Commit 2d53ecee authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Don't allow requestIdleCallback in a detached window.

Bug: 1083617
Test: fast/frames/requestIdleCallback-timeout-in-detached-frame.html
Change-Id: If7e79c3a5ac9c44ec4a9eed11ded9d0e54089574
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2209278
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@{#770403}
parent ed35ff6b
......@@ -1618,11 +1618,10 @@ void LocalDOMWindow::SetOriginPolicyIds(const Vector<String>& ids) {
int LocalDOMWindow::requestIdleCallback(V8IdleRequestCallback* callback,
const IdleRequestOptions* options) {
if (Document* document = this->document()) {
return document->RequestIdleCallback(
ScriptedIdleTaskController::V8IdleTask::Create(callback), options);
}
return 0;
if (!GetFrame())
return 0;
return document_->RequestIdleCallback(
ScriptedIdleTaskController::V8IdleTask::Create(callback), options);
}
void LocalDOMWindow::cancelIdleCallback(int id) {
......
<body>
PASS if no crash.
<iframe id="i"></iframe>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var win = i.contentWindow;
i.remove();
win.requestIdleCallback(() => {}, {timeout: 1});
</script>
</body>
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