Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2643)

Unified Diff: content/plugin/plugin_main_mac.mm

Issue 303293002: Initialize the bootstrap sandbox in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename constant Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/sandbox_type_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/plugin/plugin_main_mac.mm
diff --git a/content/plugin/plugin_main_mac.mm b/content/plugin/plugin_main_mac.mm
index 91deed83dab84c0674cee18c95b74ce4c4a5d98b..557deb76e53a4229ebaab45cc233c7812b28df6b 100644
--- a/content/plugin/plugin_main_mac.mm
+++ b/content/plugin/plugin_main_mac.mm
@@ -3,11 +3,14 @@
// found in the LICENSE file.
#import <AppKit/AppKit.h>
+#include <servers/bootstrap.h>
#include "base/environment.h"
+#include "base/mac/mach_logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "content/common/plugin_carbon_interpose_constants_mac.h"
+#include "content/common/sandbox_init_mac.h"
#include "content/plugin/plugin_interpose_util_mac.h"
#include "content/public/common/content_client.h"
@@ -46,6 +49,27 @@ void TrimInterposeEnvironment() {
#endif
void InitializeChromeApplication() {
+ // The bootstrap sandbox has taken over the bootstrap port. However, NPAPI
+ // plugins request servers with the BOOTSTRAP_PER_PID_SERVICE flag. This
+ // will fail, since the browser will be forwarding the message on behalf of
+ // the plugin, and the browser has already created these per-pid services
+ // for itself.
+ //
+ // Instead, request the real bootstrap port from the sandbox server, which
+ // can then be used by the plugin.
+ mach_port_t new_bootstrap_port = MACH_PORT_NULL;
+ kern_return_t kr = bootstrap_look_up(bootstrap_port,
+ kBootstrapPortNameForNPAPIPlugins, &new_bootstrap_port);
+ BOOTSTRAP_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
+ << "Failed to look up original bootstrap port.";
+ if (kr == KERN_SUCCESS) {
+ bootstrap_port = new_bootstrap_port;
+ kr = task_set_bootstrap_port(mach_task_self(), new_bootstrap_port);
+ MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
+ << "Failed to reset TASK_BOOTSTRAP_PORT.";
+ }
+
+
[NSApplication sharedApplication];
mac_plugin_interposing::SetUpCocoaInterposing();
}
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/sandbox_type_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698