Backed out 2 changesets (bug 1129957) for frequent browser_privatebrowsing_DownloadLastDirWithCPS.js timeouts a=merge
authorWes Kocher <wkocher@mozilla.com>
Wed, 10 Jun 2015 14:38:40 -0700
changeset 248157 1fd19d8fc936e6a7c5b6f89cd6652040b531e51c
parent 248156 f1927654c8960460f10701550a22e69b907011d4
child 248158 04c057942da4dd4800432e8bea912c9f6bc8e636
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
bugs1129957
milestone41.0a1
backs out9ac1d4aadc38dbec98cd0cd4bae6a9ff474dd8e8
109474240d8cd0fb38839d92b2d2722ef16f0911
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
Backed out 2 changesets (bug 1129957) for frequent browser_privatebrowsing_DownloadLastDirWithCPS.js timeouts a=merge Backed out changeset 9ac1d4aadc38 (bug 1129957) Backed out changeset 109474240d8c (bug 1129957)
browser/base/content/browser.js
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/Utils.jsm
toolkit/content/browser-child.js
toolkit/modules/RemoteWebNavigation.jsm
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -871,42 +871,37 @@ function _loadURIWithFlags(browser, uri,
   if (!uri) {
     uri = "about:blank";
   }
   let flags = params.flags || 0;
   let referrer = params.referrerURI;
   let referrerPolicy = ('referrerPolicy' in params ? params.referrerPolicy :
                         Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
   let charset = params.charset;
-  let postData = params.postData;
+  let postdata = params.postData;
 
   if (!(flags & browser.webNavigation.LOAD_FLAGS_FROM_EXTERNAL)) {
     browser.userTypedClear++;
   }
 
   let process = browser.isRemoteBrowser ? Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
                                         : Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
   let mustChangeProcess = gMultiProcessBrowser &&
                           !E10SUtils.canLoadURIInProcess(uri, process);
   try {
     if (!mustChangeProcess) {
       browser.webNavigation.loadURIWithOptions(uri, flags,
                                                referrer, referrerPolicy,
-                                               postData, null, null);
+                                               postdata, null, null);
     } else {
-      if (postData) {
-        postData = NetUtil.readInputStreamToString(postData, postData.available());
-      }
-
       LoadInOtherProcess(browser, {
         uri: uri,
         flags: flags,
         referrer: referrer ? referrer.spec : null,
         referrerPolicy: referrerPolicy,
-        postData: postData,
       });
     }
   } catch (e) {
     // If anything goes wrong just switch remoteness manually and load the URI.
     // We might lose history that way but at least the browser loaded a page.
     // This might be necessary if SessionStore wasn't initialized yet i.e.
     // when the homepage is a non-remote page.
     gBrowser.updateBrowserRemotenessByURL(browser, uri);
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -350,17 +350,16 @@ skip-if = buildapp == 'mulet' || e10s # 
 [browser_private_browsing_window.js]
 skip-if = buildapp == 'mulet'
 [browser_private_no_prompt.js]
 skip-if = buildapp == 'mulet'
 [browser_relatedTabs.js]
 [browser_remoteTroubleshoot.js]
 support-files =
   test_remoteTroubleshoot.html
-[browser_remoteWebNavigation_postdata.js]
 [browser_removeTabsToTheEnd.js]
 [browser_removeUnsafeProtocolsFromURLBarPaste.js]
 [browser_restore_isAppTab.js]
 [browser_sanitize-passwordDisabledHosts.js]
 [browser_sanitize-sitepermissions.js]
 [browser_sanitize-timespans.js]
 skip-if = buildapp == 'mulet'
 [browser_sanitizeDialog.js]
deleted file mode 100644
--- a/browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Cu.import("resource://gre/modules/BrowserUtils.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-
-function makeInputStream(aString) {
-  let stream = Cc["@mozilla.org/io/string-input-stream;1"]
-                 .createInstance(Ci.nsIStringInputStream);
-  stream.data = aString;
-  return stream; // XPConnect will QI this to nsIInputStream for us.
-}
-
-add_task(function* test_remoteWebNavigation_postdata() {
-  let obj = {};
-  Cu.import("resource://testing-common/httpd.js", obj);
-  Cu.import("resource://services-common/utils.js", obj);
-
-  let server = new obj.HttpServer();
-  server.start(-1);
-
-  let loadDeferred = Promise.defer();
-
-  server.registerPathHandler("/test", (request, response) => {
-    let body = obj.CommonUtils.readBytesFromInputStream(request.bodyInputStream);
-    is(body, "success", "request body is correct");
-    is(request.method, "POST", "request was a post");
-    response.write("Received from POST: " + body);
-    loadDeferred.resolve();
-  });
-
-  let i = server.identity;
-  let path = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort + "/test";
-
-  let postdata =
-    "Content-Length: 7\r\n" +
-    "Content-Type: application/x-www-form-urlencoded\r\n" +
-    "\r\n" +
-    "success";
-
-  openUILinkIn(path, "tab", null, makeInputStream(postdata));
-
-  yield loadDeferred.promise;
-  yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
-
-  let serverStoppedDeferred = Promise.defer();
-  server.stop(function() { serverStoppedDeferred.resolve(); });
-  yield serverStoppedDeferred.promise;
-});
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -197,21 +197,19 @@ ContentRestoreInternal.prototype = {
       if (loadArguments) {
         // A load has been redirected to a new process so get history into the
         // same state it was before the load started then trigger the load.
         let referrer = loadArguments.referrer ?
                        Utils.makeURI(loadArguments.referrer) : null;
         let referrerPolicy = ('referrerPolicy' in loadArguments
             ? loadArguments.referrerPolicy
             : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
-        let postData = loadArguments.postData ?
-                       Utils.makeInputStream(loadArguments.postData) : null;
         webNavigation.loadURIWithOptions(loadArguments.uri, loadArguments.flags,
-                                         referrer, referrerPolicy, postData,
-                                         null, null);
+                                         referrer, referrerPolicy, null, null,
+                                         null);
       } else if (tabData.userTypedValue && tabData.userTypedClear) {
         // If the user typed a URL into the URL bar and hit enter right before
         // we crashed, we want to start loading that page again. A non-zero
         // userTypedClear value means that the load had started.
         // Load userTypedValue and fix up the URL if it's partial/broken.
         webNavigation.loadURI(tabData.userTypedValue,
                               Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
                               null, null, null);
--- a/browser/components/sessionstore/Utils.jsm
+++ b/browser/components/sessionstore/Utils.jsm
@@ -2,33 +2,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["Utils"];
 
 const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
 
 Cu.import("resource://gre/modules/Services.jsm", this);
 
 this.Utils = Object.freeze({
   makeURI: function (url) {
     return Services.io.newURI(url, null, null);
   },
 
-  makeInputStream: function (aString) {
-    let stream = Cc["@mozilla.org/io/string-input-stream;1"].
-                 createInstance(Ci.nsISupportsCString);
-    stream.data = aString;
-    return stream; // XPConnect will QI this to nsIInputStream for us.
-  },
-
   /**
    * Returns true if the |url| passed in is part of the given root |domain|.
    * For example, if |url| is "www.mozilla.org", and we pass in |domain| as
    * "mozilla.org", this will return true. It would return false the other way
    * around.
    */
   hasRootDomain: function (url, domain) {
     let host;
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -16,23 +16,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource://gre/modules/PageThumbUtils.jsm");
 
 if (AppConstants.MOZ_CRASHREPORTER) {
   XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
                                      "@mozilla.org/xre/app-info;1",
                                      "nsICrashReporter");
 }
 
-function makeInputStream(aString) {
-  let stream = Cc["@mozilla.org/io/string-input-stream;1"].
-               createInstance(Ci.nsISupportsCString);
-  stream.data = aString;
-  return stream; // XPConnect will QI this to nsIInputStream for us.
-}
-
 let WebProgressListener = {
   init: function() {
     this._filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
                      .createInstance(Ci.nsIWebProgress);
     this._filter.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_ALL);
 
     let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
@@ -245,17 +238,16 @@ let WebNavigation =  {
         this.goForward();
         break;
       case "WebNavigation:GotoIndex":
         this.gotoIndex(message.data.index);
         break;
       case "WebNavigation:LoadURI":
         this.loadURI(message.data.uri, message.data.flags,
                      message.data.referrer, message.data.referrerPolicy,
-                     message.data.postData, message.data.headers,
                      message.data.baseURI);
         break;
       case "WebNavigation:Reload":
         this.reload(message.data.flags);
         break;
       case "WebNavigation:Stop":
         this.stop(message.data.flags);
         break;
@@ -272,38 +264,34 @@ let WebNavigation =  {
     if (this.webNavigation.canGoForward)
       this.webNavigation.goForward();
   },
 
   gotoIndex: function(index) {
     this.webNavigation.gotoIndex(index);
   },
 
-  loadURI: function(uri, flags, referrer, referrerPolicy, postData, headers, baseURI) {
+  loadURI: function(uri, flags, referrer, referrerPolicy, baseURI) {
     if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
       let annotation = uri;
       try {
         let url = Services.io.newURI(uri, null, null);
         // If the current URI contains a username/password, remove it.
         url.userPass = "";
         annotation = url.spec;
       } catch (ex) { /* Ignore failures to parse and failures
                       on about: URIs. */ }
       CrashReporter.annotateCrashReport("URL", annotation);
     }
     if (referrer)
       referrer = Services.io.newURI(referrer, null, null);
-    if (postData)
-      postData = makeInputStream(postData);
-    if (headers)
-      headers = makeInputStream(headers);
     if (baseURI)
       baseURI = Services.io.newURI(baseURI, null, null);
     this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
-                                          postData, headers, baseURI);
+                                          null, null, baseURI);
   },
 
   reload: function(flags) {
     this.webNavigation.reload(flags);
   },
 
   stop: function(flags) {
     this.webNavigation.stop(flags);
--- a/toolkit/modules/RemoteWebNavigation.jsm
+++ b/toolkit/modules/RemoteWebNavigation.jsm
@@ -11,22 +11,16 @@ Cu.import("resource://gre/modules/XPCOMU
 
 function makeURI(url)
 {
   return Cc["@mozilla.org/network/io-service;1"].
          getService(Ci.nsIIOService).
          newURI(url, null, null);
 }
 
-function readInputStreamToString(aStream)
-{
-  Cu.import("resource://gre/modules/NetUtil.jsm");
-  return NetUtil.readInputStreamToString(aStream, aStream.available());
-}
-
 function RemoteWebNavigation(browser)
 {
   this.swapBrowser(browser);
 }
 
 RemoteWebNavigation.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebNavigation, Ci.nsISupports]),
 
@@ -74,23 +68,24 @@ RemoteWebNavigation.prototype = {
   },
   loadURI: function(aURI, aLoadFlags, aReferrer, aPostData, aHeaders) {
     this.loadURIWithOptions(aURI, aLoadFlags, aReferrer,
                             Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
                             aPostData, aHeaders, null);
   },
   loadURIWithOptions: function(aURI, aLoadFlags, aReferrer, aReferrerPolicy,
                                aPostData, aHeaders, aBaseURI) {
+    if (aPostData || aHeaders)
+      throw Components.Exception("RemoteWebNavigation doesn't accept postdata or headers.", Cr.NS_ERROR_INVALID_ARGS);
+
     this._sendMessage("WebNavigation:LoadURI", {
       uri: aURI,
       flags: aLoadFlags,
       referrer: aReferrer ? aReferrer.spec : null,
       referrerPolicy: aReferrerPolicy,
-      postData: aPostData ? readInputStreamToString(aPostData) : null,
-      headers: aHeaders ? readInputStreamToString(aHeaders) : null,
       baseURI: aBaseURI ? aBaseURI.spec : null,
     });
   },
   reload: function(aReloadFlags) {
     this._sendMessage("WebNavigation:Reload", {flags: aReloadFlags});
   },
   stop: function(aStopFlags) {
     this._sendMessage("WebNavigation:Stop", {flags: aStopFlags});