Title: [221585] trunk/Source
Revision
221585
Author
[email protected]
Date
2017-09-04 03:50:58 -0700 (Mon, 04 Sep 2017)

Log Message

Source/_javascript_Core:
[WebIDL] Unify and simplify EnableBySettings with the rest of the runtime settings
https://bugs.webkit.org/show_bug.cgi?id=176312

Patch by Sam Weinig <[email protected]> on 2017-09-04
Reviewed by Darin Adler.

* runtime/CommonIdentifiers.h:

    Remove WebCore specific identifiers from CommonIdentifiers. They have been moved
    to WebCoreBuiltinNames in WebCore.

Source/WebCore:
[WebIDL] Simplify EnabledBySettings generation
https://bugs.webkit.org/show_bug.cgi?id=176312

Patch by Sam Weinig <[email protected]> on 2017-09-04
Reviewed by Darin Adler.

* bindings/scripts/CodeGeneratorJS.pm:
(NeedsRuntimeCheck):
(OperationShouldBeOnInstance):
(GeneratePropertiesHashTable):
(GenerateRuntimeEnableConditionalString):
(GenerateImplementation):
(GenerateAttributeGetterBodyDefinition):

    - Simplify the [EnabledBySetting] code generation by merging it with the other
    runtime checks (Exposed, EnabledAtRuntime, EnabledForWorld, and SecureContext).

    - Switches to using WebCoreBuiltinNames for identifiers, rather than relying
    on the appropriate identifiers being available on _javascript_Core's CommonIdentifiers
    which was an unnecessary layering violation. There are still problems with this
    as we continue to be inconsistent  about which identifiers deserve to be in
    WebCoreBuiltinNames, and which ones can be created each time and there is no
    automation of WebCoreBuiltinNames from the IDLs.

    - Enforce at code generation time that [EnabledBySetting] can only be used
    on interfaces that are uniquely exposed to the window environment. This is a
    condition we should find a way to remove (e.g. propagating necessary settings
    to an object the ScriptExecutionContext owns), but for now, Settings is a main
    thread only object.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::put):
(WebCore::addCrossOriginWindowPropertyNames):
(WebCore::addCrossOriginWindowOwnPropertyNames):

    Switch to using WebCoreBuiltinNames for WebCore specific identifiers.

* bindings/js/WebCoreBuiltinNames.h:

    Add WebCore specific identifiers from _javascript_Core's CommonIdentifiers
    as well as some new ones need by the [EnableBySetting] unification.

* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: Added.
* bindings/scripts/test/JS/JSTestEnabledBySetting.h: Added.
* bindings/scripts/test/TestEnabledBySetting.idl: Added.

    Add new test for [EnabledBySetting].

* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:

    Remove use of [EnabledBySetting] from TestObj, as it is no longer
    valid to use [EnabledBySetting] on interfaces that are no uniquely
    exposed to the window environment.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (221584 => 221585)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-04 10:50:58 UTC (rev 221585)
@@ -1,3 +1,15 @@
+2017-09-04  Sam Weinig  <[email protected]>
+
+        [WebIDL] Unify and simplify EnableBySettings with the rest of the runtime settings
+        https://bugs.webkit.org/show_bug.cgi?id=176312
+
+        Reviewed by Darin Adler.
+
+        * runtime/CommonIdentifiers.h:
+
+            Remove WebCore specific identifiers from CommonIdentifiers. They have been moved
+            to WebCoreBuiltinNames in WebCore.
+
 2017-09-03  Yusuke Suzuki  <[email protected]>
 
         Remove "malloc" and "free" use

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (221584 => 221585)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2017-09-04 10:50:58 UTC (rev 221585)
@@ -26,57 +26,22 @@
 // MarkedArgumentBuffer of property names, passed to a macro so we can do set them up various
 // ways without repeating the list.
 #define JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
-    macro(Animation) \
-    macro(AnimationEffectReadOnly) \
-    macro(AnimationTimeline) \
     macro(Array) \
     macro(ArrayBuffer) \
     macro(ArrayIterator) \
-    macro(Audio) \
     macro(BYTES_PER_ELEMENT) \
     macro(Boolean) \
-    macro(Cache) \
-    macro(CacheStorage) \
     macro(Collator) \
     macro(Credential) \
-    macro(CredentialsContainer) \
-    macro(CustomElementRegistry) \
     macro(Date) \
     macro(DateTimeFormat) \
     macro(DataTransferItem) \
     macro(DataTransferItemList) \
-    macro(DocumentTimeline) \
     macro(Error) \
     macro(EvalError) \
-    macro(FederatedCredential) \
-    macro(FileSystem) \
-    macro(FileSystemDirectoryEntry) \
-    macro(FileSystemDirectoryReader) \
-    macro(FileSystemEntry) \
-    macro(FileSystemFileEntry) \
     macro(Function) \
-    macro(Gamepad) \
-    macro(GamepadButton) \
-    macro(GamepadEvent) \
     macro(GeneratorFunction) \
-    macro(Headers) \
-    macro(HTMLAudioElement) \
-    macro(HTMLSlotElement) \
-    macro(IDBCursor) \
-    macro(IDBCursorWithValue) \
-    macro(IDBDatabase) \
-    macro(IDBFactory) \
-    macro(IDBIndex) \
-    macro(IDBKeyRange) \
-    macro(IDBObjectStore) \
-    macro(IDBOpenDBRequest) \
-    macro(IDBRequest) \
-    macro(IDBTransaction) \
-    macro(IDBVersionChangeEvent) \
     macro(Infinity) \
-    macro(InputEvent) \
-    macro(IntersectionObserver) \
-    macro(IntersectionObserverEntry) \
     macro(Intl) \
     macro(JSON) \
     macro(Loader) \
@@ -83,38 +48,10 @@
     macro(Map)\
     macro(MapIterator)\
     macro(Math) \
-    macro(MediaEncryptedEvent) \
-    macro(MediaKeyMessageEvent) \
-    macro(MediaKeySession) \
-    macro(MediaKeyStatusMap) \
-    macro(MediaKeySystemAccess) \
-    macro(MediaKeys) \
-    macro(WebKitMediaKeyError) \
-    macro(WebKitMediaKeyNeededEvent) \
-    macro(WebKitMediaKeySession) \
-    macro(WebKitMediaKeys) \
-    macro(WebKitMediaKeyMessageEvent) \
-    macro(MediaStreamEvent) \
-    macro(ModernMediaControls) \
     macro(NaN) \
-    macro(NavigatorCredentials) \
-    macro(NavigatorMediaDevices) \
-    macro(NavigatorUserMedia) \
     macro(Number) \
     macro(NumberFormat) \
     macro(Object) \
-    macro(PasswordCredential) \
-    macro(PaymentAddress) \
-    macro(PaymentRequest) \
-    macro(PaymentRequestUpdateEvent) \
-    macro(PaymentResponse) \
-    macro(PerformanceEntry) \
-    macro(PerformanceEntryList) \
-    macro(PerformanceMark) \
-    macro(PerformanceMeasure) \
-    macro(PerformanceObserver) \
-    macro(PerformanceObserverEntryList) \
-    macro(PerformanceResourceTiming) \
     macro(Promise) \
     macro(Proxy) \
     macro(RangeError) \
@@ -121,30 +58,9 @@
     macro(ReferenceError) \
     macro(Reflect) \
     macro(RegExp) \
-    macro(Request) \
-    macro(Response) \
-    macro(RTCDataChannel) \
-    macro(RTCDataChannelEvent) \
-    macro(RTCDTMFSender) \
-    macro(RTCDTMFToneChangeEvent) \
-    macro(RTCIceCandidate) \
-    macro(RTCIceTransport) \
-    macro(RTCPeerConnection) \
-    macro(RTCRtpReceiver) \
-    macro(RTCRtpSender) \
-    macro(RTCRtpTransceiver) \
-    macro(RTCSessionDescription) \
-    macro(RTCStatsReport) \
-    macro(RTCTrackEvent) \
-    macro(ServiceWorker)\
-    macro(ServiceWorkerContainer)\
-    macro(ServiceWorkerGlobalScope)\
-    macro(ServiceWorkerRegistration)\
     macro(Set)\
     macro(SetIterator)\
-    macro(ShadowRoot) \
     macro(SharedArrayBuffer) \
-    macro(StaticRange) \
     macro(String) \
     macro(Symbol) \
     macro(SyntaxError) \
@@ -153,32 +69,6 @@
     macro(UTC) \
     macro(WeakMap)\
     macro(WeakSet)\
-    macro(WebGL2RenderingContext) \
-    macro(WebGLVertexArrayObject) \
-    macro(WebGPUBuffer) \
-    macro(WebGPUCommandBuffer) \
-    macro(WebGPUCommandQueue) \
-    macro(WebGPUComputeCommandEncoder) \
-    macro(WebGPUComputePipelineState) \
-    macro(WebGPUDepthStencilDescriptor) \
-    macro(WebGPUDepthStencilState) \
-    macro(WebGPUDrawable) \
-    macro(WebGPUFunction) \
-    macro(WebGPULibrary) \
-    macro(WebGPURenderCommandEncoder) \
-    macro(WebGPURenderPassAttachmentDescriptor) \
-    macro(WebGPURenderPassColorAttachmentDescriptor) \
-    macro(WebGPURenderPassDepthAttachmentDescriptor) \
-    macro(WebGPURenderPassDescriptor) \
-    macro(WebGPURenderPipelineColorAttachmentDescriptor) \
-    macro(WebGPURenderPipelineDescriptor) \
-    macro(WebGPURenderPipelineState) \
-    macro(WebGPURenderingContext) \
-    macro(WebGPUSize) \
-    macro(WebGPUTexture) \
-    macro(WebGPUTextureDescriptor) \
-    macro(WebSocket) \
-    macro(WritableStream) \
     macro(__defineGetter__) \
     macro(__defineSetter__) \
     macro(__lookupGetter__) \
