Bug 1337186 - rm data: from navigation/test_bug386782 r=smaug draft
authorFrederik Braun <fbraun+gh@mozilla.com>
Wed, 15 Feb 2017 11:38:32 +0100
changeset 485920 041ad5b49e4fdf72fe7ba1bcf6d729f3985b2ebf
parent 485692 6cefe01ca7744d6ac3960c69eac833e2e65f7f8f
child 485921 11816f4072165087472052417aa750e218ccc247
push id45877
push userbmo:fbraun@mozilla.com
push dateFri, 17 Feb 2017 09:58:50 +0000
reviewerssmaug
bugs1337186, 386782
milestone54.0a1
Bug 1337186 - rm data: from navigation/test_bug386782 r=smaug MozReview-Commit-ID: GSBZaRvuVNg
docshell/test/navigation/file_bug386782_contenteditable.html
docshell/test/navigation/file_bug386782_designmode.html
docshell/test/navigation/mochitest.ini
docshell/test/navigation/test_bug386782.html
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_bug386782_contenteditable.html
@@ -0,0 +1,1 @@
+<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted:event.persisted}, "*"); });</script></head><body contentEditable="true"><p>contentEditable</p></body></html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_bug386782_designmode.html
@@ -0,0 +1,1 @@
+<html><head><meta charset="utf-8"><script>window.addEventListener("pageshow", function(event) { window.opener.postMessage({persisted:event.persisted}, "*"); });</script></head><body><p>designModeDocument</p></body></html>
\ No newline at end of file
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -1,12 +1,14 @@
 [DEFAULT]
 support-files =
   NavigationUtils.js
   blank.html
+  file_bug386782_contenteditable.html
+  file_bug386782_designmode.html
   file_bug462076_1.html
   file_bug462076_2.html
   file_bug462076_3.html
   file_bug508537_1.html
   file_bug534178.html
   file_document_write_1.html
   file_fragment_handling_during_load.html
   file_nested_frames.html
--- a/docshell/test/navigation/test_bug386782.html
+++ b/docshell/test/navigation/test_bug386782.html
@@ -12,34 +12,29 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script>
 
     // This tests if we can load a document whose root is in designMode,
     // edit it, navigate to a new page, navigate back, still edit, and still
     // undo/redo. Note that this is different from the case where the
     // designMode document is in a frame inside the window, as this means
     // the editable region is not in the root docshell (a less complicated case).  
 
-    var pageShowChecker = '<scr' + 'ipt>' +
-      'window.addEventListener("pageshow", function(event) {' +
-        'window.opener.postMessage({persisted:event.persisted}, "*");' +
-      '});</scr' + 'ipt>';
-  
     var gTests = [
       {
         // <html><body><p>designModeDocument</p></body></html>
-        url: "data:text/html;charset=utf-8,<html><head>" + pageShowChecker + "</head><body><p>designModeDocument</p></body></html>",
+        url: "file_bug386782_designmode.html",
         name: 'designModeNavigate',
         onload(doc) { doc.designMode = "on"; },
         expectedBodyBeforeEdit: '<p>designModeDocument</p>',
         expectedBodyAfterEdit:  '<p>EDITED designModeDocument</p>',
         expectedBodyAfterSecondEdit: '<p>EDITED TWICE designModeDocument</p>',
       },
       {
         // <html><body contentEditable="true"><p>contentEditable</p></body></html>
-        url: "data:text/html;charset=utf-8,<html><head>" + pageShowChecker + "</head><body contentEditable=\"true\"><p>contentEditable</p></body></html>",
+        url: "file_bug386782_contenteditable.html",
         name: 'contentEditableNavigate',
         expectedBodyBeforeEdit: '<p>contentEditable</p>',
         expectedBodyAfterEdit:  'EDITED <br><p>contentEditable</p>',
         expectedBodyAfterSecondEdit: 'EDITED TWICE <br><p>contentEditable</p>',
       }
     ];
     
     var gTestNum = -1;
@@ -69,17 +64,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       gTest.window.document.body.focus();
 
       // WARNING: If the following test fails, give the setTimeout() in the onload()
       // a bit longer; the doc hasn't had enough time to setup its editor.
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyBeforeEdit, "Is doc setup yet");
       sendString('EDITED ', gTest.window);
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Editing failed.");
 
-      gTest.window.location = 'data:text/html;charset=utf-8,SomeOtherDocument';
+      gTest.window.location = 'about:blank';
       SimpleTest.waitForFocus(goBack, gTest.window);
     }
     
     function goBack() {
       window.onmessage = function(e) {
         window.onmessage = null;
         // Skip the test if the page is not loaded from the bf-cache when going back.
         if (e.data.persisted) {
@@ -91,29 +86,29 @@ https://bugzilla.mozilla.org/show_bug.cg
       };
       gTest.window.history.back();
     }
 
     function checkStillEditable() {
 
       // Check that the contents are correct.
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Edited contents still correct?");
-      
+
       // Check that we can undo/redo and the contents are correct.
       gTest.window.document.execCommand("undo", false, null);
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyBeforeEdit, "Can we undo?");
 
       gTest.window.document.execCommand("redo", false, null);
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Can we redo?");
-            
+
       // Check that we can still edit the page.
       gTest.window.document.body.focus();
       sendString('TWICE ', gTest.window);
       is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterSecondEdit, "Can we still edit?");
-      
+
       gTest.window.close();
       goNext();
       
     }
     
   </script>
   
 </head>