Make ApplicationCacheHost::maybeLoadSynchronously more robust
https://bugs.webkit.org/show_bug.cgi?id=165192

Patch by Youenn Fablet <youenn@apple.com> on 2017-01-12
Reviewed by Alex Christensen.

No change of behavior.
Currently, in case out parameter "data" is not null and shouldLoadResourceFromApplicationCache returns false and resource is null, we might dereference a null pointer when calling maybeLoadSynchronously.
We refactor the code to ensure that this case cannot happen anymore.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::bufferFromResource):
(WebCore::ApplicationCacheHost::maybeLoadSynchronously):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2 files changed