Changeset 64857 in webkit
- Timestamp:
- Aug 6, 2010 10:35:57 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.mk
r64845 r64857 159 159 dom/OverflowEvent.cpp \ 160 160 dom/PageTransitionEvent.cpp \ 161 dom/PendingScript.cpp \ 161 162 dom/Position.cpp \ 162 163 dom/PositionIterator.cpp \ -
trunk/WebCore/CMakeLists.txt
r64846 r64857 838 838 dom/OverflowEvent.cpp 839 839 dom/PageTransitionEvent.cpp 840 dom/PendingScript.cpp 840 841 dom/PopStateEvent.cpp 841 842 dom/Position.cpp -
trunk/WebCore/ChangeLog
r64855 r64857 1 2010-08-06 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Factor out PendingScript and protect its members 6 https://bugs.webkit.org/show_bug.cgi?id=43391 7 8 This will be shared by AsyncScriptRunner. 9 10 No new tests because no new functionality. 11 12 * Android.mk: 13 * CMakeLists.txt: 14 * GNUmakefile.am: 15 * WebCore.gypi: 16 * WebCore.pro: 17 * WebCore.vcproj/WebCore.vcproj: 18 * WebCore.xcodeproj/project.pbxproj: 19 * dom/PendingScript.cpp: Added. 20 (WebCore::PendingScript::~PendingScript): 21 (WebCore::PendingScript::element): 22 (WebCore::PendingScript::releaseElementAndClear): 23 (WebCore::PendingScript::setCachedScript): 24 (WebCore::PendingScript::cachedScript): 25 * dom/PendingScript.h: Added. 26 (WebCore::PendingScript::PendingScript): 27 (WebCore::PendingScript::startingLineNumber): 28 (WebCore::PendingScript::watchingForLoad): 29 (WebCore::PendingScript::setWatchingForLoad): 30 (WebCore::PendingScript::hasElement): 31 (WebCore::PendingScript::adoptElement): 32 (WebCore::PendingScript::notifyFinished): 33 * html/HTMLScriptRunner.cpp: 34 (WebCore::HTMLScriptRunner::sourceFromPendingScript): 35 (WebCore::HTMLScriptRunner::haveParsingBlockingScript): 36 (WebCore::HTMLScriptRunner::requestScript): 37 * html/HTMLScriptRunner.h: 38 1 39 2010-08-06 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 40 -
trunk/WebCore/GNUmakefile.am
r64846 r64857 1116 1116 WebCore/dom/PageTransitionEvent.cpp \ 1117 1117 WebCore/dom/PageTransitionEvent.h \ 1118 WebCore/dom/PendingScript.cpp \ 1119 WebCore/dom/PendingScript.h \ 1118 1120 WebCore/dom/Position.cpp \ 1119 1121 WebCore/dom/Position.h \ -
trunk/WebCore/WebCore.gypi
r64846 r64857 1225 1225 'dom/PageTransitionEvent.cpp', 1226 1226 'dom/PageTransitionEvent.h', 1227 'dom/PendingScript.cpp', 1228 'dom/PendingScript.h', 1227 1229 'dom/Position.cpp', 1228 1230 'dom/Position.h', -
trunk/WebCore/WebCore.pro
r64846 r64857 526 526 dom/OverflowEvent.cpp \ 527 527 dom/PageTransitionEvent.cpp \ 528 dom/PendingScript.cpp \ 528 529 dom/PopStateEvent.cpp \ 529 530 dom/Position.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r64846 r64857 33082 33082 </File> 33083 33083 <File 33084 RelativePath="..\dom\PendingScript.cpp" 33085 > 33086 </File> 33087 <File 33088 RelativePath="..\dom\PendingScript.h" 33089 > 33090 </File> 33091 <File 33084 33092 RelativePath="..\dom\PageTransitionEvent.cpp" 33085 33093 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r64846 r64857 2357 2357 89CD029411C85B870070B791 /* JSBlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 89CD029211C85B870070B791 /* JSBlobBuilder.h */; }; 2358 2358 8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2359 8A7CC96B12076D73001D4588 /* PendingScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A7CC96A12076D73001D4588 /* PendingScript.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2360 8A7CC97012076F8A001D4588 /* PendingScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A7CC96F12076F8A001D4588 /* PendingScript.cpp */; }; 2359 2361 8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2360 2362 8A844D0411D3C18E0014065C /* Performance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A844D0111D3C18E0014065C /* Performance.cpp */; }; … … 8158 8160 89CD029211C85B870070B791 /* JSBlobBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobBuilder.h; sourceTree = "<group>"; }; 8159 8161 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentLoadTiming.h; sourceTree = "<group>"; }; 8162 8A7CC96A12076D73001D4588 /* PendingScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PendingScript.h; sourceTree = "<group>"; }; 8163 8A7CC96F12076F8A001D4588 /* PendingScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PendingScript.cpp; sourceTree = "<group>"; }; 8160 8164 8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadTiming.h; sourceTree = "<group>"; }; 8161 8165 8A844D0111D3C18E0014065C /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; }; … … 17267 17271 E1284AE010447D4500EAEB52 /* PageTransitionEvent.h */, 17268 17272 E1284AD910447AEB00EAEB52 /* PageTransitionEvent.idl */, 17273 8A7CC96F12076F8A001D4588 /* PendingScript.cpp */, 17274 8A7CC96A12076D73001D4588 /* PendingScript.h */, 17269 17275 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */, 17270 17276 41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */, … … 20076 20082 31FB1A5D120A5D0600DC02A0 /* DeviceMotionEvent.h in Headers */, 20077 20083 31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */, 20084 8A7CC96B12076D73001D4588 /* PendingScript.h in Headers */, 20078 20085 ); 20079 20086 runOnlyForDeploymentPostprocessing = 0; … … 22491 22498 31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */, 22492 22499 31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */, 22500 8A7CC97012076F8A001D4588 /* PendingScript.cpp in Sources */, 22493 22501 ); 22494 22502 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/html/HTMLScriptRunner.cpp
r64704 r64857 106 106 } 107 107 errorOccurred = false; 108 return ScriptSourceCode(script.element ->textContent(), documentURLForScriptExecution(m_document), script.startingLineNumber);108 return ScriptSourceCode(script.element()->textContent(), documentURLForScriptExecution(m_document), script.startingLineNumber()); 109 109 } 110 110 … … 196 196 bool HTMLScriptRunner::haveParsingBlockingScript() const 197 197 { 198 return !!m_parsingBlockingScript.element ;198 return !!m_parsingBlockingScript.element(); 199 199 } 200 200 … … 231 231 void HTMLScriptRunner::requestScript(Element* script) 232 232 { 233 ASSERT(!m_parsingBlockingScript.element );233 ASSERT(!m_parsingBlockingScript.element()); 234 234 AtomicString srcValue = script->getAttribute(srcAttr); 235 235 // Allow the host to disllow script loads (using the XSSAuditor, etc.) … … 239 239 if (!script->dispatchBeforeLoadEvent(srcValue)) 240 240 return; 241 m_parsingBlockingScript. element = script;241 m_parsingBlockingScript.adoptElement(script); 242 242 // This should correctly return 0 for empty or invalid srcValues. 243 243 CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script)->scriptCharset()); … … 279 279 } 280 280 281 HTMLScriptRunner::PendingScript::~PendingScript() 282 { 283 if (m_cachedScript) 284 m_cachedScript->removeClient(this); 285 } 286 287 PassRefPtr<Element> HTMLScriptRunner::PendingScript::releaseElementAndClear() 288 { 289 setCachedScript(0); 290 startingLineNumber = 0; 291 m_watchingForLoad = false; 292 return element.release(); 293 } 294 295 void HTMLScriptRunner::PendingScript::setCachedScript(CachedScript* cachedScript) 296 { 297 if (m_cachedScript == cachedScript) 298 return; 299 if (m_cachedScript) 300 m_cachedScript->removeClient(this); 301 m_cachedScript = cachedScript; 302 if (m_cachedScript) 303 m_cachedScript->addClient(this); 304 } 305 306 CachedScript* HTMLScriptRunner::PendingScript::cachedScript() const 307 { 308 return m_cachedScript.get(); 309 } 310 311 } 281 } -
trunk/WebCore/html/HTMLScriptRunner.h
r64704 r64857 27 27 #define HTMLScriptRunner_h 28 28 29 #include "CachedResourceClient.h" 30 #include "CachedResourceHandle.h" 29 #include "PendingScript.h" 31 30 #include <wtf/Noncopyable.h> 32 31 #include <wtf/PassRefPtr.h> … … 34 33 namespace WebCore { 35 34 36 class CachedResource Client;35 class CachedResource; 37 36 class CachedScript; 38 37 class Document; … … 57 56 58 57 private: 59 // A container for an external script which may be loaded and executed.60 //61 // A CachedResourceHandle alone does not prevent the underlying CachedResource62 // from purging its data buffer. This class holds a dummy client open for its63 // lifetime in order to guarantee that the data buffer will not be purged.64 //65 // FIXME: Finish turning this into a proper class.66 class PendingScript : public CachedResourceClient, Noncopyable {67 public:68 PendingScript()69 : startingLineNumber(0)70 , m_watchingForLoad(false)71 {72 }73 74 ~PendingScript();75 76 PassRefPtr<Element> releaseElementAndClear();77 78 bool watchingForLoad() const { return m_watchingForLoad; }79 void setWatchingForLoad(bool b) { m_watchingForLoad = b; }80 81 CachedScript* cachedScript() const;82 void setCachedScript(CachedScript*);83 84 virtual void notifyFinished(CachedResource*)85 {86 }87 88 RefPtr<Element> element;89 int startingLineNumber; // Only used for inline script tags.90 // HTML5 has an isReady parameter, however isReady ends up equivalent to91 // m_document->haveStylesheetsLoaded() && cachedScript->isLoaded()92 93 private:94 bool m_watchingForLoad;95 CachedResourceHandle<CachedScript> m_cachedScript;96 };97 98 58 Frame* frame() const; 99 59
Note: See TracChangeset
for help on using the changeset viewer.