Backed out changesets e85722c30be3 and 28714f577de0 (bug 1097419) for B2G timeouts.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 26 Dec 2014 12:09:24 -0500
changeset 238128 088cfed82c741a367e7e0f4f63083766d8489cb0
parent 238127 5f429eb915588e9551fb1168d5f2920d7e0e09c8
child 238129 a3cfb26fff61f2ae01b4c1f71b2fd72e421709ee
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1097419
milestone37.0a1
backs oute85722c30be37b7eddec9485707546a5c13020e3
28714f577de0b501dfffb8c961cc8877c3d4ac95
Backed out changesets e85722c30be3 and 28714f577de0 (bug 1097419) for B2G timeouts.
dom/browser-element/BrowserElementChildPreload.js
dom/browser-element/mochitest/browserElement_CopyPaste.js
dom/browser-element/mochitest/file_NestedFramesOuter_CopyPaste.html
dom/browser-element/mochitest/mochitest.ini
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -159,27 +159,27 @@ BrowserElementChild.prototype = {
 
     addEventListener('DOMMetaRemoved',
                      this._metaChangedHandler.bind(this),
                      /* useCapture = */ true,
                      /* wantsUntrusted = */ false);
 
     addEventListener('mozselectionstatechanged',
                      this._selectionStateChangedHandler.bind(this),
-                     /* useCapture = */ true,
+                     /* useCapture = */ false,
                      /* wantsUntrusted = */ false);
 
     addEventListener('scrollviewchange',
                      this._ScrollViewChangeHandler.bind(this),
-                     /* useCapture = */ true,
+                     /* useCapture = */ false,
                      /* wantsUntrusted = */ false);
 
     addEventListener('touchcarettap',
                      this._touchCaretTapHandler.bind(this),
-                     /* useCapture = */ true,
+                     /* useCapture = */ false,
                      /* wantsUntrusted = */ false);
 
 
     // This listens to unload events from our message manager, but /not/ from
     // the |content| window.  That's because the window's unload event doesn't
     // bubble, and we're not using a capturing listener.  If we'd used
     // useCapture == true, we /would/ hear unload events from the window, which
     // is not what we want!
@@ -657,23 +657,23 @@ BrowserElementChild.prototype = {
       zoomFactor: zoomFactor,
       states: e.states,
       isCollapsed: (e.selectedText.length == 0),
       visible: e.visible,
     };
 
     // Get correct geometry information if we have nested iframe.
     let currentWindow = e.target.defaultView;
-    while (currentWindow.realFrameElement) {
-      let currentRect = currentWindow.realFrameElement.getBoundingClientRect();
+    while (currentWindow.top != currentWindow) {
+      let currentRect = currentWindow.frameElement.getBoundingClientRect();
       detail.rect.top += currentRect.top;
       detail.rect.bottom += currentRect.top;
       detail.rect.left += currentRect.left;
       detail.rect.right += currentRect.left;
-      currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
+      currentWindow = currentWindow.parent;
     }
 
     sendAsyncMsg('selectionstatechanged', detail);
   },
 
   _themeColorChangedHandler: function(eventType, target) {
     let meta = {
       name: 'theme-color',
--- a/dom/browser-element/mochitest/browserElement_CopyPaste.js
+++ b/dom/browser-element/mochitest/browserElement_CopyPaste.js
@@ -5,27 +5,24 @@
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 browserElementTestHelpers.setEnabledPref(true);
 browserElementTestHelpers.setSelectionChangeEnabledPref(true);
 browserElementTestHelpers.addPermission();
 const { Services } = SpecialPowers.Cu.import('resource://gre/modules/Services.jsm');
-
 var gTextarea = null;
 var mm;
-var iframeOuter;
-var iframeInner;
+var iframe;
 var state = 0;
 var stateMeaning;
 var defaultData;
 var pasteData;
 var focusScript;
-var createEmbededFrame = false;
 
 function copyToClipboard(str) {
   gTextarea.value = str;
   SpecialPowers.wrap(gTextarea).editor.selectAll();
   SpecialPowers.wrap(gTextarea).editor.copy();
 }
 
 function getScriptForGetContent() {
@@ -44,140 +41,115 @@ function getScriptForGetContent() {
 }
 
 function getScriptForSetFocus() {
   var script = 'data:,' + focusScript + 'sendAsyncMessage("content-focus")';
   return script;
 }
 
 function runTest() {
-  iframeOuter = document.createElement('iframe');
-  iframeOuter.setAttribute('mozbrowser', 'true');
-  if (createEmbededFrame) {
-    iframeOuter.src = "file_NestedFramesOuter_CopyPaste.html";
-  }
-  document.body.appendChild(iframeOuter);
+  iframe = document.createElement('iframe');
+  iframe.setAttribute('mozbrowser', 'true');
+  document.body.appendChild(iframe);
 
   gTextarea = document.createElement('textarea');
   document.body.appendChild(gTextarea);
 
-  iframeOuter.addEventListener("mozbrowserloadend", function onloadend(e) {
-    iframeOuter.removeEventListener("mozbrowserloadend", onloadend);
+  mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
-    if (createEmbededFrame) {
-      var contentWin = SpecialPowers.wrap(iframeOuter)
-                             .QueryInterface(SpecialPowers.Ci.nsIFrameLoaderOwner)
-                             .frameLoader.docShell.contentViewer.DOMDocument.defaultView;
-      var contentDoc = contentWin.document;
-      iframeInner = contentDoc.getElementById('iframeInner');
-      iframeInner.addEventListener("mozbrowserloadend", function onloadendinner(e) {
-        iframeInner.removeEventListener("mozbrowserloadend", onloadendinner);
-        mm = SpecialPowers.getBrowserFrameMessageManager(iframeInner);
-        dispatchTest(e);
-      });
-    } else {
-      iframeInner = iframeOuter;
-      mm = SpecialPowers.getBrowserFrameMessageManager(iframeInner);
-      dispatchTest(e);
-    }
+  iframe.addEventListener("mozbrowserloadend", function onloadend(e) {
+    iframe.removeEventListener("mozbrowserloadend", onloadend);
+    dispatchTest(e);
   });
 }
 
 function doCommand(cmd) {
-  Services.obs.notifyObservers({wrappedJSObject: SpecialPowers.unwrap(iframeInner)},
+  Services.obs.notifyObservers({wrappedJSObject: iframe},
                                'copypaste-docommand', cmd);
 }
 
 function dispatchTest(e) {
-  iframeInner.addEventListener("mozbrowserloadend", function onloadend2(e) {
-    iframeInner.removeEventListener("mozbrowserloadend", onloadend2);
+  iframe.addEventListener("mozbrowserloadend", function onloadend2(e) {
+    iframe.removeEventListener("mozbrowserloadend", onloadend2);
     SimpleTest.executeSoon(function() { testSelectAll(e); });
   });
 
   switch (state) {
     case 0: // test for textarea
       defaultData = "Test for selection change event";
       pasteData = "from parent ";
-      iframeInner.src = "data:text/html,<html><body>" +
+      iframe.src = "data:text/html,<html><body>" +
                    "<textarea id='text'>" + defaultData + "</textarea>" +
                    "</body>" +
                    "</html>";
       stateMeaning = " (test: textarea)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();elt.select();";
       break;
     case 1: // test for input text
       defaultData = "Test for selection change event";
       pasteData = "from parent ";
-      iframeInner.src = "data:text/html,<html><body>" +
+      iframe.src = "data:text/html,<html><body>" +
                    "<input type='text' id='text' value='" + defaultData + "'>" +
                    "</body>" +
                    "</html>";
       stateMeaning = " (test: <input type=text>)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();elt.select();";
       break;
     case 2: // test for input number
       defaultData = "12345";
       pasteData = "67890";
-      iframeInner.src = "data:text/html,<html><body>" +
+      iframe.src = "data:text/html,<html><body>" +
                    "<input type='number' id='text' value='" + defaultData + "'>" +
                    "</body>" +
                    "</html>";
       stateMeaning = " (test: <input type=number>)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();elt.select();";
       break;
     case 3: // test for div contenteditable
       defaultData = "Test for selection change event";
       pasteData = "from parent ";
-      iframeInner.src = "data:text/html,<html><body>" +
+      iframe.src = "data:text/html,<html><body>" +
                    "<div contenteditable='true' id='text'>" + defaultData + "</div>" +
                    "</body>" +
                    "</html>";
       stateMeaning = " (test: content editable div)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();";
       break;
     case 4: // test for normal div
+      SimpleTest.finish();
+      return;
       defaultData = "Test for selection change event";
       pasteData = "from parent ";
-      iframeInner.src = "data:text/html,<html><body>" +
+      iframe.src = "data:text/html,<html><body>" +
                    "<div id='text'>" + defaultData + "</div>" +
                    "</body>" +
                    "</html>";
       stateMeaning = " (test: normal div)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();";
       break;
     case 5: // test for normal div with designMode:on
       defaultData = "Test for selection change event";
       pasteData = "from parent ";
-      iframeInner.src = "data:text/html,<html><body id='text'>" +
+      iframe.src = "data:text/html,<html><body id='text'>" +
                    defaultData +
                    "</body>" +
                    "<script>document.designMode='on';</script>" +
                    "</html>";
       stateMeaning = " (test: normal div with designMode:on)";
       focusScript = "var elt=content.document.getElementById('text');elt.focus();";
       break;
     default:
-      if (createEmbededFrame || browserElementTestHelpers.getOOPByDefaultPref()) {
-        SimpleTest.finish();
-      } else {
-        createEmbededFrame = true;
-
-        // clean up and run test again.
-        document.body.removeChild(iframeOuter);
-        document.body.removeChild(gTextarea);
-        state = 0;
-        runTest();
-      }
+      SimpleTest.finish();
       break;
   }
 }
 
 function testSelectAll(e) {
-  iframeOuter.addEventListener("mozbrowserselectionstatechanged", function selectchangeforselectall(e) {
-    iframeOuter.removeEventListener("mozbrowserselectionstatechanged", selectchangeforselectall, true);
+  iframe.addEventListener("mozbrowserselectionstatechanged", function selectchangeforselectall(e) {
+    iframe.removeEventListener("mozbrowserselectionstatechanged", selectchangeforselectall, true);
     ok(true, "got mozbrowserselectionstatechanged event." + stateMeaning);
     ok(e.detail, "event.detail is not null." + stateMeaning);
     ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
     ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
     SimpleTest.executeSoon(function() { testCopy1(e); });
   }, true);
 
   mm.addMessageListener('content-focus', function messageforfocus(msg) {
@@ -264,21 +236,19 @@ function testCut1(e) {
     nextTest(true);
   }
 
   let fail = function() {
     nextTest(false);
   }
 
   let compareData = pasteData;
-  // Something weird when we doCommand with content editable element in OOP.
-  // Always true in this case
-  // Normal div case cannot cut, always true as well.
-  if ((state == 3 && browserElementTestHelpers.getOOPByDefaultPref()) ||
-      state == 4) {
+  if (state == 3 && browserElementTestHelpers.getOOPByDefaultPref()) {
+    // Something weird when we doCommand with content editable element in OOP.
+    // Always true in this case
     compareData = function() { return true; }
   }
 
   SimpleTest.waitForClipboard(compareData, setup, success, fail);
 }
 
 function testCut2(e) {
   mm.addMessageListener('content-text', function messageforcut(msg) {
@@ -295,20 +265,9 @@ function testCut2(e) {
 
     state++;
     dispatchTest(e);
   });
 
   mm.loadFrameScript(getScriptForGetContent(), false);
 }
 
-// Give our origin permission to open browsers, and remove it when the test is complete.
-var principal = SpecialPowers.wrap(document).nodePrincipal;
-var context = { 'url': SpecialPowers.wrap(principal.URI).spec,
-                'appId': principal.appId,
-                'isInBrowserElement': true };
-
-addEventListener('testready', function() {
-  SpecialPowers.pushPermissions([
-    {'type': 'browser', 'allow': 1, 'context': context}
-  ], runTest);
-});
-
+addEventListener('testready', runTest);
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_NestedFramesOuter_CopyPaste.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<body>
-<p>file_NestedFramesOuter_CopyPaste.html</p>
-<script>
-
-addEventListener('load', function() {
-  setTimeout(createIframe, 0);
-});
-
-function createIframe()
-{
-  var iframe = document.createElement('iframe');
-  iframe.setAttribute('id', 'iframeInner');
-  iframe.setAttribute('mozbrowser', true);
-  iframe.setAttribute('remote', 'false');
-  document.body.appendChild(iframe);
-}
-
-</script>
-</body>
-</html>
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -108,17 +108,16 @@ support-files =
   file_download_bin.sjs
   file_empty.html
   file_empty_script.js
   file_focus.html
   file_http_401_response.sjs
   file_inputmethod.html
   file_post_request.html
   file_wyciwyg.html
-  file_NestedFramesOuter_CopyPaste.html
 
 # Note: browserElementTestHelpers.js looks at the test's filename to determine
 # whether the test should be OOP.  "_oop_" signals OOP, "_inproc_" signals in
 # process.  Default is OOP.
 [test_browserElement_NoAttr.html]
 [test_browserElement_NoPref.html]
 [test_browserElement_NoPermission.html]
 [test_browserElement_inproc_Alert.html]