Closed Bug 1380717 Opened 7 years ago Closed 7 years ago

Updates more tests within editor/ to comply with new data: URI inheritance model

Categories

(Core :: DOM: Security, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: ckerschb, Assigned: ckerschb)

References

Details

(Whiteboard: [domsecurity-active])

Attachments

(1 file)

      No description provided.
Assignee: nobody → ckerschb
Blocks: 1324406
Priority: -- → P2
Whiteboard: [domsecurity-active]
Hey Masayuki, I don't quite know why those tests have not been showing up as failing in the first place, otherwise I would have incorporated those changes within Bug 1377748. Most likely because we export failing tests using the Experimental Test-Centric-UI. Anyway, it seems 4 more tests were failing:

a) editor/libeditor/tests/test_bug611182.html
b) editor/libeditor/tests/test_bug795418-2.html
c) editor/libeditor/tests/test_bug795418-3.html
d) editor/libeditor/tests/test_dom_input_event_on_htmleditor.html

While (c) and (d) were easily fixed by using 'srcdoc' I had to move the actual data: URI code into an *.sjs file for (a) and (b). Otherwise we can not serve a content-type of application/xhtml+xml.
Attachment #8886254 - Flags: review?(masayuki)
Comment on attachment 8886254 [details] [diff] [review]
bug_1380717_editor_tests.patch

I hope that big change for a test should be independent patch like the test for bug611182 (when you request to review to me next time).

>diff --git a/editor/libeditor/tests/file_bug795418-2.sjs b/editor/libeditor/tests/file_bug795418-2.sjs
>new file mode 100644
>--- /dev/null
>+++ b/editor/libeditor/tests/file_bug795418-2.sjs
>@@ -0,0 +1,8 @@
>+// SJS file for test_bug795418-2.html
>+"use strict";
>+
>+function handleRequest(request, response) {
>+  response.setHeader("Cache-Control", "no-cache", false);
>+  response.setHeader("Content-Type", "application/xhtml+xml", false);
>+  response.write("<html contenteditable='' xmlns='http://www.w3.org/1999/xhtml'><span>AB</span></html>");
>+}

Wow, I've not known this way!

>diff --git a/editor/libeditor/tests/test_bug611182.html b/editor/libeditor/tests/test_bug611182.html
>--- a/editor/libeditor/tests/test_bug611182.html
>+++ b/editor/libeditor/tests/test_bug611182.html
>@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
>   <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.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=611182">Mozilla Bug 611182</a>
> <p id="display"></p>
> <div id="content">
>   <iframe></iframe>
>-  <iframe id="ref" src="data:text/html,foo bar"></iframe>
>+  <iframe id="ref" src="./file_bug611182.html"></iframe>

Why cannot we use srcdoc in this case?  If it's available, please use it.  Otherwise, please explain it as comment and I'd like you to keep the data URI as comment in this file.

>-  const TEST_URIS = [
...
>-  ];

I assume that the items in this const array are moved to file_bug611182.sjs without any changes.

>diff --git a/editor/libeditor/tests/test_bug795418-2.html b/editor/libeditor/tests/test_bug795418-2.html
>--- a/editor/libeditor/tests/test_bug795418-2.html
>+++ b/editor/libeditor/tests/test_bug795418-2.html
>@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
> </head>
> <body>
> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772796">Mozilla Bug 795418</a>
> <p id="display"></p>
> <div id="content" style="display: none">
> </div>
> 
> <div id="copySource">Copy this</div>
>-<iframe src="data:application/xhtml+xml,<html contenteditable='' xmlns='http://www.w3.org/1999/xhtml'><span>AB</span></html>"></iframe>
>+<iframe src="./file_bug795418-2.sjs"></iframe>

I'd like you to keep staying the deta URI in comment because when somebody hits error of this, they need to check file_bug795418-2.sjs too.