@@ -191,7 +81,6 @@
     macro(assign) \
     macro(back) \
     macro(bind) \
-    macro(blur) \
     macro(buffer) \
     macro(byteLength) \
     macro(byteOffset) \
@@ -199,14 +88,11 @@
     macro(bytecodeIndex) \
     macro(bytecodes) \
     macro(bytecodesID) \
-    macro(caches) \
     macro(calendar) \
     macro(callee) \
     macro(caller) \
     macro(caseFirst) \
     macro(clear) \
-    macro(close) \
-    macro(closed) \
     macro(collation) \
     macro(column) \
     macro(compilationKind) \
@@ -217,7 +103,6 @@
     macro(constructor) \
     macro(count) \
     macro(counters) \
-    macro(customElements) \
     macro(day) \
     macro(defineProperty) \
     macro(description) \
@@ -224,7 +109,6 @@
     macro(descriptions) \
     macro(detail) \
     macro(displayName) \
-    macro(document) \
     macro(done) \
     macro(dotAll) \
     macro(enumerable) \
@@ -236,12 +120,10 @@
     macro(exitKind) \
     macro(fetch) \
     macro(flags) \
-    macro(focus) \
     macro(forEach) \
     macro(formatMatcher) \
     macro(formatToParts) \
     macro(forward) \
-    macro(frames) \
     macro(from) \
     macro(fromCharCode) \
     macro(get) \
@@ -258,7 +140,6 @@
     macro(ignoreCase) \
     macro(ignorePunctuation) \
     macro(index) \
-    macro(indexedDB) \
     macro(inferredName) \
     macro(input) \
     macro(instructionCount) \
@@ -265,18 +146,15 @@
     macro(isArray) \
     macro(isEnabled) \
     macro(isPrototypeOf) \
-    macro(isSecureContext) \
     macro(isView) \
     macro(isWatchpoint) \
     macro(jettisonReason) \
     macro(join) \
-    macro(KeyframeEffect) \
     macro(lastIndex) \
     macro(length) \
     macro(line) \
     macro(locale) \
     macro(localeMatcher) \
-    macro(location) \
     macro(message) \
     macro(minute) \
     macro(month) \
@@ -291,15 +169,12 @@
     macro(numeric) \
     macro(of) \
     macro(opcode) \
-    macro(opener) \
     macro(origin) \
     macro(osrExitSites) \
     macro(osrExits) \
-    macro(parent) \
     macro(parse) \
     macro(parseInt) \
     macro(parseFloat) \
-    macro(postMessage) \
     macro(profiledBytecodes) \
     macro(propertyIsEnumerable) \
     macro(prototype) \
@@ -308,10 +183,8 @@
     macro(replace) \
     macro(resolve) \
     macro(second) \
-    macro(self) \
     macro(sensitivity) \
     macro(set) \
-    macro(showModalDialog) \
     macro(size) \
     macro(slice) \
     macro(source) \
@@ -335,26 +208,12 @@
     macro(toLocaleString) \
     macro(toPrecision) \
     macro(toString) \
-    macro(top) \
     macro(uid) \
     macro(unicode) \
     macro(usage) \
     macro(value) \
     macro(valueOf) \
-    macro(webkit) \
-    macro(collectMatchingElementsInFlatTree) \
-    macro(matchingElementInFlatTree) \
-    macro(webkitIDBCursor) \
-    macro(webkitIDBDatabase) \
-    macro(webkitIDBFactory) \
-    macro(webkitIDBIndex) \
-    macro(webkitIDBKeyRange) \
-    macro(webkitIDBObjectStore) \
-    macro(webkitIDBRequest) \
-    macro(webkitIDBTransaction) \
-    macro(webkitIndexedDB) \
     macro(weekday) \
-    macro(window) \
     macro(writable) \
     macro(year)
 

Modified: trunk/Source/WebCore/ChangeLog (221584 => 221585)


--- trunk/Source/WebCore/ChangeLog	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/ChangeLog	2017-09-04 10:50:58 UTC (rev 221585)
@@ -1,3 +1,62 @@
+2017-09-04  Sam Weinig  <[email protected]>
+
+        [WebIDL] Simplify EnabledBySettings generation
+        https://bugs.webkit.org/show_bug.cgi?id=176312
+
+        Reviewed by Darin Adler.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (NeedsRuntimeCheck):
+        (OperationShouldBeOnInstance):
+        (GeneratePropertiesHashTable):
+        (GenerateRuntimeEnableConditionalString):
+        (GenerateImplementation):
+        (GenerateAttributeGetterBodyDefinition):
+
+            - Simplify the [EnabledBySetting] code generation by merging it with the other
+            runtime checks (Exposed, EnabledAtRuntime, EnabledForWorld, and SecureContext).
+
+            - Switches to using WebCoreBuiltinNames for identifiers, rather than relying
+            on the appropriate identifiers being available on _javascript_Core's CommonIdentifiers
+            which was an unnecessary layering violation. There are still problems with this
+            as we continue to be inconsistent  about which identifiers deserve to be in 
+            WebCoreBuiltinNames, and which ones can be created each time and there is no
+            automation of WebCoreBuiltinNames from the IDLs.
+
+            - Enforce at code generation time that [EnabledBySetting] can only be used
+            on interfaces that are uniquely exposed to the window environment. This is a
+            condition we should find a way to remove (e.g. propagating necessary settings 
+            to an object the ScriptExecutionContext owns), but for now, Settings is a main
+            thread only object.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
+        (WebCore::JSDOMWindow::getOwnPropertySlot):
+        (WebCore::JSDOMWindow::put):
+        (WebCore::addCrossOriginWindowPropertyNames):
+        (WebCore::addCrossOriginWindowOwnPropertyNames):
+
+            Switch to using WebCoreBuiltinNames for WebCore specific identifiers.
+
+        * bindings/js/WebCoreBuiltinNames.h:
+
+            Add WebCore specific identifiers from _javascript_Core's CommonIdentifiers
+            as well as some new ones need by the [EnableBySetting] unification.
+
+        * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: Added.
+        * bindings/scripts/test/JS/JSTestEnabledBySetting.h: Added.
+        * bindings/scripts/test/TestEnabledBySetting.idl: Added.
+
+            Add new test for [EnabledBySetting].
+
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/TestObj.idl:
+
+            Remove use of [EnabledBySetting] from TestObj, as it is no longer
+            valid to use [EnabledBySetting] on interfaces that are no uniquely
+            exposed to the window environment.
+
 2017-09-03  Yusuke Suzuki  <[email protected]>
 
         Remove "malloc" and "free" use

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (221584 => 221585)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-09-04 10:50:58 UTC (rev 221585)
@@ -91,9 +91,11 @@
     Base::finishCreation(vm, proxy);
     ASSERT(inherits(vm, info()));
 
+    auto& builtinNames = static_cast<JSVMClientData*>(vm.clientData)->builtinNames();
+
     GlobalPropertyInfo staticGlobals[] = {
-        GlobalPropertyInfo(vm.propertyNames->document, jsNull(), DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->window, m_proxy, DontDelete | ReadOnly),
+        GlobalPropertyInfo(builtinNames.documentPublicName(), jsNull(), DontDelete | ReadOnly),
+        GlobalPropertyInfo(builtinNames.windowPublicName(), m_proxy, DontDelete | ReadOnly),
     };
 
     addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
@@ -117,7 +119,7 @@
     bool shouldThrowReadOnlyError = false;
     bool ignoreReadOnlyErrors = true;
     bool putResult = false;
-    symbolTablePutTouchWatchpointSet(this, exec, exec->vm().propertyNames->document, toJS(exec, this, m_wrapped->document()), shouldThrowReadOnlyError, ignoreReadOnlyErrors, putResult);
+    symbolTablePutTouchWatchpointSet(this, exec, static_cast<JSVMClientData*>(exec->vm().clientData)->builtinNames().documentPublicName(), toJS(exec, this, m_wrapped->document()), shouldThrowReadOnlyError, ignoreReadOnlyErrors, putResult);
 }
 
 ScriptExecutionContext* JSDOMWindowBase::scriptExecutionContext() const

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (221584 => 221585)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2017-09-04 10:50:58 UTC (rev 221585)
@@ -42,6 +42,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "ScheduledAction.h"
 #include "Settings.h"
+#include "WebCoreJSClientData.h"
 #include <runtime/JSCInlines.h>
 #include <runtime/Lookup.h>
 
