Commit 3c689934 authored by sigbjornf's avatar sigbjornf Committed by Commit bot

Fix detached event listener attribute updating.

The parser will in some cases create new elements in documents that
have become frame-detached. Account for that -- no execution context
due to the document having become detached -- when processing the
event listeners of an event attribute.

R=haraken
BUG=714353

Review-Url: https://codereview.chromium.org/2855443002
Cr-Commit-Position: refs/heads/master@{#468294}
parent e8abebbc
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
var t = async_test("Updating attributes for detached nodes should not crash.");
function test() {
frame.contentDocument.adoptNode(document.scrollingElement);
t.done();
}
</script>
<iframe id="frame" onload="test()"></iframe>
<div ontransitionend="g()" onwebkittransitionend="h()">
...@@ -204,7 +204,8 @@ bool V8AbstractEventListener::BelongsToTheCurrentWorld( ...@@ -204,7 +204,8 @@ bool V8AbstractEventListener::BelongsToTheCurrentWorld(
return true; return true;
// If currently parsing, the parser could be accessing this listener // If currently parsing, the parser could be accessing this listener
// outside of any v8 context; check if it belongs to the main world. // outside of any v8 context; check if it belongs to the main world.
if (!GetIsolate()->InContext() && execution_context->IsDocument()) { if (!GetIsolate()->InContext() && execution_context &&
execution_context->IsDocument()) {
Document* document = ToDocument(execution_context); Document* document = ToDocument(execution_context);
if (document->Parser() && document->Parser()->IsParsing()) if (document->Parser() && document->Parser()->IsParsing())
return World().IsMainWorld(); return World().IsMainWorld();
......
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