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

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
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 windowShell(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name); 468 windowShell(DOMWrapperWorld::mainWorld())->namedItemAdded(doc, name);
469 } 469 }
470 470
471 void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& n ame) 471 void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& n ame)
472 { 472 {
473 windowShell(DOMWrapperWorld::mainWorld())->namedItemRemoved(doc, name); 473 windowShell(DOMWrapperWorld::mainWorld())->namedItemRemoved(doc, name);
474 } 474 }
475 475
476 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso n) 476 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso n)
477 { 477 {
478 v8::Isolate* isolate = v8::Isolate::GetCurrent();
479 if (isolate->InContext() && ScriptState::current(isolate)->world().isBlinkIn JSIsolatedWorld())
480 return true;
481
478 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts)) { 482 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts)) {
479 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. 483 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
480 if (reason == AboutToExecuteScript) 484 if (reason == AboutToExecuteScript)
481 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."); 485 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.");
482 return false; 486 return false;
483 } 487 }
484 488
485 if (m_frame->document() && m_frame->document()->isViewSource()) { 489 if (m_frame->document() && m_frame->document()->isViewSource()) {
486 ASSERT(m_frame->document()->securityOrigin()->isUnique()); 490 ASSERT(m_frame->document()->securityOrigin()->isUnique());
487 return true; 491 return true;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 resultArray->Set(i, evaluationResult); 613 resultArray->Set(i, evaluationResult);
610 } 614 }
611 615
612 if (results) { 616 if (results) {
613 for (size_t i = 0; i < resultArray->Length(); ++i) 617 for (size_t i = 0; i < resultArray->Length(); ++i)
614 results->append(handleScope.Escape(resultArray->Get(i))); 618 results->append(handleScope.Escape(resultArray->Get(i)));
615 } 619 }
616 } 620 }
617 621
618 } // namespace WebCore 622 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698