Merge mozilla-central to autoland. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2018-11-07 18:21:01 +02:00
Родитель caaeda6288 ce0127e7c1
Коммит 73bfb21d7a
27 изменённых файлов: 378 добавлений и 296 удалений

Просмотреть файл

@ -1579,6 +1579,8 @@ nsIDocument::ConstructUbiNode(void* storage)
nsDocument::~nsDocument()
{
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p destroyed", this));
MOZ_ASSERT(!IsTopLevelContentDocument() || !IsResourceDoc(),
"Can't be top-level and a resource doc at the same time");
NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document");
@ -1646,6 +1648,23 @@ nsDocument::~nsDocument()
if (mDocTreeHadPlayRevoked) {
ScalarAdd(Telemetry::ScalarID::MEDIA_PAGE_HAD_PLAY_REVOKED_COUNT, 1);
}
if (IsHTMLDocument()) {
switch (GetCompatibilityMode()) {
case eCompatibility_FullStandards:
Telemetry::AccumulateCategorical(Telemetry::LABELS_QUIRKS_MODE::FullStandards);
break;
case eCompatibility_AlmostStandards:
Telemetry::AccumulateCategorical(Telemetry::LABELS_QUIRKS_MODE::AlmostStandards);
break;
case eCompatibility_NavQuirks:
Telemetry::AccumulateCategorical(Telemetry::LABELS_QUIRKS_MODE::NavQuirks);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unknown quirks mode");
break;
}
}
}
// Report the fastblock telemetry probes when the document is dying if
@ -12531,8 +12550,8 @@ nsIDocument::ReportUseCounters(UseCounterReportKind aKind)
}
}
if (IsTopLevelContentDocument() && !IsResourceDoc()) {
using mozilla::Telemetry::LABELS_HIDDEN_VIEWPORT_OVERFLOW_TYPE;
if (IsTopLevelContentDocument()) {
using Telemetry::LABELS_HIDDEN_VIEWPORT_OVERFLOW_TYPE;
LABELS_HIDDEN_VIEWPORT_OVERFLOW_TYPE label;
switch (mViewportOverflowType) {
#define CASE_OVERFLOW_TYPE(t_) \

Просмотреть файл

@ -15,12 +15,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=518104
<script class="testbody" type="text/javascript">
/** Test for Bug 518104 **/
// data: version at parser/htmlparser/tests/mochitest/test_bug1364399.html
SimpleTest.waitForExplicitFinish();
function done() {
// document.write should have gotten ignored due to the
// ignore-destructive-writes counter. Then document.close should
// have gotten ignored due to the parser still being not-script-created.
var iframe = document.getElementById("iframe");
var divs = iframe.contentWindow.document.getElementsByTagName("p").length;
is(divs, 0, "<p> got written.")
var divs = iframe.contentWindow.document.getElementsByTagName("div").length;
is(divs, 2, "<div>s are still there.")
var ps = iframe.contentWindow.document.getElementsByTagName("p").length;
is(ps, 0, "<p> did not get written.")
SimpleTest.finish();
}

Просмотреть файл

@ -532,7 +532,7 @@ public:
mMechanism = CKM_AES_CBC_PAD;
telemetryAlg = TA_AES_CBC;
AesCbcParams params;
RootedDictionary<AesCbcParams> params(aCx);
nsresult rv = Coerce(aCx, params, aAlgorithm);
if (NS_FAILED(rv)) {
mEarlyRv = NS_ERROR_DOM_INVALID_ACCESS_ERR;
@ -549,7 +549,7 @@ public:
mMechanism = CKM_AES_CTR;
telemetryAlg = TA_AES_CTR;
AesCtrParams params;
RootedDictionary<AesCtrParams> params(aCx);
nsresult rv = Coerce(aCx, params, aAlgorithm);
if (NS_FAILED(rv)) {
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;
@ -568,7 +568,7 @@ public:
mMechanism = CKM_AES_GCM;
telemetryAlg = TA_AES_GCM;
AesGcmParams params;
RootedDictionary<AesGcmParams> params(aCx);
nsresult rv = Coerce(aCx, params, aAlgorithm);
if (NS_FAILED(rv)) {
mEarlyRv = NS_ERROR_DOM_SYNTAX_ERR;

Просмотреть файл

@ -144,7 +144,6 @@
#include "nsLayoutStylesheetCache.h"
#include "nsThreadManager.h"
#include "nsAnonymousTemporaryFile.h"
#include "nsISpellChecker.h"
#include "nsClipboardProxy.h"
#include "nsDirectoryService.h"
#include "nsDirectoryServiceUtils.h"

Просмотреть файл

@ -2449,7 +2449,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority)
bidi->GetHaveBidiKeyboards(&xpcomInit.haveBidiKeyboards());
}
nsCOMPtr<nsISpellChecker> spellChecker(mozSpellChecker::Create());
RefPtr<mozSpellChecker> spellChecker(mozSpellChecker::Create());
MOZ_ASSERT(spellChecker, "No spell checker?");
spellChecker->GetDictionaryList(&xpcomInit.dictionaries());
@ -4622,7 +4622,7 @@ ContentParent::IgnoreIPCPrincipal()
void
ContentParent::NotifyUpdatedDictionaries()
{
nsCOMPtr<nsISpellChecker> spellChecker(mozSpellChecker::Create());
RefPtr<mozSpellChecker> spellChecker(mozSpellChecker::Create());
MOZ_ASSERT(spellChecker, "No spell checker?");
InfallibleTArray<nsString> dictionaries;

Просмотреть файл

@ -34,7 +34,7 @@ interface nsIEditorSpellCheck : nsISupports
* value of the next word that is misspelled. This also computes the
* suggestions which you can get by calling GetSuggestedWord.
*
* @see nsISpellChecker::GetNextMisspelledWord
* @see mozSpellChecker::GetNextMisspelledWord
*/
AString GetNextMisspelledWord();
@ -45,7 +45,7 @@ interface nsIEditorSpellCheck : nsISupports
* to build a list. When there are no more suggestions, an empty string
* (not a null pointer) will be returned.
*
* @see nsISpellChecker::GetSuggestedWord
* @see mozSpellChecker::GetSuggestedWord
*/
AString GetSuggestedWord();
@ -55,19 +55,19 @@ interface nsIEditorSpellCheck : nsISupports
* misspelled, it will compute the suggestions which you can get from
* GetSuggestedWord().
*
* @see nsISpellChecker::CheckCurrentWord
* @see mozSpellChecker::CheckCurrentWord
*/
boolean CheckCurrentWord(in AString suggestedWord);
/**
* Use when modally checking the document to replace a word.
*
* @see nsISpellChecker::CheckCurrentWord
* @see mozSpellChecker::CheckCurrentWord
*/
void ReplaceWord(in AString misspelledWord, in AString replaceWord, in boolean allOccurrences);
/**
* @see nsISpellChecker::IgnoreAll
* @see mozSpellChecker::IgnoreAll
*/
void IgnoreWordAllOccurrences(in AString word);
@ -75,7 +75,7 @@ interface nsIEditorSpellCheck : nsISupports
* Fills an internal list of words added to the personal dictionary. These
* words can be retrieved using GetPersonalDictionaryWord()
*
* @see nsISpellChecker::GetPersonalDictionary
* @see mozSpellChecker::GetPersonalDictionary
* @see GetPersonalDictionaryWord
*/
void GetPersonalDictionary();
@ -90,14 +90,14 @@ interface nsIEditorSpellCheck : nsISupports
/**
* Adds a word to the current personal dictionary.
*
* @see nsISpellChecker::AddWordToDictionary
* @see mozSpellChecker::AddWordToDictionary
*/
void AddWordToDictionary(in AString word);
/**
* Removes a word from the current personal dictionary.
*
* @see nsISpellChecker::RemoveWordFromPersonalDictionary
* @see mozSpellChecker::RemoveWordFromPersonalDictionary
*/
void RemoveWordFromDictionary(in AString word);
@ -110,12 +110,12 @@ interface nsIEditorSpellCheck : nsISupports
void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
/**
* @see nsISpellChecker::GetCurrentDictionary
* @see mozSpellChecker::GetCurrentDictionary
*/
AString GetCurrentDictionary();
/**
* @see nsISpellChecker::SetCurrentDictionary
* @see mozSpellChecker::SetCurrentDictionary
*/
void SetCurrentDictionary(in AString dictionary);

Просмотреть файл

@ -17,7 +17,6 @@
class mozSpellChecker;
class nsIEditor;
class nsISpellChecker;
namespace mozilla {

Просмотреть файл

@ -12,10 +12,6 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'txtsvc'
EXPORTS += [
'nsISpellChecker.h',
]
EXPORTS.mozilla += [
'EditorSpellCheck.h',
'TextServicesDocument.h',

Просмотреть файл

@ -1,131 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 nsISpellChecker_h__
#define nsISpellChecker_h__
#include "mozilla/MozPromise.h"
#include "nsISupports.h"
#include "nsStringFwd.h"
#include "nsTArray.h"
#define NS_ISPELLCHECKER_IID \
{ /* 27bff957-b486-40ae-9f5d-af0cdd211868 */ \
0x27bff957, 0xb486, 0x40ae, \
{ 0x9f, 0x5d, 0xaf, 0x0c, 0xdd, 0x21, 0x18, 0x68 } }
namespace mozilla {
class TextServicesDocument;
} // namespace mozilla
/**
* A generic interface for a spelling checker.
*/
class nsISpellChecker : public nsISupports{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISPELLCHECKER_IID)
/**
* Tells the spellchecker what document to check.
* @param aDoc is the document to check.
* @param aFromStartOfDoc If true, start check from beginning of document,
* if false, start check from current cursor position.
*/
NS_IMETHOD SetDocument(mozilla::TextServicesDocument* aDoc,
bool aFromStartofDoc) = 0;
/**
* Selects (hilites) the next misspelled word in the document.
* @param aWord will contain the misspelled word.
* @param aSuggestions is an array of nsStrings, that represent the
* suggested replacements for the misspelled word.
*/
NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions) = 0;
/**
* Checks if a word is misspelled. No document is required to use this method.
* @param aWord is the word to check.
* @param aIsMisspelled will be set to true if the word is misspelled.
* @param aSuggestions is an array of nsStrings which represent the
* suggested replacements for the misspelled word. The array will be empty
* if there aren't any suggestions.
*/
NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions) = 0;
/**
* Replaces the old word with the specified new word.
* @param aOldWord is the word to be replaced.
* @param aNewWord is the word that is to replace old word.
* @param aAllOccurrences will replace all occurrences of old
* word, in the document, with new word when it is true. If
* false, it will replace the 1st occurrence only!
*/
NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences) = 0;
/**
* Ignores all occurrences of the specified word in the document.
* @param aWord is the word to ignore.
*/
NS_IMETHOD IgnoreAll(const nsAString &aWord) = 0;
/**
* Add a word to the user's personal dictionary.
* @param aWord is the word to add.
*/
NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord) = 0;
/**
* Remove a word from the user's personal dictionary.
* @param aWord is the word to remove.
*/
NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord) = 0;
/**
* Returns the list of words in the user's personal dictionary.
* @param aWordList is an array of nsStrings that represent the
* list of words in the user's personal dictionary.
*/
NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList) = 0;
/**
* Returns the list of strings representing the dictionaries
* the spellchecker supports. It was suggested that the strings
* returned be in the RFC 1766 format. This format looks something
* like <ISO 639 language code>-<ISO 3166 country code>.
* For example: en-US
* @param aDictionaryList is an array of nsStrings that represent the
* dictionaries supported by the spellchecker.
*/
NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList) = 0;
/**
* Returns a string representing the current dictionary.
* @param aDictionary will contain the name of the dictionary.
* This name is the same string that is in the list returned
* by GetDictionaryList().
*/
NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary) = 0;
/**
* Tells the spellchecker to use a specific dictionary.
* @param aDictionary a string that is in the list returned
* by GetDictionaryList() or an empty string. If aDictionary is
* empty string, spellchecker will be disabled.
*/
NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) = 0;
/**
* Tells the spellchecker to use a specific dictionary from list.
* @param aList a preferred dictionary list
*/
NS_IMETHOD_(RefPtr<mozilla::GenericPromise>)
SetCurrentDictionaryFromList(const nsTArray<nsString>& aList) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISpellChecker, NS_ISPELLCHECKER_IID)
#endif // nsISpellChecker_h__

