Bug 158160 - Modern IDB: After closing a Netflix video, trying to watch it again fails
Summary: Modern IDB: After closing a Netflix video, trying to watch it again fails
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks: 149117
  Show dependency treegraph
 
Reported: 2016-05-27 12:00 PDT by Brady Eidson
Modified: 2016-05-27 16:06 PDT (History)
4 users (show)

See Also:


Attachments
Patch (20.50 KB, patch)
2016-05-27 12:05 PDT, Brady Eidson
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2016-05-27 12:00:18 PDT
Modern IDB: After closing a Netflix video, trying to watch it again fails

1 - Save off the exact URL for a specific Netflix video as a bookmark.
2 - Be watching that video.
3 - Close that Safari window, but do *not* quit Safari. This kills the WebProcess that was playing the video
4 - In a different window, open that bookmark to try to resume watching the video

In normal cases, the IDB client side cleans up all transactions/requests/etc when the window closes or page navigates.
But if the WebProcess is killed, then that client side cleanup doesn't happen.

Instead, we need to rely on server-side cleanup in response to the connection closing.

And the server doesn't abort in-progress transactions.

So when you visit a new netflix page, there's an in-progress transaction, so the new connection's transaction can never start.
Comment 1 Brady Eidson 2016-05-27 12:00:33 PDT
<rdar://problem/25092473>
Comment 2 Brady Eidson 2016-05-27 12:05:10 PDT
Created attachment 279978 [details]
Patch
Comment 3 WebKit Commit Bot 2016-05-27 12:07:50 PDT
Attachment 279978 [details] did not pass style-queue:


ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm:31:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Brady Eidson 2016-05-27 12:44:58 PDT
http://trac.webkit.org/changeset/201461
Comment 5 Darin Adler 2016-05-27 16:06:16 PDT
Comment on attachment 279978 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=279978&action=review

> Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:1244
> +    Deque<RefPtr<UniqueIDBDatabaseTransaction>> transactionsToAbort;

I think there is a chance this can use Ref instead of RefPtr.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:3
> +var request = window.indexedDB.deleteDatabase("WebProcessKillIDBCleanup");

No need for "window." here.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:18
> +    var request = window.indexedDB.open("WebProcessKillIDBCleanup");

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:22
> +        window.webkit.messageHandlers.testHandler.postMessage('Open success');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:29
> +        window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:34
> +        window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:40
> +            window.webkit.messageHandlers.testHandler.postMessage('Transaction complete');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:44
> +            window.webkit.messageHandlers.testHandler.postMessage('Transaction errored!');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html:60
> +            window.webkit.messageHandlers.testHandler.postMessage('Infinite Transaction Started');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html:7
> +    window.webkit.messageHandlers.testHandler.postMessage('Second open success');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html:17
> +    window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html:23
> +    window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded opening database');

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm:60
> +    RetainPtr<IndexedDBWebProcessKillMessageHandler> handler = adoptNS([[IndexedDBWebProcessKillMessageHandler alloc] init]);
> +    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);

Better to use auto.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm:93
> +    RetainPtr<WKWebView> webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);

auto