Title: [288793] trunk/Source/WebCore
Revision
288793
Author
[email protected]
Date
2022-01-29 13:00:55 -0800 (Sat, 29 Jan 2022)

Log Message

Delete most code for beforeload event
https://bugs.webkit.org/show_bug.cgi?id=234804

Reviewed by Antti Koivisto.

Delete code for beforeload event as the event has been disabled successfully in r261946.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/BeforeLoadEvent.cpp: Removed.
* dom/BeforeLoadEvent.h: Removed.
* dom/BeforeLoadEvent.idl: Removed.
* dom/Document.cpp:
(WebCore::Document::addListenerTypeIfNeeded):
* dom/Document.h:
* dom/EventNames.in:
* dom/Node.cpp:
(WebCore::Node::dispatchBeforeLoadEvent): Deleted.
* dom/Node.h:
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::checkStyleSheet): m_isHandlingBeforeLoad is never true.
* dom/ProcessingInstruction.h:
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestClassicScript): dispatchBeforeLoadEvent always returned true
when beforeload event is disabled, and the element is always connected here.
(WebCore::ScriptElement::requestModuleScript): Ditto.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget): Deleted the no-op code.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::shouldLoadLink):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::selectNextSourceChild):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent): Deleted.
(WebCore::HTMLPlugInElement::pluginWidget const): m_inBeforeLoadEventHandler is never true.
* html/HTMLPlugInElement.h:
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::canLoadURL):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadWithDocumentLoader): Deleted the no-op code.
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement): Document will never have beforeload event listener
but keep the call to dispatchPendingBeforeLoadEvent since we depend on it updating renderer.
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): Keep the only side effect left which is
to update the renderer.
* loader/ImageLoader.h:
* page/Settings.yaml: Deleted the option to enable beforeload event.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (288792 => 288793)


--- trunk/Source/WebCore/CMakeLists.txt	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/CMakeLists.txt	2022-01-29 21:00:55 UTC (rev 288793)
@@ -845,7 +845,6 @@
     dom/AddEventListenerOptions.idl
     dom/AnimationEvent.idl
     dom/Attr.idl
-    dom/BeforeLoadEvent.idl
     dom/BeforeUnloadEvent.idl
     dom/BroadcastChannel.idl
     dom/CDATASection.idl

Modified: trunk/Source/WebCore/ChangeLog (288792 => 288793)


--- trunk/Source/WebCore/ChangeLog	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/ChangeLog	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1,3 +1,61 @@
+2022-01-29  Ryosuke Niwa  <[email protected]>
+
+        Delete most code for beforeload event
+        https://bugs.webkit.org/show_bug.cgi?id=234804
+
+        Reviewed by Antti Koivisto.
+
+        Delete code for beforeload event as the event has been disabled successfully in r261946.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * dom/BeforeLoadEvent.cpp: Removed.
+        * dom/BeforeLoadEvent.h: Removed.
+        * dom/BeforeLoadEvent.idl: Removed.
+        * dom/Document.cpp:
+        (WebCore::Document::addListenerTypeIfNeeded):
+        * dom/Document.h:
+        * dom/EventNames.in:
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchBeforeLoadEvent): Deleted.
+        * dom/Node.h:
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet): m_isHandlingBeforeLoad is never true.
+        * dom/ProcessingInstruction.h:
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::requestClassicScript): dispatchBeforeLoadEvent always returned true
+        when beforeload event is disabled, and the element is always connected here.
+        (WebCore::ScriptElement::requestModuleScript): Ditto.
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget): Deleted the no-op code.
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::shouldLoadLink):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::selectMediaResource):
+        (WebCore::HTMLMediaElement::selectNextSourceChild):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateWidget):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent): Deleted.
+        (WebCore::HTMLPlugInElement::pluginWidget const): m_inBeforeLoadEventHandler is never true.
+        * html/HTMLPlugInElement.h:
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::canLoadURL):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadWithDocumentLoader): Deleted the no-op code.
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::updateFromElement): Document will never have beforeload event listener
+        but keep the call to dispatchPendingBeforeLoadEvent since we depend on it updating renderer.
+        (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): Keep the only side effect left which is
+        to update the renderer.
+        * loader/ImageLoader.h:
+        * page/Settings.yaml: Deleted the option to enable beforeload event.
+
 2022-01-29  Patrick Griffis  <[email protected]>
 
         CSP: Properly block image content in object elements

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (288792 => 288793)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2022-01-29 21:00:55 UTC (rev 288793)
@@ -992,7 +992,6 @@
 $(PROJECT_DIR)/dom/AddEventListenerOptions.idl
 $(PROJECT_DIR)/dom/AnimationEvent.idl
 $(PROJECT_DIR)/dom/Attr.idl
