Title: [290399] trunk/Source/WebCore
Revision
290399
Author
jen...@apple.com
Date
2022-02-23 16:39:27 -0800 (Wed, 23 Feb 2022)

Log Message

Unreviewed, reverting r290348.

Broke a test, slowing down EWS.

Reverted changeset:

"Create a DOMWindow::printWarningMessage method and start
using it in DOMWindow.cpp"
https://bugs.webkit.org/show_bug.cgi?id=237047
https://commits.webkit.org/r290348

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290398 => 290399)


--- trunk/Source/WebCore/ChangeLog	2022-02-24 00:37:24 UTC (rev 290398)
+++ trunk/Source/WebCore/ChangeLog	2022-02-24 00:39:27 UTC (rev 290399)
@@ -1,3 +1,16 @@
+2022-02-23  Robert Jenner  <jen...@apple.com>
+
+        Unreviewed, reverting r290348.
+
+        Broke a test, slowing down EWS.
+
+        Reverted changeset:
+
+        "Create a DOMWindow::printWarningMessage method and start
+        using it in DOMWindow.cpp"
+        https://bugs.webkit.org/show_bug.cgi?id=237047
+        https://commits.webkit.org/r290348
+
 2022-02-23  Alan Bujtas  <za...@apple.com>
 
         [IFC][Integration] Flip accumulatedOffset to take writing mode into account when hittesting across formatting contexts.

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (290398 => 290399)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-24 00:37:24 UTC (rev 290398)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2022-02-24 00:39:27 UTC (rev 290399)
@@ -1066,7 +1066,7 @@
         return;
 
     if (!(page->openedByDOM() || page->backForward().count() <= 1)) {
-        printWarningMessage("Can't close the window since it was not opened by _javascript_"_s);
+        console()->addMessage(MessageSource::JS, MessageLevel::Warning, "Can't close the window since it was not opened by _javascript_"_s);
         return;
     }
 
@@ -1874,8 +1874,8 @@
 int DOMWindow::webkitRequestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback)
 {
     static bool firstTime = true;
-    if (firstTime) {
-        printWarningMessage("webkitRequestAnimationFrame() is deprecated and will be removed. Please use requestAnimationFrame() instead."_s);
+    if (firstTime && document()) {
+        document()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, "webkitRequestAnimationFrame() is deprecated and will be removed. Please use requestAnimationFrame() instead."_s);
         firstTime = false;
     }
     return requestAnimationFrame(WTFMove(callback));
@@ -2110,7 +2110,8 @@
 
     String innerMessage;
     if (!isAllowedToUseDeviceOrientation(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
-        printWarningMessage(makeString("No device orientation events will be fired, reason: ", innerMessage, "."));
+        if (RefPtr document = this->document())
+            document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device orientation events will be fired, reason: ", innerMessage, "."));
         return;
     }
 
@@ -2138,7 +2139,8 @@
     String innerMessage;
     if (!isAllowedToUseDeviceMotion(innerMessage) || !hasPermissionToReceiveDeviceMotionOrOrientationEvents(innerMessage)) {
         failedToRegisterDeviceMotionEventListener();
-        printWarningMessage(makeString("No device motion events will be fired, reason: ", innerMessage, "."));
+        if (RefPtr document = this->document())
+            document->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, makeString("No device motion events will be fired, reason: ", innerMessage, "."));
         return;
     }
 
@@ -2426,25 +2428,15 @@
         lockHistory, lockBackForwardList);
 }
 
-void DOMWindow::printConsoleMessage(const String& message, MessageLevel level) const
+void DOMWindow::printErrorMessage(const String& message) const
 {
     if (message.isEmpty())
         return;
 
     if (PageConsoleClient* pageConsole = console())
-        pageConsole->addMessage(MessageSource::JS, level, message);
+        pageConsole->addMessage(MessageSource::JS, MessageLevel::Error, message);
 }
 
-void DOMWindow::printErrorMessage(const String& message) const
-{
-    printConsoleMessage(message, MessageLevel::Error);
-}
-
-void DOMWindow::printWarningMessage(const String& message) const
-{
-    printConsoleMessage(message, MessageLevel::Warning);
-}
-
 String DOMWindow::crossDomainAccessErrorMessage(const DOMWindow& activeWindow, IncludeTargetOrigin includeTargetOrigin)
 {
     const URL& activeWindowURL = activeWindow.document()->url();

Modified: trunk/Source/WebCore/page/DOMWindow.h (290398 => 290399)


--- trunk/Source/WebCore/page/DOMWindow.h	2022-02-24 00:37:24 UTC (rev 290398)
+++ trunk/Source/WebCore/page/DOMWindow.h	2022-02-24 00:39:27 UTC (rev 290399)
@@ -440,9 +440,6 @@
     void decrementGamepadEventListenerCount();
 #endif
 
-    void printConsoleMessage(const String&, MessageLevel) const;
-    void printWarningMessage(const String&) const;
-
     bool m_shouldPrintWhenFinishedLoading { false };
     bool m_suspendedForDocumentSuspension { false };
     bool m_isSuspendingObservers { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to