WebKit Bugzilla
Attachment 372673 Details for
Bug 198805
: openDatabase should return an empty object when WebSQL is disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-198805-20190621220726.patch (text/plain), 26.41 KB, created by
Sihui Liu
on 2019-06-21 22:07:27 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2019-06-21 22:07:27 PDT
Size:
26.41 KB
patch
obsolete
>Subversion Revision: 246606 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 706050d1f84bab2bee2cce9448056e65505f1240..08bfc1948290b24db2ec5b720095750025d94de6 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2019-06-21 Sihui Liu <sihui_liu@apple.com> >+ >+ openDatabase should return an empty object when WebSQL is disabled >+ https://bugs.webkit.org/show_bug.cgi?id=198805 >+ >+ Reviewed by Geoffrey Garen. >+ >+ * runtime/JSFunction.cpp: >+ (JSC::JSFunction::createFunctionThatMasqueradesAsUndefined): >+ * runtime/JSFunction.h: >+ > 2019-06-19 Adrian Perez de Castro <aperez@igalia.com> > > [WPE][GTK] Fix build with unified sources disabled >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 780b85bea79ecb5372887c8d252f5775ba2df87b..2c655721f448c8bcbfcb2224dfb9a1e8651cdba7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-06-21 Sihui Liu <sihui_liu@apple.com> >+ >+ openDatabase should return an empty object when WebSQL is disabled >+ https://bugs.webkit.org/show_bug.cgi?id=198805 >+ >+ Reviewed by Geoffrey Garen. >+ >+ Some websites rely on calling openDatabase with null parameters to check for private browsing. To not break >+ those sites, we now expose openDatabase interface even if Web SQL is disabled. When Web SQL is disabled, >+ window.openDatabase returns false, but it is callable and returns empty object. >+ >+ Test: WebSQL.OpenDatabaseAlwaysExists >+ >+ * Modules/webdatabase/DOMWindowWebDatabase.idl: >+ * bindings/js/JSDOMWindowCustom.cpp: >+ (WebCore::jsDOMWindowInstanceFunctionOpenDatabaseBody): >+ (WebCore::IDLOperation<JSDOMWindow>::cast): >+ (WebCore::jsDOMWindowInstanceFunctionOpenDatabase): >+ (WebCore::JSDOMWindow::openDatabase const): >+ > 2019-06-19 Adrian Perez de Castro <aperez@igalia.com> > > [WPE][GTK] Fix build with unified sources disabled >diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp >index 9ab3c22c04b425a725d353764827b2b34b2ec332..34b4872543403f023fec8faebd69f7b1e95c267b 100644 >--- a/Source/JavaScriptCore/runtime/JSFunction.cpp >+++ b/Source/JavaScriptCore/runtime/JSFunction.cpp >@@ -99,6 +99,16 @@ JSFunction* JSFunction::create(VM& vm, JSGlobalObject* globalObject, int length, > return function; > } > >+JSFunction* JSFunction::createFunctionThatMasqueradesAsUndefined(VM& vm, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor, const DOMJIT::Signature* signature) >+{ >+ NativeExecutable* executable = vm.getHostFunction(nativeFunction, intrinsic, nativeConstructor, signature, name); >+ Structure* structure = Structure::create(vm, globalObject, globalObject->objectPrototype(), TypeInfo(JSFunctionType, JSFunction::StructureFlags | MasqueradesAsUndefined), JSFunction::info()); >+ globalObject->masqueradesAsUndefinedWatchpoint()->fireAll(globalObject->vm(), "Allocated masquerading object"); >+ JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, globalObject, structure); >+ function->finishCreation(vm, executable, length, name); >+ return function; >+} >+ > JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure) > : Base(vm, globalObject, structure) > , m_executable() >diff --git a/Source/JavaScriptCore/runtime/JSFunction.h b/Source/JavaScriptCore/runtime/JSFunction.h >index 2248330d03fdfa9c527e6281200f563b72e22b12..5371504a8d52e6d7e4f6bf82fd629fd7bcdffb31 100644 >--- a/Source/JavaScriptCore/runtime/JSFunction.h >+++ b/Source/JavaScriptCore/runtime/JSFunction.h >@@ -80,6 +80,7 @@ public: > static Structure* selectStructureForNewFuncExp(JSGlobalObject*, FunctionExecutable*); > > JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor, const DOMJIT::Signature* = nullptr); >+ JS_EXPORT_PRIVATE static JSFunction* createFunctionThatMasqueradesAsUndefined(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor, const DOMJIT::Signature* = nullptr); > > static JSFunction* createWithInvalidatedReallocationWatchpoint(VM&, FunctionExecutable*, JSScope*); > >diff --git a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl >index 438a3821e130c1e02c87c08af62bf3f9017acfae..b628eeccedb902ad149f81a1d2569d13a6f39018 100644 >--- a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl >+++ b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl >@@ -24,10 +24,6 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-[ >- EnabledAtRuntime=WebSQL, >- EnabledByQuirk=hasWebSQLSupport, >-] > partial interface DOMWindow { >- [MayThrowException] Database? openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback? creationCallback); >+ [CustomGetter] readonly attribute any openDatabase; > }; >diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >index d10310ab6c89aa2a4b9a4a7017767d500cd4868f..50106800e51b3d7828b90f77e4377a29001d07b9 100644 >--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >@@ -22,6 +22,7 @@ > #include "JSDOMWindowCustom.h" > > #include "DOMWindowIndexedDatabase.h" >+#include "DOMWindowWebDatabase.h" > #include "Frame.h" > #include "HTMLCollection.h" > #include "HTMLDocument.h" >@@ -31,6 +32,8 @@ > #include "JSDOMConvertNullable.h" > #include "JSDOMConvertNumbers.h" > #include "JSDOMConvertStrings.h" >+#include "JSDatabase.h" >+#include "JSDatabaseCallback.h" > #include "JSEvent.h" > #include "JSEventListener.h" > #include "JSHTMLAudioElement.h" >@@ -48,8 +51,10 @@ > #include <JavaScriptCore/BuiltinNames.h> > #include <JavaScriptCore/HeapSnapshotBuilder.h> > #include <JavaScriptCore/JSCInlines.h> >+#include <JavaScriptCore/JSFunction.h> > #include <JavaScriptCore/JSMicrotask.h> > #include <JavaScriptCore/Lookup.h> >+#include <JavaScriptCore/Structure.h> > > #if ENABLE(USER_MESSAGE_HANDLERS) > #include "JSWebKitNamespace.h" >@@ -60,6 +65,7 @@ namespace WebCore { > using namespace JSC; > > EncodedJSValue JSC_HOST_CALL jsDOMWindowInstanceFunctionShowModalDialog(ExecState*); >+EncodedJSValue JSC_HOST_CALL jsDOMWindowInstanceFunctionOpenDatabase(ExecState*); > > void JSDOMWindow::visitAdditionalChildren(SlotVisitor& visitor) > { >@@ -564,4 +570,53 @@ JSValue JSDOMWindow::frames(JSC::ExecState&) const > return globalThis(); > } > >+static inline JSC::EncodedJSValue jsDOMWindowInstanceFunctionOpenDatabaseBody(JSC::ExecState* state, typename IDLOperation<JSDOMWindow>::ClassParameter castedThis, JSC::ThrowScope& throwScope) >+{ >+ if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError)) >+ return JSValue::encode(jsUndefined()); >+ auto& impl = castedThis->wrapped(); >+ if (UNLIKELY(state->argumentCount() < 4)) >+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); >+ auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ auto version = convert<IDLDOMString>(*state, state->uncheckedArgument(1)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ auto displayName = convert<IDLDOMString>(*state, state->uncheckedArgument(2)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ auto estimatedSize = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(3)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ >+ if (!RuntimeEnabledFeatures::sharedFeatures().webSQLEnabled()) { >+ if (name != "null" || version != "null" || displayName != "null" || estimatedSize) >+ propagateException(*state, throwScope, Exception(UnknownError, "Web SQL is deprecated"_s)); >+ return JSValue::encode(constructEmptyObject(state, castedThis->globalObject()->objectPrototype())); >+ } >+ >+ auto creationCallback = convert<IDLNullable<IDLCallbackFunction<JSDatabaseCallback>>>(*state, state->argument(4), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { >+ throwArgumentMustBeFunctionError(state, scope, 4, "creationCallback", "Window", "openDatabase"); >+ }); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ return JSValue::encode(toJS<IDLNullable<IDLInterface<Database>>>(*state, *castedThis->globalObject(), throwScope, WebCore::DOMWindowWebDatabase::openDatabase(impl, WTFMove(name), WTFMove(version), WTFMove(displayName), WTFMove(estimatedSize), WTFMove(creationCallback)))); >+} >+ >+template<> inline JSDOMWindow* IDLOperation<JSDOMWindow>::cast(ExecState& state) >+{ >+ return toJSDOMWindow(state.vm(), state.thisValue().toThis(&state, NotStrictMode)); >+} >+ >+EncodedJSValue JSC_HOST_CALL jsDOMWindowInstanceFunctionOpenDatabase(ExecState* state) >+{ >+ return IDLOperation<JSDOMWindow>::call<jsDOMWindowInstanceFunctionOpenDatabaseBody>(*state, "openDatabase"); >+} >+ >+JSValue JSDOMWindow::openDatabase(JSC::ExecState& state) const >+{ >+ VM& vm = state.vm(); >+ StringImpl* name = PropertyName(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().openDatabasePublicName()).publicName(); >+ if (RuntimeEnabledFeatures::sharedFeatures().webSQLEnabled()) >+ return JSFunction::create(vm, state.lexicalGlobalObject(), 4, name, jsDOMWindowInstanceFunctionOpenDatabase, NoIntrinsic); >+ >+ return JSFunction::createFunctionThatMasqueradesAsUndefined(vm, state.lexicalGlobalObject(), 4, name, jsDOMWindowInstanceFunctionOpenDatabase, NoIntrinsic); >+} >+ > } // namespace WebCore >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index db4c9d448476f0ff9843f2e091d669fc4af0a2ed..585782018ad73e069f1a2a1ca779110f87b2fa07 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-21 Sihui Liu <sihui_liu@apple.com> >+ >+ openDatabase should return an empty object when WebSQL is disabled >+ https://bugs.webkit.org/show_bug.cgi?id=198805 >+ >+ Reviewed by Geoffrey Garen. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm: Added. >+ (-[WebSQLBasicsMessageHandler userContentController:didReceiveScriptMessage:]): >+ (TEST): >+ * TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html: Added. >+ > 2019-06-19 Alex Christensen <achristensen@webkit.org> > > Add a unit test for client certificate authentication >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 916186310cd1bd845ef537b10474d4967d07ff1f..76058fd2a785340c51a64a2671ba9756bc3baa86 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -643,6 +643,8 @@ > 8E4A85371E1D1AB200F53B0F /* GridPosition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */; }; > 930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; }; > 9310CD381EF708FB0050FFE0 /* Function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9310CD361EF708FB0050FFE0 /* Function.cpp */; }; >+ 931C281D22BC55F2001D98C4 /* WebSQLBasics.mm in Sources */ = {isa = PBXBuildFile; fileRef = 931C281C22BC55A7001D98C4 /* WebSQLBasics.mm */; }; >+ 931C281E22BC579A001D98C4 /* opendatabase-always-exists.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 931C281B22BC5583001D98C4 /* opendatabase-always-exists.html */; }; > 9329AA291DE3F81E003ABD07 /* TextBreakIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9329AA281DE3F81E003ABD07 /* TextBreakIterator.cpp */; }; > 932AE53D1D371047005DFFAF /* focus-inputs.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93575C551D30366E000D604D /* focus-inputs.html */; }; > 933D631D1FCB76200032ECD6 /* Hasher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933D631B1FCB76180032ECD6 /* Hasher.cpp */; }; >@@ -1281,6 +1283,7 @@ > CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */, > 7CCB99231D3B4A46003922F6 /* open-multiple-external-url.html in Copy Resources */, > 468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */, >+ 931C281E22BC579A001D98C4 /* opendatabase-always-exists.html in Copy Resources */, > 290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */, > 83148B09202AC78D00BADE99 /* override-builtins-test.html in Copy Resources */, > CEBCA1391E3A807A00C73293 /* page-with-csp-iframe.html in Copy Resources */, >@@ -1921,6 +1924,8 @@ > 8E4A85361E1D1AA100F53B0F /* GridPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GridPosition.cpp; sourceTree = "<group>"; }; > 930AD401150698B30067970F /* lots-of-text.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-text.html"; sourceTree = "<group>"; }; > 9310CD361EF708FB0050FFE0 /* Function.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Function.cpp; sourceTree = "<group>"; }; >+ 931C281B22BC5583001D98C4 /* opendatabase-always-exists.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "opendatabase-always-exists.html"; sourceTree = "<group>"; }; >+ 931C281C22BC55A7001D98C4 /* WebSQLBasics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSQLBasics.mm; sourceTree = "<group>"; }; > 9329AA281DE3F81E003ABD07 /* TextBreakIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIterator.cpp; sourceTree = "<group>"; }; > 9331407B17B4419000F083B1 /* DidNotHandleKeyDown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DidNotHandleKeyDown.cpp; sourceTree = "<group>"; }; > 933D631B1FCB76180032ECD6 /* Hasher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Hasher.cpp; sourceTree = "<group>"; }; >@@ -2761,6 +2766,7 @@ > C1D8EE212028E8E3008EB141 /* WebProcessTerminate.mm */, > 5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */, > 5C9E56841DF9143D00C9EE33 /* WebsitePolicies.mm */, >+ 931C281C22BC55A7001D98C4 /* WebSQLBasics.mm */, > 2E5C77061FA70136005932C3 /* WKAttachmentTests.mm */, > 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */, > 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */, >@@ -3121,6 +3127,7 @@ > CDB5DFFE21360ED800D3E189 /* now-playing.html */, > 93E2D2751ED7D51700FA76F6 /* offscreen-iframe-of-media-document.html */, > 7CCB99221D3B44E7003922F6 /* open-multiple-external-url.html */, >+ 931C281B22BC5583001D98C4 /* opendatabase-always-exists.html */, > CEBCA1341E3A803400C73293 /* page-with-csp-iframe.html */, > CEBCA1351E3A803400C73293 /* page-with-csp.html */, > CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */, >@@ -4521,6 +4528,7 @@ > 536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */, > 5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */, > 5C9E56851DF9145400C9EE33 /* WebsitePolicies.mm in Sources */, >+ 931C281D22BC55F2001D98C4 /* WebSQLBasics.mm in Sources */, > 7CCE7ED41A411A7E00447C4C /* WebViewCanPasteURL.mm in Sources */, > 5C0BF8911DD599A900B00328 /* WebViewCanPasteZeroPng.mm in Sources */, > 7C83E0421D0A63FD00FEBCF3 /* WebViewCloseInsideDidFinishLoadForFrame.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..1b8ec02a94499ecc2f2093ef111eaa9db0520356 >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSQLBasics.mm >@@ -0,0 +1,68 @@ >+/* >+ * Copyright (C) 2019 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. >+ */ >+ >+#import "config.h" >+ >+#import "PlatformUtilities.h" >+#import "Test.h" >+ >+#import <WebKit/WKProcessPoolPrivate.h> >+#import <WebKit/WKUserContentControllerPrivate.h> >+#import <WebKit/WKWebViewConfigurationPrivate.h> >+#import <WebKit/WKWebsiteDataStorePrivate.h> >+#import <WebKit/WebKit.h> >+#import <wtf/RetainPtr.h> >+ >+static bool receivedScriptMessage; >+static RetainPtr<WKScriptMessage> lastScriptMessage; >+ >+@interface WebSQLBasicsMessageHandler : NSObject <WKScriptMessageHandler> >+@end >+ >+@implementation WebSQLBasicsMessageHandler >+ >+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message >+{ >+ receivedScriptMessage = true; >+ lastScriptMessage = message; >+} >+ >+@end >+ >+TEST(WebSQL, OpenDatabaseAlwaysExists) >+{ >+ auto handler = adoptNS([[WebSQLBasicsMessageHandler alloc] init]); >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"]; >+ receivedScriptMessage = false; >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"opendatabase-always-exists" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >+ [webView loadRequest:request]; >+ >+ TestWebKitAPI::Util::run(&receivedScriptMessage); >+ RetainPtr<NSString> string = (NSString *)[lastScriptMessage body]; >+ EXPECT_WK_STREQ(@"Web SQL is deprecated", string.get()); >+} >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html b/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c899e7ff01ad781f412dfa3438f0ff2ffce1ec76 >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/opendatabase-always-exists.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<script> >+ >+var allPassed = false; >+if (!window.openDatabase) { >+ if (window.openDatabase(null, null, null, null)) { >+ var hasError = false; >+ try { >+ openDatabase('WebSQLDatabase', '1.0', 'Test DB', 524288); >+ } catch(e) { >+ hasError = true; >+ window.webkit.messageHandlers.testHandler.postMessage(e.message); >+ } finally { >+ if (!hasError) >+ window.webkit.messageHandlers.testHandler.postMessage("openDatabase can be called with non-null parameters"); >+ } >+ } else { >+ window.webkit.messageHandlers.testHandler.postMessage("openDatabase cannot be called"); >+ } >+} else { >+ window.webkit.messageHandlers.testHandler.postMessage("window has openDatabase"); >+} >+ >+</script> >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 3ed8ae278f59f9a12851b421706b05639902095e..1d0534cfbddde5cdfd5a1d78cffdec5e13fd4086 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2019-06-21 Sihui Liu <sihui_liu@apple.com> >+ >+ openDatabase should return an empty object when WebSQL is disabled >+ https://bugs.webkit.org/show_bug.cgi?id=198805 >+ >+ Reviewed by Geoffrey Garen. >+ >+ Modify test expectation as openDatabase is not a function but an attribute of window now. >+ >+ * js/dom/global-function-resolve-expected.txt: >+ * js/dom/script-tests/global-function-resolve.js: >+ > 2019-06-19 Alicia Boya GarcÃa <aboya@igalia.com> > > [GTK] Unreviewed test gardening >diff --git a/LayoutTests/js/dom/global-function-resolve-expected.txt b/LayoutTests/js/dom/global-function-resolve-expected.txt >index 734bcc5f7cb43dcbf69f9658a975decfb34e7b43..b37e5fb70ed5b6ee38a176dab91cd72b85196cf3 100644 >--- a/LayoutTests/js/dom/global-function-resolve-expected.txt >+++ b/LayoutTests/js/dom/global-function-resolve-expected.txt >@@ -61,62 +61,60 @@ PASS cachedFunctions[27]() is navigator > PASS cachedFunctions[27]() is navigator > PASS cachedFunctions[28]() is open > PASS cachedFunctions[28]() is open >-PASS cachedFunctions[29]() is openDatabase >-PASS cachedFunctions[29]() is openDatabase >-PASS cachedFunctions[30]() is opener >-PASS cachedFunctions[30]() is opener >-PASS cachedFunctions[31]() is outerHeight >-PASS cachedFunctions[31]() is outerHeight >-PASS cachedFunctions[32]() is outerWidth >-PASS cachedFunctions[32]() is outerWidth >-PASS cachedFunctions[33]() is pageXOffset >-PASS cachedFunctions[33]() is pageXOffset >-PASS cachedFunctions[34]() is pageYOffset >-PASS cachedFunctions[34]() is pageYOffset >-PASS cachedFunctions[35]() is parent >-PASS cachedFunctions[35]() is parent >-PASS cachedFunctions[36]() is prompt >-PASS cachedFunctions[36]() is prompt >-PASS cachedFunctions[37]() is releaseEvents >-PASS cachedFunctions[37]() is releaseEvents >-PASS cachedFunctions[38]() is removeEventListener >-PASS cachedFunctions[38]() is removeEventListener >-PASS cachedFunctions[39]() is resizeBy >-PASS cachedFunctions[39]() is resizeBy >-PASS cachedFunctions[40]() is resizeTo >-PASS cachedFunctions[40]() is resizeTo >-PASS cachedFunctions[41]() is screen >-PASS cachedFunctions[41]() is screen >-PASS cachedFunctions[42]() is screenLeft >-PASS cachedFunctions[42]() is screenLeft >-PASS cachedFunctions[43]() is screenTop >-PASS cachedFunctions[43]() is screenTop >-PASS cachedFunctions[44]() is screenX >-PASS cachedFunctions[44]() is screenX >-PASS cachedFunctions[45]() is screenY >-PASS cachedFunctions[45]() is screenY >-PASS cachedFunctions[46]() is scroll >-PASS cachedFunctions[46]() is scroll >-PASS cachedFunctions[47]() is scrollBy >-PASS cachedFunctions[47]() is scrollBy >-PASS cachedFunctions[48]() is scrollTo >-PASS cachedFunctions[48]() is scrollTo >-PASS cachedFunctions[49]() is scrollX >-PASS cachedFunctions[49]() is scrollX >-PASS cachedFunctions[50]() is scrollY >-PASS cachedFunctions[50]() is scrollY >-PASS cachedFunctions[51]() is setInterval >-PASS cachedFunctions[51]() is setInterval >-PASS cachedFunctions[52]() is setTimeout >-PASS cachedFunctions[52]() is setTimeout >-PASS cachedFunctions[53]() is showModalDialog >-PASS cachedFunctions[53]() is showModalDialog >-PASS cachedFunctions[54]() is status >-PASS cachedFunctions[54]() is status >-PASS cachedFunctions[55]() is stop >-PASS cachedFunctions[55]() is stop >-PASS cachedFunctions[56]() is window >-PASS cachedFunctions[56]() is window >+PASS cachedFunctions[29]() is opener >+PASS cachedFunctions[29]() is opener >+PASS cachedFunctions[30]() is outerHeight >+PASS cachedFunctions[30]() is outerHeight >+PASS cachedFunctions[31]() is outerWidth >+PASS cachedFunctions[31]() is outerWidth >+PASS cachedFunctions[32]() is pageXOffset >+PASS cachedFunctions[32]() is pageXOffset >+PASS cachedFunctions[33]() is pageYOffset >+PASS cachedFunctions[33]() is pageYOffset >+PASS cachedFunctions[34]() is parent >+PASS cachedFunctions[34]() is parent >+PASS cachedFunctions[35]() is prompt >+PASS cachedFunctions[35]() is prompt >+PASS cachedFunctions[36]() is releaseEvents >+PASS cachedFunctions[36]() is releaseEvents >+PASS cachedFunctions[37]() is removeEventListener >+PASS cachedFunctions[37]() is removeEventListener >+PASS cachedFunctions[38]() is resizeBy >+PASS cachedFunctions[38]() is resizeBy >+PASS cachedFunctions[39]() is resizeTo >+PASS cachedFunctions[39]() is resizeTo >+PASS cachedFunctions[40]() is screen >+PASS cachedFunctions[40]() is screen >+PASS cachedFunctions[41]() is screenLeft >+PASS cachedFunctions[41]() is screenLeft >+PASS cachedFunctions[42]() is screenTop >+PASS cachedFunctions[42]() is screenTop >+PASS cachedFunctions[43]() is screenX >+PASS cachedFunctions[43]() is screenX >+PASS cachedFunctions[44]() is screenY >+PASS cachedFunctions[44]() is screenY >+PASS cachedFunctions[45]() is scroll >+PASS cachedFunctions[45]() is scroll >+PASS cachedFunctions[46]() is scrollBy >+PASS cachedFunctions[46]() is scrollBy >+PASS cachedFunctions[47]() is scrollTo >+PASS cachedFunctions[47]() is scrollTo >+PASS cachedFunctions[48]() is scrollX >+PASS cachedFunctions[48]() is scrollX >+PASS cachedFunctions[49]() is scrollY >+PASS cachedFunctions[49]() is scrollY >+PASS cachedFunctions[50]() is setInterval >+PASS cachedFunctions[50]() is setInterval >+PASS cachedFunctions[51]() is setTimeout >+PASS cachedFunctions[51]() is setTimeout >+PASS cachedFunctions[52]() is showModalDialog >+PASS cachedFunctions[52]() is showModalDialog >+PASS cachedFunctions[53]() is status >+PASS cachedFunctions[53]() is status >+PASS cachedFunctions[54]() is stop >+PASS cachedFunctions[54]() is stop >+PASS cachedFunctions[55]() is window >+PASS cachedFunctions[55]() is window > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/js/dom/script-tests/global-function-resolve.js b/LayoutTests/js/dom/script-tests/global-function-resolve.js >index 5c89394f55142f5a0745567299d0f43180f2833a..315b9742d9422b939d79e4e139d92dbb84586bf8 100644 >--- a/LayoutTests/js/dom/script-tests/global-function-resolve.js >+++ b/LayoutTests/js/dom/script-tests/global-function-resolve.js >@@ -30,7 +30,6 @@ var functionNames = [ > 'name', > 'navigator', > 'open', >- 'openDatabase', > 'opener', > 'outerHeight', > 'outerWidth',
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198805
:
371987
|
372617
|
372638
|
372641
|
372648
|
372650
|
372653
|
372654
|
372655
| 372673