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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 2566823002: Remove deprecated ExceptionState constructors. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "bindings/core/v8/PrivateScriptRunner.h" 5 #include "bindings/core/v8/PrivateScriptRunner.h"
6 6
7 #include "bindings/core/v8/DOMWrapperWorld.h" 7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/core/v8/V8PerContextData.h" 10 #include "bindings/core/v8/V8PerContextData.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 messageString = toCoreString(v8::Local<v8::String>::Cast(message)); 325 messageString = toCoreString(v8::Local<v8::String>::Cast(message));
326 326
327 String exceptionName = toCoreString(v8::Local<v8::String>::Cast(name)); 327 String exceptionName = toCoreString(v8::Local<v8::String>::Cast(name));
328 if (exceptionName == "PrivateScriptException") { 328 if (exceptionName == "PrivateScriptException") {
329 v8::Local<v8::Value> code = 329 v8::Local<v8::Value> code =
330 exceptionObject->Get(context, v8String(isolate, "code")) 330 exceptionObject->Get(context, v8String(isolate, "code"))
331 .ToLocalChecked(); 331 .ToLocalChecked();
332 RELEASE_ASSERT(code->IsInt32()); 332 RELEASE_ASSERT(code->IsInt32());
333 int exceptionCode = code.As<v8::Int32>()->Value(); 333 int exceptionCode = code.As<v8::Int32>()->Value();
334 ScriptState::Scope scope(scriptStateInUserScript); 334 ScriptState::Scope scope(scriptStateInUserScript);
335 ExceptionState exceptionState(errorContext, propertyName, interfaceName, 335 ExceptionState exceptionState(scriptStateInUserScript->isolate(),
336 context->Global(), 336 errorContext, interfaceName, propertyName);
337 scriptStateInUserScript->isolate());
338 exceptionState.throwDOMException(exceptionCode, messageString); 337 exceptionState.throwDOMException(exceptionCode, messageString);
339 return; 338 return;
340 } 339 }
341 340
342 // Standard JS errors thrown by a private script are treated as real errors 341 // Standard JS errors thrown by a private script are treated as real errors
343 // of the private script and crash the renderer, except for a stack overflow 342 // of the private script and crash the renderer, except for a stack overflow
344 // error. A stack overflow error can happen in a valid private script 343 // error. A stack overflow error can happen in a valid private script
345 // if user's script can create a recursion that involves the private script. 344 // if user's script can create a recursion that involves the private script.
346 if (exceptionName == "RangeError" && 345 if (exceptionName == "RangeError" &&
347 messageString.contains("Maximum call stack size exceeded")) { 346 messageString.contains("Maximum call stack size exceeded")) {
348 ScriptState::Scope scope(scriptStateInUserScript); 347 ScriptState::Scope scope(scriptStateInUserScript);
349 ExceptionState exceptionState(errorContext, propertyName, interfaceName, 348 ExceptionState exceptionState(scriptStateInUserScript->isolate(),
350 scriptStateInUserScript->context()->Global(), 349 errorContext, interfaceName, propertyName);
351 scriptStateInUserScript->isolate());
352 exceptionState.throwDOMException(V8RangeError, messageString); 350 exceptionState.throwDOMException(V8RangeError, messageString);
353 return; 351 return;
354 } 352 }
355 353
356 dumpV8Message(context, tryCatchMessage); 354 dumpV8Message(context, tryCatchMessage);
357 LOG(FATAL) << "Private script error: " << exceptionName.utf8().data() 355 LOG(FATAL) << "Private script error: " << exceptionName.utf8().data()
358 << " was thrown."; 356 << " was thrown.";
359 } 357 }
360 358
361 } // namespace 359 } // namespace
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 rethrowExceptionInPrivateScript( 481 rethrowExceptionInPrivateScript(
484 scriptState->isolate(), block, scriptStateInUserScript, 482 scriptState->isolate(), block, scriptStateInUserScript,
485 ExceptionState::ExecutionContext, methodName, className); 483 ExceptionState::ExecutionContext, methodName, className);
486 block.ReThrow(); 484 block.ReThrow();
487 return v8::Local<v8::Value>(); 485 return v8::Local<v8::Value>();
488 } 486 }
489 return result; 487 return result;
490 } 488 }
491 489
492 } // namespace blink 490 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698