Backing out due to test failures

This commit is contained in:
jonas@sicking.cc 2008-04-08 20:20:39 -07:00
Родитель b8460fe033
Коммит 75616dfab3
35 изменённых файлов: 56 добавлений и 74 удалений

Просмотреть файл

@ -1061,6 +1061,45 @@ private:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)
/**
* Helper class to automatically handle batching of document updates. This
* class will call BeginUpdate on construction and EndUpdate on destruction on
* the given document with the given update type. The document could be null,
* in which case no updates will be called. The constructor also takes a
* boolean that can be set to false to prevent notifications.
*/
class mozAutoDocUpdate
{
public:
mozAutoDocUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType,
PRBool aNotify) :
mDocument(aNotify ? aDocument : nsnull),
mUpdateType(aUpdateType)
{
if (mDocument) {
mDocument->BeginUpdate(mUpdateType);
}
}
~mozAutoDocUpdate()
{
if (mDocument) {
mDocument->EndUpdate(mUpdateType);
}
}
private:
nsCOMPtr<nsIDocument> mDocument;
nsUpdateType mUpdateType;
};
#define MOZ_AUTO_DOC_UPDATE_PASTE2(tok,line) tok##line
#define MOZ_AUTO_DOC_UPDATE_PASTE(tok,line) \
MOZ_AUTO_DOC_UPDATE_PASTE2(tok,line)
#define MOZ_AUTO_DOC_UPDATE(doc,type,notify) \
mozAutoDocUpdate MOZ_AUTO_DOC_UPDATE_PASTE(_autoDocUpdater_, __LINE__) \
(doc,type,notify)
/**
* mozAutoSubtreeModified batches DOM mutations so that a DOMSubtreeModified
* event is dispatched, if necessary, when the outermost mozAutoSubtreeModified

Просмотреть файл

@ -102,7 +102,6 @@ EXPORTS = \
nsStubImageDecoderObserver.h \
nsStubMutationObserver.h \
nsTextFragment.h \
mozAutoDocUpdate.h \
$(NULL)
CPPSRCS = \

Просмотреть файл

@ -642,7 +642,6 @@ nsAttrAndChildArray::Clear()
ATTRS(mImpl)[i].~InternalAttr();
}
nsAutoScriptBlocker scriptBlocker;
PRUint32 end = slotCount * ATTRSIZE + ChildCount();
for (i = slotCount * ATTRSIZE; i < end; ++i) {
nsIContent* child = static_cast<nsIContent*>(mImpl->mBuffer[i]);

Просмотреть файл

@ -93,7 +93,6 @@
#include "nsThreadUtils.h"
#include "nsPresShellIterator.h"
#include "nsPIDOMWindow.h"
#include "mozAutoDocUpdate.h"
PRLogModuleInfo* gContentSinkLogModuleInfo;

Просмотреть файл

@ -162,8 +162,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIScriptError.h"
#include "nsIConsoleService.h"
#include "mozAutoDocUpdate.h"
const char kLoadAsData[] = "loadAsData";
static const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1";

Просмотреть файл

@ -160,8 +160,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "nsFrameLoader.h"
#include "mozAutoDocUpdate.h"
#ifdef MOZ_LOGGING
// so we can get logging even in release builds
#define FORCE_PR_LOG 1
@ -833,8 +831,6 @@ nsDocument::~nsDocument()
// links one by one
DestroyLinkMap();
nsAutoScriptBlocker scriptBlocker;
PRInt32 indx; // must be signed
PRUint32 count = mChildren.ChildCount();
for (indx = PRInt32(count) - 1; indx >= 0; --indx) {
@ -1089,8 +1085,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
// from the doc.
tmp->DestroyLinkMap();
nsAutoScriptBlocker scriptBlocker;
// Unlink the mChildren nsAttrAndChildArray.
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1;
indx >= 0; --indx) {

Просмотреть файл

@ -62,7 +62,6 @@
#include "nsNodeUtils.h"
#include "nsBindingManager.h"
#include "nsCCUncollectableMarker.h"
#include "mozAutoDocUpdate.h"
#include "pldhash.h"
#include "prprf.h"

Просмотреть файл

@ -138,8 +138,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCCUncollectableMarker.h"
#include "mozAutoDocUpdate.h"
#ifdef MOZ_SVG
PRBool NS_SVG_TestFeature(const nsAString &fstr);
#endif /* MOZ_SVG */
@ -2045,8 +2043,7 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_PRECONDITION(!IsNativeAnonymous() || aBindingParent == this,
"Native anonymous content must have itself as its "
"own binding parent");
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(), "Need a script blocker!");
if (!aBindingParent && aParent) {
aBindingParent = aParent->GetBindingParent();
}
@ -2178,7 +2175,6 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
NS_PRECONDITION(aDeep || (!GetCurrentDoc() && !GetBindingParent()),
"Shallow unbind won't clear document and binding parent on "
"kids!");
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(), "Need a script blocker!");
// Make sure to unbind this node before doing the kids
nsIDocument *document =
HasFlag(NODE_FORCE_XBL_BINDINGS) ? GetOwnerDoc() : GetCurrentDoc();
@ -3460,17 +3456,13 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
// Unlink child content (and unbind our subtree).
{
PRUint32 childCount = tmp->mAttrsAndChildren.ChildCount();
if (childCount) {
// Don't allow script to run while we're unbinding everything.
nsAutoScriptBlocker scriptBlocker;
while (childCount-- > 0) {
// Once we have XPCOMGC we shouldn't need to call UnbindFromTree.
// We could probably do a non-deep unbind here when IsInDoc is false
// for better performance.
tmp->mAttrsAndChildren.ChildAt(childCount)->UnbindFromTree();
tmp->mAttrsAndChildren.RemoveChildAt(childCount);
}
PRUint32 i;
PRUint32 kids = tmp->mAttrsAndChildren.ChildCount();
for (i = kids; i > 0; i--) {
// We could probably do a non-deep unbind here when IsInDoc is false
// for better performance.
tmp->mAttrsAndChildren.ChildAt(i-1)->UnbindFromTree();
tmp->mAttrsAndChildren.RemoveChildAt(i-1);
}
}

Просмотреть файл

@ -77,8 +77,6 @@
#include "nsEventDispatcher.h"
#include "nsDOMClassInfo.h"
#include "mozAutoDocUpdate.h"
#ifdef DEBUG_chb
static void PrintReqURL(imgIRequest* req) {
if (!req) {

Просмотреть файл

@ -83,7 +83,6 @@
#include "nsFrameLoader.h"
#include "nsObjectLoadingContent.h"
#include "mozAutoDocUpdate.h"
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);

Просмотреть файл

@ -66,7 +66,6 @@ public:
NS_IMETHOD Run();
nsresult PostDOMEvent();
nsresult RunDOMEventWhenSafe();
nsCOMPtr<nsIDOMNode> mEventNode;
nsCOMPtr<nsIDOMEvent> mEvent;

Просмотреть файл

@ -41,7 +41,6 @@
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsContentUtils.h"
NS_IMETHODIMP nsPLDOMEvent::Run()
{
@ -77,8 +76,3 @@ nsresult nsPLDOMEvent::PostDOMEvent()
{
return NS_DispatchToCurrentThread(this);
}
nsresult nsPLDOMEvent::RunDOMEventWhenSafe()
{
return nsContentUtils::AddScriptRunner(this) ? NS_OK : NS_ERROR_FAILURE;
}

Просмотреть файл

@ -110,7 +110,6 @@
#include "nsEventDispatcher.h"
#include "nsLayoutUtils.h"
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
class nsINodeInfo;
class nsIDOMNodeList;

Просмотреть файл

@ -87,8 +87,6 @@
#include "nsUnicharUtils.h"
#include "nsEventDispatcher.h"
#include "mozAutoDocUpdate.h"
static const int NS_FORM_CONTROL_LIST_HASHTABLE_SIZE = 16;
class nsFormControlList;

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsPresContext.h"
#include "nsMappedAttributes.h"
#include "nsRuleData.h"
#include "mozAutoDocUpdate.h"
class nsHTMLHeadingElement : public nsGenericHTMLElement,
public nsIDOMHTMLHeadingElement

Просмотреть файл

@ -111,8 +111,6 @@
#include "nsImageLoadingContent.h"
#include "nsIDOMWindowInternal.h"
#include "mozAutoDocUpdate.h"
// XXX align=left, hspace, vspace, border? other nav4 attrs
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);

Просмотреть файл

@ -209,6 +209,10 @@ nsHTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
UpdateStyleSheetInternal(nsnull);
// XXXbz we really shouldn't fire the event until after we've finished with
// the outermost BindToTree... In particular, this can effectively cause us
// to reenter this code, or for some part of the document to become unbound
// inside the event!
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));
return rv;
@ -239,8 +243,10 @@ nsHTMLLinkElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
mLinkState = eLinkState_Unknown;
}
// Once we have XPCOMGC we shouldn't need to call UnbindFromTree during Unlink
// and so this messy event dispatch can go away.
// XXXbz we really shouldn't fire the event until after we've finished with
// the outermost UnbindFromTree... In particular, this can effectively cause
// us to reenter this code, or to be bound to a different tree inside the
// event!
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc);
@ -270,7 +276,7 @@ nsHTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
nsRefPtr<nsPLDOMEvent> event = new nsPLDOMEvent(this, aEventName);
if (event) {
event->RunDOMEventWhenSafe();
event->PostDOMEvent();
}
}

