| Index: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
|
| index 7ed2ae7975c54c39306c86033b4b31231e0330b5..018ad380a91228ac514394c68c6297dacf0074ee 100644
|
| --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
|
| @@ -735,7 +735,7 @@ void LocalDOMWindow::blur()
|
| {
|
| }
|
|
|
| -void LocalDOMWindow::print()
|
| +void LocalDOMWindow::print(ScriptState* scriptState)
|
| {
|
| if (!frame())
|
| return;
|
| @@ -752,6 +752,14 @@ void LocalDOMWindow::print()
|
| }
|
| }
|
|
|
| + if (scriptState && v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
|
| + Deprecation::countDeprecation(frame()->document(), UseCounter::During_Microtask_Print);
|
| + if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnabled()) {
|
| + frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'print()' during microtask execution."));
|
| + return;
|
| + }
|
| + }
|
| +
|
| if (frame()->isLoading()) {
|
| m_shouldPrintWhenFinishedLoading = true;
|
| return;
|
| @@ -767,7 +775,7 @@ void LocalDOMWindow::stop()
|
| frame()->loader().stopAllLoaders();
|
| }
|
|
|
| -void LocalDOMWindow::alert(const String& message)
|
| +void LocalDOMWindow::alert(ScriptState* scriptState, const String& message)
|
| {
|
| if (!frame())
|
| return;
|
| @@ -780,6 +788,14 @@ void LocalDOMWindow::alert(const String& message)
|
| }
|
| }
|
|
|
| + if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
|
| + Deprecation::countDeprecation(frame()->document(), UseCounter::During_Microtask_Alert);
|
| + if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnabled()) {
|
| + frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'alert()' during microtask execution."));
|
| + return;
|
| + }
|
| + }
|
| +
|
| frame()->document()->updateLayoutTree();
|
|
|
| FrameHost* host = frame()->host();
|
| @@ -789,7 +805,7 @@ void LocalDOMWindow::alert(const String& message)
|
| host->chromeClient().openJavaScriptAlert(frame(), message);
|
| }
|
|
|
| -bool LocalDOMWindow::confirm(const String& message)
|
| +bool LocalDOMWindow::confirm(ScriptState* scriptState, const String& message)
|
| {
|
| if (!frame())
|
| return false;
|
| @@ -802,6 +818,14 @@ bool LocalDOMWindow::confirm(const String& message)
|
| }
|
| }
|
|
|
| + if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
|
| + Deprecation::countDeprecation(frame()->document(), UseCounter::During_Microtask_Confirm);
|
| + if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnabled()) {
|
| + frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'confirm()' during microtask execution."));
|
| + return false;
|
| + }
|
| + }
|
| +
|
| frame()->document()->updateLayoutTree();
|
|
|
| FrameHost* host = frame()->host();
|
| @@ -811,7 +835,7 @@ bool LocalDOMWindow::confirm(const String& message)
|
| return host->chromeClient().openJavaScriptConfirm(frame(), message);
|
| }
|
|
|
| -String LocalDOMWindow::prompt(const String& message, const String& defaultValue)
|
| +String LocalDOMWindow::prompt(ScriptState* scriptState, const String& message, const String& defaultValue)
|
| {
|
| if (!frame())
|
| return String();
|
| @@ -824,6 +848,14 @@ String LocalDOMWindow::prompt(const String& message, const String& defaultValue)
|
| }
|
| }
|
|
|
| + if (v8::MicrotasksScope::IsRunningMicrotasks(scriptState->isolate())) {
|
| + Deprecation::countDeprecation(frame()->document(), UseCounter::During_Microtask_Prompt);
|
| + if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnabled()) {
|
| + frameConsole()->addMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Ignored call to 'prompt()' during microtask execution."));
|
| + return String();
|
| + }
|
| + }
|
| +
|
| frame()->document()->updateLayoutTree();
|
|
|
| FrameHost* host = frame()->host();
|
| @@ -1404,7 +1436,7 @@ void LocalDOMWindow::finishedLoading()
|
| {
|
| if (m_shouldPrintWhenFinishedLoading) {
|
| m_shouldPrintWhenFinishedLoading = false;
|
| - print();
|
| + print(nullptr);
|
| }
|
| }
|
|
|
|
|