Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#36236 closed defect (bug) (fixed)

JS error & odd behaviour when attempting to set image as 'site icon'

Reported by: anonymized_13665966 Owned by: ocean90
Priority: normal Milestone: 4.6
Component: Customize Version: 4.4.2
Severity: normal Keywords: has-patch
Cc: Focuses: javascript

Description

When attempting to select an image for use with the 'site icon' feature in the customizer, the following JS error is generated:

b.trigger is not a function

Steps taken:

  1. Click on 'Select Image' in the Site Identity section of the Customize UI.

Upload brand new image to the media.

  1. Uploaded a brand new image, exactly 512px x 512px, 23kb file size, 72 DPI
  2. Hit 'Select'

The image is then de-selected in the media library, and nothing else happens except the generation of the above error in the console.

Tried in FF Dev Edition and latest stable Chrome.

Interestingly, if I close the Media Library, exit the Customize UI and then come back and try to Select Image again there are several files using the site-icon-cropped-X.jpg nomenclature that have been generated.

Clicking one of these images lets me actually select the image for use as the site-icon, the others have no effect.

Attachments (1)

36236.diff​ (537 bytes ) - added by celloexpressions 10 years ago.

Download all attachments as: .zip

Change History (10)

#1 @westonruter
11 years ago

  • Keywords reporter-feedback added

@davetgreen what version of are you testing with? Is it 4.5-beta3 or is it 4.4.2? I cannot seem to reproduce the issue in trunk.

#2 @westonruter
11 years ago

Also, if you could add define( 'SCRIPT_DEBUG', true ); to your wp-config.php that will allow for a better error message to be generated, including the file and line number where the error is happening. Please share those details as well.

#3 @anonymized_13665966
11 years ago

  • Version trunk → 4.4.2

@westonruter Apologies, it's actually 4.4.2 I'm building this site with: I don't know why I flagged this as trunk!

controller.trigger is not a function

File: customize-controls.js
Row: 2249
Column: 6

Version 0, edited 11 years ago by anonymized_13665966 (next)

#4 @westonruter
11 years ago

  • Keywords reporter-feedback removed

OK, the issue is being triggered here: https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-admin/js/customize-controls.js?marks=2249#L2224

I'm not familiar enough with the Media Backbone to recognize immediately why this would fail. @ericlewis?

#5 @ericlewis
11 years ago

  • Focuses javascript added
  • Keywords reporter-feedback added

I'm not sure why it would fail either, but also not sure why controller.trigger would be undefined.

@davetgreen, can you reproduce the bug with all plugins disabled and a default theme active?

If so, can you attach the image you're uploading, and we'll see if we can reproduce.

#6 @adamsilverstein
11 years ago

@davetgreen Can you test against trunk to see if you can reproduce the issue there as well?

#7 @anonymized_13665966
11 years ago

@ericlewis @adamsilverstein I'll be back to you with the results of these tests a bit later today.

#8 @celloexpressions
10 years ago

  • Keywords has-patch added; reporter-feedback removed
  • Milestone Awaiting Review → 4.6

controller is supposed to be controller.frame in this case, see patch. controller is the customizer control object, but in this case it should actually be the media frame (controller.frame). I can confirm that this change prevents a JS error from being thrown, although it doesn't provide information on the error to the user. If nothing else though, let's get the JS error fix in.

#9 @ocean90
10 years ago

  • Owner set to ocean90
  • Resolution → fixed
  • Status new → closed

In 37955:

Customize: Use the correct variable when referring to the media frame.

Props celloexpressions.
Fixes #36236.

Note: See TracTickets for help on using tickets.