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

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

Issue 2796653003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 2) (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 v8::Local<v8::Value> ScriptController::evaluateScriptInMainWorld( 300 v8::Local<v8::Value> ScriptController::evaluateScriptInMainWorld(
301 const ScriptSourceCode& sourceCode, 301 const ScriptSourceCode& sourceCode,
302 AccessControlStatus accessControlStatus, 302 AccessControlStatus accessControlStatus,
303 ExecuteScriptPolicy policy) { 303 ExecuteScriptPolicy policy) {
304 if (policy == DoNotExecuteScriptWhenScriptsDisabled && 304 if (policy == DoNotExecuteScriptWhenScriptsDisabled &&
305 !frame()->document()->canExecuteScripts(AboutToExecuteScript)) 305 !frame()->document()->canExecuteScripts(AboutToExecuteScript))
306 return v8::Local<v8::Value>(); 306 return v8::Local<v8::Value>();
307 307
308 // TODO(dcheng): Clean this up to not use ScriptState, to match 308 // TODO(dcheng): Clean this up to not use ScriptState, to match
309 // executeScriptInIsolatedWorld. 309 // executeScriptInIsolatedWorld.
310 ScriptState* scriptState = ScriptState::forMainWorld(frame()); 310 ScriptState* scriptState = toScriptStateForMainWorld(frame());
311 if (!scriptState) 311 if (!scriptState)
312 return v8::Local<v8::Value>(); 312 return v8::Local<v8::Value>();
313 v8::EscapableHandleScope handleScope(isolate()); 313 v8::EscapableHandleScope handleScope(isolate());
314 ScriptState::Scope scope(scriptState); 314 ScriptState::Scope scope(scriptState);
315 315
316 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument()) 316 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument())
317 frame()->loader().didAccessInitialDocument(); 317 frame()->loader().didAccessInitialDocument();
318 318
319 v8::Local<v8::Value> object = executeScriptAndReturnValue( 319 v8::Local<v8::Value> object = executeScriptAndReturnValue(
320 scriptState->context(), sourceCode, accessControlStatus); 320 scriptState->context(), sourceCode, accessControlStatus);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 for (size_t i = 0; i < resultArray->Length(); ++i) { 358 for (size_t i = 0; i < resultArray->Length(); ++i) {
359 v8::Local<v8::Value> value; 359 v8::Local<v8::Value> value;
360 if (!resultArray->Get(context, i).ToLocal(&value)) 360 if (!resultArray->Get(context, i).ToLocal(&value))
361 return; 361 return;
362 results->push_back(value); 362 results->push_back(value);
363 } 363 }
364 } 364 }
365 } 365 }
366 366
367 } // namespace blink 367 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698