Backed out changeset 27f8d8e9c4dc (bug 1149966) for frequent timeouts in test_form_submission.html
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 09 Jan 2017 18:42:17 -0800
changeset 328565 8f3b24109e3412b36f97277e31ad66856dc609d6
parent 328564 845cc4dea57f6cc93f46810d24b1058b640c3b74
child 328644 0b2807bcb797178c134a3ff6ae3fbb8014c2ca09
child 328701 4a7dadb4e68dab40642d4cc763881c4e0efb8733
push id31180
push userphilringnalda@gmail.com
push dateTue, 10 Jan 2017 02:42:25 +0000
treeherdermozilla-central@8f3b24109e34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1149966
milestone53.0a1
backs out27f8d8e9c4dcb7335bf182d508088469fe6384fd
first release with
nightly linux32
8f3b24109e34 / 53.0a1 / 20170110030221 / files
nightly linux64
8f3b24109e34 / 53.0a1 / 20170110030221 / files
nightly mac
8f3b24109e34 / 53.0a1 / 20170110030221 / files
nightly win32
8f3b24109e34 / 53.0a1 / 20170110030221 / files
nightly win64
8f3b24109e34 / 53.0a1 / 20170110030221 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 27f8d8e9c4dc (bug 1149966) for frequent timeouts in test_form_submission.html MozReview-Commit-ID: K5mb2MCCiGx
accessible/tests/crashtests/448064.xhtml
dom/tests/mochitest/bugs/bug346659-opener-echoer.html
dom/tests/mochitest/bugs/bug346659-parent-echoer.html
dom/tests/mochitest/bugs/test_bug346659.html
dom/tests/mochitest/bugs/test_bug61098.html
embedding/test/test_bug449141.html
testing/mochitest/tests/SimpleTest/MockObjects.js
toolkit/components/satchel/test/subtst_form_submission_1.html
toolkit/components/satchel/test/test_form_submission.html
widget/tests/chrome.ini
widget/tests/mochitest.ini
widget/tests/test_bug565392.html
--- a/accessible/tests/crashtests/448064.xhtml
+++ b/accessible/tests/crashtests/448064.xhtml
@@ -27,37 +27,40 @@ function dumpAccessibleNode(aNode, level
 		msg += " noName ";
 	}
 	
 	dump(msg + '\n');
 }
 
 
 function dumpAccessibleTree(aNode, level) {
+netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 	level = level || 0;
 
 	dumpAccessibleNode(aNode, level);
 	try {	
 		var child = aNode.firstChild;
 		while (child) {
 			dumpAccessibleTree(child, level + 1);
 			child = child.nextSibling;
 		}
 	} catch (e) {
 		dump("Error visiting child nodes: " + e + '\n');
 	}
 }
 
 function A(o) { 
-  var acc = SpecialPowers.Cc['@mozilla.org/accessibilityService;1']
-                         .getService(SpecialPowers.Ci.nsIAccessibilityService);
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  var acc = Components.classes['@mozilla.org/accessibilityService;1']
+                         .getService(Components.interfaces.nsIAccessibilityService);
   return acc.getAccessibleFor(o);
 }
 
 function beginAccessible() {
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   dumpAccessibleTree(A(document),0);
 }
 setTimeout(beginAccessible, 100);
 
 
 setTimeout(doe, 200);
 function doe() {
    document.getElementById('mw_a').appendChild(document.getElementById('mw_b'));
--- a/dom/tests/mochitest/bugs/bug346659-opener-echoer.html
+++ b/dom/tests/mochitest/bugs/bug346659-opener-echoer.html
@@ -1,6 +1,6 @@
 <script>
-  var win = SpecialPowers.wrap(window).wrappedJSObject;
-  win.opener.opener.postMessage(win.opener.testNum + " - " + win.x, "http://mochi.test:8888");
-  win.opener.close();
-  win.close();
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  window.opener.opener.postMessage(window.opener.testNum + " - " + window.x, "http://mochi.test:8888");
+  window.opener.close();
+  window.close();
 </script>
--- a/dom/tests/mochitest/bugs/bug346659-parent-echoer.html
+++ b/dom/tests/mochitest/bugs/bug346659-parent-echoer.html
@@ -1,5 +1,5 @@
 <script>
-  var win = SpecialPowers.wrap(window).wrappedJSObject;
-  win.parent.opener.postMessage(win.parent.testNum + " - " + win.x, "http://mochi.test:8888");
-  win.parent.close();
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  window.parent.opener.postMessage(window.parent.testNum + " - " + window.x, "http://mochi.test:8888");
+  window.parent.close();
 </script>
--- a/dom/tests/mochitest/bugs/test_bug346659.html
+++ b/dom/tests/mochitest/bugs/test_bug346659.html
@@ -32,21 +32,24 @@ function handleCmd(evt) {
   var cmd;
   try {
     cmd = JSON.parse(evt.data);
   } catch (e) {
     // Not json
     return false;
   }  
 
+  // Grab privileges so we can access cross-domain windows
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
   if ("load" in cmd) {
     var testNum = cmd.load;
-    var win = SpecialPowers.wrap(wins[testNum]).wrappedJSObject;
+    var win = wins[testNum];
     win.childWin.x = testNum;
-    if (SpecialPowers.unwrap(win.childWin.opener) == SpecialPowers.unwrap(win)) {
+    if (win.childWin.opener == win) {
       if ("xsite" in cmd) {
         var loc = r(window.location.href, "bug346659-opener-echoer.html");
       } else {
         var loc = r(win.location.href, "bug346659-opener-echoer.html");
       }
     } else {
       if ("xsite" in cmd) {
         var loc = r(window.location.href, "bug346659-parent-echoer.html");
--- a/dom/tests/mochitest/bugs/test_bug61098.html
+++ b/dom/tests/mochitest/bugs/test_bug61098.html
@@ -24,21 +24,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 var mockPromptServiceRegisterer, mockPromptFactoryRegisterer;
 
 var promptState;
 
 function registerMockPromptService()
 {
+  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   var XPCOMUtils = SpecialPowers.Cu.import("resource://gre/modules/XPCOMUtils.jsm").XPCOMUtils;
   var Ci = SpecialPowers.Ci;
 
   function MockPrompt(aDOMWindow) {
-    this.domWindow = SpecialPowers.unwrap(aDOMWindow);
+    this.domWindow = aDOMWindow;
   }
 
   MockPrompt.prototype = {
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrompt]),
 
     domWindow : null,
 
     _toggleModalState: function()
--- a/embedding/test/test_bug449141.html
+++ b/embedding/test/test_bug449141.html
@@ -87,15 +87,16 @@ function persistDocument(aDoc) {
                          folder,
                          aDoc.contentType,
                          encodingFlags, kWrapColumn);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 addLoadEvent(function() {
+    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     var srcDoc = document.getElementById('source').contentDocument;
     persistDocument(srcDoc);
 });
 </script>
 </pre>
 </body>
 </html>
--- a/testing/mochitest/tests/SimpleTest/MockObjects.js
+++ b/testing/mochitest/tests/SimpleTest/MockObjects.js
@@ -32,62 +32,59 @@ MockObjectRegisterer.prototype = {
    * restore the original component. Usually, you should use a try-catch block
    * to ensure that unregister() is called.
    */
   register: function MOR_register() {
     if (this._originalFactory)
       throw new Exception("Invalid object state when calling register()");
 
     // Define a factory that creates a new object using the given constructor.
-    var isChrome = location.protocol == "chrome:";
     var providedConstructor = this._replacementCtor;
     this._mockFactory = {
       createInstance: function MF_createInstance(aOuter, aIid) {
         if (aOuter != null)
           throw SpecialPowers.Cr.NS_ERROR_NO_AGGREGATION;
-        var inst = new providedConstructor();
-        if (!isChrome) {
-          var QI = inst.QueryInterface;
-          inst = SpecialPowers.wrapCallbackObject(inst);
-          inst.QueryInterface = QI;
-        }
-        return inst.QueryInterface(aIid);
+        return new providedConstructor().QueryInterface(aIid);
       }
     };
-    if (!isChrome) {
-      this._mockFactory = SpecialPowers.wrapCallbackObject(this._mockFactory);
-    }
 
-    var retVal = SpecialPowers.swapFactoryRegistration(null, this._contractID, this._mockFactory, this._originalFactory);
+    var retVal = SpecialPowers.swapFactoryRegistration(this._cid, this._contractID, this._mockFactory, this._originalFactory);
     if ('error' in retVal) {
       throw new Exception("ERROR: " + retVal.error);
     } else {
-      this._originalFactory = SpecialPowers.wrap(retVal).originalFactory;
+      this._cid = retVal.cid;
+      this._originalFactory = retVal.originalFactory;
     }
   },
 
   /**
    * Restores the original factory.
    */
   unregister: function MOR_unregister() {
     if (!this._originalFactory)
       throw new Exception("Invalid object state when calling unregister()");
 
     // Free references to the mock factory.
-    SpecialPowers.swapFactoryRegistration(null, this._contractID, this._originalFactory, this._mockFactory);
+    SpecialPowers.swapFactoryRegistration(this._cid, this._contractID, this._mockFactory, this._originalFactory);
 
     // Allow registering a mock factory again later.
+    this._cid = null;
     this._originalFactory = null;
     this._mockFactory = null;
   },
 
   // --- Private methods and properties ---
 
   /**
    * The factory of the component being replaced.
    */
   _originalFactory: null,
 
   /**
+   * The CID under which the mock contractID was registered.
+   */
+  _cid: null,
+
+  /**
    * The nsIFactory that was automatically generated by this object.
    */
   _mockFactory: null
 }
--- a/toolkit/components/satchel/test/subtst_form_submission_1.html
+++ b/toolkit/components/satchel/test/subtst_form_submission_1.html
@@ -12,28 +12,19 @@
 </form>
 
 <form id="subform2" onsubmit="return checkSubmit(100)">
   <input id="subtest2" type="text" name="subtest2">
   <button type="submit">Submit</button>
 </form>
 
 <script>
-  var parentOrigin = "http://mochi.test:8888";
-  window.addEventListener("message", receiveMessage, false);
-  function receiveMessage(event) {
-    if (event.origin !== parentOrigin) {
-      parent.postMessage({error: "unexpected origin " + event.origin}, parentOrigin);
-      return;
-    }
-    clickButton(+event.data);
-  }
-
   function checkSubmit(num) {
-    return parent.postMessage({num}, parentOrigin);
+    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+    return parent.checkSubmit(num);
   }
 
   function clickButton(num) {
     if (num == 21)
       document.querySelectorAll("button")[0].click();
     else if (num == 100)
       document.querySelectorAll("button")[1].click();
   }
--- a/toolkit/components/satchel/test/test_form_submission.html
+++ b/toolkit/components/satchel/test/test_form_submission.html
@@ -251,26 +251,16 @@
     <input type="text" name="test10">
     <button type="submit">Submit</button>
   </form>
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /* import-globals-from satchel_common.js */
-var iframeOrigin = "https://example.com";
-window.addEventListener("message", receiveMessage, false);
-function receiveMessage(event) {
-  is(event.origin, iframeOrigin, "checking origin");
-  if (event.data.error) {
-    ok(false, event.data.error);
-  }
-  checkSubmit(+event.data.num);
-}
-
 var numSubmittedForms = 0;
 
 var ccNumbers = {
   valid15: [
     "930771457288760", "474915027480942",
     "924894781317325", "714816113937185",
     "790466087343106", "474320195408363",
     "219211148122351", "633038472250799",
@@ -370,16 +360,17 @@ function startTest() {
   // submit the first form.
   var button = getFormSubmitButton(1);
   button.click();
 }
 
 
 // Called by each form's onsubmit handler.
 function checkSubmit(formNum) {
+  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
   ok(true, "form " + formNum + " submitted");
   numSubmittedForms++;
 
   // Check for expected storage state.
   switch (formNum) {
     // Test 1-24 should not save anything.
     case 1:
@@ -505,17 +496,17 @@ function submitForm(formNum) {
   setTimeout(function() {
     checkObserver.waitForChecks(function() {
       var nextFormNum = formNum == 24 ? 100 : (formNum + 1);
 
       // Submit the next form. Special cases are Forms 21 and 100, which happen
       // from an HTTPS domain in an iframe.
       if (nextFormNum == 21 || nextFormNum == 100) {
         ok(true, "submitting iframe test " + nextFormNum);
-        document.getElementById("iframe").contentWindow.postMessage(nextFormNum, iframeOrigin);
+        document.getElementById("iframe").contentWindow.clickButton(nextFormNum);
       } else {
         var button = getFormSubmitButton(nextFormNum);
         button.click();
       }
     });
   }, 0);
 
   return false; // cancel current form submission
--- a/widget/tests/chrome.ini
+++ b/widget/tests/chrome.ini
@@ -11,19 +11,16 @@ support-files = window_bug429954.xul
 [test_bug444800.xul]
 subsuite = clipboard
 [test_bug478536.xul]
 skip-if = true # Bug 561929
 support-files = window_bug478536.xul
 [test_bug517396.xul]
 [test_bug538242.xul]
 support-files = window_bug538242.xul
-[test_bug565392.html]
-subsuite = clipboard
-skip-if = toolkit != "windows"
 [test_bug593307.xul]
 support-files = window_bug593307_offscreen.xul window_bug593307_centerscreen.xul
 [test_bug1151186.html]
 skip-if = os == 'linux' && debug #Bug 1176038
 [test_keycodes.xul]
 [test_wheeltransaction.xul]
 support-files = window_wheeltransaction.xul
 [test_imestate.html]
--- a/widget/tests/mochitest.ini
+++ b/widget/tests/mochitest.ini
@@ -1,9 +1,12 @@
 [DEFAULT]
 support-files = utils.js
 
 [test_assign_event_data.html]
 subsuite = clipboard
 skip-if = toolkit == "cocoa" # Mac: Bug 933303
+[test_bug565392.html]
+subsuite = clipboard
+skip-if = toolkit != "windows" || e10s # Bug 1267406
 [test_picker_no_crash.html]
 skip-if = toolkit != "windows" || e10s # Bug 1267491
 support-files = window_picker_no_crash_child.html
--- a/widget/tests/test_bug565392.html
+++ b/widget/tests/test_bug565392.html
@@ -1,29 +1,30 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=565392
 -->
 <head>
   <title>Test for Bug 565392</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565392">Mozilla Bug 565392</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 565392 **/
 
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   const Cc = SpecialPowers.Cc;
   const Ci = SpecialPowers.Ci;
   var ds = Cc["@mozilla.org/file/directory_service;1"]
              .getService(Ci.nsIProperties);
   var dir1 = ds.get("ProfD", Ci.nsIFile);
   var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
                     .getService(Ci.nsIClipboard);