| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/worklet/WorkletGlobalScope.h" | 5 #include "modules/worklet/WorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 8 #include "core/frame/FrameConsole.h" | 8 #include "core/frame/FrameConsole.h" |
| 9 #include "core/inspector/InspectorInstrumentation.h" | 9 #include "core/inspector/InspectorInstrumentation.h" |
| 10 #include "core/inspector/MainThreadDebugger.h" | 10 #include "core/inspector/MainThreadDebugger.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return true; | 60 return true; |
| 61 errorMessage = getSecurityOrigin()->isPotentiallyTrustworthyErrorMessage(); | 61 errorMessage = getSecurityOrigin()->isPotentiallyTrustworthyErrorMessage(); |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void WorkletGlobalScope::reportBlockedScriptExecutionToInspector(const String& d
irectiveText) | 65 void WorkletGlobalScope::reportBlockedScriptExecutionToInspector(const String& d
irectiveText) |
| 66 { | 66 { |
| 67 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 67 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WorkletGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage
> prpConsoleMessage) | 70 void WorkletGlobalScope::addConsoleMessage(RawPtr<ConsoleMessage> prpConsoleMess
age) |
| 71 { | 71 { |
| 72 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 72 RawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
| 73 frame()->console().addMessage(consoleMessage.release()); | 73 frame()->console().addMessage(consoleMessage.release()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, int s
criptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<S
criptCallStack> callStack) | 76 void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, int s
criptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<S
criptCallStack> callStack) |
| 77 { | 77 { |
| 78 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, columnNu
mber); | 78 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSour
ce, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, columnNumber); |
| 79 consoleMessage->setScriptId(scriptId); | 79 consoleMessage->setScriptId(scriptId); |
| 80 consoleMessage->setCallStack(callStack); | 80 consoleMessage->setCallStack(callStack); |
| 81 addConsoleMessage(consoleMessage.release()); | 81 addConsoleMessage(consoleMessage.release()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const | 84 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const |
| 85 { | 85 { |
| 86 // Always return a null URL when passed a null string. | 86 // Always return a null URL when passed a null string. |
| 87 // TODO(ikilpatrick): Should we change the KURL constructor to have this | 87 // TODO(ikilpatrick): Should we change the KURL constructor to have this |
| 88 // behavior? | 88 // behavior? |
| 89 if (url.isNull()) | 89 if (url.isNull()) |
| 90 return KURL(); | 90 return KURL(); |
| 91 // Always use UTF-8 in Worklets. | 91 // Always use UTF-8 in Worklets. |
| 92 return KURL(m_url, url); | 92 return KURL(m_url, url); |
| 93 } | 93 } |
| 94 | 94 |
| 95 DEFINE_TRACE(WorkletGlobalScope) | 95 DEFINE_TRACE(WorkletGlobalScope) |
| 96 { | 96 { |
| 97 visitor->trace(m_scriptController); | 97 visitor->trace(m_scriptController); |
| 98 visitor->trace(m_console); | 98 visitor->trace(m_console); |
| 99 ExecutionContext::trace(visitor); | 99 ExecutionContext::trace(visitor); |
| 100 SecurityContext::trace(visitor); | 100 SecurityContext::trace(visitor); |
| 101 MainThreadWorkletGlobalScope::trace(visitor); | 101 MainThreadWorkletGlobalScope::trace(visitor); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |