Changeset 35253 in webkit
- Timestamp:
- Jul 20, 2008 5:43:22 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r35250 r35253 1 2008-07-20 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Mark Rowe. 4 5 Add layout test to check correctly handling of exceptions in callback by WebCore. 6 Update existing test results for higher fidelity output. 7 8 * fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt: 9 * fast/js/exceptions-thrown-in-callbacks-expected.txt: Added. 10 * fast/js/exceptions-thrown-in-callbacks.html: Added. 11 * fast/xpath/nsresolver-exception-expected.txt: 12 * fast/xsl/transform-xhr-doc-expected.txt: 13 * http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write-expected.txt: 14 * http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url-expected.txt: 15 * http/tests/security/aboutBlank/xss-DENIED-set-opener-expected.txt: 16 * platform/mac/fast/dynamic/015-expected.txt: 17 * platform/mac/fast/events/updateLayoutForHitTest-expected.txt: 18 * platform/mac/tables/mozilla_expected_failures/bugs/bug92868_1-expected.txt: 19 * platform/mac/tables/mozilla_expected_failures/dom/appendCells1-expected.txt: 20 * platform/mac/tables/mozilla_expected_failures/dom/appendCellsRebuild1-expected.txt: 21 * platform/mac/tables/mozilla_expected_failures/dom/insertTbodyExpand1-expected.txt: 22 * platform/mac/tables/mozilla_expected_failures/dom/insertTbodyRebuild1-expected.txt: 23 * storage/transaction_callback_exception_crash-expected.txt: 24 1 25 2008-07-19 Oliver Hunt <oliver@apple.com> 2 26 -
trunk/LayoutTests/fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt
r33023 r35253 1 CONSOLE MESSAGE: line 7: NOT_FOUND_ERR: DOM Exception 81 CONSOLE MESSAGE: line 7: Error: NOT_FOUND_ERR: DOM Exception 8 2 2 This passes if it does not crash. (see https://bugs.webkit.org/show_bug.cgi?id=18958) -
trunk/LayoutTests/fast/xpath/nsresolver-exception-expected.txt
r33979 r35253 1 CONSOLE MESSAGE: line 14: this is an exception1 CONSOLE MESSAGE: line 14: Error: this is an exception 2 2 SUCCESS -
trunk/LayoutTests/fast/xsl/transform-xhr-doc-expected.txt
r35245 r35253 1 CONSOLE MESSAGE: line 20: Result of expression 'doc' [undefined] is not an object.1 CONSOLE MESSAGE: line 20: TypeError: Result of expression 'doc' [undefined] is not an object. 2 2 Test for bug 10313: xsl:import doesn't work in stylesheets loaded via XMLHttpRequest. 3 3 -
trunk/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write-expected.txt
r35245 r35253 1 1 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/innocent-victim-with-notify.html from frame with URL about:blank. Domains, protocols and ports must match. 2 2 3 CONSOLE MESSAGE: line 1: Result of expression 'target.document' [undefined] is not an object.3 CONSOLE MESSAGE: line 1: TypeError: Result of expression 'target.document' [undefined] is not an object. 4 4 This page opens a window to "", injects malicious code, and then navigates its opener to the victim. The opened window then tries to scripts its opener after document.writeing a new document. 5 5 Code injected into window: -
trunk/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url-expected.txt
r35245 r35253 1 1 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/innocent-victim-with-notify.html from frame with URL http://127.0.0.1:8000/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html. Domains, protocols and ports must match. 2 2 3 CONSOLE MESSAGE: line 1: Result of expression 'target.document' [undefined] is not an object.3 CONSOLE MESSAGE: line 1: TypeError: Result of expression 'target.document' [undefined] is not an object. 4 4 This page opens a window to "", injects malicious code, and then navigates its opener to the victim. The opened window then tries to scripts its opener after reloading itself as a javascript URL. 5 5 Code injected into window: -
trunk/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener-expected.txt
r35245 r35253 3 3 CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/innocent-victim.html from frame with URL about:blank. Domains, protocols and ports must match. 4 4 5 CONSOLE MESSAGE: line 1: Result of expression 'target.document' [undefined] is not an object.5 CONSOLE MESSAGE: line 1: TypeError: Result of expression 'target.document' [undefined] is not an object. 6 6 This page opens a window to "", injects malicious code, and then uses window.open.call to set its opener to the victim. The opened window then tries to scripts its opener. 7 7 Code injected into window: -
trunk/LayoutTests/platform/mac/fast/dynamic/015-expected.txt
r25970 r35253 1 CONSOLE MESSAGE: line 16: INDEX_SIZE_ERR: DOM Exception 11 CONSOLE MESSAGE: line 16: Error: INDEX_SIZE_ERR: DOM Exception 1 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/fast/events/updateLayoutForHitTest-expected.txt
r35245 r35253 1 CONSOLE MESSAGE: line 36: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object.2 CONSOLE MESSAGE: line 40: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object.3 CONSOLE MESSAGE: line 36: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object.4 CONSOLE MESSAGE: line 40: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object.1 CONSOLE MESSAGE: line 36: TypeError: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object. 2 CONSOLE MESSAGE: line 40: TypeError: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object. 3 CONSOLE MESSAGE: line 36: TypeError: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object. 4 CONSOLE MESSAGE: line 40: TypeError: Result of expression 'triangleSpan.nextSibling.nextSibling.nextSibling.nextSibling' [null] is not an object. 5 5 layer at (0,0) size 800x600 6 6 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug92868_1-expected.txt
r35250 r35253 1 CONSOLE MESSAGE: line 14: Result of expression 'document.styleSheets[1]' [undefined] is not an object.1 CONSOLE MESSAGE: line 14: TypeError: Result of expression 'document.styleSheets[1]' [undefined] is not an object. 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCells1-expected.txt
r30635 r35253 1 CONSOLE MESSAGE: line 7: Can't find variable: appendCellAt1 CONSOLE MESSAGE: line 7: ReferenceError: Can't find variable: appendCellAt 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCellsRebuild1-expected.txt
r30635 r35253 1 CONSOLE MESSAGE: line 7: Can't find variable: appendCellAt1 CONSOLE MESSAGE: line 7: ReferenceError: Can't find variable: appendCellAt 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/insertTbodyExpand1-expected.txt
r30635 r35253 1 CONSOLE MESSAGE: line 10: Can't find variable: appendCell1 CONSOLE MESSAGE: line 10: ReferenceError: Can't find variable: appendCell 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/insertTbodyRebuild1-expected.txt
r30635 r35253 1 CONSOLE MESSAGE: line 10: Can't find variable: appendCell1 CONSOLE MESSAGE: line 10: ReferenceError: Can't find variable: appendCell 2 2 layer at (0,0) size 800x600 3 3 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/storage/transaction_callback_exception_crash-expected.txt
r30635 r35253 1 CONSOLE MESSAGE: line 0: undefined1 CONSOLE MESSAGE: line 0: TransactionCallbackError 2 2 If WebKit doesn't crash, this test has passed -
trunk/WebCore/ChangeLog
r35252 r35253 1 2008-07-19 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Mark Rowe. 4 5 Bug 15979: Console logs in a database callback lose line number information 6 <https://bugs.webkit.org/show_bug.cgi?id=15979> 7 8 The problem was that there were multiple versions of the logic to 9 log an exception to the console, many of which were incorrect. We 10 resolve this by making one single shared reportException method, 11 which handles the exceptions correctly. 12 13 This improves fidelity of callback errors, and ensures that 14 exceptions thrown in timer callbacks correctly report line numbers, 15 etc. 16 17 Test: fast/js/exceptions-thrown-in-callbacks.html 18 19 * bindings/js/JSCustomSQLStatementCallback.cpp: 20 (WebCore::JSCustomSQLStatementCallback::handleEvent): 21 * bindings/js/JSCustomSQLStatementErrorCallback.cpp: 22 (WebCore::JSCustomSQLStatementErrorCallback::handleEvent): 23 * bindings/js/JSCustomSQLTransactionCallback.cpp: 24 (WebCore::JSCustomSQLTransactionCallback::handleEvent): 25 * bindings/js/JSCustomSQLTransactionErrorCallback.cpp: 26 (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent): 27 * bindings/js/JSCustomVoidCallback.cpp: 28 (WebCore::JSCustomVoidCallback::handleEvent): 29 * bindings/js/JSCustomXPathNSResolver.cpp: 30 (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): 31 * bindings/js/JSEventListener.cpp: 32 (WebCore::JSAbstractEventListener::handleEvent): 33 * bindings/js/ScheduledAction.cpp: 34 (WebCore::ScheduledAction::execute): 35 * bindings/js/ScriptController.cpp: 36 (WebCore::ScriptController::evaluate): 37 * bindings/objc/WebScriptObject.mm: 38 (WebCore::addExceptionToConsole): 39 * page/Console.cpp: 40 (WebCore::Console::reportException): 41 * page/Console.h: 42 1 43 2008-07-20 Nikolas Zimmermann <zimmermann@kde.org> 2 44 … … 28 70 (WebCore::TextResourceDecoder::checkForHeadCharset): 29 71 30 2008-07- 19Oliver Hunt <oliver@apple.com>31 32 Reviewed by NOBODY ( Build fix).72 2008-07-20 Oliver Hunt <oliver@apple.com> 73 74 Reviewed by NOBODY (build fix). 33 75 34 76 Attempt to fix windows build -
trunk/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp
r34947 r35253 85 85 86 86 if (exec->hadException()) { 87 JSObject* exception = exec->exception()->toObject(exec); 88 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 89 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 90 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 91 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 87 m_frame->domWindow()->console()->reportCurrentException(exec); 92 88 93 89 raisedException = true; 94 95 exec->clearException();96 90 } 97 91 -
trunk/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
r34947 r35253 91 91 92 92 if (exec->hadException()) { 93 JSObject* exception = exec->exception()->toObject(exec); 94 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 95 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 96 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 97 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 98 exec->clearException(); 93 m_frame->domWindow()->console()->reportCurrentException(exec); 99 94 100 95 // The spec says: -
trunk/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp
r35148 r35253 130 130 131 131 if (exec->hadException()) { 132 JSObject* exception = exec->exception()->toObject(exec); 133 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 134 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 135 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 136 m_data->frame()->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 137 exec->clearException(); 132 m_data->frame()->domWindow()->console()->reportCurrentException(exec); 138 133 139 134 raisedException = true; -
trunk/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp
r34947 r35253 83 83 globalObject->stopTimeoutCheck(); 84 84 85 if (exec->hadException()) { 86 JSObject* exception = exec->exception()->toObject(exec); 87 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 88 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 89 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 90 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 91 exec->clearException(); 92 } 85 if (exec->hadException()) 86 m_frame->domWindow()->console()->reportCurrentException(exec); 93 87 94 88 Document::updateDocumentsRendering(); -
trunk/WebCore/bindings/js/JSCustomVoidCallback.cpp
r34947 r35253 82 82 globalObject->stopTimeoutCheck(); 83 83 84 if (exec->hadException()) { 85 JSObject* exception = exec->exception()->toObject(exec); 86 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 87 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 88 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 89 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 90 exec->clearException(); 91 } 84 if (exec->hadException()) 85 m_frame->domWindow()->console()->reportCurrentException(exec); 92 86 93 87 Document::updateDocumentsRendering(); -
trunk/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
r34947 r35253 105 105 106 106 String result; 107 if (exec->hadException()) { 108 JSObject* exception = exec->exception()->toObject(exec); 109 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 110 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 111 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 112 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 113 exec->clearException(); 114 } else { 107 if (exec->hadException()) 108 m_frame->domWindow()->console()->reportCurrentException(exec); 109 else { 115 110 if (!retval->isUndefinedOrNull()) 116 111 result = retval->toString(exec); -
trunk/WebCore/bindings/js/JSEventListener.cpp
r35148 r35253 99 99 window->setCurrentEvent(savedEvent); 100 100 101 if (exec->hadException()) { 102 JSObject* exception = exec->exception()->toObject(exec); 103 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 104 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 105 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 106 frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 107 exec->clearException(); 108 } else { 101 if (exec->hadException()) 102 frame->domWindow()->console()->reportCurrentException(exec); 103 else { 109 104 if (!retval->isUndefinedOrNull() && event->storesResultAsString()) 110 105 event->storeResult(retval->toString(exec)); -
trunk/WebCore/bindings/js/ScheduledAction.cpp
r35203 r35253 75 75 call(exec, m_function, callType, callData, windowShell, args); 76 76 window->stopTimeoutCheck(); 77 if (exec->hadException()) { 78 JSObject* exception = exec->exception()->toObject(exec); 79 exec->clearException(); 80 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 81 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 82 frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, String()); 83 } 77 if (exec->hadException()) 78 frame->domWindow()->console()->reportCurrentException(exec); 84 79 } 85 80 } else -
trunk/WebCore/bindings/js/ScriptController.cpp
r35184 r35253 98 98 } 99 99 100 if (comp.complType() == Throw) { 101 UString errorMessage = comp.value()->toString(exec); 102 int lineNumber = comp.value()->toObject(exec)->get(exec, Identifier(exec, "line"))->toInt32(exec); 103 UString exceptionSourceURL = comp.value()->toObject(exec)->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 104 m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, errorMessage, lineNumber, exceptionSourceURL); 105 } 100 if (comp.complType() == Throw) 101 m_frame->domWindow()->console()->reportException(exec, comp.value()); 106 102 107 103 m_sourceURL = savedSourceURL; -
trunk/WebCore/bindings/objc/WebScriptObject.mm
r34956 r35253 90 90 { 91 91 JSDOMWindow* window = asJSDOMWindow(exec->dynamicGlobalObject()); 92 JSObject* exception = exec->exception()->toObject(exec); 93 if (!window || !exception) 92 if (!window || !exec->hadException()) 94 93 return; 95 String message = exception->get(exec, exec->propertyNames().message)->toString(exec); 96 int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec); 97 String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 98 window->impl()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL); 94 window->impl()->console()->reportCurrentException(exec); 99 95 } 100 96 -
trunk/WebCore/page/Console.cpp
r35039 r35253 296 296 } 297 297 298 void Console::reportException(ExecState* exec, JSValue* exception) 299 { 300 UString errorMessage = exception->toString(exec); 301 JSObject* exceptionObject = exception->toObject(exec); 302 int lineNumber = exceptionObject->get(exec, Identifier(exec, "line"))->toInt32(exec); 303 UString exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL"))->toString(exec); 304 addMessage(JSMessageSource, ErrorMessageLevel, errorMessage, lineNumber, exceptionSourceURL); 305 } 306 307 void Console::reportCurrentException(ExecState* exec) 308 { 309 JSValue* exception = exec->exception(); 310 exec->clearException(); 311 reportException(exec, exception); 312 } 313 298 314 } // namespace WebCore -
trunk/WebCore/page/Console.h
r34696 r35253 39 39 class ArgList; 40 40 class Profile; 41 class JSValue; 41 42 } 42 43 … … 80 81 void finishedProfiling(PassRefPtr<KJS::Profile>); 81 82 83 void reportException(KJS::ExecState*, KJS::JSValue*); 84 void reportCurrentException(KJS::ExecState*); 82 85 private: 83 86 Console(Frame*);
Note: See TracChangeset
for help on using the changeset viewer.