Title: [293124] trunk/Source/WebCore
Revision
293124
Author
cdu...@apple.com
Date
2022-04-20 15:21:10 -0700 (Wed, 20 Apr 2022)

Log Message

Simplify type checking / casting in JSEventListener::handleEvent()
https://bugs.webkit.org/show_bug.cgi?id=239559

Reviewed by Sam Weinig.

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293123 => 293124)


--- trunk/Source/WebCore/ChangeLog	2022-04-20 22:11:20 UTC (rev 293123)
+++ trunk/Source/WebCore/ChangeLog	2022-04-20 22:21:10 UTC (rev 293124)
@@ -1,5 +1,15 @@
 2022-04-20  Chris Dumez  <cdu...@apple.com>
 
+        Simplify type checking / casting in JSEventListener::handleEvent()
+        https://bugs.webkit.org/show_bug.cgi?id=239559
+
+        Reviewed by Sam Weinig.
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent):
+
+2022-04-20  Chris Dumez  <cdu...@apple.com>
+
         Avoid call to convertToASCIILowercase() in SelectorFilter::collectElementIdentifierHashes() in the common case
         https://bugs.webkit.org/show_bug.cgi?id=239545
 

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (293123 => 293124)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2022-04-20 22:11:20 UTC (rev 293123)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2022-04-20 22:21:10 UTC (rev 293124)
@@ -138,25 +138,25 @@
     // "If this throws an exception, report the exception." It should not propagate the
     // exception.
 
-    JSObject* jsFunction = ensureJSFunction(scriptExecutionContext);
+    auto* jsFunction = ensureJSFunction(scriptExecutionContext);
     if (!jsFunction)
         return;
 
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, m_isolatedWorld);
+    auto* globalObject = toJSDOMGlobalObject(scriptExecutionContext, m_isolatedWorld);
     if (!globalObject)
         return;
 
     if (scriptExecutionContext.isDocument()) {
-        JSDOMWindow* window = jsCast<JSDOMWindow*>(globalObject);
+        auto* window = jsCast<JSDOMWindow*>(globalObject);
         if (!window->wrapped().isCurrentlyDisplayedInFrame())
             return;
         if (wasCreatedFromMarkup()) {
-            Element* element = event.target()->isNode() && !downcast<Node>(*event.target()).isDocumentNode() ? dynamicDowncast<Element>(*event.target()) : nullptr;
+            auto* element = dynamicDowncast<Element>(*event.target());
             if (!scriptExecutionContext.contentSecurityPolicy()->allowInlineEventHandlers(sourceURL().string(), sourcePosition().m_line, code(), element))
                 return;
         }
         // FIXME: Is this check needed for other contexts?
-        ScriptController& script = window->wrapped().frame()->script();
+        auto& script = window->wrapped().frame()->script();
         if (!script.canExecuteScripts(AboutToExecuteScript) || script.isPaused())
             return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to