From 7fc323f76ca9e42f123e72978846a431e9972560 Mon Sep 17 00:00:00 2001 From: Yuki Shiino Date: Thu, 27 Dec 2018 22:36:42 -0800 Subject: [PATCH] v8binding: Implement timers with IDL callback function of type Function 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 Commit-Queue: Yuki Shiino Cr-Commit-Position: refs/heads/master@{#619125} --- .../url-entry-document-timer-frame.html | 3 +++ .../url-entry-document.window.js | 18 ++++++++++++++++++ lint.whitelist | 1 + 3 files changed, 22 insertions(+) create mode 100644 html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-timer-frame.html create mode 100644 html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document.window.js diff --git a/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-timer-frame.html b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-timer-frame.html new file mode 100644 index 00000000000000..b2c050768c7828 --- /dev/null +++ b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-timer-frame.html @@ -0,0 +1,3 @@ + diff --git a/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document.window.js b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document.window.js new file mode 100644 index 00000000000000..c3a1c3a874f357 --- /dev/null +++ b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document.window.js @@ -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)"); diff --git a/lint.whitelist b/lint.whitelist index c3ff66bc0cf787..c9221883c51997 100644 --- a/lint.whitelist +++ b/lint.whitelist @@ -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/*