@@ -82,16 +83,18 @@
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
+    auto& builtinNames = static_cast<JSVMClientData*>(vm.clientData)->builtinNames();
+
     // We don't want any properties other than "close" and "closed" on a frameless window
     // (i.e. one whose page got closed, or whose iframe got removed).
     // FIXME: This handling for frameless windows duplicates similar behaviour for cross-origin
     // access below; we should try to find a way to merge the two.
     if (!frame) {
-        if (propertyName == exec->propertyNames().closed) {
+        if (propertyName == builtinNames.closedPublicName()) {
             slot.setCustom(thisObject, ReadOnly | DontDelete, jsDOMWindowClosed);
             return true;
         }
-        if (propertyName == exec->propertyNames().close) {
+        if (propertyName == builtinNames.closePublicName()) {
             slot.setCustom(thisObject, ReadOnly | DontDelete, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
             return true;
         }
@@ -110,19 +113,19 @@
 
     // These are the functions we allow access to cross-origin (DoNotCheckSecurity in IDL).
     // Always provide the original function, on a fresh uncached function object.
-    if (propertyName == exec->propertyNames().blur) {
+    if (propertyName == builtinNames.blurPublicName()) {
         slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
         return true;
     }
-    if (propertyName == exec->propertyNames().close) {
+    if (propertyName == builtinNames.closePublicName()) {
         slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
         return true;
     }
-    if (propertyName == exec->propertyNames().focus) {
+    if (propertyName == builtinNames.focusPublicName()) {
         slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
         return true;
     }
-    if (propertyName == exec->propertyNames().postMessage) {
+    if (propertyName == builtinNames.postMessagePublicName()) {
         slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
         return true;
     }
@@ -132,16 +135,16 @@
     // behavior.
     if (auto* entry = JSDOMWindow::info()->staticPropHashTable->entry(propertyName)) {
         // Only allow access to these specific properties.
-        if (propertyName == exec->propertyNames().location
-            || propertyName == exec->propertyNames().closed
+        if (propertyName == builtinNames.locationPublicName()
+            || propertyName == builtinNames.closedPublicName()
             || propertyName == exec->propertyNames().length
-            || propertyName == exec->propertyNames().self
-            || propertyName == exec->propertyNames().window
-            || propertyName == exec->propertyNames().frames
-            || propertyName == exec->propertyNames().opener
-            || propertyName == exec->propertyNames().parent
-            || propertyName == exec->propertyNames().top) {
-            bool shouldExposeSetter = propertyName == exec->propertyNames().location;
+            || propertyName == builtinNames.selfPublicName()
+            || propertyName == builtinNames.windowPublicName()
+            || propertyName == builtinNames.framesPublicName()
+            || propertyName == builtinNames.openerPublicName()
+            || propertyName == builtinNames.parentPublicName()
+            || propertyName == builtinNames.topPublicName()) {
+            bool shouldExposeSetter = propertyName == builtinNames.locationPublicName();
             CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, entry->propertyGetter(), shouldExposeSetter ? entry->propertyPutter() : nullptr);
             slot.setCustomGetterSetter(thisObject, CustomAccessor, customGetterSetter);
             return true;
@@ -196,7 +199,7 @@
     PropertySlot slotCopy = slot;
     if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
         // Detect when we're getting the property 'showModalDialog', this is disabled, and has its original value.
-        bool isShowModalDialogAndShouldHide = propertyName == state->propertyNames().showModalDialog
+        bool isShowModalDialogAndShouldHide = propertyName == static_cast<JSVMClientData*>(state->vm().clientData)->builtinNames().showModalDialogPublicName()
             && !DOMWindow::canShowModalDialog(*frame)
             && slot.isValue() && isHostFunction(slot.getValue(state, propertyName), jsDOMWindowInstanceFunctionShowModalDialog);
         // Unless we're in the showModalDialog special case, we're done.
@@ -206,7 +209,7 @@
     }
 
 #if ENABLE(USER_MESSAGE_HANDLERS)
-    if (propertyName == state->propertyNames().webkit && thisObject->wrapped().shouldHaveWebKitNamespaceForWorld(thisObject->world())) {
+    if (propertyName == static_cast<JSVMClientData*>(state->vm().clientData)->builtinNames().webkitPublicName() && thisObject->wrapped().shouldHaveWebKitNamespaceForWorld(thisObject->world())) {
         slot.setCacheableCustom(thisObject, DontDelete | ReadOnly, jsDOMWindowWebKit);
         return true;
     }
@@ -255,7 +258,7 @@
     String errorMessage;
     if (!BindingSecurity::shouldAllowAccessToDOMWindow(*state, thisObject->wrapped(), errorMessage)) {
         // We only allow setting "location" attribute cross-origin.
-        if (propertyName == state->propertyNames().location) {
+        if (propertyName == static_cast<JSVMClientData*>(vm.clientData)->builtinNames().locationPublicName()) {
             bool putResult = false;
             if (lookupPut(state, propertyName, thisObject, value, *s_info.staticPropHashTable, slot, putResult))
                 return putResult;
@@ -296,14 +299,22 @@
 }
 
 // https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
-static void addCrossOriginWindowPropertyNames(ExecState& state, PropertyNameArray& propertyNames)
+static void addCrossOriginWindowPropertyNames(VM& vm, PropertyNameArray& propertyNames)
 {
     static const Identifier* const properties[] = {
-        &state.propertyNames().blur, &state.propertyNames().close, &state.propertyNames().closed,
-        &state.propertyNames().focus, &state.propertyNames().frames, &state.propertyNames().length,
-        &state.propertyNames().location, &state.propertyNames().opener, &state.propertyNames().parent,
-        &state.propertyNames().postMessage, &state.propertyNames().self, &state.propertyNames().top,
-        &state.propertyNames().window
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().blurPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().closePublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().closedPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().focusPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().framesPublicName(),
+        &vm.propertyNames->length,
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().locationPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().openerPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().parentPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().postMessagePublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().selfPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().topPublicName(),
+        &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().windowPublicName()
     };
     for (auto* property : properties)
         propertyNames.add(*property);
@@ -327,7 +338,7 @@
 // https://html.spec.whatwg.org/#crossoriginownpropertykeys-(-o-)
 static void addCrossOriginWindowOwnPropertyNames(ExecState& state, PropertyNameArray& propertyNames)
 {
-    addCrossOriginWindowPropertyNames(state, propertyNames);
+    addCrossOriginWindowPropertyNames(state.vm(), propertyNames);
 
     propertyNames.add(state.propertyNames().toStringTagSymbol);
     propertyNames.add(state.propertyNames().hasInstanceSymbol);

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (221584 => 221585)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2017-09-04 10:50:58 UTC (rev 221585)
@@ -30,47 +30,190 @@
 
 namespace WebCore {
 
-#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro)\
+#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
+    macro(Animation) \
+    macro(AnimationEffectReadOnly) \
+    macro(AnimationTimeline) \
+    macro(ApplePaySession) \
+    macro(Audio) \
+    macro(Cache) \
+    macro(CacheStorage) \
+    macro(Credential) \
+    macro(CredentialsContainer) \
+    macro(CustomElementRegistry) \
+    macro(DataTransferItem) \
+    macro(DataTransferItemList) \
+    macro(DocumentTimeline) \
+    macro(FederatedCredential) \
+    macro(FileSystem) \
+    macro(FileSystemDirectoryEntry) \
+    macro(FileSystemDirectoryReader) \
+    macro(FileSystemEntry) \
+    macro(FileSystemFileEntry) \
+    macro(Gamepad) \
+    macro(GamepadButton) \
+    macro(GamepadEvent) \
+    macro(HTMLAudioElement) \
+    macro(HTMLSlotElement) \
+    macro(Headers) \
+    macro(IDBCursor) \
+    macro(IDBCursorWithValue) \
+    macro(IDBDatabase) \
+    macro(IDBFactory) \
+    macro(IDBIndex) \
+    macro(IDBKeyRange) \
+    macro(IDBObjectStore) \
+    macro(IDBOpenDBRequest) \
+    macro(IDBRequest) \
+    macro(IDBTransaction) \
+    macro(IDBVersionChangeEvent) \
+    macro(InputEvent) \
+    macro(IntersectionObserver) \
+    macro(IntersectionObserverEntry) \
+    macro(KeyframeEffect) \
+    macro(MediaEncryptedEvent) \
+    macro(MediaKeyMessageEvent) \
+    macro(MediaKeySession) \
+    macro(MediaKeyStatusMap) \
+    macro(MediaKeySystemAccess) \
+    macro(MediaKeys) \
+    macro(MediaSource) \
+    macro(MediaStream) \
+    macro(MediaStreamEvent) \
+    macro(MediaStreamTrack) \
+    macro(ModernMediaControls) \
+    macro(NavigatorCredentials) \
+    macro(NavigatorMediaDevices) \
+    macro(NavigatorUserMedia) \
+    macro(PasswordCredential) \
+    macro(PaymentAddress) \
+    macro(PaymentRequest) \
+    macro(PaymentRequestUpdateEvent) \
+    macro(PaymentResponse) \
+    macro(PerformanceEntry) \
+    macro(PerformanceEntryList) \
+    macro(PerformanceMark) \
+    macro(PerformanceMeasure) \
+    macro(PerformanceObserver) \
+    macro(PerformanceObserverEntryList) \
+    macro(PerformanceResourceTiming) \
+    macro(RTCDTMFSender) \
+    macro(RTCDTMFToneChangeEvent) \
+    macro(RTCDataChannel) \
+    macro(RTCDataChannelEvent) \
+    macro(RTCIceCandidate) \
+    macro(RTCIceTransport) \
+    macro(RTCPeerConnection) \
+    macro(RTCRtpReceiver) \
+    macro(RTCRtpSender) \
+    macro(RTCRtpTransceiver) \
+    macro(RTCSessionDescription) \
+    macro(RTCStatsReport) \
+    macro(RTCTrackEvent) \
+    macro(ReadableByteStreamController) \
+    macro(ReadableStream) \
+    macro(ReadableStreamBYOBReader) \
+    macro(ReadableStreamBYOBRequest) \
+    macro(ReadableStreamDefaultController) \
+    macro(ReadableStreamDefaultReader) \
+    macro(Request) \
+    macro(Response) \
+    macro(ServiceWorker) \
+    macro(ServiceWorkerContainer) \
+    macro(ServiceWorkerGlobalScope) \
+    macro(ServiceWorkerRegistration) \
+    macro(ShadowRoot) \
+    macro(StaticRange) \
+    macro(WebGL2RenderingContext) \
+    macro(WebGLVertexArrayObject) \
+    macro(WebGPUBuffer) \
+    macro(WebGPUCommandBuffer) \
+    macro(WebGPUCommandQueue) \
+    macro(WebGPUComputeCommandEncoder) \
+    macro(WebGPUComputePipelineState) \
+    macro(WebGPUDepthStencilDescriptor) \
+    macro(WebGPUDepthStencilState) \
+    macro(WebGPUDrawable) \
+    macro(WebGPUFunction) \
+    macro(WebGPULibrary) \
+    macro(WebGPURenderCommandEncoder) \
+    macro(WebGPURenderPassAttachmentDescriptor) \
+    macro(WebGPURenderPassColorAttachmentDescriptor) \
+    macro(WebGPURenderPassDepthAttachmentDescriptor) \
+    macro(WebGPURenderPassDescriptor) \
+    macro(WebGPURenderPipelineColorAttachmentDescriptor) \
+    macro(WebGPURenderPipelineDescriptor) \
+    macro(WebGPURenderPipelineState) \
+    macro(WebGPURenderingContext) \
+    macro(WebGPUSize) \
+    macro(WebGPUTexture) \
+    macro(WebGPUTextureDescriptor) \
+    macro(WebKitMediaKeyError) \
+    macro(WebKitMediaKeyMessageEvent) \
+    macro(WebKitMediaKeyNeededEvent) \
+    macro(WebKitMediaKeySession) \
+    macro(WebKitMediaKeys) \
+    macro(WebSocket) \
+    macro(WritableStream) \
+    macro(XMLHttpRequest) \
     macro(addTrack) \
     macro(appendFromJS) \
     macro(associatedReadableByteStreamController) \
     macro(autoAllocateChunkSize) \
     macro(backingMap) \
+    macro(blur) \
     macro(body) \
     macro(byobRequest) \
+    macro(caches) \
     macro(cancel) \
     macro(cloneArrayBuffer) \
     macro(cloneForJS) \
+    macro(close) \
     macro(closeRequested) \
+    macro(closed) \
     macro(closedPromiseCapability) \
+    macro(collectMatchingElementsInFlatTree) \
     macro(consume) \
     macro(consumeChunk) \
     macro(controlledReadableStream) \
     macro(controller) \
     macro(createReadableStream) \
+    macro(customElements) \
     macro(disturbed) \
+    macro(document) \
     macro(failureKind) \
+    macro(fetch) \
     macro(fetchRequest) \
     macro(fillFromJS) \
     macro(finishConsumingStream) \
-    macro(getUserMedia) \
+    macro(focus) \
+    macro(frames) \
     macro(getRemoteStreams) \
     macro(getSenders) \
     macro(getTracks) \
+    macro(getUserMedia) \
+    macro(header) \
+    macro(indexedDB) \
     macro(initializeWith) \
     macro(isDisturbed) \
     macro(isLoading) \
+    macro(isSecureContext) \
     macro(localStreams) \
+    macro(location) \
+    macro(makeGetterTypeError) \
     macro(makeThisTypeError) \
-    macro(makeGetterTypeError) \
+    macro(matchingElementInFlatTree) \
     macro(mediaStreamTrackConstraints) \
+    macro(opener) \
     macro(operations) \
     macro(ownerReadableStream) \
+    macro(parent) \
     macro(pendingPullIntos) \
+    macro(postMessage) \
     macro(privateGetStats) \
     macro(pull) \
+    macro(pullAgain) \
     macro(pulling) \
-    macro(pullAgain) \
     macro(queue) \
     macro(queuedAddIceCandidate) \
     macro(queuedCreateAnswer) \
@@ -77,24 +220,26 @@
     macro(queuedCreateOffer) \
     macro(queuedSetLocalDescription) \
     macro(queuedSetRemoteDescription) \
-    macro(reader) \
     macro(readIntoRequests) \
     macro(readRequests) \
     macro(readableByteStreamAPIEnabled) \
     macro(readableStreamController) \
+    macro(reader) \
     macro(readyPromiseCapability) \
     macro(removeTrack) \
+    macro(response) \
     macro(responseCacheIsValid) \
     macro(retrieveResponse) \
-    macro(response) \
+    macro(self) \
     macro(setBody) \
     macro(setBodyAsReadableStream) \
     macro(setBodyFromInputRequest) \
     macro(setStatus) \
-    macro(state) \
+    macro(showModalDialog) \
     macro(startConsumingStream) \
     macro(started) \
     macro(startedPromise) \
+    macro(state) \
     macro(storedError) \
     macro(strategy) \
     macro(strategyHWM) \
@@ -106,6 +251,7 @@
     macro(streamWritable) \
     macro(structuredCloneArrayBuffer) \
     macro(structuredCloneArrayBufferView) \
+    macro(top) \
     macro(totalQueuedBytes) \
     macro(underlyingByteSource) \
     macro(underlyingSink) \
@@ -112,21 +258,19 @@
     macro(underlyingSource) \
     macro(view) \
     macro(webRTCLegacyAPIEnabled) \
-    macro(writing) \
-    macro(Headers) \
-    macro(MediaStream) \
-    macro(MediaStreamTrack) \
-    macro(ReadableByteStreamController) \
-    macro(ReadableStream) \
-    macro(ReadableStreamBYOBReader) \
-    macro(ReadableStreamBYOBRequest) \
-    macro(ReadableStreamDefaultController) \
-    macro(ReadableStreamDefaultReader) \
-    macro(Request) \
-    macro(Response) \
-    macro(RTCIceCandidate) \
-    macro(RTCSessionDescription) \
-    macro(XMLHttpRequest)
+    macro(webkit) \
+    macro(webkitAudioContext) \
+    macro(webkitIDBCursor) \
+    macro(webkitIDBDatabase) \
+    macro(webkitIDBFactory) \
+    macro(webkitIDBIndex) \
+    macro(webkitIDBKeyRange) \
+    macro(webkitIDBObjectStore) \
+    macro(webkitIDBRequest) \
+    macro(webkitIDBTransaction) \
+    macro(webkitIndexedDB) \
+    macro(window) \
+    macro(writing)
 
 class WebCoreBuiltinNames {
 public:

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (221584 => 221585)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-09-04 10:50:58 UTC (rev 221585)
@@ -1695,6 +1695,7 @@
 
     return $context->extendedAttributes->{EnabledAtRuntime}
         || $context->extendedAttributes->{EnabledForWorld}
+        || $context->extendedAttributes->{EnabledBySetting}
         || $context->extendedAttributes->{SecureContext};
 }
 
@@ -1705,11 +1706,11 @@
 
     return 1 if IsGlobalOrPrimaryGlobalInterface($interface);
 
-    # FIXME: The bindings generator does not support putting runtime-enabled operations on the instance yet (except for global objects).
-    return 0 if NeedsRuntimeCheck($interface, $operation);
-
     # [Unforgeable] operations should be on the instance. https://heycam.github.io/webidl/#Unforgeable
-    return 1 if IsUnforgeable($interface, $operation);
+    if (IsUnforgeable($interface, $operation)) {
+        assert("The bindings generator does not support putting runtime-enabled operations on the instance yet (except for global objects):[" . $interface->type->name . "::" . $operation->name . "]") if NeedsRuntimeCheck($interface, $operation);
+        return 1;
+    }
 
     return 0;
 }
@@ -2990,7 +2991,7 @@
 
 sub GeneratePropertiesHashTable
 {
-    my ($object, $interface, $isInstance, $hashKeys, $hashSpecials, $hashValue1, $hashValue2, $conditionals, $readWriteConditionals, $runtimeEnabledOperations, $runtimeEnabledAttributes, $settingsEnabledOperations, $settingsEnabledAttributes) = @_;
+    my ($object, $interface, $isInstance, $hashKeys, $hashSpecials, $hashValue1, $hashValue2, $conditionals, $readWriteConditionals, $runtimeEnabledOperations, $runtimeEnabledAttributes) = @_;
 
     # FIXME: These should be functions on $interface.
     my $interfaceName = $interface->type->name;
@@ -3053,10 +3054,6 @@
         if (NeedsRuntimeCheck($interface, $attribute)) {
             push(@$runtimeEnabledAttributes, $attribute);
         }
-
-        if ($attribute->extendedAttributes->{EnabledBySetting}) {
-            push(@$settingsEnabledAttributes, $attribute);
-        }
     }
 
     my @operations = @{$interface->operations};
@@ -3098,10 +3095,6 @@
         if (NeedsRuntimeCheck($interface, $operation)) {
             push(@$runtimeEnabledOperations, $operation);
         }
-
-        if ($operation->extendedAttributes->{EnabledBySetting}) {
-            push(@$settingsEnabledOperations, $operation);
-        }
     }
 
     return $propertyCount;
@@ -3660,6 +3653,20 @@
         push(@conjuncts, "worldForDOMObject(this)." . ToMethodName($context->extendedAttributes->{EnabledForWorld}) . "()");
     }
 
+    if ($context->extendedAttributes->{EnabledBySetting}) {
+        assert("Must specify value for EnabledBySetting.") if $context->extendedAttributes->{EnabledBySetting} eq "VALUE_IS_MISSING";
+
+        AddToImplIncludes("Document.h");
+        AddToImplIncludes("Settings.h");
+
+        assert("EnabledBySetting can only be used by interfaces only exposed to the Window") if $interface->extendedAttributes->{Exposed} && $interface->extendedAttributes->{Exposed} ne "Window";
+
+        my @flags = split(/&/, $context->extendedAttributes->{EnabledBySetting});
+        foreach my $flag (@flags) {
+            push(@conjuncts, "downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings()." . ToMethodName($flag) . "Enabled()");
+        }
+    }
+
     if ($context->extendedAttributes->{EnabledAtRuntime}) {
         assert("Must specify value for EnabledAtRuntime.") if $context->extendedAttributes->{EnabledAtRuntime} eq "VALUE_IS_MISSING";
 
@@ -3950,11 +3957,9 @@
     my $hashName = $className . "Table";
     my @runtimeEnabledOperations = ();
     my @runtimeEnabledAttributes = ();
-    my @settingsEnabledOperations = ();
-    my @settingsEnabledAttributes = ();
 
     # Generate hash table for properties on the instance.
-    my $numInstanceProperties = GeneratePropertiesHashTable($object, $interface, 1, \@hashKeys, \@hashSpecials, \@hashValue1, \@hashValue2, \%conditionals, \%readWriteConditionals, \@runtimeEnabledOperations, \@runtimeEnabledAttributes, \@settingsEnabledOperations, \@settingsEnabledAttributes);
+    my $numInstanceProperties = GeneratePropertiesHashTable($object, $interface, 1, \@hashKeys, \@hashSpecials, \@hashValue1, \@hashValue2, \%conditionals, \%readWriteConditionals, \@runtimeEnabledOperations, \@runtimeEnabledAttributes);
     $object->GenerateHashTable($className, $hashName, $numInstanceProperties, \@hashKeys, \@hashSpecials, \@hashValue1, \@hashValue2, \%conditionals, \%readWriteConditionals, 0) if $numInstanceProperties > 0;
 
     # - Add all interface object (aka constructor) properties (constants, static attributes, static operations).
@@ -4070,8 +4075,6 @@
     %readWriteConditionals = ();
     @runtimeEnabledOperations = ();
     @runtimeEnabledAttributes = ();
-    @settingsEnabledOperations = ();
-    @settingsEnabledAttributes = ();
 
     # Generate hash table for properties on the prototype.
     my $numPrototypeProperties = GeneratePropertiesHashTable($object, $interface, 0,
@@ -4078,8 +4081,7 @@
         \@hashKeys, \@hashSpecials,
         \@hashValue1, \@hashValue2,
         \%conditionals, \%readWriteConditionals,
-        \@runtimeEnabledOperations, \@runtimeEnabledAttributes,
-        \@settingsEnabledOperations, \@settingsEnabledAttributes);
+        \@runtimeEnabledOperations, \@runtimeEnabledAttributes);
 
     my $hashSize = $numPrototypeProperties;
 
@@ -4128,31 +4130,6 @@
             push(@implContent, "#endif\n") if $conditionalString;
         }
 
-        my @settingsEnabledProperties = @settingsEnabledOperations;
-        push(@settingsEnabledProperties, @settingsEnabledAttributes);
-        if (scalar(@settingsEnabledProperties)) {
-            AddToImplIncludes("Document.h");
-            AddToImplIncludes("Settings.h");
-            push(@implContent, "    auto* context = jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext();\n");
-            push(@implContent, "    ASSERT(!context || context->isDocument());\n");
-            
-            foreach my $operationOrAttribute (@settingsEnabledProperties) {
-                my $conditionalString = $codeGenerator->GenerateConditionalString($operationOrAttribute);
-                push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-
-                my $enableFunction = ToMethodName($operationOrAttribute->extendedAttributes->{EnabledBySetting}) . "Enabled";
-                my $name = $operationOrAttribute->name;
-
-                push(@implContent, "    if (!context || !downcast<Document>(*context).settings().${enableFunction}()) {\n");
-                push(@implContent, "        auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
-                push(@implContent, "        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n");
-                push(@implContent, "        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);\n");
-                push(@implContent, "    }\n");
-
-                push(@implContent, "#endif\n") if $conditionalString;
-            }
-        }
-
         foreach my $operation (@{$interface->operations}) {
             next unless ($operation->extendedAttributes->{PrivateIdentifier});
             AddToImplIncludes("WebCoreJSClientData.h");
@@ -4251,17 +4228,17 @@
         next unless NeedsRuntimeCheck($interface, $attribute);
         next unless AttributeShouldBeOnInstance($interface, $attribute);
 
-        my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
-        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
+        AddToImplIncludes("WebCoreJSClientData.h");
         my $runtimeEnableConditionalString = GenerateRuntimeEnableConditionalString($interface, $attribute);
         my $attributeName = $attribute->name;
-        push(@implContent, "    if (${runtimeEnableConditionalString}) {\n");
         my $getter = GetAttributeGetterName($interface, $className, $attribute);
         my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interface, $className, $attribute);
-        push(@implContent, "        auto* customGetterSetter = CustomGetterSetter::create(vm, $getter, $setter);\n");
         my $jscAttributes = GetJSCAttributesForAttribute($interface, $attribute);
-        push(@implContent, "        putDirectCustomAccessor(vm, vm.propertyNames->$attributeName, customGetterSetter, attributesForStructure($jscAttributes));\n");
-        push(@implContent, "    }\n");
+
+        my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
+        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
+        push(@implContent, "    if (${runtimeEnableConditionalString})\n");
+        push(@implContent, "        putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $attributeName . "PublicName(), CustomGetterSetter::create(vm, $getter, $setter), attributesForStructure($jscAttributes));\n");
         push(@implContent, "#endif\n") if $conditionalString;
     }
 
@@ -4286,17 +4263,17 @@
         next unless OperationShouldBeOnInstance($interface, $operation);
         next if $operation->{overloadIndex} && $operation->{overloadIndex} > 1;
 
-        my $conditionalString = $codeGenerator->GenerateConditionalString($operation);
-        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
+        AddToImplIncludes("WebCoreJSClientData.h");
         my $runtimeEnableConditionalString = GenerateRuntimeEnableConditionalString($interface, $operation);
         my $functionName = $operation->name;
         my $implementationFunction = GetFunctionName($interface, $className, $operation);
         my $functionLength = GetFunctionLength($operation);
         my $jsAttributes = ComputeFunctionSpecial($interface, $operation);
+
+        my $conditionalString = $codeGenerator->GenerateConditionalString($operation);
+        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
         push(@implContent, "    if (${runtimeEnableConditionalString})\n");
-
-        my $propertyName = "vm.propertyNames->$functionName";
-        $propertyName = "static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $functionName . "PrivateName()" if $operation->extendedAttributes->{PrivateIdentifier};
+        my $propertyName = "static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $functionName . ($operation->extendedAttributes->{PrivateIdentifier} ? "PrivateName()" : "PublicName()");
         if (IsJSBuiltin($interface, $operation)) {
             push(@implContent, "        putDirectBuiltinFunction(vm, this, $propertyName, $implementationFunction(vm), attributesForStructure($jsAttributes));\n");
         } else {
@@ -4690,24 +4667,7 @@
     push(@$outputArray, "{\n");
     push(@$outputArray, "    UNUSED_PARAM(throwScope);\n");
     push(@$outputArray, "    UNUSED_PARAM(state);\n");
-    
-    # Global constructors can be disabled at runtime.
-    # FIXME: Returning undefined is not the same as diasabling. These properties should be removed
-    # from the object instead.
-    if ($codeGenerator->IsConstructorType($attribute->type)) {
-        if ($attribute->extendedAttributes->{EnabledBySetting}) {
-            AddToImplIncludes("Frame.h", $conditional);
-            AddToImplIncludes("Settings.h", $conditional);
-            
-            my $enableFunction = ToMethodName($attribute->extendedAttributes->{EnabledBySetting}) . "Enabled";
-            push(@$outputArray, "    if (UNLIKELY(!thisObject.wrapped().frame()))\n");
-            push(@$outputArray, "        return jsUndefined();\n");
-            push(@$outputArray, "    Settings& settings = thisObject.wrapped().frame()->settings();\n");
-            push(@$outputArray, "    if (!settings.$enableFunction())\n");
-            push(@$outputArray, "        return jsUndefined();\n");
-        }
-    }
-    
+
     if ($interface->extendedAttributes->{CheckSecurity} &&
         !$attribute->extendedAttributes->{DoNotCheckSecurity} &&
         !$attribute->extendedAttributes->{DoNotCheckSecurityOnGetter}) {

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp (0 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp	2017-09-04 10:50:58 UTC (rev 221585)
@@ -0,0 +1,355 @@
+/*
+    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 "JSTestEnabledBySetting.h"
+
+#include "Document.h"
+#include "JSDOMAttribute.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConstructorNotConstructable.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMOperation.h"
+#include "JSDOMWrapperCache.h"
+#include "JSTestSubObj.h"
+#include "Settings.h"
+#include "WebCoreJSClientData.h"
+#include <runtime/FunctionPrototype.h>
+#include <runtime/JSCInlines.h>
+#include <wtf/GetPtr.h>
+
+#if ENABLE(TEST_FEATURE)
+#include "JSDOMConvertStrings.h"
+#endif
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Functions
+
+#if ENABLE(TEST_FEATURE)
+JSC::EncodedJSValue JSC_HOST_CALL jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperation(JSC::ExecState*);
+#endif
+
+// Attributes
+
+JSC::EncodedJSValue jsTestEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestEnabledBySettingTestSubObjEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+#if ENABLE(TEST_FEATURE)
+JSC::EncodedJSValue jsTestEnabledBySettingEnabledBySettingAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestEnabledBySettingEnabledBySettingAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+#endif
+
+class JSTestEnabledBySettingPrototype : public JSC::JSNonFinalObject {
+public:
+    using Base = JSC::JSNonFinalObject;
+    static JSTestEnabledBySettingPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestEnabledBySettingPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestEnabledBySettingPrototype>(vm.heap)) JSTestEnabledBySettingPrototype(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:
+    JSTestEnabledBySettingPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+
+using JSTestEnabledBySettingConstructor = JSDOMConstructorNotConstructable<JSTestEnabledBySetting>;
+
+template<> JSValue JSTestEnabledBySettingConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestEnabledBySettingConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestEnabledBySetting::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestEnabledBySetting"))), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestEnabledBySettingConstructor::s_info = { "TestEnabledBySetting", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestEnabledBySettingConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestEnabledBySettingPrototypeTableValues[] =
+{
+    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestEnabledBySettingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestEnabledBySettingConstructor) } },
+#if ENABLE(TEST_FEATURE)
+    { "enabledBySettingAttribute", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestEnabledBySettingEnabledBySettingAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestEnabledBySettingEnabledBySettingAttribute) } },
+#else
+    { 0, 0, NoIntrinsic, { 0, 0 } },
+#endif
+#if ENABLE(TEST_FEATURE)
+    { "enabledBySettingOperation", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperation), (intptr_t) (1) } },
+#else
+    { 0, 0, NoIntrinsic, { 0, 0 } },
+#endif
+};
+
+const ClassInfo JSTestEnabledBySettingPrototype::s_info = { "TestEnabledBySettingPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestEnabledBySettingPrototype) };
+
+void JSTestEnabledBySettingPrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestEnabledBySetting::info(), JSTestEnabledBySettingPrototypeTableValues, *this);
+#if ENABLE(TEST_FEATURE)
+    if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().testSettingEnabled()) {
+        auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingOperation"), strlen("enabledBySettingOperation"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+#endif
+#if ENABLE(TEST_FEATURE)
+    if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().testSettingEnabled()) {
+        auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingAttribute"), strlen("enabledBySettingAttribute"));
+        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
+        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
+    }
+#endif
+}
+
+const ClassInfo JSTestEnabledBySetting::s_info = { "TestEnabledBySetting", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestEnabledBySetting) };
+
+JSTestEnabledBySetting::JSTestEnabledBySetting(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestEnabledBySetting>&& impl)
+    : JSDOMWrapper<TestEnabledBySetting>(structure, globalObject, WTFMove(impl))
+{
+}
+
+void JSTestEnabledBySetting::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(vm, info()));
+
+    if (downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().testSettingEnabled())
+        putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().TestSubObjEnabledBySettingPublicName(), CustomGetterSetter::create(vm, jsTestEnabledBySettingTestSubObjEnabledBySettingConstructor, setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructor), attributesForStructure(DontEnum));
+}
+
+JSObject* JSTestEnabledBySetting::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return JSTestEnabledBySettingPrototype::create(vm, &globalObject, JSTestEnabledBySettingPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
+}
+
+JSObject* JSTestEnabledBySetting::prototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return getDOMPrototype<JSTestEnabledBySetting>(vm, globalObject);
+}
+
+JSValue JSTestEnabledBySetting::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestEnabledBySettingConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSTestEnabledBySetting::destroy(JSC::JSCell* cell)
+{
+    JSTestEnabledBySetting* thisObject = static_cast<JSTestEnabledBySetting*>(cell);
+    thisObject->JSTestEnabledBySetting::~JSTestEnabledBySetting();
+}
+
+template<> inline JSTestEnabledBySetting* IDLAttribute<JSTestEnabledBySetting>::cast(ExecState& state, EncodedJSValue thisValue)
+{
+    return jsDynamicDowncast<JSTestEnabledBySetting*>(state.vm(), JSValue::decode(thisValue));
+}
+
+template<> inline JSTestEnabledBySetting* IDLOperation<JSTestEnabledBySetting>::cast(ExecState& state)
+{
+    return jsDynamicDowncast<JSTestEnabledBySetting*>(state.vm(), state.thisValue());
+}
+
+EncodedJSValue jsTestEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicDowncast<JSTestEnabledBySettingPrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype))
+        return throwVMTypeError(state, throwScope);
+    return JSValue::encode(JSTestEnabledBySetting::getConstructor(state->vm(), prototype->globalObject()));
+}
+
+bool setJSTestEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicDowncast<JSTestEnabledBySettingPrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype)) {
+        throwVMTypeError(state, throwScope);
+        return false;
+    }
+    // Shadowing a built-in constructor
+    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
+}
+
+static inline JSValue jsTestEnabledBySettingTestSubObjEnabledBySettingConstructorGetter(ExecState& state, JSTestEnabledBySetting& thisObject, ThrowScope& throwScope)
+{
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(state);
+    return JSTestSubObj::getConstructor(state.vm(), thisObject.globalObject());
+}
+
+EncodedJSValue jsTestEnabledBySettingTestSubObjEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    return IDLAttribute<JSTestEnabledBySetting>::get<jsTestEnabledBySettingTestSubObjEnabledBySettingConstructorGetter>(*state, thisValue, "TestSubObjEnabledBySetting");
+}
+
+static inline bool setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructorSetter(ExecState& state, JSTestEnabledBySetting& thisObject, JSValue value, ThrowScope& throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    // Shadowing a built-in constructor.
+    return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("TestSubObjEnabledBySetting"), strlen("TestSubObjEnabledBySetting")), value);
+}
+
+bool setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    return IDLAttribute<JSTestEnabledBySetting>::set<setJSTestEnabledBySettingTestSubObjEnabledBySettingConstructorSetter>(*state, thisValue, encodedValue, "TestSubObjEnabledBySetting");
+}
+
+#if ENABLE(TEST_FEATURE)
+static inline JSValue jsTestEnabledBySettingEnabledBySettingAttributeGetter(ExecState& state, JSTestEnabledBySetting& thisObject, ThrowScope& throwScope)
+{
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(state);
+    auto& impl = thisObject.wrapped();
+    JSValue result = toJS<IDLDOMString>(state, impl.enabledBySettingAttribute());
+    return result;
+}
+
+EncodedJSValue jsTestEnabledBySettingEnabledBySettingAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    return IDLAttribute<JSTestEnabledBySetting>::get<jsTestEnabledBySettingEnabledBySettingAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "enabledBySettingAttribute");
+}
+
+#endif
+
+#if ENABLE(TEST_FEATURE)
+static inline bool setJSTestEnabledBySettingEnabledBySettingAttributeSetter(ExecState& state, JSTestEnabledBySetting& thisObject, JSValue value, ThrowScope& throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(state, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    impl.setEnabledBySettingAttribute(WTFMove(nativeValue));
+    return true;
+}
+
+bool setJSTestEnabledBySettingEnabledBySettingAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    return IDLAttribute<JSTestEnabledBySetting>::set<setJSTestEnabledBySettingEnabledBySettingAttributeSetter>(*state, thisValue, encodedValue, "enabledBySettingAttribute");
+}
+
+#endif
+
+#if ENABLE(TEST_FEATURE)
+static inline JSC::EncodedJSValue jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperationBody(JSC::ExecState* state, typename IDLOperation<JSTestEnabledBySetting>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    auto& impl = castedThis->wrapped();
+    if (UNLIKELY(state->argumentCount() < 1))
+        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+    auto testParam = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.enabledBySettingOperation(WTFMove(testParam));
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperation(ExecState* state)
+{
+    return IDLOperation<JSTestEnabledBySetting>::call<jsTestEnabledBySettingPrototypeFunctionEnabledBySettingOperationBody>(*state, "enabledBySettingOperation");
+}
+
+#endif
+
+bool JSTestEnabledBySettingOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    return false;
+}
+
+void JSTestEnabledBySettingOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestEnabledBySetting = static_cast<JSTestEnabledBySetting*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestEnabledBySetting->wrapped(), jsTestEnabledBySetting);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestEnabledBySetting@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore20TestEnabledBySettingE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestEnabledBySetting>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestEnabledBySetting@WebCore@@6B@"));
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore20TestEnabledBySettingE[2];
+#endif
+
+    // If this fails TestEnabledBySetting does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(std::is_polymorphic<TestEnabledBySetting>::value, "TestEnabledBySetting is not polymorphic");
+
+    // If you hit this assertion you either have a use after free bug, or
+    // TestEnabledBySetting has subclasses. If TestEnabledBySetting has subclasses that get passed
+    // to toJS() we currently require TestEnabledBySetting you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    return createWrapper<TestEnabledBySetting>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEnabledBySetting& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
+TestEnabledBySetting* JSTestEnabledBySetting::toWrapped(JSC::VM& vm, JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicDowncast<JSTestEnabledBySetting*>(vm, value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.h (0 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.h	2017-09-04 10:50:58 UTC (rev 221585)
@@ -0,0 +1,87 @@
+/*
+    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 "TestEnabledBySetting.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestEnabledBySetting : public JSDOMWrapper<TestEnabledBySetting> {
+public:
+    using Base = JSDOMWrapper<TestEnabledBySetting>;
+    static JSTestEnabledBySetting* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestEnabledBySetting>&& impl)
+    {
+        JSTestEnabledBySetting* ptr = new (NotNull, JSC::allocateCell<JSTestEnabledBySetting>(globalObject->vm().heap)) JSTestEnabledBySetting(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
+    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
+    static TestEnabledBySetting* toWrapped(JSC::VM&, 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*);
+public:
+    static const unsigned StructureFlags = JSC::HasStaticPropertyTable | Base::StructureFlags;
+protected:
+    JSTestEnabledBySetting(JSC::Structure*, JSDOMGlobalObject&, Ref<TestEnabledBySetting>&&);
+
+    void finishCreation(JSC::VM&);
+};
+
+class JSTestEnabledBySettingOwner : 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&, TestEnabledBySetting*)
+{
+    static NeverDestroyed<JSTestEnabledBySettingOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(TestEnabledBySetting* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEnabledBySetting&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEnabledBySetting* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestEnabledBySetting>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestEnabledBySetting>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+template<> struct JSDOMWrapperConverterTraits<TestEnabledBySetting> {
+    using WrapperClass = JSTestEnabledBySetting;
+    using ToWrappedReturnType = TestEnabledBySetting*;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (221584 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2017-09-04 10:50:58 UTC (rev 221585)
@@ -163,10 +163,8 @@
     ASSERT(inherits(vm, info()));
 
 #if ENABLE(TEST_FEATURE)
-    if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
-        auto* customGetterSetter = CustomGetterSetter::create(vm, jsTestGlobalObjectEnabledAtRuntimeAttribute, setJSTestGlobalObjectEnabledAtRuntimeAttribute);
-        putDirectCustomAccessor(vm, vm.propertyNames->enabledAtRuntimeAttribute, customGetterSetter, attributesForStructure(CustomAccessor));
-    }
+    if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
+        putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledAtRuntimeAttributePublicName(), CustomGetterSetter::create(vm, jsTestGlobalObjectEnabledAtRuntimeAttribute, setJSTestGlobalObjectEnabledAtRuntimeAttribute), attributesForStructure(CustomAccessor));
 #endif
     putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().publicAndPrivateAttributePrivateName(), CustomGetterSetter::create(vm, jsTestGlobalObjectPublicAndPrivateAttribute, nullptr), attributesForStructure(DontDelete | ReadOnly));
 #if ENABLE(TEST_FEATURE)
@@ -174,14 +172,14 @@
 #endif
 #if ENABLE(TEST_FEATURE)
     if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
-        putDirectNativeFunction(vm, this, vm.propertyNames->enabledAtRuntimeOperation, 1, jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledAtRuntimeOperationPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation, NoIntrinsic, attributesForStructure(JSC::Function));
 #endif
     if (worldForDOMObject(this).specificWorld())
-        putDirectNativeFunction(vm, this, vm.propertyNames->enabledInSpecificWorld, 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledInSpecificWorldPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld, NoIntrinsic, attributesForStructure(JSC::Function));
     if ((worldForDOMObject(this).specificWorld() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()))
-        putDirectNativeFunction(vm, this, vm.propertyNames->enabledInSpecificWorldWhenRuntimeFeatureEnabled, 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledInSpecificWorldWhenRuntimeFeatureEnabledPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled, NoIntrinsic, attributesForStructure(JSC::Function));
     if ((worldForDOMObject(this).specificWorld() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled() && RuntimeEnabledFeatures::sharedFeatures().testFeature1Enabled()))
-        putDirectNativeFunction(vm, this, vm.propertyNames->enabledInSpecificWorldWhenRuntimeFeaturesEnabled, 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledInSpecificWorldWhenRuntimeFeaturesEnabledPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled, NoIntrinsic, attributesForStructure(JSC::Function));
 #if ENABLE(TEST_FEATURE)
     if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
         putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().testPrivateFunctionPrivateName(), 0, jsTestGlobalObjectInstanceFunctionTestPrivateFunction, NoIntrinsic, attributesForStructure(JSC::Function));
@@ -188,15 +186,15 @@
 #endif
 #if ENABLE(TEST_FEATURE)
     if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())
-        putDirectBuiltinFunction(vm, this, vm.propertyNames->testJSBuiltinFunction, testGlobalObjectTestJSBuiltinFunctionCodeGenerator(vm), attributesForStructure(JSC::Builtin));
+        putDirectBuiltinFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().testJSBuiltinFunctionPublicName(), testGlobalObjectTestJSBuiltinFunctionCodeGenerator(vm), attributesForStructure(JSC::Builtin));
 #endif
     if (jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext())
-        putDirectNativeFunction(vm, this, vm.propertyNames->calculateSecretResult, 0, jsTestGlobalObjectInstanceFunctionCalculateSecretResult, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().calculateSecretResultPublicName(), 0, jsTestGlobalObjectInstanceFunctionCalculateSecretResult, NoIntrinsic, attributesForStructure(JSC::Function));
     if (jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext())
-        putDirectNativeFunction(vm, this, vm.propertyNames->getSecretBoolean, 0, jsTestGlobalObjectInstanceFunctionGetSecretBoolean, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().getSecretBooleanPublicName(), 0, jsTestGlobalObjectInstanceFunctionGetSecretBoolean, NoIntrinsic, attributesForStructure(JSC::Function));
 #if ENABLE(TEST_FEATURE)
     if ((jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()))
-        putDirectNativeFunction(vm, this, vm.propertyNames->testFeatureGetSecretBoolean, 0, jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean, NoIntrinsic, attributesForStructure(JSC::Function));
+        putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().testFeatureGetSecretBooleanPublicName(), 0, jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean, NoIntrinsic, attributesForStructure(JSC::Function));
 #endif
 }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (221584 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-09-04 10:50:58 UTC (rev 221585)
@@ -26,7 +26,6 @@
 #include "DOMWrapperWorld.h"
 #include "Document.h"
 #include "EventNames.h"
-#include "Frame.h"
 #include "HTMLNames.h"
 #include "JSBlob.h"
 #include "JSDOMAttribute.h"
@@ -79,7 +78,6 @@
 #include "RuntimeEnabledFeatures.h"
 #include "ScriptExecutionContext.h"
 #include "SerializedScriptValue.h"
-#include "Settings.h"
 #include "URL.h"
 #include "WebCoreJSClientData.h"
 #include <builtins/BuiltinNames.h>
@@ -997,9 +995,6 @@
 #endif
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWorldSpecificMethod(JSC::ExecState*);
-#if ENABLE(TEST_FEATURE)
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledBySettingOperation(JSC::ExecState*);
-#endif
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCalculateSecretResult(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSecretBoolean(JSC::ExecState*);
 #if ENABLE(TEST_FEATURE)
@@ -1176,8 +1171,6 @@
 JSC::EncodedJSValue jsTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjConstructorTestSubObj(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-JSC::EncodedJSValue jsTestObjTestSubObjEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjTestSubObjEnabledBySettingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjByteAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -1265,10 +1258,6 @@
 JSC::EncodedJSValue jsTestObjEnabledAtRuntimeAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjEnabledAtRuntimeAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 #endif
-#if ENABLE(TEST_FEATURE)
-JSC::EncodedJSValue jsTestObjEnabledBySettingAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjEnabledBySettingAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
-#endif
 JSC::EncodedJSValue jsTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 bool setJSTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 JSC::EncodedJSValue jsTestObjAttributeWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -1413,30 +1402,28 @@
 
 /* Hash table */
 
-static const struct CompactHashIndex JSTestObjTableIndex[17] = {
+static const struct CompactHashIndex JSTestObjTableIndex[16] = {
     { -1, -1 },
     { -1, -1 },
-    { 5, -1 },
+    { 4, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 4, -1 },
+    { 3, -1 },
     { -1, -1 },
+    { 0, -1 },
     { 1, -1 },
     { 2, -1 },
-    { 0, 16 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 3, -1 },
 };
 
 
 static const HashTableValue JSTestObjTableValues[] =
 {
-    { "TestSubObjEnabledBySetting", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestSubObjEnabledBySettingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTestSubObjEnabledBySettingConstructor) } },
     { "unforgeableAttr", DontDelete | ReadOnly | CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnforgeableAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
 #if ENABLE(Condition1)
     { "conditionalAttr4", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionalAttr4Constructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConditionalAttr4Constructor) } },
@@ -1456,7 +1443,7 @@
     { "unforgeableMethod", DontDelete | ReadOnly | JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjInstanceFunctionUnforgeableMethod), (intptr_t) (0) } },
 };
 
-static const HashTable JSTestObjTable = { 6, 15, true, JSTestObj::info(), JSTestObjTableValues, JSTestObjTableIndex };
+static const HashTable JSTestObjTable = { 5, 15, true, JSTestObj::info(), JSTestObjTableValues, JSTestObjTableIndex };
 /* Hash table for constructor */
 
 static const HashTableValue JSTestObjConstructorTableValues[] =
@@ -1605,11 +1592,6 @@
 #else
     { 0, 0, NoIntrinsic, { 0, 0 } },
 #endif
-#if ENABLE(TEST_FEATURE)
-    { "enabledBySettingAttribute", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjEnabledBySettingAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjEnabledBySettingAttribute) } },
-#else
-    { 0, 0, NoIntrinsic, { 0, 0 } },
-#endif
     { "typedArrayAttr", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTypedArrayAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTypedArrayAttr) } },
     { "attributeWithGetterException", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithGetterException) } },
     { "attributeWithSetterException", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithSetterException) } },
@@ -1702,11 +1684,6 @@
 #endif
     { "enabledInSpecificWorldWhenRuntimeFeatureEnabled", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled), (intptr_t) (1) } },
     { "worldSpecificMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWorldSpecificMethod), (intptr_t) (1) } },
-#if ENABLE(TEST_FEATURE)
-    { "enabledBySettingOperation", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionEnabledBySettingOperation), (intptr_t) (1) } },
-#else
-    { 0, 0, NoIntrinsic, { 0, 0 } },
-#endif
     { "calculateSecretResult", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCalculateSecretResult), (intptr_t) (0) } },
     { "getSecretBoolean", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSecretBoolean), (intptr_t) (0) } },
 #if ENABLE(TEST_FEATURE)