-$(PROJECT_DIR)/dom/BeforeLoadEvent.idl
 $(PROJECT_DIR)/dom/BeforeUnloadEvent.idl
 $(PROJECT_DIR)/dom/BroadcastChannel.idl
 $(PROJECT_DIR)/dom/CDATASection.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (288792 => 288793)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-01-29 21:00:55 UTC (rev 288793)
@@ -266,8 +266,6 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBaseAudioContext.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBasicCredential.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBasicCredential.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBeforeLoadEvent.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBeforeLoadEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBeforeUnloadEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBeforeUnloadEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSBiquadFilterNode.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (288792 => 288793)


--- trunk/Source/WebCore/DerivedSources.make	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/DerivedSources.make	2022-01-29 21:00:55 UTC (rev 288793)
@@ -850,7 +850,6 @@
     $(WebCore)/dom/AddEventListenerOptions.idl \
     $(WebCore)/dom/AnimationEvent.idl \
     $(WebCore)/dom/Attr.idl \
-    $(WebCore)/dom/BeforeLoadEvent.idl \
     $(WebCore)/dom/BeforeUnloadEvent.idl \
     $(WebCore)/dom/BroadcastChannel.idl \
     $(WebCore)/dom/CDATASection.idl \

Modified: trunk/Source/WebCore/Sources.txt (288792 => 288793)


--- trunk/Source/WebCore/Sources.txt	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/Sources.txt	2022-01-29 21:00:55 UTC (rev 288793)
@@ -903,7 +903,6 @@
 dom/AllDescendantsCollection.cpp
 dom/AnimationEvent.cpp
 dom/Attr.cpp
-dom/BeforeLoadEvent.cpp
 dom/BeforeTextInsertedEvent.cpp
 dom/BeforeUnloadEvent.cpp
 dom/BoundaryPoint.cpp
@@ -2917,7 +2916,6 @@
 JSBarProp.cpp
 JSBaseAudioContext.cpp
 JSBasicCredential.cpp
-JSBeforeLoadEvent.cpp
 JSBeforeUnloadEvent.cpp
 JSBiquadFilterNode.cpp
 JSBiquadFilterOptions.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (288792 => 288793)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-29 21:00:55 UTC (rev 288793)
@@ -4226,8 +4226,6 @@
 		BC8C8FAE0DDCD31B00B592F4 /* RenderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8C8FAC0DDCD31B00B592F4 /* RenderStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC926F810C0552470082776B /* JSHTMLFrameSetElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC926F7F0C0552470082776B /* JSHTMLFrameSetElement.h */; };
 		BC9439C3116CF4940048C750 /* JSNodeCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9439C2116CF4940048C750 /* JSNodeCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		BC9462D8107A7B4C00857193 /* BeforeLoadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9462D7107A7B4C00857193 /* BeforeLoadEvent.h */; };
