- Revision
- 206575
- Author
- [email protected]
- Date
- 2016-09-28 20:58:33 -0700 (Wed, 28 Sep 2016)
Log Message
Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
https://bugs.webkit.org/show_bug.cgi?id=162709
Reviewed by Alex Christensen.
Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
as it is unused. This is the quickest way to allow DOMWindow / EventTarget members
in IDL dictionaries. This is because the generated bindings code relies on
convertWrapperType() in JSDOMConvert.h which calls toWrapped() with a single
parameter. Right now, the only type that requires an ExecState for its toWrapped()
is XPathNSResolver (which should likely be a callback interface rather than a
regular interface).
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::toWrapped):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::JSEventTarget::toWrapped):
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(JSValueToNative):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (206574 => 206575)
--- trunk/Source/WebCore/ChangeLog 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/ChangeLog 2016-09-29 03:58:33 UTC (rev 206575)
@@ -1,5 +1,32 @@
2016-09-28 Chris Dumez <[email protected]>
+ Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
+ https://bugs.webkit.org/show_bug.cgi?id=162709
+
+ Reviewed by Alex Christensen.
+
+ Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
+ as it is unused. This is the quickest way to allow DOMWindow / EventTarget members
+ in IDL dictionaries. This is because the generated bindings code relies on
+ convertWrapperType() in JSDOMConvert.h which calls toWrapped() with a single
+ parameter. Right now, the only type that requires an ExecState for its toWrapped()
+ is XPathNSResolver (which should likely be a callback interface rather than a
+ regular interface).
+
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::toWrapped):
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue):
+ * bindings/js/JSEventTargetCustom.cpp:
+ (WebCore::JSEventTarget::toWrapped):
+ * bindings/js/JSMessageEventCustom.cpp:
+ (WebCore::handleInitMessageEvent):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHeader):
+ (JSValueToNative):
+
+2016-09-28 Chris Dumez <[email protected]>
+
Log console messages when the anchor download attribute is ignored
https://bugs.webkit.org/show_bug.cgi?id=162703
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (206574 => 206575)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2016-09-29 03:58:33 UTC (rev 206575)
@@ -591,7 +591,7 @@
return jsNumber(result);
}
-DOMWindow* JSDOMWindow::toWrapped(ExecState&, JSValue value)
+DOMWindow* JSDOMWindow::toWrapped(JSValue value)
{
if (!value.isObject())
return nullptr;
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (206574 => 206575)
--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2016-09-29 03:58:33 UTC (rev 206575)
@@ -184,7 +184,7 @@
VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- auto* window = JSDOMWindow::toWrapped(*state, value);
+ auto* window = JSDOMWindow::toWrapped(value);
if (UNLIKELY(!window) && !value.isUndefinedOrNull()) {
throwVMTypeError(state, scope, "Dictionary member is not of type Window");
return;
@@ -192,9 +192,9 @@
result = window;
}
-void JSDictionary::convertValue(ExecState* state, JSValue value, RefPtr<EventTarget>& result)
+void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result)
{
- result = JSEventTarget::toWrapped(*state, value);
+ result = JSEventTarget::toWrapped(value);
}
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result)
Modified: trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp (206574 => 206575)
--- trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2016-09-29 03:58:33 UTC (rev 206575)
@@ -60,7 +60,7 @@
if (value.inherits(JS##interfaceName::info())) \
return &jsCast<JS##interfaceName*>(asObject(value))->wrapped();
-EventTarget* JSEventTarget::toWrapped(ExecState&, JSValue value)
+EventTarget* JSEventTarget::toWrapped(JSValue value)
{
TRY_TO_UNWRAP_WITH_INTERFACE(DOMWindowShell)
TRY_TO_UNWRAP_WITH_INTERFACE(DOMWindow)
Modified: trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp (206574 => 206575)
--- trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2016-09-29 03:58:33 UTC (rev 206575)
@@ -112,7 +112,7 @@
bool cancelableArg = state.argument(2).toBoolean(&state);
const String originArg = valueToUSVString(&state, state.argument(4));
const String lastEventIdArg = state.argument(5).toString(&state)->value(&state);
- DOMWindow* sourceArg = JSDOMWindow::toWrapped(state, state.argument(6));
+ DOMWindow* sourceArg = JSDOMWindow::toWrapped(state.argument(6));
std::unique_ptr<MessagePortArray> messagePorts;
std::unique_ptr<ArrayBufferArray> arrayBuffers;
if (!state.argument(7).isUndefinedOrNull()) {
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (206574 => 206575)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-09-29 01:36:42 UTC (rev 206574)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-09-29 03:58:33 UTC (rev 206575)
@@ -1202,7 +1202,7 @@
# JSValue to implementation type
if (ShouldGenerateToWrapped($hasParent, $interface)) {
my $nativeType = GetNativeType($interface, $implType);
- if ($interface->extendedAttributes->{"JSCustomToNativeObject"}) {
+ if ($interface->name eq "XPathNSResolver") {
push(@headerContent, " static $nativeType toWrapped(JSC::ExecState&, JSC::JSValue);\n");
} else {
my $export = "";
@@ -4844,7 +4844,7 @@
return "JSEventListener::create($value, *castedThis, false, currentWorld(state))" if $type eq "EventListener";
my $extendedAttributes = $codeGenerator->getInterfaceExtendedAttributesFromName($type);
- return ("JS${type}::toWrapped(*state, $value)", 1) if $extendedAttributes->{"JSCustomToNativeObject"};
+ return ("JS${type}::toWrapped(*state, $value)", 1) if $type eq "XPathNSResolver";
return ("JS${type}::toWrapped($value)", 0);
}