@@ -1963,22 +1940,6 @@
         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
         JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
     }
-    auto* context = jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext();
-    ASSERT(!context || context->isDocument());
-#if ENABLE(TEST_FEATURE)
-    if (!context || !downcast<Document>(*context).settings().testSettingEnabled()) {
-        auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingOperation"), strlen("enabledBySettingOperation"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
-#endif
-#if ENABLE(TEST_FEATURE)
-    if (!context || !downcast<Document>(*context).settings().testSettingEnabled()) {
-        auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingAttribute"), strlen("enabledBySettingAttribute"));
-        VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
-        JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
-    }
-#endif
     putDirect(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
     putDirect(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
     putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayPrototype()->getDirect(vm, vm.propertyNames->builtinNames().valuesPrivateName()), DontEnum);
@@ -2252,36 +2213,6 @@
     return IDLAttribute<JSTestObj>::getStatic<jsTestObjConstructorTestSubObjGetter>(*state, thisValue, "TestSubObj");
 }
 
-static inline JSValue jsTestObjTestSubObjEnabledBySettingConstructorGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
-{
-    UNUSED_PARAM(throwScope);
-    UNUSED_PARAM(state);
-    if (UNLIKELY(!thisObject.wrapped().frame()))
-        return jsUndefined();
-    Settings& settings = thisObject.wrapped().frame()->settings();
-    if (!settings.testSettingEnabled())
-        return jsUndefined();
-    return JSTestSubObj::getConstructor(state.vm(), thisObject.globalObject());
-}
-
-EncodedJSValue jsTestObjTestSubObjEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    return IDLAttribute<JSTestObj>::get<jsTestObjTestSubObjEnabledBySettingConstructorGetter>(*state, thisValue, "TestSubObjEnabledBySetting");
-}
-
-static inline bool setJSTestObjTestSubObjEnabledBySettingConstructorSetter(ExecState& state, JSTestObj& thisObject, JSValue value, ThrowScope& throwScope)
-{
-    UNUSED_PARAM(state);
-    UNUSED_PARAM(throwScope);
-    // Shadowing a built-in constructor.
-    return thisObject.putDirect(state.vm(), Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("TestSubObjEnabledBySetting"), strlen("TestSubObjEnabledBySetting")), value);
-}
-
-bool setJSTestObjTestSubObjEnabledBySettingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
-    return IDLAttribute<JSTestObj>::set<setJSTestObjTestSubObjEnabledBySettingConstructorSetter>(*state, thisValue, encodedValue, "TestSubObjEnabledBySetting");
-}
-
 static inline JSValue jsTestObjEnumAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
 {
     UNUSED_PARAM(throwScope);
@@ -3568,42 +3499,6 @@
 
 #endif
 
-#if ENABLE(TEST_FEATURE)
-static inline JSValue jsTestObjEnabledBySettingAttributeGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
-{
-    UNUSED_PARAM(throwScope);
-    UNUSED_PARAM(state);
-    auto& impl = thisObject.wrapped();
-    JSValue result = toJS<IDLDOMString>(state, impl.enabledBySettingAttribute());
-    return result;
-}
-
-EncodedJSValue jsTestObjEnabledBySettingAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    return IDLAttribute<JSTestObj>::get<jsTestObjEnabledBySettingAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "enabledBySettingAttribute");
-}
-
-#endif
-
-#if ENABLE(TEST_FEATURE)
-static inline bool setJSTestObjEnabledBySettingAttributeSetter(ExecState& state, JSTestObj& thisObject, JSValue value, ThrowScope& throwScope)
-{
-    UNUSED_PARAM(state);
-    UNUSED_PARAM(throwScope);
-    auto& impl = thisObject.wrapped();
-    auto nativeValue = convert<IDLDOMString>(state, value);
-    RETURN_IF_EXCEPTION(throwScope, false);
-    impl.setEnabledBySettingAttribute(WTFMove(nativeValue));
-    return true;
-}
-
-bool setJSTestObjEnabledBySettingAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
-    return IDLAttribute<JSTestObj>::set<setJSTestObjEnabledBySettingAttributeSetter>(*state, thisValue, encodedValue, "enabledBySettingAttribute");
-}
-
-#endif
-
 static inline JSValue jsTestObjTypedArrayAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
 {
     UNUSED_PARAM(throwScope);
@@ -5193,27 +5088,6 @@
     return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionWorldSpecificMethodBody>(*state, "worldSpecificMethod");
 }
 
