Bug 1120592 - Create iframe directly instead of using setTimeout. r=kanru, a=test-only
authorMorris Tseng <mtseng@mozilla.com>
Thu, 23 Apr 2015 19:36:00 -0400
changeset 260285 a4f506639153
parent 260284 55b58d5184ce
child 260290 33ea9bfaaeea
push id738
push userryanvm@gmail.com
push date2015-04-27 15:52 +0000
treeherdermozilla-release@a4f506639153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskanru, test-only
bugs1120592
milestone38.0b8
Bug 1120592 - Create iframe directly instead of using setTimeout. r=kanru, a=test-only
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/mochitest/browserElement_CopyPaste.js
+++ b/dom/browser-element/mochitest/browserElement_CopyPaste.js
@@ -47,32 +47,35 @@ 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";
+    iframeOuter.src = "file_empty.html";
   }
   document.body.appendChild(iframeOuter);
 
   gTextarea = document.createElement('textarea');
   document.body.appendChild(gTextarea);
 
   iframeOuter.addEventListener("mozbrowserloadend", function onloadend(e) {
     iframeOuter.removeEventListener("mozbrowserloadend", onloadend);
 
     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 = contentDoc.createElement('iframe');
+      iframeInner.setAttribute('mozbrowser', true);
+      iframeInner.setAttribute('remote', 'false');
+      contentDoc.body.appendChild(iframeInner);
       iframeInner.addEventListener("mozbrowserloadend", function onloadendinner(e) {
         iframeInner.removeEventListener("mozbrowserloadend", onloadendinner);
         mm = SpecialPowers.getBrowserFrameMessageManager(iframeInner);
         dispatchTest(e);
       });
     } else {
       iframeInner = iframeOuter;
       mm = SpecialPowers.getBrowserFrameMessageManager(iframeInner);
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
@@ -109,17 +109,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]