Changeset 79223 in webkit
- Timestamp:
- Feb 21, 2011 8:01:41 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r79220 r79223 1 2011-02-21 Anton Muhin <antonm@chromium.org> 2 3 Reviewed by Adam Barth and Alexey Proskuryakov. 4 5 Propagate security origin of parent document into HTML documents created with DOMImplementation 6 https://bugs.webkit.org/show_bug.cgi?id=53611 7 8 Additional test which checks case when parent document can be collected while 9 its implementation is alive. 10 11 * fast/dom/gc-9.html: 12 1 13 2011-02-21 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/LayoutTests/fast/dom/gc-9.html
r58526 r79223 84 84 } 85 85 86 function testDOMImplementation() 87 { 88 var impl = document.implementation.createHTMLDocument('').implementation; 89 gc(); 90 impl.createHTMLDocument(''); // May crash or throw an exception if we collect parent document of impl. 91 } 92 86 93 function test() 87 94 { … … 98 105 99 106 testEvents(); 107 testDOMImplementation(); 100 108 } 101 109 -
trunk/Source/WebCore/Android.jscbindings.mk
r78042 r79223 88 88 bindings/js/JSDOMFormDataCustom.cpp \ 89 89 bindings/js/JSDOMGlobalObject.cpp \ 90 bindings/js/JSDOMImplementationCustom.cpp \ 90 91 bindings/js/JSDOMSettableTokenList.cpp \ 91 92 bindings/js/JSDOMTokenList.cpp \ -
trunk/Source/WebCore/CMakeLists.txt
r79011 r79223 486 486 bindings/js/JSDOMFormDataCustom.cpp 487 487 bindings/js/JSDOMGlobalObject.cpp 488 bindings/js/JSDOMImplementationCustom.cpp 488 489 bindings/js/JSDOMMimeTypeArrayCustom.cpp 489 490 bindings/js/JSDOMPluginArrayCustom.cpp -
trunk/Source/WebCore/ChangeLog
r79221 r79223 1 2011-02-08 Anton Muhin <antonm@chromium.org> 2 3 Reviewed by Adam Barth and Alexey Proskuryakov. 4 5 Propagate security origin of parent document into HTML documents created with DOMImplementation 6 https://bugs.webkit.org/show_bug.cgi?id=53611 7 8 This restores invariant that JS wrappers residing in the same JS context should come 9 from the same security origin. 10 11 Absence of regressions is covered by the current tests. Different security origin of 12 DOMImplementation is difficult to check with layout tests as DOMImplementation 13 resides in the same JS context as parent document and therefore there are no security origin checks. 14 This is observable however in C++. 15 16 * Android.jscbindings.mk: 17 * CMakeLists.txt: 18 * WebCore.gypi: 19 * WebCore.pro: 20 * WebCore.vcproj/WebCore.vcproj: 21 * WebCore.xcodeproj/project.pbxproj: 22 * bindings/v8/V8GCController.cpp: 23 (WebCore::NodeGrouperVisitor::visitDOMWrapper): 24 * dom/DOMImplementation.cpp: 25 (WebCore::DOMImplementation::DOMImplementation): 26 (WebCore::DOMImplementation::createDocument): 27 * dom/DOMImplementation.h: 28 (WebCore::DOMImplementation::create): 29 (WebCore::DOMImplementation::documentDestroyed): 30 (WebCore::DOMImplementation::parentDocument): 31 * dom/DOMImplementation.idl: 32 * dom/Document.cpp: 33 (WebCore::Document::~Document): 34 (WebCore::Document::implementation): 35 * dom/Document.h: 36 1 37 2011-02-21 Andrey Adaikin <aandrey@google.com> 2 38 -
trunk/Source/WebCore/WebCore.gypi
r79217 r79223 618 618 'bindings/js/JSDOMGlobalObject.cpp', 619 619 'bindings/js/JSDOMGlobalObject.h', 620 'bindings/js/JSDOMImplementationCustom.cpp', 620 621 'bindings/js/JSDOMStringMapCustom.cpp', 621 622 'bindings/js/JSDOMStringMapCustom.h', -
trunk/Source/WebCore/WebCore.pro
r79217 r79223 1397 1397 bindings/js/JSDOMBinding.h \ 1398 1398 bindings/js/JSDOMGlobalObject.h \ 1399 bindings/js/JSDOMImplementationCustom.h \ 1399 1400 bindings/js/JSDOMStringMapCustom.h \ 1400 1401 bindings/js/JSDOMWindowBase.h \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r79217 r79223 58018 58018 </File> 58019 58019 <File 58020 RelativePath="..\bindings\js\JSDOMImplementationCustom.cpp" 58021 > 58022 <FileConfiguration 58023 Name="Debug|Win32" 58024 ExcludedFromBuild="true" 58025 > 58026 <Tool 58027 Name="VCCLCompilerTool" 58028 /> 58029 </FileConfiguration> 58030 <FileConfiguration 58031 Name="Release|Win32" 58032 ExcludedFromBuild="true" 58033 > 58034 <Tool 58035 Name="VCCLCompilerTool" 58036 /> 58037 </FileConfiguration> 58038 <FileConfiguration 58039 Name="Debug_Cairo_CFLite|Win32" 58040 ExcludedFromBuild="true" 58041 > 58042 <Tool 58043 Name="VCCLCompilerTool" 58044 /> 58045 </FileConfiguration> 58046 <FileConfiguration 58047 Name="Release_Cairo_CFLite|Win32" 58048 ExcludedFromBuild="true" 58049 > 58050 <Tool 58051 Name="VCCLCompilerTool" 58052 /> 58053 </FileConfiguration> 58054 <FileConfiguration 58055 Name="Debug_All|Win32" 58056 ExcludedFromBuild="true" 58057 > 58058 <Tool 58059 Name="VCCLCompilerTool" 58060 /> 58061 </FileConfiguration> 58062 <FileConfiguration 58063 Name="Release_LTCG|Win32" 58064 ExcludedFromBuild="true" 58065 > 58066 <Tool 58067 Name="VCCLCompilerTool" 58068 /> 58069 </FileConfiguration> 58070 </File> 58071 <File 58020 58072 RelativePath="..\bindings\js\JSDOMMimeTypeArrayCustom.cpp" 58021 58073 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r79217 r79223 653 653 20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20D629241253690B00081543 /* InspectorInstrumentation.cpp */; }; 654 654 20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; }; 655 22885E641301AE4C00526E68 /* JSDOMImplementationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */; }; 655 656 228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; }; 656 657 24F54EAC101FE914000AE741 /* ApplicationCacheHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */; }; … … 7007 7008 20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; }; 7008 7009 20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; }; 7010 22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMImplementationCustom.cpp; path = bindings/js/JSDOMImplementationCustom.cpp; sourceTree = "<group>"; }; 7009 7011 228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; }; 7010 7012 2442BBF81194C9D300D49469 /* HashChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashChangeEvent.h; sourceTree = "<group>"; }; … … 12422 12424 isa = PBXGroup; 12423 12425 children = ( 12426 22885E631301AE4C00526E68 /* JSDOMImplementationCustom.cpp */, 12424 12427 65C97AF208EA908800ACD273 /* config.h */, 12425 12428 EDEC98020AED7E170059137F /* WebCorePrefix.h */, … … 22541 22544 buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */; 22542 22545 compatibilityVersion = "Xcode 2.4"; 22543 developmentRegion = English;22544 22546 hasScannedForEncodings = 1; 22545 22547 knownRegions = ( … … 25168 25170 A1E1154613015C4E0054AC8C /* PointLightSource.cpp in Sources */, 25169 25171 A1E1154813015C5D0054AC8C /* SpotLightSource.cpp in Sources */, 25172 22885E641301AE4C00526E68 /* JSDOMImplementationCustom.cpp in Sources */, 25170 25173 B8DBDB4B130B0F8A00F5CDB1 /* SetSelectionCommand.cpp in Sources */, 25171 25174 B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r78407 r79223 57 57 #include "JSDOMFormDataCustom.cpp" 58 58 #include "JSDOMGlobalObject.cpp" 59 #include "JSDOMImplementationCustom.cpp" 59 60 #include "JSDOMMimeTypeArrayCustom.cpp" 60 61 #include "JSDOMPluginArrayCustom.cpp" -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r77650 r79223 368 368 { 369 369 END 370 if ($domMapFunction) { 371 push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); 372 my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)"; 373 push(@headerContent, <<END); 370 push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); 371 my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getWrapper(impl)" : "${domMapFunction}.get(impl)"; 372 push(@headerContent, <<END); 374 373 v8::Handle<v8::Object> wrapper = ${getWrapper}; 375 374 if (!wrapper.IsEmpty()) 376 375 return wrapper; 377 376 END 378 push(@headerContent, " }\n") if IsDOMNodeType($interfaceName); 379 } 377 push(@headerContent, " }\n") if IsDOMNodeType($interfaceName); 380 378 push(@headerContent, <<END); 381 379 return ${className}::wrapSlow(impl); … … 2502 2500 } 2503 2501 2504 if ($domMapFunction) { 2505 push(@implContent, <<END); 2502 push(@implContent, <<END); 2506 2503 ${domMapFunction}.set(impl, v8::Persistent<v8::Object>::New(wrapper)); 2507 2504 END 2508 }2509 2505 2510 2506 push(@implContent, <<END); … … 2550 2546 return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance"; 2551 2547 return "getDOMNodeMap()" if ($dataNode && IsNodeSubType($dataNode)); 2552 return "" if $type eq "DOMImplementation";2553 2548 return "getActiveDOMObjectMap()" if IsActiveDomType($type); 2554 2549 return "getDOMObjectMap()"; -
trunk/Source/WebCore/bindings/v8/V8GCController.cpp
r74686 r79223 291 291 Document* document = reinterpret_cast<Document*>(node); 292 292 addDOMObjectToGroup(store, groupId, document->styleSheets()); 293 addDOMObjectToGroup(store, groupId, document->implementation()); 293 294 } 294 295 -
trunk/Source/WebCore/dom/DOMImplementation.cpp
r65986 r79223 172 172 #endif 173 173 174 DOMImplementation::DOMImplementation(Document* ownerDocument) 175 : m_ownerDocument(ownerDocument) 176 { 177 ASSERT(m_ownerDocument); 178 } 179 174 180 bool DOMImplementation::hasFeature(const String& feature, const String& version) 175 181 { … … 241 247 doc = Document::create(0, KURL()); 242 248 249 if (!m_ownerDocument) { 250 ec = INVALID_STATE_ERR; 251 return 0; 252 } 253 doc->setSecurityOrigin(m_ownerDocument->securityOrigin()); 254 243 255 RefPtr<Node> documentElement; 244 256 if (!qualifiedName.isEmpty()) { … … 301 313 d->write("<!doctype html><html><body></body></html>"); 302 314 d->setTitle(title); 315 ASSERT(m_ownerDocument); 316 if (m_ownerDocument) 317 d->setSecurityOrigin(m_ownerDocument->securityOrigin()); 303 318 return d.release(); 304 319 } -
trunk/Source/WebCore/dom/DOMImplementation.h
r65021 r79223 42 42 class DOMImplementation : public RefCounted<DOMImplementation> { 43 43 public: 44 static PassRefPtr<DOMImplementation> create( ) { return adoptRef(new DOMImplementation); }44 static PassRefPtr<DOMImplementation> create(Document* ownerDocument) { return adoptRef(new DOMImplementation(ownerDocument)); } 45 45 46 46 // DOM methods & attributes for DOMImplementation 47 47 static bool hasFeature(const String& feature, const String& version); 48 static PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String &systemId, ExceptionCode&);49 staticPassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);48 PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&); 49 PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&); 50 50 51 51 DOMImplementation* getInterface(const String& feature); … … 55 55 56 56 // From the HTMLDOMImplementation interface 57 staticPassRefPtr<HTMLDocument> createHTMLDocument(const String& title);57 PassRefPtr<HTMLDocument> createHTMLDocument(const String& title); 58 58 59 59 // Other methods (not part of DOM) … … 63 63 static bool isTextMIMEType(const String& MIMEType); 64 64 65 Document* ownerDocument() { return m_ownerDocument; } 66 void ownerDocumentDestroyed() { m_ownerDocument = 0; } 67 65 68 private: 66 DOMImplementation() { } 69 DOMImplementation(Document* ownerDocument); 70 71 Document* m_ownerDocument; 67 72 }; 68 73 -
trunk/Source/WebCore/dom/DOMImplementation.idl
r52921 r79223 21 21 module core { 22 22 23 interface DOMImplementation { 23 interface [ 24 CustomMarkFunction 25 ] DOMImplementation { 24 26 25 27 // DOM Level 1 -
trunk/Source/WebCore/dom/Document.cpp
r79208 r79223 603 603 if (m_mediaQueryMatcher) 604 604 m_mediaQueryMatcher->documentDestroyed(); 605 606 if (m_implementation) 607 m_implementation->ownerDocumentDestroyed(); 605 608 } 606 609 … … 684 687 } 685 688 686 DOMImplementation* Document::implementation() const689 DOMImplementation* Document::implementation() 687 690 { 688 691 if (!m_implementation) 689 m_implementation = DOMImplementation::create( );692 m_implementation = DOMImplementation::create(this); 690 693 return m_implementation.get(); 691 694 } -
trunk/Source/WebCore/dom/Document.h
r79208 r79223 307 307 DocumentType* doctype() const { return m_docType.get(); } 308 308 309 DOMImplementation* implementation() const;309 DOMImplementation* implementation(); 310 310 311 311 Element* documentElement() const
Note: See TracChangeset
for help on using the changeset viewer.