-		BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC946347107A936600857193 /* JSBeforeLoadEvent.h */; };
 		BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D14D0C275C68006BC617 /* JSHistory.h */; };
 		BC94D1540C275C8B006BC617 /* History.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1510C275C8B006BC617 /* History.h */; };
 		BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC96DB420F3A880E00573CB3 /* RenderBoxModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -15442,10 +15440,6 @@
 		BC926F7E0C0552470082776B /* JSHTMLFrameSetElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameSetElement.cpp; sourceTree = "<group>"; };
 		BC926F7F0C0552470082776B /* JSHTMLFrameSetElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLFrameSetElement.h; sourceTree = "<group>"; };
 		BC9439C2116CF4940048C750 /* JSNodeCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNodeCustom.h; sourceTree = "<group>"; };
-		BC9462CB107A7A3900857193 /* BeforeLoadEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BeforeLoadEvent.idl; sourceTree = "<group>"; };
-		BC9462D7107A7B4C00857193 /* BeforeLoadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BeforeLoadEvent.h; sourceTree = "<group>"; };
-		BC946345107A934B00857193 /* JSBeforeLoadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBeforeLoadEvent.cpp; sourceTree = "<group>"; };
-		BC946347107A936600857193 /* JSBeforeLoadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBeforeLoadEvent.h; sourceTree = "<group>"; };
 		BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformScreenMac.mm; sourceTree = "<group>"; };
 		BC94D14C0C275C68006BC617 /* JSHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistory.cpp; sourceTree = "<group>"; };
 		BC94D14D0C275C68006BC617 /* JSHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHistory.h; sourceTree = "<group>"; };
@@ -17338,7 +17332,6 @@
 		E3BF19E122AF2F55009C9926 /* XMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; };
 		E3BF19E322AF2FA5009C9926 /* OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OverconstrainedErrorEvent.cpp; sourceTree = "<group>"; };
 		E3BF19E422AF2FCF009C9926 /* CloseEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseEvent.cpp; sourceTree = "<group>"; };
-		E3BF19E522AF2FF4009C9926 /* BeforeLoadEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BeforeLoadEvent.cpp; sourceTree = "<group>"; };
 		E3BF19E622AF302A009C9926 /* HashChangeEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HashChangeEvent.cpp; sourceTree = "<group>"; };
 		E3BF19E722AF309F009C9926 /* SecurityPolicyViolationEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityPolicyViolationEvent.cpp; sourceTree = "<group>"; };
 		E3C0412D254CA29B0021D0E6 /* SystemSoundManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemSoundManager.h; sourceTree = "<group>"; };
@@ -27789,8 +27782,6 @@
 			children = (
 				319848031A1E6B5D00A13318 /* JSAnimationEvent.cpp */,
 				319848041A1E6B5D00A13318 /* JSAnimationEvent.h */,
-				BC946345107A934B00857193 /* JSBeforeLoadEvent.cpp */,
-				BC946347107A936600857193 /* JSBeforeLoadEvent.h */,
 				8225432CA9D4B4CF4628EC7F /* JSBeforeUnloadEvent.cpp */,
 				29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */,
 				836D032D1DA8A13200FFD96B /* JSClipboardEvent.cpp */,
@@ -32202,9 +32193,6 @@
 				A8C4A7FB09D563270003AC8D /* Attr.h */,
 				93EEC1E509C2877700C515D1 /* Attr.idl */,
 				A8C4A7F909D563270003AC8D /* Attribute.h */,
-				E3BF19E522AF2FF4009C9926 /* BeforeLoadEvent.cpp */,
-				BC9462D7107A7B4C00857193 /* BeforeLoadEvent.h */,
-				BC9462CB107A7A3900857193 /* BeforeLoadEvent.idl */,
 				AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */,
 				AB23A32609BBA7D00067CC53 /* BeforeTextInsertedEvent.h */,
 				85031B260A44EFC700F992E0 /* BeforeUnloadEvent.cpp */,
@@ -33589,7 +33577,6 @@
 				7156BCA121CA350F00534397 /* BasicEffectTiming.h in Headers */,
 				FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */,
 				FBD6AF8C15EF2604008B7110 /* BasicShapes.h in Headers */,
-				BC9462D8107A7B4C00857193 /* BeforeLoadEvent.h in Headers */,
 				AB23A32809BBA7D00067CC53 /* BeforeTextInsertedEvent.h in Headers */,
 				85031B3D0A44EFC700F992E0 /* BeforeUnloadEvent.h in Headers */,
 				B2C3DA240D006C1D00EF6F26 /* BidiContext.h in Headers */,
@@ -35154,7 +35141,6 @@
 				57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */,
 				BC124F000C26447A009E2349 /* JSBarProp.h in Headers */,
 				57C7A69F1E57917800C67D71 /* JSBasicCredential.h in Headers */,
