Bug 1424220 - Set mCurrentHtmlScriptIsAsyncOrDefer to false when restoring tree builder state. r=smaug

MozReview-Commit-ID: 9gsFme52mOG

--HG--
extra : rebase_source : d71040069ff4b3db476bf4cf3c08258def019f5a
This commit is contained in:
Henri Sivonen 2018-01-15 20:07:28 +02:00
parent f9a358875b
commit 71f07dccfb
10 changed files with 2 additions and 68 deletions

View File

@ -6218,6 +6218,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
@SuppressWarnings("unchecked") public void loadState(
TreeBuilderState<T> snapshot, Interner interner)
throws SAXException {
// CPPONLY: mCurrentHtmlScriptIsAsyncOrDefer = false;
StackNode<T>[] stackCopy = snapshot.getStack();
int stackLen = snapshot.getStackLength();
StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();

View File

@ -58,15 +58,12 @@ class nsHtml5AttributeName
{
public:
static int32_t* ALL_NO_NS;
private:
static int32_t* XMLNS_NS;
static int32_t* XML_NS;
static int32_t* XLINK_NS;
public:
static nsAtom** ALL_NO_PREFIX;
private:
static nsAtom** XMLNS_PREFIX;
static nsAtom** XLINK_PREFIX;
@ -74,7 +71,6 @@ private:
static nsAtom** SVG_DIFFERENT(nsAtom* name, nsAtom* camel);
static nsAtom** MATH_DIFFERENT(nsAtom* name, nsAtom* camel);
static nsAtom** COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix);
public:
static nsAtom** SAME_LOCAL(nsAtom* name);
inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
@ -162,7 +158,6 @@ private:
nsAtom** prefix;
bool custom;
nsHtml5AttributeName(int32_t* uri, nsAtom** local, nsAtom** prefix);
public:
nsHtml5AttributeName();
inline bool isInterned() { return !custom; }
@ -673,11 +668,9 @@ public:
static nsHtml5AttributeName* ATTR_FY;
static nsHtml5AttributeName* ATTR_RY;
static nsHtml5AttributeName* ATTR_REFY;
private:
static nsHtml5AttributeName** ATTRIBUTE_NAMES;
static staticJArray<int32_t, int32_t> ATTRIBUTE_HASHES;
public:
static void initializeStatics();
static void releaseStatics();

View File

@ -80,7 +80,6 @@ private:
nsAtom* camelCaseName;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
mozilla::dom::SVGContentCreatorFunction svgCreator;
public:
int32_t flags;
inline nsAtom* getName() { return name; }
@ -405,11 +404,9 @@ public:
static nsHtml5ElementName* ELT_RUBY;
static nsHtml5ElementName* ELT_SUMMARY;
static nsHtml5ElementName* ELT_TBODY;
private:
static nsHtml5ElementName** ELEMENT_NAMES;
static staticJArray<int32_t, int32_t> ELEMENT_HASHES;
public:
static void initializeStatics();
static void releaseStatics();

View File

@ -120,17 +120,14 @@ private:
protected:
nsHtml5ByteReadable* readable;
private:
int32_t metaState;
int32_t contentIndex;
int32_t charsetIndex;
int32_t httpEquivIndex;
int32_t contentTypeIndex;
protected:
int32_t stateSave;
private:
int32_t strBufLen;
autoJArray<char16_t, int32_t> strBuf;
@ -138,14 +135,11 @@ private:
nsHtml5String charset;
int32_t httpEquivState;
nsHtml5TreeBuilder* treeBuilder;
public:
explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
~nsHtml5MetaScanner();
protected:
void stateLoop(int32_t state);
private:
void handleCharInAttributeValue(int32_t c);
inline int32_t toAsciiLowerCase(int32_t c)
@ -160,10 +154,8 @@ private:
void handleAttributeValue();
bool handleTag();
bool handleTagInner();
protected:
bool tryCharset(nsHtml5String encoding);
public:
static void initializeStatics();
static void releaseStatics();

View File

@ -66,11 +66,9 @@ public:
int32_t ns;
nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes;
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
public:
inline int32_t getFlags() { return flags; }
@ -106,7 +104,6 @@ public:
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
public:
~nsHtml5StackNode();
void dropAttributes();

View File

@ -68,7 +68,6 @@ private:
bool framesetOk;
bool needToDropLF;
bool quirks;
public:
nsHtml5StateSnapshot(
jArray<nsHtml5StackNode*, int32_t> stack,

View File

@ -235,19 +235,15 @@ private:
static staticJArray<char16_t, int32_t> NOEMBED_ARR;
static staticJArray<char16_t, int32_t> NOSCRIPT_ARR;
static staticJArray<char16_t, int32_t> NOFRAMES_ARR;
protected:
nsHtml5TreeBuilder* tokenHandler;
nsHtml5StreamParser* encodingDeclarationHandler;
bool lastCR;
int32_t stateSave;
private:
int32_t returnStateSave;
protected:
int32_t index;
private:
bool forceQuirks;
char16_t additional;
@ -257,16 +253,12 @@ private:
int32_t hi;
int32_t candidate;
int32_t charRefBufMark;
protected:
int32_t value;
private:
bool seenDigits;
protected:
int32_t cstart;
private:
nsHtml5String publicId;
nsHtml5String systemId;
@ -276,24 +268,18 @@ private:
int32_t charRefBufLen;
autoJArray<char16_t, int32_t> bmpChar;
autoJArray<char16_t, int32_t> astralChar;
protected:
nsHtml5ElementName* endTagExpectation;
private:
jArray<char16_t, int32_t> endTagExpectationAsArray;
protected:
bool endTag;
private:
bool containsHyphen;
nsHtml5ElementName* tagName;
nsHtml5ElementName* nonInternedTagName;
protected:
nsHtml5AttributeName* attributeName;
private:
nsHtml5AttributeName* nonInternedAttributeName;
nsAtom* doctypeName;
@ -302,16 +288,13 @@ private:
nsHtml5HtmlAttributes* attributes;
bool newAttributesEachTime;
bool shouldSuspend;
protected:
bool confident;
private:
int32_t line;
int32_t attributeLine;
nsHtml5AtomTable* interner;
bool viewingXmlSource;
public:
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource);
void setInterner(nsHtml5AtomTable* interner);
@ -324,13 +307,11 @@ public:
private:
void endTagExpectationToArray();
public:
void setLineNumber(int32_t line);
inline int32_t getLineNumber() { return line; }
nsHtml5HtmlAttributes* emptyAttributes();
private:
inline void appendCharRefBuf(char16_t c)
{
@ -369,7 +350,6 @@ private:
protected:
nsHtml5String strBufToString();
private:
void strBufToDoctypeName();
void emitStrBuf();
@ -389,21 +369,17 @@ private:
}
void emitComment(int32_t provisionalHyphens, int32_t pos);
protected:
void flushChars(char16_t* buf, int32_t pos);
private:
void strBufToElementNameString();
int32_t emitCurrentTagToken(bool selfClosing, int32_t pos);
void attributeNameComplete();
void addAttributeWithoutValue();
void addAttributeWithValue();
public:
void start();
bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
private:
template<class P>
int32_t stateLoop(int32_t state,
@ -455,23 +431,18 @@ private:
void bogusDoctype();
void bogusDoctypeWithoutQuirks();
void handleNcrValue(int32_t returnState);
public:
void eof();
private:
void emitDoctypeToken(int32_t pos);
protected:
inline char16_t checkChar(char16_t* buf, int32_t pos) { return buf[pos]; }
public:
bool internalEncodingDeclaration(nsHtml5String internalCharset);
private:
void emitOrAppendTwo(const char16_t* val, int32_t returnState);
void emitOrAppendOne(const char16_t* val, int32_t returnState);
public:
void end();
void requestSuspension();

View File

@ -4928,6 +4928,7 @@ void
nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot,
nsHtml5AtomTable* interner)
{
mCurrentHtmlScriptIsAsyncOrDefer = false;
jArray<nsHtml5StackNode*, int32_t> stackCopy = snapshot->getStack();
int32_t stackLen = snapshot->getStackLength();
jArray<nsHtml5StackNode*, int32_t> listCopy =

View File

@ -71,7 +71,6 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
{
private:
static char16_t REPLACEMENT_CHARACTER[];
public:
static const int32_t OTHER = 0;
@ -288,10 +287,8 @@ private:
int32_t mode;
int32_t originalMode;
bool framesetOk;
protected:
nsHtml5Tokenizer* tokenizer;
private:
bool scriptingEnabled;
bool needToDropLF;
@ -311,11 +308,9 @@ private:
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
protected:
autoJArray<char16_t, int32_t> charBuffer;
int32_t charBufferLen;
private:
bool quirks;
bool isSrcdocDocument;
@ -362,17 +357,14 @@ private:
bool isTemplateContents();
bool isTemplateModeStackEmpty();
bool isSpecialParentInForeign(nsHtml5StackNode* stackNode);
public:
static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue,
nsHtml5TreeBuilder* tb);
private:
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
public:
void endTag(nsHtml5ElementName* elementName);
private:
void endTagTemplateInHead();
int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
@ -435,10 +427,8 @@ private:
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
public:
void notifyUnusedStackNode(int32_t idxInStackNodes);
private:
nsHtml5StackNode* getUnusedStackNode();
nsHtml5StackNode* createStackNode(
@ -521,7 +511,6 @@ private:
void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
@ -579,14 +568,12 @@ protected:
nsHtml5String systemIdentifier);
void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
public:
inline bool cdataSectionAllowed() { return isInForeign(); }
private:
bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsAtom* context,
int32_t ns,
@ -595,16 +582,13 @@ public:
protected:
nsIContentHandle* currentNode();
public:
bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled);
void setIsSrcdocDocument(bool isSrcdocDocument);
void flushCharacters();
private:
bool charBufferContainsNonWhitespace();
public:
nsAHtml5TreeBuilderState* newSnapshot();
bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);

View File

@ -60,7 +60,6 @@ private:
char16_t* buffer;
int32_t start;
int32_t end;
public:
int32_t getStart();
void setStart(int32_t start);