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

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

Issue 686103005: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (exception && !exception->messageForConsole().isEmpty()) 137 if (exception && !exception->messageForConsole().isEmpty())
138 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo rConsole()); 138 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo rConsole());
139 } 139 }
140 } 140 }
141 141
142 // This method might be called while we're creating a new context. In this c ase, we 142 // This method might be called while we're creating a new context. In this c ase, we
143 // avoid storing the exception object, as we can't create a wrapper during c ontext creation. 143 // avoid storing the exception object, as we can't create a wrapper during c ontext creation.
144 // FIXME: Can we even get here during initialization now that we bail out wh en GetEntered returns an empty handle? 144 // FIXME: Can we even get here during initialization now that we bail out wh en GetEntered returns an empty handle?
145 LocalFrame* frame = enteredWindow->document()->frame(); 145 LocalFrame* frame = enteredWindow->document()->frame();
146 if (frame && frame->script().existingWindowProxy(scriptState->world())) { 146 if (frame && frame->script().existingWindowProxy(scriptState->world())) {
147 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scr iptState->context()->Global(), isolate); 147 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get(), data, scriptState->context()->Global());
148 } 148 }
149 149
150 if (scriptState->world().isPrivateScriptIsolatedWorld()) { 150 if (scriptState->world().isPrivateScriptIsolatedWorld()) {
151 // We allow a private script to dispatch error events even in a EventDis patchForbiddenScope scope. 151 // We allow a private script to dispatch error events even in a EventDis patchForbiddenScope scope.
152 // Without having this ability, it's hard to debug the private script be cause syntax errors 152 // Without having this ability, it's hard to debug the private script be cause syntax errors
153 // in the private script are not reported to console (the private script just crashes silently). 153 // in the private script are not reported to console (the private script just crashes silently).
154 // Allowing error events in private scripts is safe because error events don't propagate to 154 // Allowing error events in private scripts is safe because error events don't propagate to
155 // other isolated worlds (which means that the error events won't fire a ny event listeners 155 // other isolated worlds (which means that the error events won't fire a ny event listeners
156 // in user's scripts). 156 // in user's scripts).
157 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; 157 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 String errorMessage = toCoreString(message->Get()); 412 String errorMessage = toCoreString(message->Get());
413 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin(). ResourceName()); 413 TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin(). ResourceName());
414 int scriptId = message->GetScriptOrigin().ScriptID()->Value(); 414 int scriptId = message->GetScriptOrigin().ScriptID()->Value();
415 415
416 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW orld::current(isolate)); 416 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, message->GetLineNumber(), message->GetStartColumn() + 1, &DOMWrapperW orld::current(isolate));
417 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab leCrossOrigin : NotSharableCrossOrigin; 417 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab leCrossOrigin : NotSharableCrossOrigin;
418 418
419 // If execution termination has been triggered as part of constructing 419 // If execution termination has been triggered as part of constructing
420 // the error event from the v8::Message, quietly leave. 420 // the error event from the v8::Message, quietly leave.
421 if (!v8::V8::IsExecutionTerminating(isolate)) { 421 if (!v8::V8::IsExecutionTerminating(isolate)) {
422 V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, scriptState->context()->Global(), isolate); 422 V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get (), data, scriptState->context()->Global());
423 context->reportException(event.release(), scriptId, nullptr, corsSta tus); 423 context->reportException(event.release(), scriptId, nullptr, corsSta tus);
424 } 424 }
425 } 425 }
426 426
427 perIsolateData->setReportingException(false); 427 perIsolateData->setReportingException(false);
428 } 428 }
429 429
430 static const int kWorkerMaxStackSize = 500 * 1024; 430 static const int kWorkerMaxStackSize = 500 * 1024;
431 431
432 void V8Initializer::initializeWorker(v8::Isolate* isolate) 432 void V8Initializer::initializeWorker(v8::Isolate* isolate)
433 { 433 {
434 initializeV8Common(isolate); 434 initializeV8Common(isolate);
435 435
436 v8::V8::AddMessageListener(messageHandlerInWorker); 436 v8::V8::AddMessageListener(messageHandlerInWorker);
437 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 437 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
438 438
439 uint32_t here; 439 uint32_t here;
440 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 440 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
441 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 441 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
442 } 442 }
443 443
444 } // namespace blink 444 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8ErrorHandler.cpp ('k') | Source/bindings/core/v8/WorkerScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698