Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash.html

Issue 2398313002: WebSQL: Add missing getExecutionContext() null check (Closed)
Patch Set: Use newfangled remove() method to simplify repro Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash.html
diff --git a/third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash.html b/third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash.html
new file mode 100644
index 0000000000000000000000000000000000000000..0f2b7c494f8cfea49ebe694ea436b2a666ba7a60
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<title>Database from removed execution context</title>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var script = `
+var db = openDatabase('' + Date.now() + Math.random(), '1', 'db', 1024);
+frameElement.remove();
+`;
+
+var cases = [
+ 'db.transaction(() => {});',
+ 'db.readTransaction(() => {});',
+ 'db.changeVersion(1, 2);'
+];
+
+window.addEventListener('DOMContentLoaded', e => {
+ function nextCase() {
+ if (!cases.length) {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+
+ var srcdoc = '<script>' + script + cases.shift() + '<\/script>';
+ var iframe = document.createElement('iframe');
+ document.body.appendChild(iframe);
+ iframe.srcdoc = srcdoc;
+ waitUntil(() => iframe.parentNode === null, nextCase);
+ }
+
+ nextCase();
+});
+
+// Poll (10ms) until testFunc returns true, then execute callback().
+function waitUntil(testFunc, callback) {
+ setTimeout(() => {
+ if (testFunc())
+ callback();
+ else
+ waitUntil(testFunc, callback);
+ }, 10);
+}
+</script>
+<body>
+If it doesn't crash, this test has passed.
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/storage/websql/database-removed-context-crash-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698