2009-06-28 15:44:22 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Henri Sivonen
|
2010-04-09 08:48:29 -07:00
|
|
|
* Copyright (c) 2008-2010 Mozilla Foundation
|
2009-06-28 15:44:22 -07:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
|
|
|
* Please edit MetaScanner.java instead and regenerate.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define nsHtml5MetaScanner_cpp__
|
|
|
|
|
|
|
|
#include "nsIAtom.h"
|
2009-09-21 04:43:43 -07:00
|
|
|
#include "nsHtml5AtomTable.h"
|
2009-06-28 15:44:22 -07:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsTraceRefcnt.h"
|
|
|
|
#include "jArray.h"
|
|
|
|
#include "nsHtml5ArrayCopy.h"
|
2010-07-30 03:15:38 -07:00
|
|
|
#include "nsAHtml5TreeBuilderState.h"
|
2009-06-28 15:44:22 -07:00
|
|
|
#include "nsHtml5Atoms.h"
|
|
|
|
#include "nsHtml5ByteReadable.h"
|
2009-09-18 02:21:47 -07:00
|
|
|
#include "nsIUnicodeDecoder.h"
|
2010-04-19 06:25:13 -07:00
|
|
|
#include "nsHtml5Macros.h"
|
2009-06-28 15:44:22 -07:00
|
|
|
|
|
|
|
#include "nsHtml5Tokenizer.h"
|
|
|
|
#include "nsHtml5TreeBuilder.h"
|
|
|
|
#include "nsHtml5AttributeName.h"
|
|
|
|
#include "nsHtml5ElementName.h"
|
|
|
|
#include "nsHtml5HtmlAttributes.h"
|
|
|
|
#include "nsHtml5StackNode.h"
|
|
|
|
#include "nsHtml5UTF16Buffer.h"
|
|
|
|
#include "nsHtml5StateSnapshot.h"
|
|
|
|
#include "nsHtml5Portability.h"
|
|
|
|
|
|
|
|
#include "nsHtml5MetaScanner.h"
|
|
|
|
|
2010-12-08 04:37:19 -08:00
|
|
|
static PRUnichar const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' };
|
2013-03-26 00:15:23 -07:00
|
|
|
staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) };
|
2010-12-08 04:37:19 -08:00
|
|
|
static PRUnichar const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' };
|
2013-03-26 00:15:23 -07:00
|
|
|
staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) };
|
2010-12-08 04:37:19 -08:00
|
|
|
static PRUnichar const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' };
|
2013-03-26 00:15:23 -07:00
|
|
|
staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
|
2010-12-08 04:37:19 -08:00
|
|
|
static PRUnichar const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' };
|
2013-03-26 00:15:23 -07:00
|
|
|
staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
|
2010-12-08 04:37:19 -08:00
|
|
|
|
|
|
|
nsHtml5MetaScanner::nsHtml5MetaScanner()
|
2012-07-30 07:20:58 -07:00
|
|
|
: readable(nullptr),
|
2010-12-08 04:37:19 -08:00
|
|
|
metaState(NS_HTML5META_SCANNER_NO),
|
2012-09-27 23:57:33 -07:00
|
|
|
contentIndex(INT32_MAX),
|
|
|
|
charsetIndex(INT32_MAX),
|
|
|
|
httpEquivIndex(INT32_MAX),
|
|
|
|
contentTypeIndex(INT32_MAX),
|
2010-12-08 04:37:19 -08:00
|
|
|
stateSave(NS_HTML5META_SCANNER_DATA),
|
|
|
|
strBufLen(0),
|
2012-08-22 08:56:38 -07:00
|
|
|
strBuf(jArray<PRUnichar,int32_t>::newJArray(36)),
|
2012-07-30 07:20:58 -07:00
|
|
|
content(nullptr),
|
|
|
|
charset(nullptr),
|
2010-12-08 04:37:19 -08:00
|
|
|
httpEquivState(NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(nsHtml5MetaScanner);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsHtml5MetaScanner::~nsHtml5MetaScanner()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(nsHtml5MetaScanner);
|
|
|
|
nsHtml5Portability::releaseString(content);
|
|
|
|
nsHtml5Portability::releaseString(charset);
|
|
|
|
}
|
|
|
|
|
2009-06-28 15:44:22 -07:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsHtml5MetaScanner::stateLoop(int32_t state)
|
2009-06-28 15:44:22 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t c = -1;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
stateloop: for (; ; ) {
|
|
|
|
switch(state) {
|
|
|
|
case NS_HTML5META_SCANNER_DATA: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '<': {
|
|
|
|
state = NS_HTML5META_SCANNER_TAG_OPEN;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(dataloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dataloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_TAG_OPEN: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case 'm':
|
|
|
|
case 'M': {
|
|
|
|
metaState = NS_HTML5META_SCANNER_M;
|
|
|
|
state = NS_HTML5META_SCANNER_TAG_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(tagopenloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '!': {
|
|
|
|
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '\?':
|
|
|
|
case '/': {
|
|
|
|
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
|
|
|
metaState = NS_HTML5META_SCANNER_NO;
|
|
|
|
state = NS_HTML5META_SCANNER_TAG_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(tagopenloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = true;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tagopenloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_TAG_NAME: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(tagnameloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '/': {
|
|
|
|
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case 'e':
|
|
|
|
case 'E': {
|
|
|
|
if (metaState == NS_HTML5META_SCANNER_M) {
|
|
|
|
metaState = NS_HTML5META_SCANNER_E;
|
|
|
|
} else {
|
|
|
|
metaState = NS_HTML5META_SCANNER_NO;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case 't':
|
|
|
|
case 'T': {
|
|
|
|
if (metaState == NS_HTML5META_SCANNER_E) {
|
|
|
|
metaState = NS_HTML5META_SCANNER_T;
|
|
|
|
} else {
|
|
|
|
metaState = NS_HTML5META_SCANNER_NO;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case 'a':
|
|
|
|
case 'A': {
|
|
|
|
if (metaState == NS_HTML5META_SCANNER_T) {
|
|
|
|
metaState = NS_HTML5META_SCANNER_A;
|
|
|
|
} else {
|
|
|
|
metaState = NS_HTML5META_SCANNER_NO;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
metaState = NS_HTML5META_SCANNER_NO;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tagnameloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case '/': {
|
|
|
|
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
if (handleTag()) {
|
|
|
|
NS_HTML5_BREAK(stateloop);
|
|
|
|
}
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case 'c':
|
|
|
|
case 'C': {
|
|
|
|
contentIndex = 0;
|
|
|
|
charsetIndex = 0;
|
2012-09-27 23:57:33 -07:00
|
|
|
httpEquivIndex = INT32_MAX;
|
|
|
|
contentTypeIndex = INT32_MAX;
|
2010-12-08 04:37:19 -08:00
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
|
|
|
NS_HTML5_BREAK(beforeattributenameloop);
|
|
|
|
}
|
|
|
|
case 'h':
|
|
|
|
case 'H': {
|
2012-09-27 23:57:33 -07:00
|
|
|
contentIndex = INT32_MAX;
|
|
|
|
charsetIndex = INT32_MAX;
|
2010-12-08 04:37:19 -08:00
|
|
|
httpEquivIndex = 0;
|
2012-09-27 23:57:33 -07:00
|
|
|
contentTypeIndex = INT32_MAX;
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(beforeattributenameloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2012-09-27 23:57:33 -07:00
|
|
|
contentIndex = INT32_MAX;
|
|
|
|
charsetIndex = INT32_MAX;
|
|
|
|
httpEquivIndex = INT32_MAX;
|
|
|
|
contentTypeIndex = INT32_MAX;
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(beforeattributenameloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
beforeattributenameloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_ATTRIBUTE_NAME: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '/': {
|
|
|
|
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '=': {
|
|
|
|
strBufLen = 0;
|
2010-12-08 04:37:19 -08:00
|
|
|
contentTypeIndex = 0;
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(attributenameloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
if (handleTag()) {
|
|
|
|
NS_HTML5_BREAK(stateloop);
|
|
|
|
}
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
if (metaState == NS_HTML5META_SCANNER_A) {
|
|
|
|
if (c >= 'A' && c <= 'Z') {
|
|
|
|
c += 0x20;
|
|
|
|
}
|
2010-12-08 04:37:19 -08:00
|
|
|
if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
|
|
|
|
++contentIndex;
|
|
|
|
} else {
|
2012-09-27 23:57:33 -07:00
|
|
|
contentIndex = INT32_MAX;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
2010-12-08 04:37:19 -08:00
|
|
|
if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
|
|
|
|
++charsetIndex;
|
|
|
|
} else {
|
2012-09-27 23:57:33 -07:00
|
|
|
charsetIndex = INT32_MAX;
|
2010-12-08 04:37:19 -08:00
|
|
|
}
|
|
|
|
if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
|
|
|
|
++httpEquivIndex;
|
|
|
|
} else {
|
2012-09-27 23:57:33 -07:00
|
|
|
httpEquivIndex = INT32_MAX;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
attributenameloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case '\"': {
|
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(beforeattributevalueloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '\'': {
|
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
if (handleTag()) {
|
|
|
|
NS_HTML5_BREAK(stateloop);
|
|
|
|
}
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleCharInAttributeValue(c);
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
beforeattributevalueloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '\"': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(attributevaluedoublequotedloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleCharInAttributeValue(c);
|
2009-06-28 15:44:22 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
attributevaluedoublequotedloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '/': {
|
|
|
|
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(afterattributevaluequotedloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
if (handleTag()) {
|
|
|
|
NS_HTML5_BREAK(stateloop);
|
|
|
|
}
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = true;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
afterattributevaluequotedloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG: {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
if (handleTag()) {
|
|
|
|
NS_HTML5_BREAK(stateloop);
|
|
|
|
}
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = true;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
|
|
|
if (handleTag()) {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleCharInAttributeValue(c);
|
2009-06-28 15:44:22 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
case '\n':
|
|
|
|
case '\f': {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
case '/': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '=': {
|
2010-12-08 04:37:19 -08:00
|
|
|
strBufLen = 0;
|
|
|
|
contentTypeIndex = 0;
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
|
|
|
if (handleTag()) {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case 'c':
|
|
|
|
case 'C': {
|
|
|
|
contentIndex = 0;
|
|
|
|
charsetIndex = 0;
|
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2012-09-27 23:57:33 -07:00
|
|
|
contentIndex = INT32_MAX;
|
|
|
|
charsetIndex = INT32_MAX;
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(markupdeclarationopenloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = true;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
markupdeclarationopenloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT_START;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(markupdeclarationhyphenloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_SCAN_UNTIL_GT;
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = true;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
markupdeclarationhyphenloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_COMMENT_START: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT_START_DASH;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(commentstartloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
commentstartloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_COMMENT: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT_END_DASH;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(commentloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
commentloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_COMMENT_END_DASH: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT_END;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(commentenddashloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
commentenddashloop_end: ;
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_COMMENT_END: {
|
|
|
|
for (; ; ) {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_COMMENT_START_DASH: {
|
|
|
|
c = read();
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '-': {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT_END;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
state = NS_HTML5META_SCANNER_COMMENT;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '\'': {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleAttributeValue();
|
2009-06-28 15:44:22 -07:00
|
|
|
state = NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
2010-12-08 04:37:19 -08:00
|
|
|
handleCharInAttributeValue(c);
|
2009-06-28 15:44:22 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case NS_HTML5META_SCANNER_SCAN_UNTIL_GT: {
|
|
|
|
for (; ; ) {
|
|
|
|
if (reconsume) {
|
2011-10-17 07:59:28 -07:00
|
|
|
reconsume = false;
|
2009-06-28 15:44:22 -07:00
|
|
|
} else {
|
|
|
|
c = read();
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case -1: {
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_BREAK(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
case '>': {
|
|
|
|
state = NS_HTML5META_SCANNER_DATA;
|
2010-04-19 06:25:13 -07:00
|
|
|
NS_HTML5_CONTINUE(stateloop);
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stateloop_end: ;
|
|
|
|
stateSave = state;
|
|
|
|
}
|
|
|
|
|
2010-12-08 04:37:19 -08:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c)
|
2010-12-08 04:37:19 -08:00
|
|
|
{
|
|
|
|
if (metaState == NS_HTML5META_SCANNER_A) {
|
|
|
|
if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
|
|
|
|
addToBuffer(c);
|
|
|
|
} else if (httpEquivIndex == HTTP_EQUIV.length) {
|
|
|
|
if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
|
|
|
|
++contentTypeIndex;
|
|
|
|
} else {
|
2012-09-27 23:57:33 -07:00
|
|
|
contentTypeIndex = INT32_MAX;
|
2010-12-08 04:37:19 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-28 15:44:22 -07:00
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsHtml5MetaScanner::addToBuffer(int32_t c)
|
2009-06-28 15:44:22 -07:00
|
|
|
{
|
|
|
|
if (strBufLen == strBuf.length) {
|
2012-08-22 08:56:38 -07:00
|
|
|
jArray<PRUnichar,int32_t> newBuf = jArray<PRUnichar,int32_t>::newJArray(strBuf.length + (strBuf.length << 1));
|
2009-06-28 15:44:22 -07:00
|
|
|
nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length);
|
|
|
|
strBuf = newBuf;
|
|
|
|
}
|
|
|
|
strBuf[strBufLen++] = (PRUnichar) c;
|
|
|
|
}
|
|
|
|
|
2010-12-08 04:37:19 -08:00
|
|
|
void
|
|
|
|
nsHtml5MetaScanner::handleAttributeValue()
|
2009-06-28 15:44:22 -07:00
|
|
|
{
|
2010-12-08 04:37:19 -08:00
|
|
|
if (metaState != NS_HTML5META_SCANNER_A) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (contentIndex == CONTENT.length && !content) {
|
|
|
|
content = nsHtml5Portability::newStringFromBuffer(strBuf, 0, strBufLen);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (charsetIndex == CHARSET.length && !charset) {
|
|
|
|
charset = nsHtml5Portability::newStringFromBuffer(strBuf, 0, strBufLen);
|
|
|
|
return;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
2010-12-08 04:37:19 -08:00
|
|
|
if (httpEquivIndex == HTTP_EQUIV.length && httpEquivState == NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN) {
|
|
|
|
httpEquivState = (contentTypeIndex == CONTENT_TYPE.length) ? NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE : NS_HTML5META_SCANNER_HTTP_EQUIV_OTHER;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-12-08 04:37:19 -08:00
|
|
|
nsHtml5MetaScanner::handleTag()
|
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
bool stop = handleTagInner();
|
2010-12-08 04:37:19 -08:00
|
|
|
nsHtml5Portability::releaseString(content);
|
2012-07-30 07:20:58 -07:00
|
|
|
content = nullptr;
|
2010-12-08 04:37:19 -08:00
|
|
|
nsHtml5Portability::releaseString(charset);
|
2012-07-30 07:20:58 -07:00
|
|
|
charset = nullptr;
|
2010-12-08 04:37:19 -08:00
|
|
|
httpEquivState = NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN;
|
|
|
|
return stop;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-12-08 04:37:19 -08:00
|
|
|
nsHtml5MetaScanner::handleTagInner()
|
|
|
|
{
|
|
|
|
if (!!charset && tryCharset(charset)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
2010-12-08 04:37:19 -08:00
|
|
|
if (!!content && httpEquivState == NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE) {
|
|
|
|
nsString* extract = nsHtml5TreeBuilder::extractCharsetFromContent(content);
|
|
|
|
if (!extract) {
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2010-12-08 04:37:19 -08:00
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool success = tryCharset(extract);
|
2010-12-08 04:37:19 -08:00
|
|
|
nsHtml5Portability::releaseString(extract);
|
|
|
|
return success;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2009-06-28 15:44:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHtml5MetaScanner::initializeStatics()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHtml5MetaScanner::releaseStatics()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsHtml5MetaScannerCppSupplement.h"
|
|
|
|
|