-#if ENABLE(TEST_FEATURE)
-static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionEnabledBySettingOperationBody(JSC::ExecState* state, typename IDLOperation<JSTestObj>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
-{
-    UNUSED_PARAM(state);
-    UNUSED_PARAM(throwScope);
-    auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
-    auto testParam = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    impl.enabledBySettingOperation(WTFMove(testParam));
-    return JSValue::encode(jsUndefined());
-}
-
-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledBySettingOperation(ExecState* state)
-{
-    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionEnabledBySettingOperationBody>(*state, "enabledBySettingOperation");
-}
-
-#endif
-
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionCalculateSecretResultBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSTestObj>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)
 {
     UNUSED_PARAM(state);

Added: trunk/Source/WebCore/bindings/scripts/test/TestEnabledBySetting.idl (0 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/TestEnabledBySetting.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestEnabledBySetting.idl	2017-09-04 10:50:58 UTC (rev 221585)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ * 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.
+ */
+
+interface TestEnabledBySetting {
+    [EnabledBySetting=TestSetting] attribute TestSubObjConstructor TestSubObjEnabledBySetting;
+
+    // [EnabledBySetting] attributes and operations.
+    [Conditional=TEST_FEATURE, EnabledBySetting=TestSetting] attribute DOMString enabledBySettingAttribute;
+    [Conditional=TEST_FEATURE, EnabledBySetting=TestSetting] void enabledBySettingOperation(DOMString testParam);
+};

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (221584 => 221585)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2017-09-04 09:24:43 UTC (rev 221584)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2017-09-04 10:50:58 UTC (rev 221585)
@@ -58,7 +58,6 @@
     static readonly attribute long     staticReadOnlyLongAttr;
     static attribute DOMString         staticStringAttr;
     static readonly attribute TestSubObjConstructor TestSubObj;
-    [EnabledBySetting=TestSetting] attribute TestSubObjConstructor TestSubObjEnabledBySetting;
     attribute TestEnumType enumAttr;
     attribute byte byteAttr;
     attribute octet octetAttr;
@@ -113,13 +112,8 @@
     [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam);
 
     [EnabledForWorld=someWorld, EnabledAtRuntime=TestFeature] void enabledInSpecificWorldWhenRuntimeFeatureEnabled(long testParam);
-
     [EnabledForWorld=someWorld] void worldSpecificMethod(long testParam);
 
-    // [EnabledBySetting] attributes and operations.
-    [Conditional=TEST_FEATURE, EnabledBySetting=TestSetting] attribute DOMString enabledBySettingAttribute;
-    [Conditional=TEST_FEATURE, EnabledBySetting=TestSetting] void enabledBySettingOperation(DOMString testParam);
-
     // [SecureContext] attributes and operations; will not be exposed to a non-secure context.
     // From <https://w3c.github.io/webappsec-secure-contexts/#integration-idl> (Editor's Draft, 17 November 2016)
     [SecureContext] Promise<double> calculateSecretResult();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to