Changeset 76224 in webkit
- Timestamp:
- Jan 20, 2011 4:31:18 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76221 r76224 1 2010-12-14 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 [V8] Get rid of delayed exception reporting in V8ConsoleMessage.cpp 6 https://bugs.webkit.org/show_bug.cgi?id=51044 7 8 * WebCore.gypi: 9 * bindings/v8/V8ConsoleMessage.cpp: Removed. 10 * bindings/v8/V8ConsoleMessage.h: Removed. 11 * bindings/v8/V8DOMWindowShell.cpp: 12 (WebCore::v8UncaughtExceptionHandler): 13 (WebCore::reportUnsafeJavaScriptAccess): 14 (WebCore::V8DOMWindowShell::initContextIfNeeded): 15 * bindings/v8/V8Proxy.cpp: 16 (WebCore::addMessageToConsole): 17 (WebCore::logInfo): 18 (WebCore::V8Proxy::reportUnsafeAccessTo): 19 (WebCore::V8Proxy::runScript): 20 (WebCore::V8Proxy::callFunction): 21 (WebCore::V8Proxy::newInstance): 22 * bindings/v8/V8Proxy.h: 23 * bindings/v8/WorkerContextExecutionProxy.cpp: 24 * bindings/v8/specialization/V8BindingState.cpp: 25 (WebCore::::immediatelyReportUnsafeAccessTo): 26 1 27 2011-01-19 MORITA Hajime <morrita@google.com> 2 28 -
trunk/Source/WebCore/WebCore.gypi
r76216 r76224 950 950 'bindings/v8/V8Collection.cpp', 951 951 'bindings/v8/V8Collection.h', 952 'bindings/v8/V8ConsoleMessage.cpp',953 'bindings/v8/V8ConsoleMessage.h',954 952 'bindings/v8/V8DataGridDataSource.cpp', 955 953 'bindings/v8/V8DataGridDataSource.h', -
trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
r76207 r76224 40 40 #include "Page.h" 41 41 #include "PageGroup.h" 42 #include "ScriptCallStack.h" 43 #include "ScriptCallStackFactory.h" 42 44 #include "ScriptController.h" 43 45 #include "StorageNamespace.h" … … 45 47 #include "V8BindingState.h" 46 48 #include "V8Collection.h" 47 #include "V8ConsoleMessage.h"48 49 #include "V8DOMMap.h" 49 50 #include "V8DOMWindow.h" … … 91 92 } 92 93 94 static void v8UncaughtExceptionHandler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data) 95 { 96 // Use the frame where JavaScript is called from. 97 Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); 98 if (!frame) 99 return; 100 101 v8::Handle<v8::String> errorMessageString = message->Get(); 102 ASSERT(!errorMessageString.IsEmpty()); 103 String errorMessage = toWebCoreString(errorMessageString); 104 105 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); 106 RefPtr<ScriptCallStack> callStack; 107 // Currently stack trace is only collected when inspector is open. 108 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 109 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); 110 111 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); 112 bool useURL = resourceName.IsEmpty() || !resourceName->IsString(); 113 Document* document = frame->document(); 114 String resourceNameString = useURL ? document->url() : toWebCoreString(resourceName); 115 document->reportException(errorMessage, message->GetLineNumber(), resourceNameString, callStack); 116 } 117 93 118 // Returns the owner frame pointer of a DOM wrapper object. It only works for 94 119 // these DOM objects requiring cross-domain access check. … … 118 143 Frame* target = getTargetFrame(host, data); 119 144 if (target) 120 V8Proxy::reportUnsafeAccessTo(target , V8Proxy::ReportLater);145 V8Proxy::reportUnsafeAccessTo(target); 121 146 } 122 147 … … 263 288 v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); 264 289 265 v8::V8::AddMessageListener(& V8ConsoleMessage::handler);290 v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); 266 291 267 292 v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r73605 r76224 51 51 #include "V8BindingState.h" 52 52 #include "V8Collection.h" 53 #include "V8ConsoleMessage.h"54 53 #include "V8DOMCoreException.h" 55 54 #include "V8DOMMap.h" … … 132 131 bool AllowAllocation::m_current = false; 133 132 133 static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber) 134 { 135 ASSERT(page); 136 Console* console = page->mainFrame()->domWindow()->console(); 137 console->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, lineNumber, sourceID); 138 } 139 134 140 void logInfo(Frame* frame, const String& message, const String& url) 135 141 { … … 137 143 if (!page) 138 144 return; 139 V8ConsoleMessage consoleMessage(message, url, 0); 140 consoleMessage.dispatchNow(page); 141 } 142 143 enum DelayReporting { 144 ReportLater, 145 ReportNow 146 }; 147 148 void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay) 145 addMessageToConsole(page, message, url, 0); 146 } 147 148 void V8Proxy::reportUnsafeAccessTo(Frame* target) 149 149 { 150 150 ASSERT(target); … … 167 167 const String kSourceID = ""; 168 168 const int kLineNumber = 1; 169 V8ConsoleMessage message(str, kSourceID, kLineNumber); 170 171 if (delay == ReportNow) { 172 // NOTE: Safari prints the message in the target page, but it seems like 173 // it should be in the source page. Even for delayed messages, we put it in 174 // the source page; see V8ConsoleMessage::processDelayed(). 175 message.dispatchNow(source->page()); 176 } else { 177 ASSERT(delay == ReportLater); 178 // We cannot safely report the message eagerly, because this may cause 179 // allocations and GCs internally in V8 and we cannot handle that at this 180 // point. Therefore we delay the reporting. 181 message.dispatchLater(); 182 } 169 170 // NOTE: Safari prints the message in the target page, but it seems like 171 // it should be in the source page. Even for delayed messages, we put it in 172 // the source page. 173 addMessageToConsole(source->page(), str, kSourceID, kLineNumber); 183 174 } 184 175 … … 413 404 v8::Local<v8::Value> result; 414 405 { 415 V8ConsoleMessage::Scope scope;416 417 406 // See comment in V8Proxy::callFunction. 418 407 m_frame->keepAlive(); … … 447 436 v8::Local<v8::Value> result; 448 437 { 449 V8ConsoleMessage::Scope scope;450 451 438 if (m_recursion >= kMaxRecursionDepth) { 452 439 v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')"); … … 512 499 v8::Local<v8::Value> result; 513 500 { 514 V8ConsoleMessage::Scope scope;515 516 501 // See comment in V8Proxy::callFunction. 517 502 m_frame->keepAlive(); … … 775 760 } 776 761 777 void V8Proxy::processConsoleMessages()778 {779 V8ConsoleMessage::processDelayed();780 }781 782 762 void V8Proxy::registerExtensionWithV8(v8::Extension* extension) 783 763 { -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r72387 r76224 133 133 }; 134 134 135 // When to report errors.136 enum DelayReporting {137 ReportLater,138 ReportNow139 };140 141 135 explicit V8Proxy(Frame*); 142 136 … … 264 258 static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*); 265 259 266 // Process any pending JavaScript console messages.267 static void processConsoleMessages();268 269 260 v8::Local<v8::Context> context(); 270 261 v8::Local<v8::Context> mainWorldContext(); … … 287 278 288 279 // Report an unsafe attempt to access the given frame on the console. 289 static void reportUnsafeAccessTo(Frame* target , DelayReporting delay);280 static void reportUnsafeAccessTo(Frame* target); 290 281 291 282 private: -
trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
r76216 r76224 42 42 #include "SharedWorkerContext.h" 43 43 #include "V8Binding.h" 44 #include "V8ConsoleMessage.h"45 44 #include "V8DOMMap.h" 46 45 #include "V8DedicatedWorkerContext.h" -
trunk/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp
r74449 r76224 82 82 void State<V8Binding>::immediatelyReportUnsafeAccessTo(Frame* target) 83 83 { 84 V8Proxy::reportUnsafeAccessTo(target , V8Proxy::ReportNow);84 V8Proxy::reportUnsafeAccessTo(target); 85 85 } 86 86 -
trunk/Source/WebKit/chromium/ChangeLog
r76216 r76224 1 2010-12-14 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 [V8] Get rid of delayed exception reporting in V8ConsoleMessage.cpp 6 https://bugs.webkit.org/show_bug.cgi?id=51044 7 8 * src/ChromeClientImpl.cpp: 9 (WebKit::ChromeClientImpl::runJavaScriptAlert): 10 * src/WebScriptController.cpp: 11 (WebKit::WebScriptController::flushConsoleMessages): 12 1 13 2010-12-27 Yury Semikhatsky <yurys@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp
r76198 r76224 437 437 { 438 438 if (m_webView->client()) { 439 #if USE(V8)440 // Before showing the JavaScript dialog, we give the proxy implementation441 // a chance to process any pending console messages.442 V8Proxy::processConsoleMessages();443 #endif444 439 m_webView->client()->runModalAlertDialog( 445 440 WebFrameImpl::fromFrame(frame), message); -
trunk/Source/WebKit/chromium/src/WebScriptController.cpp
r68666 r76224 55 55 void WebScriptController::flushConsoleMessages() 56 56 { 57 WebCore::V8Proxy::processConsoleMessages();57 // FIXME: remove this method after all it's usages are gone. 58 58 } 59 59
Note: See TracChangeset
for help on using the changeset viewer.