-				BC946348107A936600857193 /* JSBeforeLoadEvent.h in Headers */,
 				6FA4454E898F2FC168BC38C1 /* JSBeforeUnloadEvent.h in Headers */,
 				FDF09DC91399B62200688E5B /* JSBiquadFilterNode.h in Headers */,
 				2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (288792 => 288793)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -62,7 +62,6 @@
     macro(AuthenticatorAttestationResponse) \
     macro(AuthenticatorResponse) \
     macro(BaseAudioContext) \
-    macro(BeforeLoadEvent) \
     macro(BlobEvent) \
     macro(BroadcastChannel) \
     macro(Cache) \

Deleted: trunk/Source/WebCore/dom/BeforeLoadEvent.cpp (288792 => 288793)


--- trunk/Source/WebCore/dom/BeforeLoadEvent.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/BeforeLoadEvent.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "BeforeLoadEvent.h"
-
-#include <wtf/IsoMallocInlines.h>
-
-namespace WebCore {
-
-WTF_MAKE_ISO_ALLOCATED_IMPL(BeforeLoadEvent);
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/dom/BeforeLoadEvent.h (288792 => 288793)


--- trunk/Source/WebCore/dom/BeforeLoadEvent.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/BeforeLoadEvent.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#pragma once
-
-#include "Event.h"
-#include "EventNames.h"
-
-namespace WebCore {
-
-class BeforeLoadEvent final : public Event {
-    WTF_MAKE_ISO_ALLOCATED(BeforeLoadEvent);
-public:
-    static Ref<BeforeLoadEvent> create(const String& url)
-    {
-        return adoptRef(*new BeforeLoadEvent(url));
-    }
-
-    struct Init : EventInit {
-        String url;
-    };
-
-    static Ref<BeforeLoadEvent> create(const AtomString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
-    {
-        return adoptRef(*new BeforeLoadEvent(type, initializer, isTrusted));
-    }
-
-    const String& url() const { return m_url; }
-
-    EventInterface eventInterface() const override { return BeforeLoadEventInterfaceType; }
-
-private:
-    explicit BeforeLoadEvent(const String& url)
-        : Event(eventNames().beforeloadEvent, CanBubble::No, IsCancelable::Yes)
-        , m_url(url)
-    {
-    }
-
-    BeforeLoadEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted)
-        : Event(type, initializer, isTrusted)
-        , m_url(initializer.url)
-    {
-    }
-
-    String m_url;
-};
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/dom/BeforeLoadEvent.idl (288792 => 288793)


--- trunk/Source/WebCore/dom/BeforeLoadEvent.idl	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/BeforeLoadEvent.idl	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-[
-    EnabledBySetting=LegacyBeforeLoadEventEnabled,
-    Exposed=Window
-] interface BeforeLoadEvent : Event {
-    constructor(DOMString type, optional BeforeLoadEventInit eventInitDict);
-
-    readonly attribute DOMString url;
-};
-
-dictionary BeforeLoadEventInit : EventInit {
-    DOMString url = ""
-};

Modified: trunk/Source/WebCore/dom/Document.cpp (288792 => 288793)


--- trunk/Source/WebCore/dom/Document.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -5220,8 +5220,6 @@
         addListenerType(DOMCHARACTERDATAMODIFIED_LISTENER);
     else if (eventType == eventNames().overflowchangedEvent)
         addListenerType(OVERFLOWCHANGED_LISTENER);
-    else if (eventType == eventNames().beforeloadEvent)
-        addListenerType(BEFORELOAD_LISTENER);
     else if (eventType == eventNames().scrollEvent)
         addListenerType(SCROLL_LISTENER);
     else if (eventType == eventNames().webkitmouseforcewillbeginEvent)

Modified: trunk/Source/WebCore/dom/Document.h (288792 => 288793)


--- trunk/Source/WebCore/dom/Document.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/Document.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -891,7 +891,7 @@
     // dispatch events unnecessarily
     // FIXME: Consider using OptionSet.
     enum ListenerType {
-        DOMSUBTREEMODIFIED_LISTENER          = 1,
+        DOMSUBTREEMODIFIED_LISTENER          = 1 << 0,
         DOMNODEINSERTED_LISTENER             = 1 << 1,
         DOMNODEREMOVED_LISTENER              = 1 << 2,
         DOMNODEREMOVEDFROMDOCUMENT_LISTENER  = 1 << 3,
@@ -899,14 +899,13 @@
         DOMCHARACTERDATAMODIFIED_LISTENER    = 1 << 5,
         OVERFLOWCHANGED_LISTENER             = 1 << 6,
         TRANSITIONEND_LISTENER               = 1 << 7,
-        BEFORELOAD_LISTENER                  = 1 << 8,
-        SCROLL_LISTENER                      = 1 << 9,
-        FORCEWILLBEGIN_LISTENER              = 1 << 10,
-        FORCECHANGED_LISTENER                = 1 << 11,
-        FORCEDOWN_LISTENER                   = 1 << 12,
-        FORCEUP_LISTENER                     = 1 << 13,
-        FOCUSIN_LISTENER                     = 1 << 14,
-        FOCUSOUT_LISTENER                    = 1 << 15,
+        SCROLL_LISTENER                      = 1 << 8,
+        FORCEWILLBEGIN_LISTENER              = 1 << 9,
+        FORCECHANGED_LISTENER                = 1 << 10,
+        FORCEDOWN_LISTENER                   = 1 << 11,
+        FORCEUP_LISTENER                     = 1 << 12,
+        FOCUSIN_LISTENER                     = 1 << 13,
+        FOCUSOUT_LISTENER                    = 1 << 14,
     };
 
     bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }

Modified: trunk/Source/WebCore/dom/EventNames.in (288792 => 288793)


--- trunk/Source/WebCore/dom/EventNames.in	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/EventNames.in	2022-01-29 21:00:55 UTC (rev 288793)
@@ -7,7 +7,7 @@
 HTMLEvents interfaceName=Event
 AnimationEvent
 AnimationPlaybackEvent
-BeforeLoadEvent
+BeforeLoadEvent interfaceName=Event
 BeforeUnloadEvent
 ClipboardEvent
 CloseEvent

Modified: trunk/Source/WebCore/dom/Node.cpp (288792 => 288793)


--- trunk/Source/WebCore/dom/Node.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/Node.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -27,7 +27,6 @@
 
 #include "AXObjectCache.h"
 #include "Attr.h"
-#include "BeforeLoadEvent.h"
 #include "ChildListMutationScope.h"
 #include "CommonVM.h"
 #include "ComposedTreeAncestorIterator.h"
@@ -42,6 +41,7 @@
 #include "ElementTraversal.h"
 #include "EventDispatcher.h"
 #include "EventHandler.h"
+#include "EventNames.h"
 #include "FrameView.h"
 #include "HTMLAreaElement.h"
 #include "HTMLBodyElement.h"
@@ -2409,20 +2409,6 @@
         underlyingClickEvent.setDefaultHandled();
 }
 
-bool Node::dispatchBeforeLoadEvent(const String& sourceURL)
-{
-    if (!document().settings().legacyBeforeLoadEventEnabled())
-        return true;
-
-    if (!document().hasListenerType(Document::BEFORELOAD_LISTENER))
-        return true;
-
-    Ref<Node> protectedThis(*this);
-    auto event = BeforeLoadEvent::create(sourceURL);
-    dispatchEvent(event);
-    return !event->defaultPrevented();
-}
-
 void Node::dispatchInputEvent()
 {
     dispatchScopedEvent(Event::create(eventNames().inputEvent, Event::CanBubble::Yes, Event::IsCancelable::No, Event::IsComposed::Yes));

Modified: trunk/Source/WebCore/dom/Node.h (288792 => 288793)


--- trunk/Source/WebCore/dom/Node.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/Node.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -478,8 +478,6 @@
     virtual bool allowsDoubleTapGesture() const { return true; }
 #endif
 
-    bool dispatchBeforeLoadEvent(const String& sourceURL);
-
     WEBCORE_EXPORT void dispatchInputEvent();
 
     // Perform the default action for an event.

Modified: trunk/Source/WebCore/dom/ProcessingInstruction.cpp (288792 => 288793)


--- trunk/Source/WebCore/dom/ProcessingInstruction.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/ProcessingInstruction.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -85,10 +85,6 @@
 
 void ProcessingInstruction::checkStyleSheet()
 {
-    // Prevent recursive loading of stylesheet.
-    if (m_isHandlingBeforeLoad)
-        return;
-
     if (m_target == "xml-stylesheet" && document().frame() && parentNode() == &document()) {
         // see http://www.w3.org/TR/xml-stylesheet/
         // ### support stylesheet included in a fragment of this (or another) document
@@ -143,12 +139,6 @@
 
             String url = ""
 
-            {
-            SetForScope<bool> change(m_isHandlingBeforeLoad, true);
-            if (!dispatchBeforeLoadEvent(url))
-                return;
-            }
-
             bool didEventListenerDisconnectThisElement = !isConnected() || &document() != originalDocument.ptr();
             if (didEventListenerDisconnectThisElement)
                 return;

Modified: trunk/Source/WebCore/dom/ProcessingInstruction.h (288792 => 288793)


--- trunk/Source/WebCore/dom/ProcessingInstruction.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/ProcessingInstruction.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -89,7 +89,6 @@
 #if ENABLE(XSLT)
     bool m_isXSL { false };
 #endif
-    bool m_isHandlingBeforeLoad { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/dom/ScriptElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -285,13 +285,7 @@
 
 bool ScriptElement::requestClassicScript(const String& sourceURL)
 {
-    Ref<Document> originalDocument(m_element.document());
-    if (!m_element.dispatchBeforeLoadEvent(sourceURL))
-        return false;
-    bool didEventListenerDisconnectThisElement = !m_element.isConnected() || &m_element.document() != originalDocument.ptr();
-    if (didEventListenerDisconnectThisElement)
-        return false;
-
+    ASSERT(m_element.isConnected());
     ASSERT(!m_loadableScript);
     if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
         auto script = LoadableClassicScript::create(
@@ -336,15 +330,9 @@
         crossOriginMode = ScriptElementCachedScriptFetcher::defaultCrossOriginModeForModule;
 
     if (hasSourceAttribute()) {
+        ASSERT(m_element.isConnected());
+
         String sourceURL = sourceAttributeValue();
-        Ref<Document> originalDocument(m_element.document());
-        if (!m_element.dispatchBeforeLoadEvent(sourceURL))
-            return false;
-
-        bool didEventListenerDisconnectThisElement = !m_element.isConnected() || &m_element.document() != originalDocument.ptr();
-        if (didEventListenerDisconnectThisElement)
-            return false;
-
         if (stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
             dispatchErrorEvent();
             return false;

Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -161,16 +161,6 @@
     parametersForPlugin(paramNames, paramValues);
 
     Ref<HTMLEmbedElement> protectedThis(*this); // Loading the plugin might remove us from the document.
-    bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url);
-    if (!beforeLoadAllowedLoad) {
-        if (is<PluginDocument>(document())) {
-            // Plugins inside plugin documents load differently than other plugins. By the time
-            // we are here in a plugin document, the load of the plugin (which is the plugin document's
-            // main resource) has already started. We need to explicitly cancel the main resource load here.
-            downcast<PluginDocument>(document()).cancelManualPluginLoad();
-        }
-        return;
-    }
     if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer.
         return;
 

Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLLinkElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -209,13 +209,7 @@
 
 bool HTMLLinkElement::shouldLoadLink()
 {
-    Ref<Document> originalDocument = document();
-    if (!dispatchBeforeLoadEvent(getNonEmptyURLAttribute(hrefAttr).string()))
-        return false;
-    // A beforeload handler might have removed us from the document or changed the document.
-    if (!isConnected() || &document() != originalDocument.ptr())
-        return false;
-    return true;
+    return isConnected();
 }
 
 void HTMLLinkElement::setCrossOrigin(const AtomString& value)

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1406,7 +1406,7 @@
                 return;
             }
 
-            if (!isSafeToLoadURL(absoluteURL, Complain) || !dispatchBeforeLoadEvent(absoluteURL.string())) {
+            if (!isSafeToLoadURL(absoluteURL, Complain)) {
                 mediaLoadingFailed(MediaPlayer::NetworkState::FormatError);
                 return;
             }
@@ -4884,7 +4884,7 @@
         }
 
         // Is it safe to load this url?
-        if (!isSafeToLoadURL(mediaURL, actionIfInvalid) || !dispatchBeforeLoadEvent(mediaURL.string()))
+        if (!isSafeToLoadURL(mediaURL, actionIfInvalid))
             goto CheckAgain;
 
         // A 'beforeload' event handler can mutate the DOM, so check to see if the source element is still a child node.

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -276,14 +276,11 @@
 
     setNeedsWidgetUpdate(false);
 
-    Ref<HTMLObjectElement> protectedThis(*this); // beforeload and plugin loading can make arbitrary DOM mutations.
-    bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url);
-    if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer.
-        return;
+    Ref protectedThis = *this; // Plugin loading can make arbitrary DOM mutations.
 
     // Dispatching a beforeLoad event could have executed code that changed the document.
     // Make sure the URL is still safe to load.
-    bool success = beforeLoadAllowedLoad && hasValidClassId() && canLoadURL(url);
+    bool success = hasValidClassId() && canLoadURL(url);
     if (success)
         success = requestObject(url, serviceType, paramNames, paramValues);
     if (!success && hasFallbackContent())

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -107,29 +107,8 @@
     return m_instance.get();
 }
 
-bool HTMLPlugInElement::guardedDispatchBeforeLoadEvent(const String& sourceURL)
-{
-    // FIXME: Our current plug-in loading design can't guarantee the following
-    // assertion is true, since plug-in loading can be initiated during layout,
-    // and synchronous layout can be initiated in a beforeload event handler!
-    // See <http://webkit.org/b/71264>.
-    // ASSERT(!m_inBeforeLoadEventHandler);
-    m_inBeforeLoadEventHandler = true;
-    // static_cast is used to avoid a compile error since dispatchBeforeLoadEvent
-    // is intentionally undefined on this class.
-    bool beforeLoadAllowedLoad = static_cast<HTMLFrameOwnerElement*>(this)->dispatchBeforeLoadEvent(sourceURL);
-    m_inBeforeLoadEventHandler = false;
-    return beforeLoadAllowedLoad;
-}
-
 Widget* HTMLPlugInElement::pluginWidget(PluginLoadingPolicy loadPolicy) const
 {
-    if (m_inBeforeLoadEventHandler) {
-        // The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
-        // That would recursively call beforeload for the same element.
-        return nullptr;
-    }
-
     RenderWidget* renderWidget = loadPolicy == PluginLoadingPolicy::Load ? renderWidgetLoadingPlugin() : this->renderWidget();
     if (!renderWidget)
         return nullptr;

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLPlugInElement.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -93,9 +93,6 @@
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
     void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
-    // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
-    bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
-
     // This will load the plugin if necessary.
     virtual RenderWidget* renderWidgetLoadingPlugin() const;
 
@@ -103,8 +100,6 @@
     void swapRendererTimerFired();
     bool shouldOverridePlugin(const String& url, const String& mimeType);
 
-    bool dispatchBeforeLoadEvent(const String& sourceURL) = delete; // Generate a compile error if someone calls this by mistake.
-
     bool supportsFocus() const final;
 
     bool isKeyboardFocusable(KeyboardEvent*) const final;
@@ -114,7 +109,6 @@
     RefPtr<JSC::Bindings::Instance> m_instance;
     Timer m_swapRendererTimer;
     bool m_isCapturingMouseEvents { false };
-    bool m_inBeforeLoadEventHandler { false };
     DisplayState m_displayState { Playing };
 };
 

Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (288792 => 288793)


--- trunk/Source/WebCore/html/HTMLTrackElement.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/html/HTMLTrackElement.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -229,7 +229,7 @@
         return false;
     }
 
-    return dispatchBeforeLoadEvent(url.string());
+    return true;
 }
 
 void HTMLTrackElement::didCompleteLoad(LoadStatus status)

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (288792 => 288793)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -1550,8 +1550,7 @@
 {
     FRAMELOADER_RELEASE_LOG(ResourceLoading, "loadWithDocumentLoader: frame load started");
 
-    // Retain because dispatchBeforeLoadEvent may release the last reference to it.
-    Ref<Frame> protect(m_frame);
+    Ref protectedFrame = m_frame;
 
     CompletionHandlerCallingScope completionHandlerCaller(WTFMove(completionHandler));
 
@@ -1612,19 +1611,6 @@
     if (loader->triggeringAction().isEmpty())
         loader->setTriggeringAction({ *m_frame.document(), loader->request(), InitiatedByMainFrame::Unknown, policyChecker().loadType(), isFormSubmission });
 
-    if (Element* ownerElement = m_frame.ownerElement()) {
-        // We skip dispatching the beforeload event if we've already
-        // committed a real document load because the event would leak
-        // subsequent activity by the frame which the parent frame isn't
-        // supposed to learn. For example, if the child frame navigated to
-        // a new URL, the parent frame shouldn't learn the URL.
-        if (!m_stateMachine.committedFirstRealDocumentLoad()
-            && !ownerElement->dispatchBeforeLoadEvent(loader->request().url().string())) {
-            continueLoadAfterNavigationPolicy(loader->request(), formState.get(), NavigationPolicyDecision::IgnoreLoad, allowNavigationToInvalidURL);
-            return;
-        }
-    }
-
     m_frame.navigationScheduler().cancel(NewLoadInProgress::Yes);
 
     if (shouldTreatCurrentLoadAsContinuingLoad()) {

Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (288792 => 288793)


--- trunk/Source/WebCore/loader/ImageLoader.cpp	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp	2022-01-29 21:00:55 UTC (rev 288793)
@@ -71,6 +71,7 @@
 
 namespace WebCore {
 
+// FIXME: beforeload event no longer exists. Delete this code.
 static ImageEventSender& beforeLoadEventSender()
 {
     static NeverDestroyed<ImageEventSender> sender(eventNames().beforeloadEvent);
@@ -263,12 +264,9 @@
         m_imageComplete = !newImage;
 
         if (newImage) {
-            if (!document.isImageDocument()) {
-                if (!document.hasListenerType(Document::BEFORELOAD_LISTENER))
-                    dispatchPendingBeforeLoadEvent();
-                else
-                    beforeLoadEventSender().dispatchEventSoon(*this);
-            } else
+            if (!document.isImageDocument())
+                dispatchPendingBeforeLoadEvent();
+            else
                 updateRenderer();
 
             if (m_lazyImageLoadState == LazyImageLoadState::Deferred)
@@ -510,29 +508,9 @@
     if (!element().document().hasLivingRenderTree())
         return;
     m_hasPendingBeforeLoadEvent = false;
-    Ref<Document> originalDocument = element().document();
-    if (element().dispatchBeforeLoadEvent(m_image->url().string())) {
-        bool didEventListenerDisconnectThisElement = !element().isConnected() || &element().document() != originalDocument.ptr();
-        if (didEventListenerDisconnectThisElement)
-            return;
-        
-        updateRenderer();
+    if (!element().isConnected())
         return;
-    }
-    if (m_image) {
-        m_image->removeClient(*this);
-        m_image = nullptr;
-    }
-
-    loadEventSender().cancelEvent(*this);
-    m_hasPendingLoadEvent = false;
-    
-    if (is<HTMLObjectElement>(element()))
-        downcast<HTMLObjectElement>(element()).renderFallbackContent();
-
-    // Only consider updating the protection ref-count of the Element immediately before returning
-    // from this function as doing so might result in the destruction of this ImageLoader.
-    updatedHasPendingEvent();
+    updateRenderer();
 }
 
 void ImageLoader::dispatchPendingLoadEvent()

Modified: trunk/Source/WebCore/loader/ImageLoader.h (288792 => 288793)


--- trunk/Source/WebCore/loader/ImageLoader.h	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/loader/ImageLoader.h	2022-01-29 21:00:55 UTC (rev 288793)
@@ -70,6 +70,7 @@
 
     void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
 
+    // FIXME: Delete this code. beforeload event no longer exists.
     bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
     bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
 

Modified: trunk/Source/WebCore/page/Settings.yaml (288792 => 288793)


--- trunk/Source/WebCore/page/Settings.yaml	2022-01-29 19:27:59 UTC (rev 288792)
+++ trunk/Source/WebCore/page/Settings.yaml	2022-01-29 21:00:55 UTC (rev 288793)
@@ -314,14 +314,6 @@
     WebCore:
       default: false
 
-LegacyBeforeLoadEventEnabled:
-  comment: >-
-    FIMXE: This does not appear to ever be set to true. Remove once verified.
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
 LocalStorageDatabasePath:
   type: String
   defaultValue:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to