This issue seems related to #1503340: Stuck in overlay after upload, no way to close modal dialog in that the media item upload stalls on the upload success message.

https://skitch.com/jesse.beach/85sy1/windows-7-32-ie-9-native-running

In the error we encountered, Internet Explorer is choking on the this reference to the object that triggered the iframe load event, namely the iframe. this doesn't refer to the iframe.

Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad = function (e) {
  var options = e.data;
  if (this.contentWindow.Drupal.media.browser.selectedMedia.length > 0) {
    var ok = $(this).dialog('option', 'buttons')['OK'];
    ok.call(this);
    return;
  }
};
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jessebeach’s picture

Instead of using this to refer to the iframe that triggered the load event, I changed the reference to the target of the event object. From the srcElement property on the event object, IE correctly gets a reference to the iframe from which we can further reference the contentWindow and its properties.

Also, the onload property can't be directly manipulated in IE. The attachEvent method of the iframe element must be invoked in order for the assigned load handling function to fire in a timely manner (i.e. in less than 10 seconds!). So I replaced code that binds the iframe onLoad handler to the load event. Instead, the attachEvent method is used if the method exists on the iframe element (in IE), and use onload property of the iframe otherwise.

katbailey’s picture

Status: Active » Needs review
FileSize
2.28 KB

Needed a version of this that would apply on top of #1364640: Upload popup window doesn't work with translated interface ;-)

Also, setting the status to "needs review"...

Status: Needs review » Needs work

The last submitted patch, 1595194_media_ie-image-upload-error_2.patch, failed testing.

katbailey’s picture

*facepalm*

DamienMcKenna’s picture

Version: 7.x-1.0-rc3 » 7.x-2.x-dev
Status: Needs work » Needs review
FileSize
2.3 KB

Rerolled for v7.x-2.x.

DamienMcKenna’s picture

FileSize
2.3 KB

Oops, there was an errant plus symbol in the last patch.

DamienMcKenna’s picture

The patch doesn't work with the latest v2, it rolls up the popup to a ~20px-tall bar after the image uploads so you can't see the form to finish the upload process.

DamienMcKenna’s picture

FileSize
2.3 KB

This version at least fixes a typo in a comment, I can do that much =)

DamienMcKenna’s picture

Issue summary: View changes

Corrected an issue reference tag.

SocialNicheGuru’s picture

Issue summary: View changes

so does #8 fix #7 issue?

Chris Matthews’s picture

Assigned: jessebeach » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch in #8 to media.popups.js does not apply to the latest media 7.x-2.x-dev and if still relevant needs to be rerolled.

Checking patch js/media.popups.js...
Hunk #1 succeeded at 14 (offset -1 lines).
error: while searching for:

  browserSrc += '&' + $.param(params);
  var mediaIframe = Drupal.media.popups.getPopupIframe(browserSrc, 'mediaBrowser');
  // Attach the onLoad event
  mediaIframe.bind('load', options, options.widget.onLoad);
  /**
   * Setting up the modal dialog
   */

  var ok = 'OK';
  var cancel = 'Cancel';
  var notSelected = 'You have not selected anything!';

error: patch failed: js/media.popups.js:56
error: js/media.popups.js: patch does not apply
DamienMcKenna’s picture

OTOH does anyone still care about IE 9?

joseph.olstad’s picture

Status: Needs work » Closed (won't fix)

NOPE :\