Title: [151748] trunk/Source/WebKit2
Revision
151748
Author
[email protected]
Date
2013-06-19 13:05:33 -0700 (Wed, 19 Jun 2013)

Log Message

REGRESSION: Cannot open Silverlight preferences via context menu
https://bugs.webkit.org/show_bug.cgi?id=117806
<rdar://problem/14166644>

Reviewed by Beth Dakin.

Hook the LSOpenCFURLRef function and make the UI process open the URL if it's the URL for the
Silverlight Preferences application. This is what we do for the Flash updater.

* PluginProcess/PluginProcess.h:
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::openCFURLRef):
(WebKit::initializeShim):
(WebKit::PluginProcess::openURL):
* PluginProcess/mac/PluginProcessShim.h:
* PluginProcess/mac/PluginProcessShim.mm:
(WebKit::shimLSOpenCFURLRef):
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Plugins/PluginProcessProxy.messages.in:
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::isSilverlightPreferencesURL):
(WebKit::shouldOpenURL):
(WebKit::PluginProcessProxy::openURL):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (151747 => 151748)


--- trunk/Source/WebKit2/ChangeLog	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-19 20:05:33 UTC (rev 151748)
@@ -1,3 +1,29 @@
+2013-06-19  Anders Carlsson  <[email protected]>
+
+        REGRESSION: Cannot open Silverlight preferences via context menu
+        https://bugs.webkit.org/show_bug.cgi?id=117806
+        <rdar://problem/14166644>
+
+        Reviewed by Beth Dakin.
+
+        Hook the LSOpenCFURLRef function and make the UI process open the URL if it's the URL for the
+        Silverlight Preferences application. This is what we do for the Flash updater.
+
+        * PluginProcess/PluginProcess.h:
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::openCFURLRef):
+        (WebKit::initializeShim):
+        (WebKit::PluginProcess::openURL):
+        * PluginProcess/mac/PluginProcessShim.h:
+        * PluginProcess/mac/PluginProcessShim.mm:
+        (WebKit::shimLSOpenCFURLRef):
+        * UIProcess/Plugins/PluginProcessProxy.h:
+        * UIProcess/Plugins/PluginProcessProxy.messages.in:
+        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+        (WebKit::isSilverlightPreferencesURL):
+        (WebKit::shouldOpenURL):
+        (WebKit::PluginProcessProxy::openURL):
+
 2013-06-19  Krzysztof Wolanski  <[email protected]>
 
         [EFL][WK2] Implement unit test callback: onSettingChange.

Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.h (151747 => 151748)


--- trunk/Source/WebKit2/PluginProcess/PluginProcess.h	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.h	2013-06-19 20:05:33 UTC (rev 151748)
@@ -58,6 +58,8 @@
 #endif
 
     bool launchProcess(const String& launchPath, const Vector<String>& arguments);
+    bool openURL(const String& urlString, int32_t& status, String& launchedURLString);
+
 #endif
 
 private:

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (151747 => 151748)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-06-19 20:05:33 UTC (rev 151748)
@@ -186,6 +186,17 @@
 #endif
 }
 
+static bool openCFURLRef(CFURLRef url, int32_t& status, CFURLRef* launchedURL)
+{
+    String launchedURLString;
+    if (!PluginProcess::shared().openURL(KURL(url).string(), status, launchedURLString))
+        return false;
+
+    if (!launchedURLString.isNull() && launchedURL)
+        *launchedURL = KURL(ParsedURLString, launchedURLString).createCFURL().leakRef();
+    return true;
+}
+
 #endif
 
 static void setModal(bool modalWindowIsShowing)
@@ -243,6 +254,7 @@
         carbonWindowShown,
         carbonWindowHidden,
         setModal,
+        openCFURLRef,
     };
 
     PluginProcessShimInitializeFunc initFunc = reinterpret_cast<PluginProcessShimInitializeFunc>(dlsym(RTLD_DEFAULT, "WebKitPluginProcessShimInitialize"));
@@ -315,6 +327,15 @@
     return result;
 }
 
