Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (207377 => 207378)
--- trunk/Source/WebCore/CMakeLists.txt 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-10-15 21:15:17 UTC (rev 207378)
@@ -1075,7 +1075,6 @@
bindings/js/JSCSSValueCustom.cpp
bindings/js/JSCallbackData.cpp
bindings/js/JSCanvasRenderingContext2DCustom.cpp
- bindings/js/JSClientRectCustom.cpp
bindings/js/JSCommandLineAPIHostCustom.cpp
bindings/js/JSCryptoAlgorithmBuilder.cpp
bindings/js/JSCryptoAlgorithmDictionary.cpp
@@ -1165,7 +1164,6 @@
bindings/js/JSNodeIteratorCustom.cpp
bindings/js/JSNodeListCustom.cpp
bindings/js/JSPerformanceEntryCustom.cpp
- bindings/js/JSPerformanceTimingCustom.cpp
bindings/js/JSPluginElementFunctions.cpp
bindings/js/JSPopStateEventCustom.cpp
bindings/js/JSReadableStreamPrivateConstructors.cpp
Modified: trunk/Source/WebCore/ChangeLog (207377 => 207378)
--- trunk/Source/WebCore/ChangeLog 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/ChangeLog 2016-10-15 21:15:17 UTC (rev 207378)
@@ -1,3 +1,48 @@
+2016-10-15 Simon Fraser <simon.fra...@apple.com>
+
+ Implement serializer = { attribute }
+ https://bugs.webkit.org/show_bug.cgi?id=163466
+
+ Reviewed by Darin Adler.
+
+ Fix the code generator to generate code for serializer = { attribute }.
+ In IDLParser, extend domSerializable with flags for the 'inherit', 'getter' and
+ 'attribute' values (the first two are still unsupported). Fix parseSerializationPattern()
+ to detect these; it needs to create the domSerializable() now. Basic support
+ for isSerializableAttribute() is added (primitive types only).
+
+ GenerateSerializerFunction is fixed to output code for the serializable attributes
+ in the order specified in "serializer = {}", as specified in WebIDL.
+
+ Removed custom serialization for ClientRect and PerformanceTiming.
+
+ Other minor cleanup to always get $interfaceName from $interface->name, and to fix
+ ObjectConstructor.h to be included as <runtime/ObjectConstructor.h>.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSClientRectCustom.cpp: Removed.
+ * bindings/js/JSPerformanceTimingCustom.cpp: Removed.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (GenerateSerializerFunction):
+ * bindings/scripts/IDLParser.pm:
+ (parseSerializerRest):
+ (parseSerializationPattern):
+ (parseSerializationAttributes):
+ (isSerializableAttribute):
+ (applyMemberList):
+ * bindings/scripts/test/JS/JSTestNode.cpp:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
+ * bindings/scripts/test/JS/JSTestSerialization.cpp: Added.
+ * bindings/scripts/test/JS/JSTestSerialization.h: Added.
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/TestSerialization.idl: Copied from Source/WebCore/dom/ClientRect.idl.
+ * dom/ClientRect.idl:
+ * page/PerformanceTiming.idl:
+
2016-10-15 Michael Catanzaro <mcatanz...@igalia.com>
[GTK] Restore user agent quirk for Yahoo
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207377 => 207378)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-15 21:15:17 UTC (rev 207378)
@@ -1379,7 +1379,6 @@
31C0FF3E0E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF3A0E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.h */; };
31C0FF3F0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF3B0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.cpp */; };
31C0FF400E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF3C0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.h */; };
- 31C422461D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31C422451D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp */; };
31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D591B116697A6C00E6BF02 /* PlugInClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
31DCD29D1AB4FBDE0072E817 /* AnimationTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */; settings = {ATTRIBUTES = (Private, ); }; };
31DCDF431DA1C45400EA5B93 /* ExtendedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */; };
@@ -1739,7 +1738,6 @@
4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4671E0641D67A57B00C6B497 /* CanvasPath.h */; };
467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; };
4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
- 46A58AC51D46B3FA00432036 /* JSClientRectCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */; };
46B63F6C1C6E8D19002E914B /* JSEventTargetCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */; };
46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8347,7 +8345,6 @@
31C0FF3A0E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitAnimationEvent.h; sourceTree = "<group>"; };
31C0FF3B0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitTransitionEvent.cpp; sourceTree = "<group>"; };
31C0FF3C0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitTransitionEvent.h; sourceTree = "<group>"; };
- 31C422451D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceTimingCustom.cpp; sourceTree = "<group>"; };
31D591B116697A6C00E6BF02 /* PlugInClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInClient.h; sourceTree = "<group>"; };
31DCD29C1AB4FBDE0072E817 /* AnimationTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationTrigger.h; sourceTree = "<group>"; };
31DCDF411DA1C45400EA5B93 /* ExtendedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtendedColor.cpp; sourceTree = "<group>"; };
@@ -8755,7 +8752,6 @@
4671E0641D67A57B00C6B497 /* CanvasPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPath.h; sourceTree = "<group>"; };
467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
- 46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClientRectCustom.cpp; sourceTree = "<group>"; };
46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventTargetCustom.h; sourceTree = "<group>"; };
46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeoNotifier.cpp; sourceTree = "<group>"; };
46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = "<group>"; };
@@ -21201,7 +21197,6 @@
BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */,
8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */,
49EED14B1051971900099FAB /* JSCanvasRenderingContext2DCustom.cpp */,
- 46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */,
A584FE371864DAC100843B10 /* JSCommandLineAPIHostCustom.cpp */,
7CEF26181D6A92E300BE905D /* JSCryptoCustom.cpp */,
E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */,
@@ -21282,7 +21277,6 @@
83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */,
1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */,
- 31C422451D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp */,
AD20B18C18E9D216005A8083 /* JSNodeListCustom.h */,
A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */,
@@ -27729,7 +27723,6 @@
FD3160BC12B0272A00C1A359 /* AudioDestinationMac.cpp in Sources */,
FD31600712B0267600C1A359 /* AudioDestinationNode.cpp in Sources */,
FD31608112B026F700C1A359 /* AudioDSPKernelProcessor.cpp in Sources */,
- 31C422461D74EB9A00F12342 /* JSPerformanceTimingCustom.cpp in Sources */,
CD5596911475B678001D0BD0 /* AudioFileReaderIOS.cpp in Sources */,
FD3160BE12B0272A00C1A359 /* AudioFileReaderMac.cpp in Sources */,
CD2F4A2318D89F700063746D /* AudioHardwareListener.cpp in Sources */,
@@ -28717,7 +28710,6 @@
FDA15EA312B03EE1003A583A /* JSChannelSplitterNode.cpp in Sources */,
65DF31F309D1CC60000BE325 /* JSCharacterData.cpp in Sources */,
BCC065870F3CE2A700CD2D87 /* JSClientRect.cpp in Sources */,
- 46A58AC51D46B3FA00432036 /* JSClientRectCustom.cpp in Sources */,
BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
E3150EA61DA7219000194012 /* JSNodeDOMJIT.cpp in Sources */,
51FB5505113E3E9100821176 /* JSCloseEvent.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (207377 => 207378)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -41,7 +41,6 @@
#include "JSCSSValueCustom.cpp"
#include "JSCallbackData.cpp"
#include "JSCanvasRenderingContext2DCustom.cpp"
-#include "JSClientRectCustom.cpp"
#include "JSCommandLineAPIHostCustom.cpp"
#include "JSCryptoCustom.cpp"
#include "JSCustomEventCustom.cpp"
Deleted: trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp (207377 => 207378)
--- trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/js/JSClientRectCustom.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "JSClientRect.h"
-
-#include "ClientRect.h"
-#include <bytecode/CodeBlock.h>
-#include <heap/HeapInlines.h>
-#include <runtime/AuxiliaryBarrierInlines.h>
-#include <runtime/IdentifierInlines.h>
-#include <runtime/JSObject.h>
-#include <runtime/ObjectConstructor.h>
-
-namespace WebCore {
-
-using namespace JSC;
-
-JSC::JSValue JSClientRect::toJSON(ExecState& state)
-{
- ClientRect& rect = wrapped();
- VM& vm = state.vm();
-
- JSValue object = constructEmptyObject(&state);
- CodeBlock* codeBlock = state.codeBlock();
- PutPropertySlot slot(object, codeBlock ? codeBlock->isStrictMode() : false);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("top")), jsNumber(rect.top()), slot);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("right")), jsNumber(rect.right()), slot);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("bottom")), jsNumber(rect.bottom()), slot);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("left")), jsNumber(rect.left()), slot);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("width")), jsNumber(rect.width()), slot);
- object.put(&state, Identifier::fromString(&vm, ASCIILiteral("height")), jsNumber(rect.height()), slot);
-
- return object;
-}
-
-}
Deleted: trunk/Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp (207377 => 207378)
--- trunk/Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/js/JSPerformanceTimingCustom.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "JSPerformanceTiming.h"
-
-#if ENABLE(WEB_TIMING)
-
-#include "DOMWrapperWorld.h"
-#include <heap/HeapInlines.h>
-#include <runtime/AuxiliaryBarrierInlines.h>
-#include <runtime/IdentifierInlines.h>
-#include <runtime/JSObject.h>
-#include <runtime/ObjectConstructor.h>
-
-namespace WebCore {
-
-using namespace JSC;
-
-JSC::JSValue JSPerformanceTiming::toJSON(ExecState& state)
-{
- PerformanceTiming& timing = wrapped();
- VM& vm = state.vm();
-
- auto object = constructEmptyObject(&state);
-
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("navigationStart")), jsNumber(timing.navigationStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("unloadEventStart")), jsNumber(timing.unloadEventStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("unloadEventEnd")), jsNumber(timing.unloadEventEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("redirectStart")), jsNumber(timing.redirectStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("redirectEnd")), jsNumber(timing.redirectEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("fetchStart")), jsNumber(timing.fetchStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domainLookupStart")), jsNumber(timing.domainLookupStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domainLookupEnd")), jsNumber(timing.domainLookupEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("connectStart")), jsNumber(timing.connectStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("connectEnd")), jsNumber(timing.connectEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("secureConnectionStart")), jsNumber(timing.secureConnectionStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("requestStart")), jsNumber(timing.requestStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("responseStart")), jsNumber(timing.responseStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("responseEnd")), jsNumber(timing.responseEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domLoading")), jsNumber(timing.domLoading()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domInteractive")), jsNumber(timing.domInteractive()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domContentLoadedEventStart")), jsNumber(timing.domContentLoadedEventStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domContentLoadedEventEnd")), jsNumber(timing.domContentLoadedEventEnd()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("domComplete")), jsNumber(timing.domComplete()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("loadEventStart")), jsNumber(timing.loadEventStart()));
- object->putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("loadEventEnd")), jsNumber(timing.loadEventEnd()));
-
- return object;
-}
-
-}
-
-#endif // ENABLE(WEB_TIMING)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207377 => 207378)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-10-15 21:15:17 UTC (rev 207378)
@@ -3745,7 +3745,7 @@
GenerateImplementationIterableFunctions($interface) if $interface->iterable;
- GenerateSerializerFunction($interface, $interfaceName, $className) if $interface->serializable;
+ GenerateSerializerFunction($interface, $className) if $interface->serializable;
if ($needsVisitChildren) {
push(@implContent, "void ${className}::visitChildren(JSCell* cell, SlotVisitor& visitor)\n");
@@ -3968,26 +3968,40 @@
sub GenerateSerializerFunction
{
- my ($interface, $interfaceName, $className) = @_;
+ my ($interface, $className) = @_;
+
+ my $interfaceName = $interface->name;
+
my $serializerFunctionName = "toJSON";
my $serializerNativeFunctionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($serializerFunctionName);
- AddToImplIncludes("ObjectConstructor.h");
+ AddToImplIncludes("<runtime/ObjectConstructor.h>");
push(@implContent, "static inline EncodedJSValue ${serializerNativeFunctionName}Caller(ExecState* state, JS$interfaceName* thisObject, JSC::ThrowScope& throwScope)\n");
push(@implContent, "{\n");
push(@implContent, " auto& vm = state->vm();\n");
push(@implContent, " auto* result = constructEmptyObject(state);\n");
push(@implContent, "\n");
- foreach my $attribute (@{$interface->attributes}) {
- my $name = $attribute->signature->name;
- if (grep $_ eq $name, @{$interface->serializable->attributes}) {
- my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
- push(@implContent, " auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
- push(@implContent, " ASSERT(!throwScope.exception());\n");
- push(@implContent, " result->putDirect(vm, Identifier::fromString(&vm, \"${name}\"), ${name}Value);\n");
- push(@implContent, "\n");
+
+ my @serializedAttributes = ();
+ foreach my $attribute_name (@{$interface->serializable->attributes}) {
+ foreach my $attribute (@{$interface->attributes}) {
+ if ($attribute_name eq $attribute->signature->name) {
+ push @serializedAttributes, $attribute;
+ last;
+ }
}
}
+
+ foreach my $attribute (@serializedAttributes) {
+ my $name = $attribute->signature->name;
+
+ my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
+ push(@implContent, " auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
+ push(@implContent, " ASSERT(!throwScope.exception());\n");
+ push(@implContent, " result->putDirect(vm, Identifier::fromString(&vm, \"${name}\"), ${name}Value);\n");
+ push(@implContent, "\n");
+ }
+
push(@implContent, " return JSValue::encode(result);\n");
push(@implContent, "}\n");
push(@implContent, "\n");
Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (207377 => 207378)
--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-10-15 21:15:17 UTC (rev 207378)
@@ -112,6 +112,9 @@
# Used to represent serializable interface
struct( domSerializable => {
attributes => '@', # List of attributes to serialize
+ hasAttribute => '$', # serializer = { attribute }
+ hasInherit => '$', # serializer = { inherit }
+ hasGetter => '$', # serializer = { getter }
functions => '@', # toJSON function
});
@@ -1148,12 +1151,9 @@
my $next = $self->nextToken();
if ($next->value() eq "=") {
$self->assertTokenValue($self->getToken(), "=", __LINE__);
- my $attributes = $self->parseSerializationPattern();
- my $newDataNode = domSerializable->new();
- $newDataNode->attributes($attributes);
+ return $self->parseSerializationPattern();
- return $newDataNode;
}
if ($next->type() == IdentifierToken || $next->value() eq "(") {
return $self->parseOperationRest($extendedAttributeList);
@@ -1167,9 +1167,10 @@
my $next = $self->nextToken();
if ($next->value() eq "{") {
$self->assertTokenValue($self->getToken(), "{", __LINE__);
- my $attributes = $self->parseSerializationAttributes();
+ my $newDataNode = domSerializable->new();
+ $self->parseSerializationAttributes($newDataNode);
$self->assertTokenValue($self->getToken(), "}", __LINE__);
- return \@{$attributes};
+ return $newDataNode;
}
if ($next->value() eq "[") {
die "Serialization of lists pattern is not currently supported.";
@@ -1179,7 +1180,11 @@
my $token = $self->getToken();
$self->assertTokenType($token, IdentifierToken);
push(@attributes, $token->value());
- return \@attributes;
+
+ my $newDataNode = domSerializable->new();
+ $newDataNode->attributes(\@attributes);
+
+ return $newDataNode;
}
$self->assertUnexpectedToken($next->value(), __LINE__);
}
@@ -1187,21 +1192,30 @@
sub parseSerializationAttributes
{
my $self = shift;
+ my $domSerializable = shift;
my $token = $self->getToken();
if ($token->value() eq "getter") {
+ $domSerializable->hasGetter(1);
die "Serializer getter keyword is not currently supported.";
}
if ($token->value() eq "inherit") {
+ $domSerializable->hasInherit(1);
die "Serializer inherit keyword is not currently supported.";
}
+ if ($token->value() eq "attribute") {
+ $domSerializable->hasAttribute(1);
+ # Attributes will be filled in via applyMemberList()
+ return;
+ }
+
my @attributes = ();
$self->assertTokenType($token, IdentifierToken);
push(@attributes, $token->value());
push(@attributes, @{$self->parseIdentifiers()});
- return \@attributes;
+ $domSerializable->attributes(\@attributes);
}
sub parseIdentifierList
@@ -2316,7 +2330,17 @@
$self->assertUnexpectedToken($next->value());
}
+sub isSerializableAttribute
+{
+ my $attribute = shift;
+ # FIXME: Need to support more than primitive serializable types.
+ # This check may have to move to the code generator, if we don't have enough information
+ # here to determine serializability: https://heycam.github.io/webidl/#idl-serializers
+ my $serializable_types = '^(\(byte|octet|short|unsigned short|long|unsigned long|long long|unsigned long long|float|unrestricted float|double|unrestricted double|boolean|DOMString|ByteString|USVString)$';
+ return $attribute->signature->type =~ /$serializable_types/;
+}
+
sub applyMemberList
{
my $interface = shift;
@@ -2351,8 +2375,14 @@
if ($interface->serializable) {
my $numSerializerAttributes = @{$interface->serializable->attributes};
- if ($numSerializerAttributes == 0) {
+ if ($interface->serializable->hasAttribute) {
foreach my $attribute (@{$interface->attributes}) {
+ if (isSerializableAttribute($attribute)) {
+ push(@{$interface->serializable->attributes}, $attribute->signature->name);
+ }
+ }
+ } elsif ($numSerializerAttributes == 0) {
+ foreach my $attribute (@{$interface->attributes}) {
push(@{$interface->serializable->attributes}, $attribute->signature->name);
}
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (207377 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -26,11 +26,11 @@
#include "JSDOMConstructor.h"
#include "JSDOMIterator.h"
#include "JSDOMPromise.h"
-#include "ObjectConstructor.h"
#include "RuntimeEnabledFeatures.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
+#include <runtime/ObjectConstructor.h>
#include <wtf/GetPtr.h>
using namespace JSC;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (207377 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -53,7 +53,6 @@
#include "JSTestStandaloneDictionary.h"
#include "JSTestSubObj.h"
#include "JSXPathNSResolver.h"
-#include "ObjectConstructor.h"
#include "RuntimeEnabledFeatures.h"
#include "SVGDocument.h"
#include "SVGPoint.h"
@@ -7740,6 +7739,10 @@
auto& vm = state->vm();
auto* result = constructEmptyObject(state);
+ auto createValue = jsTestObjCreateGetter(*state, *thisObject, throwScope);
+ ASSERT(!throwScope.exception());
+ result->putDirect(vm, Identifier::fromString(&vm, "create"), createValue);
+
auto readOnlyStringAttrValue = jsTestObjReadOnlyStringAttrGetter(*state, *thisObject, throwScope);
ASSERT(!throwScope.exception());
result->putDirect(vm, Identifier::fromString(&vm, "readOnlyStringAttr"), readOnlyStringAttrValue);
@@ -7752,10 +7755,6 @@
ASSERT(!throwScope.exception());
result->putDirect(vm, Identifier::fromString(&vm, "longAttr"), longAttrValue);
- auto createValue = jsTestObjCreateGetter(*state, *thisObject, throwScope);
- ASSERT(!throwScope.exception());
- result->putDirect(vm, Identifier::fromString(&vm, "create"), createValue);
-
return JSValue::encode(result);
}
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (0 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp 2016-10-15 21:15:17 UTC (rev 207378)
@@ -0,0 +1,448 @@
+/*
+ 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 "JSTestSerialization.h"
+
+#include "JSDOMBinding.h"
+#include "JSDOMConstructor.h"
+#include "JSDOMConvert.h"
+#include "JSTestNode.h"
+#include "URL.h"
+#include <runtime/FunctionPrototype.h>
+#include <runtime/JSString.h>
+#include <runtime/ObjectConstructor.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Functions
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(JSC::ExecState*);
+
+// Attributes
+
+JSC::EncodedJSValue jsTestSerializationFirstStringAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationFirstStringAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestSerializationSecondLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationSecondLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestSerializationThirdUnserializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationThirdUnserializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestSerializationFourthUnrestrictedDoubleAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationFourthUnrestrictedDoubleAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestSerializationFifthLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationFifthLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestSerializationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestSerializationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSTestSerializationPrototype : public JSC::JSNonFinalObject {
+public:
+ using Base = JSC::JSNonFinalObject;
+ static JSTestSerializationPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSTestSerializationPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestSerializationPrototype>(vm.heap)) JSTestSerializationPrototype(vm, globalObject, structure);
+ ptr->finishCreation(vm);
+ return ptr;
+ }
+
+ DECLARE_INFO;
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+private:
+ JSTestSerializationPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+ : JSC::JSNonFinalObject(vm, structure)
+ {
+ }
+
+ void finishCreation(JSC::VM&);
+};
+
+using JSTestSerializationConstructor = JSDOMConstructorNotConstructable<JSTestSerialization>;
+
+template<> JSValue JSTestSerializationConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+ UNUSED_PARAM(vm);
+ return globalObject.functionPrototype();
+}
+
+template<> void JSTestSerializationConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+ putDirect(vm, vm.propertyNames->prototype, JSTestSerialization::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestSerialization"))), ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestSerializationConstructor::s_info = { "TestSerialization", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestSerializationConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestSerializationPrototypeTableValues[] =
+{
+ { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationConstructor) } },
+ { "firstStringAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFirstStringAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFirstStringAttribute) } },
+ { "secondLongAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationSecondLongAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationSecondLongAttribute) } },
+ { "thirdUnserializableAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationThirdUnserializableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationThirdUnserializableAttribute) } },
+ { "fourthUnrestrictedDoubleAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFourthUnrestrictedDoubleAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFourthUnrestrictedDoubleAttribute) } },
+ { "fifthLongAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFifthLongAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFifthLongAttribute) } },
+ { "toJSON", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestSerializationPrototypeFunctionToJSON), (intptr_t) (0) } },
+};
+
+const ClassInfo JSTestSerializationPrototype::s_info = { "TestSerializationPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestSerializationPrototype) };
+
+void JSTestSerializationPrototype::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+ reifyStaticProperties(vm, JSTestSerializationPrototypeTableValues, *this);
+}
+
+const ClassInfo JSTestSerialization::s_info = { "TestSerialization", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestSerialization) };
+
+JSTestSerialization::JSTestSerialization(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestSerialization>&& impl)
+ : JSDOMWrapper<TestSerialization>(structure, globalObject, WTFMove(impl))
+{
+}
+
+JSObject* JSTestSerialization::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return JSTestSerializationPrototype::create(vm, globalObject, JSTestSerializationPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+JSObject* JSTestSerialization::prototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return getDOMPrototype<JSTestSerialization>(vm, globalObject);
+}
+
+void JSTestSerialization::destroy(JSC::JSCell* cell)
+{
+ JSTestSerialization* thisObject = static_cast<JSTestSerialization*>(cell);
+ thisObject->JSTestSerialization::~JSTestSerialization();
+}
+
+template<> inline JSTestSerialization* BindingCaller<JSTestSerialization>::castForAttribute(ExecState&, EncodedJSValue thisValue)
+{
+ return jsDynamicCast<JSTestSerialization*>(JSValue::decode(thisValue));
+}
+
+template<> inline JSTestSerialization* BindingCaller<JSTestSerialization>::castForOperation(ExecState& state)
+{
+ return jsDynamicCast<JSTestSerialization*>(state.thisValue());
+}
+
+static inline JSValue jsTestSerializationFirstStringAttributeGetter(ExecState&, JSTestSerialization&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestSerializationFirstStringAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestSerialization>::attribute<jsTestSerializationFirstStringAttributeGetter>(state, thisValue, "firstStringAttribute");
+}
+
+static inline JSValue jsTestSerializationFirstStringAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = jsStringWithCache(&state, impl.firstStringAttribute());
+ return result;
+}
+
+static inline JSValue jsTestSerializationSecondLongAttributeGetter(ExecState&, JSTestSerialization&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestSerializationSecondLongAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestSerialization>::attribute<jsTestSerializationSecondLongAttributeGetter>(state, thisValue, "secondLongAttribute");
+}
+
+static inline JSValue jsTestSerializationSecondLongAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = jsNumber(impl.secondLongAttribute());
+ return result;
+}
+
+static inline JSValue jsTestSerializationThirdUnserializableAttributeGetter(ExecState&, JSTestSerialization&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestSerializationThirdUnserializableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestSerialization>::attribute<jsTestSerializationThirdUnserializableAttributeGetter>(state, thisValue, "thirdUnserializableAttribute");
+}
+
+static inline JSValue jsTestSerializationThirdUnserializableAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = toJS(&state, thisObject.globalObject(), impl.thirdUnserializableAttribute());
+ return result;
+}
+
+static inline JSValue jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(ExecState&, JSTestSerialization&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestSerializationFourthUnrestrictedDoubleAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestSerialization>::attribute<jsTestSerializationFourthUnrestrictedDoubleAttributeGetter>(state, thisValue, "fourthUnrestrictedDoubleAttribute");
+}
+
+static inline JSValue jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = jsNumber(impl.fourthUnrestrictedDoubleAttribute());
+ return result;
+}
+
+static inline JSValue jsTestSerializationFifthLongAttributeGetter(ExecState&, JSTestSerialization&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestSerializationFifthLongAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestSerialization>::attribute<jsTestSerializationFifthLongAttributeGetter>(state, thisValue, "fifthLongAttribute");
+}
+
+static inline JSValue jsTestSerializationFifthLongAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = jsNumber(impl.fifthLongAttribute());
+ return result;
+}
+
+EncodedJSValue jsTestSerializationConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ VM& vm = state->vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ JSTestSerializationPrototype* domObject = jsDynamicCast<JSTestSerializationPrototype*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!domObject))
+ return throwVMTypeError(state, throwScope);
+ return JSValue::encode(JSTestSerialization::getConstructor(state->vm(), domObject->globalObject()));
+}
+
+bool setJSTestSerializationConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ VM& vm = state->vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ JSValue value = JSValue::decode(encodedValue);
+ JSTestSerializationPrototype* domObject = jsDynamicCast<JSTestSerializationPrototype*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!domObject)) {
+ throwVMTypeError(state, throwScope);
+ return false;
+ }
+ // Shadowing a built-in constructor
+ return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
+}
+
+static inline bool setJSTestSerializationFirstStringAttributeFunction(ExecState&, JSTestSerialization&, JSValue, ThrowScope&);
+
+bool setJSTestSerializationFirstStringAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestSerialization>::setAttribute<setJSTestSerializationFirstStringAttributeFunction>(state, thisValue, encodedValue, "firstStringAttribute");
+}
+
+static inline bool setJSTestSerializationFirstStringAttributeFunction(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = value.toWTFString(&state);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setFirstStringAttribute(WTFMove(nativeValue));
+ return true;
+}
+
+
+static inline bool setJSTestSerializationSecondLongAttributeFunction(ExecState&, JSTestSerialization&, JSValue, ThrowScope&);
+
+bool setJSTestSerializationSecondLongAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestSerialization>::setAttribute<setJSTestSerializationSecondLongAttributeFunction>(state, thisValue, encodedValue, "secondLongAttribute");
+}
+
+static inline bool setJSTestSerializationSecondLongAttributeFunction(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLLong>(state, value, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setSecondLongAttribute(WTFMove(nativeValue));
+ return true;
+}
+
+
+static inline bool setJSTestSerializationThirdUnserializableAttributeFunction(ExecState&, JSTestSerialization&, JSValue, ThrowScope&);
+
+bool setJSTestSerializationThirdUnserializableAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestSerialization>::setAttribute<setJSTestSerializationThirdUnserializableAttributeFunction>(state, thisValue, encodedValue, "thirdUnserializableAttribute");
+}
+
+static inline bool setJSTestSerializationThirdUnserializableAttributeFunction(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = JSTestNode::toWrapped(value);
+ if (UNLIKELY(!nativeValue)) {
+ throwAttributeTypeError(state, throwScope, "TestSerialization", "thirdUnserializableAttribute", "TestNode");
+ return false;
+ }
+ impl.setThirdUnserializableAttribute(*nativeValue);
+ return true;
+}
+
+
+static inline bool setJSTestSerializationFourthUnrestrictedDoubleAttributeFunction(ExecState&, JSTestSerialization&, JSValue, ThrowScope&);
+
+bool setJSTestSerializationFourthUnrestrictedDoubleAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestSerialization>::setAttribute<setJSTestSerializationFourthUnrestrictedDoubleAttributeFunction>(state, thisValue, encodedValue, "fourthUnrestrictedDoubleAttribute");
+}
+
+static inline bool setJSTestSerializationFourthUnrestrictedDoubleAttributeFunction(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setFourthUnrestrictedDoubleAttribute(WTFMove(nativeValue));
+ return true;
+}
+
+
+static inline bool setJSTestSerializationFifthLongAttributeFunction(ExecState&, JSTestSerialization&, JSValue, ThrowScope&);
+
+bool setJSTestSerializationFifthLongAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestSerialization>::setAttribute<setJSTestSerializationFifthLongAttributeFunction>(state, thisValue, encodedValue, "fifthLongAttribute");
+}
+
+static inline bool setJSTestSerializationFifthLongAttributeFunction(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLLong>(state, value, NormalConversion);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setFifthLongAttribute(WTFMove(nativeValue));
+ return true;
+}
+
+
+JSValue JSTestSerialization::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+ return getDOMConstructor<JSTestSerializationConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope& throwScope)
+{
+ auto& vm = state->vm();
+ auto* result = constructEmptyObject(state);
+
+ auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
+ ASSERT(!throwScope.exception());
+ result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
+
+ auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
+ ASSERT(!throwScope.exception());
+ result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
+
+ auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
+ ASSERT(!throwScope.exception());
+ result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
+
+ auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
+ ASSERT(!throwScope.exception());
+ result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
+
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(ExecState* state)
+{
+ return BindingCaller<JSTestSerialization>::callOperation<jsTestSerializationPrototypeFunctionToJSONCaller>(state, "toJSON");
+}
+
+bool JSTestSerializationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+ UNUSED_PARAM(handle);
+ UNUSED_PARAM(visitor);
+ return false;
+}
+
+void JSTestSerializationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+ auto* jsTestSerialization = jsCast<JSTestSerialization*>(handle.slot()->asCell());
+ auto& world = *static_cast<DOMWrapperWorld*>(context);
+ uncacheWrapper(world, &jsTestSerialization->wrapped(), jsTestSerialization);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestSerialization@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore17TestSerializationE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestSerialization>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+ void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+ void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestSerialization@WebCore@@6B@"));
+#else
+ void* expectedVTablePointer = &_ZTVN7WebCore17TestSerializationE[2];
+#if COMPILER(CLANG)
+ // If this fails TestSerialization does not have a vtable, so you need to add the
+ // ImplementationLacksVTable attribute to the interface definition
+ static_assert(__is_polymorphic(TestSerialization), "TestSerialization is not polymorphic");
+#endif
+#endif
+ // If you hit this assertion you either have a use after free bug, or
+ // TestSerialization has subclasses. If TestSerialization has subclasses that get passed
+ // to toJS() we currently require TestSerialization you to opt out of binding hardening
+ // by adding the SkipVTableValidation attribute to the interface IDL definition
+ RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+ return createWrapper<TestSerialization>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestSerialization& impl)
+{
+ return wrap(state, globalObject, impl);
+}
+
+TestSerialization* JSTestSerialization::toWrapped(JSC::JSValue value)
+{
+ if (auto* wrapper = jsDynamicCast<JSTestSerialization*>(value))
+ return &wrapper->wrapped();
+ return nullptr;
+}
+
+}
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h (0 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h 2016-10-15 21:15:17 UTC (rev 207378)
@@ -0,0 +1,89 @@
+/*
+ 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 "JSDOMWrapper.h"
+#include "TestSerialization.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestSerialization : public JSDOMWrapper<TestSerialization> {
+public:
+ using Base = JSDOMWrapper<TestSerialization>;
+ static JSTestSerialization* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestSerialization>&& impl)
+ {
+ JSTestSerialization* ptr = new (NotNull, JSC::allocateCell<JSTestSerialization>(globalObject->vm().heap)) JSTestSerialization(structure, *globalObject, WTFMove(impl));
+ ptr->finishCreation(globalObject->vm());
+ return ptr;
+ }
+
+ static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+ static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
+ static TestSerialization* toWrapped(JSC::JSValue);
+ static void destroy(JSC::JSCell*);
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+protected:
+ JSTestSerialization(JSC::Structure*, JSDOMGlobalObject&, Ref<TestSerialization>&&);
+
+ void finishCreation(JSC::VM& vm)
+ {
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ }
+
+};
+
+class JSTestSerializationOwner : public JSC::WeakHandleOwner {
+public:
+ virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
+ virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestSerialization*)
+{
+ static NeverDestroyed<JSTestSerializationOwner> owner;
+ return &owner.get();
+}
+
+inline void* wrapperKey(TestSerialization* wrappableObject)
+{
+ return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestSerialization&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestSerialization* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestSerialization>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestSerialization>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+template<> struct JSDOMWrapperConverterTraits<TestSerialization> {
+ using WrapperClass = JSTestSerialization;
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (207377 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-10-15 21:15:17 UTC (rev 207378)
@@ -414,8 +414,7 @@
stringifier attribute USVString stringifierAttribute;
-
- serializer = {readOnlyStringAttr, create, enumAttr, longAttr};
+ serializer = {create, readOnlyStringAttr, enumAttr, longAttr};
};
// The following comment should not generate any code.
Copied: trunk/Source/WebCore/bindings/scripts/test/TestSerialization.idl (from rev 207377, trunk/Source/WebCore/dom/ClientRect.idl) (0 => 207378)
--- trunk/Source/WebCore/bindings/scripts/test/TestSerialization.idl (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestSerialization.idl 2016-10-15 21:15:17 UTC (rev 207378)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+interface TestSerialization {
+ attribute DOMString firstStringAttribute;
+ attribute long secondLongAttribute;
+ attribute TestNode thirdUnserializableAttribute;
+ attribute unrestricted double fourthUnrestrictedDoubleAttribute;
+ attribute long fifthLongAttribute;
+
+ serializer = { attribute };
+};
Modified: trunk/Source/WebCore/dom/ClientRect.idl (207377 => 207378)
--- trunk/Source/WebCore/dom/ClientRect.idl 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/dom/ClientRect.idl 2016-10-15 21:15:17 UTC (rev 207378)
@@ -35,7 +35,5 @@
readonly attribute unrestricted float width;
readonly attribute unrestricted float height;
- // FIXME: should be serializer = { attribute };
- [Custom] Object toJSON();
+ serializer = { attribute };
};
-
Modified: trunk/Source/WebCore/page/PerformanceTiming.idl (207377 => 207378)
--- trunk/Source/WebCore/page/PerformanceTiming.idl 2016-10-15 20:56:24 UTC (rev 207377)
+++ trunk/Source/WebCore/page/PerformanceTiming.idl 2016-10-15 21:15:17 UTC (rev 207378)
@@ -54,7 +54,5 @@
readonly attribute unsigned long long loadEventStart;
readonly attribute unsigned long long loadEventEnd;
- // FIXME: Should be serializer = { attribute };
- [Custom] Object toJSON();
+ serializer = { attribute };
};
-