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

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

Issue 2386173002: reflow comments in Source/bindings/core/v8 (Closed)
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple 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 are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 const V8Extensions& extensions = registeredExtensions(); 250 const V8Extensions& extensions = registeredExtensions();
251 for (size_t i = 0; i < extensions.size(); ++i) { 251 for (size_t i = 0; i < extensions.size(); ++i) {
252 if (extensions[i] == extension) 252 if (extensions[i] == extension)
253 return; 253 return;
254 } 254 }
255 v8::RegisterExtension(extension); 255 v8::RegisterExtension(extension);
256 registeredExtensions().append(extension); 256 registeredExtensions().append(extension);
257 } 257 }
258 258
259 void ScriptController::clearWindowProxy() { 259 void ScriptController::clearWindowProxy() {
260 // V8 binding expects ScriptController::clearWindowProxy only be called 260 // V8 binding expects ScriptController::clearWindowProxy only be called when a
261 // when a frame is loading a new page. This creates a new context for the new page. 261 // frame is loading a new page. This creates a new context for the new page.
262 m_windowProxyManager->clearForNavigation(); 262 m_windowProxyManager->clearForNavigation();
263 MainThreadDebugger::instance()->didClearContextsForFrame(frame()); 263 MainThreadDebugger::instance()->didClearContextsForFrame(frame());
264 } 264 }
265 265
266 void ScriptController::collectIsolatedContexts( 266 void ScriptController::collectIsolatedContexts(
267 Vector<std::pair<ScriptState*, SecurityOrigin*>>& result) { 267 Vector<std::pair<ScriptState*, SecurityOrigin*>>& result) {
268 m_windowProxyManager->collectIsolatedContexts(result); 268 m_windowProxyManager->collectIsolatedContexts(result);
269 } 269 }
270 270
271 void ScriptController::updateDocument() { 271 void ScriptController::updateDocument() {
272 // For an uninitialized main window windowProxy, do not incur the cost of cont ext initialization. 272 // For an uninitialized main window windowProxy, do not incur the cost of
273 // context initialization.
273 if (!m_windowProxyManager->mainWorldProxy()->isGlobalInitialized()) 274 if (!m_windowProxyManager->mainWorldProxy()->isGlobalInitialized())
274 return; 275 return;
275 276
276 if (!initializeMainWorld()) 277 if (!initializeMainWorld())
277 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument(); 278 windowProxy(DOMWrapperWorld::mainWorld())->updateDocument();
278 } 279 }
279 280
280 void ScriptController::namedItemAdded(HTMLDocument* doc, 281 void ScriptController::namedItemAdded(HTMLDocument* doc,
281 const AtomicString& name) { 282 const AtomicString& name) {
282 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); 283 windowProxy(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name);
(...skipping 11 matching lines...) Expand all
294 } 295 }
295 296
296 bool ScriptController::canExecuteScripts( 297 bool ScriptController::canExecuteScripts(
297 ReasonForCallingCanExecuteScripts reason) { 298 ReasonForCallingCanExecuteScripts reason) {
298 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if 299 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if
299 // canExecuteScripts is going to return false. 300 // canExecuteScripts is going to return false.
300 301
301 if (frame()->document() && frame()->document()->isSandboxed(SandboxScripts)) { 302 if (frame()->document() && frame()->document()->isSandboxed(SandboxScripts)) {
302 if (isInPrivateScriptIsolateWorld(isolate())) 303 if (isInPrivateScriptIsolateWorld(isolate()))
303 return true; 304 return true;
304 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. 305 // FIXME: This message should be moved off the console once a solution to
306 // https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
305 if (reason == AboutToExecuteScript) 307 if (reason == AboutToExecuteScript)
306 frame()->document()->addConsoleMessage(ConsoleMessage::create( 308 frame()->document()->addConsoleMessage(ConsoleMessage::create(
307 SecurityMessageSource, ErrorMessageLevel, 309 SecurityMessageSource, ErrorMessageLevel,
308 "Blocked script execution in '" + 310 "Blocked script execution in '" +
309 frame()->document()->url().elidedString() + 311 frame()->document()->url().elidedString() +
310 "' because the document's frame is sandboxed and the " 312 "' because the document's frame is sandboxed and the "
311 "'allow-scripts' permission is not set.")); 313 "'allow-scripts' permission is not set."));
312 return false; 314 return false;
313 } 315 }
314 316
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 for (size_t i = 0; i < resultArray->Length(); ++i) { 464 for (size_t i = 0; i < resultArray->Length(); ++i) {
463 v8::Local<v8::Value> value; 465 v8::Local<v8::Value> value;
464 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 466 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
465 return; 467 return;
466 results->append(value); 468 results->append(value);
467 } 469 }
468 } 470 }
469 } 471 }
470 472
471 } // namespace blink 473 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698