Bug 1363632 - rewrite test_497898.html. r=smaug
authorYoshi Huang <allstars.chh@mozilla.com>
Wed, 10 May 2017 11:52:33 +0800
changeset 358507 5cef191f7d10d22597d4696535e5b8b3426cc18f
parent 358506 22522049bc80f2c441aad60a910bf9b56eee5518
child 358508 f7e2f109410ea4cc478b5433e7bbebdb080ba076
push id90348
push useryhuang@mozilla.com
push dateTue, 16 May 2017 09:02:06 +0000
treeherdermozilla-inbound@1e29842a2984 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1363632
milestone55.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 1363632 - rewrite test_497898.html. r=smaug test_497898.html uses encoded URI in data:text/html, so I am going to replace it with srcdoc attribute and also decode the URI into plain html.
dom/tests/mochitest/general/497633.html
dom/tests/mochitest/general/test_497898.html
--- a/dom/tests/mochitest/general/497633.html
+++ b/dom/tests/mochitest/general/497633.html
@@ -13,12 +13,23 @@ setTimeout(function() {
   else {
     window.frames[0].location.reload();
     t++;
   }
 }, 300);
 }
 </script>
 
-<iframe src="data:application/xhtml+xml;charset=utf-8,%3Chtml%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%0A%0A%3Ciframe%2F%3E%0A%3Cframeset%20onblur%3D%22window.frameElement.parentNode.removeChild(window.frameElement)%22%20id%3D%22frame%22%2F%3E%0A%0A%3Cscript%3E%0Afunction%20doe(i)%7B%0Adocument.getElementById('frame').focus()%3B%0Adocument.getElementsByTagName('*')%5B1%5D.focus()%3B%0A%7D%0Atop.opener.SimpleTest.waitForFocus(function%20()%20setTimeout(doe%2C%20100)%2C%20top)%3B%0A%3C%2Fscript%3E%0A%3C%2Fhtml%3E" onload="doe()" id="content"></iframe>
+<iframe srcdoc="<html xmlns='http://www.w3.org/1999/xhtml'>
+    <iframe/>
+      <frameset onblur='window.frameElement.parentNode.removeChild(window.frameElement)' id='frame'/>
+
+      <script>
+function doe(i){
+  document.getElementById('frame').focus();
+  document.getElementsByTagName('*')[1].focus();
+}
+top.opener.SimpleTest.waitForFocus(function () setTimeout(doe, 100), top);
+      </script>
+  </html>" onload="doe()" id="content"></iframe>
 </body>
 </html>
 
--- a/dom/tests/mochitest/general/test_497898.html
+++ b/dom/tests/mochitest/general/test_497898.html
@@ -14,16 +14,25 @@ function done()
 
 function switchFocus()
 {
   setTimeout(() => window.open('497633.html', '_new', 'width=300,height=300'), 0);
 }
 </script>
 </head>
 <body>
-<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%0A%3Chead%3E%3C/head%3E%0A%3Cbody%3E%0A%3Cbutton%20id%3D%22a%22%20onfocus%3D%22parent.switchFocus%28%29%22%20onblur%3D%22window.frameElement.parentNode.removeChild%28window.frameElement%29%22%3ESwitching%20focus%20to%20a%20different%20program%20should%20not%20crash%20Mozilla%3C/button%3E%0A%3Cscript%3E%0Adocument.getElementById%28%27a%27%29.focus%28%29%3B%0A%3C/script%3E%0A%3C/body%3E%0A%3C/html%3E"></iframe>
+  <iframe srcdoc="<html><meta charset='utf-8'>
+      <head></head>
+      <body>
+        <button id='a' onfocus='parent.switchFocus()' onblur='window.frameElement.parentNode.removeChild(window.frameElement)'>Switching focus to a different program should not crash Mozilla</button>
+        <script>
+document.getElementById('a').focus();
+        </script>
+      </body>
+    </html>">
+  </iframe>
 
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 
 </body>
 </html>