OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. |
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
34 #include "bindings/core/v8/V8GCController.h" | 34 #include "bindings/core/v8/V8GCController.h" |
35 #include "bindings/core/v8/V8NPUtils.h" | 35 #include "bindings/core/v8/V8NPUtils.h" |
36 #include "bindings/core/v8/V8ObjectConstructor.h" | 36 #include "bindings/core/v8/V8ObjectConstructor.h" |
37 #include "bindings/core/v8/V8ScriptRunner.h" | 37 #include "bindings/core/v8/V8ScriptRunner.h" |
38 #include "bindings/core/v8/WrapperTypeInfo.h" | 38 #include "bindings/core/v8/WrapperTypeInfo.h" |
39 #include "bindings/core/v8/npruntime_impl.h" | 39 #include "bindings/core/v8/npruntime_impl.h" |
40 #include "bindings/core/v8/npruntime_priv.h" | 40 #include "bindings/core/v8/npruntime_priv.h" |
41 #include "core/frame/LocalDOMWindow.h" | 41 #include "core/frame/LocalDOMWindow.h" |
42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 43 #include "platform/ScriptForbiddenScope.h" |
43 #include "platform/UserGestureIndicator.h" | 44 #include "platform/UserGestureIndicator.h" |
44 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
45 #include "wtf/StringExtras.h" | 46 #include "wtf/StringExtras.h" |
46 #include "wtf/text/WTFString.h" | 47 #include "wtf/text/WTFString.h" |
47 #include <stdio.h> | 48 #include <stdio.h> |
48 | 49 |
49 using namespace blink; | 50 using namespace blink; |
50 | 51 |
51 namespace blink { | 52 namespace blink { |
52 | 53 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* r
esult) | 336 bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* r
esult) |
336 { | 337 { |
337 // FIXME: Give the embedder a way to control this. | 338 // FIXME: Give the embedder a way to control this. |
338 bool popupsAllowed = false; | 339 bool popupsAllowed = false; |
339 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result); | 340 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result); |
340 } | 341 } |
341 | 342 |
342 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
ng* npScript, NPVariant* result) | 343 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
ng* npScript, NPVariant* result) |
343 { | 344 { |
344 VOID_TO_NPVARIANT(*result); | 345 VOID_TO_NPVARIANT(*result); |
| 346 if (ScriptForbiddenScope::isScriptForbidden()) |
| 347 return false; |
| 348 |
345 if (!npObject) | 349 if (!npObject) |
346 return false; | 350 return false; |
347 | 351 |
348 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); | 352 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); |
349 if (!v8NpObject) | 353 if (!v8NpObject) |
350 return false; | 354 return false; |
351 | 355 |
352 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 356 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
353 ScriptState* scriptState = mainWorldScriptState(isolate, npp, npObject); | 357 ScriptState* scriptState = mainWorldScriptState(isolate, npp, npObject); |
354 if (!scriptState) | 358 if (!scriptState) |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 615 |
612 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); | 616 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); |
613 return true; | 617 return true; |
614 } | 618 } |
615 | 619 |
616 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 620 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
617 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 621 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
618 | 622 |
619 return false; | 623 return false; |
620 } | 624 } |
OLD | NEW |