From 260965c8f7da6202007e60f2422967920215db23 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 - general r=jst --- content/html/content/test/Makefile.in | 12 + .../test/file_iframe_sandbox_c_if1.html | 35 +++ .../test/file_iframe_sandbox_c_if2.html | 23 ++ .../test/file_iframe_sandbox_c_if3.html | 26 +++ .../test/file_iframe_sandbox_c_if4.html | 44 ++++ .../test/file_iframe_sandbox_c_if5.html | 20 ++ .../test/file_iframe_sandbox_c_if6.html | 24 ++ .../content/test/file_iframe_sandbox_fail.js | 1 + .../test/file_iframe_sandbox_form_fail.html | 19 ++ .../test/file_iframe_sandbox_form_pass.html | 19 ++ .../file_iframe_sandbox_open_window_fail.html | 21 ++ .../content/test/file_iframe_sandbox_pass.js | 1 + .../test/test_iframe_sandbox_general.html | 221 ++++++++++++++++++ 13 files changed, 466 insertions(+) create mode 100644 content/html/content/test/file_iframe_sandbox_c_if1.html create mode 100644 content/html/content/test/file_iframe_sandbox_c_if2.html create mode 100644 content/html/content/test/file_iframe_sandbox_c_if3.html create mode 100644 content/html/content/test/file_iframe_sandbox_c_if4.html create mode 100644 content/html/content/test/file_iframe_sandbox_c_if5.html create mode 100644 content/html/content/test/file_iframe_sandbox_c_if6.html create mode 100644 content/html/content/test/file_iframe_sandbox_fail.js create mode 100644 content/html/content/test/file_iframe_sandbox_form_fail.html create mode 100644 content/html/content/test/file_iframe_sandbox_form_pass.html create mode 100644 content/html/content/test/file_iframe_sandbox_open_window_fail.html create mode 100644 content/html/content/test/file_iframe_sandbox_pass.js create mode 100644 content/html/content/test/test_iframe_sandbox_general.html diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 4fb1bd2b848..27f945648d8 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -280,6 +280,18 @@ MOCHITEST_FILES = \ file_iframe_sandbox_b_if1.html \ file_iframe_sandbox_b_if2.html \ file_iframe_sandbox_b_if3.html \ + test_iframe_sandbox_general.html \ + file_iframe_sandbox_c_if1.html \ + file_iframe_sandbox_c_if2.html \ + file_iframe_sandbox_c_if3.html \ + file_iframe_sandbox_c_if4.html \ + file_iframe_sandbox_c_if5.html \ + file_iframe_sandbox_c_if6.html \ + file_iframe_sandbox_form_fail.html \ + file_iframe_sandbox_form_pass.html \ + file_iframe_sandbox_open_window_fail.html \ + file_iframe_sandbox_pass.js \ + file_iframe_sandbox_fail.js \ test_iframe_sandbox_navigation.html \ file_iframe_sandbox_d_if1.html \ file_iframe_sandbox_d_if2.html \ diff --git a/content/html/content/test/file_iframe_sandbox_c_if1.html b/content/html/content/test/file_iframe_sandbox_c_if1.html new file mode 100644 index 00000000000..fff2f6d40ca --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if1.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed but with "allow-scripts" + +
+ First name: + Last name: + +
+ + click me + + diff --git a/content/html/content/test/file_iframe_sandbox_c_if2.html b/content/html/content/test/file_iframe_sandbox_c_if2.html new file mode 100644 index 00000000000..373c170ec75 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if2.html @@ -0,0 +1,23 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed with no permissions + + + diff --git a/content/html/content/test/file_iframe_sandbox_c_if3.html b/content/html/content/test/file_iframe_sandbox_c_if3.html new file mode 100644 index 00000000000..aca5d335699 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if3.html @@ -0,0 +1,26 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed but with "allow-scripts allow-forms" + +
+ First name: + Last name: + +
+ + diff --git a/content/html/content/test/file_iframe_sandbox_c_if4.html b/content/html/content/test/file_iframe_sandbox_c_if4.html new file mode 100644 index 00000000000..2cffe2d01c9 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if4.html @@ -0,0 +1,44 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed but with "allow-scripts allow-same-origin" + + open window + + diff --git a/content/html/content/test/file_iframe_sandbox_c_if5.html b/content/html/content/test/file_iframe_sandbox_c_if5.html new file mode 100644 index 00000000000..267864bd8a4 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if5.html @@ -0,0 +1,20 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed but with "allow-same-origin" + + click me + + diff --git a/content/html/content/test/file_iframe_sandbox_c_if6.html b/content/html/content/test/file_iframe_sandbox_c_if6.html new file mode 100644 index 00000000000..3dab5977128 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_c_if6.html @@ -0,0 +1,24 @@ + + + + + Test for Bug 341604 + + + + + + + I am sandboxed but with "allow-same-origin" and "allow-scripts" + + diff --git a/content/html/content/test/file_iframe_sandbox_fail.js b/content/html/content/test/file_iframe_sandbox_fail.js new file mode 100644 index 00000000000..63397c7de9a --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_fail.js @@ -0,0 +1 @@ +ok(false, "documents sandboxed with allow-scripts should NOT be able to run + + + + + I should NOT be loaded by a form submit from a sandbox without 'allow-forms' + + + + \ No newline at end of file diff --git a/content/html/content/test/file_iframe_sandbox_form_pass.html b/content/html/content/test/file_iframe_sandbox_form_pass.html new file mode 100644 index 00000000000..c85b73cf672 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_form_pass.html @@ -0,0 +1,19 @@ + + + + + Test for Bug 341604 + + + + + + I should be loaded by a form submit from a sandbox with 'allow-forms' + + + + \ No newline at end of file diff --git a/content/html/content/test/file_iframe_sandbox_open_window_fail.html b/content/html/content/test/file_iframe_sandbox_open_window_fail.html new file mode 100644 index 00000000000..199e56df043 --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_open_window_fail.html @@ -0,0 +1,21 @@ + + + + + Test for Bug 341604 + + + + + + I should NOT be opened by a sandboxed iframe via any method + + + + \ No newline at end of file diff --git a/content/html/content/test/file_iframe_sandbox_pass.js b/content/html/content/test/file_iframe_sandbox_pass.js new file mode 100644 index 00000000000..bd633056f2b --- /dev/null +++ b/content/html/content/test/file_iframe_sandbox_pass.js @@ -0,0 +1 @@ +ok(true, "documents sandboxed with allow-scripts should be able to run + + + + + +Mozilla Bug 341604 - Implement HTML5 sandbox attribute for IFRAMEs +

+
+ + + + + + + + + + + + + + + + +
+ +