From 4b2cb8090312967f56b5c82e145a58605ef5246b Mon Sep 17 00:00:00 2001 From: Ian Melven Date: Mon, 20 Aug 2012 11:34:34 -0700 Subject: [PATCH] Bug 341604 - tests for iframe sandbox - inheritance r=jst --- content/html/content/test/Makefile.in | 10 ++ .../test/file_iframe_sandbox_a_if1.html | 13 +++ .../test/file_iframe_sandbox_a_if2.html | 21 ++++ .../test/file_iframe_sandbox_a_if3.html | 24 ++++ .../test/file_iframe_sandbox_a_if4.html | 28 +++++ .../test/file_iframe_sandbox_a_if5.html | 22 ++++ .../test/file_iframe_sandbox_a_if6.html | 21 ++++ .../test/file_iframe_sandbox_a_if7.html | 20 ++++ .../test/file_iframe_sandbox_a_if8.html | 26 +++++ .../test/file_iframe_sandbox_a_if9.html | 18 +++ .../test/test_iframe_sandbox_inheritance.html | 107 ++++++++++++++++++ 11 files changed, 310 insertions(+) create mode 100644 content/html/content/test/file_iframe_sandbox_a_if1.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if2.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if3.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if4.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if5.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if6.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if7.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if8.html create mode 100644 content/html/content/test/file_iframe_sandbox_a_if9.html create mode 100644 content/html/content/test/test_iframe_sandbox_inheritance.html diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 81d3e2aa58f4..4fb1bd2b8481 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -266,6 +266,16 @@ MOCHITEST_FILES = \ test_input_file_picker.html \ test_bug763626.html \ test_bug780993.html \ + test_iframe_sandbox_inheritance.html \ + file_iframe_sandbox_a_if1.html \ + file_iframe_sandbox_a_if2.html \ + file_iframe_sandbox_a_if3.html \ + file_iframe_sandbox_a_if4.html \ + file_iframe_sandbox_a_if5.html \ + file_iframe_sandbox_a_if6.html \ + file_iframe_sandbox_a_if7.html \ + file_iframe_sandbox_a_if8.html \ + file_iframe_sandbox_a_if9.html \ test_iframe_sandbox_same_origin.html \ file_iframe_sandbox_b_if1.html \ file_iframe_sandbox_b_if2.html \ diff --git a/content/html/content/test/file_iframe_sandbox_a_if1.html b/content/html/content/test/file_iframe_sandbox_a_if1.html new file mode 100644 index 000000000000..b60d52ca004b --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if1.html @@ -0,0 +1,13 @@ + + + + + Test for Bug 341604 + + + + I am sandboxed without any permissions + + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if2.html b/content/html/content/test/file_iframe_sandbox_a_if2.html new file mode 100644 index 000000000000..72bde69e41f1 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if2.html @@ -0,0 +1,21 @@ + + + + + Test for Bug 341604 + + + + + + + I am NOT sandboxed or am sandboxed with "allow-scripts" but am contained within an iframe sandboxed with sandbox = "" + or am sandboxed with sandbox='' inside an iframe sandboxed with "allow-scripts" + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if3.html b/content/html/content/test/file_iframe_sandbox_a_if3.html new file mode 100644 index 000000000000..c103c19f229f --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if3.html @@ -0,0 +1,24 @@ + + + + + Test for Bug 341604 + + + + + + + + I am sandboxed but with "allow-scripts" + + + + + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if4.html b/content/html/content/test/file_iframe_sandbox_a_if4.html new file mode 100644 index 000000000000..44adb79e4629 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if4.html @@ -0,0 +1,28 @@ + + + + + Test for Bug 341604 + + + + + + + + I am not sandboxed but contained within a sandboxed document with 'allow-scripts' + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if5.html b/content/html/content/test/file_iframe_sandbox_a_if5.html new file mode 100644 index 000000000000..dfa0fed01dd3 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if5.html @@ -0,0 +1,22 @@ + + + + + Test for Bug 341604 + + + + + + + + I am sandboxed but with "allow-scripts allow-same-origin" + + + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if6.html b/content/html/content/test/file_iframe_sandbox_a_if6.html new file mode 100644 index 000000000000..79f15e6ec71d --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if6.html @@ -0,0 +1,21 @@ + + + + + Test for Bug 341604 + + + + + + + + I am sandboxed with 'allow-scripts allow-same-origin' and contained within a sandboxed document with 'allow-scripts allow-same-origin' + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if7.html b/content/html/content/test/file_iframe_sandbox_a_if7.html new file mode 100644 index 000000000000..6480eebdba7f --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if7.html @@ -0,0 +1,20 @@ + + + + + Test for Bug 341604 + + + + + + + I am NOT sandboxed but am contained within an iframe contained within an iframe sandboxed with sandbox = "allow-scripts" + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if8.html b/content/html/content/test/file_iframe_sandbox_a_if8.html new file mode 100644 index 000000000000..002df5df5115 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if8.html @@ -0,0 +1,26 @@ + + + + + Test for Bug 341604 + + + + + + I am sandboxed but with "allow-scripts allow-same-origin". After my initial load, "allow-same-origin" is removed + and then I load file_iframe_sandbox_a_if9.html, which attemps to call a function in window.top. This should + succeed since the new sandbox flags shouldn't have taken affect on me until I'm reloaded. + + + + + diff --git a/content/html/content/test/file_iframe_sandbox_a_if9.html b/content/html/content/test/file_iframe_sandbox_a_if9.html new file mode 100644 index 000000000000..da2bcf1fa32c --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_a_if9.html @@ -0,0 +1,18 @@ + + + + + Test for Bug 341604 + + + + + I'm a subloaded document of file_iframe_sandbox_a_if8.html. I should be able to call a function in window.top + because I should be same-origin with it. + + + diff --git a/content/html/content/test/test_iframe_sandbox_inheritance.html b/content/html/content/test/test_iframe_sandbox_inheritance.html new file mode 100644 index 000000000000..d35a26b6fc9f --- /dev/null +++ b/content/html/content/test/test_iframe_sandbox_inheritance.html @@ -0,0 +1,107 @@ + + + + + + Test for Bug 341604 + + + + + +Mozilla Bug 341604 - Implement HTML5 sandbox attribute for IFRAMEs +

+
+ + + + +