Commit 36812aed authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Do not execute classic scripts moved between element documents

Because kEvaluateScriptMovedBetweenElementDocuments UMA
has been 0 for a week on canary,
it seems also safe to stop executing such scripts.

We still keep the use counter to confirm that
such cases are really rare on stable channel.

Bug: 721914
Change-Id: I2b4963321f6e81284b9baac22ee5d5f9e3df7484
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854643Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706110}
parent 712cbd1b
......@@ -141,18 +141,22 @@ void PendingScript::ExecuteScriptBlock(const KURL& document_url) {
}
if (OriginalContextDocument() != context_document) {
// Do not execute scripts if they are moved between documents.
// Do not execute scripts if they are moved between context documents.
Dispose();
return;
}
if (OriginalContextDocument() == context_document &&
original_element_document_ != &element_->GetDocument()) {
// Count how many scripts are moved between element Documents under the same
// context Document, to investigate the feasibility of stopping execution of
// such scripts. https://crbug.com/721914
if (original_element_document_ != &element_->GetDocument()) {
// Do not execute scripts if they are moved between element documents (under
// the same context Document).
// We continue counting for a while to confirm that such cases are really
// rare on stable channel. https://crbug.com/721914
UseCounter::Count(context_document,
WebFeature::kEvaluateScriptMovedBetweenElementDocuments);
Dispose();
return;
}
Script* script = GetSource(document_url);
......
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