OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google 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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 #include "core/workers/WorkerLocation.h" | 53 #include "core/workers/WorkerLocation.h" |
54 #include "core/workers/WorkerNavigator.h" | 54 #include "core/workers/WorkerNavigator.h" |
55 #include "core/workers/WorkerReportingProxy.h" | 55 #include "core/workers/WorkerReportingProxy.h" |
56 #include "core/workers/WorkerScriptLoader.h" | 56 #include "core/workers/WorkerScriptLoader.h" |
57 #include "core/workers/WorkerThread.h" | 57 #include "core/workers/WorkerThread.h" |
58 #include "platform/network/ContentSecurityPolicyParsers.h" | 58 #include "platform/network/ContentSecurityPolicyParsers.h" |
59 #include "platform/weborigin/KURL.h" | 59 #include "platform/weborigin/KURL.h" |
60 #include "platform/weborigin/SecurityOrigin.h" | 60 #include "platform/weborigin/SecurityOrigin.h" |
61 #include "public/platform/WebURLRequest.h" | 61 #include "public/platform/WebURLRequest.h" |
62 | 62 |
63 namespace { | |
64 unsigned long createWorkerExceptionUniqueIdentifier() | |
65 { | |
66 static unsigned long s_workerExceptionUniqueIdentifier = 0; | |
67 return ++s_workerExceptionUniqueIdentifier; | |
68 } | |
69 } | |
70 | |
63 namespace blink { | 71 namespace blink { |
64 | 72 |
65 class CloseWorkerGlobalScopeTask : public ExecutionContextTask { | 73 class CloseWorkerGlobalScopeTask : public ExecutionContextTask { |
66 public: | 74 public: |
67 static PassOwnPtr<CloseWorkerGlobalScopeTask> create() | 75 static PassOwnPtr<CloseWorkerGlobalScopeTask> create() |
68 { | 76 { |
69 return adoptPtr(new CloseWorkerGlobalScopeTask); | 77 return adoptPtr(new CloseWorkerGlobalScopeTask); |
70 } | 78 } |
71 | 79 |
72 virtual void performTask(ExecutionContext *context) | 80 virtual void performTask(ExecutionContext *context) |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 return; | 268 return; |
261 } | 269 } |
262 } | 270 } |
263 } | 271 } |
264 | 272 |
265 EventTarget* WorkerGlobalScope::errorEventTarget() | 273 EventTarget* WorkerGlobalScope::errorEventTarget() |
266 { | 274 { |
267 return this; | 275 return this; |
268 } | 276 } |
269 | 277 |
270 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack>) | 278 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack) |
271 { | 279 { |
272 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL); | 280 unsigned long exceptionId = createWorkerExceptionUniqueIdentifier(); |
281 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | |
282 consoleMessage->setCallStack(callStack); | |
283 m_pendingMessages.set(exceptionId, consoleMessage); | |
284 | |
285 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL, exceptionId); | |
273 } | 286 } |
274 | 287 |
275 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText) | 288 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText) |
276 { | 289 { |
277 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 290 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
278 } | 291 } |
279 | 292 |
280 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage) | 293 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage) |
281 { | 294 { |
282 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 295 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const | 335 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const |
323 { | 336 { |
324 // FIXME: How should we count features for shared/service workers? | 337 // FIXME: How should we count features for shared/service workers? |
325 } | 338 } |
326 | 339 |
327 ConsoleMessageStorage* WorkerGlobalScope::messageStorage() | 340 ConsoleMessageStorage* WorkerGlobalScope::messageStorage() |
328 { | 341 { |
329 return m_messageStorage.get(); | 342 return m_messageStorage.get(); |
330 } | 343 } |
331 | 344 |
345 void WorkerGlobalScope::exceptionHandled(int exceptionId, bool isHandled) | |
346 { | |
347 RefPtr<ConsoleMessage> consoleMessage = m_pendingMessages.take(exceptionId); | |
348 if (!isHandled) { | |
349 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); | |
350 addMessageToWorkerConsole(consoleMessage.release()); | |
vsevik
2014/12/01 15:06:03
Let's call addConsoleMessage instead.
kozy
2014/12/01 16:17:05
Done.
| |
351 } | |
352 } | |
353 | |
332 void WorkerGlobalScope::trace(Visitor* visitor) | 354 void WorkerGlobalScope::trace(Visitor* visitor) |
333 { | 355 { |
334 #if ENABLE(OILPAN) | 356 #if ENABLE(OILPAN) |
335 visitor->trace(m_console); | 357 visitor->trace(m_console); |
336 visitor->trace(m_location); | 358 visitor->trace(m_location); |
337 visitor->trace(m_navigator); | 359 visitor->trace(m_navigator); |
338 visitor->trace(m_workerInspectorController); | 360 visitor->trace(m_workerInspectorController); |
339 visitor->trace(m_eventQueue); | 361 visitor->trace(m_eventQueue); |
340 visitor->trace(m_workerClients); | 362 visitor->trace(m_workerClients); |
341 visitor->trace(m_messageStorage); | 363 visitor->trace(m_messageStorage); |
342 HeapSupplementable<WorkerGlobalScope>::trace(visitor); | 364 HeapSupplementable<WorkerGlobalScope>::trace(visitor); |
343 #endif | 365 #endif |
344 ExecutionContext::trace(visitor); | 366 ExecutionContext::trace(visitor); |
345 EventTargetWithInlineData::trace(visitor); | 367 EventTargetWithInlineData::trace(visitor); |
346 } | 368 } |
347 | 369 |
348 } // namespace blink | 370 } // namespace blink |
OLD | NEW |