diff options
Diffstat (limited to 'chromium/ppapi')
7 files changed, 19 insertions, 81 deletions
diff --git a/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc index 0928c05f2ce..12d3c10d19c 100644 --- a/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc +++ b/chromium/ppapi/native_client/src/trusted/plugin/json_manifest.cc @@ -173,15 +173,6 @@ bool IsValidUrlSpec(const Json::Value& url_spec, urlSpecPlusOptional = kPnaclUrlSpecPlusOptional; urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kPnaclUrlSpecPlusOptional); } else { - // URL specifications must not contain "pnacl-translate" keys. - // This prohibits NaCl clients from invoking PNaCl. - if (url_spec.isMember(kPnaclTranslateKey)) { - nacl::stringstream error_stream; - error_stream << "PNaCl-like NMF with application/x-nacl mimetype instead " - << "of x-pnacl mimetype (has " << kPnaclTranslateKey << ")."; - *error_string = error_stream.str(); - return false; - } urlSpecPlusOptional = kManifestUrlSpecRequired; urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kManifestUrlSpecRequired); } @@ -193,6 +184,16 @@ bool IsValidUrlSpec(const Json::Value& url_spec, error_string)) { return false; } + // URL specifications must not contain "pnacl-translate" keys. + // This prohibits NaCl clients from invoking PNaCl. + Json::Value translate = url_spec[kPnaclTranslateKey]; + if (!translate.empty()) { + nacl::stringstream error_stream; + error_stream << parent_key << " property '" << container_key << + "' has '" << kPnaclTranslateKey << "' inside URL spec."; + *error_string = error_stream.str(); + return false; + } // Verify the correct types of the fields if they exist. Json::Value url = url_spec[kUrlKey]; if (!url.isString()) { diff --git a/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py b/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py index fb9644326b9..513a091605c 100755 --- a/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py +++ b/chromium/ppapi/native_client/tools/browser_tester/browser_tester.py @@ -138,10 +138,6 @@ def BuildArgParser(): parser.add_option('--enable_crash_reporter', dest='enable_crash_reporter', action='store_true', default=False, help='Force crash reporting on.') - parser.add_option('--enable_sockets', dest='enable_sockets', - action='store_true', default=False, - help='Pass --allow-nacl-socket-api=<host> to Chrome, where ' - '<host> is the name of the browser tester\'s web server.') return parser @@ -246,7 +242,7 @@ def RunTestsOnce(url, options): full_url = 'http://%s:%d/%s' % (host, port, url) if len(options.test_args) > 0: full_url += '?' + urllib.urlencode(options.test_args) - browser.Run(full_url, host, port) + browser.Run(full_url, port) server.TestingBegun(0.125) # In Python 2.5, server.handle_request may block indefinitely. Serving pages diff --git a/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py b/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py index 29a6897287b..256a1cb37f9 100755 --- a/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py +++ b/chromium/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py @@ -9,7 +9,6 @@ import shutil import sys import tempfile import time -import urlparse import browserprocess @@ -106,7 +105,7 @@ class BrowserLauncher(object): def CreateProfile(self): raise NotImplementedError - def MakeCmd(self, url, host, port): + def MakeCmd(self, url): raise NotImplementedError def CreateToolLogDir(self): @@ -206,12 +205,12 @@ class BrowserLauncher(object): def GetReturnCode(self): return self.browser_process.GetReturnCode() - def Run(self, url, host, port): + def Run(self, url, port): self.binary = EscapeSpaces(self.FindBinary()) self.profile = self.CreateProfile() if self.options.tool is not None: self.tool_log_dir = self.CreateToolLogDir() - cmd = self.MakeCmd(url, host, port) + cmd = self.MakeCmd(url, port) self.Launch(cmd, MakeEnv(self.options)) @@ -263,7 +262,7 @@ class ChromeLauncher(BrowserLauncher): def NetLogName(self): return os.path.join(self.profile, 'netlog.json') - def MakeCmd(self, url, host, port): + def MakeCmd(self, url, port): cmd = [self.binary, # Note that we do not use "--enable-logging" here because # it actually turns off logging to the Buildbot logs on @@ -290,8 +289,7 @@ class ChromeLauncher(BrowserLauncher): # blacklisted port. To work around this, the tester whitelists # whatever port it is using. '--explicitly-allowed-ports=%d' % port, - '--user-data-dir=%s' % self.profile, - '--allow-nacl-socket-api=%s' % host] + '--user-data-dir=%s' % self.profile] # Log network requests to assist debugging. cmd.append('--log-net-log=%s' % self.NetLogName()) if self.options.ppapi_plugin is None: @@ -337,8 +335,6 @@ class ChromeLauncher(BrowserLauncher): '--log-file=%s/log.%%p' % (self.tool_log_dir,)] + cmd elif self.options.tool != None: raise LaunchFailure('Invalid tool name "%s"' % (self.options.tool,)) - if self.options.enable_sockets: - cmd.append('--allow-nacl-socket-api=%s' % host) cmd.extend(self.options.browser_flags) cmd.append(url) return cmd diff --git a/chromium/ppapi/proxy/plugin_resource_tracker.cc b/chromium/ppapi/proxy/plugin_resource_tracker.cc index 86cbf7cee43..12e9d3faf6a 100644 --- a/chromium/ppapi/proxy/plugin_resource_tracker.cc +++ b/chromium/ppapi/proxy/plugin_resource_tracker.cc @@ -18,7 +18,6 @@ namespace ppapi { namespace proxy { PluginResourceTracker::PluginResourceTracker() : ResourceTracker(THREAD_SAFE) { - UseOddResourceValueInDebugMode(); } PluginResourceTracker::~PluginResourceTracker() { diff --git a/chromium/ppapi/shared_impl/id_assignment.h b/chromium/ppapi/shared_impl/id_assignment.h index 3bacac3829f..039e7fed4ca 100644 --- a/chromium/ppapi/shared_impl/id_assignment.h +++ b/chromium/ppapi/shared_impl/id_assignment.h @@ -26,7 +26,7 @@ PPAPI_SHARED_EXPORT extern const unsigned int kPPIdTypeBits; extern const int32 kMaxPPId; -// The least significant bits are the type, the rest are the value. +// The most significant bits are the type, the rest are the value. template <typename T> inline T MakeTypedId(T value, PPIdType type) { return (value << kPPIdTypeBits) | static_cast<T>(type); } diff --git a/chromium/ppapi/shared_impl/resource_tracker.cc b/chromium/ppapi/shared_impl/resource_tracker.cc index 36aa2e142dc..5d7d01ad7ab 100644 --- a/chromium/ppapi/shared_impl/resource_tracker.cc +++ b/chromium/ppapi/shared_impl/resource_tracker.cc @@ -44,9 +44,6 @@ void ResourceTracker::AddRefResource(PP_Resource res) { CheckThreadingPreconditions(); DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE)) << res << " is not a PP_Resource."; - - DCHECK(CanOperateOnResource(res)); - ResourceMap::iterator i = live_resources_.find(res); if (i == live_resources_.end()) return; @@ -69,9 +66,6 @@ void ResourceTracker::ReleaseResource(PP_Resource res) { CheckThreadingPreconditions(); DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE)) << res << " is not a PP_Resource."; - - DCHECK(CanOperateOnResource(res)); - ResourceMap::iterator i = live_resources_.find(res); if (i == live_resources_.end()) return; @@ -172,23 +166,15 @@ int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const { return static_cast<int>(found->second->resources.size()); } -void ResourceTracker::UseOddResourceValueInDebugMode() { -#if !defined(NDEBUG) - DCHECK_EQ(0, last_resource_value_); - - ++last_resource_value_; -#endif -} - PP_Resource ResourceTracker::AddResource(Resource* object) { CheckThreadingPreconditions(); // If the plugin manages to create too many resources, don't do crazy stuff. - if (last_resource_value_ >= kMaxPPId) + if (last_resource_value_ == kMaxPPId) return 0; // Allocate an ID. Note there's a rare error condition below that means we // could end up not using |new_id|, but that's harmless. - PP_Resource new_id = MakeTypedId(GetNextResourceValue(), PP_ID_TYPE_RESOURCE); + PP_Resource new_id = MakeTypedId(++last_resource_value_, PP_ID_TYPE_RESOURCE); // Some objects have a 0 instance, meaning they aren't associated with any // instance, so they won't be in |instance_map_|. This is (as of this writing) @@ -243,31 +229,4 @@ void ResourceTracker::LastPluginRefWasDeleted(Resource* object) { object->NotifyLastPluginRefWasDeleted(); } -int32 ResourceTracker::GetNextResourceValue() { -#if defined(NDEBUG) - return ++last_resource_value_; -#else - // In debug mode, the least significant bit indicates which side (renderer - // or plugin process) created the resource. Increment by 2 so it's always the - // same. - last_resource_value_ += 2; - return last_resource_value_; -#endif -} - -bool ResourceTracker::CanOperateOnResource(PP_Resource res) { -#if defined(NDEBUG) - return true; -#else - // The invalid PP_Resource value could appear at both sides. - if (res == 0) - return true; - - // Skipping the type bits, the least significant bit of |res| should be the - // same as that of |last_resource_value_|. - return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1); -#endif - -} - } // namespace ppapi diff --git a/chromium/ppapi/shared_impl/resource_tracker.h b/chromium/ppapi/shared_impl/resource_tracker.h index b1228d2bbac..2ba43b8bb5a 100644 --- a/chromium/ppapi/shared_impl/resource_tracker.h +++ b/chromium/ppapi/shared_impl/resource_tracker.h @@ -63,14 +63,6 @@ class PPAPI_SHARED_EXPORT ResourceTracker { // plugin side, make sure we have the proxy lock. void CheckThreadingPreconditions() const; - // This method is called by PluginResourceTracker's constructor so that in - // debug mode PP_Resources from the plugin process always have odd values - // (ignoring the type bits), while PP_Resources from the renderer process have - // even values. - // This allows us to check that resource refs aren't added or released on the - // wrong side. - void UseOddResourceValueInDebugMode(); - // Adds the given resource to the tracker, associating it with the instance // stored in the resource object. The new resource ID is returned, and the // resource will have 0 plugin refcount. This is called by the resource @@ -88,11 +80,6 @@ class PPAPI_SHARED_EXPORT ResourceTracker { // cancels pending callbacks for the resource. void LastPluginRefWasDeleted(Resource* object); - int32 GetNextResourceValue(); - - // In debug mode, checks whether |res| comes from the same resource tracker. - bool CanOperateOnResource(PP_Resource res); - typedef std::set<PP_Resource> ResourceSet; struct InstanceData { |