Title: [247576] branches/safari-608-branch
Revision
247576
Author
kocsen_ch...@apple.com
Date
2019-07-18 13:22:58 -0700 (Thu, 18 Jul 2019)

Log Message

Cherry-pick r247434. rdar://problem/53229565

    window.openDatabase is not writable
    https://bugs.webkit.org/show_bug.cgi?id=199737
    <rdar://problem/52551332>

    Reviewed by Chris Dumez.

    Source/WebCore:

    In r246707 we made openDatabase an undetectable attribute of window, and it was set to be read-only. This broke
    some sites which replace window.openDatabase with their own implementation when window.openDatabase does not
    exists or WebSQL is not implemented.

    This patch removes the readonly property and adds a setter for openDatabase.

    * Modules/webdatabase/DOMWindowWebDatabase.idl:
    * bindings/js/JSDOMWindowCustom.cpp:
    (WebCore::JSDOMWindow::setOpenDatabase):

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm:
    (TEST):
    * TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (247575 => 247576)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-07-18 20:22:58 UTC (rev 247576)
@@ -1,5 +1,54 @@
 2019-07-17  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r247434. rdar://problem/53229565
+
+    window.openDatabase is not writable
+    https://bugs.webkit.org/show_bug.cgi?id=199737
+    <rdar://problem/52551332>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    In r246707 we made openDatabase an undetectable attribute of window, and it was set to be read-only. This broke
+    some sites which replace window.openDatabase with their own implementation when window.openDatabase does not
+    exists or WebSQL is not implemented.
+    
+    This patch removes the readonly property and adds a setter for openDatabase.
+    
+    * Modules/webdatabase/DOMWindowWebDatabase.idl:
+    * bindings/js/JSDOMWindowCustom.cpp:
+    (WebCore::JSDOMWindow::setOpenDatabase):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm:
+    (TEST):
+    * TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-15  Sihui Liu  <sihui_...@apple.com>
+
+            window.openDatabase is not writable
+            https://bugs.webkit.org/show_bug.cgi?id=199737
+            <rdar://problem/52551332>
+
+            Reviewed by Chris Dumez.
+
+            In r246707 we made openDatabase an undetectable attribute of window, and it was set to be read-only. This broke
+            some sites which replace window.openDatabase with their own implementation when window.openDatabase does not
+            exists or WebSQL is not implemented.
+
+            This patch removes the readonly property and adds a setter for openDatabase.
+
+            * Modules/webdatabase/DOMWindowWebDatabase.idl:
+            * bindings/js/JSDOMWindowCustom.cpp:
+            (WebCore::JSDOMWindow::setOpenDatabase):
+
+2019-07-17  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r247379. rdar://problem/53229731
 
     Fix builds where HAVE_DESIGN_SYSTEM_UI_FONTS is not defined.

Modified: branches/safari-608-branch/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl (247575 => 247576)


--- branches/safari-608-branch/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl	2019-07-18 20:22:58 UTC (rev 247576)
@@ -25,5 +25,5 @@
  */
 
 partial interface DOMWindow {
-    [CustomGetter, NotEnumerable] readonly attribute any openDatabase;
+    [Custom, NotEnumerable] attribute any openDatabase;
 };

Modified: branches/safari-608-branch/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (247575 => 247576)


--- branches/safari-608-branch/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2019-07-18 20:22:58 UTC (rev 247576)
@@ -619,4 +619,12 @@
     return JSFunction::createFunctionThatMasqueradesAsUndefined(vm, state.lexicalGlobalObject(), 4, name, jsDOMWindowInstanceFunctionOpenDatabase, NoIntrinsic);
 }
 
+void JSDOMWindow::setOpenDatabase(JSC::ExecState& state, JSC::JSValue value)
+{
+    if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, wrapped(), ThrowSecurityError))
+        return;
+
+    replaceStaticPropertySlot(state.vm(), this, Identifier::fromString(&state.vm(), "openDatabase"), value);
+}
+
 } // namespace WebCore

Modified: branches/safari-608-branch/Tools/ChangeLog (247575 => 247576)


--- branches/safari-608-branch/Tools/ChangeLog	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-07-18 20:22:58 UTC (rev 247576)
@@ -1,3 +1,46 @@
+2019-07-17  Kocsen Chung  <kocsen_ch...@apple.com>
+
+        Cherry-pick r247434. rdar://problem/53229565
+
+    window.openDatabase is not writable
+    https://bugs.webkit.org/show_bug.cgi?id=199737
+    <rdar://problem/52551332>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    In r246707 we made openDatabase an undetectable attribute of window, and it was set to be read-only. This broke
+    some sites which replace window.openDatabase with their own implementation when window.openDatabase does not
+    exists or WebSQL is not implemented.
+    
+    This patch removes the readonly property and adds a setter for openDatabase.
+    
+    * Modules/webdatabase/DOMWindowWebDatabase.idl:
+    * bindings/js/JSDOMWindowCustom.cpp:
+    (WebCore::JSDOMWindow::setOpenDatabase):
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm:
+    (TEST):
+    * TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-15  Sihui Liu  <sihui_...@apple.com>
+
+            window.openDatabase is not writable
+            https://bugs.webkit.org/show_bug.cgi?id=199737
+            <rdar://problem/52551332>
+
+            Reviewed by Chris Dumez.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm:
+            (TEST):
+            * TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html:
+
 2019-07-15  Aakash Jain  <aakash_j...@apple.com>
 
         [ews-build] Parse and display layout test failures

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm (247575 => 247576)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm	2019-07-18 20:22:58 UTC (rev 247576)
@@ -64,5 +64,5 @@
 
     TestWebKitAPI::Util::run(&receivedScriptMessage);
     RetainPtr<NSString> string = (NSString *)[lastScriptMessage body];
-    EXPECT_WK_STREQ(@"Web SQL is deprecated", string.get());
+    EXPECT_WK_STREQ(@"openDatabase tests passed", string.get());
 }

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html (247575 => 247576)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html	2019-07-18 20:22:54 UTC (rev 247575)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html	2019-07-18 20:22:58 UTC (rev 247576)
@@ -9,10 +9,18 @@
             openDatabase('WebSQLDatabase', '1.0', 'Test DB', 524288);
         } catch(e) {
             hasError = true;
-            window.webkit.messageHandlers.testHandler.postMessage(e.message);
         } finally {
-            if (!hasError)
+            if (!hasError) {
                 window.webkit.messageHandlers.testHandler.postMessage("openDatabase can be called with non-null parameters");
+            } else {
+                var func = function() { }
+                window.openDatabase = func;
+                if (window.openDatabase == func) {
+                    window.webkit.messageHandlers.testHandler.postMessage("openDatabase tests passed");
+                } else {
+                    window.webkit.messageHandlers.testHandler.postMessage("openDatabase is not writable");
+                }
+            }
         }
     } else {
         window.webkit.messageHandlers.testHandler.postMessage("openDatabase cannot be called");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to