Просмотреть файл

@ -8,7 +8,7 @@
#include "nsCOMPtr.h"
#include "nsTArray.h"
class nsISpellChecker;
class mozSpellChecker;
namespace mozilla {
@ -36,7 +36,7 @@ public:
override;
private:
nsCOMPtr<nsISpellChecker> mSpellChecker;
RefPtr<mozSpellChecker> mSpellChecker;
};
} // namespace mozilla

Просмотреть файл

@ -24,19 +24,13 @@ using mozilla::TextServicesDocument;
#define DEFAULT_SPELL_CHECKER "@mozilla.org/spellchecker/engine;1"
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozSpellChecker)
NS_IMPL_CYCLE_COLLECTING_RELEASE(mozSpellChecker)
NS_INTERFACE_MAP_BEGIN(mozSpellChecker)
NS_INTERFACE_MAP_ENTRY(nsISpellChecker)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpellChecker)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(mozSpellChecker)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION(mozSpellChecker,
mTextServicesDocument,
mPersonalDictionary)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(mozSpellChecker, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(mozSpellChecker, Release)
mozSpellChecker::mozSpellChecker()
: mEngine(nullptr)
{
@ -80,7 +74,7 @@ mozSpellChecker::GetTextServicesDocument()
return mTextServicesDocument;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::SetDocument(TextServicesDocument* aTextServicesDocument,
bool aFromStartofDoc)
{
@ -90,7 +84,7 @@ mozSpellChecker::SetDocument(TextServicesDocument* aTextServicesDocument,
}
NS_IMETHODIMP
nsresult
mozSpellChecker::NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions)
{
if(!aSuggestions||!mConverter)
@ -135,7 +129,7 @@ mozSpellChecker::NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSugge
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions)
{
nsresult result;
@ -178,7 +172,7 @@ mozSpellChecker::CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences)
{
if(!mConverter)
@ -269,7 +263,7 @@ mozSpellChecker::Replace(const nsAString &aOldWord, const nsAString &aNewWord, b
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::IgnoreAll(const nsAString &aWord)
{
if (mPersonalDictionary) {
@ -278,7 +272,7 @@ mozSpellChecker::IgnoreAll(const nsAString &aWord)
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::AddWordToPersonalDictionary(const nsAString &aWord)
{
nsresult res;
@ -289,7 +283,7 @@ mozSpellChecker::AddWordToPersonalDictionary(const nsAString &aWord)
return res;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::RemoveWordFromPersonalDictionary(const nsAString &aWord)
{
nsresult res;
@ -300,7 +294,7 @@ mozSpellChecker::RemoveWordFromPersonalDictionary(const nsAString &aWord)
return res;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::GetPersonalDictionary(nsTArray<nsString> *aWordList)
{
if(!aWordList || !mPersonalDictionary)
@ -318,7 +312,7 @@ mozSpellChecker::GetPersonalDictionary(nsTArray<nsString> *aWordList)
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::GetDictionaryList(nsTArray<nsString> *aDictionaryList)
{
if (XRE_IsContentProcess()) {
@ -366,7 +360,7 @@ mozSpellChecker::GetDictionaryList(nsTArray<nsString> *aDictionaryList)
return NS_OK;
}
NS_IMETHODIMP
nsresult
mozSpellChecker::GetCurrentDictionary(nsAString &aDictionary)
{
if (XRE_IsContentProcess()) {
@ -382,7 +376,7 @@ mozSpellChecker::GetCurrentDictionary(nsAString &aDictionary)
return mSpellCheckingEngine->GetDictionary(aDictionary);
}
NS_IMETHODIMP
nsresult
mozSpellChecker::SetCurrentDictionary(const nsAString &aDictionary)
{
if (XRE_IsContentProcess()) {
@ -435,7 +429,7 @@ mozSpellChecker::SetCurrentDictionary(const nsAString &aDictionary)
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP_(RefPtr<GenericPromise>)
RefPtr<GenericPromise>
mozSpellChecker::SetCurrentDictionaryFromList(const nsTArray<nsString>& aList)
{
if (aList.IsEmpty()) {

Просмотреть файл

@ -8,7 +8,6 @@
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsISpellChecker.h"
#include "nsString.h"
#include "mozIPersonalDictionary.h"
#include "mozISpellCheckingEngine.h"
@ -20,13 +19,14 @@ class mozEnglishWordUtils;
namespace mozilla {
class RemoteSpellcheckEngineChild;
class TextServicesDocument;
} // namespace mozilla
class mozSpellChecker final : public nsISpellChecker
class mozSpellChecker final
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(mozSpellChecker)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(mozSpellChecker)
static already_AddRefed<mozSpellChecker>
Create()
@ -37,23 +37,104 @@ public:
return spellChecker.forget();
}
// nsISpellChecker
NS_IMETHOD SetDocument(mozilla::TextServicesDocument* aTextServicesDocument,
bool aFromStartofDoc) override;
NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions) override;
NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions) override;
NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences) override;
NS_IMETHOD IgnoreAll(const nsAString &aWord) override;
/**
* Tells the spellchecker what document to check.
* @param aDoc is the document to check.
* @param aFromStartOfDoc If true, start check from beginning of document,
* if false, start check from current cursor position.
*/
nsresult SetDocument(mozilla::TextServicesDocument* aTextServicesDocument,
bool aFromStartofDoc);
NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord) override;
NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord) override;
NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList) override;
/**
* Selects (hilites) the next misspelled word in the document.
* @param aWord will contain the misspelled word.
* @param aSuggestions is an array of nsStrings, that represent the
* suggested replacements for the misspelled word.
*/
nsresult NextMisspelledWord(nsAString& aWord,
nsTArray<nsString>* aSuggestions);
NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList) override;
NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary) override;
NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) override;
NS_IMETHOD_(RefPtr<mozilla::GenericPromise>)
SetCurrentDictionaryFromList(const nsTArray<nsString>& aList) override;
/**
* Checks if a word is misspelled. No document is required to use this method.
* @param aWord is the word to check.
* @param aIsMisspelled will be set to true if the word is misspelled.
* @param aSuggestions is an array of nsStrings which represent the
* suggested replacements for the misspelled word. The array will be empty
* if there aren't any suggestions.
*/
nsresult CheckWord(const nsAString& aWord, bool* aIsMisspelled,
nsTArray<nsString>* aSuggestions);
/**
* Replaces the old word with the specified new word.
* @param aOldWord is the word to be replaced.
* @param aNewWord is the word that is to replace old word.
* @param aAllOccurrences will replace all occurrences of old
* word, in the document, with new word when it is true. If
* false, it will replace the 1st occurrence only!
*/
nsresult Replace(const nsAString& aOldWord, const nsAString& aNewWord,
bool aAllOccurrences);
/**
* Ignores all occurrences of the specified word in the document.
* @param aWord is the word to ignore.
*/
nsresult IgnoreAll(const nsAString& aWord);
/**
* Add a word to the user's personal dictionary.
* @param aWord is the word to add.
*/
nsresult AddWordToPersonalDictionary(const nsAString& aWord);
/**
* Remove a word from the user's personal dictionary.
* @param aWord is the word to remove.
*/
nsresult RemoveWordFromPersonalDictionary(const nsAString& aWord);
/**
* Returns the list of words in the user's personal dictionary.
* @param aWordList is an array of nsStrings that represent the
* list of words in the user's personal dictionary.
*/
nsresult GetPersonalDictionary(nsTArray<nsString>* aWordList);
/**
* Returns the list of strings representing the dictionaries
* the spellchecker supports. It was suggested that the strings
* returned be in the RFC 1766 format. This format looks something
* like <ISO 639 language code>-<ISO 3166 country code>.
* For example: en-US
* @param aDictionaryList is an array of nsStrings that represent the
* dictionaries supported by the spellchecker.
*/
nsresult GetDictionaryList(nsTArray<nsString>* aDictionaryList);
/**
* Returns a string representing the current dictionary.
* @param aDictionary will contain the name of the dictionary.
* This name is the same string that is in the list returned
* by GetDictionaryList().
*/
nsresult GetCurrentDictionary(nsAString& aDictionary);
/**
* Tells the spellchecker to use a specific dictionary.
* @param aDictionary a string that is in the list returned
* by GetDictionaryList() or an empty string. If aDictionary is
* empty string, spellchecker will be disabled.
*/
nsresult SetCurrentDictionary(const nsAString& aDictionary);
/**
* Tells the spellchecker to use a specific dictionary from list.
* @param aList a preferred dictionary list
*/
RefPtr<mozilla::GenericPromise>
SetCurrentDictionaryFromList(const nsTArray<nsString>& aList);
void DeleteRemoteEngine() {
mEngine = nullptr;

Просмотреть файл

@ -105,18 +105,44 @@ nsWebPDecoder::ReadData()
LexerResult
nsWebPDecoder::DoDecode(SourceBufferIterator& aIterator, IResumable* aOnResume)
{
while (true) {
SourceBufferIterator::State state = SourceBufferIterator::COMPLETE;
if (!mIteratorComplete) {
state = aIterator.AdvanceOrScheduleResume(SIZE_MAX, aOnResume);
// We need to remember since we can't advance a complete iterator.
mIteratorComplete = state == SourceBufferIterator::COMPLETE;
}
if (state == SourceBufferIterator::WAITING) {
return LexerResult(Yield::NEED_MORE_DATA);
}
LexerResult rv = UpdateBuffer(aIterator, state);
if (rv.is<Yield>() && rv.as<Yield>() == Yield::NEED_MORE_DATA) {
// We need to check the iterator to see if more is available before
// giving up unless we are already complete.
if (mIteratorComplete) {
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::DoDecode -- read all data, "
"but needs more\n", this));
return LexerResult(TerminalState::FAILURE);
}
continue;
}
return rv;
}
}
LexerResult
nsWebPDecoder::UpdateBuffer(SourceBufferIterator& aIterator,
SourceBufferIterator::State aState)
{
MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!");
SourceBufferIterator::State state = SourceBufferIterator::COMPLETE;
if (!mIteratorComplete) {
state = aIterator.AdvanceOrScheduleResume(SIZE_MAX, aOnResume);
// We need to remember since we can't advance a complete iterator.
mIteratorComplete = state == SourceBufferIterator::COMPLETE;
}
switch (state) {
switch (aState) {
case SourceBufferIterator::READY:
if (!aIterator.IsContiguous()) {
// We need to buffer. This should be rare, but expensive.
@ -133,8 +159,6 @@ nsWebPDecoder::DoDecode(SourceBufferIterator& aIterator, IResumable* aOnResume)
return ReadData();
case SourceBufferIterator::COMPLETE:
return ReadData();
case SourceBufferIterator::WAITING:
return LexerResult(Yield::NEED_MORE_DATA);
default:
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::DoDecode -- bad state\n", this));
@ -406,86 +430,94 @@ nsWebPDecoder::ReadSingle(const uint8_t* aData, size_t aLength, const IntRect& a
}
bool complete;
VP8StatusCode status = WebPIUpdate(mDecoder, aData, aLength);
switch (status) {
case VP8_STATUS_OK:
complete = true;
break;
case VP8_STATUS_SUSPENDED:
complete = false;
break;
default:
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::ReadSingle -- append error %d\n",
this, status));
return LexerResult(TerminalState::FAILURE);
}
int lastRow = -1;
int width = 0;
int height = 0;
int stride = 0;
uint8_t* rowStart = WebPIDecGetRGB(mDecoder, &lastRow, &width, &height, &stride);
if (!rowStart || lastRow == -1) {
return LexerResult(Yield::NEED_MORE_DATA);
}
if (width != mFrameRect.width || height != mFrameRect.height ||
stride < mFrameRect.width * 4 ||
lastRow > mFrameRect.height) {
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::ReadSingle -- bad (w,h,s) = (%d, %d, %d)\n",
this, width, height, stride));
return LexerResult(TerminalState::FAILURE);
}
const bool noPremultiply =
bool(GetSurfaceFlags() & SurfaceFlags::NO_PREMULTIPLY_ALPHA);
for (int row = mLastRow; row < lastRow; row++) {
uint8_t* src = rowStart + row * stride;
if (mTransform) {
qcms_transform_data(mTransform, src, src, width);
do {
VP8StatusCode status = WebPIUpdate(mDecoder, aData, aLength);
switch (status) {
case VP8_STATUS_OK:
complete = true;
break;
case VP8_STATUS_SUSPENDED:
complete = false;
break;
default:
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::ReadSingle -- append error %d\n",
this, status));
return LexerResult(TerminalState::FAILURE);
}
WriteState result;
if (noPremultiply) {
result = mPipe.WritePixelsToRow<uint32_t>([&]() -> NextPixel<uint32_t> {
MOZ_ASSERT(mFormat == SurfaceFormat::B8G8R8A8 || src[3] == 0xFF);
const uint32_t pixel =
gfxPackedPixelNoPreMultiply(src[3], src[0], src[1], src[2]);
src += 4;
return AsVariant(pixel);
});
} else {
result = mPipe.WritePixelsToRow<uint32_t>([&]() -> NextPixel<uint32_t> {
MOZ_ASSERT(mFormat == SurfaceFormat::B8G8R8A8 || src[3] == 0xFF);
const uint32_t pixel = gfxPackedPixel(src[3], src[0], src[1], src[2]);
src += 4;
return AsVariant(pixel);
});
int lastRow = -1;
int width = 0;
int height = 0;
int stride = 0;
uint8_t* rowStart = WebPIDecGetRGB(mDecoder, &lastRow, &width, &height, &stride);
MOZ_LOG(sWebPLog, LogLevel::Debug,
("[this=%p] nsWebPDecoder::ReadSingle -- complete %d, read %d rows, "
"has %d rows available\n", this, complete, mLastRow, lastRow));
if (!rowStart || lastRow == -1 || lastRow == mLastRow) {
return LexerResult(Yield::NEED_MORE_DATA);
}
MOZ_ASSERT(result != WriteState::FAILURE);
MOZ_ASSERT_IF(result == WriteState::FINISHED, complete && row == lastRow - 1);
if (result == WriteState::FAILURE) {
if (width != mFrameRect.width || height != mFrameRect.height ||
stride < mFrameRect.width * 4 ||
lastRow > mFrameRect.height) {
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::ReadSingle -- write pixels error\n",
this));
("[this=%p] nsWebPDecoder::ReadSingle -- bad (w,h,s) = (%d, %d, %d)\n",
this, width, height, stride));
return LexerResult(TerminalState::FAILURE);
}
}
if (mLastRow != lastRow) {
const bool noPremultiply =
bool(GetSurfaceFlags() & SurfaceFlags::NO_PREMULTIPLY_ALPHA);
for (int row = mLastRow; row < lastRow; row++) {
uint8_t* src = rowStart + row * stride;
if (mTransform) {
qcms_transform_data(mTransform, src, src, width);
}
WriteState result;
if (noPremultiply) {
result = mPipe.WritePixelsToRow<uint32_t>([&]() -> NextPixel<uint32_t> {
MOZ_ASSERT(mFormat == SurfaceFormat::B8G8R8A8 || src[3] == 0xFF);
const uint32_t pixel =
gfxPackedPixelNoPreMultiply(src[3], src[0], src[1], src[2]);
src += 4;
return AsVariant(pixel);
});
} else {
result = mPipe.WritePixelsToRow<uint32_t>([&]() -> NextPixel<uint32_t> {
MOZ_ASSERT(mFormat == SurfaceFormat::B8G8R8A8 || src[3] == 0xFF);
const uint32_t pixel = gfxPackedPixel(src[3], src[0], src[1], src[2]);
src += 4;
return AsVariant(pixel);
});
}
Maybe<SurfaceInvalidRect> invalidRect = mPipe.TakeInvalidRect();
if (invalidRect) {
PostInvalidation(invalidRect->mInputSpaceRect,
Some(invalidRect->mOutputSpaceRect));
}
if (result == WriteState::FAILURE) {
MOZ_LOG(sWebPLog, LogLevel::Error,
("[this=%p] nsWebPDecoder::ReadSingle -- write pixels error\n",
this));
return LexerResult(TerminalState::FAILURE);
}
if (result == WriteState::FINISHED) {
MOZ_ASSERT(row == lastRow - 1, "There was more data to read?");
complete = true;
break;
}
}
mLastRow = lastRow;
Maybe<SurfaceInvalidRect> invalidRect = mPipe.TakeInvalidRect();
if (invalidRect) {
PostInvalidation(invalidRect->mInputSpaceRect,
Some(invalidRect->mOutputSpaceRect));
}
}
} while (!complete);
if (!complete) {
return LexerResult(Yield::NEED_MORE_DATA);

Просмотреть файл

@ -34,14 +34,10 @@ private:
// Decoders should only be instantiated via DecoderFactory.
explicit nsWebPDecoder(RasterImage* aImage);
enum class State
{
WEBP_DATA,
FINISHED_WEBP_DATA
};
void ApplyColorProfile(const char* aProfile, size_t aLength);
LexerResult UpdateBuffer(SourceBufferIterator& aIterator,
SourceBufferIterator::State aState);
LexerResult ReadData();
LexerResult ReadHeader(WebPDemuxer* aDemuxer, bool aIsComplete);
LexerResult ReadPayload(WebPDemuxer* aDemuxer, bool aIsComplete);

Просмотреть файл

@ -580,6 +580,12 @@ ImageTestCase GreenWebPTestCase()
return ImageTestCase("green.webp", "image/webp", IntSize(100, 100));
}
ImageTestCase LargeWebPTestCase()
{
return ImageTestCase("large.webp", "image/webp", IntSize(1200, 660),
TEST_CASE_IGNORE_OUTPUT);
}
ImageTestCase GreenWebPIccSrgbTestCase()
{
return ImageTestCase("green.icc_srgb.webp", "image/webp", IntSize(100, 100));

Просмотреть файл

@ -455,6 +455,7 @@ ImageTestCase GreenICOTestCase();
ImageTestCase GreenIconTestCase();
ImageTestCase GreenWebPTestCase();
ImageTestCase LargeWebPTestCase();
ImageTestCase GreenWebPIccSrgbTestCase();
ImageTestCase GreenFirstFrameAnimatedGIFTestCase();

Просмотреть файл

@ -195,7 +195,7 @@ CheckDecoderDelayedChunk(const ImageTestCase& aTestCase)
}
static void
CheckDecoderMultiChunk(const ImageTestCase& aTestCase)
CheckDecoderMultiChunk(const ImageTestCase& aTestCase, uint64_t aChunkSize = 1)
{
nsCOMPtr<nsIInputStream> inputStream = LoadFile(aTestCase.mPath);
ASSERT_TRUE(inputStream != nullptr);
@ -216,22 +216,31 @@ CheckDecoderMultiChunk(const ImageTestCase& aTestCase)
DefaultSurfaceFlags());
ASSERT_TRUE(decoder != nullptr);
RefPtr<IDecodingTask> task =
new AnonymousDecodingTask(WrapNotNull(decoder), /* aResumable */ false);
new AnonymousDecodingTask(WrapNotNull(decoder), /* aResumable */ true);
// Run the full decoder synchronously. It should now be waiting on
// the iterator to yield some data since we haven't written anything yet.
task->Run();
while (length > 0) {
uint64_t read = length > aChunkSize ? aChunkSize : length;
length -= read;
for (uint64_t read = 0; read < length ; ++read) {
uint64_t available = 0;
rv = inputStream->Available(&available);
ASSERT_TRUE(available > 0);
ASSERT_TRUE(available >= read);
ASSERT_TRUE(NS_SUCCEEDED(rv));
rv = sourceBuffer->AppendFromInputStream(inputStream, 1);
// Writing any data should wake up the decoder to complete.
rv = sourceBuffer->AppendFromInputStream(inputStream, read);
ASSERT_TRUE(NS_SUCCEEDED(rv));
task->Run();
// It would have gotten posted to the main thread to avoid mutex contention.
SpinPendingEvents();
}
sourceBuffer->Complete(NS_OK);
task->Run();
SpinPendingEvents();
CheckDecoderResults(aTestCase, decoder);
}
@ -775,6 +784,11 @@ TEST_F(ImageDecoders, WebPMultiChunk)
CheckDecoderMultiChunk(GreenWebPTestCase());
}
TEST_F(ImageDecoders, WebPLargeMultiChunk)
{
CheckDecoderMultiChunk(LargeWebPTestCase(), /* aChunkSize */ 64);
}
TEST_F(ImageDecoders, WebPDownscaleDuringDecode)
{
CheckDownscaleDuringDecode(DownscaledWebPTestCase());
@ -976,7 +990,7 @@ TEST_F(ImageDecoders, LargeICOWithBMPSingleChunk)
TEST_F(ImageDecoders, LargeICOWithBMPMultiChunk)
{
CheckDecoderMultiChunk(LargeICOWithBMPTestCase());
CheckDecoderMultiChunk(LargeICOWithBMPTestCase(), /* aChunkSize */ 64);
}
TEST_F(ImageDecoders, LargeICOWithPNGSingleChunk)

Двоичные данные
image/test/gtest/large.webp Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 165 KiB

Просмотреть файл

@ -70,6 +70,7 @@ TEST_HARNESS_FILES.gtest += [
'green.png',
'green.webp',
'invalid-truncated-metadata.bmp',
'large.webp',
'no-frame-delay.gif',
'rle4.bmp',
'rle8.bmp',

Просмотреть файл

@ -43,3 +43,6 @@ non262/object/15.2.3.6-redefinition-4-of-4.js
non262/extensions/clone-complex-object.js
non262/reflect-parse/classes.js
non262/reflect-parse/destructuring-variable-declarations.js
test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js
test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js
test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js

Просмотреть файл

@ -202,6 +202,10 @@ nsHtml5TreeOpExecutor::DidBuildModel(bool aTerminated)
mDocument->EndLoad();
}
// Dropping the stream parser changes the parser's apparent script-createdness,
// which is why the stream parser must not be dropped before this executor's
// nsHtml5Parser has been made unreachable from its nsHTMLDocument.
// (mDocument->EndLoad() above drops the parser from the document.)
GetParser()->DropStreamParser();
DropParserAndPerfHint();
#ifdef GATHER_DOCWRITE_STATISTICS

Просмотреть файл

@ -148,3 +148,4 @@ skip-if = (verify && debug && (os == 'linux' || os == 'mac'))
# Disable test due to frequent orange on Mac
# test_bug534293.html
[test_bug1209658.html]
[test_bug1364399.html]

Просмотреть файл

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1364399
-->
<head>
<title>Test for Bug 1364399</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1364399">Mozilla Bug 1364399</a>
<p id="display"></p>
<script class="testbody" type="text/javascript">
/** Test for Bug 1364399 **/
// Non-data: version at dom/base/test/test_bug518104.html
SimpleTest.waitForExplicitFinish();
function done() {
// document.write should have gotten ignored due to the
// ignore-destructive-writes counter. Then document.close should
// have gotten ignored due to the parser still being not-script-created.
var iframe = document.getElementById("iframe");
var divs = iframe.contentWindow.document.getElementsByTagName("div").length;
is(divs, 2, "<div>s are still there.")
var ps = iframe.contentWindow.document.getElementsByTagName("p").length;
is(ps, 0, "<p> did not get written.")
SimpleTest.finish();
}
</script>
<div id="content" style="display: none">
<iframe id='iframe' srcdoc="
<div></div><div></div>
<script defer src='data:application/javascript,document.write(&quot;<p></p>&quot;);parent.done();document.close();'></script>">
</iframe>
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -172,3 +172,11 @@ mpfr-3.1.5:
gpg-signature:
sig-url: "{url}.asc"
key-path: build/unix/build-gcc/07F3DBBECC1A39605078094D980C197698C3739D.key
grcov-osx-x86_64:
description: grcov binary release
fetch:
type: static-url
url: https://github.com/mozilla/grcov/releases/download/v0.3.2/grcov-osx-x86_64.tar.bz2
sha256: 6a810f782efb207234ef418ab136edd1c0ffa61aa84d8c4545042a6fa3b9dd13
size: 915948

Просмотреть файл

@ -221,7 +221,7 @@ def use_fetches(config, jobs):
env['MOZ_FETCHES'] = {'task-reference': json.dumps(job_fetches, sort_keys=True)}
impl, os = worker_type_implementation(job['worker-type'])
if os == 'windows':
if os in ('windows', 'macosx'):
env.setdefault('MOZ_FETCHES_DIR', 'fetches')
else:
workdir = job['run'].get('workdir', '/builds/worker')

Просмотреть файл

@ -778,7 +778,7 @@ def enable_code_coverage(config, tests):
if 'linux' in test['build-platform']:
test['fetches']['toolchain'].append('linux64-grcov')
elif 'osx' in test['build-platform']:
test['fetches']['toolchain'].append('macosx64-grcov')
test['fetches']['fetch'].append('grcov-osx-x86_64')
elif 'win' in test['build-platform']:
test['fetches']['toolchain'].append('win64-grcov')

Просмотреть файл

@ -14153,6 +14153,16 @@
"n_buckets": 20,
"description": "Total number of http:// and https:// doc groups per tab group, including docgroups fully in bfcache. Collected at the point when the top level document of the tab group is unloaded."
},
"QUIRKS_MODE": {
"record_in_processes": ["main", "content"],
"alert_emails": ["emilio@mozilla.com"],
"bug_numbers": [1505117],
"expires_in_version": "70",
"kind": "categorical",
"releaseChannelCollection": "opt-out",
"labels": ["FullStandards", "AlmostStandards", "NavQuirks"],
"description": "HTML document compat mode (quirks mode)"
},
"HIDDEN_VIEWPORT_OVERFLOW_TYPE": {
"record_in_processes": ["main", "content"],
"alert_emails": ["mozilla-telemetry@upsuper.org", "botond@mozilla.com"],