Bug 1498687 - Make webcompat-reporter WebExtension load about:blank instead of about:newtab in the reporter tab. r=twisniewski
authorMike Conley <mconley@mozilla.com>
Sun, 14 Oct 2018 00:33:46 +0000
changeset 499725 942ccac42c5e7e0ef48f5ef3f1b3d18f1cf47750
parent 499724 8886fad423dc0f7de57b96512b5680eecc2733ba
child 499726 ad329ec90b6eedfdc428f8dcb08d85aed08af61d
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstwisniewski
bugs1498687
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 1498687 - Make webcompat-reporter WebExtension load about:blank instead of about:newtab in the reporter tab. r=twisniewski Differential Revision: https://phabricator.services.mozilla.com/D8596
browser/extensions/webcompat-reporter/background.js
browser/extensions/webcompat-reporter/experimentalAPIs/tabExtras.js
--- a/browser/extensions/webcompat-reporter/background.js
+++ b/browser/extensions/webcompat-reporter/background.js
@@ -104,17 +104,17 @@ async function openWebCompatTab(compatIn
   };
   if (details["gfx.webrender.all"] || details["gfx.webrender.enabled"]) {
     params.label.push("type-webrender-enabled");
   }
   if (compatInfo.hasTrackingContentBlocked) {
     params.label.push(`type-tracking-protection-${compatInfo.blockList}`);
   }
 
-  const tab = await browser.tabs.create({});
+  const tab = await browser.tabs.create({url: "about:blank"});
   const json = stripNonASCIIChars(JSON.stringify(params));
   await browser.tabExtras.loadURIWithPostData(tab.id, url.href, json,
                                               "application/json");
   await browser.tabs.executeScript(tab.id, {
     runAt: "document_end",
     code: `(function() {
       async function sendScreenshot(dataURI) {
         const res = await fetch(dataURI);
--- a/browser/extensions/webcompat-reporter/experimentalAPIs/tabExtras.js
+++ b/browser/extensions/webcompat-reporter/experimentalAPIs/tabExtras.js
@@ -116,17 +116,19 @@ this.tabExtras = class extends Extension
                        .createInstance(Ci.nsIMIMEInputStream);
           post.addHeader("Content-Type", postDataContentType ||
                                          "application/x-www-form-urlencoded");
           post.setData(stringStream);
 
           return new Promise(resolve => {
             const listener = {
               onLocationChange(browser, webProgress, request, locationURI, flags) {
-                if (webProgress.isTopLevel && browser === tab.browser) {
+                if (webProgress.isTopLevel &&
+                    browser === tab.browser &&
+                    locationURI.spec === url) {
                   windowTracker.removeListener("progress", listener);
                   resolve();
                 }
               },
             };
             windowTracker.addListener("progress", listener);
             tab.browser.webNavigation.loadURIWithOptions(url, null, null, null,
                                                          post, null, null, null);