Changeset 84357 in webkit
- Timestamp:
- Apr 20, 2011 4:52:04 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r84356 r84357 1 2011-04-20 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Tony Gentilcore. 4 5 Error event in <script> element shouldn't bubble 6 https://bugs.webkit.org/show_bug.cgi?id=51040 7 8 * fast/events/onerror-bubbling-expected.txt: 9 * fast/events/onerror-bubbling.html: 10 * svg/dom/SVGScriptElement/script-load-and-error-events.svg: error event is dispatched on the 11 corresponding SVGScriptElement and shouldn't bubble, so the global error handler should 12 never be invoked for script load errors. This behaviour is consistent with HTMLScriptElement element. 13 * svg/dom/SVGScriptElement/script-onerror-bubbling-expected.txt: Added. 14 * svg/dom/SVGScriptElement/script-onerror-bubbling.svg: Added. 15 1 16 2011-04-20 John Knottenbelt <jknotten@chromium.org> 2 17 -
trunk/LayoutTests/fast/events/onerror-bubbling-expected.txt
r25617 r84357 1 PASS: inline script load error bubbled 2 PASS: dynamic script load error bubbled 1 PASS: script error handler invoked 3 2 -
trunk/LayoutTests/fast/events/onerror-bubbling.html
r14007 r84357 21 21 22 22 var div = document.createElement("div"); 23 div.setAttribute("onerror", "print(' PASS: dynamic script load error bubbled'); \23 div.setAttribute("onerror", "print('FAILED: dynamic script load error bubbled'); \ 24 24 if (window.layoutTestController) \ 25 25 layoutTestController.notifyDone();"); … … 32 32 document.body.appendChild(div); 33 33 } 34 35 function scriptOnerror() 36 { 37 print('PASS: script error handler invoked'); 38 39 // Allow event bubbling phase to complete. 40 setTimeout(function() { 41 if (window.layoutTestController) 42 layoutTestController.notifyDone(); 43 }, 0); 44 } 45 46 window.onerror = function() { 47 print('FAILED: window.onerror handler invoked'); 48 } 34 49 </script> 35 50 </head> … … 37 52 <hr> 38 53 <div id='console'></div> 39 <div onerror="print(' PASS: inline script load error bubbled')">40 <script src="file:///GregTheBunny.js" ></script>54 <div onerror="print('FAILED: inline script load error bubbled')"> 55 <script src="file:///GregTheBunny.js" onerror="scriptOnerror()"></script> 41 56 </div> 42 57 -
trunk/LayoutTests/svg/dom/SVGScriptElement/script-load-and-error-events.svg
r36699 r84357 1 1 <?xml version="1.0"?> 2 <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml" onerror=" errorEventHandler(evt)" onload="testLoadEventNotFired()">2 <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml" onerror="testGlobalErrorHandlerNotFired(evt)" onload="testLoadEventNotFired()"> 3 3 <defs> 4 4 <title><SCRIPT> load and error events</title> … … 14 14 layoutTestController.dumpAsText(); 15 15 layoutTestController.waitUntilDone(); 16 } 17 18 function testGlobalErrorHandlerNotFired(evt) { 19 status_[evt.target.id] += "G"; 16 20 } 17 21 … … 97 101 window.setTimeout('continueDynamicTest2()', 0); 98 102 }; 103 scriptElement.onerror = errorEventHandler; 99 104 100 105 document.getElementsByTagName("defs")[0].appendChild(scriptElement); … … 107 112 scriptElement.href.baseVal = "resources/not-existant.js"; 108 113 scriptElement.externalResourcesRequired.baseVal = true; 114 scriptElement.onerror = errorEventHandler; 109 115 110 116 lastTest = 1; … … 112 118 } 113 119 </script> 114 <script id="0" type="text/javascript" on load="loadEventHandler(evt)" xlink:href="resources/certainlydoesnotexist.js"></script>115 <script id="1" type="text/javascript" externalResourcesRequired="true" onload="loadEventHandler(evt)" xlink:href="resources/certainlydoesnotexisttoo.js"/>116 <script id="2" type="text/javascript" on load="loadEventHandler(evt)" xlink:href="resources/script-load.js"></script>117 <script id="3" type="text/javascript" externalResourcesRequired="true" onload="loadEventHandler(evt); lastTestBeforeRootElementLoaded();" xlink:href="resources/script-load.js"/>120 <script id="0" type="text/javascript" onerror="errorEventHandler(evt)" onload="loadEventHandler(evt)" xlink:href="resources/certainlydoesnotexist.js"></script> 121 <script id="1" type="text/javascript" onerror="errorEventHandler(evt)" externalResourcesRequired="true" onload="loadEventHandler(evt)" xlink:href="resources/certainlydoesnotexisttoo.js"/> 122 <script id="2" type="text/javascript" onerror="errorEventHandler(evt)" onload="loadEventHandler(evt)" xlink:href="resources/script-load.js"></script> 123 <script id="3" type="text/javascript" onerror="errorEventHandler(evt)" externalResourcesRequired="true" onload="loadEventHandler(evt); lastTestBeforeRootElementLoaded();" xlink:href="resources/script-load.js"/> 118 124 </defs> 119 125 <foreignObject> -
trunk/Source/WebCore/ChangeLog
r84351 r84357 1 2011-04-20 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Tony Gentilcore. 4 5 Error event in <script> element shouldn't bubble 6 https://bugs.webkit.org/show_bug.cgi?id=51040 7 8 Test: svg/dom/SVGScriptElement/script-onerror-bubbling.svg 9 10 * dom/ScriptElement.cpp: 11 (WebCore::ScriptElement::dispatchErrorEvent): the method now has same implementation for all script 12 elements, script load error event doesn' bubble. 13 * dom/ScriptElement.h: 14 * html/HTMLScriptElement.cpp: 15 * html/HTMLScriptElement.h: 16 * html/parser/HTMLScriptRunner.cpp: 17 (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): 18 * svg/SVGScriptElement.cpp: 19 (WebCore::SVGScriptElement::parseMappedAttribute): SVG script element now supports onerror 20 hanlder which behaves the same way as onerror in HTML script element: it's invoked when 21 script loading fails and the event doesn't bubble. 22 * svg/SVGScriptElement.h: 23 1 24 2011-04-20 Pavel Feldman <pfeldman@google.com> 2 25 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r83159 r84357 136 136 } 137 137 138 void ScriptElement::dispatchErrorEvent() 139 { 140 m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false)); 141 } 142 138 143 bool ScriptElement::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) const 139 144 { -
trunk/Source/WebCore/dom/ScriptElement.h
r81198 r84357 51 51 // XML parser calls these 52 52 virtual void dispatchLoadEvent() = 0; 53 v irtual void dispatchErrorEvent() = 0;53 void dispatchErrorEvent(); 54 54 bool isScriptTypeSupported(LegacyTypeSupport) const; 55 55 -
trunk/Source/WebCore/html/HTMLScriptElement.cpp
r81198 r84357 186 186 } 187 187 188 void HTMLScriptElement::dispatchErrorEvent()189 {190 dispatchEvent(Event::create(eventNames().errorEvent, true, false));191 }192 193 188 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren() const 194 189 { -
trunk/Source/WebCore/html/HTMLScriptElement.h
r81198 r84357 66 66 67 67 virtual void dispatchLoadEvent(); 68 virtual void dispatchErrorEvent();69 68 70 69 PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() const; -
trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp
r82631 r84357 87 87 } 88 88 89 inline PassRefPtr<Event> createScriptErrorEvent()90 {91 return Event::create(eventNames().errorEvent, true, false);92 }93 94 89 ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) const 95 90 { … … 139 134 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document); 140 135 if (errorOccurred) 141 element->dispatchEvent(createScriptErrorEvent());136 scriptElement->dispatchErrorEvent(); 142 137 else { 143 138 ASSERT(isExecutingScript()); -
trunk/Source/WebCore/svg/SVGScriptElement.cpp
r79114 r84357 28 28 #include "Event.h" 29 29 #include "EventNames.h" 30 #include "HTMLNames.h" 30 31 #include "SVGNames.h" 32 #include "ScriptEventListener.h" 31 33 32 34 namespace WebCore { … … 53 55 if (attrName == SVGNames::typeAttr) 54 56 setType(attr->value()); 57 else if (attr->name() == HTMLNames::onerrorAttr) 58 setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attr)); 55 59 else { 56 60 if (SVGURIReference::parseMappedAttribute(attr)) … … 245 249 } 246 250 247 void SVGScriptElement::dispatchErrorEvent()248 {249 dispatchEvent(Event::create(eventNames().errorEvent, true, false));250 }251 252 251 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() const 253 252 { -
trunk/Source/WebCore/svg/SVGScriptElement.h
r79114 r84357 72 72 73 73 virtual void dispatchLoadEvent(); 74 virtual void dispatchErrorEvent();75 74 76 75 PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() const;
Note: See TracChangeset
for help on using the changeset viewer.