зеркало из https://github.com/mozilla/gecko-dev.git
Bug 333673 - document.implementation != document.implementation, r=peterv
--HG-- extra : rebase_source : eb0ce55653b586242f6da43e0c95f6aaf914342b
This commit is contained in:
Родитель
cc4efd34d3
Коммит
65dbfbe2ba
|
@ -1785,6 +1785,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLayoutHistoryState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnloadBlocker)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation)
|
||||
|
||||
// An element will only be in the linkmap as long as it's in the
|
||||
// document, so we'll traverse the table here instead of from the element.
|
||||
|
@ -1837,6 +1838,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedRootContent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDisplayDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
||||
|
||||
|
@ -4095,22 +4097,22 @@ nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype)
|
|||
NS_IMETHODIMP
|
||||
nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
|
||||
{
|
||||
// For now, create a new implementation every time. This shouldn't
|
||||
// be a high bandwidth operation
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), "about:blank");
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY);
|
||||
PRBool hasHadScriptObject = PR_TRUE;
|
||||
nsIScriptGlobalObject* scriptObject =
|
||||
GetScriptHandlingObject(hasHadScriptObject);
|
||||
NS_ENSURE_STATE(scriptObject || !hasHadScriptObject);
|
||||
*aImplementation = new nsDOMImplementation(scriptObject, uri, uri,
|
||||
NodePrincipal());
|
||||
if (!*aImplementation) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!mDOMImplementation) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), "about:blank");
|
||||
NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY);
|
||||
PRBool hasHadScriptObject = PR_TRUE;
|
||||
nsIScriptGlobalObject* scriptObject =
|
||||
GetScriptHandlingObject(hasHadScriptObject);
|
||||
NS_ENSURE_STATE(scriptObject || !hasHadScriptObject);
|
||||
mDOMImplementation = new nsDOMImplementation(scriptObject, uri, uri,
|
||||
NodePrincipal());
|
||||
if (!mDOMImplementation) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*aImplementation);
|
||||
NS_ADDREF(*aImplementation = mDOMImplementation);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
#include "nsISecurityEventSink.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
|
||||
#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0)
|
||||
#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1)
|
||||
|
@ -1277,6 +1278,8 @@ private:
|
|||
// All images in process of being preloaded
|
||||
nsCOMArray<imgIRequest> mPreloadingImages;
|
||||
|
||||
nsCOMPtr<nsIDOMDOMImplementation> mDOMImplementation;
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
nsAutoPtr<nsSMILAnimationController> mAnimationController;
|
||||
#endif // MOZ_SMIL
|
||||
|
|
|
@ -79,6 +79,7 @@ _TEST_FILES = test_bug5141.html \
|
|||
test_bug311681.xml \
|
||||
test_bug322317.html \
|
||||
test_bug330925.xhtml \
|
||||
test_bug333673.html \
|
||||
test_bug337631.html \
|
||||
test_bug338541.xhtml \
|
||||
test_bug338679.html \
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=333673
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 333673</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333673">Mozilla Bug 333673</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 333673 **/
|
||||
|
||||
is(document.implementation, document.implementation,
|
||||
"document.implementation should be the same object all the time.");
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче