mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1424548 - Part 1: Fix non-unified build of HTML parser code. r=hsivonen
--HG-- extra : rebase_source : 78aa25eb45c0f7cd446ac7eab4f853c46590c7e7
This commit is contained in:
parent
4eee1598f7
commit
16e0dd144e
@ -1,12 +1,12 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
const Encoding*
|
||||
const mozilla::Encoding*
|
||||
nsHtml5MetaScanner::sniff(nsHtml5ByteReadable* bytes)
|
||||
{
|
||||
readable = bytes;
|
||||
@ -25,7 +25,7 @@ nsHtml5MetaScanner::tryCharset(nsHtml5String charset)
|
||||
nsString charset16; // Not Auto, because using it to hold nsStringBuffer*
|
||||
charset.ToString(charset16);
|
||||
CopyUTF16toUTF8(charset16, label);
|
||||
const Encoding* encoding = Encoding::ForLabel(label);
|
||||
const mozilla::Encoding* encoding = Encoding::ForLabel(label);
|
||||
if (!encoding) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4,6 +4,10 @@
|
||||
|
||||
#include "nsHtml5OwningUTF16Buffer.h"
|
||||
|
||||
#include "mozilla/Span.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsHtml5OwningUTF16Buffer::nsHtml5OwningUTF16Buffer(char16_t* aBuffer)
|
||||
: nsHtml5UTF16Buffer(aBuffer, 0),
|
||||
next(nullptr),
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "nsHtml5TreeOpExecutor.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsHtml5SpeculativeLoad::nsHtml5SpeculativeLoad()
|
||||
:
|
||||
#ifdef DEBUG
|
||||
|
@ -1,12 +1,14 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#ifndef nsHtml5SpeculativeLoad_h
|
||||
#define nsHtml5SpeculativeLoad_h
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5String.h"
|
||||
|
||||
class nsHtml5TreeOpExecutor;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsHtml5AtomTable.h"
|
||||
#include "nsHtml5Module.h"
|
||||
#include "nsHtml5StreamParserPtr.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
|
@ -2,8 +2,11 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsHtml5StreamParserPtr_h
|
||||
#define nsHtml5StreamParserPtr_h
|
||||
|
||||
#include "nsHtml5StreamParser.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/dom/DocGroup.h"
|
||||
|
||||
@ -24,6 +27,7 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Like nsRefPtr except release is proxied to the main
|
||||
* thread. Mostly copied from nsRefPtr.
|
||||
@ -265,4 +269,5 @@ operator!=(decltype(nullptr), const nsHtml5StreamParserPtr& rhs)
|
||||
{
|
||||
return nullptr != rhs.get();
|
||||
}
|
||||
|
||||
#endif // !defined(nsHtml5StreamParserPtr_h)
|
||||
|
@ -2,6 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// INT32_MAX is (2^31)-1. Therefore, the highest power-of-two that fits
|
||||
@ -19,7 +20,7 @@ nsHtml5Tokenizer::EnsureBufferSpace(int32_t aLength)
|
||||
// Can't happen when loading from network.
|
||||
return false;
|
||||
}
|
||||
CheckedInt<int32_t> worstCase(strBufLen);
|
||||
mozilla::CheckedInt<int32_t> worstCase(strBufLen);
|
||||
worstCase += aLength;
|
||||
worstCase += charRefBufLen;
|
||||
// Add 2 to account for emissions of LT_GT, LT_SOLIDUS and RSQB_RSQB.
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
@ -595,7 +596,7 @@ nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aS
|
||||
return;
|
||||
}
|
||||
|
||||
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
|
||||
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
|
||||
if (!bufferCopy) {
|
||||
// Just assigning mBroken instead of generating tree op. The caller
|
||||
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
|
||||
@ -661,7 +662,7 @@ nsHtml5TreeBuilder::appendCharacters(nsIContentHandle* aParent, char16_t* aBuffe
|
||||
return;
|
||||
}
|
||||
|
||||
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
|
||||
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
|
||||
if (!bufferCopy) {
|
||||
// Just assigning mBroken instead of generating tree op. The caller
|
||||
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
|
||||
@ -704,7 +705,7 @@ nsHtml5TreeBuilder::appendComment(nsIContentHandle* aParent, char16_t* aBuffer,
|
||||
return;
|
||||
}
|
||||
|
||||
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
|
||||
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
|
||||
if (!bufferCopy) {
|
||||
// Just assigning mBroken instead of generating tree op. The caller
|
||||
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
|
||||
@ -740,7 +741,7 @@ nsHtml5TreeBuilder::appendCommentToDocument(char16_t* aBuffer, int32_t aStart, i
|
||||
return;
|
||||
}
|
||||
|
||||
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
|
||||
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
|
||||
if (!bufferCopy) {
|
||||
// Just assigning mBroken instead of generating tree op. The caller
|
||||
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
|
||||
@ -1081,7 +1082,7 @@ nsHtml5TreeBuilder::EnsureBufferSpace(int32_t aLength)
|
||||
{
|
||||
// TODO: Unify nsHtml5Tokenizer::strBuf and nsHtml5TreeBuilder::charBuffer
|
||||
// so that this method becomes unnecessary.
|
||||
CheckedInt<int32_t> worstCase(charBufferLen);
|
||||
mozilla::CheckedInt<int32_t> worstCase(charBufferLen);
|
||||
worstCase += aLength;
|
||||
if (!worstCase.isValid()) {
|
||||
return false;
|
||||
@ -1119,7 +1120,7 @@ nsHtml5TreeBuilder::AllocateContentHandle()
|
||||
}
|
||||
if (mHandlesUsed == NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH) {
|
||||
mOldHandles.AppendElement(Move(mHandles));
|
||||
mHandles = MakeUnique<nsIContent*[]>(NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH);
|
||||
mHandles = mozilla::MakeUnique<nsIContent*[]>(NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH);
|
||||
mHandlesUsed = 0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsINestedURI.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIWebShellServices.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user