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

Side by Side Diff: Source/bindings/core/v8/NPV8Object.cpp

Issue 648423003: Enforce ScriptForbiddenScope and make it non-fatal. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Getting ambitious Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 } 220 }
221 v8NpObject->v8Object.Reset(); 221 v8NpObject->v8Object.Reset();
222 v8NpObject->rootObject = 0; 222 v8NpObject->rootObject = 0;
223 } 223 }
224 224
225 } // namespace blink 225 } // namespace blink
226 226
227 bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV ariant* arguments, uint32_t argumentCount, NPVariant* result) 227 bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV ariant* arguments, uint32_t argumentCount, NPVariant* result)
228 { 228 {
229 ScriptForbiddenScope::AllowSuperUnsafeScript thisShouldBeRemoved;
230
231 if (!npObject) 229 if (!npObject)
232 return false; 230 return false;
233 231
234 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 232 v8::Isolate* isolate = v8::Isolate::GetCurrent();
235 233
236 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); 234 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
237 if (!v8NpObject) { 235 if (!v8NpObject) {
238 if (npObject->_class->invoke) 236 if (npObject->_class->invoke)
239 return npObject->_class->invoke(npObject, methodName, arguments, arg umentCount, result); 237 return npObject->_class->invoke(npObject, methodName, arguments, arg umentCount, result);
240 238
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (resultObject.IsEmpty()) 284 if (resultObject.IsEmpty())
287 return false; 285 return false;
288 286
289 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); 287 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
290 return true; 288 return true;
291 } 289 }
292 290
293 // FIXME: Fix it same as _NPN_Invoke (HandleScope and such). 291 // FIXME: Fix it same as _NPN_Invoke (HandleScope and such).
294 bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) 292 bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
295 { 293 {
296 ScriptForbiddenScope::AllowSuperUnsafeScript thisShouldBeRemoved;
297
298 if (!npObject) 294 if (!npObject)
299 return false; 295 return false;
300 296
301 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 297 v8::Isolate* isolate = v8::Isolate::GetCurrent();
302 298
303 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); 299 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
304 if (!v8NpObject) { 300 if (!v8NpObject) {
305 if (npObject->_class->invokeDefault) 301 if (npObject->_class->invokeDefault)
306 return npObject->_class->invokeDefault(npObject, arguments, argument Count, result); 302 return npObject->_class->invokeDefault(npObject, arguments, argument Count, result);
307 303
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 339
344 bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* r esult) 340 bool _NPN_Evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* r esult)
345 { 341 {
346 // FIXME: Give the embedder a way to control this. 342 // FIXME: Give the embedder a way to control this.
347 bool popupsAllowed = false; 343 bool popupsAllowed = false;
348 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result); 344 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result);
349 } 345 }
350 346
351 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri ng* npScript, NPVariant* result) 347 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri ng* npScript, NPVariant* result)
352 { 348 {
353 ScriptForbiddenScope::AllowSuperUnsafeScript thisShouldBeRemoved;
354
355 VOID_TO_NPVARIANT(*result); 349 VOID_TO_NPVARIANT(*result);
356 if (!npObject) 350 if (!npObject)
357 return false; 351 return false;
358 352
359 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); 353 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
360 if (!v8NpObject) 354 if (!v8NpObject)
361 return false; 355 return false;
362 356
363 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 357 v8::Isolate* isolate = v8::Isolate::GetCurrent();
364 ScriptState* scriptState = mainWorldScriptState(isolate, npp, npObject); 358 ScriptState* scriptState = mainWorldScriptState(isolate, npp, npObject);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 616
623 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); 617 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
624 return true; 618 return true;
625 } 619 }
626 620
627 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
628 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
629 623
630 return false; 624 return false;
631 } 625 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8RecursionScope.h » ('j') | Source/bindings/core/v8/V8RecursionScope.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698