diff --git a/content/base/public/nsIScriptElement.h b/content/base/public/nsIScriptElement.h
index 02105ef13f67..5e7e1b99e069 100644
--- a/content/base/public/nsIScriptElement.h
+++ b/content/base/public/nsIScriptElement.h
@@ -45,6 +45,7 @@
#include "nsIScriptLoaderObserver.h"
#include "nsWeakPtr.h"
#include "nsIParser.h"
+#include "nsContentCreatorFunctions.h"
#define NS_ISCRIPTELEMENT_IID \
{ 0x6d625b30, 0xfac4, 0x11de, \
@@ -57,14 +58,15 @@ class nsIScriptElement : public nsIScriptLoaderObserver {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTELEMENT_IID)
- nsIScriptElement()
+ nsIScriptElement(PRUint32 aFromParser)
: mLineNumber(0),
- mIsEvaluated(PR_FALSE),
+ mAlreadyStarted(PR_FALSE),
mMalformed(PR_FALSE),
mDoneAddingChildren(PR_TRUE),
mFrozen(PR_FALSE),
mDefer(PR_FALSE),
mAsync(PR_FALSE),
+ mParserCreated((PRUint8)aFromParser),
mCreatorParser(nsnull)
{
}
@@ -117,6 +119,15 @@ public:
return mAsync;
}
+ /**
+ * Returns a constant defined in nsContentCreatorFunctions.h. Non-zero
+ * values mean parser-created and zero means not parser-created.
+ */
+ PRUint32 GetParserCreated()
+ {
+ return mParserCreated;
+ }
+
void SetScriptLineNumber(PRUint32 aLineNumber)
{
mLineNumber = aLineNumber;
@@ -137,7 +148,15 @@ public:
void PreventExecution()
{
- mIsEvaluated = PR_TRUE;
+ mAlreadyStarted = PR_TRUE;
+ }
+
+ void LoseParserInsertedness()
+ {
+ mFrozen = PR_FALSE;
+ mUri = nsnull;
+ mCreatorParser = nsnull;
+ mParserCreated = NS_NOT_FROM_PARSER;
}
void SetCreatorParser(nsIParser* aParser)
@@ -185,7 +204,7 @@ protected:
/**
* The "already started" flag per HTML5.
*/
- PRPackedBool mIsEvaluated;
+ PRPackedBool mAlreadyStarted;
/**
* The script didn't have an end tag.
@@ -212,6 +231,11 @@ protected:
*/
PRPackedBool mAsync;
+ /**
+ * Whether this element was parser-created.
+ */
+ PRUint8 mParserCreated;
+
/**
* The effective src (or null if no src).
*/
diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp
index 613a5ef0cb21..ecec06f24669 100644
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -366,8 +366,8 @@ nsContentSink::ScriptAvailable(nsresult aResult,
PRUint32 count = mScriptElements.Count();
// aElement will not be in mScriptElements if a
@@ -59,11 +55,6 @@ res += 'B';
-