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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); | 96 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); |
97 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); | 97 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); |
98 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to
WebCoreString(resourceName); | 98 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to
WebCoreString(resourceName); |
99 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, messag
e->GetLineNumber(), message->GetStartColumn()); | 99 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, messag
e->GetLineNumber(), message->GetStartColumn()); |
100 v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>
(), v8::Isolate::GetCurrent()); | 100 v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>
(), v8::Isolate::GetCurrent()); |
101 if (!wrappedEvent.IsEmpty()) { | 101 if (!wrappedEvent.IsEmpty()) { |
102 ASSERT(wrappedEvent->IsObject()); | 102 ASSERT(wrappedEvent->IsObject()); |
103 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenProper
tyName::error(), data); | 103 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenProper
tyName::error(), data); |
104 } | 104 } |
105 firstWindow->document()->reportException(event.release(), callStack); | 105 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr
ossOrigin : NotSharableCrossOrigin; |
| 106 firstWindow->document()->reportException(event.release(), callStack, corsSta
tus); |
106 } | 107 } |
107 | 108 |
108 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) | 109 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8
::AccessType type, v8::Local<v8::Value> data) |
109 { | 110 { |
110 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); | 111 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); |
111 if (!target) | 112 if (!target) |
112 return; | 113 return; |
113 DOMWindow* targetWindow = target->domWindow(); | 114 DOMWindow* targetWindow = target->domWindow(); |
114 | 115 |
115 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessage(a
ctiveDOMWindow()), v8::Isolate::GetCurrent()); | 116 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessage(a
ctiveDOMWindow()), v8::Isolate::GetCurrent()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // During the frame teardown, there may not be a valid context. | 171 // During the frame teardown, there may not be a valid context. |
171 if (ScriptExecutionContext* context = getScriptExecutionContext()) { | 172 if (ScriptExecutionContext* context = getScriptExecutionContext()) { |
172 String errorMessage = toWebCoreString(message->Get()); | 173 String errorMessage = toWebCoreString(message->Get()); |
173 String sourceURL = toWebCoreString(message->GetScriptResourceName()); | 174 String sourceURL = toWebCoreString(message->GetScriptResourceName()); |
174 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, m
essage->GetLineNumber(), message->GetStartColumn()); | 175 RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, m
essage->GetLineNumber(), message->GetStartColumn()); |
175 v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Obj
ect>(), v8::Isolate::GetCurrent()); | 176 v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Obj
ect>(), v8::Isolate::GetCurrent()); |
176 if (!wrappedEvent.IsEmpty()) { | 177 if (!wrappedEvent.IsEmpty()) { |
177 ASSERT(wrappedEvent->IsObject()); | 178 ASSERT(wrappedEvent->IsObject()); |
178 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPr
opertyName::error(), data); | 179 v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPr
opertyName::error(), data); |
179 } | 180 } |
180 context->reportException(event.release(), 0); | 181 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? Sharab
leCrossOrigin : NotSharableCrossOrigin; |
| 182 context->reportException(event.release(), 0, corsStatus); |
181 } | 183 } |
182 | 184 |
183 isReportingException = false; | 185 isReportingException = false; |
184 } | 186 } |
185 | 187 |
186 static const int kWorkerMaxStackSize = 500 * 1024; | 188 static const int kWorkerMaxStackSize = 500 * 1024; |
187 | 189 |
188 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 190 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
189 { | 191 { |
190 initializeV8Common(); | 192 initializeV8Common(); |
191 | 193 |
192 v8::V8::AddMessageListener(messageHandlerInWorker); | 194 v8::V8::AddMessageListener(messageHandlerInWorker); |
193 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 195 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
194 | 196 |
195 v8::ResourceConstraints resourceConstraints; | 197 v8::ResourceConstraints resourceConstraints; |
196 uint32_t here; | 198 uint32_t here; |
197 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 199 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
198 v8::SetResourceConstraints(&resourceConstraints); | 200 v8::SetResourceConstraints(&resourceConstraints); |
199 | 201 |
200 V8PerIsolateData::ensureInitialized(isolate); | 202 V8PerIsolateData::ensureInitialized(isolate); |
201 } | 203 } |
202 | 204 |
203 } // namespace WebCore | 205 } // namespace WebCore |
OLD | NEW |