Changeset 185322 in webkit


Ignore:
Timestamp:
Jun 8, 2015 9:49:57 AM (9 years ago)
Author:
beidson@apple.com
Message:

Completely remove all IDB properties/constructors when it is disabled at runtime.
rdar://problem/18429374 and https://bugs.webkit.org/show_bug.cgi?id=137034

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • runtime/CommonIdentifiers.h:

Source/WebCore:

Test: storage/indexeddb/properties-disabled-at-runtime.html

  • Make constructors all runtime enabled.
  • Remove autogeneration of the window.(webkit)indexedDB accessors.
  • Add manual overrides for the (webkit)indexedDB accessors at runtime.
  • Modules/indexeddb/DOMWindowIndexedDatabase.idl:
  • Modules/indexeddb/IDBAny.idl:
  • Modules/indexeddb/IDBCursor.idl:
  • Modules/indexeddb/IDBCursorWithValue.idl:
  • Modules/indexeddb/IDBDatabase.idl:
  • Modules/indexeddb/IDBFactory.idl:
  • Modules/indexeddb/IDBIndex.idl:
  • Modules/indexeddb/IDBKeyRange.idl:
  • Modules/indexeddb/IDBObjectStore.idl:
  • Modules/indexeddb/IDBOpenDBRequest.idl:
  • Modules/indexeddb/IDBRequest.idl:
  • Modules/indexeddb/IDBTransaction.idl:
  • Modules/indexeddb/IDBVersionChangeEvent.idl:
  • page/DOMWindow.idl:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::jsDOMWindowIndexedDB):
(WebCore::JSDOMWindow::getOwnPropertySlot):

Source/WebKit2:

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::WebProcess): Enable IDB at runtime if it's enabled at compile time.

LayoutTests:

  • platform/mac-mavericks/TestExpectations: Disable global-constructors-attributes on Mavericks as there is no way to have different WK1 and WK2 results.
  • platform/mac-wk1/TestExpectations: Enable the new "properties are missing" test for Mac WK1.
  • platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: Added.
  • platform/win/TestExpectations: Enable the new "properties are missing" test for Win WK1
  • platform/wk2/TestExpectations: Disable the new "properties are missing" test for all WK2.
  • storage/indexeddb/properties-disabled-at-runtime-expected.txt: Added.
  • storage/indexeddb/properties-disabled-at-runtime.html: Added.
