Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22676 closed defect (bug) (fixed)

Do not leak media JS variable into the global namespace

Reported by: koopersmith's profile koopersmith Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch needs-testing
Focuses: Cc:

Description

Currently, media-models.js is not declaring the media variable properly, which is leaking it into the global namespace.

Test this by opening your browser console and typing media. If it's defined, that's bad.

Attachments (1)

22676.diff (420 bytes) - added by koopersmith 11 years ago.

Download all attachments as: .zip

Change History (6)

@koopersmith
11 years ago

#1 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 22968:

Avoid leaking the 'media' var into the global JS namespace. props koopersmith, fixes #22676.

#2 @nacin
11 years ago

In 22972:

Use wp.media, not media, in media-editor.js. see #22676.

#3 @nacin
11 years ago

In 22974:

wp.media instead of just media. props alexkingorg, see #22676.

#4 @nacin
11 years ago

ack --js '[^.]media\.' now just finds results in media-models, media-views, and a few tinymce/plugins/media false positives (it matches "macromedia"). Before r22972, that search finds the three in [22972] in media-editor.js and the one in [22974] in wp-plupload.

#5 @nacin
11 years ago

#22685 was marked as a duplicate.

Note: See TracTickets for help on using tickets.