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

Unified Diff: webkit/port/bindings/v8/np_v8object.cpp

Issue 6562: This fixes http://code.google.com/p/chromium/issues/detail?id=2472, which... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 | « third_party/npapi/bindings/npruntime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/port/bindings/v8/np_v8object.cpp
===================================================================
--- webkit/port/bindings/v8/np_v8object.cpp (revision 2981)
+++ webkit/port/bindings/v8/np_v8object.cpp (working copy)
@@ -41,6 +41,7 @@
#include "v8_np_utils.h"
#include "v8_proxy.h"
#include "DOMWindow.h"
+#include "glue/plugins/plugin_instance.h"
using WebCore::V8ClassIndex;
using WebCore::V8Proxy;
@@ -242,6 +243,20 @@
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *npscript,
NPVariant *result) {
+ bool popups_allowed = false;
+
+ if (npp) {
+ NPAPI::PluginInstance* plugin_instance =
+ reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata);
+ if (plugin_instance)
+ popups_allowed = plugin_instance->popups_allowed();
+ }
+
+ return NPN_EvaluateHelper(npp, popups_allowed, npobj, npscript, result);
+}
+
+bool NPN_EvaluateHelper(NPP npp, bool popups_allowed, NPObject *npobj,
+ NPString *npscript, NPVariant *result) {
VOID_TO_NPVARIANT(*result);
if (npobj == NULL)
return false;
@@ -257,7 +272,13 @@
v8::Context::Scope scope(context);
- WebCore::String filename("npscript");
+ // Passing in a NULL filename is the trick used in V8 to indicate
+ // user gesture. See the inline_code/setInlineCode functions in V8Proxy
+ // for more information.
+ WebCore::String filename;
+ if (!popups_allowed)
+ filename = "npscript";
+
// Convert UTF-8 stream to WebCore::String.
WebCore::String script = WebCore::String::fromUTF8(
npscript->UTF8Characters, npscript->UTF8Length);
« no previous file with comments | « third_party/npapi/bindings/npruntime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698