Location:
trunk
Files:
5 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185318 r185322  
     12015-06-08  Brady Eidson  <beidson@apple.com>
     2
     3        Completely remove all IDB properties/constructors when it is disabled at runtime.
     4        rdar://problem/18429374 and https://bugs.webkit.org/show_bug.cgi?id=137034
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * platform/mac-mavericks/TestExpectations: Disable global-constructors-attributes on Mavericks as
     9          there is no way to have different WK1 and WK2 results.
     10        * platform/mac-wk1/TestExpectations: Enable the new "properties are missing" test for Mac WK1.
     11        * platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: Added.
     12        * platform/win/TestExpectations: Enable the new "properties are missing" test for Win WK1
     13        * platform/wk2/TestExpectations: Disable the new "properties are missing" test for all WK2.
     14        * storage/indexeddb/properties-disabled-at-runtime-expected.txt: Added.
     15        * storage/indexeddb/properties-disabled-at-runtime.html: Added.
     16
    1172015-06-08  Sergio Villar Senin  <svillar@igalia.com>
    218
  • trunk/LayoutTests/platform/mac-mavericks/TestExpectations

    r184899 r185322  
    1919platform/mac/fast/ruby/ruby-expansion-cjk-3.html [ Skip ]
    2020platform/mac/fast/ruby/ruby-expansion-cjk-4.html [ Skip ]
     21
     22# Need to have Mavericks WK1 and Mavericks WK2 compare to different results which is not currently possible
     23js/dom/global-constructors-attributes.html [ Skip ]
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r185181 r185322  
    4242
    4343# IndexedDB is not yet enabled in Mac WK1
     44storage/indexeddb
    4445fast/history/page-cache-indexed-closed-db.html
    4546fast/history/page-cache-indexed-opened-db.html
    46 storage/indexeddb
    4747http/tests/security/cross-origin-indexeddb-allowed.html
    4848http/tests/security/cross-origin-indexeddb.html
     
    5252crypto/subtle/rsa-indexeddb.html
    5353crypto/subtle/rsa-indexeddb-non-exportable.html
     54
     55# But since it is disabled at runtime, we should make sure it is correctly disabled
     56storage/indexeddb/properties-disabled-at-runtime.html [ Pass ]
    5457
    5558# Fails with WebKit1 only.
  • trunk/LayoutTests/platform/win/TestExpectations

    r185286 r185322  
    243243fast/history/page-cache-indexed-closed-db.html [ Skip ]
    244244fast/history/page-cache-indexed-opened-db.html [ Skip ]
     245
     246# But since it is disabled at runtime, we should make sure it is correctly disabled
     247storage/indexeddb/properties-disabled-at-runtime.html [ Pass ]
     248
    245249fast/history/page-cache-webdatabase-no-transaction-db.html [ Skip ]
    246250fast/history/page-cache-webdatabase-pending-transaction.html [ Skip ]
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r185310 r185322  
    679679fast/text/shaping
    680680
     681# WebKit2 should always have IndexedDB enabled
     682storage/indexeddb/properties-disabled-at-runtime.html [ Skip ]
     683
    681684### END OF (4) Features that are not supported in WebKit2 and likely never will be
    682685########################################
  • trunk/Source/JavaScriptCore/ChangeLog

    r185286 r185322  
     12015-06-08  Brady Eidson  <beidson@apple.com>
     2
     3        Completely remove all IDB properties/constructors when it is disabled at runtime.
     4        rdar://problem/18429374 and https://bugs.webkit.org/show_bug.cgi?id=137034
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * runtime/CommonIdentifiers.h:
     9
    1102015-06-06  Mark Lam  <mark.lam@apple.com>
    211
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r184828 r185322  
    119119    macro(ignoreCase) \
    120120    macro(index) \
     121    macro(indexedDB) \
    121122    macro(inferredName) \
    122123    macro(input) \
     
    177178    macro(values) \
    178179    macro(webkit) \
     180    macro(webkitIndexedDB) \
    179181    macro(window) \
    180182    macro(writable)
  • trunk/Source/WebCore/ChangeLog

    r185320 r185322  
     12015-06-08  Brady Eidson  <beidson@apple.com>
     2
     3        Completely remove all IDB properties/constructors when it is disabled at runtime.
     4        rdar://problem/18429374 and https://bugs.webkit.org/show_bug.cgi?id=137034
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Test: storage/indexeddb/properties-disabled-at-runtime.html
     9
     10        - Make constructors all runtime enabled.
     11        - Remove autogeneration of the window.(webkit)indexedDB accessors.
     12        - Add manual overrides for the (webkit)indexedDB accessors at runtime.
     13       
     14        * Modules/indexeddb/DOMWindowIndexedDatabase.idl:
     15        * Modules/indexeddb/IDBAny.idl:
     16        * Modules/indexeddb/IDBCursor.idl:
     17        * Modules/indexeddb/IDBCursorWithValue.idl:
     18        * Modules/indexeddb/IDBDatabase.idl:
     19        * Modules/indexeddb/IDBFactory.idl:
     20        * Modules/indexeddb/IDBIndex.idl:
     21        * Modules/indexeddb/IDBKeyRange.idl:
     22        * Modules/indexeddb/IDBObjectStore.idl:
     23        * Modules/indexeddb/IDBOpenDBRequest.idl:
     24        * Modules/indexeddb/IDBRequest.idl:
     25        * Modules/indexeddb/IDBTransaction.idl:
     26        * Modules/indexeddb/IDBVersionChangeEvent.idl:
     27        * page/DOMWindow.idl:
     28
     29        * bindings/js/JSDOMWindowCustom.cpp:
     30        (WebCore::jsDOMWindowIndexedDB):
     31        (WebCore::JSDOMWindow::getOwnPropertySlot):
     32
    1332015-06-08  Michael Catanzaro  <mcatanzaro@igalia.com>
    234
  • trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl

    r165676 r185322  
    2828    Conditional=INDEXED_DATABASE,
    2929] partial interface DOMWindow {
    30     [ImplementedAs=indexedDB] readonly attribute IDBFactory webkitIndexedDB;
    31 
    32     readonly attribute IDBFactory indexedDB;
     30    // This space is intentionally left blank.
    3331};
    3432
  • trunk/Source/WebCore/Modules/indexeddb/IDBAny.idl

    r171824 r185322  
    2828    Conditional=INDEXED_DATABASE,
    2929    CustomToJSObject,
     30    EnabledAtRuntime=IndexedDB,
    3031] interface IDBAny {
    3132    // This space is intentionally left blank.
  • trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl

    r171824 r185322  
    2626[
    2727    Conditional=INDEXED_DATABASE,
     28    EnabledAtRuntime=IndexedDB,
    2829] interface IDBCursor {
    2930    readonly attribute IDBAny source;
  • trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl

    r171824 r185322  
    2626[
    2727    Conditional=INDEXED_DATABASE,
     28    EnabledAtRuntime=IndexedDB,
    2829] interface IDBCursorWithValue : IDBCursor {
    2930    readonly attribute any value;
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl

    r181507 r185322  
    3131    JSGenerateToJSObject,
    3232    JSGenerateToNativeObject,
     33    EnabledAtRuntime=IndexedDB,
    3334] interface IDBDatabase : EventTarget {
    3435    readonly attribute DOMString name;
  • trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl

    r171824 r185322  
    2727    Conditional=INDEXED_DATABASE,
    2828    ImplementationLacksVTable,
     29    EnabledAtRuntime=IndexedDB,
    2930] interface IDBFactory {
    3031    [CallWith=ScriptExecutionContext, RaisesException] IDBOpenDBRequest open(DOMString name, [EnforceRange] optional unsigned long long version);
  • trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl

    r171824 r185322  
    2727    Conditional=INDEXED_DATABASE,
    2828    ImplementationLacksVTable,
     29    EnabledAtRuntime=IndexedDB,
    2930] interface IDBIndex {
    3031    readonly attribute DOMString name;
  • trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl

    r171824 r185322  
    2727    Conditional=INDEXED_DATABASE,
    2828    ImplementationLacksVTable,
     29    EnabledAtRuntime=IndexedDB,
    2930] interface IDBKeyRange {
    3031    [ImplementedAs=lowerValue,CallWith=ScriptExecutionContext] readonly attribute any lower;
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl

    r171824 r185322  
    2727    Conditional=INDEXED_DATABASE,
    2828    ImplementationLacksVTable,
     29    EnabledAtRuntime=IndexedDB,
    2930] interface IDBObjectStore {
    3031    [TreatReturnedNullStringAs=Null] readonly attribute DOMString name;
  • trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.idl

    r181507 r185322  
    2828    EventTarget,
    2929    JSGenerateToJSObject,
    30     JSGenerateToNativeObject
     30    JSGenerateToNativeObject,
     31    EnabledAtRuntime=IndexedDB,
    3132] interface IDBOpenDBRequest : IDBRequest {
    3233    attribute EventHandler onblocked;
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl

    r181507 r185322  
    3030[
    3131    Conditional=INDEXED_DATABASE,
     32    EnabledAtRuntime=IndexedDB,
    3233    ActiveDOMObject,
    3334    EventTarget,
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl

    r181507 r185322  
    3131    JSGenerateToJSObject,
    3232    JSGenerateToNativeObject,
     33    EnabledAtRuntime=IndexedDB,
    3334] interface IDBTransaction : EventTarget {
    3435    readonly attribute DOMString mode;
  • trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.idl

    r171824 r185322  
    2626[
    2727    Conditional=INDEXED_DATABASE,
     28    EnabledAtRuntime=IndexedDB,
    2829] interface IDBVersionChangeEvent : Event {
    2930    readonly attribute unsigned long long oldVersion;
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r184828 r185322  
    2222#include "JSDOMWindowCustom.h"
    2323
     24#include "DOMWindowIndexedDatabase.h"
    2425#include "Frame.h"
    2526#include "HTMLCollection.h"
     
    3031#include "JSHTMLCollection.h"
    3132#include "JSHTMLOptionElement.h"
     33#include "JSIDBFactory.h"
    3234#include "JSImageConstructor.h"
    3335#include "JSMessagePortCustom.h"
    3436#include "JSWorker.h"
    3537#include "Location.h"
     38#include "RuntimeEnabledFeatures.h"
    3639#include "ScheduledAction.h"
    3740#include "Settings.h"
     
    97100        return JSValue::encode(jsUndefined());
    98101    return JSValue::encode(toJS(exec, castedThis->globalObject(), castedThis->impl().webkitNamespace()));
     102}
     103#endif
     104
     105#if ENABLE(INDEXED_DATABASE)
     106static EncodedJSValue jsDOMWindowIndexedDB(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
     107{
     108    UNUSED_PARAM(exec);
     109    UNUSED_PARAM(slotBase);
     110    UNUSED_PARAM(thisValue);
     111    auto* castedThis = toJSDOMWindow(JSValue::decode(thisValue));
     112    if (!RuntimeEnabledFeatures::sharedFeatures().indexedDBEnabled())
     113        return JSValue::encode(jsUndefined());
     114    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))
     115        return JSValue::encode(jsUndefined());
     116    auto& impl = castedThis->impl();
     117    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(DOMWindowIndexedDatabase::indexedDB(&impl)));
     118    return JSValue::encode(result);
    99119}
    100120#endif
     
    168188        }
    169189    }
     190
     191#if ENABLE(INDEXED_DATABASE)
     192    // FIXME: With generated JS bindings built on static property tables there is no way to
     193    // completely remove a generated property at runtime.
     194    // So to completely disable IndexedDB at runtime we have to not generate these accessors
     195    // and have to handle them specially here.
     196    // Once https://webkit.org/b/145669 is resolved, they can once again be auto generated.
     197    if (RuntimeEnabledFeatures::sharedFeatures().indexedDBEnabled() && (propertyName == exec->propertyNames().indexedDB || propertyName == exec->propertyNames().webkitIndexedDB)) {
     198        slot.setCustom(thisObject, allowsAccess ? DontDelete | ReadOnly | CustomAccessor : ReadOnly | DontDelete | DontEnum, jsDOMWindowIndexedDB);
     199        return true;
     200    }
     201#endif
    170202
    171203    const HashTableValue* entry = JSDOMWindow::info()->staticPropHashTable->entry(propertyName);
  • trunk/Source/WebCore/page/DOMWindow.idl

    r184616 r185322  
    208208    attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
    209209    attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this.
    210     [Conditional=INDEXED_DATABASE] attribute IDBCursorConstructor webkitIDBCursor;
    211     [Conditional=INDEXED_DATABASE] attribute IDBDatabaseConstructor webkitIDBDatabase;
    212     [Conditional=INDEXED_DATABASE] attribute IDBFactoryConstructor webkitIDBFactory;
    213     [Conditional=INDEXED_DATABASE] attribute IDBIndexConstructor webkitIDBIndex;
    214     [Conditional=INDEXED_DATABASE] attribute IDBKeyRangeConstructor webkitIDBKeyRange;
    215     [Conditional=INDEXED_DATABASE] attribute IDBObjectStoreConstructor webkitIDBObjectStore;
    216     [Conditional=INDEXED_DATABASE] attribute IDBRequestConstructor webkitIDBRequest;
    217     [Conditional=INDEXED_DATABASE] attribute IDBTransactionConstructor webkitIDBTransaction;
     210    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBCursorConstructor webkitIDBCursor;
     211    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBDatabaseConstructor webkitIDBDatabase;
     212    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBFactoryConstructor webkitIDBFactory;
     213    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBIndexConstructor webkitIDBIndex;
     214    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBKeyRangeConstructor webkitIDBKeyRange;
     215    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBObjectStoreConstructor webkitIDBObjectStore;
     216    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBRequestConstructor webkitIDBRequest;
     217    [Conditional=INDEXED_DATABASE, EnabledAtRuntime=IndexedDB] attribute IDBTransactionConstructor webkitIDBTransaction;
    218218#endif // defined(LANGUAGE_JAVASCRIPT)
    219219
  • trunk/Source/WebKit2/ChangeLog

    r185320 r185322  
     12015-06-08  Brady Eidson  <beidson@apple.com>
     2
     3        Completely remove all IDB properties/constructors when it is disabled at runtime.
     4        rdar://problem/18429374 and https://bugs.webkit.org/show_bug.cgi?id=137034
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * WebProcess/WebProcess.cpp:
     9        (WebKit::WebProcess::WebProcess): Enable IDB at runtime if it's enabled at compile time.
     10
    1112015-06-08  Michael Catanzaro  <mcatanzaro@igalia.com>
    212
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r185251 r185322  
    8787#include <WebCore/PageGroup.h>
    8888#include <WebCore/ResourceHandle.h>
     89#include <WebCore/RuntimeEnabledFeatures.h>
    8990#include <WebCore/SchemeRegistry.h>
    9091#include <WebCore/SecurityOrigin.h>
     
    204205#endif
    205206    m_plugInAutoStartOriginHashes.add(SessionID::defaultSessionID(), HashMap<unsigned, double>());
     207
     208#if ENABLE(INDEXED_DATABASE)
     209    RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
     210#endif
    206211}
    207212
Note: See TracChangeset for help on using the changeset viewer.