Commit 3feb4c33 authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2008-06-15  Darin Adler  <darin@apple.com>

        Reviewed and tweaked by Sam Weinig.

        Fix for <rdar://problem/5908591>
        https://bugs.webkit.org/show_bug.cgi?id=18743

        Makes DOMImplementation per-document.

        Test: http/tests/security/cross-frame-access-DOMImplementation.html

        * bindings/objc/DOMImplementationFront.cpp:
        (WebCore::DOMImplementationFront::getInterface):
        * bindings/objc/DOMImplementationFront.h:
        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::hasFeature):
        (WebCore::DOMImplementation::createDocumentType):
        (WebCore::DOMImplementation::getInterface):
        (WebCore::DOMImplementation::createDocument):
        (WebCore::DOMImplementation::createHTMLDocument):
        * dom/DOMImplementation.h:
        (WebCore::DOMImplementation::create):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::implementation):
        * dom/Document.h:
        (WebCore::Document::create):
        (WebCore::Document::createXHTML):
        * dom/DocumentType.cpp:
        * dom/DocumentType.h:
        (WebCore::DocumentType::create):
        (WebCore::DocumentType::entities):
        (WebCore::DocumentType::notations):
        (WebCore::DocumentType::name):
        (WebCore::DocumentType::publicId):
        (WebCore::DocumentType::systemId):
        (WebCore::DocumentType::internalSubset):
        * dom/Node.cpp:
        (WebCore::Node::isSupported):
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::internalSubset):
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::HTMLDocument):
        * html/HTMLDocument.h:
        (WebCore::HTMLDocument::create):
        (WebCore::HTMLDocument::isHTMLDocument):
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::parseDoctypeToken):
        * html/HTMLViewSourceDocument.cpp:
        (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
        (WebCore::HTMLViewSourceDocument::createTokenizer):
        * html/HTMLViewSourceDocument.h:
        (WebCore::HTMLViewSourceDocument::create):
        * loader/CachedFont.cpp:
        (WebCore::CachedFont::ensureSVGFontData):
        * loader/FTPDirectoryDocument.cpp:
        (WebCore::FTPDirectoryDocument::FTPDirectoryDocument):
        * loader/FTPDirectoryDocument.h:
        (WebCore::FTPDirectoryDocument::create):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::begin):
        * loader/ImageDocument.cpp:
        (WebCore::ImageDocument::ImageDocument):
        * loader/ImageDocument.h:
        (WebCore::ImageDocument::create):
        (WebCore::ImageDocument::isImageDocument):
        * loader/PluginDocument.cpp:
        (WebCore::PluginDocument::PluginDocument):
        * loader/PluginDocument.h:
        (WebCore::PluginDocument::create):
        (WebCore::PluginDocument::isPluginDocument):
        * loader/TextDocument.cpp:
        (WebCore::TextTokenizer::checkBuffer):
        (WebCore::TextDocument::TextDocument):
        (WebCore::createTextTokenizer):
        * loader/TextDocument.h:
        (WebCore::TextDocument::create):
        * svg/SVGDocument.cpp:
        (WebCore::SVGDocument::SVGDocument):
        * svg/SVGDocument.h:
        (WebCore::SVGDocument::create):
        * svg/SVGElement.cpp:
        (WebCore::SVGElement::isSupported):
        * svg/SVGTests.cpp:
        (WebCore::SVGTests::isValid):
        * xml/DOMParser.cpp:
        (WebCore::DOMParser::parseFromString):

LayoutTests:

2008-06-15  Darin Adler  <darin@apple.com>

        Reviewed and tweaked by Sam Weinig.

        Test for <rdar://problem/5908591>
        https://bugs.webkit.org/show_bug.cgi?id=18743

        * http/tests/security/cross-frame-access-DOMImplementation-expected.txt: Added.
        * http/tests/security/cross-frame-access-DOMImplementation.html: Added.
        * http/tests/security/resources/cross-frame-iframe-for-DOMImplementation-test.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 193d4d68
