+2017-08-01 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Convert MutationCallback to be a normal generate callback
+ https://bugs.webkit.org/show_bug.cgi?id=174140
+
+ Reviewed by Darin Adler.
+
+ * fast/dom/MutationObserver/mutation-observer-constructor-expected.txt:
+ Update results for standard error messages.
+
2017-08-03 Chris Dumez <cdumez@apple.com>
Improve our support for referrer policies
PASS typeof WebKitMutationObserver.prototype.disconnect is "function"
PASS typeof observer.observe is "function"
PASS typeof observer.disconnect is "function"
-PASS new MutationObserver({ handleEvent: function() {} }) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be an instance of MutationCallback.
-PASS new MutationObserver({}) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be an instance of MutationCallback.
-PASS new MutationObserver(42) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be an instance of MutationCallback.
-PASS new MutationObserver("foo") threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be an instance of MutationCallback.
+PASS new MutationObserver({ handleEvent: function() {} }) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be a function.
+PASS new MutationObserver({}) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be a function.
+PASS new MutationObserver(42) threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be a function.
+PASS new MutationObserver("foo") threw exception TypeError: Argument 1 ('callback') to the MutationObserver constructor must be a function.
PASS successfullyParsed is true
TEST COMPLETE
dom/MessagePort.idl
dom/MouseEvent.idl
dom/MouseEventInit.idl
+ dom/MutationCallback.idl
dom/MutationEvent.idl
dom/MutationObserver.idl
dom/MutationRecord.idl
bindings/js/JSMessageChannelCustom.cpp
bindings/js/JSMessageEventCustom.cpp
bindings/js/JSMessagePortCustom.cpp
- bindings/js/JSMutationCallback.cpp
bindings/js/JSMutationObserverCustom.cpp
bindings/js/JSNodeCustom.cpp
bindings/js/JSNodeIteratorCustom.cpp
+2017-08-02 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Convert MutationCallback to be a normal generated callback
+ https://bugs.webkit.org/show_bug.cgi?id=174140
+
+ Reviewed by Darin Adler.
+
+ To make this work more nicely, I:
+ - Added the ability to for non-nullable interfaces in sequences to be passed
+ via a Ref<> rather than a RefPtr<> as a parameter to a callback function.
+ (e.g. callback MyCallback = void (sequence<Foo> foos) will now have the
+ signature, CallbackResult<void> handleEvent(const Vector<Ref<Foo>>&) rather
+ than CallbackResult<void> handleEvent(const Vector<RefPtr<Foo>>&).
+ - Added a new extended attribute for callback functions called [CallbackThisObject=Type]
+ which allows you to specify that the callback needs a this object in addition
+ to its arguments. When specified, the first argument of the C++ implementation
+ function will now correspond to the this object, with the remaining arguments
+ shifted over one.
+ - Converted callback objects to all inherit directly from ActiveDOMCallback rather
+ than having the generated JS callback derived class inherit from it. This allows
+ us to have access to a callback's canInvokeCallback() function anywhere (needed
+ for MutationCallback) as well as giving a place to put an optional virtual
+ visitJSFunction to allow marking weak callbacks (while not an ideal layering,
+ this matches what we do in EventListener). This change requires each callback to
+ have a bit more code to import the ActiveDOMCallback's constructor and requires
+ non-JS derived callbacks to pass a ScriptExecutionContext (e.g. the Document).
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSMutationCallback.cpp: Removed.
+ * bindings/js/JSMutationCallback.h: Removed.
+ Remove custom JSMutationCallback.h/cpp
+
+ * Modules/geolocation/PositionCallback.h:
+ * Modules/geolocation/PositionErrorCallback.h:
+ * Modules/notifications/NotificationPermissionCallback.h:
+ * Modules/webaudio/AudioBufferCallback.h:
+ * Modules/webdatabase/DatabaseCallback.h:
+ * Modules/webdatabase/SQLStatementCallback.h:
+ * Modules/webdatabase/SQLStatementErrorCallback.h:
+ * Modules/webdatabase/SQLTransactionCallback.h:
+ * Modules/webdatabase/SQLTransactionErrorCallback.h:
+ * css/MediaQueryListListener.h:
+ * dom/NodeFilter.h:
+ * dom/RequestAnimationFrameCallback.h:
+ * dom/StringCallback.h:
+ * fileapi/BlobCallback.h:
+ * html/VoidCallback.h:
+ * page/IntersectionObserverCallback.h:
+ * page/PerformanceObserverCallback.h:
+ Add ActiveDOMCallback as a base class. Import the ActiveDOMCallback constructor.
+
+ * Modules/mediastream/MediaDevicesRequest.cpp:
+ (WebCore::MediaDevicesRequest::filterDeviceList):
+ (WebCore::MediaDevicesRequest::start):
+ * Modules/mediastream/MediaDevicesRequest.h:
+ Change filterDeviceList to take a Vector of Refs.
+
+ * bindings/IDLTypes.h:
+ Add InnerParameterType and NullableInnerParameterType type hooks
+ and specialize wrappers to use Ref for InnerParameterType, and RefPtr
+ for NullableInnerParameterType.
+
+ * bindings/js/JSCallbackData.cpp:
+ * bindings/js/JSCallbackData.h:
+ Add support for passing a this object and give JSCallbackDataWeak a visitJSFunction
+ to allow marking the underlying function.
+
+ * bindings/js/JSMutationObserverCustom.cpp:
+ (WebCore::JSMutationObserver::visitAdditionalChildren):
+ (WebCore::constructJSMutationObserver): Deleted.
+ Remove the custom constructor and replace it with a custom visitAdditionalChildren
+ that calls the new ActiveDOMObject's visitJSFunction.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (ParseType):
+ Add helper to parse a type and cache the result.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateCallbackHeaderContent):
+ (GenerateCallbackImplementationContent):
+ (GetJSCallbackDataType): Deleted.
+ - Add support for [CallbackThisObject]. When [CallbackThisObject] is not specified, use jsUndefined()
+ as the this object as specified by WebIDL.
+ - Stop inheriting from ActiveDOMCallback now that callbacks need to do this themselves.
+ - Add a visitJSFunction override for weak callback functions which calls into the callback data.
+
+ * bindings/scripts/IDLAttributes.json:
+ Add [CallbackThisObject].
+
+ * bindings/scripts/IDLParser.pm:
+ (ParseType):
+ Add entry point to parse a single type.
+
+ * css/FontFaceSet.h:
+ Use Ref rather than RefPtr for the faces sequence.
+
+ * dom/ActiveDOMCallback.h:
+ (WebCore::ActiveDOMCallback::visitJSFunction):
+ Add an optional visitJSFunction virtual function so that derived classes
+ have a way of marking underlying function objects.
+
+ * dom/MutationCallback.h:
+ Convert to support generation (return a CallbackResult, inherit from ActiveDOMObject).
+
+ * dom/MutationCallback.idl: Added.
+ Added to generate the callback. Uses the new [CallbackThisObject].
+
+ * dom/MutationObserver.cpp:
+ (WebCore::MutationObserver::deliver):
+ Switch to call idiomatic handleEvent, and pass *this as the first parameter
+ which will be translated into the this object.
+
+ * dom/MutationObserver.h:
+ (WebCore::MutationObserver::callback):
+ Expose the callback so it can marked during GC.
+
+ * dom/MutationObserver.idl:
+ Remove CustomConstructor and replace it with a custom mark function.
+
+ * dom/NativeNodeFilter.cpp:
+ * dom/NativeNodeFilter.h:
+ * inspector/InspectorDatabaseAgent.cpp:
+ Pass now needed ScriptExecutionContext to non-js based callbacks.
+
+ * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: Added.
+ * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h: Added.
+ * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackInterface.h:
+ * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
+ * bindings/scripts/test/TestCallbackFunctionWithThisObject.idl: Added.
+ * bindings/scripts/test/TestCallbackInterface.idl:
+ Add/update tests.
+
2017-08-03 Jeremy Jones <jeremyj@apple.com>
Use MPAVRoutingController instead of deprecated versions.
$(WebCore)/dom/MessagePort.idl \
$(WebCore)/dom/MouseEvent.idl \
$(WebCore)/dom/MouseEventInit.idl \
+ $(WebCore)/dom/MutationCallback.idl \
$(WebCore)/dom/MutationEvent.idl \
$(WebCore)/dom/MutationObserver.idl \
$(WebCore)/dom/MutationRecord.idl \
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class Geoposition;
-class PositionCallback : public RefCounted<PositionCallback> {
+class PositionCallback : public RefCounted<PositionCallback>, public ActiveDOMCallback {
public:
- virtual ~PositionCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(Geoposition*) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class PositionError;
-class PositionErrorCallback : public RefCounted<PositionErrorCallback> {
+class PositionErrorCallback : public RefCounted<PositionErrorCallback>, public ActiveDOMCallback {
public:
- virtual ~PositionErrorCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(PositionError&) = 0;
};
ContextDestructionObserver::contextDestroyed();
}
-void MediaDevicesRequest::filterDeviceList(Vector<RefPtr<MediaDeviceInfo>>& devices)
+void MediaDevicesRequest::filterDeviceList(Vector<Ref<MediaDeviceInfo>>& devices)
{
#if !PLATFORM(COCOA)
UNUSED_PARAM(devices);
int cameraCount = 0;
int microphoneCount = 0;
- devices.removeAllMatching([&](const RefPtr<MediaDeviceInfo>& device) -> bool {
+ devices.removeAllMatching([&](const Ref<MediaDeviceInfo>& device) -> bool {
if (device->kind() == MediaDeviceInfo::Kind::Videoinput && ++cameraCount > defaultCameraCount)
return true;
if (device->kind() == MediaDeviceInfo::Kind::Audioinput && ++microphoneCount > defaultMicrophoneCount)
Document& document = downcast<Document>(*scriptExecutionContext());
document.setDeviceIDHashSalt(deviceIdentifierHashSalt);
- Vector<RefPtr<MediaDeviceInfo>> devices;
+ Vector<Ref<MediaDeviceInfo>> devices;
for (auto& deviceInfo : captureDevices) {
auto label = emptyString();
if (originHasPersistentAccess || document.hasHadActiveMediaStreamTrack())
void contextDestroyed() final;
- void filterDeviceList(Vector<RefPtr<MediaDeviceInfo>>&);
+ void filterDeviceList(Vector<Ref<MediaDeviceInfo>>&);
MediaDevices::EnumerateDevicesPromise m_promise;
RefPtr<MediaDevicesRequest> m_protector;
#if ENABLE(NOTIFICATIONS)
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include "Notification.h"
#include <wtf/Forward.h>
namespace WebCore {
-class NotificationPermissionCallback : public RefCounted<NotificationPermissionCallback> {
+class NotificationPermissionCallback : public RefCounted<NotificationPermissionCallback>, public ActiveDOMCallback {
public:
- virtual ~NotificationPermissionCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(Notification::Permission) = 0;
};
#if ENABLE(WEB_AUDIO)
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class AudioBuffer;
-class AudioBufferCallback : public RefCounted<AudioBufferCallback> {
+class AudioBufferCallback : public RefCounted<AudioBufferCallback>, public ActiveDOMCallback {
public:
- virtual ~AudioBufferCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(AudioBuffer*) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/ThreadSafeRefCounted.h>
class Database;
-class DatabaseCallback : public ThreadSafeRefCounted<DatabaseCallback> {
+class DatabaseCallback : public ThreadSafeRefCounted<DatabaseCallback>, public ActiveDOMCallback {
public:
- virtual ~DatabaseCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(Database&) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/ThreadSafeRefCounted.h>
class SQLTransaction;
class SQLResultSet;
-class SQLStatementCallback : public ThreadSafeRefCounted<SQLStatementCallback> {
+class SQLStatementCallback : public ThreadSafeRefCounted<SQLStatementCallback>, public ActiveDOMCallback {
public:
- virtual ~SQLStatementCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(SQLTransaction&, SQLResultSet&) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/ThreadSafeRefCounted.h>
class SQLTransaction;
class SQLError;
-class SQLStatementErrorCallback : public ThreadSafeRefCounted<SQLStatementErrorCallback> {
+class SQLStatementErrorCallback : public ThreadSafeRefCounted<SQLStatementErrorCallback>, public ActiveDOMCallback {
public:
- virtual ~SQLStatementErrorCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<bool> handleEvent(SQLTransaction&, SQLError&) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/ThreadSafeRefCounted.h>
class SQLTransaction;
-class SQLTransactionCallback : public ThreadSafeRefCounted<SQLTransactionCallback> {
+class SQLTransactionCallback : public ThreadSafeRefCounted<SQLTransactionCallback>, public ActiveDOMCallback {
public:
- virtual ~SQLTransactionCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(SQLTransaction&) = 0;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/ThreadSafeRefCounted.h>
class SQLError;
-class SQLTransactionErrorCallback : public ThreadSafeRefCounted<SQLTransactionErrorCallback> {
+class SQLTransactionErrorCallback : public ThreadSafeRefCounted<SQLTransactionErrorCallback>, public ActiveDOMCallback {
public:
- virtual ~SQLTransactionErrorCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(SQLError&) = 0;
};
7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D531DD7B09300128552 /* SVGLengthValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CD0BA041B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */; };
7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
+ 7CD344161F3183A5000DCD49 /* JSMutationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD344121F3108E2000DCD49 /* JSMutationCallback.cpp */; };
7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CDE8EBE1F193BCB00168FE7 /* CSSStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDE8EBC1F193BC500168FE7 /* CSSStyleDeclaration.cpp */; };
C6F0902C14327D4F00685849 /* JSMutationObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F0902414327D4F00685849 /* JSMutationObserver.cpp */; };
C6F0902D14327D4F00685849 /* JSMutationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F0902514327D4F00685849 /* JSMutationObserver.h */; };
C6F0917F143A2BB900685849 /* JSMutationObserverCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */; };
- C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F420A016B7164E0052A9F2 /* JSMutationCallback.cpp */; };
- C6F420A316B7164E0052A9F2 /* JSMutationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */; };
C9026B651B1CF5FE001D99A7 /* JSMediaRemoteControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9026B631B1CF5AB001D99A7 /* JSMediaRemoteControls.cpp */; };
C9027F411B1D0AD200BFBFEF /* MediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9027F3F1B1D0AD200BFBFEF /* MediaSession.cpp */; };
C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = C9027F401B1D0AD200BFBFEF /* MediaSession.h */; };
7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMCallbackMicrotask.cpp; sourceTree = "<group>"; };
7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
+ 7CD3440D1F310836000DCD49 /* MutationCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MutationCallback.idl; sourceTree = "<group>"; };
+ 7CD344111F3108DD000DCD49 /* JSMutationCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSMutationCallback.h; sourceTree = "<group>"; };
+ 7CD344121F3108E2000DCD49 /* JSMutationCallback.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationCallback.cpp; sourceTree = "<group>"; };
7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
7CDE8EBC1F193BC500168FE7 /* CSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSStyleDeclaration.cpp; sourceTree = "<group>"; };
C6F0902414327D4F00685849 /* JSMutationObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationObserver.cpp; sourceTree = "<group>"; };
C6F0902514327D4F00685849 /* JSMutationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMutationObserver.h; sourceTree = "<group>"; };
C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationObserverCustom.cpp; sourceTree = "<group>"; };
- C6F420A016B7164E0052A9F2 /* JSMutationCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationCallback.cpp; sourceTree = "<group>"; };
- C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMutationCallback.h; sourceTree = "<group>"; };
C9026B631B1CF5AB001D99A7 /* JSMediaRemoteControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaRemoteControls.cpp; sourceTree = "<group>"; };
C9026B641B1CF5AB001D99A7 /* JSMediaRemoteControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaRemoteControls.h; sourceTree = "<group>"; };
C9027F3E1B1D0AB900BFBFEF /* MediaSession.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaSession.idl; sourceTree = "<group>"; };
46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */,
BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */,
BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
+ D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
512BDB4C1C46B0FF006494DF /* JSIDBCursorCustom.cpp */,
5141298D1C5FD7E90059E714 /* JSIDBCursorWithValueCustom.cpp */,
5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */,
415CDAF61E6CE0D3004F11EE /* JSMediaStreamTrackCustom.cpp */,
E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */,
E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */,
+ C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */,
BC9439C2116CF4940048C750 /* JSNodeCustom.h */,
1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
name = "Promises Only";
sourceTree = "<group>";
};
+ 7CD3441B1F32DE30000DCD49 /* Cached Attributes w/ Invalidation */ = {
+ isa = PBXGroup;
+ children = (
+ DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
+ BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
+ 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
+ A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
+ BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
+ );
+ name = "Cached Attributes w/ Invalidation";
+ sourceTree = "<group>";
+ };
7E4DE10B198B10810051CB02 /* cocoa */ = {
isa = PBXGroup;
children = (
BC64649611D82349006455B0 /* JSDOMStringMap.h */,
65DF31E509D1CC60000BE325 /* JSElement.cpp */,
65DF31E609D1CC60000BE325 /* JSElement.h */,
+ 7CD344121F3108E2000DCD49 /* JSMutationCallback.cpp */,
+ 7CD344111F3108DD000DCD49 /* JSMutationCallback.h */,
C6F0902414327D4F00685849 /* JSMutationObserver.cpp */,
C6F0902514327D4F00685849 /* JSMutationObserver.h */,
C6F08FC71431000D00685849 /* JSMutationRecord.cpp */,
children = (
7C3D8EE41E08BABE0023B084 /* GC / Wrapping Only */,
7CBA5BA91F0B51480034D745 /* Promises Only */,
+ 7CD3441B1F32DE30000DCD49 /* Cached Attributes w/ Invalidation */,
E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */,
9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */,
- DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
- BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
- D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
- 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
- C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
- A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */,
57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */,
E1FF8F661807460800132674 /* JSWebKitSubtleCryptoCustom.cpp */,
- BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
);
name = Custom;
sourceTree = "<group>";
93B70D4E09EB0C7C009D8468 /* JSEventListener.h */,
935F45400F7C3B5F00D7C1FB /* JSLazyEventListener.cpp */,
935F45410F7C3B5F00D7C1FB /* JSLazyEventListener.h */,
- C6F420A016B7164E0052A9F2 /* JSMutationCallback.cpp */,
- C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */,
BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */,
BCA378BB0D15F64200B793D6 /* ScheduledAction.h */,
);
85031B310A44EFC700F992E0 /* MouseRelatedEvent.cpp */,
85031B320A44EFC700F992E0 /* MouseRelatedEvent.h */,
C6F0900114327B6100685849 /* MutationCallback.h */,
+ 7CD3440D1F310836000DCD49 /* MutationCallback.idl */,
85031B330A44EFC700F992E0 /* MutationEvent.cpp */,
85031B340A44EFC700F992E0 /* MutationEvent.h */,
93EEC1F309C2877700C515D1 /* MutationEvent.idl */,
2D6F3E951C1F85550061DBD4 /* JSMockPageOverlay.h in Headers */,
A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */,
- C6F420A316B7164E0052A9F2 /* JSMutationCallback.h in Headers */,
65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */,
C6F0902D14327D4F00685849 /* JSMutationObserver.h in Headers */,
C6F08FCA1431000D00685849 /* JSMutationRecord.h in Headers */,
E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */,
A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
830A36BC1DAC5FAD006D7D09 /* JSMouseEventInit.cpp in Sources */,
- C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */,
65DF31FB09D1CC60000BE325 /* JSMutationEvent.cpp in Sources */,
C6F0902C14327D4F00685849 /* JSMutationObserver.cpp in Sources */,
C6F0917F143A2BB900685849 /* JSMutationObserverCustom.cpp in Sources */,
B22279F90D00BF220071B782 /* SVGFEOffsetElement.cpp in Sources */,
B22279FC0D00BF220071B782 /* SVGFEPointLightElement.cpp in Sources */,
B22279FF0D00BF220071B782 /* SVGFESpecularLightingElement.cpp in Sources */,
+ 7CD344161F3183A5000DCD49 /* JSMutationCallback.cpp in Sources */,
B2227A020D00BF220071B782 /* SVGFESpotLightElement.cpp in Sources */,
B2227A050D00BF220071B782 /* SVGFETileElement.cpp in Sources */,
B2227A080D00BF220071B782 /* SVGFETurbulenceElement.cpp in Sources */,
using ParameterType = T;
using NullableParameterType = std::optional<ImplementationType>;
+ using InnerParameterType = T;
+ using NullableInnerParameterType = std::optional<ImplementationType>;
+
using NullableType = std::optional<ImplementationType>;
static NullableType nullValue() { return std::nullopt; }
static bool isNullValue(const NullableType& value) { return !value; }
using ParameterType = T&;
using NullableParameterType = T*;
+ using InnerParameterType = Ref<T>;
+ using NullableInnerParameterType = RefPtr<T>;
+
using NullableType = RefPtr<T>;
static inline std::nullptr_t nullValue() { return nullptr; }
template<typename U> static inline bool isNullValue(U&& value) { return !value; }
using ParameterType = typename T::NullableParameterType;
using NullableParameterType = typename T::NullableParameterType;
+ using InnerParameterType = typename T::NullableInnerParameterType;
+ using NullableInnerParameterType = typename T::NullableInnerParameterType;
+
using NullableType = typename T::NullableType;
static inline auto nullValue() -> decltype(T::nullValue()) { return T::nullValue(); }
template<typename U> static inline bool isNullValue(U&& value) { return T::isNullValue(std::forward<U>(value)); }
template<typename T> struct IDLSequence : IDLType<Vector<typename T::ImplementationType>> {
using InnerType = T;
- using ParameterType = const Vector<typename T::ImplementationType>&;
- using NullableParameterType = const std::optional<Vector<typename T::ImplementationType>>&;
+ using ParameterType = const Vector<typename T::InnerParameterType>&;
+ using NullableParameterType = const std::optional<Vector<typename T::InnerParameterType>>&;
};
template<typename T> struct IDLFrozenArray : IDLType<Vector<typename T::ImplementationType>> {
namespace WebCore {
-JSValue JSCallbackData::invokeCallback(JSDOMGlobalObject& globalObject, JSObject* callback, MarkedArgumentBuffer& args, CallbackType method, PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
+JSValue JSCallbackData::invokeCallback(JSDOMGlobalObject& globalObject, JSObject* callback, JSValue thisValue, MarkedArgumentBuffer& args, CallbackType method, PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
{
ASSERT(callback);
returnedException = nullptr;
JSValue result = context->isDocument()
- ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, callback, args, returnedException)
- : JSC::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, callback, args, returnedException);
+ ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, thisValue, args, returnedException)
+ : JSC::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, thisValue, args, returnedException);
InspectorInstrumentation::didCallFunction(cookie, context);
return result;
}
+void JSCallbackDataWeak::visitJSFunction(JSC::SlotVisitor& vistor)
+{
+ vistor.append(m_callback);
+}
+
bool JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, SlotVisitor& visitor)
{
return visitor.containsOpaqueRoot(context);
#endif
}
- static JSC::JSValue invokeCallback(JSDOMGlobalObject&, JSC::JSObject* callback, JSC::MarkedArgumentBuffer&, CallbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException);
+ static JSC::JSValue invokeCallback(JSDOMGlobalObject&, JSC::JSObject* callback, JSC::JSValue thisValue, JSC::MarkedArgumentBuffer&, CallbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException);
private:
JSC::Weak<JSDOMGlobalObject> m_globalObject;
JSC::JSObject* callback() { return m_callback.get(); }
- JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer& args, CallbackType callbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
+ JSC::JSValue invokeCallback(JSC::JSValue thisValue, JSC::MarkedArgumentBuffer& args, CallbackType callbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
{
auto* globalObject = this->globalObject();
if (!globalObject)
return { };
- return JSCallbackData::invokeCallback(*globalObject, callback(), args, callbackType, functionName, returnedException);
+ return JSCallbackData::invokeCallback(*globalObject, callback(), thisValue, args, callbackType, functionName, returnedException);
}
private:
JSC::JSObject* callback() { return m_callback.get(); }
- JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer& args, CallbackType callbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
+ JSC::JSValue invokeCallback(JSC::JSValue thisValue, JSC::MarkedArgumentBuffer& args, CallbackType callbackType, JSC::PropertyName functionName, NakedPtr<JSC::Exception>& returnedException)
{
auto* globalObject = this->globalObject();
if (!globalObject)
return { };
- return JSCallbackData::invokeCallback(*globalObject, callback(), args, callbackType, functionName, returnedException);
+ return JSCallbackData::invokeCallback(*globalObject, callback(), thisValue, args, callbackType, functionName, returnedException);
}
+ void visitJSFunction(JSC::SlotVisitor&);
+
private:
class WeakOwner : public JSC::WeakHandleOwner {
bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&) override;
+++ /dev/null
-/*
- * Copyright (C) 2013 Google 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. AND ITS CONTRIBUTORS ``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 ITS 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 "JSMutationCallback.h"
-
-#include "JSDOMConvertInterface.h"
-#include "JSDOMConvertSequences.h"
-#include "JSDOMGlobalObject.h"
-#include "JSMainThreadExecState.h"
-#include "JSMainThreadExecStateInstrumentation.h"
-#include "JSMutationObserver.h"
-#include "JSMutationRecord.h"
-#include "ScriptExecutionContext.h"
-#include <heap/WeakInlines.h>
-#include <runtime/JSLock.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSMutationCallback::JSMutationCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
- : ActiveDOMCallback(globalObject->scriptExecutionContext())
- , m_callback(callback)
- , m_isolatedWorld(globalObject->world())
-{
-}
-
-JSMutationCallback::~JSMutationCallback()
-{
-}
-
-void JSMutationCallback::call(const Vector<Ref<MutationRecord>>& mutations, MutationObserver* observer)
-{
- if (!canInvokeCallback())
- return;
-
- Ref<JSMutationCallback> protectedThis(*this);
-
- JSLockHolder lock(m_isolatedWorld->vm());
-
- if (!m_callback)
- return;
-
- JSValue callback = m_callback.get();
- CallData callData;
- CallType callType = getCallData(callback, callData);
- if (callType == CallType::None) {
- ASSERT_NOT_REACHED();
- return;
- }
-
- ScriptExecutionContext* context = scriptExecutionContext();
- if (!context)
- return;
- ASSERT(context->isDocument());
-
- JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld);
- ExecState* exec = globalObject->globalExec();
-
- JSValue jsObserver = toJS(exec, globalObject, observer);
-
- MarkedArgumentBuffer args;
- args.append(toJS<IDLSequence<IDLInterface<MutationRecord>>>(*exec, *globalObject, mutations));
- args.append(jsObserver);
-
- InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
-
- NakedPtr<JSC::Exception> exception;
- JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, callback, callType, callData, jsObserver, args, exception);
-
- InspectorInstrumentation::didCallFunction(cookie, context);
-
- if (exception)
- reportException(exec, exception);
-}
-
-} // namespace WebCore
#include "config.h"
#include "JSMutationObserver.h"
-#include "JSDOMConstructorBase.h"
-#include "JSMutationCallback.h"
#include "JSNodeCustom.h"
-#include "MutationObserver.h"
-#include <runtime/Error.h>
-#include <runtime/PrivateName.h>
+#include "MutationCallback.h"
using namespace JSC;
namespace WebCore {
-EncodedJSValue JSC_HOST_CALL constructJSMutationObserver(ExecState& exec)
+void JSMutationObserver::visitAdditionalChildren(JSC::SlotVisitor& visitor)
{
- VM& vm = exec.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (exec.argumentCount() < 1)
- return throwVMError(&exec, scope, createNotEnoughArgumentsError(&exec));
-
- JSObject* object = exec.uncheckedArgument(0).getObject();
- CallData callData;
- if (!object || object->methodTable()->getCallData(object, callData) == CallType::None)
- return throwArgumentTypeError(exec, scope, 0, "callback", "MutationObserver", nullptr, "MutationCallback");
-
- auto* jsConstructor = jsCast<JSDOMConstructorBase*>(exec.jsCallee());
- auto callback = JSMutationCallback::create(object, jsConstructor->globalObject());
- JSObject* jsObserver = asObject(toJSNewlyCreated(&exec, jsConstructor->globalObject(), MutationObserver::create(WTFMove(callback))));
- PrivateName propertyName;
- jsObserver->putDirect(vm, propertyName, object);
- return JSValue::encode(jsObserver);
+ wrapped().callback().visitJSFunction(visitor);
}
bool JSMutationObserverOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
my $cachedInterfaces = {};
my $cachedExternalDictionaries = {};
my $cachedExternalEnumerations = {};
+my $cachedTypes = {};
sub assert
{
die("Could NOT find interface definition for $interfaceName in $filename");
}
+sub ParseType
+{
+ my ($object, $typeString) = @_;
+
+ return $cachedTypes->{$typeString} if exists($cachedTypes->{$typeString});
+
+ my $parser = IDLParser->new(1);
+ my $type = $parser->ParseType($typeString, $idlAttributes);
+
+ $cachedTypes->{$typeString} = $type;
+
+ return $type;
+}
+
# Helpers for all CodeGenerator***.pm modules
sub IsNumericType
return "JS$className";
}
-sub GetJSCallbackDataType
-{
- my $callback = shift;
-
- return $callback->extendedAttributes->{IsWeakCallback} ? "JSCallbackDataWeak" : "JSCallbackDataStrong";
-}
-
sub GetExportMacroForJSClass
{
my $interface = shift;
push(@$outputArray, " auto getterFunctor = [] (auto& thisObject, auto propertyName) -> ${returnType} {\n");
- my @args = GenerateCallWithUsingReferences($namedGetterOperation->extendedAttributes->{CallWith}, $outputArray, "std::nullopt", "thisObject", " ");
- push(@args, "propertyNameToAtomicString(propertyName)");
+ my @arguments = GenerateCallWithUsingReferences($namedGetterOperation->extendedAttributes->{CallWith}, $outputArray, "std::nullopt", "thisObject", " ");
+ push(@arguments, "propertyNameToAtomicString(propertyName)");
- push(@$outputArray, " auto result = thisObject.wrapped().${namedGetterFunctionName}(" . join(", ", @args) . ");\n");
+ push(@$outputArray, " auto result = thisObject.wrapped().${namedGetterFunctionName}(" . join(", ", @arguments) . ");\n");
if ($namedGetterOperation->extendedAttributes->{MayThrowException}) {
push(@$outputArray, " if (result.hasException())\n");
my ($object, $interfaceOrCallback, $operations, $constants, $contentRef, $includesRef) = @_;
my $name = $interfaceOrCallback->type->name;
- my $callbackDataType = GetJSCallbackDataType($interfaceOrCallback);
+ my $callbackDataType = $interfaceOrCallback->extendedAttributes->{IsWeakCallback} ? "JSCallbackDataWeak" : "JSCallbackDataStrong";
my $className = "JS${name}";
- $includesRef->{"ActiveDOMCallback.h"} = 1;
$includesRef->{"IDLTypes.h"} = 1;
$includesRef->{"JSCallbackData.h"} = 1;
$includesRef->{"<wtf/Forward.h>"} = 1;
$includesRef->{"${name}.h"} = 1;
- push(@$contentRef, "class $className final : public ${name}, public ActiveDOMCallback {\n");
+ push(@$contentRef, "class $className final : public ${name} {\n");
push(@$contentRef, "public:\n");
# The static create() method.
push(@$contentRef, "\n // Functions\n");
foreach my $operation (@{$operations}) {
my @arguments = ();
+
+ my $callbackThisObject = $operation->extendedAttributes->{CallbackThisObject};
+ if ($callbackThisObject) {
+ my $thisObjectType = $codeGenerator->ParseType($callbackThisObject);
+ my $IDLType = GetIDLType($interfaceOrCallback, $thisObjectType);
+ push(@arguments, "typename ${IDLType}::ParameterType thisObject");
+ }
+
foreach my $argument (@{$operation->arguments}) {
my $IDLType = GetIDLType($interfaceOrCallback, $argument->type);
push(@arguments, "typename ${IDLType}::ParameterType " . $argument->name);
push(@$contentRef, "\nprivate:\n");
- # Constructor
push(@$contentRef, " ${className}(JSC::JSObject*, JSDOMGlobalObject*);\n\n");
- # Private members
+ push(@$contentRef, " virtual void visitJSFunction(JSC::SlotVisitor&) override;\n\n") if $interfaceOrCallback->extendedAttributes->{IsWeakCallback};
+
push(@$contentRef, " ${callbackDataType}* m_data;\n");
push(@$contentRef, "};\n\n");
my ($object, $interfaceOrCallback, $operations, $constants, $contentRef, $includesRef) = @_;
my $name = $interfaceOrCallback->type->name;
- my $callbackDataType = GetJSCallbackDataType($interfaceOrCallback);
+ my $callbackDataType = $interfaceOrCallback->extendedAttributes->{IsWeakCallback} ? "JSCallbackDataWeak" : "JSCallbackDataStrong";
my $visibleName = $codeGenerator->GetVisibleInterfaceName($interfaceOrCallback);
my $className = "JS${name}";
$includesRef->{"ScriptExecutionContext.h"} = 1;
- $includesRef->{"<runtime/JSLock.h>"} = 1;
# Constructor
push(@$contentRef, "${className}::${className}(JSObject* callback, JSDOMGlobalObject* globalObject)\n");
if ($interfaceOrCallback->extendedAttributes->{CallbackNeedsOperatorEqual}) {
- push(@$contentRef, " : ${name}(${className}Type)\n");
+ push(@$contentRef, " : ${name}(globalObject->scriptExecutionContext(), ${className}Type)\n");
} else {
- push(@$contentRef, " : ${name}()\n");
+ push(@$contentRef, " : ${name}(globalObject->scriptExecutionContext())\n");
}
- push(@$contentRef, " , ActiveDOMCallback(globalObject->scriptExecutionContext())\n");
push(@$contentRef, " , m_data(new ${callbackDataType}(callback, globalObject, this))\n");
push(@$contentRef, "{\n");
push(@$contentRef, "}\n\n");
# FIXME: Change the default name (used for callback functions) to something other than handleEvent. It makes little sense.
my $functionName = $operation->name || "handleEvent";
- my @args = ();
+ my @arguments = ();
+
+ my $thisValue = "jsUndefined()";
+
+ my $callbackThisObject = $operation->extendedAttributes->{CallbackThisObject};
+ if ($callbackThisObject) {
+ my $thisObjectType = $codeGenerator->ParseType($callbackThisObject);
+
+ AddToIncludesForIDLType($thisObjectType, $includesRef, 1);
+ my $IDLType = GetIDLType($interfaceOrCallback, $thisObjectType);
+ push(@arguments, "typename ${IDLType}::ParameterType thisObject");
+
+ my $thisObjectArgument = IDLArgument->new();
+ $thisObjectArgument->type($thisObjectType);
+
+ $thisValue = NativeToJSValueUsingReferences($thisObjectArgument, $interfaceOrCallback, "thisObject", "globalObject");
+ }
+
foreach my $argument (@{$operation->arguments}) {
AddToIncludesForIDLType($argument->type, $includesRef, 1);
-
my $IDLType = GetIDLType($interfaceOrCallback, $argument->type);
- push(@args, "typename ${IDLType}::ParameterType " . $argument->name);
+ push(@arguments, "typename ${IDLType}::ParameterType " . $argument->name);
}
- push(@$contentRef, "${nativeReturnType} ${className}::${functionName}(" . join(", ", @args) . ")\n");
+ push(@$contentRef, "${nativeReturnType} ${className}::${functionName}(" . join(", ", @arguments) . ")\n");
push(@$contentRef, "{\n");
# FIXME: This is needed for NodeFilter, which works even for disconnected iframes. We should investigate
push(@$contentRef, " JSLockHolder lock(vm);\n");
push(@$contentRef, " auto& state = *globalObject.globalExec();\n");
+
+ push(@$contentRef, " JSValue thisValue = ${thisValue};\n");
push(@$contentRef, " MarkedArgumentBuffer args;\n");
foreach my $argument (@{$operation->arguments}) {
my $callbackInvocation;
if (ref($interfaceOrCallback) eq "IDLCallbackFunction") {
- $callbackInvocation = "m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException)";
+ $callbackInvocation = "m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException)";
} else {
my $callbackType = $numOperations > 1 ? "Object" : "FunctionOrObject";
- $callbackInvocation = "m_data->invokeCallback(args, JSCallbackData::CallbackType::${callbackType}, Identifier::fromString(&vm, \"${functionName}\"), returnedException)";
+ $callbackInvocation = "m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::${callbackType}, Identifier::fromString(&vm, \"${functionName}\"), returnedException)";
}
if ($operation->type->name eq "void") {
}
}
- # toJS() implementation.
+ if ($interfaceOrCallback->extendedAttributes->{IsWeakCallback}) {
+ push(@$contentRef, "void ${className}::visitJSFunction(JSC::SlotVisitor& visitor)\n");
+ push(@$contentRef, "{\n");
+ push(@$contentRef, " m_data->visitJSFunction(visitor);\n");
+ push(@$contentRef, "}\n\n");
+ }
+
push(@$contentRef, "JSC::JSValue toJS(${name}& impl)\n");
push(@$contentRef, "{\n");
push(@$contentRef, " if (!static_cast<${className}&>(impl).callbackData())\n");
push(@$contentRef, " return jsNull();\n\n");
- push(@$contentRef, " return static_cast<${className}&>(impl).callbackData()->callback();\n\n");
+ push(@$contentRef, " return static_cast<${className}&>(impl).callbackData()->callback();\n");
push(@$contentRef, "}\n\n");
}
"CallbackNeedsOperatorEqual": {
"contextsAllowed": ["callback-function"]
},
+ "CallbackThisObject": {
+ "contextsAllowed": ["callback-function", "operation"]
+ },
"CallNamedSetterOnlyForSupportedProperties": {
"contextsAllowed": ["operation"]
},
return $document;
}
+sub ParseType
+{
+ my ($self, $type, $idlAttributes) = @_;
+
+ $self->{Line} = $type;
+ $self->{DocumentContent} = $type;
+ $self->{ExtendedAttributeMap} = $idlAttributes;
+
+ addBuiltinTypedefs();
+
+ my $result;
+
+ $self->getToken();
+ eval {
+ $result = $self->parseType();
+
+ my $next = $self->nextToken();
+ $self->assertTokenType($next, EmptyToken);
+ };
+ assert $@ . " parsing type ${type}" if $@;
+
+ return $result;
+}
+
sub nextToken
{
my $self = shift;
#include "JSDOMConvertStrings.h"
#include "JSDOMExceptionHandling.h"
#include "ScriptExecutionContext.h"
-#include <runtime/JSLock.h>
using namespace JSC;
namespace WebCore {
JSTestCallbackFunction::JSTestCallbackFunction(JSObject* callback, JSDOMGlobalObject* globalObject)
- : TestCallbackFunction()
- , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ : TestCallbackFunction(globalObject->scriptExecutionContext())
, m_data(new JSCallbackDataStrong(callback, globalObject, this))
{
}
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLLong>(argument));
NakedPtr<JSC::Exception> returnedException;
- auto jsResult = m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
return jsNull();
return static_cast<JSTestCallbackFunction&>(impl).callbackData()->callback();
-
}
} // namespace WebCore
#pragma once
-#include "ActiveDOMCallback.h"
#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackFunction.h"
namespace WebCore {
-class JSTestCallbackFunction final : public TestCallbackFunction, public ActiveDOMCallback {
+class JSTestCallbackFunction final : public TestCallbackFunction {
public:
static Ref<JSTestCallbackFunction> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
#include "JSDOMGlobalObject.h"
#include "ScriptExecutionContext.h"
#include <runtime/JSArray.h>
-#include <runtime/JSLock.h>
using namespace JSC;
namespace WebCore {
JSTestCallbackFunctionRethrow::JSTestCallbackFunctionRethrow(JSObject* callback, JSDOMGlobalObject* globalObject)
- : TestCallbackFunctionRethrow()
- , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ : TestCallbackFunctionRethrow(globalObject->scriptExecutionContext())
, m_data(new JSCallbackDataStrong(callback, globalObject, this))
{
}
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLSequence<IDLLong>>(state, globalObject, argument));
NakedPtr<JSC::Exception> returnedException;
- auto jsResult = m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
if (returnedException) {
auto throwScope = DECLARE_THROW_SCOPE(vm);
throwException(&state, throwScope, returnedException);
return jsNull();
return static_cast<JSTestCallbackFunctionRethrow&>(impl).callbackData()->callback();
-
}
} // namespace WebCore
#pragma once
-#include "ActiveDOMCallback.h"
#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackFunctionRethrow.h"
namespace WebCore {
-class JSTestCallbackFunctionRethrow final : public TestCallbackFunctionRethrow, public ActiveDOMCallback {
+class JSTestCallbackFunctionRethrow final : public TestCallbackFunctionRethrow {
public:
static Ref<JSTestCallbackFunctionRethrow> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
--- /dev/null
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestCallbackFunctionWithThisObject.h"
+
+#include "JSDOMConvertInterface.h"
+#include "JSDOMConvertSequences.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMGlobalObject.h"
+#include "JSTestNode.h"
+#include "ScriptExecutionContext.h"
+#include <runtime/JSArray.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSTestCallbackFunctionWithThisObject::JSTestCallbackFunctionWithThisObject(JSObject* callback, JSDOMGlobalObject* globalObject)
+ : TestCallbackFunctionWithThisObject(globalObject->scriptExecutionContext())
+ , m_data(new JSCallbackDataStrong(callback, globalObject, this))
+{
+}
+
+JSTestCallbackFunctionWithThisObject::~JSTestCallbackFunctionWithThisObject()
+{
+ ScriptExecutionContext* context = scriptExecutionContext();
+ // When the context is destroyed, all tasks with a reference to a callback
+ // should be deleted. So if the context is 0, we are on the context thread.
+ if (!context || context->isContextThread())
+ delete m_data;
+ else
+ context->postTask(DeleteCallbackDataTask(m_data));
+#ifndef NDEBUG
+ m_data = nullptr;
+#endif
+}
+
+CallbackResult<typename IDLVoid::ImplementationType> JSTestCallbackFunctionWithThisObject::handleEvent(typename IDLInterface<TestNode>::ParameterType thisObject, typename IDLSequence<IDLInterface<TestNode>>::ParameterType parameter)
+{
+ if (!canInvokeCallback())
+ return CallbackResultType::UnableToExecute;
+
+ Ref<JSTestCallbackFunctionWithThisObject> protectedThis(*this);
+
+ auto& globalObject = *m_data->globalObject();
+ auto& vm = globalObject.vm();
+
+ JSLockHolder lock(vm);
+ auto& state = *globalObject.globalExec();
+ JSValue thisValue = toJS<IDLInterface<TestNode>>(state, globalObject, thisObject);
+ MarkedArgumentBuffer args;
+ args.append(toJS<IDLSequence<IDLInterface<TestNode>>>(state, globalObject, parameter));
+
+ NakedPtr<JSC::Exception> returnedException;
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
+ if (returnedException) {
+ reportException(&state, returnedException);
+ return CallbackResultType::ExceptionThrown;
+ }
+
+ return { };
+}
+
+JSC::JSValue toJS(TestCallbackFunctionWithThisObject& impl)
+{
+ if (!static_cast<JSTestCallbackFunctionWithThisObject&>(impl).callbackData())
+ return jsNull();
+
+ return static_cast<JSTestCallbackFunctionWithThisObject&>(impl).callbackData()->callback();
+}
+
+} // namespace WebCore
--- /dev/null
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "IDLTypes.h"
+#include "JSCallbackData.h"
+#include "TestCallbackFunctionWithThisObject.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class JSTestCallbackFunctionWithThisObject final : public TestCallbackFunctionWithThisObject {
+public:
+ static Ref<JSTestCallbackFunctionWithThisObject> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
+ {
+ return adoptRef(*new JSTestCallbackFunctionWithThisObject(callback, globalObject));
+ }
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
+
+ virtual ~JSTestCallbackFunctionWithThisObject();
+ JSCallbackDataStrong* callbackData() { return m_data; }
+
+ // Functions
+ virtual CallbackResult<typename IDLVoid::ImplementationType> handleEvent(typename IDLInterface<TestNode>::ParameterType thisObject, typename IDLSequence<IDLInterface<TestNode>>::ParameterType parameter) override;
+
+private:
+ JSTestCallbackFunctionWithThisObject(JSC::JSObject*, JSDOMGlobalObject*);
+
+ JSCallbackDataStrong* m_data;
+};
+
+JSC::JSValue toJS(TestCallbackFunctionWithThisObject&);
+inline JSC::JSValue toJS(TestCallbackFunctionWithThisObject* impl) { return impl ? toJS(*impl) : JSC::jsNull(); }
+
+} // namespace WebCore
#include "JSDOMGlobalObject.h"
#include "ScriptExecutionContext.h"
#include <runtime/JSArray.h>
-#include <runtime/JSLock.h>
using namespace JSC;
namespace WebCore {
JSTestCallbackFunctionWithTypedefs::JSTestCallbackFunctionWithTypedefs(JSObject* callback, JSDOMGlobalObject* globalObject)
- : TestCallbackFunctionWithTypedefs()
- , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ : TestCallbackFunctionWithTypedefs(globalObject->scriptExecutionContext())
, m_data(new JSCallbackDataStrong(callback, globalObject, this))
{
}
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLSequence<IDLNullable<IDLLong>>>(state, globalObject, sequenceArg));
args.append(toJS<IDLLong>(longArg));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
return jsNull();
return static_cast<JSTestCallbackFunctionWithTypedefs&>(impl).callbackData()->callback();
-
}
} // namespace WebCore
#pragma once
-#include "ActiveDOMCallback.h"
#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackFunctionWithTypedefs.h"
namespace WebCore {
-class JSTestCallbackFunctionWithTypedefs final : public TestCallbackFunctionWithTypedefs, public ActiveDOMCallback {
+class JSTestCallbackFunctionWithTypedefs final : public TestCallbackFunctionWithTypedefs {
public:
static Ref<JSTestCallbackFunctionWithTypedefs> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
#include "JSDOMGlobalObject.h"
#include "JSDOMStringList.h"
#include "JSTestNode.h"
+#include "JSTestObj.h"
#include "ScriptExecutionContext.h"
#include "SerializedScriptValue.h"
#include <runtime/FunctionPrototype.h>
#include <runtime/JSCInlines.h>
-#include <runtime/JSLock.h>
#include <runtime/JSString.h>
#include <wtf/NeverDestroyed.h>
}
JSTestCallbackInterface::JSTestCallbackInterface(JSObject* callback, JSDOMGlobalObject* globalObject)
- : TestCallbackInterface()
- , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ : TestCallbackInterface(globalObject->scriptExecutionContext())
, m_data(new JSCallbackDataStrong(callback, globalObject, this))
{
}
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithNoParam"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithNoParam"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLFloat32Array>(state, globalObject, arrayParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithArrayParam"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithArrayParam"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, globalObject, srzParam));
args.append(toJS<IDLDOMString>(state, strParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithSerializedScriptValueParam"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithSerializedScriptValueParam"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLInterface<DOMStringList>>(state, globalObject, listParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithStringList"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithStringList"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLBoolean>(boolParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithBoolean"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithBoolean"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLLong>(longParam));
args.append(toJS<IDLInterface<TestNode>>(state, globalObject, testNodeParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackRequiresThisToPass"), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackRequiresThisToPass"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
NakedPtr<JSC::Exception> returnedException;
- auto jsResult = m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithAReturnValue"), returnedException);
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithAReturnValue"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLEnumeration<TestCallbackInterface::Enum>>(state, enumParam));
NakedPtr<JSC::Exception> returnedException;
- auto jsResult = m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackThatRethrowsExceptions"), returnedException);
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackThatRethrowsExceptions"), returnedException);
if (returnedException) {
auto throwScope = DECLARE_THROW_SCOPE(vm);
throwException(&state, throwScope, returnedException);
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLDictionary<TestCallbackInterface::Dictionary>>(state, globalObject, dictionaryParam));
NakedPtr<JSC::Exception> returnedException;
- auto jsResult = m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackThatSkipsInvokeCheck"), returnedException);
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackThatSkipsInvokeCheck"), returnedException);
+ if (returnedException) {
+ reportException(&state, returnedException);
+ return CallbackResultType::ExceptionThrown;
+ }
+
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ auto returnValue = convert<IDLDOMString>(state, jsResult);
+ RETURN_IF_EXCEPTION(throwScope, CallbackResultType::ExceptionThrown);
+ return WTFMove(returnValue);
+}
+
+CallbackResult<typename IDLDOMString::ImplementationType> JSTestCallbackInterface::callbackWithThisObject(typename IDLInterface<TestNode>::ParameterType thisObject, typename IDLInterface<TestObj>::ParameterType testObjParam)
+{
+ if (!canInvokeCallback())
+ return CallbackResultType::UnableToExecute;
+
+ Ref<JSTestCallbackInterface> protectedThis(*this);
+
+ auto& globalObject = *m_data->globalObject();
+ auto& vm = globalObject.vm();
+
+ JSLockHolder lock(vm);
+ auto& state = *globalObject.globalExec();
+ JSValue thisValue = toJS<IDLInterface<TestNode>>(state, globalObject, thisObject);
+ MarkedArgumentBuffer args;
+ args.append(toJS<IDLInterface<TestObj>>(state, globalObject, testObjParam));
+
+ NakedPtr<JSC::Exception> returnedException;
+ auto jsResult = m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Object, Identifier::fromString(&vm, "callbackWithThisObject"), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
return jsNull();
return static_cast<JSTestCallbackInterface&>(impl).callbackData()->callback();
-
}
} // namespace WebCore
#if ENABLE(TEST_CONDITIONAL)
-#include "ActiveDOMCallback.h"
#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "JSDOMConvertDictionary.h"
namespace WebCore {
-class JSTestCallbackInterface final : public TestCallbackInterface, public ActiveDOMCallback {
+class JSTestCallbackInterface final : public TestCallbackInterface {
public:
static Ref<JSTestCallbackInterface> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
virtual CallbackResult<typename IDLDOMString::ImplementationType> callbackWithAReturnValue() override;
virtual CallbackResult<typename IDLDOMString::ImplementationType> callbackThatRethrowsExceptions(typename IDLEnumeration<TestCallbackInterface::Enum>::ParameterType enumParam) override;
virtual CallbackResult<typename IDLDOMString::ImplementationType> callbackThatSkipsInvokeCheck(typename IDLDictionary<TestCallbackInterface::Dictionary>::ParameterType dictionaryParam) override;
+ virtual CallbackResult<typename IDLDOMString::ImplementationType> callbackWithThisObject(typename IDLInterface<TestNode>::ParameterType thisObject, typename IDLInterface<TestObj>::ParameterType testObjParam) override;
private:
JSTestCallbackInterface(JSC::JSObject*, JSDOMGlobalObject*);
#include "JSTestNode.h"
#include "ScriptExecutionContext.h"
#include "SerializedScriptValue.h"
-#include <runtime/JSLock.h>
using namespace JSC;
namespace WebCore {
JSTestVoidCallbackFunction::JSTestVoidCallbackFunction(JSObject* callback, JSDOMGlobalObject* globalObject)
- : TestVoidCallbackFunction()
- , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ : TestVoidCallbackFunction(globalObject->scriptExecutionContext())
, m_data(new JSCallbackDataStrong(callback, globalObject, this))
{
}
JSLockHolder lock(vm);
auto& state = *globalObject.globalExec();
+ JSValue thisValue = jsUndefined();
MarkedArgumentBuffer args;
args.append(toJS<IDLFloat32Array>(state, globalObject, arrayParam));
args.append(toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, globalObject, srzParam));
args.append(toJS<IDLInterface<TestNode>>(state, globalObject, testNodeParam));
NakedPtr<JSC::Exception> returnedException;
- m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
+ m_data->invokeCallback(thisValue, args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
if (returnedException) {
reportException(&state, returnedException);
return CallbackResultType::ExceptionThrown;
return jsNull();
return static_cast<JSTestVoidCallbackFunction&>(impl).callbackData()->callback();
-
}
} // namespace WebCore
#if ENABLE(TEST_CONDITIONAL)
-#include "ActiveDOMCallback.h"
#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestVoidCallbackFunction.h"
namespace WebCore {
-class JSTestVoidCallbackFunction final : public TestVoidCallbackFunction, public ActiveDOMCallback {
+class JSTestVoidCallbackFunction final : public TestVoidCallbackFunction {
public:
static Ref<JSTestVoidCallbackFunction> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
--- /dev/null
+/*
+ * Copyright (C) 2015 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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+[
+ CallbackThisObject=TestNode
+] callback TestCallbackFunctionWithThisObject = void (sequence<TestNode> parameter);
DOMString callbackWithAReturnValue();
[RethrowException] DOMString callbackThatRethrowsExceptions(TestCallbackInterfaceEnum enumParam);
[SkipCallbackInvokeCheck] DOMString callbackThatSkipsInvokeCheck(TestCallbackInterfaceDictionary dictionaryParam);
+ [CallbackThisObject=TestNode] DOMString callbackWithThisObject(TestObj testObjParam);
};
PendingPromise(LoadPromise&&);
public:
- Vector<RefPtr<FontFace>> faces;
+ Vector<Ref<FontFace>> faces;
LoadPromise promise;
bool hasReachedTerminalState { false };
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class MediaQueryList;
-class MediaQueryListListener : public RefCounted<MediaQueryListListener> {
+class MediaQueryListListener : public RefCounted<MediaQueryListListener>, public ActiveDOMCallback {
public:
enum Type {
JSMediaQueryListListenerType
virtual CallbackResult<void> handleEvent(MediaQueryList&) = 0;
virtual bool operator==(const MediaQueryListListener&) const = 0;
- virtual ~MediaQueryListListener() { }
Type type() const { return m_type; }
protected:
- explicit MediaQueryListListener(Type type)
- : m_type(type)
+ explicit MediaQueryListListener(ScriptExecutionContext* context, Type type)
+ : ActiveDOMCallback(context)
+ , m_type(type)
{
}
#include "ContextDestructionObserver.h"
+namespace JSC {
+class SlotVisitor;
+}
+
namespace WebCore {
class ScriptExecutionContext;
// context thread.
class ActiveDOMCallback : public ContextDestructionObserver {
public:
- ActiveDOMCallback(ScriptExecutionContext* context);
+ ActiveDOMCallback(ScriptExecutionContext*);
virtual ~ActiveDOMCallback();
WEBCORE_EXPORT bool canInvokeCallback() const;
+
+ virtual void visitJSFunction(JSC::SlotVisitor&) { }
};
} // namespace WebCore
#pragma once
+#include "ActiveDOMCallback.h"
+#include "CallbackResult.h"
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
class MutationRecord;
class MutationObserver;
-class MutationCallback : public RefCounted<MutationCallback> {
+class MutationCallback : public RefCounted<MutationCallback>, public ActiveDOMCallback {
public:
- virtual ~MutationCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
- virtual void call(const Vector<Ref<MutationRecord>>&, MutationObserver*) = 0;
- virtual bool canInvokeCallback() const = 0;
+ virtual CallbackResult<void> handleEvent(MutationObserver&, const Vector<Ref<MutationRecord>>&, MutationObserver&) = 0;
};
} // namespace WebCore
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#pragma once
-
-#include "ActiveDOMCallback.h"
-#include "DOMWrapperWorld.h"
-#include "MutationCallback.h"
-#include <heap/Weak.h>
-#include <runtime/JSObject.h>
-
-namespace WebCore {
-
-class JSDOMGlobalObject;
-
-class JSMutationCallback final : public MutationCallback, public ActiveDOMCallback {
-public:
- static Ref<JSMutationCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
- {
- return adoptRef(*new JSMutationCallback(callback, globalObject));
- }
-
- virtual ~JSMutationCallback();
-
- void call(const Vector<Ref<MutationRecord>>&, MutationObserver*) override;
- bool canInvokeCallback() const override { return ActiveDOMCallback::canInvokeCallback(); }
-
-private:
- JSMutationCallback(JSC::JSObject* callback, JSDOMGlobalObject*);
-
- mutable JSC::Weak<JSC::JSObject> m_callback;
- Ref<DOMWrapperWorld> m_isolatedWorld;
-};
-
-} // namespace WebCore
+[
+ CallbackThisObject=MutationObserver,
+ IsWeakCallback,
+] callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
Vector<Ref<MutationRecord>> records;
records.swap(m_records);
- m_callback->call(records, this);
+ m_callback->handleEvent(*this, records, *this);
}
void MutationObserver::notifyMutationObservers()
HashSet<Node*> observedNodes() const;
+ MutationCallback& callback() const { return m_callback.get(); }
+
static void enqueueSlotChangeEvent(HTMLSlotElement&);
private:
*/
[
- CustomConstructor(MutationCallback callback),
+ Constructor(MutationCallback callback),
CustomIsReachable,
ImplementationLacksVTable,
LegacyWindowAlias=WebKitMutationObserver,
+ JSCustomMarkFunction
] interface MutationObserver {
[MayThrowException] void observe(Node target, optional MutationObserverInit options);
void disconnect();
namespace WebCore {
-NativeNodeFilter::NativeNodeFilter(Ref<NodeFilterCondition>&& condition)
- : m_condition(WTFMove(condition))
+NativeNodeFilter::NativeNodeFilter(ScriptExecutionContext* context, Ref<NodeFilterCondition>&& condition)
+ : NodeFilter(context)
+ , m_condition(WTFMove(condition))
{
}
class NativeNodeFilter final : public NodeFilter {
public:
- static Ref<NativeNodeFilter> create(Ref<NodeFilterCondition>&& condition)
+ static Ref<NativeNodeFilter> create(ScriptExecutionContext* context, Ref<NodeFilterCondition>&& condition)
{
- return adoptRef(*new NativeNodeFilter(WTFMove(condition)));
+ return adoptRef(*new NativeNodeFilter(context, WTFMove(condition)));
}
CallbackResult<unsigned short> acceptNode(Node&) override;
private:
- WEBCORE_EXPORT explicit NativeNodeFilter(Ref<NodeFilterCondition>&&);
+ WEBCORE_EXPORT explicit NativeNodeFilter(ScriptExecutionContext*, Ref<NodeFilterCondition>&&);
Ref<NodeFilterCondition> m_condition;
};
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class Node;
-class NodeFilter : public RefCounted<NodeFilter> {
+class NodeFilter : public RefCounted<NodeFilter>, public ActiveDOMCallback {
public:
- virtual ~NodeFilter() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<unsigned short> acceptNode(Node&) = 0;
/*
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
namespace WebCore {
-class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> {
+class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback>, public ActiveDOMCallback {
public:
- virtual ~RequestAnimationFrameCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(double highResTimeMs) = 0;
int m_id;
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
class ScriptExecutionContext;
-class StringCallback : public RefCounted<StringCallback> {
+class StringCallback : public RefCounted<StringCallback>, public ActiveDOMCallback {
public:
- virtual ~StringCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(const String& data) = 0;
// Helper to post callback task.
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
class Blob;
class ScriptExecutionContext;
-class BlobCallback : public RefCounted<BlobCallback> {
+class BlobCallback : public RefCounted<BlobCallback>, public ActiveDOMCallback {
public:
- virtual ~BlobCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(Blob*) = 0;
void scheduleCallback(ScriptExecutionContext&, RefPtr<Blob>&&);
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
namespace WebCore {
-class VoidCallback : public RefCounted<VoidCallback> {
+class VoidCallback : public RefCounted<VoidCallback>, public ActiveDOMCallback {
public:
- virtual ~VoidCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent() = 0;
};
class StatementCallback final : public SQLStatementCallback {
public:
- static Ref<StatementCallback> create(Ref<ExecuteSQLCallback>&& requestCallback)
+ static Ref<StatementCallback> create(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
{
- return adoptRef(*new StatementCallback(WTFMove(requestCallback)));
+ return adoptRef(*new StatementCallback(context, WTFMove(requestCallback)));
}
private:
- StatementCallback(Ref<ExecuteSQLCallback>&& requestCallback)
- : m_requestCallback(WTFMove(requestCallback)) { }
+ StatementCallback(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
+ : SQLStatementCallback(context)
+ , m_requestCallback(WTFMove(requestCallback))
+ {
+ }
CallbackResult<void> handleEvent(SQLTransaction&, SQLResultSet& resultSet) final
{
class StatementErrorCallback final : public SQLStatementErrorCallback {
public:
- static Ref<StatementErrorCallback> create(Ref<ExecuteSQLCallback>&& requestCallback)
+ static Ref<StatementErrorCallback> create(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
{
- return adoptRef(*new StatementErrorCallback(WTFMove(requestCallback)));
+ return adoptRef(*new StatementErrorCallback(context, WTFMove(requestCallback)));
}
private:
- StatementErrorCallback(Ref<ExecuteSQLCallback>&& requestCallback)
- : m_requestCallback(WTFMove(requestCallback)) { }
+ StatementErrorCallback(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
+ : SQLStatementErrorCallback(context)
+ , m_requestCallback(WTFMove(requestCallback))
+ {
+ }
CallbackResult<bool> handleEvent(SQLTransaction&, SQLError& error) final
{
class TransactionCallback final : public SQLTransactionCallback {
public:
- static Ref<TransactionCallback> create(const String& sqlStatement, Ref<ExecuteSQLCallback>&& requestCallback)
+ static Ref<TransactionCallback> create(ScriptExecutionContext* context, const String& sqlStatement, Ref<ExecuteSQLCallback>&& requestCallback)
{
- return adoptRef(*new TransactionCallback(sqlStatement, WTFMove(requestCallback)));
+ return adoptRef(*new TransactionCallback(context, sqlStatement, WTFMove(requestCallback)));
}
private:
- TransactionCallback(const String& sqlStatement, Ref<ExecuteSQLCallback>&& requestCallback)
- : m_sqlStatement(sqlStatement)
- , m_requestCallback(WTFMove(requestCallback)) { }
+ TransactionCallback(ScriptExecutionContext* context, const String& sqlStatement, Ref<ExecuteSQLCallback>&& requestCallback)
+ : SQLTransactionCallback(context)
+ , m_sqlStatement(sqlStatement)
+ , m_requestCallback(WTFMove(requestCallback))
+ {
+ }
CallbackResult<void> handleEvent(SQLTransaction& transaction) final
{
if (!m_requestCallback->isActive())
return { };
- Ref<SQLStatementCallback> callback(StatementCallback::create(m_requestCallback.copyRef()));
- Ref<SQLStatementErrorCallback> errorCallback(StatementErrorCallback::create(m_requestCallback.copyRef()));
+ Ref<SQLStatementCallback> callback(StatementCallback::create(scriptExecutionContext(), m_requestCallback.copyRef()));
+ Ref<SQLStatementErrorCallback> errorCallback(StatementErrorCallback::create(scriptExecutionContext(), m_requestCallback.copyRef()));
transaction.executeSql(m_sqlStatement, { }, WTFMove(callback), WTFMove(errorCallback));
return { };
}
class TransactionErrorCallback final : public SQLTransactionErrorCallback {
public:
- static Ref<TransactionErrorCallback> create(Ref<ExecuteSQLCallback>&& requestCallback)
+ static Ref<TransactionErrorCallback> create(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
{
- return adoptRef(*new TransactionErrorCallback(WTFMove(requestCallback)));
+ return adoptRef(*new TransactionErrorCallback(context, WTFMove(requestCallback)));
}
private:
- TransactionErrorCallback(Ref<ExecuteSQLCallback>&& requestCallback)
- : m_requestCallback(WTFMove(requestCallback)) { }
+ TransactionErrorCallback(ScriptExecutionContext* context, Ref<ExecuteSQLCallback>&& requestCallback)
+ : SQLTransactionErrorCallback(context)
+ , m_requestCallback(WTFMove(requestCallback))
+ {
+ }
CallbackResult<void> handleEvent(SQLError& error) final
{
class TransactionSuccessCallback final : public VoidCallback {
public:
- static Ref<TransactionSuccessCallback> create()
+ static Ref<TransactionSuccessCallback> create(ScriptExecutionContext* context)
{
- return adoptRef(*new TransactionSuccessCallback());
+ return adoptRef(*new TransactionSuccessCallback(context));
}
CallbackResult<void> handleEvent() final { return { }; }
private:
- TransactionSuccessCallback() { }
+ TransactionSuccessCallback(ScriptExecutionContext* context)
+ : VoidCallback(context)
+ {
+ }
};
} // namespace
return;
}
- database->transaction(TransactionCallback::create(query, requestCallback.copyRef()),
- TransactionErrorCallback::create(requestCallback.copyRef()),
- TransactionSuccessCallback::create());
+ database->transaction(TransactionCallback::create(&database->scriptExecutionContext(), query, requestCallback.copyRef()),
+ TransactionErrorCallback::create(&database->scriptExecutionContext(), requestCallback.copyRef()),
+ TransactionSuccessCallback::create(&database->scriptExecutionContext()));
}
String InspectorDatabaseAgent::databaseId(Database& database)
#if ENABLE(INTERSECTION_OBSERVER)
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
class IntersectionObserver;
class IntersectionObserverEntry;
-class IntersectionObserverCallback : public RefCounted<IntersectionObserverCallback> {
+class IntersectionObserverCallback : public RefCounted<IntersectionObserverCallback>, public ActiveDOMCallback {
public:
- virtual ~IntersectionObserverCallback() { }
- virtual CallbackResult<void> handleEvent(const Vector<RefPtr<IntersectionObserverEntry>>&, IntersectionObserver&) = 0;
+ using ActiveDOMCallback::ActiveDOMCallback;
+
+ virtual CallbackResult<void> handleEvent(const Vector<Ref<IntersectionObserverEntry>>&, IntersectionObserver&) = 0;
};
} // namespace WebCore
#pragma once
+#include "ActiveDOMCallback.h"
#include "CallbackResult.h"
#include <wtf/RefCounted.h>
class PerformanceObserver;
class PerformanceObserverEntryList;
-class PerformanceObserverCallback : public RefCounted<PerformanceObserverCallback> {
+class PerformanceObserverCallback : public RefCounted<PerformanceObserverCallback>, public ActiveDOMCallback {
public:
- virtual ~PerformanceObserverCallback() { }
+ using ActiveDOMCallback::ActiveDOMCallback;
+
virtual CallbackResult<void> handleEvent(PerformanceObserverEntryList&, PerformanceObserver&) = 0;
};
+2017-08-02 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Convert MutationCallback to be a normal generated callback
+ https://bugs.webkit.org/show_bug.cgi?id=174140
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.cpp:
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilterPrivate.h:
+ Pass, now necessary, Document to NativeNodeFilter constructor.
+
2017-08-03 Jeremy Jones <jeremyj@apple.com>
Use MPAVRoutingController instead of deprecated versions.
UNUSED_PARAM(error);
WebCore::Document* item = WebKit::core(self);
WebCore::Node* convertedRoot = WebKit::core(root);
- RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(filter);
+ RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(item, filter);
RefPtr<WebCore::NodeIterator> gobjectResult = WTF::getPtr(item->createNodeIterator(*convertedRoot, whatToShow, WTF::getPtr(convertedFilter), expandEntityReferences));
return WebKit::kit(gobjectResult.get());
}
UNUSED_PARAM(error);
WebCore::Document* item = WebKit::core(self);
WebCore::Node* convertedRoot = WebKit::core(root);
- RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(filter);
+ RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(item, filter);
RefPtr<WebCore::TreeWalker> gobjectResult = WTF::getPtr(item->createTreeWalker(*convertedRoot, whatToShow, WTF::getPtr(convertedFilter), expandEntityReferences));
return WebKit::kit(gobjectResult.get());
}
#include "WebKitDOMNodeFilter.h"
#include "GObjectNodeFilterCondition.h"
+#include <WebCore/Document.h>
#include <WebCore/NativeNodeFilter.h>
#include "WebKitDOMNode.h"
#include "WebKitDOMNodeFilterPrivate.h"
return nodeFilterMap().get(coreNodeFilter);
}
-RefPtr<WebCore::NodeFilter> core(WebKitDOMNodeFilter* nodeFilter)
+RefPtr<WebCore::NodeFilter> core(WebCore::Document* document, WebKitDOMNodeFilter* nodeFilter)
{
if (!nodeFilter)
return nullptr;
RefPtr<WebCore::NodeFilter> coreNodeFilter = static_cast<WebCore::NodeFilter*>(g_object_get_data(G_OBJECT(nodeFilter), "webkit-core-node-filter"));
if (!coreNodeFilter) {
- coreNodeFilter = WebCore::NativeNodeFilter::create(WebKit::GObjectNodeFilterCondition::create(nodeFilter));
+ coreNodeFilter = WebCore::NativeNodeFilter::create(document, WebKit::GObjectNodeFilterCondition::create(nodeFilter));
nodeFilterMap().add(coreNodeFilter.get(), nodeFilter);
g_object_weak_ref(G_OBJECT(nodeFilter), nodeFilterObjectDestroyedCallback, coreNodeFilter.get());
g_object_set_data(G_OBJECT(nodeFilter), "webkit-core-node-filter", coreNodeFilter.get());
#include <webkitdom/WebKitDOMNodeFilter.h>
namespace WebCore {
+class Document;
class NodeFilter;
}
namespace WebKit {
WebKitDOMNodeFilter* kit(WebCore::NodeFilter*);
-RefPtr<WebCore::NodeFilter> core(WebKitDOMNodeFilter*);
+RefPtr<WebCore::NodeFilter> core(WebCore::Document*, WebKitDOMNodeFilter*);
} // namespace WebKit
#endif /* WebKitDOMNodeFilterPrivate_h */
+2017-08-02 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Convert MutationCallback to be a normal generated callback
+ https://bugs.webkit.org/show_bug.cgi?id=174140
+
+ Reviewed by Darin Adler.
+
+ * DOM/DOMDocument.mm:
+ (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]):
+ (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]):
+ Pass, now necessary, Document to NativeNodeFilter constructor.
+
2017-08-01 Chris Dumez <cdumez@apple.com>
Add initial support for navigator.sendBeacon
raiseTypeErrorException();
RefPtr<WebCore::NodeFilter> nativeNodeFilter;
if (filter)
- nativeNodeFilter = WebCore::NativeNodeFilter::create(WebCore::ObjCNodeFilterCondition::create(filter));
+ nativeNodeFilter = WebCore::NativeNodeFilter::create(IMPL, WebCore::ObjCNodeFilterCondition::create(filter));
return kit(WTF::getPtr(IMPL->createNodeIterator(*core(root), whatToShow, WTF::getPtr(nativeNodeFilter), expandEntityReferences)));
}
raiseTypeErrorException();
RefPtr<WebCore::NodeFilter> nativeNodeFilter;
if (filter)
- nativeNodeFilter = WebCore::NativeNodeFilter::create(WebCore::ObjCNodeFilterCondition::create(filter));
+ nativeNodeFilter = WebCore::NativeNodeFilter::create(IMPL, WebCore::ObjCNodeFilterCondition::create(filter));
return kit(WTF::getPtr(IMPL->createTreeWalker(*core(root), whatToShow, WTF::getPtr(nativeNodeFilter), expandEntityReferences)));
}