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

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

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 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 * 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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPreprocessor.cpp » ('j') | Source/core/dom/ExecutionContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698