Bug 1163911 - Make responsive images block the document load event while the load task is queued. r=jst
authorJosh Matthews <josh@joshmatthews.net>
Sat, 06 Jun 2015 09:21:56 -0400
changeset 278328 b638e3dea13fafb10f201fc20dc7de4a94e50bb9
parent 278327 f1c34cec973b1cc8c6e48e10028d7c2e2d31f6c8
child 278329 6e74f27a5ab0d8d923ce9b1a51db4647d5fb2708
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1163911
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1163911 - Make responsive images block the document load event while the load task is queued. r=jst
dom/html/HTMLImageElement.cpp
dom/html/test/mochitest.ini
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -80,30 +80,35 @@ namespace dom {
 // Calls LoadSelectedImage on host element unless it has been superseded or
 // canceled -- this is the synchronous section of "update the image data".
 // https://html.spec.whatwg.org/multipage/embedded-content.html#update-the-image-data
 class ImageLoadTask : public nsRunnable
 {
 public:
   explicit ImageLoadTask(HTMLImageElement *aElement) :
     mElement(aElement)
-  {}
+  {
+    mDocument = aElement->OwnerDoc();
+    mDocument->BlockOnload();
+  }
 
   NS_IMETHOD Run()
   {
     if (mElement->mPendingImageLoadTask == this) {
       mElement->mPendingImageLoadTask = nullptr;
       mElement->LoadSelectedImage(true, true);
     }
+    mDocument->UnblockOnload(false);
     return NS_OK;
   }
 
 private:
   ~ImageLoadTask() {}
   nsRefPtr<HTMLImageElement> mElement;
+  nsCOMPtr<nsIDocument> mDocument;
 };
 
 HTMLImageElement::HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
   , mForm(nullptr)
 {
   // We start out broken
   AddStatesSilently(NS_EVENT_STATE_BROKEN);
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -589,10 +589,9 @@ skip-if = buildapp == 'b2g' || e10s
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
 support-files = file_bug871161-1.html file_bug871161-2.html
 [test_bug1013316.html]
 [test_hash_encoded.html]
 [test_bug1081037.html]
 [test_window_open_close.html]
 skip-if = buildapp == 'b2g' # bug 1129014
 [test_img_complete.html]
-[test_viewport_resize.html]
-skip-if = os == 'win' || os == 'mac' # bug 1163911
\ No newline at end of file
+[test_viewport_resize.html]
\ No newline at end of file