>diff --git a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
>--- a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
>+++ b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html
>@@ -5,21 +5,21 @@
>           src="/tests/SimpleTest/SimpleTest.js"></script>
>   <script type="text/javascript"
>           src="/tests/SimpleTest/EventUtils.js"></script>
>   <link rel="stylesheet" type="text/css"
>           href="/tests/SimpleTest/test.css" />
> </head>
> <body>
> <div id="display">
>-  <iframe id="editor1" src="data:text/html,<html><body contenteditable id='eventTarget'></body></html>"></iframe>
>-  <iframe id="editor2" src="data:text/html,<html contenteditable id='eventTarget'><body></body></html>"></iframe>
>-  <iframe id="editor3" src="data:text/html,<html><body><div contenteditable id='eventTarget'></div></body></html>"></iframe>
>-  <iframe id="editor4" src="data:text/html,<html contenteditable id='eventTarget'><body><div contenteditable id='editTarget'></div></body></html>"></iframe>
>-  <iframe id="editor5" src="data:text/html,<html><body id='eventTarget'></body><script>document.designMode='on';</script></html>"></iframe>
>+  <iframe id="editor1" srcdoc="<html><body contenteditable id='eventTarget'></body></html>"></iframe>
>+  <iframe id="editor2" srcdoc="<html contenteditable id='eventTarget'><body></body></html>"></iframe>
>+  <iframe id="editor3" srcdoc="<html><body><div contenteditable id='eventTarget'></div></body></html>"></iframe>
>+  <iframe id="editor4" srcdoc="<html contenteditable id='eventTarget'><body><div contenteditable id='editTarget'></div></body></html>"></iframe>
>+  <iframe id="editor5" srcdoc="<html><body id='eventTarget'></body><script>document.designMode='on';</script></html>"></iframe>

Assuming that you did s/src="data:text\/html,/srcdoc=" here. (If this were in reviewboard, I could see the difference in each line though.)
Attachment #8886254 - Flags: review?(masayuki) → review+
(In reply to Masayuki Nakano [:masayuki] (JST, +0900) from comment #2)
> I hope that big change for a test should be independent patch like the test
> for bug611182 (when you request to review to me next time).
Will remember that for next time, agreed.

> >diff --git a/editor/libeditor/tests/test_bug611182.html b/editor/libeditor/tests/test_bug611182.html
> >+  <iframe id="ref" src="./file_bug611182.html"></iframe>
> 
> Why cannot we use srcdoc in this case?  If it's available, please use it. 
> Otherwise, please explain it as comment and I'd like you to keep the data
> URI as comment in this file.

src is ignored if srcdoc is set, hence this tests would fail because we use src to load content into this iframe further down.
 
> >-  const TEST_URIS = [
> ...
> >-  ];
> 
> I assume that the items in this const array are moved to file_bug611182.sjs
> without any changes.
No changes, just copied the tests into the *.sjs file.

> >diff --git a/editor/libeditor/tests/test_bug795418-2.html b/editor/libeditor/tests/test_bug795418-2.html
> >+<iframe src="./file_bug795418-2.sjs"></iframe>
> 
> I'd like you to keep staying the deta URI in comment because when somebody
> hits error of this, they need to check file_bug795418-2.sjs too.
Added a comment.
 
> >diff --git a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html arget'><body><div contenteditable id='editTarget'></div></body></html>"></iframe>
> >-  <iframe id="editor5" src="data:text/html,<html><body id='eventTarget'></body><script>document.designMode='on';</script></html>"></iframe>
> >+  <iframe id="editor5" srcdoc="<html><body id='eventTarget'></body><script>document.designMode='on';</script></html>"></iframe>
> 
> Assuming that you did s/src="data:text\/html,/srcdoc=" here. (If this were
> in reviewboard, I could see the difference in each line though.)

Yes, since this tests is totally self contained I just replaced src="data..." with srcdoc="...".
Pushed by mozilla@christophkerschbaumer.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/70430c71aac9
Updates more tests within editor/ to comply with new data: URI inheritance model. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/70430c71aac9
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: