Changeset 151951 in webkit
- Timestamp:
- Jun 24, 2013 7:38:54 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r151942 r151951 1 2013-06-24 Kangil Han <kangil.han@samsung.com> 2 3 Add support for document.currentScript 4 https://bugs.webkit.org/show_bug.cgi?id=104221 5 6 Reviewed by Ryosuke Niwa. 7 8 Merge http://src.chromium.org/viewvc/blink?view=revision&revision=152230 9 document.currentScript reflects the script that is currently being executed. 10 11 Merge http://src.chromium.org/viewvc/blink?view=revision&revision=152237 12 Following up patch for code clean-up. 13 14 * fast/dom/Document/document-current-script-async-expected.txt: Added. 15 * fast/dom/Document/document-current-script-async.html: Added. 16 * fast/dom/Document/document-current-script-expected.txt: Added. 17 * fast/dom/Document/document-current-script.html: Added. 18 * fast/dom/Document/resources/log-current-script-b.js: Added. 19 * fast/dom/Document/resources/log-current-script-d.js: Added. 20 * fast/dom/Document/resources/log-current-script-f.js: Added. 21 * fast/dom/Document/resources/log-current-script.js: Added. 22 1 23 2013-06-24 Jer Noble <jer.noble@apple.com> 2 24 -
trunk/Source/WebCore/ChangeLog
r151949 r151951 1 2013-06-24 Kangil Han <kangil.han@samsung.com> 2 3 Add support for document.currentScript 4 https://bugs.webkit.org/show_bug.cgi?id=104221 5 6 Reviewed by Ryosuke Niwa. 7 8 Merge http://src.chromium.org/viewvc/blink?view=revision&revision=152230 9 document.currentScript reflects the script that is currently being executed. 10 11 Merge http://src.chromium.org/viewvc/blink?view=revision&revision=152237 12 Following up patch for code clean-up. 13 14 Tests: fast/dom/Document/document-current-script-async.html 15 fast/dom/Document/document-current-script.html 16 17 * dom/Document.cpp: 18 (WebCore::Document::pushCurrentScript): 19 (WebCore::Document::popCurrentScript): 20 * dom/Document.h: 21 (WebCore::Document::currentScript): 22 * dom/Document.idl: 23 * dom/ScriptElement.cpp: 24 (WebCore::isHTMLScriptElement): 25 (WebCore::isSVGScriptElement): 26 (WebCore::ScriptElement::executeScript): 27 (WebCore::toScriptElementIfPossible): 28 * html/HTMLScriptElement.h: 29 (WebCore::toHTMLScriptElement): 30 * svg/SVGScriptElement.cpp: 31 * svg/SVGScriptElement.h: 32 (WebCore::toSVGScriptElement): 33 1 34 2013-06-24 Kangil Han <kangil.han@samsung.com> 2 35 -
trunk/Source/WebCore/dom/Document.cpp
r151926 r151951 92 92 #include "HTMLParserIdioms.h" 93 93 #include "HTMLPlugInElement.h" 94 #include "HTMLScriptElement.h" 94 95 #include "HTMLStyleElement.h" 95 96 #include "HTMLTitleElement.h" … … 4220 4221 } 4221 4222 4223 void Document::pushCurrentScript(PassRefPtr<HTMLScriptElement> newCurrentScript) 4224 { 4225 ASSERT(newCurrentScript); 4226 m_currentScriptStack.append(newCurrentScript); 4227 } 4228 4229 void Document::popCurrentScript() 4230 { 4231 ASSERT(!m_currentScriptStack.isEmpty()); 4232 m_currentScriptStack.removeLast(); 4233 } 4234 4222 4235 #if ENABLE(XSLT) 4223 4236 -
trunk/Source/WebCore/dom/Document.h
r151466 r151951 105 105 class HTMLMapElement; 106 106 class HTMLNameCollection; 107 class HTMLScriptElement; 107 108 class HitTestRequest; 108 109 class HitTestResult; … … 879 880 ScriptRunner* scriptRunner() { return m_scriptRunner.get(); } 880 881 882 HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : 0; } 883 void pushCurrentScript(PassRefPtr<HTMLScriptElement>); 884 void popCurrentScript(); 885 881 886 #if ENABLE(XSLT) 882 887 void applyXSLTransform(ProcessingInstruction* pi); … … 1406 1411 OwnPtr<ScriptRunner> m_scriptRunner; 1407 1412 1413 Vector<RefPtr<HTMLScriptElement> > m_currentScriptStack; 1414 1408 1415 #if ENABLE(XSLT) 1409 1416 OwnPtr<TransformSource> m_transformSource; -
trunk/Source/WebCore/dom/Document.idl
r151714 r151951 356 356 [Conditional=CSP_NEXT] readonly attribute DOMSecurityPolicy securityPolicy; 357 357 358 // currentscript API: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript 359 readonly attribute HTMLScriptElement currentScript; 358 360 }; 359 361 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r150957 r151951 30 30 #include "ContentSecurityPolicy.h" 31 31 #include "CrossOriginAccessControl.h" 32 #include "CurrentScriptIncrementer.h" 32 33 #include "Document.h" 33 34 #include "DocumentParser.h" … … 308 309 { 309 310 IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0); 311 CurrentScriptIncrementer currentScriptIncrementer(document.get(), m_element); 312 310 313 // Create a script from the script element node, using the script 311 314 // block's source and the script block's type. … … 418 421 ScriptElement* toScriptElementIfPossible(Element* element) 419 422 { 420 if ( element->isHTMLElement() && element->hasTagName(HTMLNames::scriptTag))421 return static_cast<HTMLScriptElement*>(element);423 if (isHTMLScriptElement(element)) 424 return toHTMLScriptElement(element); 422 425 423 426 #if ENABLE(SVG) 424 if ( element->isSVGElement() && element->hasTagName(SVGNames::scriptTag))425 return static_cast<SVGScriptElement*>(element);427 if (isSVGScriptElement(element)) 428 return toSVGScriptElement(element); 426 429 #endif 427 430 -
trunk/Source/WebCore/html/HTMLScriptElement.h
r149960 r151951 25 25 #define HTMLScriptElement_h 26 26 27 #include "HTMLElement.h" 27 28 #include "ScriptElement.h" 28 #include "HTMLElement.h"29 29 30 30 namespace WebCore { … … 68 68 }; 69 69 70 inline bool isHTMLScriptElement(Node* node) 71 { 72 return node->hasTagName(HTMLNames::scriptTag); 73 } 74 75 inline HTMLScriptElement* toHTMLScriptElement(Node* node) 76 { 77 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::scriptTag)); 78 return static_cast<HTMLScriptElement*>(node); 79 } 80 70 81 } //namespace 71 82 -
trunk/Source/WebCore/svg/SVGScriptElement.cpp
r151800 r151951 31 31 #include "SVGAnimatedStaticPropertyTearOff.h" 32 32 #include "SVGElementInstance.h" 33 #include "SVGNames.h"34 33 #include "ScriptEventListener.h" 35 34 -
trunk/Source/WebCore/svg/SVGScriptElement.h
r149960 r151951 27 27 #include "SVGElement.h" 28 28 #include "SVGExternalResourcesRequired.h" 29 #include "SVGNames.h" 29 30 #include "SVGURIReference.h" 30 31 #include "ScriptElement.h" … … 87 88 }; 88 89 90 inline bool isSVGScriptElement(Node* node) 91 { 92 return node->hasTagName(SVGNames::scriptTag); 93 } 94 95 inline SVGScriptElement* toSVGScriptElement(Node* node) 96 { 97 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptTag)); 98 return static_cast<SVGScriptElement*>(node); 99 } 100 89 101 } // namespace WebCore 90 102
Note: See TracChangeset
for help on using the changeset viewer.