Merge mozilla-central to tracemonkey.

This commit is contained in:
Robert Sayre
2010-07-20 15:07:03 -07:00
1753 changed files with 106286 additions and 36260 deletions

View File

@@ -99,7 +99,7 @@
#include "nsIDOMHTMLHeadElement.h"
#include "nsINameSpaceManager.h"
#include "nsGenericHTMLElement.h"
#include "nsCSSLoader.h"
#include "mozilla/css/Loader.h"
#include "nsIHttpChannel.h"
#include "nsIFile.h"
#include "nsIEventListenerManager.h"
@@ -2169,12 +2169,34 @@ nsHTMLDocument::WriteCommon(const nsAString& aText,
(mWriteState == ePendingClose &&
!mPendingScripts.Contains(key)) ||
(mParser && !mParser->IsInsertionPointDefined())) {
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nsnull, 0,
mDocumentURI,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
return NS_OK;
}
mWriteState = eDocumentClosed;
mParser->Terminate();
NS_ASSERTION(!mParser, "mParser should have been null'd out");
}
if (!mParser) {
if (mExternalScriptsBeingEvaluated) {
// Instead of implying a call to document.open(), ignore the call.
nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"DocumentWriteIgnored",
nsnull, 0,
mDocumentURI,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
return NS_OK;
}
rv = Open();
// If Open() fails, or if it didn't create a parser (as it won't
@@ -2983,6 +3005,30 @@ nsHTMLDocument::EndUpdate(nsUpdateType aUpdateType)
MaybeEditingStateChanged();
}
// Helper class, used below in ChangeContentEditableCount().
class DeferredContentEditableCountChangeEvent : public nsRunnable
{
public:
DeferredContentEditableCountChangeEvent(nsHTMLDocument *aDoc,
nsIContent *aElement)
: mDoc(aDoc)
, mElement(aElement)
{
}
NS_IMETHOD Run() {
if (mElement->GetOwnerDoc() == mDoc) {
mDoc->DeferredContentEditableCountChange(mElement);
}
return NS_OK;
}
private:
nsRefPtr<nsHTMLDocument> mDoc;
nsCOMPtr<nsIContent> mElement;
};
nsresult
nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement,
PRInt32 aChange)
@@ -2992,27 +3038,6 @@ nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement,
mContentEditableCount += aChange;
class DeferredContentEditableCountChangeEvent : public nsRunnable
{
public:
DeferredContentEditableCountChangeEvent(nsHTMLDocument *aDoc, nsIContent *aElement)
: mDoc(aDoc)
, mElement(aElement)
{
}
NS_IMETHOD Run() {
if (mElement->GetOwnerDoc() == mDoc) {
mDoc->DeferredContentEditableCountChange(mElement);
}
return NS_OK;
}
private:
nsRefPtr<nsHTMLDocument> mDoc;
nsCOMPtr<nsIContent> mElement;
};
nsContentUtils::AddScriptRunner(
new DeferredContentEditableCountChangeEvent(this, aElement));
@@ -3306,6 +3331,10 @@ nsHTMLDocument::EditingStateChanged()
// designMode is being turned on (overrides contentEditable).
editorss->AddOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/designmode.css"));
// We need to flush styles here because we're setting an XBL binding in
// designmode.css.
FlushPendingNotifications(Flush_Style);
// Disable scripting and plugins.
rv = editSession->DisableJSAndPlugins(window);
NS_ENSURE_SUCCESS(rv, rv);

View File

@@ -68,15 +68,15 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCSSParser.h"
#include "nsCSSProperty.h"
#include "nsCSSDeclaration.h"
#include "mozilla/css/Declaration.h"
#include "nsICSSStyleRule.h"
#include "nsUnicharInputStream.h"
#include "nsCSSStyleSheet.h"
#include "nsICSSRuleList.h"
#include "nsCSSDeclaration.h"
#include "nsCSSProperty.h"
#include "nsIDOMCSSRule.h"
namespace css = mozilla::css;
//
// XXX THIS IS TEMPORARY CODE
// There's a considerable amount of copied code from the
@@ -1164,11 +1164,7 @@ nsHTMLParanoidFragmentSink::CloseContainer(const nsHTMLTag aTag)
if (NS_FAILED(rv))
continue;
NS_ASSERTION(rule, "We should have a rule by now");
PRInt32 type;
rv = rule->GetType(type);
if (NS_FAILED(rv))
continue;
switch (type) {
switch (rule->GetType()) {
case nsICSSRule::UNKNOWN_RULE:
case nsICSSRule::CHARSET_RULE:
case nsICSSRule::IMPORT_RULE:
@@ -1219,7 +1215,7 @@ void
nsHTMLParanoidFragmentSink::SanitizeStyleRule(nsICSSStyleRule *aRule, nsAutoString &aRuleText)
{
aRuleText.Truncate();
nsCSSDeclaration *style = aRule->GetDeclaration();
css::Declaration *style = aRule->GetDeclaration();
if (style) {
nsresult rv = style->RemoveProperty(eCSSProperty_binding);
if (NS_SUCCEEDED(rv)) {