0

WebSQL: Remove WebSQL everywhere

WebSQL has been deprecated and removed from WebView in M133,
and M119 on all other platforms. This change updates
RuntimeEnabledFeatures to remove the feature from everywhere.

Chromestatus: https://chromestatus.com/feature/5134293578285056
I2D&R: https://groups.google.com/a/chromium.org/g/blink-dev/c/fWYb6evVA-w/m/pziWcvboAgAJ

Bug: 395838064
Change-Id: Ic5840a5372cd26559b6ec385eef4f2f610343487
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6318423
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432355}
This commit is contained in:
Ayu Ishii
2025-03-13 14:02:01 -07:00
committed by Chromium LUCI CQ
parent d899765f36
commit 7861236c71
15 changed files with 53 additions and 232 deletions

@ -12128,7 +12128,6 @@ namespace console
method moveBy
method moveTo
method open
method openDatabase
method popinContextType
method popinContextTypesSupported
method postMessage

@ -351,8 +351,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
raw_ref(network::features::kCompressionDictionaryTransportBackend)},
{"CookieDeprecationFacilitatedTesting",
raw_ref(features::kCookieDeprecationFacilitatedTesting)},
{"Database", raw_ref(blink::features::kWebSQLAccess),
kSetOnlyIfOverridden},
{"DocumentPolicyIncludeJSCallStacksInCrashReports",
raw_ref(blink::features::
kDocumentPolicyIncludeJSCallStacksInCrashReports),

@ -625,7 +625,6 @@ source_set("unit_tests") {
"webaudio/media_stream_audio_destination_handler_test.cc",
"webaudio/script_processor_node_test.cc",
"webaudio/stereo_panner_node_test.cc",
"webdatabase/dom_window_web_database_test.cc",
"webdatabase/quota_tracker_test.cc",
"webrtc/webrtc_audio_device_impl_test.cc",
"webshare/navigator_share_test.cc",

@ -1,105 +0,0 @@
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/webdatabase/dom_window_web_database.h"
#include "base/feature_list.h"
#include "base/strings/strcat.h"
#include "base/test/scoped_command_line.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/modules/webdatabase/database.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
namespace blink {
void OpenWebDatabaseInIFrame(const char* outer_origin,
const char* outer_file,
const char* inner_origin,
const char* inner_file,
ExceptionState& exception_state) {
url_test_helpers::RegisterMockedURLLoadFromBase(
WebString::FromUTF8(outer_origin), test::CoreTestDataPath(),
WebString::FromUTF8(outer_file));
url_test_helpers::RegisterMockedURLLoadFromBase(
WebString::FromUTF8(inner_origin), test::CoreTestDataPath(),
WebString::FromUTF8(inner_file));
frame_test_helpers::WebViewHelper web_view_helper;
web_view_helper.InitializeAndLoad(base::StrCat({outer_origin, outer_file}));
LocalDOMWindow* local_dom_window =
To<LocalDOMWindow>(web_view_helper.GetWebView()
->GetPage()
->MainFrame()
->Tree()
.FirstChild()
->DomWindow());
Database* result = DOMWindowWebDatabase::openDatabase(
*local_dom_window, "", "", "", 0, exception_state);
EXPECT_EQ(result, nullptr);
url_test_helpers::UnregisterAllURLsAndClearMemoryCache();
}
void OpenWebDatabaseInWindow(const char* outer_origin,
const char* outer_file,
ExceptionState& exception_state) {
url_test_helpers::RegisterMockedURLLoadFromBase(
WebString::FromUTF8(outer_origin), test::CoreTestDataPath(),
WebString::FromUTF8(outer_file));
frame_test_helpers::WebViewHelper web_view_helper;
web_view_helper.InitializeAndLoad(base::StrCat({outer_origin, outer_file}));
LocalDOMWindow* local_dom_window = To<LocalDOMWindow>(
web_view_helper.GetWebView()->GetPage()->MainFrame()->DomWindow());
Database* result = DOMWindowWebDatabase::openDatabase(
*local_dom_window, "", "", "", 0, exception_state);
EXPECT_EQ(result, nullptr);
url_test_helpers::UnregisterAllURLsAndClearMemoryCache();
}
TEST(DOMWindowWebDatabaseTest, WebSQLThirdPartyContext) {
test::TaskEnvironment task_environment;
V8TestingScope scope;
OpenWebDatabaseInIFrame("http://not-example.test:0/",
"first_party/nested-originA.html",
"http://example.test:0/", "first_party/empty.html",
scope.GetExceptionState());
// This error means the database opening was rejected.
EXPECT_TRUE(scope.GetExceptionState().HadException());
EXPECT_EQ(scope.GetExceptionState().Code(),
static_cast<int>(DOMExceptionCode::kSecurityError));
}
TEST(DOMWindowWebDatabaseTest, WebSQLNonSecureContext) {
test::TaskEnvironment task_environment;
V8TestingScope scope;
OpenWebDatabaseInWindow("http://example.test:0/", "first_party/empty.html",
scope.GetExceptionState());
EXPECT_TRUE(scope.GetExceptionState().HadException());
// This error means the database opening was rejected.
EXPECT_TRUE(scope.GetExceptionState().HadException());
EXPECT_EQ(scope.GetExceptionState().Code(),
static_cast<int>(DOMExceptionCode::kSecurityError));
}
TEST(DOMWindowWebDatabaseTest, WebSQLFirstPartyContext) {
test::TaskEnvironment task_environment;
V8TestingScope scope;
OpenWebDatabaseInWindow("https://example.test:0/", "first_party/empty.html",
scope.GetExceptionState());
// Insufficient state exists to actually open a database, but this error
// means it was tried.
EXPECT_TRUE(scope.GetExceptionState().HadException());
EXPECT_EQ(scope.GetExceptionState().Code(),
static_cast<int>(DOMExceptionCode::kInvalidStateError));
}
} // namespace blink

@ -1440,13 +1440,8 @@
depends_on: ["CustomizableSelect"],
},
{
// https://chromestatus.com/feature/5134293578285056
name: "Database",
public: true,
status: "experimental",
base_feature: "none",
origin_trial_feature_name: "WebSQL",
origin_trial_allows_third_party: true,
origin_trial_type: "deprecation",
},
// This allows pages to opt out of the unload deprecation. Enabling this
// allows unload event handers to be used in the frame regardless of any

@ -10,7 +10,6 @@ PASS window.addEventListener.length is 2
PASS window.removeEventListener.length is 2
PASS window.postMessage.length is 1
PASS window.dispatchEvent.length is 1
PASS window.openDatabase.length is 4
PASS window.history.pushState.length is 2
PASS window.history.length is 1
PASS window.URL.createObjectURL.length is 1

@ -15,7 +15,6 @@ shouldBe('window.addEventListener.length', '2');
shouldBe('window.removeEventListener.length', '2');
shouldBe('window.postMessage.length', '1');
shouldBe('window.dispatchEvent.length', '1');
shouldBe('window.openDatabase.length', '4');
shouldBe('window.history.pushState.length', '2');
shouldBe('window.history.length', '1');
shouldBe('window.URL.createObjectURL.length', '1');

@ -58,60 +58,58 @@ PASS cachedFunctions[26]() is navigator
PASS cachedFunctions[26]() is navigator
PASS cachedFunctions[27]() is open
PASS cachedFunctions[27]() is open
PASS cachedFunctions[28]() is openDatabase
PASS cachedFunctions[28]() is openDatabase
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 status
PASS cachedFunctions[52]() is status
PASS cachedFunctions[53]() is stop
PASS cachedFunctions[53]() is stop
PASS cachedFunctions[54]() is window
PASS cachedFunctions[54]() is window
PASS cachedFunctions[28]() is opener
PASS cachedFunctions[28]() is opener
PASS cachedFunctions[29]() is outerHeight
PASS cachedFunctions[29]() is outerHeight
PASS cachedFunctions[30]() is outerWidth
PASS cachedFunctions[30]() is outerWidth
PASS cachedFunctions[31]() is pageXOffset
PASS cachedFunctions[31]() is pageXOffset
PASS cachedFunctions[32]() is pageYOffset
PASS cachedFunctions[32]() is pageYOffset
PASS cachedFunctions[33]() is parent
PASS cachedFunctions[33]() is parent
PASS cachedFunctions[34]() is prompt
PASS cachedFunctions[34]() is prompt
PASS cachedFunctions[35]() is releaseEvents
PASS cachedFunctions[35]() is releaseEvents
PASS cachedFunctions[36]() is removeEventListener
PASS cachedFunctions[36]() is removeEventListener
PASS cachedFunctions[37]() is resizeBy
PASS cachedFunctions[37]() is resizeBy
PASS cachedFunctions[38]() is resizeTo
PASS cachedFunctions[38]() is resizeTo
PASS cachedFunctions[39]() is screen
PASS cachedFunctions[39]() is screen
PASS cachedFunctions[40]() is screenLeft
PASS cachedFunctions[40]() is screenLeft
PASS cachedFunctions[41]() is screenTop
PASS cachedFunctions[41]() is screenTop
PASS cachedFunctions[42]() is screenX
PASS cachedFunctions[42]() is screenX
PASS cachedFunctions[43]() is screenY
PASS cachedFunctions[43]() is screenY
PASS cachedFunctions[44]() is scroll
PASS cachedFunctions[44]() is scroll
PASS cachedFunctions[45]() is scrollBy
PASS cachedFunctions[45]() is scrollBy
PASS cachedFunctions[46]() is scrollTo
PASS cachedFunctions[46]() is scrollTo
PASS cachedFunctions[47]() is scrollX
PASS cachedFunctions[47]() is scrollX
PASS cachedFunctions[48]() is scrollY
PASS cachedFunctions[48]() is scrollY
PASS cachedFunctions[49]() is setInterval
PASS cachedFunctions[49]() is setInterval
PASS cachedFunctions[50]() is setTimeout
PASS cachedFunctions[50]() is setTimeout
PASS cachedFunctions[51]() is status
PASS cachedFunctions[51]() is status
PASS cachedFunctions[52]() is stop
PASS cachedFunctions[52]() is stop
PASS cachedFunctions[53]() is window
PASS cachedFunctions[53]() is window
PASS successfullyParsed is true
TEST COMPLETE

@ -29,7 +29,6 @@ var functionNames = [
'name',
'navigator',
'open',
'openDatabase',
'opener',
'outerHeight',
'outerWidth',

@ -10,7 +10,6 @@ PASS window.find.call(targetWindow, 'string', false, false, false, false, false,
PASS window.confirm.call(targetWindow, 'message') threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.prompt.call(targetWindow, 'message', 'defaultValue') threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.getComputedStyle.call(targetWindow, document.body, '') threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0) threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.atob.call(targetWindow, 'string') threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.btoa.call(targetWindow, 'string') threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..
PASS window.clearTimeout.call(targetWindow, 0); threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame..

@ -33,7 +33,6 @@ window.onload = function()
shouldThrow("window.confirm.call(targetWindow, 'message')", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.prompt.call(targetWindow, 'message', 'defaultValue')", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.getComputedStyle.call(targetWindow, document.body, '')", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.atob.call(targetWindow, 'string')", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.btoa.call(targetWindow, 'string')", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
shouldThrow("window.clearTimeout.call(targetWindow, 0);", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');

@ -1,14 +0,0 @@
<html>
<head>
<script>
try {
var c = window.openDatabase('testdb', '1.0', 'Testing database', 512 * 1024);
document.write('No exception');
} catch (exception) {
document.write(exception.name);
}
</script>
</head>
<body>
</body>
</head>

@ -1,35 +0,0 @@
<html>
<head>
<script>
function log(message) {
var node = document.createElement('p');
node.textContent = message;
document.body.appendChild(node);
}
window.onload = function() {
try {
var sql = window.openDatabase('testdb', '1.0', 'Testing database', 512 * 1024);
sql = null;
log('No exception');
} catch (exception) {
log(exception.name);
}
}
window.onmessage = function(e) {
try {
var sql = window.openDatabase('testdb', '1.0', 'Testing database', 512 * 1024);
sql = null;
log('No exception');
window.parent.postMessage('No exception', '*');
} catch (exception) {
log(exception.name);
window.parent.postMessage(exception.name, '*');
}
}
</script>
</head>
<body>
</body>
</html>

@ -1,8 +0,0 @@
self.onmessage = function() {
try {
var db = self.openDatabase('testdb', '1.0', 'Testing database', 512 * 1024);
self.postMessage(null);
} catch (exception) {
self.postMessage(exception.name);
}
}

@ -13166,7 +13166,6 @@ namespace console
method moveBy
method moveTo
method open
method openDatabase
method popinContextType
method popinContextTypesSupported
method postMessage