RESOLVED FIXED 220981
Load data URLs in the web process also for synchronous loads
https://bugs.webkit.org/show_bug.cgi?id=220981
Summary Load data URLs in the web process also for synchronous loads
Carlos Garcia Campos
Reported 2021-01-26 07:32:52 PST
In r271879 I removed the support for data URLs in the network process for soup, assuming data URLs were always loaded from the web process, but that's not the case for synchronous loads. We don't need to go to the network process for sync loads.
Attachments
Patch (15.19 KB, patch)
2021-01-26 07:41 PST, Carlos Garcia Campos
ews-feeder: commit-queue-
Patch (16.87 KB, patch)
2021-01-27 03:55 PST, Carlos Garcia Campos
ews-feeder: commit-queue-
Patch (16.88 KB, patch)
2021-01-27 04:03 PST, Carlos Garcia Campos
no flags
Patch (19.16 KB, patch)
2021-01-27 04:10 PST, Carlos Garcia Campos
aperez: review+
achristensen: commit-queue-
Patch for landing (21.33 KB, patch)
2021-01-28 03:08 PST, Carlos Garcia Campos
no flags
Carlos Garcia Campos
Comment 1 2021-01-26 07:41:12 PST
Carlos Garcia Campos
Comment 2 2021-01-26 07:49:46 PST
It seems it's failing to find <WebCore/DataURLDecoder.h>. Aren't forwarding headers automatic in mac? I added the header to Source/WebCore/Headers.cmake
Carlos Garcia Campos
Comment 3 2021-01-27 00:40:08 PST
*** Bug 221023 has been marked as a duplicate of this bug. ***
Carlos Garcia Campos
Comment 4 2021-01-27 03:55:18 PST
Carlos Garcia Campos
Comment 5 2021-01-27 04:03:23 PST
Carlos Garcia Campos
Comment 6 2021-01-27 04:10:30 PST
Alex Christensen
Comment 7 2021-01-27 15:01:22 PST
Comment on attachment 418528 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418528&action=review > Source/WebCore/platform/network/DataURLDecoder.cpp:221 > + bool success = task->process(); I don't think we need a local variable here. I think the function logic would look simpler like this: if (!task->process()) return WTF::nullopt; if (task->isBase64) { if (!decodeBase64(*task, mode)) return WTF::nullopt; } else decodeEscaped(*task); return WTFMove(task->result); Also, this whole thing is duplicate code. I think this function should be called decodeSynchronously and decode should call it. > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:547 > + result.response.setHTTPStatusCode(200); This is adding duplicate code with ResourceLoader::loadDataURL. Could we make them share code? > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:601 > + auto syncLoadResult = loadDataURLSynchronously(request); WebLoaderStrategy::loadResourceSynchronously should return a SyncLoadResult instead of taking error, response, and data as out params.
Carlos Garcia Campos
Comment 8 2021-01-28 03:00:55 PST
Comment on attachment 418528 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418528&action=review >> Source/WebCore/platform/network/DataURLDecoder.cpp:221 >> + bool success = task->process(); > > I don't think we need a local variable here. I think the function logic would look simpler like this: > > if (!task->process()) > return WTF::nullopt; > if (task->isBase64) { > if (!decodeBase64(*task, mode)) > return WTF::nullopt; > } else > decodeEscaped(*task); > return WTFMove(task->result); > > Also, this whole thing is duplicate code. I think this function should be called decodeSynchronously and decode should call it. Ok, I'll moved the common parts, the whole function can't be used from the async function because the task creation is different. >> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:547 >> + result.response.setHTTPStatusCode(200); > > This is adding duplicate code with ResourceLoader::loadDataURL. Could we make them share code? Yes. >> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:601 >> + auto syncLoadResult = loadDataURLSynchronously(request); > > WebLoaderStrategy::loadResourceSynchronously should return a SyncLoadResult instead of taking error, response, and data as out params. SyncLoadResult is private. We could make it public and update all the callers, but I think that refactoring is out of scope of this bug.
Carlos Garcia Campos
Comment 9 2021-01-28 03:08:25 PST
Created attachment 418633 [details] Patch for landing
Carlos Garcia Campos
Comment 10 2021-01-28 04:40:54 PST
Radar WebKit Bug Importer
Comment 11 2021-01-28 04:41:15 PST
Note You need to log in before you can comment on or make changes to this bug.