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

Side by Side Diff: Source/bindings/v8/ScriptController.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/bindings/v8/PrivateScriptTest.js ('k') | Source/bindings/v8/V8EventListener.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 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 windowShell(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); 469 windowShell(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name);
470 } 470 }
471 471
472 void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& n ame) 472 void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& n ame)
473 { 473 {
474 windowShell(DOMWrapperWorld::mainWorld())->namedItemRemoved(doc, name); 474 windowShell(DOMWrapperWorld::mainWorld())->namedItemRemoved(doc, name);
475 } 475 }
476 476
477 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso n) 477 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso n)
478 { 478 {
479 v8::Isolate* isolate = v8::Isolate::GetCurrent();
480 if (isolate->InContext() && ScriptState::current(isolate)->world().isPrivate ScriptIsolatedWorld())
481 return true;
482
479 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts)) { 483 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts)) {
480 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. 484 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
481 if (reason == AboutToExecuteScript) 485 if (reason == AboutToExecuteScript)
482 m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorM essageLevel, "Blocked script execution in '" + m_frame->document()->url().elided String() + "' because the document's frame is sandboxed and the 'allow-scripts' permission is not set."); 486 m_frame->document()->addConsoleMessage(SecurityMessageSource, ErrorM essageLevel, "Blocked script execution in '" + m_frame->document()->url().elided String() + "' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.");
483 return false; 487 return false;
484 } 488 }
485 489
486 if (m_frame->document() && m_frame->document()->isViewSource()) { 490 if (m_frame->document() && m_frame->document()->isViewSource()) {
487 ASSERT(m_frame->document()->securityOrigin()->isUnique()); 491 ASSERT(m_frame->document()->securityOrigin()->isUnique());
488 return true; 492 return true;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 resultArray->Set(i, evaluationResult); 614 resultArray->Set(i, evaluationResult);
611 } 615 }
612 616
613 if (results) { 617 if (results) {
614 for (size_t i = 0; i < resultArray->Length(); ++i) 618 for (size_t i = 0; i < resultArray->Length(); ++i)
615 results->append(handleScope.Escape(resultArray->Get(i))); 619 results->append(handleScope.Escape(resultArray->Get(i)));
616 } 620 }
617 } 621 }
618 622
619 } // namespace WebCore 623 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/PrivateScriptTest.js ('k') | Source/bindings/v8/V8EventListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698