RESOLVED FIXED 158991
Retrieving Blobs from IDB using cursors fails in WK2 (Sandboxing)
https://bugs.webkit.org/show_bug.cgi?id=158991
Summary Retrieving Blobs from IDB using cursors fails in WK2 (Sandboxing)
Brady Eidson
Reported 2016-06-21 10:57:08 PDT
URL.createObjectURL from Blob saved in indexedDB does not work Loading the URL gives a 404 From <rdar://problem/26882004>
Attachments
Test #1 (17.82 KB, text/html)
2016-06-22 10:00 PDT, Brady Eidson
no flags
Test #2 (17.58 KB, text/html)
2016-06-22 10:01 PDT, Brady Eidson
no flags
Patch (35.78 KB, patch)
2016-06-23 14:01 PDT, Brady Eidson
no flags
Much better test that can be run in browser (39.50 KB, patch)
2016-06-23 16:50 PDT, Brady Eidson
no flags
Archive of layout-test-results from ews100 for mac-yosemite (804.82 KB, application/zip)
2016-06-23 17:39 PDT, Build Bot
no flags
Archive of layout-test-results from ews115 for mac-yosemite (1.19 MB, application/zip)
2016-06-23 17:59 PDT, Build Bot
no flags
Now with WK1 hopefully working (39.49 KB, patch)
2016-06-23 18:50 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2016-06-21 12:05:16 PDT
The reported steps: Steps to Reproduce: 1. Save blob in indexedDB 2. Retrieve Blob 3. URL.createObjectURL(retreivedBlob) 4. Display Image (with an img tag) Working on a repro case of this.
Brady Eidson
Comment 2 2016-06-21 12:10:18 PDT
We actually have layout tests that cover this (With XHR, admittedly, and not <img>) and they're working fine. In the meantime I've pinged the originator and asked for a test case that reproduces.
David Heidrich
Comment 3 2016-06-21 15:23:39 PDT
Thank you for looking at the issue: I created a Fiddle to show the Problem: // Working: Store blob first and read directly: https://jsfiddle.net/0y9vsfud/3/ // not Working: check if blob exists, load existing (results in 404), otherwise store https://jsfiddle.net/0y9vsfud/11/ The first execution will just store the image, a second run will load the existing image from the database. This results in a broken image. There are some other issues (not part of the Ticket), somehow I can't delete an existing database and the inspector does not show any items inside the collections.
Brady Eidson
Comment 4 2016-06-21 21:42:27 PDT
(In reply to comment #3) > There are some other issues (not part of the Ticket) > somehow I can't delete an existing database We have about 950 automated tests that successfully delete a database before they recreate it in the test, so what you're seeing here is definitely an edge case that we'd love more details on. > and the inspector does not show any items inside the collections. This is known. CC'ing Joe.
Brady Eidson
Comment 5 2016-06-22 09:57:41 PDT
Just a heads up, the fiddles don't work because of cross origin checks on the JS. Putting them in single-file test cases works.
Brady Eidson
Comment 6 2016-06-22 09:59:47 PDT
(In reply to comment #5) > Just a heads up, the fiddles don't work because of cross origin checks on > the JS. > > Putting them in single-file test cases works. (You can see the exceptions in the web inspector console)
Brady Eidson
Comment 7 2016-06-22 10:00:29 PDT
In general, it's best for test cases to be standalone files you can attach to a bug. I'm attaching your fiddles here. For me, they both work in Safari Tech Preview and a nightly.
Brady Eidson
Comment 8 2016-06-22 10:00:54 PDT
Brady Eidson
Comment 9 2016-06-22 10:01:04 PDT
Brady Eidson
Comment 10 2016-06-22 10:01:58 PDT
Perhaps you were running into security origin issues when you saw things not working? Could you give these test cases I attached a shot and see if they work for you?
David Heidrich
Comment 11 2016-06-22 10:07:28 PDT
Thank you. I disabled the security check I think. Sorry forgot to mention that. Just saw that a new Preview Version has been released (Today). I tested this version with the second Attachement (OSX 10.11.4, Safari Version 9.1.2 (11601.7.4, 11602.1.37)). I still get the 404 on the second call. I will switch to another Computer and a fresh OSX install.
David Heidrich
Comment 12 2016-06-22 10:33:59 PDT
I tested Test #2 with another Machine, OS X 10.11.5 (15F34), Version 9.1.2 (11601.7.4, 11602.1.37), same Problem. Important: The first (initial) request always shows the webkit logo, the second Request should show the Safari Technology Preview Logo (but shows a failed image instead) and a 404 error is thrown for the blob url.
Brady Eidson
Comment 13 2016-06-22 11:44:31 PDT
I can reproduce that now, not sure why I couldn't before.
Brady Eidson
Comment 14 2016-06-23 09:39:05 PDT
In a debug build, Networking process is ASSERTing: #0 0x00000001142d1db7 in ::WTFCrash() at /Volumes/Data/git/OpenSource/Source/WTF/wtf/Assertions.cpp:317 #1 0x000000010ff95f75 in WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath(WTF::String const&) at /Volumes/Data/git/OpenSource/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:285 #2 0x000000010fef11f7 in WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked(WebKit::NetworkConnectionToWebProcess*, WebCore::URL const&, WebCore::URL const&, WTF::String const&) at /Volumes/Data/git/OpenSource/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:89 #3 0x000000010ff95fed in WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked(WebCore::URL const&, WebCore::URL const&, WTF::String const&) at /Volumes/Data/git/OpenSource/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:291 ... RefPtr<WebCore::BlobDataFileReference> NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath(const String& path) { ASSERT(m_blobDataFileReferences.contains(path)); return m_blobDataFileReferences.get(path); } m_blobDataFileReferences get's populated for a path from preregisterSandboxExtensionsForOptionallyFileBackedBlob, which is not getting hit by this point in time. Basically, the Networking process either: A - Isn't getting its sandbox extension for the file ever B - Isn't getting it *yet* due to a race or out-of-order.
Brady Eidson
Comment 15 2016-06-23 09:40:49 PDT
WebProcess is getting WebIDBConnectionToServer::didGetRecord instead of WebIDBConnectionToServer::didGetRecordWithSandboxExtensions, so it never has any extensions to pass to Networking.
Brady Eidson
Comment 16 2016-06-23 09:54:38 PDT
(In reply to comment #15) > WebProcess is getting WebIDBConnectionToServer::didGetRecord instead of > WebIDBConnectionToServer::didGetRecordWithSandboxExtensions, so it never has > any extensions to pass to Networking. Aha! Super obvious. The test case uses a cursor, not an objectStore.get, and that's not getting the extra sandbox extension code. Yikes!
Brady Eidson
Comment 17 2016-06-23 13:05:31 PDT
Have a patch that fixes this, just need to get the test case cleaned up as a layout test.
Brady Eidson
Comment 18 2016-06-23 14:01:24 PDT
WebKit Commit Bot
Comment 19 2016-06-23 14:02:47 PDT
Attachment 281930 [details] did not pass style-queue: ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:79: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:127: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp:287: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 3 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
David Heidrich
Comment 20 2016-06-23 15:05:10 PDT
Thank you a lot for fixing this :).
Brady Eidson
Comment 21 2016-06-23 16:50:18 PDT
Created attachment 281942 [details] Much better test that can be run in browser
Brady Eidson
Comment 22 2016-06-23 16:50:47 PDT
(In reply to comment #20) > Thank you a lot for fixing this :). No, thanks for finding and reporting it so we have the opportunity to fix it!
WebKit Commit Bot
Comment 23 2016-06-23 16:52:09 PDT
Attachment 281942 [details] did not pass style-queue: ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:79: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:127: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp:287: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 3 in 20 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brady Eidson
Comment 24 2016-06-23 17:25:44 PDT
Looks like WK1 test fails and I totally know why - I didn't allow opening multiple windows! sigh. DRT needs it, even if WKTR doesn't
Build Bot
Comment 25 2016-06-23 17:39:32 PDT
Comment on attachment 281942 [details] Much better test that can be run in browser Attachment 281942 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/1557769 New failing tests: storage/indexeddb/modern/blob-cursor.html
Build Bot
Comment 26 2016-06-23 17:39:35 PDT
Created attachment 281947 [details] Archive of layout-test-results from ews100 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 27 2016-06-23 17:59:11 PDT
Comment on attachment 281942 [details] Much better test that can be run in browser Attachment 281942 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1557833 New failing tests: storage/indexeddb/modern/blob-cursor.html
Build Bot
Comment 28 2016-06-23 17:59:14 PDT
Created attachment 281948 [details] Archive of layout-test-results from ews115 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-yosemite Platform: Mac OS X 10.10.5
Brady Eidson
Comment 29 2016-06-23 18:50:35 PDT
Created attachment 281953 [details] Now with WK1 hopefully working
WebKit Commit Bot
Comment 30 2016-06-23 18:51:49 PDT
Attachment 281953 [details] did not pass style-queue: ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:79: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.h:127: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp:287: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 3 in 20 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brady Eidson
Comment 31 2016-06-23 20:35:13 PDT
Uggggh... remaining orange EWSes are in a "unable to build without patch, tree is red?" loop.
Brady Eidson
Comment 32 2016-06-23 20:42:11 PDT
Comment on attachment 281953 [details] Now with WK1 hopefully working Even though other platform EWSes are still orange, they're obviously not related to this patch. CQ+'ing
WebKit Commit Bot
Comment 33 2016-06-23 21:09:02 PDT
Comment on attachment 281953 [details] Now with WK1 hopefully working Clearing flags on attachment: 281953 Committed r202414: <http://trac.webkit.org/changeset/202414>
WebKit Commit Bot
Comment 34 2016-06-23 21:09:07 PDT
All reviewed patches have been landed. Closing bug.
David Heidrich
Comment 35 2016-07-13 15:02:26 PDT
I tested the latest Safari Preview (v8) and it seems to work, at least with Images (like png, jpeg, gif etc.). It does not work with Video and Sound Blobs (they won't play). I will try to create a test case.
Brady Eidson
Comment 36 2016-07-13 20:20:12 PDT
(In reply to comment #35) > I tested the latest Safari Preview (v8) and it seems to work, at least with > Images (like png, jpeg, gif etc.). It does not work with Video and Sound > Blobs (they won't play). I will try to create a test case. Can you demonstrate video and sounds blobs working *at all*? That is, without Indexed DB usage, just directly applying a blob to a video/audio element?
Brady Eidson
Comment 37 2016-07-13 20:20:49 PDT
(In reply to comment #36) > (In reply to comment #35) > > I tested the latest Safari Preview (v8) and it seems to work, at least with > > Images (like png, jpeg, gif etc.). It does not work with Video and Sound > > Blobs (they won't play). I will try to create a test case. > > Can you demonstrate video and sounds blobs working *at all*? > > That is, without Indexed DB usage, just directly applying a blob to a > video/audio element? Regardless of the answer, when you put together a test case, please file a new bug. The issue discovered in this bug has been resolved, and we prefer not to reuse bugs.
Note You need to log in before you can comment on or make changes to this bug.