+bool PluginProcess::openURL(const String& urlString, int32_t& status, String& launchedURLString)
+{
+    bool result;
+    if (!parentProcessConnection()->sendSync(Messages::PluginProcessProxy::OpenURL(urlString), Messages::PluginProcessProxy::OpenURL::Reply(result, status, launchedURLString), 0))
+        return false;
+
+    return result;
+}
+
 static void muteAudio(void)
 {
     AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyProcessIsAudible, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h (151747 => 151748)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.h	2013-06-19 20:05:33 UTC (rev 151748)
@@ -41,6 +41,7 @@
     void (*carbonWindowShown)(WindowRef);
     void (*carbonWindowHidden)(WindowRef);
     void (*setModal)(bool);
+    bool (*openCFURLRef)(CFURLRef, int32_t& returnValue, CFURLRef* launchedURL);
 };
 
 typedef void (*PluginProcessShimInitializeFunc)(const PluginProcessShimCallbacks&);

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm (151747 => 151748)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm	2013-06-19 20:05:33 UTC (rev 151748)
@@ -100,6 +100,16 @@
     HideWindow(window);
 }
 
+static OSStatus
+shimLSOpenCFURLRef(CFURLRef url, CFURLRef* launchedURL)
+{
+    int32_t returnValue;
+    if (pluginProcessShimCallbacks.openCFURLRef(url, returnValue, launchedURL))
+        return returnValue;
+
+    return LSOpenCFURLRef(url, launchedURL);
+}
+
 DYLD_INTERPOSE(shimDebugger, Debugger);
 DYLD_INTERPOSE(shimGetCurrentEventButtonState, GetCurrentEventButtonState);
 DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive);
@@ -107,6 +117,7 @@
 DYLD_INTERPOSE(shimAlert, Alert);
 DYLD_INTERPOSE(shimShowWindow, ShowWindow);
 DYLD_INTERPOSE(shimHideWindow, HideWindow);
+DYLD_INTERPOSE(shimLSOpenCFURLRef, LSOpenCFURLRef);
 
 #if COMPILER(CLANG)
 #pragma clang diagnostic pop

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h (151747 => 151748)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h	2013-06-19 20:05:33 UTC (rev 151748)
@@ -136,6 +136,7 @@
     void applicationDidBecomeActive();
     void openPluginPreferencePane();
     void launchProcess(const String& launchPath, const Vector<String>& arguments, bool& result);
+    void openURL(const String& url, bool& result, int32_t& status, String& launchedURLString);
 #endif
 
     void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in (151747 => 151748)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in	2013-06-19 20:05:33 UTC (rev 151748)
@@ -37,6 +37,9 @@
 
     # Returns true if the UI process launched the process.
     LaunchProcess(WTF::String launchPath, Vector<WTF::String> arguments) -> (bool result)
+
+    # Returns true if the UI process did open the URL.
+    OpenURL(WTF::String urlString) -> (bool result, int32_t status, WTF::String launchedURLString)
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm (151747 => 151748)


--- trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm	2013-06-19 19:45:01 UTC (rev 151747)
+++ trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm	2013-06-19 20:05:33 UTC (rev 151748)
@@ -33,6 +33,7 @@
 #import "PluginProcessMessages.h"
 #import "WebKitSystemInterface.h"
 #import <WebCore/FileSystem.h>
+#import <WebCore/KURL.h>
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <spawn.h>
 #import <wtf/text/CString.h>
@@ -396,6 +397,40 @@
     [NSTask launchedTaskWithLaunchPath:launchPath arguments:argumentsArray.get()];
 }
 
+static bool isSilverlightPreferencesURL(const PluginProcessAttributes& pluginProcessAttributes, const String& urlString)
+{
+    NSURL *silverlightPreferencesURL = [NSURL fileURLWithPathComponents:[NSArray arrayWithObjects:(NSString *)pluginProcessAttributes.moduleInfo.path, @"Contents/Resources/Silverlight Preferences.app", nil]];
+
+    return [[NSURL URLWithString:urlString] isEqual:silverlightPreferencesURL];
+}
+
+static bool shouldOpenURL(const PluginProcessAttributes& pluginProcessAttributes, const String& urlString)
+{
+    if (pluginProcessAttributes.moduleInfo.bundleIdentifier == "com.microsoft.SilverlightPlugin")
+        return isSilverlightPreferencesURL(pluginProcessAttributes, urlString);
+
+    return false;
+}
+
+void PluginProcessProxy::openURL(const String& urlString, bool& result, int32_t& status, String& launchedURLString)
+{
+    if (!shouldOpenURL(m_pluginProcessAttributes, urlString)) {
+        result = false;
+        return;
+    }
+
+    result = true;
+    CFURLRef launchedURL;
+    status = LSOpenCFURLRef(KURL(ParsedURLString, urlString).createCFURL().get(), &launchedURL);
+
+    if (launchedURL) {
+        launchedURLString = KURL(launchedURL).string();
+        CFRelease(launchedURL);
+    }
+
+    result = false;
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PLUGIN_PROCESS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to