Просмотреть файл

@ -69,7 +69,6 @@
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
/**
* Implementation of &lt;option&gt;

Просмотреть файл

@ -75,7 +75,6 @@
#include "nsLayoutErrors.h"
#include "nsStubMutationObserver.h"
#include "nsDOMError.h"
#include "mozAutoDocUpdate.h"
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);

Просмотреть файл

@ -121,7 +121,6 @@
#include "nsIElementObserver.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
#ifdef NS_DEBUG
static PRLogModuleInfo* gSinkLogModuleInfo;

Просмотреть файл

@ -140,7 +140,6 @@
#include "nsIEditorStyleSheets.h"
#include "nsIInlineSpellChecker.h"
#include "nsRange.h"
#include "mozAutoDocUpdate.h"
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20

Просмотреть файл

@ -51,7 +51,6 @@
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsDOMClassInfoID.h"
#include "mozAutoDocUpdate.h"
//----------------------------------------------------------------------
// nsISupports methods:

Просмотреть файл

@ -65,7 +65,6 @@ NS_IMPL_NS_NEW_SVG_ELEMENT(Use)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsSVGUseElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsSVGUseElement,
nsSVGUseElementBase)
nsAutoScriptBlocker scriptBlocker;
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginal)
tmp->DestroyAnonymousContent();
tmp->RemoveListener();

Просмотреть файл

@ -345,8 +345,6 @@ nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElem
nsIDocument* doc = aElement->GetCurrentDoc();
PRBool allowScripts = AllowScripts();
nsAutoScriptBlocker scriptBlocker;
PRUint32 childCount = aAnonParent->GetChildCount();
for (PRUint32 i = 0; i < childCount; i++) {
nsIContent *child = aAnonParent->GetChildAt(i);
@ -1141,7 +1139,6 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
nsCOMPtr<nsIXULDocument> xuldoc(do_QueryInterface(aOldDocument));
#endif
nsAutoScriptBlocker scriptBlocker;
anonymous->UnbindFromTree(); // Kill it.
#ifdef MOZ_XUL

Просмотреть файл

@ -37,7 +37,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsXBLInsertionPoint.h"
#include "nsContentUtils.h"
nsXBLInsertionPoint::nsXBLInsertionPoint(nsIContent* aParentElement,
PRUint32 aIndex,
@ -126,8 +125,6 @@ nsXBLInsertionPoint::UnbindDefaultContent()
// Hold a strong ref while doing this, just in case
nsCOMPtr<nsIContent> defContent = mDefaultContent;
nsAutoScriptBlocker scriptBlocker;
// Unbind the _kids_ of the default content, not just the default content
// itself, since they are bound to some other parent. Basically we want to
// undo the mess that InstallAnonymousContent created.

Просмотреть файл

@ -141,7 +141,6 @@ class nsXBLInsertionPointEntry {
public:
~nsXBLInsertionPointEntry() {
if (mDefaultContent) {
nsAutoScriptBlocker scriptBlocker;
// mDefaultContent is a sort of anonymous content within the XBL
// document, and we own and manage it. Unhook it here, since we're going
// away.
@ -249,7 +248,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLInsertionPointEntry)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLInsertionPointEntry)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInsertionParent)
if (tmp->mDefaultContent) {
nsAutoScriptBlocker scriptBlocker;
// mDefaultContent is a sort of anonymous content within the XBL
// document, and we own and manage it. Unhook it here, since we're going
// away.
@ -1287,7 +1285,6 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
// in situations where no content ends up being placed at the insertion point.
PRUint32 defaultCount = child->GetChildCount();
if (defaultCount > 0) {
nsAutoScriptBlocker scriptBlocker;
// Annotate the insertion point with our default content.
xblIns->SetDefaultContent(child);

Просмотреть файл

@ -96,7 +96,6 @@
#include "nsNodeUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsEventDispatcher.h"
#include "mozAutoDocUpdate.h"
#ifdef MOZ_SVG
#include "nsGUIEvent.h"

Просмотреть файл

@ -62,7 +62,6 @@
#include "nsIProgrammingLanguage.h"
#include "nsIXPConnect.h"
#include "nsXTFWeakTearoff.h"
#include "mozAutoDocUpdate.h"
nsXTFElementWrapper::nsXTFElementWrapper(nsINodeInfo* aNodeInfo,
nsIXTFElement* aXTFElement)

Просмотреть файл

@ -151,7 +151,6 @@
#include "nsXBLBinding.h"
#include "nsEventDispatcher.h"
#include "nsPresShellIterator.h"
#include "mozAutoDocUpdate.h"
/**
* Three bits are used for XUL Element's lazy state.

Просмотреть файл

@ -66,7 +66,6 @@
#include "nsContentUtils.h"
#include "nsAttrName.h"
#include "nsNodeUtils.h"
#include "mozAutoDocUpdate.h"
#include "jsapi.h"
#include "pldhash.h"

Просмотреть файл

@ -13452,8 +13452,6 @@ nsCSSFrameConstructor::ProcessPendingRestyles()
// already processing, sending us into an infinite loop.
mPendingRestyles.Clear();
nsAutoScriptBlocker scriptBlocker;
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
BeginUpdate();

Просмотреть файл

@ -1704,8 +1704,6 @@ PresShell::Destroy()
CancelAllPendingReflows();
CancelPostedReflowCallbacks();
nsAutoScriptBlocker scriptBlocker;
// Destroy the frame manager. This will destroy the frame hierarchy
mFrameConstructor->WillDestroyFrameTree();
FrameManager()->Destroy();
@ -4607,7 +4605,6 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
// be good.
if (aType >= Flush_Layout && !mIsDestroying) {
nsAutoScriptBlocker scriptBlocker;
mFrameConstructor->RecalcQuotesAndCounters();
ProcessReflowCommands(aInterruptibleReflow);
}

Просмотреть файл

@ -75,7 +75,6 @@
#include "nsIContent.h"
#include "nsDisplayList.h"
#include "nsNodeUtils.h"
#include "mozAutoDocUpdate.h"
// masks for mEdgeVisibility
#define LEFT_VIS 0x0001

Просмотреть файл

@ -76,7 +76,6 @@
#include "nsContentUtils.h"
#include "nsContentErrors.h"
#include "mozAutoDocUpdate.h"
#define NS_IF_CLONE(member_) \
PR_BEGIN_MACRO \

Просмотреть файл

@ -74,7 +74,6 @@
#include "nsContentUtils.h"
#include "nsIJSContextStack.h"
#include "nsIScriptSecurityManager.h"
#include "mozAutoDocUpdate.h"
// -------------------------------
// Style Rule List for the DOM