From c7b665bcf36c7d0eed5cfd346cb146d6a99bd32f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
Date: Sat, 5 Aug 2017 08:53:03 +0200
Subject: [PATCH] Bug 1382568: Test. r=heycam

MozReview-Commit-ID: DLvVBoXubGT

--HG--
extra : rebase_source : 1edc227048565d9bfb8ba342195ac3b7ff9b06d5
---
 layout/style/test/bug1382568-iframe.html |  8 ++++++++
 layout/style/test/mochitest.ini          |  2 ++
 layout/style/test/test_bug1382568.html   | 14 ++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 layout/style/test/bug1382568-iframe.html
 create mode 100644 layout/style/test/test_bug1382568.html

diff --git a/layout/style/test/bug1382568-iframe.html b/layout/style/test/bug1382568-iframe.html
new file mode 100644
index 0000000000000..63cbe3400edff
--- /dev/null
+++ b/layout/style/test/bug1382568-iframe.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<iframe src="http://example.com/doesnt-matter-because-it-gets-blocked-due-to-mixed-content"></iframe>
+<script>
+window.addEventListener('load', function(){
+  window[0].document.body.innerText;
+  window.parent.postMessage({ result: "ok" }, "*");
+}, false);
+</script>
diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini
index c2d3272cbcf18..a0f4770353a3d 100644
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -161,6 +161,8 @@ support-files = file_bug1089417_iframe.html
 [test_bug1371488.html]
 [test_bug1375944.html]
 support-files = file_bug1375944.html Ahem.ttf
+[test_bug1382568.html]
+support-files = bug1382568-iframe.html
 [test_cascade.html]
 [test_ch_ex_no_infloops.html]
 [test_change_hint_optimizations.html]
diff --git a/layout/style/test/test_bug1382568.html b/layout/style/test/test_bug1382568.html
new file mode 100644
index 0000000000000..c30f943fdc645
--- /dev/null
+++ b/layout/style/test/test_bug1382568.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Test for bug 1382568: calling innerText on an uninitialized presshell doesn't crash</title>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script>
+  window.onmessage = function(e) {
+    is(e.data.result, "ok", "Child frame should load properly");
+    SimpleTest.finish();
+  };
+</script>
+<iframe src="https://example.com/tests/layout/style/test/bug1382568-iframe.html"></iframe>
+<script>
+  SimpleTest.waitForExplicitFinish();
+</script>
-- 
GitLab