2008-06-15 Darin Adler <darin@apple.com>
Reviewed and tweaked by Sam Weinig.
Test for <rdar://problem/5908591>
https://bugs.webkit.org/show_bug.cgi?id=18743
* http/tests/security/cross-frame-access-DOMImplementation-expected.txt: Added.
* http/tests/security/cross-frame-access-DOMImplementation.html: Added.
* http/tests/security/resources/cross-frame-iframe-for-DOMImplementation-test.html: Added.
2008-06-15 Dan Bernstein <mitz@apple.com>
Rubber-stamped by Sam Weinig.
PASS: Setting properties on the DOMImplementation did not leak cross-frame.
<html>
<head>
<script src="resources/cross-frame-access.js"></script>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
addEventListener('message', function(e) {
if (e.data == "test")
test();
}, false);
test = function()
{
if (document.implementation.foo == "FAIL")
log("FAIL: Setting properties on the DOMImplementation leaked cross-frame.");
else
log("PASS: Setting properties on the DOMImplementation did not leak cross-frame.");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-DOMImplementation-test.html"></iframe>
<pre id="console"></pre>
</body>
</html>
<html>
<head>
<script>
window.onload = function()
{
document.implementation.foo = "FAIL";
window.parent.postMessage("test", "*");
}
</script>
</head>
<body>
</body>
</html>
2008-06-15 Darin Adler <darin@apple.com>
Reviewed and tweaked by Sam Weinig.
Fix for <rdar://problem/5908591>
https://bugs.webkit.org/show_bug.cgi?id=18743
Makes DOMImplementation per-document.
Test: http/tests/security/cross-frame-access-DOMImplementation.html
* bindings/objc/DOMImplementationFront.cpp:
(WebCore::DOMImplementationFront::getInterface):
* bindings/objc/DOMImplementationFront.h:
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::hasFeature):
(WebCore::DOMImplementation::createDocumentType):
(WebCore::DOMImplementation::getInterface):
(WebCore::DOMImplementation::createDocument):
(WebCore::DOMImplementation::createHTMLDocument):
* dom/DOMImplementation.h:
(WebCore::DOMImplementation::create):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::implementation):
* dom/Document.h:
(WebCore::Document::create):
(WebCore::Document::createXHTML):
* dom/DocumentType.cpp:
* dom/DocumentType.h:
(WebCore::DocumentType::create):
(WebCore::DocumentType::entities):
(WebCore::DocumentType::notations):
(WebCore::DocumentType::name):
(WebCore::DocumentType::publicId):
(WebCore::DocumentType::systemId):
(WebCore::DocumentType::internalSubset):
* dom/Node.cpp:
(WebCore::Node::isSupported):
* dom/XMLTokenizer.cpp:
(WebCore::XMLTokenizer::internalSubset):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::HTMLDocument):
* html/HTMLDocument.h:
(WebCore::HTMLDocument::create):
(WebCore::HTMLDocument::isHTMLDocument):
* html/HTMLParser.cpp:
(WebCore::HTMLParser::parseDoctypeToken):
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
(WebCore::HTMLViewSourceDocument::createTokenizer):
* html/HTMLViewSourceDocument.h:
(WebCore::HTMLViewSourceDocument::create):
* loader/CachedFont.cpp:
(WebCore::CachedFont::ensureSVGFontData):
* loader/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocument::FTPDirectoryDocument):
* loader/FTPDirectoryDocument.h:
(WebCore::FTPDirectoryDocument::create):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::begin):
* loader/ImageDocument.cpp:
(WebCore::ImageDocument::ImageDocument):
* loader/ImageDocument.h:
(WebCore::ImageDocument::create):
(WebCore::ImageDocument::isImageDocument):
* loader/PluginDocument.cpp:
(WebCore::PluginDocument::PluginDocument):
* loader/PluginDocument.h:
(WebCore::PluginDocument::create):
(WebCore::PluginDocument::isPluginDocument):
* loader/TextDocument.cpp:
(WebCore::TextTokenizer::checkBuffer):
(WebCore::TextDocument::TextDocument):
(WebCore::createTextTokenizer):
* loader/TextDocument.h:
(WebCore::TextDocument::create):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::SVGDocument):
* svg/SVGDocument.h:
(WebCore::SVGDocument::create):
* svg/SVGElement.cpp:
(WebCore::SVGElement::isSupported):
* svg/SVGTests.cpp:
(WebCore::SVGTests::isValid):
* xml/DOMParser.cpp:
(WebCore::DOMParser::parseFromString):
2008-06-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -64,9 +64,9 @@ PassRefPtr<Document> DOMImplementationFront::createDocument(const String& namesp
return reinterpret_cast<DOMImplementation*>(this)->createDocument(namespaceURI, qualifiedName, type, ec);
}
DOMImplementationFront* DOMImplementationFront::getInterface(const String& feature) const
DOMImplementationFront* DOMImplementationFront::getInterface(const String& feature)
{
return reinterpret_cast<DOMImplementationFront*>(reinterpret_cast<const DOMImplementation*>(this)->getInterface(feature));
return reinterpret_cast<DOMImplementationFront*>(reinterpret_cast<DOMImplementation*>(this)->getInterface(feature));
}
PassRefPtr<CSSStyleSheet> DOMImplementationFront::createCSSStyleSheet(const String& title, const String& media, ExceptionCode& ec)
......
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -48,7 +48,7 @@ public:
bool hasFeature(const String& feature, const String& version) const;
PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&);
PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
DOMImplementationFront* getInterface(const String& feature) const;
DOMImplementationFront* getInterface(const String& feature);
PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
};
......
......@@ -158,11 +158,7 @@ static bool isSVG11Feature(const String &feature)
}
#endif
DOMImplementation::~DOMImplementation()
{
}
bool DOMImplementation::hasFeature (const String& feature, const String& version) const
bool DOMImplementation::hasFeature(const String& feature, const String& version)
{
String lower = feature.lower();
if (lower == "core" || lower == "html" || lower == "xml" || lower == "xhtml")
......@@ -204,12 +200,11 @@ PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const String& qua
if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec))
return 0;
return new DocumentType(this, 0, qualifiedName, publicId, systemId);
return DocumentType::create(0, qualifiedName, publicId, systemId);
}
DOMImplementation* DOMImplementation::getInterface(const String& /*feature*/) const
DOMImplementation* DOMImplementation::getInterface(const String& /*feature*/)
{
// ###
return 0;
}
......@@ -219,19 +214,19 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceUR
// WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was
// created from a different implementation.
bool shouldThrowWrongDocErr = false;
if (doctype && (doctype->document() || doctype->implementation() != this))
if (doctype && doctype->document())
shouldThrowWrongDocErr = true;
RefPtr<Document> doc;
#if ENABLE(SVG)
if (namespaceURI == SVGNames::svgNamespaceURI)
doc = new SVGDocument(this, 0);
doc = SVGDocument::create(0);
else
#endif
if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
doc = new Document(this, 0, true);
else
doc = new Document(this, 0);
if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
doc = Document::createXHTML(0);
else
doc = Document::create(0);
// now get the interesting parts of the doctype
if (doctype)
......@@ -265,18 +260,12 @@ PassRefPtr<CSSStyleSheet> DOMImplementation::createCSSStyleSheet(const String&,
PassRefPtr<Document> DOMImplementation::createDocument(Frame* frame)
{
return new Document(this, frame);
return Document::create(frame);
}
PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(Frame* frame)
{
return new HTMLDocument(this, frame);
}
DOMImplementation* DOMImplementation::instance()
{
static DOMImplementation* staticInstance = new DOMImplementation;
return staticInstance;
return HTMLDocument::create(frame);
}
bool DOMImplementation::isXMLMIMEType(const String& mimeType)
......@@ -300,7 +289,7 @@ bool DOMImplementation::isTextMIMEType(const String& mimeType)
PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
{
RefPtr<HTMLDocument> d = new HTMLDocument(this, 0);
RefPtr<HTMLDocument> d = HTMLDocument::create(0);
d->open();
d->write("<!doctype html><html><head><title>" + title + "</title></head><body></body></html>");
return d.release();
......@@ -310,19 +299,19 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame
{
if (inViewSourceMode) {
if (type == "text/html" || type == "application/xhtml+xml" || type == "image/svg+xml" || isTextMIMEType(type) || isXMLMIMEType(type))
return new HTMLViewSourceDocument(this, frame, type);
return HTMLViewSourceDocument::create(frame, type);
}
// Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those.
if (type == "text/html")
return new HTMLDocument(this, frame);
return HTMLDocument::create(frame);
if (type == "application/xhtml+xml")
return new Document(this, frame, true);
return Document::createXHTML(frame);
#if ENABLE(FTPDIR)
// Plugins cannot take FTP from us either
if (type == "application/x-ftp-directory")
return new FTPDirectoryDocument(this, frame);
return FTPDirectoryDocument::create(frame);
#endif
PluginData* pluginData = 0;
......@@ -332,16 +321,16 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame
// PDF is one image type for which a plugin can override built-in support.
// We do not want QuickTime to take over all image types, obviously.
if ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type))
return new PluginDocument(this, frame);
return PluginDocument::create(frame);
if (Image::supportsType(type))
return new ImageDocument(this, frame);
return ImageDocument::create(frame);
// Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
// Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle,
// and also serves as an optimization to prevent loading the plug-in database in the common case.
if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type))
return new PluginDocument(this, frame);
return PluginDocument::create(frame);
if (isTextMIMEType(type))
return new TextDocument(this, frame);
return TextDocument::create(frame);
#if ENABLE(SVG)
if (type == "image/svg+xml") {
......@@ -349,13 +338,13 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame
Settings* settings = frame ? frame->settings() : 0;
if (!settings || !settings->usesDashboardBackwardCompatibilityMode())
#endif
return new SVGDocument(this, frame);
return SVGDocument::create(frame);
}
#endif
if (isXMLMIMEType(type))
return new Document(this, frame);
return Document::create(frame);
return new HTMLDocument(this, frame);
return HTMLDocument::create(frame);
}
}
......@@ -24,8 +24,8 @@
#ifndef DOMImplementation_h
#define DOMImplementation_h
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Forward.h>
namespace WebCore {
......@@ -40,29 +40,25 @@ typedef int ExceptionCode;
class DOMImplementation : public RefCounted<DOMImplementation> {
public:
~DOMImplementation();
static PassRefPtr<DOMImplementation> create() { return adoptRef(new DOMImplementation); }
// DOM methods & attributes for DOMImplementation
bool hasFeature(const String& feature, const String& version) const;
PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String &systemId, ExceptionCode&);
PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
static bool hasFeature(const String& feature, const String& version);
static PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String &systemId, ExceptionCode&);
static PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
DOMImplementation* getInterface(const String& feature) const;
DOMImplementation* getInterface(const String& feature);
// From the DOMImplementationCSS interface
PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
static PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&);
// From the HTMLDOMImplementation interface
PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
static PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
// Other methods (not part of DOM)
PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, bool inViewSourceMode);
PassRefPtr<Document> createDocument(Frame*);
PassRefPtr<HTMLDocument> createHTMLDocument(Frame*);
// Returns the static instance of this class - only one instance of this class should
// ever be present, and is used as a factory method for creating Document objects
static DOMImplementation* instance();
static PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, bool inViewSourceMode);
static PassRefPtr<Document> createDocument(Frame*);
static PassRefPtr<HTMLDocument> createHTMLDocument(Frame*);
static bool isXMLMIMEType(const String& MIMEType);
static bool isTextMIMEType(const String& MIMEType);
......
......@@ -258,10 +258,8 @@ static bool acceptsEditingFocus(Node *node)
static DeprecatedPtrList<Document>* changedDocuments = 0;
// FrameView might be 0
Document::Document(DOMImplementation* impl, Frame* frame, bool isXHTML)
Document::Document(Frame* frame, bool isXHTML)
: ContainerNode(0)
, m_implementation(impl)
, m_domtree_version(0)
, m_styleSheets(StyleSheetList::create(this))
, m_title("")
......@@ -486,6 +484,8 @@ void Document::setDocType(PassRefPtr<DocumentType> docType)
DOMImplementation* Document::implementation() const
{
if (!m_implementation)
m_implementation = DOMImplementation::create();
return m_implementation.get();
}
......
......@@ -167,7 +167,14 @@ struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> {
class Document : public ContainerNode {
public:
Document(DOMImplementation*, Frame*, bool isXHTML = false);
static PassRefPtr<Document> create(Frame* frame)
{
return new Document(frame, false);
}
static PassRefPtr<Document> createXHTML(Frame* frame)
{
return new Document(frame, true);
}
virtual ~Document();
virtual void removedLastRef();
......@@ -739,6 +746,9 @@ public:
CanvasRenderingContext2D* getCSSCanvasContext(const String& type, const String& name, int width, int height);
HTMLCanvasElement* getCSSCanvasElement(const String& name);
protected:
Document(Frame*, bool isXHTML);
private:
CSSStyleSelector* m_styleSelector;
bool m_didCalculateStyleSelector;
......@@ -752,7 +762,7 @@ private:
String m_baseTarget;
RefPtr<DocumentType> m_docType;
RefPtr<DOMImplementation> m_implementation;
mutable RefPtr<DOMImplementation> m_implementation;
RefPtr<StyleSheet> m_sheet;
#if FRAME_LOADS_USER_STYLESHEET
......
......@@ -29,15 +29,6 @@
namespace WebCore {
DocumentType::DocumentType(DOMImplementation* i, Document* document, const String& n, const String& p, const String& s)
: Node(document)
, m_implementation(i)
, m_name(n)
, m_publicId(p)
, m_systemId(s)
{
}
DocumentType::DocumentType(Document* document, const String& n, const String& p, const String& s)
: Node(document)
, m_name(n)
......@@ -46,16 +37,6 @@ DocumentType::DocumentType(Document* document, const String& n, const String& p,
{
}
DocumentType::DocumentType(Document* document, const DocumentType &t)
: Node(document)
, m_implementation(t.m_implementation)
, m_name(t.m_name)
, m_publicId(t.m_publicId)
, m_systemId(t.m_systemId)
, m_subset(t.m_subset)
{
}
KURL DocumentType::baseURI() const
{
return KURL();
......
/*
* This file is part of the DOM implementation for KDE.
*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -22,6 +20,7 @@
* Boston, MA 02110-1301, USA.
*
*/
#ifndef DocumentType_h
#define DocumentType_h
......@@ -30,29 +29,26 @@
namespace WebCore {
class NamedNodeMap;
class DOMImplementation;
class DocumentType : public Node
{
class DocumentType : public Node {
public:
DocumentType(DOMImplementation *, Document *, const String &name, const String &publicId, const String &systemId);
DocumentType(Document *, const String &name, const String &publicId, const String &systemId);
DocumentType(Document *, const DocumentType &);
static PassRefPtr<DocumentType> create(Document* document, const String& name, const String& publicId, const String& systemId)
{
return new DocumentType(document, name, publicId, systemId);
}
// DOM methods & attributes for DocumentType
NamedNodeMap *entities() const { return m_entities.get(); }
NamedNodeMap *notations() const { return m_notations.get(); }
NamedNodeMap* entities() const { return m_entities.get(); }
NamedNodeMap* notations() const { return m_notations.get(); }
String name() const { return m_name; }
String publicId() const { return m_publicId; }
String systemId() const { return m_systemId; }
String internalSubset() const { return m_subset; }
virtual KURL baseURI() const;
const String& name() const { return m_name; }
const String& publicId() const { return m_publicId; }
const String& systemId() const { return m_systemId; }
const String& internalSubset() const { return m_subset; }
// Other methods (not part of DOM)
DOMImplementation *implementation() const { return m_implementation.get(); }
private:
DocumentType(Document*, const String& name, const String& publicId, const String& systemId);
virtual KURL baseURI() const;
virtual String nodeName() const;
virtual NodeType nodeType() const;
virtual PassRefPtr<Node> cloneNode(bool deep);
......@@ -60,8 +56,6 @@ public:
virtual void insertedIntoDocument();
virtual void removedFromDocument();
private:
RefPtr<DOMImplementation> m_implementation;
RefPtr<NamedNodeMap> m_entities;
RefPtr<NamedNodeMap> m_notations;
......@@ -71,6 +65,6 @@ private:
String m_subset;
};
} //namespace
} // namespace WebCore
#endif
......@@ -83,7 +83,7 @@ struct NodeListsNodeData {
bool Node::isSupported(const String& feature, const String& version)
{
return DOMImplementation::instance()->hasFeature(feature, version);
return DOMImplementation::hasFeature(feature, version);
}
#ifndef NDEBUG
......
......@@ -1092,7 +1092,7 @@ void XMLTokenizer::internalSubset(const xmlChar* name, const xmlChar* externalID
}
if (m_doc)
m_doc->addChild(new DocumentType(m_doc, toString(name), toString(externalID), toString(systemID)));
m_doc->addChild(DocumentType::create(m_doc, toString(name), toString(externalID), toString(systemID)));
}
static inline XMLTokenizer* getTokenizer(void* closure)
......
......@@ -80,8 +80,8 @@ namespace WebCore {
using namespace HTMLNames;
HTMLDocument::HTMLDocument(DOMImplementation* implementation, Frame* frame)
: Document(implementation, frame)
HTMLDocument::HTMLDocument(Frame* frame)
: Document(frame, false)
{
clearXMLVersion();
setParseMode(Compat);
......
......@@ -33,11 +33,12 @@ class HTMLElement;
class HTMLDocument : public Document, public CachedResourceClient {
public:
HTMLDocument(DOMImplementation*, Frame*);
static PassRefPtr<HTMLDocument> create(Frame* frame)
{
return new HTMLDocument(frame);
}
virtual ~HTMLDocument();
virtual bool isHTMLDocument() const { return true; }
int width();
int height();
......@@ -68,8 +69,6 @@ public:
void captureEvents();
void releaseEvents();
virtual Tokenizer* createTokenizer();
virtual bool childAllowed(Node*);
virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
......@@ -84,10 +83,14 @@ public:
typedef HashMap<AtomicStringImpl*, int> NameCountMap;
protected:
HTMLDocument(Frame*);
private:
virtual bool isHTMLDoc