WebKit Bugzilla
Attachment 357801 Details for
Bug 192923
: Unparented WKWebView can't retrieve main resource data for a main frame plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192923-20181220010154.patch (text/plain), 9.98 KB, created by
Tim Horton
on 2018-12-20 01:01:55 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-12-20 01:01:55 PST
Size:
9.98 KB
patch
obsolete
>Subversion Revision: 239199 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9fbabea1e2f9339d6b1ddcb4f60f62fae1bb7ddd..4cec9039879b7448b796f4ac42c3a56bb11cee05 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-20 Tim Horton <timothy_horton@apple.com> >+ >+ Unparented WKWebView can't retrieve main resource data for a main frame plugin >+ https://bugs.webkit.org/show_bug.cgi?id=192923 >+ <rdar://problem/46859068> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/Plugins/PluginView.cpp: >+ (WebKit::PluginView::liveResourceData const): >+ If the WKWebView is unparented, we may not immediately initialize the plugin. >+ In that case, PluginView holds on to the backing data until the plugin >+ is initialized. If a WKWebView API client asks for the backing data >+ for the plugin during this time, we should return it, instead of bailing. >+ > 2018-12-13 Joseph Pecoraro <pecoraro@apple.com> > > [iOS] Web Inspector: Occasional UIProcess crashes under WebPageProxy::showInspectorIndication >diff --git a/Source/WebKit/WebProcess/Plugins/PluginView.cpp b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >index 4495c991122d0843dab0c84da60ba5a7c97ba6c8..99f1a145a6ad910b409d5a38a7e78bc1cffc7675 100644 >--- a/Source/WebKit/WebProcess/Plugins/PluginView.cpp >+++ b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >@@ -997,8 +997,12 @@ void PluginView::willDetachRenderer() > > RefPtr<SharedBuffer> PluginView::liveResourceData() const > { >- if (!m_isInitialized || !m_plugin) >- return 0; >+ if (!m_isInitialized || !m_plugin) { >+ if (m_manualStreamData && m_manualStreamState == ManualStreamState::Finished) >+ return m_manualStreamData; >+ >+ return nullptr; >+ } > > return m_plugin->liveResourceData(); > } >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 9078ea15e57188695f85eb446f48c79c1adfda09..4d7e644ccd62f5f9fa7dd7323694d03f72e445f0 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-20 Tim Horton <timothy_horton@apple.com> >+ >+ Unparented WKWebView can't retrieve main resource data for a main frame plugin >+ https://bugs.webkit.org/show_bug.cgi?id=192923 >+ <rdar://problem/46859068> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/WebKitCocoa/GetResourceData.mm: >+ Add a test ensuring that both parented and unparented WKWebViews can >+ retrieve main resource data when loading a PDF. >+ > 2018-12-13 Don Olmstead <don.olmstead@sony.com> > > Unreviewed. Changed my status to a reviewer. >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 7e8ed3be51484308e0d8a1a9b78ba358eff554a5..3928fefc6a19f832524d80bf4ca60ece899da501 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -88,6 +88,7 @@ > 2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; }; > 2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; }; > 2D838B1F1EEF3A5C009B980E /* WKContentViewEditingActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */; }; >+ 2DADF26321CB8F32003D3E3A /* GetResourceData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DADF26221CB8F32003D3E3A /* GetResourceData.mm */; }; > 2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */; }; > 2DB647881F4163D60051A89E /* WKWebViewDoesNotLogDuringInitialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB647871F4161F70051A89E /* WKWebViewDoesNotLogDuringInitialization.mm */; }; > 2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */; }; >@@ -1382,6 +1383,7 @@ > 2D8104CB1BEC13E70020DA46 /* FindInPage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPage.mm; sourceTree = "<group>"; }; > 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewEditingActions.mm; sourceTree = "<group>"; }; > 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShrinkToFit.mm; sourceTree = "<group>"; }; >+ 2DADF26221CB8F32003D3E3A /* GetResourceData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetResourceData.mm; sourceTree = "<group>"; }; > 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InteractionDeadlockAfterCrash.mm; sourceTree = "<group>"; }; > 2DB647871F4161F70051A89E /* WKWebViewDoesNotLogDuringInitialization.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewDoesNotLogDuringInitialization.mm; sourceTree = "<group>"; }; > 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; }; >@@ -2445,6 +2447,7 @@ > CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */, > 631EFFF51E7B5E8D00D2EBB8 /* Geolocation.mm */, > 07E1F6A01FFC3A080096C7EC /* GetDisplayMedia.mm */, >+ 2DADF26221CB8F32003D3E3A /* GetResourceData.mm */, > 51AF23DE1EF1A3720072F281 /* IconLoadingDelegate.mm */, > 510477751D298E03009747EB /* IDBDeleteRecovery.mm */, > 5110FCEF1E01CBAA006F8D0B /* IDBIndexUpgradeToV2.mm */, >@@ -3969,6 +3972,7 @@ > 07E1F6A31FFC4B760096C7EC /* GetDisplayMedia.mm in Sources */, > 7CCE7EF91A411AE600447C4C /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */, > 7CCE7EE21A411A9A00447C4C /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */, >+ 2DADF26321CB8F32003D3E3A /* GetResourceData.mm in Sources */, > 07CE1CF31F06A7E000BF89F5 /* GetUserMediaNavigation.mm in Sources */, > 07E499911F9E56DF002F1EF3 /* GetUserMediaReprompt.mm in Sources */, > 316BDBAC1E7207F100DE0D5A /* GPULegacyBuffer.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/GetResourceData.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/GetResourceData.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..cc70b199abf84105c24039df9bab56254b83133a >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/GetResourceData.mm >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import <WebKit/WKFoundation.h> >+ >+#if PLATFORM(MAC) && WK_API_ENABLED >+ >+#import "PlatformUtilities.h" >+#import "Test.h" >+#import "TestNavigationDelegate.h" >+#import "TestWKWebView.h" >+#import <WebKit/WKWebViewPrivate.h> >+#import <wtf/RetainPtr.h> >+ >+TEST(WebKit, GetPDFResourceData) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:configuration.get() addToWindow:YES]); >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]]; >+ [webView loadRequest:request]; >+ >+ [webView _test_waitForDidFinishNavigation]; >+ >+ __block bool isDone; >+ [webView _getMainResourceDataWithCompletionHandler:^(NSData *data, NSError *error) { >+ EXPECT_EQ(data.length, 10820UL); >+ isDone = true; >+ }]; >+ >+ TestWebKitAPI::Util::run(&isDone); >+} >+ >+TEST(WebKit, GetPDFResourceDataInUnparentedWebView) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:configuration.get() addToWindow:NO]); >+ >+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]]; >+ [webView loadRequest:request]; >+ >+ [webView _test_waitForDidFinishNavigation]; >+ >+ __block bool isDone; >+ [webView _getMainResourceDataWithCompletionHandler:^(NSData *data, NSError *error) { >+ EXPECT_EQ(data.length, 10820UL); >+ isDone = true; >+ }]; >+ >+ TestWebKitAPI::Util::run(&isDone); >+} >+ >+#endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192923
: 357801