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

Side by Side Diff: Source/bindings/v8/V8Initializer.cpp

Issue 19693006: Pass column as 4th argument to WorkerGlobalScope.onerror handler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8ErrorHandler.cpp ('k') | Source/bindings/v8/WorkerScriptController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); 88 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
89 RefPtr<ScriptCallStack> callStack; 89 RefPtr<ScriptCallStack> callStack;
90 // Currently stack trace is only collected when inspector is open. 90 // Currently stack trace is only collected when inspector is open.
91 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 91 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
92 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture); 92 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture);
93 93
94 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); 94 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
95 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g(); 95 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g();
96 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName); 96 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName);
97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), resource, callStack); 97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), message->GetStartColumn(), resource, callStack);
98 } 98 }
99 99
100 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 100 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
101 { 101 {
102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); 102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent());
103 if (!target) 103 if (!target)
104 return; 104 return;
105 DOMWindow* targetWindow = target->domWindow(); 105 DOMWindow* targetWindow = target->domWindow();
106 106
107 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console. 107 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Exceptions that occur in error handler should be ignored since in that ca se 161 // Exceptions that occur in error handler should be ignored since in that ca se
162 // WorkerGlobalScope::reportException will send the exception to the worker object. 162 // WorkerGlobalScope::reportException will send the exception to the worker object.
163 if (isReportingException) 163 if (isReportingException)
164 return; 164 return;
165 isReportingException = true; 165 isReportingException = true;
166 166
167 // During the frame teardown, there may not be a valid context. 167 // During the frame teardown, there may not be a valid context.
168 if (ScriptExecutionContext* context = getScriptExecutionContext()) { 168 if (ScriptExecutionContext* context = getScriptExecutionContext()) {
169 String errorMessage = toWebCoreString(message->Get()); 169 String errorMessage = toWebCoreString(message->Get());
170 int lineNumber = message->GetLineNumber(); 170 int lineNumber = message->GetLineNumber();
171 int columnNumber = message->GetStartColumn();
171 String sourceURL = toWebCoreString(message->GetScriptResourceName()); 172 String sourceURL = toWebCoreString(message->GetScriptResourceName());
172 context->reportException(errorMessage, lineNumber, sourceURL, 0); 173 context->reportException(errorMessage, lineNumber, columnNumber, sourceU RL, 0);
173 } 174 }
174 175
175 isReportingException = false; 176 isReportingException = false;
176 } 177 }
177 178
178 static const int kWorkerMaxStackSize = 500 * 1024; 179 static const int kWorkerMaxStackSize = 500 * 1024;
179 180
180 void V8Initializer::initializeWorker(v8::Isolate* isolate) 181 void V8Initializer::initializeWorker(v8::Isolate* isolate)
181 { 182 {
182 initializeV8Common(); 183 initializeV8Common();
183 184
184 v8::V8::AddMessageListener(messageHandlerInWorker); 185 v8::V8::AddMessageListener(messageHandlerInWorker);
185 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 186 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
186 187
187 v8::ResourceConstraints resourceConstraints; 188 v8::ResourceConstraints resourceConstraints;
188 uint32_t here; 189 uint32_t here;
189 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 190 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
190 v8::SetResourceConstraints(&resourceConstraints); 191 v8::SetResourceConstraints(&resourceConstraints);
191 192
192 V8PerIsolateData::ensureInitialized(isolate); 193 V8PerIsolateData::ensureInitialized(isolate);
193 } 194 }
194 195
195 } // namespace WebCore 196 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8ErrorHandler.cpp ('k') | Source/bindings/v8/WorkerScriptController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698