OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "core/dom/Node.h" | 52 #include "core/dom/Node.h" |
53 #include "core/dom/ScriptableDocumentParser.h" | 53 #include "core/dom/ScriptableDocumentParser.h" |
54 #include "core/events/Event.h" | 54 #include "core/events/Event.h" |
55 #include "core/events/EventListener.h" | 55 #include "core/events/EventListener.h" |
56 #include "core/frame/LocalDOMWindow.h" | 56 #include "core/frame/LocalDOMWindow.h" |
57 #include "core/frame/LocalFrame.h" | 57 #include "core/frame/LocalFrame.h" |
58 #include "core/frame/Settings.h" | 58 #include "core/frame/Settings.h" |
59 #include "core/frame/UseCounter.h" | 59 #include "core/frame/UseCounter.h" |
60 #include "core/frame/csp/ContentSecurityPolicy.h" | 60 #include "core/frame/csp/ContentSecurityPolicy.h" |
61 #include "core/html/HTMLPlugInElement.h" | 61 #include "core/html/HTMLPlugInElement.h" |
| 62 #include "core/inspector/ConsoleMessage.h" |
62 #include "core/inspector/InspectorInstrumentation.h" | 63 #include "core/inspector/InspectorInstrumentation.h" |
63 #include "core/inspector/InspectorTraceEvents.h" | 64 #include "core/inspector/InspectorTraceEvents.h" |
64 #include "core/inspector/ScriptCallStack.h" | 65 #include "core/inspector/ScriptCallStack.h" |
65 #include "core/loader/DocumentLoader.h" | 66 #include "core/loader/DocumentLoader.h" |
66 #include "core/loader/FrameLoader.h" | 67 #include "core/loader/FrameLoader.h" |
67 #include "core/loader/FrameLoaderClient.h" | 68 #include "core/loader/FrameLoaderClient.h" |
68 #include "core/plugins/PluginView.h" | 69 #include "core/plugins/PluginView.h" |
69 #include "platform/NotImplemented.h" | 70 #include "platform/NotImplemented.h" |
70 #include "platform/TraceEvent.h" | 71 #include "platform/TraceEvent.h" |
71 #include "platform/UserGestureIndicator.h" | 72 #include "platform/UserGestureIndicator.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
n) | 484 bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reaso
n) |
484 { | 485 { |
485 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if | 486 // For performance reasons, we check isInPrivateScriptIsolateWorld() only if |
486 // canExecuteScripts is going to return false. | 487 // canExecuteScripts is going to return false. |
487 | 488 |
488 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts))
{ | 489 if (m_frame->document() && m_frame->document()->isSandboxed(SandboxScripts))
{ |
489 if (isInPrivateScriptIsolateWorld(m_isolate)) | 490 if (isInPrivateScriptIsolateWorld(m_isolate)) |
490 return true; | 491 return true; |
491 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 492 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
492 if (reason == AboutToExecuteScript) | 493 if (reason == AboutToExecuteScript) |
493 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."); | 494 m_frame->document()->addConsoleMessage(ConsoleMessage::create(Securi
tyMessageSource, ErrorMessageLevel, "Blocked script execution in '" + m_frame->d
ocument()->url().elidedString() + "' because the document's frame is sandboxed a
nd the 'allow-scripts' permission is not set.")); |
494 return false; | 495 return false; |
495 } | 496 } |
496 | 497 |
497 if (m_frame->document() && m_frame->document()->isViewSource()) { | 498 if (m_frame->document() && m_frame->document()->isViewSource()) { |
498 ASSERT(m_frame->document()->securityOrigin()->isUnique()); | 499 ASSERT(m_frame->document()->securityOrigin()->isUnique()); |
499 return true; | 500 return true; |
500 } | 501 } |
501 | 502 |
502 Settings* settings = m_frame->settings(); | 503 Settings* settings = m_frame->settings(); |
503 const bool allowed = m_frame->loader().client()->allowScript(settings && set
tings->scriptEnabled()) | 504 const bool allowed = m_frame->loader().client()->allowScript(settings && set
tings->scriptEnabled()) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 resultArray->Set(i, evaluationResult); | 623 resultArray->Set(i, evaluationResult); |
623 } | 624 } |
624 | 625 |
625 if (results) { | 626 if (results) { |
626 for (size_t i = 0; i < resultArray->Length(); ++i) | 627 for (size_t i = 0; i < resultArray->Length(); ++i) |
627 results->append(handleScope.Escape(resultArray->Get(i))); | 628 results->append(handleScope.Escape(resultArray->Get(i))); |
628 } | 629 } |
629 } | 630 } |
630 | 631 |
631 } // namespace WebCore | 632 } // namespace WebCore |
OLD | NEW |