Skip to content

Commit

Permalink
v8binding: Implement timers with IDL callback function of type Function
Browse files Browse the repository at this point in the history
This is mostly a reland of Iee5c1d6917ad7770383e06a425f96000835a663a.

This patch implements setTimeout/setInterval Web APIs with IDL
callback function of type Function (i.e. V8Function in Blink).

Also ensure eager finalization of ScheduledAction in DOMTimer to
prevent a memory leak.

Bug: 866610
Change-Id: I3f460247f27069e4054a984efd3f98a2ce0ceac7
Reviewed-on: https://chromium-review.googlesource.com/c/1391248
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619125}
  • Loading branch information
yuki3 authored and chromium-wpt-export-bot committed Dec 28, 2018
1 parent 16fc0dc commit 7fc323f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
@@ -0,0 +1,3 @@
<script>
setTimeout(parent.timerTest, 10);
</script>
@@ -0,0 +1,18 @@
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
const frameURL = new URL("resources/url-entry-document-timer-frame.html", document.URL).href;
window.timerTest = t.step_func_done(() => {
assert_equals(frame.contentDocument.URL, frameURL);
assert_equals(frame.contentWindow.location.href, frameURL);

// In this case, the entry settings object was set when this function is
// executed in the timer task through Web IDL's "invoke a callback
// function" algorithm, to be the relevant settings object of this
// function. Therefore the URL of this document would be inherited.
assert_equals(frame.contentDocument.open(), frame.contentDocument);
assert_equals(frame.contentDocument.URL, document.URL);
assert_equals(frame.contentWindow.location.href, document.URL);
});
frame.src = frameURL;
}, "document.open() changes document's URL to the entry settings object's responsible document's (through timeouts)");
1 change: 1 addition & 0 deletions lint.whitelist
Expand Up @@ -167,6 +167,7 @@ SET TIMEOUT: html/semantics/embedded-content/the-img-element/*
SET TIMEOUT: html/semantics/scripting-1/the-script-element/*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/0*
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/history-frame.html
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-timer-frame.html
SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
SET TIMEOUT: html/webappapis/scripting/event-loops/*
SET TIMEOUT: html/webappapis/scripting/events/event-handler-processing-algorithm-error/*
Expand Down

0 comments on commit 7fc323f

Please sign in to comment.