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

Side by Side Diff: content/common/npobject_util.cc

Issue 8576001: Chromium does not throw the exception message by calling NPN_SetException from NPAPI plugin Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/npobject_proxy.cc ('k') | content/common/plugin_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/npobject_util.h" 5 #include "content/common/npobject_util.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "content/common/np_channel_base.h" 8 #include "content/common/np_channel_base.h"
9 #include "content/common/npobject_proxy.h" 9 #include "content/common/npobject_proxy.h"
10 #include "content/common/plugin_messages.h" 10 #include "content/common/plugin_messages.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 NPString *script, 80 NPString *script,
81 NPVariant *result) { 81 NPVariant *result) {
82 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result); 82 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result);
83 } 83 }
84 84
85 85
86 static void NPN_SetExceptionPatch(NPObject *obj, const NPUTF8 *message) { 86 static void NPN_SetExceptionPatch(NPObject *obj, const NPUTF8 *message) {
87 std::string message_str(message); 87 std::string message_str(message);
88 if (IsPluginProcess()) { 88 if (IsPluginProcess()) {
89 NPChannelBase* renderer_channel = NPChannelBase::GetCurrentChannel(); 89 NPChannelBase* renderer_channel = NPChannelBase::GetCurrentChannel();
90 if (renderer_channel) 90 if (renderer_channel) {
91 renderer_channel->Send(new PluginHostMsg_SetException(message_str)); 91 if (obj->_class != NPObjectProxy::npclass()) {
92 int route_id = MSG_ROUTING_NONE;
93 // Determine the route id of NPObjectProxy instance in renderer process
94 // It is the same as the route id of NPObjectStub instance in plugin
95 // process.
96 route_id = renderer_channel->GetExistingRouteForNPObjectStub(obj);
97 renderer_channel->Send(new NPObjectMsg_SetException(route_id,
98 message_str));
99 } else {
100 renderer_channel->Send(new PluginHostMsg_SetException(message_str));
101 }
102 }
92 } else { 103 } else {
93 WebBindings::setException(obj, message_str.c_str()); 104 WebBindings::setException(obj, message_str.c_str());
94 } 105 }
95 } 106 }
96 107
97 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj, 108 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj,
98 NPIdentifier **identifier, uint32_t *count) { 109 NPIdentifier **identifier, uint32_t *count) {
99 return NPObjectProxy::NPNEnumerate(obj, identifier, count); 110 return NPObjectProxy::NPNEnumerate(obj, identifier, count);
100 } 111 }
101 112
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 result->type = NPVariantType_Object; 290 result->type = NPVariantType_Object;
280 result->value.objectValue = npobject_base->GetUnderlyingNPObject(); 291 result->value.objectValue = npobject_base->GetUnderlyingNPObject();
281 WebBindings::retainObject(result->value.objectValue); 292 WebBindings::retainObject(result->value.objectValue);
282 break; 293 break;
283 } 294 }
284 default: 295 default:
285 NOTREACHED(); 296 NOTREACHED();
286 } 297 }
287 return true; 298 return true;
288 } 299 }
OLDNEW
« no previous file with comments | « content/common/npobject_proxy.cc ('k') | content/common/plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698