| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/v8/ScriptCallStackFactory.h" | 35 #include "bindings/v8/ScriptCallStackFactory.h" |
| 36 #include "bindings/v8/ScriptController.h" | 36 #include "bindings/v8/ScriptController.h" |
| 37 #include "bindings/v8/ScriptProfiler.h" | 37 #include "bindings/v8/ScriptProfiler.h" |
| 38 #include "bindings/v8/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
| 39 #include "bindings/v8/V8ErrorHandler.h" | 39 #include "bindings/v8/V8ErrorHandler.h" |
| 40 #include "bindings/v8/V8GCController.h" | 40 #include "bindings/v8/V8GCController.h" |
| 41 #include "bindings/v8/V8PerContextData.h" | 41 #include "bindings/v8/V8PerContextData.h" |
| 42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
| 43 #include "core/dom/ExceptionCode.h" | 43 #include "core/dom/ExceptionCode.h" |
| 44 #include "core/frame/ConsoleTypes.h" | 44 #include "core/frame/ConsoleTypes.h" |
| 45 #include "core/frame/DOMWindow.h" | 45 #include "core/frame/LocalDOMWindow.h" |
| 46 #include "core/frame/LocalFrame.h" | 46 #include "core/frame/LocalFrame.h" |
| 47 #include "core/frame/csp/ContentSecurityPolicy.h" | 47 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 48 #include "core/inspector/ScriptCallStack.h" | 48 #include "core/inspector/ScriptCallStack.h" |
| 49 #include "platform/TraceEvent.h" | 49 #include "platform/TraceEvent.h" |
| 50 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
| 51 #include "wtf/RefPtr.h" | 51 #include "wtf/RefPtr.h" |
| 52 #include "wtf/text/WTFString.h" | 52 #include "wtf/text/WTFString.h" |
| 53 #include <v8-debug.h> | 53 #include <v8-debug.h> |
| 54 | 54 |
| 55 namespace WebCore { | 55 namespace WebCore { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 { | 87 { |
| 88 ASSERT(isMainThread()); | 88 ASSERT(isMainThread()); |
| 89 // It's possible that messageHandlerInMainThread() is invoked while we're in
itializing a window. | 89 // It's possible that messageHandlerInMainThread() is invoked while we're in
itializing a window. |
| 90 // In that half-baked situation, we don't have a valid context nor a valid w
orld, | 90 // In that half-baked situation, we don't have a valid context nor a valid w
orld, |
| 91 // so just return immediately. | 91 // so just return immediately. |
| 92 if (DOMWrapperWorld::windowIsBeingInitialized()) | 92 if (DOMWrapperWorld::windowIsBeingInitialized()) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 95 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 96 // If called during context initialization, there will be no entered window. | 96 // If called during context initialization, there will be no entered window. |
| 97 DOMWindow* enteredWindow = enteredDOMWindow(isolate); | 97 LocalDOMWindow* enteredWindow = enteredDOMWindow(isolate); |
| 98 if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame()) | 98 if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame()) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 String errorMessage = toCoreString(message->Get()); | 101 String errorMessage = toCoreString(message->Get()); |
| 102 | 102 |
| 103 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); | 103 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 104 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; | 104 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; |
| 105 // Currently stack trace is only collected when inspector is open. | 105 // Currently stack trace is only collected when inspector is open. |
| 106 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) | 106 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| 107 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt
ackSizeToCapture, isolate); | 107 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt
ackSizeToCapture, isolate); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 132 } | 132 } |
| 133 enteredWindow->document()->reportException(event.release(), callStack, corsS
tatus); | 133 enteredWindow->document()->reportException(event.release(), callStack, corsS
tatus); |
| 134 } | 134 } |
| 135 | 135 |
| 136 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) | 136 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) |
| 137 { | 137 { |
| 138 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 138 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 139 LocalFrame* target = findFrame(host, data, isolate); | 139 LocalFrame* target = findFrame(host, data, isolate); |
| 140 if (!target) | 140 if (!target) |
| 141 return; | 141 return; |
| 142 DOMWindow* targetWindow = target->domWindow(); | 142 LocalDOMWindow* targetWindow = target->domWindow(); |
| 143 | 143 |
| 144 // FIXME: We should modify V8 to pass in more contextual information (contex
t, property, and object). | 144 // FIXME: We should modify V8 to pass in more contextual information (contex
t, property, and object). |
| 145 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate-
>GetCurrentContext()->Global(), isolate); | 145 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate-
>GetCurrentContext()->Global(), isolate); |
| 146 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa
ge(callingDOMWindow(isolate))); | 146 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr
rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa
ge(callingDOMWindow(isolate))); |
| 147 exceptionState.throwIfNeeded(); | 147 exceptionState.throwIfNeeded(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte
xt) | 150 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte
xt) |
| 151 { | 151 { |
| 152 if (ExecutionContext* executionContext = toExecutionContext(context)) { | 152 if (ExecutionContext* executionContext = toExecutionContext(context)) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 v8::V8::AddMessageListener(messageHandlerInWorker); | 242 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 243 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 243 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 244 | 244 |
| 245 v8::ResourceConstraints resourceConstraints; | 245 v8::ResourceConstraints resourceConstraints; |
| 246 uint32_t here; | 246 uint32_t here; |
| 247 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 247 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
| 248 v8::SetResourceConstraints(isolate, &resourceConstraints); | 248 v8::SetResourceConstraints(isolate, &resourceConstraints); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace WebCore | 251 } // namespace WebCore |
| OLD | NEW |