Don't convert pasted content to use blob URL in WebKit1
[WebKit-https.git] / Source / WebCore / editing / cocoa / WebContentReaderCocoa.mm
index 17de1697adcbca34ea6839908d69ac5c68a2cad0..6fb68ac9578f2933b967be7b6d4ddf5e15bb68cb 100644 (file)
@@ -31,6 +31,7 @@
 #import "BlobURL.h"
 #import "CachedResourceLoader.h"
 #import "DOMURL.h"
+#import "DeprecatedGlobalSettings.h"
 #import "Document.h"
 #import "DocumentFragment.h"
 #import "DocumentLoader.h"
@@ -265,6 +266,14 @@ RefPtr<DocumentFragment> createFragmentAndAddResources(Frame& frame, NSAttribute
     if (!fragmentAndResources.fragment)
         return nullptr;
 
+    if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) {
+        if (DocumentLoader* loader = frame.loader().documentLoader()) {
+            for (auto& resource : fragmentAndResources.resources)
+                loader->addArchiveResource(resource.copyRef());
+        }
+        return WTFMove(fragmentAndResources.fragment);
+    }
+
     HashMap<AtomicString, AtomicString> blobURLMap;
     for (const Ref<ArchiveResource>& subresource : fragmentAndResources.resources) {
         auto blob = Blob::create(subresource->data(), subresource->mimeType());
@@ -366,6 +375,13 @@ bool WebContentReader::readWebArchive(SharedBuffer& buffer)
     });
     if (!result)
         return false;
+    
+    if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) {
+        fragment = createFragmentFromMarkup(*frame.document(), result->markup, result->mainResource->url(), DisallowScriptingAndPluginContent);
+        if (DocumentLoader* loader = frame.loader().documentLoader())
+            loader->addAllArchiveResources(result->archive.get());
+        return true;
+    }
 
     if (!shouldSanitize()) {
         fragment = createFragmentFromMarkup(*frame.document(), result->markup, result->mainResource->url(), DisallowScriptingAndPluginContent);