Commit 2907c7aa authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Speculative fix for crbug.com/1099191

In https://chromium-review.googlesource.com/c/chromium/src/+/2258426, I
added an early-exit to address crashes in document.open(). It looks like we
probably need the same early-exit in document.write().

Two tests depend on the old behavior of invoking document.write() from
a detached context. However, the new behavior matches firefox's behavior
(though they thrown an exception), so I think these tests are asserting
unnecessary behavior.

Bug: 1099191
Change-Id: Iad039d6a7203b4321602399c0cb0feed39b32d3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2267446
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782794}
parent 740e9e8a
...@@ -4280,6 +4280,9 @@ void Document::write(const String& text, ...@@ -4280,6 +4280,9 @@ void Document::write(const String& text,
return; return;
} }
if (entered_document && !entered_document->GetExecutionContext())
return;
if (ignore_opens_and_writes_for_abort_) if (ignore_opens_and_writes_for_abort_)
return; return;
......
Test for bug 15707: Crash when manipulating document from within an iframe onload function.
SUCCESS if no crash.
<HTML>
<HEAD>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function startTest() {
document.open();
document.write("<p>Test for <a href='https://bugs.webkit.org/show_bug.cgi?id=15707'>bug 15707</a>: Crash when manipulating document from within an iframe onload function.</p><p>SUCCESS if no crash.</p>");
document.close();
if (window.testRunner)
setTimeout("testRunner.notifyDone()", 0); // Wait until stack unwinds.
}
</script>
</HEAD>
<BODY>
<IFRAME SRC="resources/frame-onload-open.html"></IFRAME>
<IFRAME SRC="resources/frame-onload-open.html"></IFRAME>
</BODY>
</HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=x-mac-cyrillic">
<title>Frames and encodings</title>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.done = function(charset) {
document.open();
document.write("<p>" + ((charset == "x-mac-cyrillic") ? "PASS" : "FAIL") + "</p>");
<!-- It's unlikely that anyone has x-mac-cyrillic as default -->
document.close();
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</head>
<frameset rows="0,*">
<frame src="about:" scrolling=no marginwidth=0 marginheight=0>
<frame src="resources/frame-default-enc-frame.html">
</frameset>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment