Diff
Modified: trunk/LayoutTests/ChangeLog (183407 => 183408)
--- trunk/LayoutTests/ChangeLog 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/LayoutTests/ChangeLog 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1,3 +1,18 @@
+2015-04-27 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183393.
+ https://bugs.webkit.org/show_bug.cgi?id=144272
+
+ Caused memory corruption detected by GuardMalloc (Requested by
+ ap on #webkit).
+
+ Reverted changeset:
+
+ "Synchronous XMLHttpRequest should get access to AppCache
+ resources stored as flat files"
+ https://bugs.webkit.org/show_bug.cgi?id=143711
+ http://trac.webkit.org/changeset/183393
+
2015-04-27 Yoav Weiss <[email protected]>
Fix viewport units in Media Queries
Deleted: trunk/LayoutTests/http/tests/appcache/resources/fake-video.mp4 (183407 => 183408)
--- trunk/LayoutTests/http/tests/appcache/resources/fake-video.mp4 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/LayoutTests/http/tests/appcache/resources/fake-video.mp4 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1 +0,0 @@
-This is a fake video
Deleted: trunk/LayoutTests/http/tests/appcache/resources/simple-video-sync.manifest (183407 => 183408)
--- trunk/LayoutTests/http/tests/appcache/resources/simple-video-sync.manifest 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/LayoutTests/http/tests/appcache/resources/simple-video-sync.manifest 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1,2 +0,0 @@
-CACHE MANIFEST
-fake-video.mp4
Deleted: trunk/LayoutTests/http/tests/appcache/simple-video-sync-expected.txt (183407 => 183408)
--- trunk/LayoutTests/http/tests/appcache/simple-video-sync-expected.txt 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/LayoutTests/http/tests/appcache/simple-video-sync-expected.txt 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1,2 +0,0 @@
-This tests that the application cache works for video retrieved by sync XMLHttpRequest
-SUCCESS
Deleted: trunk/LayoutTests/http/tests/appcache/simple-video-sync.html (183407 => 183408)
--- trunk/LayoutTests/http/tests/appcache/simple-video-sync.html 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/LayoutTests/http/tests/appcache/simple-video-sync.html 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1,36 +0,0 @@
-<html manifest="resources/simple-video-sync.manifest">
-<script>
-if (window.testRunner) {
- testRunner.dumpAsText()
- testRunner.waitUntilDone();
-}
-
-function finishTest(message) {
- document.getElementById('result').innerHTML = message;
- testRunner.notifyDone();
-}
-
-function cached()
-{
- try {
- var req = new XMLHttpRequest();
- req.open("GET", "resources/fake-video.mp4", false);
- req.send();
- if (req.getResponseHeader("Content-Type") != "video/mp4")
- finishTest("FAILURE: Did not get correct content type from cached resource");
- if (req.responseText.trim() != "This is a fake video")
- finishTest("FAILURE: Did not get correct data from cached resource");
- finishTest("SUCCESS");
- } catch (e) {
- finishTest("FAILURE: Could not load video data from cache");
- }
-}
-
-applicationCache.addEventListener('cached', cached, false);
-applicationCache.addEventListener('noupdate', cached, false);
-
-</script>
-<div>This tests that the application cache works for video retrieved by sync XMLHttpRequest</div>
-
-<div id="result">FAILURE</div>
-</html>
Modified: trunk/Source/WebCore/ChangeLog (183407 => 183408)
--- trunk/Source/WebCore/ChangeLog 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/ChangeLog 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1,3 +1,18 @@
+2015-04-27 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183393.
+ https://bugs.webkit.org/show_bug.cgi?id=144272
+
+ Caused memory corruption detected by GuardMalloc (Requested by
+ ap on #webkit).
+
+ Reverted changeset:
+
+ "Synchronous XMLHttpRequest should get access to AppCache
+ resources stored as flat files"
+ https://bugs.webkit.org/show_bug.cgi?id=143711
+ http://trac.webkit.org/changeset/183393
+
2015-04-27 Per Arne Vollan <[email protected]>
[Curl] Favicons loaded from disc cache are ignored.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (183407 => 183408)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -1063,6 +1063,25 @@
loadResource(mediaURL, contentType, keySystem);
}
+static URL createFileURLForApplicationCacheResource(const String& path)
+{
+ // URL should have a function to create a url from a path, but it does not. This function
+ // is not suitable because URL::setPath uses encodeWithURLEscapeSequences, which it notes
+ // does not correctly escape '#' and '?'. This function works for our purposes because
+ // app cache media files are always created with encodeForFileName(createCanonicalUUIDString()).
+
+#if USE(CF) && PLATFORM(WIN)
+ RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false));
+ URL url(cfURL.get());
+#else
+ URL url;
+
+ url.setProtocol(ASCIILiteral("file"));
+ url.setPath(path);
+#endif
+ return url;
+}
+
void HTMLMediaElement::loadResource(const URL& initialURL, ContentType& contentType, const String& keySystem)
{
ASSERT(isSafeToLoadURL(initialURL, Complain));
@@ -1127,7 +1146,7 @@
m_currentSrc = url;
if (resource) {
- url = ""
+ url = ""
LOG(Media, "HTMLMediaElement::loadResource(%p) - will load from app cache -> %s", this, urlForLoggingMedia(url).utf8().data());
}
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (183407 => 183408)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -375,7 +375,7 @@
}
// FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchronous requests.
- RefPtr<SharedBuffer> data;
+ Vector<char> data;
ResourceError error;
ResourceResponse response;
unsigned long identifier = std::numeric_limits<unsigned long>::max();
@@ -404,8 +404,10 @@
didReceiveResponse(identifier, response);
- if (data)
- didReceiveData(identifier, data->data(), data->size());
+ const char* bytes = static_cast<const char*>(data.data());
+ int len = static_cast<int>(data.size());
+ didReceiveData(identifier, bytes, len);
+
didFinishLoading(identifier, 0.0);
}
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (183407 => 183408)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -2660,7 +2660,7 @@
}
}
-unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, RefPtr<SharedBuffer>& data)
+unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
ASSERT(m_frame.document());
String referrer = SecurityPolicy::generateReferrerHeader(m_frame.document()->referrerPolicy(), request.url(), outgoingReferrer());
@@ -2682,15 +2682,13 @@
if (error.isNull()) {
ASSERT(!newRequest.isNull());
-
+
if (!documentLoader()->applicationCacheHost()->maybeLoadSynchronously(newRequest, error, response, data)) {
- Vector<char> buffer;
- platformStrategies()->loaderStrategy()->loadResourceSynchronously(networkingContext(), identifier, newRequest, storedCredentials, clientCredentialPolicy, error, response, buffer);
- data = ""
+ platformStrategies()->loaderStrategy()->loadResourceSynchronously(networkingContext(), identifier, newRequest, storedCredentials, clientCredentialPolicy, error, response, data);
documentLoader()->applicationCacheHost()->maybeLoadFallbackSynchronously(newRequest, error, response, data);
}
}
- notifier().sendRemainingDelegateMessages(m_documentLoader.get(), identifier, request, response, data ? data->data() : nullptr, data ? data->size() : 0, -1, error);
+ notifier().sendRemainingDelegateMessages(m_documentLoader.get(), identifier, request, response, data.data(), data.size(), -1, error);
return identifier;
}
Modified: trunk/Source/WebCore/loader/FrameLoader.h (183407 => 183408)
--- trunk/Source/WebCore/loader/FrameLoader.h 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2015-04-27 19:36:25 UTC (rev 183408)
@@ -43,7 +43,6 @@
#include "ResourceLoadNotifier.h"
#include "ResourceRequestBase.h"
#include "SecurityContext.h"
-#include "SharedBuffer.h"
#include "Timer.h"
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
@@ -117,7 +116,7 @@
#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
WEBCORE_EXPORT void loadArchive(PassRefPtr<Archive>);
#endif
- unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ClientCredentialPolicy, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data);
+ unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ClientCredentialPolicy, ResourceError&, ResourceResponse&, Vector<char>& data);
void changeLocation(SecurityOrigin*, const URL&, const String& referrer, LockHistory = LockHistory::Yes,
LockBackForwardList = LockBackForwardList::Yes, bool refresh = false, AllowNavigationToInvalidURL = AllowNavigationToInvalidURL::Yes);
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (183407 => 183408)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -31,7 +31,6 @@
#include "ApplicationCacheResource.h"
#include "DocumentLoader.h"
#include "DOMApplicationCache.h"
-#include "FileSystem.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
@@ -169,10 +168,10 @@
ApplicationCacheResource* resource;
if (!shouldLoadResourceFromApplicationCache(request, resource))
return false;
-
+
m_documentLoader.m_pendingSubstituteResources.set(loader, resource);
m_documentLoader.deliverSubstituteResourcesAfterDelay();
-
+
return true;
}
@@ -203,48 +202,22 @@
return false;
}
-URL ApplicationCacheHost::createFileURL(const String& path)
+bool ApplicationCacheHost::maybeLoadSynchronously(ResourceRequest& request, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
- // FIXME: Can we just use fileURLWithFileSystemPath instead?
-
- // fileURLWithFileSystemPath function is not suitable because URL::setPath uses encodeWithURLEscapeSequences, which it notes
- // does not correctly escape '#' and '?'. This function works for our purposes because
- // app cache media files are always created with encodeForFileName(createCanonicalUUIDString()).
-
-#if USE(CF) && PLATFORM(WIN)
- RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false));
- URL url(cfURL.get());
-#else
- URL url;
-
- url.setProtocol(ASCIILiteral("file"));
- url.setPath(path);
-#endif
- return url;
-}
-
-bool ApplicationCacheHost::maybeLoadSynchronously(ResourceRequest& request, ResourceError& error, ResourceResponse& response, RefPtr<SharedBuffer>& data)
-{
ApplicationCacheResource* resource;
if (shouldLoadResourceFromApplicationCache(request, resource)) {
if (resource) {
- // FIXME: Clients proably do not need a copy of the SharedBuffer.
- // Remove the call to copy() once we ensure SharedBuffer will not be modified.
- if (resource->path().isEmpty())
- data = ""
- else
- data = ""
- }
- if (!data)
- error = m_documentLoader.frameLoader()->client().cannotShowURLError(request);
- else
response = resource->response();
+ data.append(resource->data()->data(), resource->data()->size());
+ } else {
+ error = m_documentLoader.frameLoader()->client().cannotShowURLError(request);
+ }
return true;
}
return false;
}
-void ApplicationCacheHost::maybeLoadFallbackSynchronously(const ResourceRequest& request, ResourceError& error, ResourceResponse& response, RefPtr<SharedBuffer>& data)
+void ApplicationCacheHost::maybeLoadFallbackSynchronously(const ResourceRequest& request, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
// If normal loading results in a redirect to a resource with another origin (indicative of a captive portal), or a 4xx or 5xx status code or equivalent,
// or if there were network errors (but not if the user canceled the download), then instead get, from the cache, the resource of the fallback entry
@@ -255,9 +228,8 @@
ApplicationCacheResource* resource;
if (getApplicationCacheFallbackResource(request, resource)) {
response = resource->response();
- // FIXME: Clients proably do not need a copy of the SharedBuffer.
- // Remove the call to copy() once we ensure SharedBuffer will not be modified.
- data = ""
+ data.clear();
+ data.append(resource->data()->data(), resource->data()->size());
}
}
}
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h (183407 => 183408)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h 2015-04-27 19:36:25 UTC (rev 183408)
@@ -41,11 +41,10 @@
class DOMApplicationCache;
class DocumentLoader;
class Frame;
- class ResourceError;
class ResourceLoader;
+ class ResourceError;
class ResourceRequest;
class ResourceResponse;
- class SharedBuffer;
class SubstituteData;
class ApplicationCache;
class ApplicationCacheGroup;
@@ -111,8 +110,6 @@
explicit ApplicationCacheHost(DocumentLoader&);
~ApplicationCacheHost();
- static URL createFileURL(const String&);
-
void selectCacheWithoutManifest();
void selectCacheWithManifest(const URL& manifestURL);
@@ -128,8 +125,8 @@
WEBCORE_EXPORT bool maybeLoadFallbackForResponse(ResourceLoader*, const ResourceResponse&);
WEBCORE_EXPORT bool maybeLoadFallbackForError(ResourceLoader*, const ResourceError&);
- bool maybeLoadSynchronously(ResourceRequest&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>&);
- void maybeLoadFallbackSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>&);
+ bool maybeLoadSynchronously(ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
+ void maybeLoadFallbackSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
bool canCacheInPageCache();
@@ -180,6 +177,7 @@
ApplicationCache* mainResourceApplicationCache() const { return m_mainResourceApplicationCache.get(); }
bool maybeLoadFallbackForMainError(const ResourceRequest&, const ResourceError&);
+
// The application cache that the document loader is associated with (if any).
RefPtr<ApplicationCache> m_applicationCache;
Modified: trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (183407 => 183408)
--- trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -124,19 +124,18 @@
ResourceError error;
ResourceResponse response;
- RefPtr<SharedBuffer> data;
+ Vector<char> data;
bool requestAllowed = globalCachedResourceLoader->frame() && globalCachedResourceLoader->document()->securityOrigin()->canRequest(url);
if (requestAllowed) {
globalCachedResourceLoader->frame()->loader().loadResourceSynchronously(url, AllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, error, response, data);
if (error.isNull())
requestAllowed = globalCachedResourceLoader->document()->securityOrigin()->canRequest(response.url());
- else if (data)
- data = ""
+ else
+ data.clear();
}
if (!requestAllowed) {
- if (data)
- data = ""
+ data.clear();
globalCachedResourceLoader->printAccessDeniedMessage(url);
}
@@ -149,7 +148,7 @@
// We don't specify an encoding here. Neither Gecko nor WinIE respects
// the encoding specified in the HTTP headers.
- xmlDocPtr doc = xmlReadMemory(data ? data->data() : nullptr, data ? data->size() : 0, (const char*)uri, 0, options);
+ xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), (const char*)uri, 0, options);
xmlSetStructuredErrorFunc(0, 0);
xmlSetGenericErrorFunc(0, 0);
Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (183407 => 183408)
--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2015-04-27 18:57:13 UTC (rev 183407)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp 2015-04-27 19:36:25 UTC (rev 183408)
@@ -454,7 +454,7 @@
ResourceError error;
ResourceResponse response;
- RefPtr<SharedBuffer> data;
+ Vector<char> data;
{
@@ -470,10 +470,8 @@
// See <https://bugs.webkit.org/show_bug.cgi?id=21963>.
if (!shouldAllowExternalLoad(response.url()))
return &globalDescriptor;
- Vector<char> buffer;
- if (data)
- buffer.append(data->data(), data->size());
- return new OffsetBuffer(WTF::move(buffer));
+
+ return new OffsetBuffer(WTF::move(data));
}
static int readFunc(void* context, char* buffer, int len)