merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-03-01 12:01:58 +01:00
commit 82e4b3a48c
368 changed files with 9131 additions and 6829 deletions

View File

@ -43,7 +43,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eNoValue, eNoValue,
eNoAction, eNoAction,
eNoLiveAttr, eNoLiveAttr,
kGenericAccType, eAlert,
kNoReqStates kNoReqStates
}, },
{ // alertdialog { // alertdialog

View File

@ -68,20 +68,21 @@ enum AccType {
* type, the same accessible class can have several types. * type, the same accessible class can have several types.
*/ */
enum AccGenericType { enum AccGenericType {
eAutoComplete = 1 << 0, eAlert = 1 << 0,
eAutoCompletePopup = 1 << 1, eAutoComplete = 1 << 1,
eButton = 1 << 2, eAutoCompletePopup = 1 << 2,
eCombobox = 1 << 3, eButton = 1 << 3,
eDocument = 1 << 4, eCombobox = 1 << 4,
eHyperText = 1 << 5, eDocument = 1 << 5,
eLandmark = 1 << 6, eHyperText = 1 << 6,
eList = 1 << 7, eLandmark = 1 << 7,
eListControl = 1 << 8, eList = 1 << 8,
eMenuButton = 1 << 9, eListControl = 1 << 9,
eSelect = 1 << 10, eMenuButton = 1 << 10,
eTable = 1 << 11, eSelect = 1 << 11,
eTableCell = 1 << 12, eTable = 1 << 12,
eTableRow = 1 << 13, eTableCell = 1 << 13,
eTableRow = 1 << 14,
eLastAccGenericType = eTableRow eLastAccGenericType = eTableRow
}; };

View File

@ -1982,6 +1982,10 @@ Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
if (mParent->IsARIAHidden() || aria::HasDefinedARIAHidden(mContent)) if (mParent->IsARIAHidden() || aria::HasDefinedARIAHidden(mContent))
SetARIAHidden(true); SetARIAHidden(true);
mContextFlags |=
static_cast<uint32_t>((mParent->IsAlert() ||
mParent->IsInsideAlert())) & eInsideAlert;
} }
// Accessible protected // Accessible protected
@ -1999,7 +2003,7 @@ Accessible::UnbindFromParent()
delete mBits.groupInfo; delete mBits.groupInfo;
mBits.groupInfo = nullptr; mBits.groupInfo = nullptr;
mContextFlags &= ~eHasNameDependentParent; mContextFlags &= ~eHasNameDependentParent & ~eInsideAlert;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -568,6 +568,8 @@ public:
return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym); return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym);
} }
bool IsAlert() const { return HasGenericType(eAlert); }
bool IsApplication() const { return mType == eApplicationType; } bool IsApplication() const { return mType == eApplicationType; }
ApplicationAccessible* AsApplication(); ApplicationAccessible* AsApplication();
@ -946,6 +948,11 @@ public:
bool IsARIAHidden() const { return mContextFlags & eARIAHidden; } bool IsARIAHidden() const { return mContextFlags & eARIAHidden; }
void SetARIAHidden(bool aIsDefined); void SetARIAHidden(bool aIsDefined);
/**
* Return true if the element is inside an alert.
*/
bool IsInsideAlert() const { return mContextFlags & eInsideAlert; }
protected: protected:
virtual ~Accessible(); virtual ~Accessible();
@ -1034,8 +1041,9 @@ protected:
enum ContextFlags { enum ContextFlags {
eHasNameDependentParent = 1 << 0, // Parent's name depends on this accessible. eHasNameDependentParent = 1 << 0, // Parent's name depends on this accessible.
eARIAHidden = 1 << 1, eARIAHidden = 1 << 1,
eInsideAlert = 1 << 2,
eLastContextFlag = eARIAHidden eLastContextFlag = eInsideAlert
}; };
protected: protected:
@ -1141,9 +1149,9 @@ protected:
static const uint8_t kChildrenFlagsBits = 2; static const uint8_t kChildrenFlagsBits = 2;
static const uint8_t kStateFlagsBits = 11; static const uint8_t kStateFlagsBits = 11;
static const uint8_t kContextFlagsBits = 2; static const uint8_t kContextFlagsBits = 3;
static const uint8_t kTypeBits = 6; static const uint8_t kTypeBits = 6;
static const uint8_t kGenericTypesBits = 14; static const uint8_t kGenericTypesBits = 15;
/** /**
* Keep in sync with ChildrenFlags, StateFlags, ContextFlags, and AccTypes. * Keep in sync with ChildrenFlags, StateFlags, ContextFlags, and AccTypes.

View File

@ -1764,22 +1764,16 @@ DocAccessible::UpdateTreeOnInsertion(Accessible* aContainer)
// Check to see if change occurred inside an alert, and fire an EVENT_ALERT // Check to see if change occurred inside an alert, and fire an EVENT_ALERT
// if it did. // if it did.
if (!(updateFlags & eAlertAccessible)) { if (!(updateFlags & eAlertAccessible) &&
// XXX: tree traversal is perf issue, accessible should know if they are (aContainer->IsAlert() || aContainer->IsInsideAlert())) {
// children of alert accessible to avoid this.
Accessible* ancestor = aContainer; Accessible* ancestor = aContainer;
while (ancestor) { do {
if (ancestor->ARIARole() == roles::ALERT) { if (ancestor->IsAlert()) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor); FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
break; break;
} }
// Don't climb above this document.
if (ancestor == this)
break;
ancestor = ancestor->Parent();
} }
while ((ancestor = ancestor->Parent()));
} }
MaybeNotifyOfValueChange(aContainer); MaybeNotifyOfValueChange(aContainer);

View File

@ -19,6 +19,7 @@ XULAlertAccessible::
XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) : XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
AccessibleWrap(aContent, aDoc) AccessibleWrap(aContent, aDoc)
{ {
mGenericTypes |= eAlert;
} }
XULAlertAccessible::~XULAlertAccessible() XULAlertAccessible::~XULAlertAccessible()

View File

@ -0,0 +1,17 @@
Manifest-Version: 1.0
Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: N643P4YjKKlwZUqrfLi4ow==
SHA1-Digest: XK/2qoOrnuYo8xNYeLvB8DlUIik=
Name: bootstrap.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: XH+mMa/H9aj3hm/ZtVKviw==
SHA1-Digest: LMmd1aTash/onjS1eAYIshgrdnM=
Name: options.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: XeELNGdttv8Lq66lT8ykbQ==
SHA1-Digest: 4KO6/RBoe10rYOGS+gFSHuuWi4Y=

Binary file not shown.

View File

@ -0,0 +1,4 @@
Signature-Version: 1.0
MD5-Digest-Manifest: cnqbpqBEVoHgJi/ocCsKKA==
SHA1-Digest-Manifest: eDmvBAkodeNbk/0ujttYgF8KDgI=

View File

@ -61,7 +61,7 @@ exports.ZipWriter = function (zipPath, mode) {
let nsfile = createNsFile(filePath); let nsfile = createNsFile(filePath);
if (!nsfile.exists()) { if (!nsfile.exists()) {
reject(new Error("This file doesn't exists : " + nsfile.path)); reject(new Error("This file doesn't exist: " + nsfile.path));
return promise; return promise;
} }

View File

@ -13,7 +13,7 @@
"{workdir}/out/target/product/generic/tests/*.zip", "{workdir}/out/target/product/generic/tests/*.zip",
"{workdir}/out/emulator.tar.gz", "{workdir}/out/emulator.tar.gz",
"{objdir}/dist/b2g-*.crashreporter-symbols.zip", "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
"{objdir}/dist/test_packages.json", "{objdir}/dist/b2g-*.test_packages.json",
"{workdir}/sources.xml" "{workdir}/sources.xml"
], ],
"upload_platform": "emulator-ics", "upload_platform": "emulator-ics",

View File

@ -13,7 +13,7 @@
"{workdir}/out/target/product/generic/tests/*.zip", "{workdir}/out/target/product/generic/tests/*.zip",
"{workdir}/out/emulator.tar.gz", "{workdir}/out/emulator.tar.gz",
"{objdir}/dist/b2g-*.crashreporter-symbols.zip", "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
"{objdir}/dist/test_packages.json", "{objdir}/dist/b2g-*.test_packages.json",
"{workdir}/sources.xml" "{workdir}/sources.xml"
], ],
"public_upload_files": [ "public_upload_files": [

View File

@ -1,6 +0,0 @@
# 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/.
# Branding Makefile
# - jars chrome artwork

View File

@ -1,6 +0,0 @@
# 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/.
# Branding Makefile
# - jars chrome artwork

View File

@ -1,6 +0,0 @@
# 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/.
# Branding Makefile
# - jars chrome artwork

View File

@ -1,6 +0,0 @@
# 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/.
# Branding Makefile
# - jars chrome artwork

View File

@ -3,18 +3,6 @@
let {AddonManager} = Components.utils.import("resource://gre/modules/AddonManager.jsm", {}); let {AddonManager} = Components.utils.import("resource://gre/modules/AddonManager.jsm", {});
let {Extension} = Components.utils.import("resource://gre/modules/Extension.jsm", {}); let {Extension} = Components.utils.import("resource://gre/modules/Extension.jsm", {});
function install(url) {
return new Promise((resolve, reject) => {
AddonManager.getInstallForURL(url, (install) => {
install.addListener({
onInstallEnded: (i, addon) => resolve(addon),
onInstallFailed: () => reject(),
});
install.install();
}, "application/x-xpinstall");
});
}
function* makeAndInstallXPI(id, backgroundScript, loadedURL) { function* makeAndInstallXPI(id, backgroundScript, loadedURL) {
let xpi = Extension.generateXPI(id, { let xpi = Extension.generateXPI(id, {
background: "(" + backgroundScript.toString() + ")()", background: "(" + backgroundScript.toString() + ")()",
@ -26,9 +14,9 @@ function* makeAndInstallXPI(id, backgroundScript, loadedURL) {
let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, loadedURL); let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, loadedURL);
let fileURI = Services.io.newFileURI(xpi);
info(`installing ${fileURI.spec}`); info(`installing ${xpi.path}`);
let addon = yield install(fileURI.spec); let addon = yield AddonManager.installTemporaryAddon(xpi);
info("installed"); info("installed");
// A WebExtension is started asynchronously, we have our test extension // A WebExtension is started asynchronously, we have our test extension

View File

@ -2509,7 +2509,7 @@ var SessionStoreInternal = {
let window = tab.ownerDocument && tab.ownerDocument.defaultView; let window = tab.ownerDocument && tab.ownerDocument.defaultView;
// The tab or its window might be gone. // The tab or its window might be gone.
if (!window || !window.__SSi) { if (!window || !window.__SSi || window.closed) {
return; return;
} }

View File

@ -45,9 +45,6 @@ def parse_args():
parser.add_argument("--jsshell", required=True, parser.add_argument("--jsshell", required=True,
action="store", dest="jsshell", action="store", dest="jsshell",
help="Name of the jsshell zip.") help="Name of the jsshell zip.")
parser.add_argument("--use-short-names", action="store_true",
help="Use short names for packages (target.$name.tests.zip "
"instead of $(PACKAGE_BASENAME).$name.tests.zip)")
for harness in PACKAGE_SPECIFIED_HARNESSES: for harness in PACKAGE_SPECIFIED_HARNESSES:
parser.add_argument("--%s" % harness, required=True, parser.add_argument("--%s" % harness, required=True,
action="store", dest=harness, action="store", dest=harness,
@ -61,6 +58,7 @@ def parse_args():
help="Path to the output file to be written.") help="Path to the output file to be written.")
return parser.parse_args() return parser.parse_args()
def generate_package_data(args): def generate_package_data(args):
# Generate a dictionary mapping test harness names (exactly as they're known to # Generate a dictionary mapping test harness names (exactly as they're known to
# mozharness and testsuite-targets.mk, ideally) to the set of archive names that # mozharness and testsuite-targets.mk, ideally) to the set of archive names that
@ -69,9 +67,6 @@ def generate_package_data(args):
# which will be an optimization once parts of the main zip are split to harness # which will be an optimization once parts of the main zip are split to harness
# specific zips. # specific zips.
tests_common = args.tests_common tests_common = args.tests_common
if args.use_short_names:
tests_common = 'target.common.tests.zip'
jsshell = args.jsshell jsshell = args.jsshell
harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES]) harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
@ -80,8 +75,6 @@ def generate_package_data(args):
pkg_name = getattr(args, harness, None) pkg_name = getattr(args, harness, None)
if pkg_name is None: if pkg_name is None:
continue continue
if args.use_short_names:
pkg_name = 'target.%s.tests.zip' % harness
harness_requirements[harness].append(pkg_name) harness_requirements[harness].append(pkg_name)
return harness_requirements return harness_requirements

View File

@ -56,12 +56,16 @@ if __name__ == '__main__':
env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
env["XPCOM_DEBUG_BREAK"] = "warn" env["XPCOM_DEBUG_BREAK"] = "warn"
# For VC12, make sure we can find the right bitness of pgort120.dll # For VC12+, make sure we can find the right bitness of pgort1x0.dll
if "VS120COMNTOOLS" in env and not substs["HAVE_64BIT_BUILD"]: if not substs['HAVE_64BIT_BUILD']:
vc12dir = os.path.abspath(os.path.join(env["VS120COMNTOOLS"], for e in ('VS140COMNTOOLS', 'VS120COMNTOOLS'):
"../../VC/bin")) if e not in env:
if os.path.exists(vc12dir): continue
env["PATH"] = vc12dir + ";" + env["PATH"]
vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
if os.path.exists(vcdir):
env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
break
# Run Firefox a first time to initialize its profile # Run Firefox a first time to initialize its profile
runner = FirefoxRunner(profile=profile, runner = FirefoxRunner(profile=profile,

52
build/util/count_ctors.py Normal file
View File

@ -0,0 +1,52 @@
#!/usr/bin/python
import subprocess
import re
import sys
def count_ctors(filename):
proc = subprocess.Popen(
['readelf', '-W', '-S', filename], stdout=subprocess.PIPE)
# Some versions of ld produce both .init_array and .ctors. So we have
# to check for both.
n_init_array_ctors = 0
have_init_array = False
n_ctors_ctors = 0
have_ctors = False
for line in proc.stdout:
f = line.split()
if len(f) != 11:
continue
# Don't try to int()-parse the header line for the section summaries.
if not re.match("\\[\\d+\\]", f[0]):
continue
section_name, contents, size, align = f[1], f[2], int(f[5], 16), int(f[10])
if section_name == ".ctors" and contents == "PROGBITS":
have_ctors = True
# Subtract 2 for the uintptr_t(-1) header and the null terminator.
n_ctors_ctors = size / align - 2
if section_name == ".init_array" and contents == "INIT_ARRAY":
have_init_array = True
n_init_array_ctors = size / align
if have_init_array:
# Even if we have .ctors, we shouldn't have any constructors in .ctors.
# Complain if .ctors does not look how we expect it to.
if have_ctors and n_ctors_ctors != 0:
print >>sys.stderr, "Unexpected .ctors contents for", filename
sys.exit(1)
return n_init_array_ctors
if have_ctors:
return n_ctors_ctors
# We didn't find anything; somebody switched initialization mechanisms on
# us, or the binary is completely busted. Complain either way.
print >>sys.stderr, "Couldn't find .init_array or .ctors in", filename
sys.exit(1)
if __name__ == '__main__':
for f in sys.argv[1:]:
output = {"framework": {"name": "build_metrics"}, "suites": [{"name": "compiler_metrics", "subtests": [{"name": "num_constructors", "value": count_ctors(f)}] } ]}
print "PERFHERDER_DATA: %s" % output

View File

@ -9,10 +9,13 @@ import itertools
import os import os
import subprocess import subprocess
import sys import sys
import re
base_dir = os.path.dirname(__file__) base_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(base_dir, 'python', 'which')) sys.path.append(os.path.join(base_dir, 'python', 'which'))
sys.path.append(os.path.join(base_dir, 'python', 'mozbuild'))
from which import which, WhichError from which import which, WhichError
from mozbuild.mozconfig import MozconfigLoader
# If feel dirty replicating this from python/mozbuild/mozbuild/mozconfig.py, # If feel dirty replicating this from python/mozbuild/mozbuild/mozconfig.py,
@ -24,7 +27,15 @@ if sys.platform == 'win32':
shell = shell + '.exe' shell = shell + '.exe'
def is_absolute_or_relative(path):
if os.altsep and os.altsep in path:
return True
return os.sep in path
def find_program(file): def find_program(file):
if is_absolute_or_relative(file):
return os.path.abspath(file) if os.path.isfile(file) else None
try: try:
return which(file) return which(file)
except WhichError: except WhichError:
@ -45,10 +56,29 @@ def autoconf_refresh(configure):
else: else:
return return
for ac in ('autoconf-2.13', 'autoconf2.13', 'autoconf213'): mozconfig_autoconf = None
autoconf = find_program(ac) configure_dir = os.path.dirname(configure)
if autoconf: # Don't read the mozconfig for the js configure (yay backwards
break # compatibility)
if not configure_dir.replace(os.sep, '/').endswith('/js/src'):
loader = MozconfigLoader(os.path.dirname(configure))
project = os.environ.get('MOZ_CURRENT_PROJECT')
mozconfig = loader.find_mozconfig(env=os.environ)
mozconfig = loader.read_mozconfig(mozconfig, moz_build_app=project)
make_extra = mozconfig['make_extra']
if make_extra:
for assignment in make_extra:
m = re.match('(?:export\s+)?AUTOCONF\s*:?=\s*(.+)$',
assignment)
if m:
mozconfig_autoconf = m.group(1)
for ac in (mozconfig_autoconf, os.environ.get('AUTOCONF'), 'autoconf-2.13',
'autoconf2.13', 'autoconf213'):
if ac:
autoconf = find_program(ac)
if autoconf:
break
else: else:
fink = find_program('fink') fink = find_program('fink')
if fink: if fink:
@ -58,7 +88,10 @@ def autoconf_refresh(configure):
if not autoconf: if not autoconf:
raise RuntimeError('Could not find autoconf 2.13') raise RuntimeError('Could not find autoconf 2.13')
print('Refreshing %s' % configure, file=sys.stderr) # Add or adjust AUTOCONF for subprocesses, especially the js/src configure
os.environ['AUTOCONF'] = autoconf
print('Refreshing %s with %s' % (configure, autoconf), file=sys.stderr)
with open(configure, 'wb') as fh: with open(configure, 'wb') as fh:
subprocess.check_call([ subprocess.check_call([

File diff suppressed because it is too large Load Diff

View File

@ -111,9 +111,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.10.2" #define SQLITE_VERSION "3.11.0"
#define SQLITE_VERSION_NUMBER 3010002 #define SQLITE_VERSION_NUMBER 3011000
#define SQLITE_SOURCE_ID "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9" #define SQLITE_SOURCE_ID "2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -347,7 +347,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
** from [sqlite3_malloc()] and passed back through the 5th parameter. ** from [sqlite3_malloc()] and passed back through the 5th parameter.
** To avoid memory leaks, the application should invoke [sqlite3_free()] ** To avoid memory leaks, the application should invoke [sqlite3_free()]
** on error message strings returned through the 5th parameter of ** on error message strings returned through the 5th parameter of
** of sqlite3_exec() after the error message string is no longer needed. ** sqlite3_exec() after the error message string is no longer needed.
** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors ** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
** occur, then sqlite3_exec() sets the pointer in its 5th parameter to ** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
** NULL before returning. ** NULL before returning.
@ -5697,7 +5697,7 @@ struct sqlite3_index_info {
/* Inputs */ /* Inputs */
int nConstraint; /* Number of entries in aConstraint */ int nConstraint; /* Number of entries in aConstraint */
struct sqlite3_index_constraint { struct sqlite3_index_constraint {
int iColumn; /* Column on left-hand side of constraint */ int iColumn; /* Column constrained. -1 for ROWID */
unsigned char op; /* Constraint operator */ unsigned char op; /* Constraint operator */
unsigned char usable; /* True if this constraint is usable */ unsigned char usable; /* True if this constraint is usable */
int iTermOffset; /* Used internally - xBestIndex should ignore */ int iTermOffset; /* Used internally - xBestIndex should ignore */
@ -8193,6 +8193,9 @@ struct Fts5PhraseIter {
** an OOM condition or IO error), an appropriate SQLite error code is ** an OOM condition or IO error), an appropriate SQLite error code is
** returned. ** returned.
** **
** This function may be quite inefficient if used with an FTS5 table
** created with the "columnsize=0" option.
**
** xColumnText: ** xColumnText:
** This function attempts to retrieve the text of column iCol of the ** This function attempts to retrieve the text of column iCol of the
** current document. If successful, (*pz) is set to point to a buffer ** current document. If successful, (*pz) is set to point to a buffer
@ -8213,15 +8216,29 @@ struct Fts5PhraseIter {
** the query within the current row. Return SQLITE_OK if successful, or ** the query within the current row. Return SQLITE_OK if successful, or
** an error code (i.e. SQLITE_NOMEM) if an error occurs. ** an error code (i.e. SQLITE_NOMEM) if an error occurs.
** **
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option. If the FTS5 table is created
** with either "detail=none" or "detail=column" and "content=" option
** (i.e. if it is a contentless table), then this API always returns 0.
**
** xInst: ** xInst:
** Query for the details of phrase match iIdx within the current row. ** Query for the details of phrase match iIdx within the current row.
** Phrase matches are numbered starting from zero, so the iIdx argument ** Phrase matches are numbered starting from zero, so the iIdx argument
** should be greater than or equal to zero and smaller than the value ** should be greater than or equal to zero and smaller than the value
** output by xInstCount(). ** output by xInstCount().
** **
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
** to the column in which it occurs and *piOff the token offset of the
** first token of the phrase. The exception is if the table was created
** with the offsets=0 option specified. In this case *piOff is always
** set to -1.
**
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) ** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
** if an error occurs. ** if an error occurs.
** **
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
**
** xRowid: ** xRowid:
** Returns the rowid of the current row. ** Returns the rowid of the current row.
** **
@ -8305,7 +8322,7 @@ struct Fts5PhraseIter {
** Fts5PhraseIter iter; ** Fts5PhraseIter iter;
** int iCol, iOff; ** int iCol, iOff;
** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff); ** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
** iOff>=0; ** iCol>=0;
** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff) ** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
** ){ ** ){
** // An instance of phrase iPhrase at offset iOff of column iCol ** // An instance of phrase iPhrase at offset iOff of column iCol
@ -8313,13 +8330,51 @@ struct Fts5PhraseIter {
** **
** The Fts5PhraseIter structure is defined above. Applications should not ** The Fts5PhraseIter structure is defined above. Applications should not
** modify this structure directly - it should only be used as shown above ** modify this structure directly - it should only be used as shown above
** with the xPhraseFirst() and xPhraseNext() API methods. ** with the xPhraseFirst() and xPhraseNext() API methods (and by
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option. If the FTS5 table is created
** with either "detail=none" or "detail=column" and "content=" option
** (i.e. if it is a contentless table), then this API always iterates
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
** **
** xPhraseNext() ** xPhraseNext()
** See xPhraseFirst above. ** See xPhraseFirst above.
**
** xPhraseFirstColumn()
** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
** and xPhraseNext() APIs described above. The difference is that instead
** of iterating through all instances of a phrase in the current row, these
** APIs are used to iterate through the set of columns in the current row
** that contain one or more instances of a specified phrase. For example:
**
** Fts5PhraseIter iter;
** int iCol;
** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
** iCol>=0;
** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
** ){
** // Column iCol contains at least one instance of phrase iPhrase
** }
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" option. If the FTS5 table is created with either
** "detail=none" "content=" option (i.e. if it is a contentless table),
** then this API always iterates through an empty set (all calls to
** xPhraseFirstColumn() set iCol to -1).
**
** The information accessed using this API and its companion
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
** (or xInst/xInstCount). The chief advantage of this API is that it is
** significantly more efficient than those alternatives when used with
** "detail=column" tables.
**
** xPhraseNextColumn()
** See xPhraseFirstColumn above.
*/ */
struct Fts5ExtensionApi { struct Fts5ExtensionApi {
int iVersion; /* Currently always set to 1 */ int iVersion; /* Currently always set to 3 */
void *(*xUserData)(Fts5Context*); void *(*xUserData)(Fts5Context*);
@ -8349,8 +8404,11 @@ struct Fts5ExtensionApi {
int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*)); int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
void *(*xGetAuxdata)(Fts5Context*, int bClear); void *(*xGetAuxdata)(Fts5Context*, int bClear);
void (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*); int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff); void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
}; };
/* /*

View File

@ -298,7 +298,7 @@ public:
return false; return false;
} }
if (NS_WARN_IF(!mWorkerPrivate->AddFeature(cx, this))) { if (NS_WARN_IF(!mWorkerPrivate->AddFeature(this))) {
return false; return false;
} }
@ -360,7 +360,7 @@ private:
mRunnable->ReleaseData(); mRunnable->ReleaseData();
mRunnable->mConsole = nullptr; mRunnable->mConsole = nullptr;
aWorkerPrivate->RemoveFeature(aCx, mRunnable); aWorkerPrivate->RemoveFeature(mRunnable);
return true; return true;
} }

View File

@ -701,7 +701,7 @@ nsresult
FileReader::IncreaseBusyCounter() FileReader::IncreaseBusyCounter()
{ {
if (mWorkerPrivate && mBusyCount++ == 0 && if (mWorkerPrivate && mBusyCount++ == 0 &&
!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), this)) { !mWorkerPrivate->AddFeature(this)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -713,7 +713,7 @@ FileReader::DecreaseBusyCounter()
{ {
MOZ_ASSERT_IF(mWorkerPrivate, mBusyCount); MOZ_ASSERT_IF(mWorkerPrivate, mBusyCount);
if (mWorkerPrivate && --mBusyCount == 0) { if (mWorkerPrivate && --mBusyCount == 0) {
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
} }
} }
@ -742,7 +742,7 @@ FileReader::Shutdown()
} }
if (mWorkerPrivate && mBusyCount != 0) { if (mWorkerPrivate && mBusyCount != 0) {
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
mWorkerPrivate = nullptr; mWorkerPrivate = nullptr;
mBusyCount = 0; mBusyCount = 0;
} }

View File

@ -2130,8 +2130,7 @@ WebSocketImpl::RegisterFeature()
MOZ_ASSERT(!mWorkerFeature); MOZ_ASSERT(!mWorkerFeature);
mWorkerFeature = new WebSocketWorkerFeature(this); mWorkerFeature = new WebSocketWorkerFeature(this);
JSContext* cx = GetCurrentThreadJSContext(); if (!mWorkerPrivate->AddFeature(mWorkerFeature)) {
if (!mWorkerPrivate->AddFeature(cx, mWorkerFeature)) {
NS_WARNING("Failed to register a feature."); NS_WARNING("Failed to register a feature.");
mWorkerFeature = nullptr; mWorkerFeature = nullptr;
return false; return false;
@ -2152,8 +2151,7 @@ WebSocketImpl::UnregisterFeature()
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mWorkerFeature); MOZ_ASSERT(mWorkerFeature);
JSContext* cx = GetCurrentThreadJSContext(); mWorkerPrivate->RemoveFeature(mWorkerFeature);
mWorkerPrivate->RemoveFeature(cx, mWorkerFeature);
mWorkerFeature = nullptr; mWorkerFeature = nullptr;
mWorkerPrivate = nullptr; mWorkerPrivate = nullptr;

View File

@ -3619,8 +3619,10 @@ nsDOMWindowUtils::GetContentAPZTestData(JSContext* aContext,
{ {
if (nsIWidget* widget = GetWidget()) { if (nsIWidget* widget = GetWidget()) {
RefPtr<LayerManager> lm = widget->GetLayerManager(); RefPtr<LayerManager> lm = widget->GetLayerManager();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { if (!lm) {
ClientLayerManager* clm = static_cast<ClientLayerManager*>(lm.get()); return NS_OK;
}
if (ClientLayerManager* clm = lm->AsClientLayerManager()) {
if (!clm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) { if (!clm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -3636,8 +3638,10 @@ nsDOMWindowUtils::GetCompositorAPZTestData(JSContext* aContext,
{ {
if (nsIWidget* widget = GetWidget()) { if (nsIWidget* widget = GetWidget()) {
RefPtr<LayerManager> lm = widget->GetLayerManager(); RefPtr<LayerManager> lm = widget->GetLayerManager();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { if (!lm) {
ClientLayerManager* clm = static_cast<ClientLayerManager*>(lm.get()); return NS_OK;
}
if (ClientLayerManager* clm = lm->AsClientLayerManager()) {
APZTestData compositorSideData; APZTestData compositorSideData;
clm->GetCompositorSideAPZTestData(&compositorSideData); clm->GetCompositorSideAPZTestData(&compositorSideData);
if (!compositorSideData.ToJS(aOutCompositorTestData, aContext)) { if (!compositorSideData.ToJS(aOutCompositorTestData, aContext)) {
@ -3857,9 +3861,8 @@ nsDOMWindowUtils::SetNextPaintSyncId(int32_t aSyncId)
{ {
if (nsIWidget* widget = GetWidget()) { if (nsIWidget* widget = GetWidget()) {
RefPtr<LayerManager> lm = widget->GetLayerManager(); RefPtr<LayerManager> lm = widget->GetLayerManager();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { if (lm && lm->AsClientLayerManager()) {
ClientLayerManager* clm = static_cast<ClientLayerManager*>(lm.get()); lm->AsClientLayerManager()->SetNextPaintSyncId(aSyncId);
clm->SetNextPaintSyncId(aSyncId);
return NS_OK; return NS_OK;
} }
} }

View File

@ -1574,6 +1574,15 @@ nsDocument::~nsDocument()
Accumulate(Telemetry::MIXED_CONTENT_PAGE_LOAD, mixedContentLevel); Accumulate(Telemetry::MIXED_CONTENT_PAGE_LOAD, mixedContentLevel);
Accumulate(Telemetry::SCROLL_LINKED_EFFECT_FOUND, mHasScrollLinkedEffect); Accumulate(Telemetry::SCROLL_LINKED_EFFECT_FOUND, mHasScrollLinkedEffect);
// record mixed object subrequest telemetry
if (mHasMixedContentObjectSubrequest) {
/* mixed object subrequest loaded on page*/
Accumulate(Telemetry::MIXED_CONTENT_OBJECT_SUBREQUEST, 1);
} else {
/* no mixed object subrequests loaded on page*/
Accumulate(Telemetry::MIXED_CONTENT_OBJECT_SUBREQUEST, 0);
}
} }
} }
@ -2311,7 +2320,7 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets()
void void
nsDocument::RemoveStyleSheetsFromStyleSets( nsDocument::RemoveStyleSheetsFromStyleSets(
nsTArray<StyleSheetHandle::RefPtr>& aSheets, const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
SheetType aType) SheetType aType)
{ {
// The stylesheets should forget us // The stylesheets should forget us
@ -4131,7 +4140,7 @@ nsDocument::GetStyleSheetAt(int32_t aIndex) const
} }
int32_t int32_t
nsDocument::GetIndexOfStyleSheet(StyleSheetHandle aSheet) const nsDocument::GetIndexOfStyleSheet(const StyleSheetHandle aSheet) const
{ {
return mStyleSheets.IndexOf(aSheet); return mStyleSheets.IndexOf(aSheet);
} }
@ -4470,7 +4479,7 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
} }
StyleSheetHandle StyleSheetHandle
nsDocument::FirstAdditionalAuthorSheet() nsDocument::GetFirstAdditionalAuthorSheet()
{ {
return mAdditionalSheets[eAuthorSheet].SafeElementAt(0, StyleSheetHandle()); return mAdditionalSheets[eAuthorSheet].SafeElementAt(0, StyleSheetHandle());
} }

View File

@ -805,7 +805,8 @@ public:
*/ */
virtual int32_t GetNumberOfStyleSheets() const override; virtual int32_t GetNumberOfStyleSheets() const override;
virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override; virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override;
virtual int32_t GetIndexOfStyleSheet(mozilla::StyleSheetHandle aSheet) const override; virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const override;
virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override; virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override;
virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override; virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override;
@ -826,7 +827,7 @@ public:
mozilla::StyleSheetHandle aSheet) override; mozilla::StyleSheetHandle aSheet) override;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) override; nsIURI* sheetURI) override;
virtual mozilla::StyleSheetHandle FirstAdditionalAuthorSheet() override; virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() override;
virtual nsIChannel* GetChannel() const override { virtual nsIChannel* GetChannel() const override {
return mChannel; return mChannel;
@ -1494,7 +1495,7 @@ protected:
void RemoveDocStyleSheetsFromStyleSets(); void RemoveDocStyleSheetsFromStyleSets();
void RemoveStyleSheetsFromStyleSets( void RemoveStyleSheetsFromStyleSets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets, const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
mozilla::SheetType aType); mozilla::SheetType aType);
void ResetStylesheetsToURI(nsIURI* aURI); void ResetStylesheetsToURI(nsIURI* aURI);
void FillStyleSet(mozilla::StyleSetHandle aStyleSet); void FillStyleSet(mozilla::StyleSetHandle aStyleSet);

View File

@ -610,6 +610,14 @@ public:
mHasMixedDisplayContentBlocked = aHasMixedDisplayContentBlocked; mHasMixedDisplayContentBlocked = aHasMixedDisplayContentBlocked;
} }
/**
* Set the mixed content object subrequest flag for this document.
*/
void SetHasMixedContentObjectSubrequest(bool aHasMixedContentObjectSubrequest)
{
mHasMixedContentObjectSubrequest = aHasMixedContentObjectSubrequest;
}
/** /**
* Get tracking content blocked flag for this document. * Get tracking content blocked flag for this document.
*/ */
@ -954,7 +962,8 @@ public:
* @param aSheet the sheet to get the index of * @param aSheet the sheet to get the index of
* @return aIndex the index of the sheet in the full list * @return aIndex the index of the sheet in the full list
*/ */
virtual int32_t GetIndexOfStyleSheet(mozilla::StyleSheetHandle aSheet) const = 0; virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const = 0;
/** /**
* Replace the stylesheets in aOldSheets with the stylesheets in * Replace the stylesheets in aOldSheets with the stylesheets in
@ -998,7 +1007,7 @@ public:
mozilla::StyleSheetHandle aSheet) = 0; mozilla::StyleSheetHandle aSheet) = 0;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType, virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) = 0; nsIURI* sheetURI) = 0;
virtual mozilla::StyleSheetHandle FirstAdditionalAuthorSheet() = 0; virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() = 0;
/** /**
* Get this document's CSSLoader. This is guaranteed to not return null. * Get this document's CSSLoader. This is guaranteed to not return null.
@ -2907,6 +2916,9 @@ protected:
// True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp) // True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
bool mHasMixedDisplayContentBlocked : 1; bool mHasMixedDisplayContentBlocked : 1;
// True if a document loads a plugin object that attempts to load mixed content subresources through necko(see nsMixedContentBlocker.cpp)
bool mHasMixedContentObjectSubrequest : 1;
// True if a document has blocked Tracking Content // True if a document has blocked Tracking Content
bool mHasTrackingContentBlocked : 1; bool mHasTrackingContentBlocked : 1;

View File

@ -1604,7 +1604,7 @@ DOMInterfaces = {
'workers': True, 'workers': True,
'concrete': False, 'concrete': False,
'implicitJSContext': [ 'implicitJSContext': [
'close', 'importScripts', 'close',
], ],
# Rename a few things so we don't have both classes and methods # Rename a few things so we don't have both classes and methods
# with the same name # with the same name

View File

@ -913,7 +913,8 @@ BluetoothAvrcpManager::VolumeChangeNotification(uint8_t aVolume,
} }
void void
BluetoothAvrcpManager::PassthroughCmdNotification(int aId, int aKeyState) BluetoothAvrcpManager::PassthroughCmdNotification(uint8_t aId,
uint8_t aKeyState)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

View File

@ -108,7 +108,7 @@ private:
void VolumeChangeNotification(uint8_t aVolume, uint8_t aCType) override; void VolumeChangeNotification(uint8_t aVolume, uint8_t aCType) override;
void PassthroughCmdNotification(int aId, int aKeyState) override; void PassthroughCmdNotification(uint8_t aId, uint8_t aKeyState) override;
BluetoothAddress mDeviceAddress; BluetoothAddress mDeviceAddress;
RefPtr<BluetoothProfileController> mController; RefPtr<BluetoothProfileController> mController;

View File

@ -550,7 +550,7 @@ public:
nsresult nsresult
operator () (uint8_t& aArg1, operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>& aArg2) const UniquePtr<BluetoothAvrcpPlayerAttribute[]>& aArg2) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -591,7 +591,7 @@ public:
nsresult nsresult
operator () (uint8_t& aArg1, operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>& aArg2) const UniquePtr<BluetoothAvrcpPlayerAttribute[]>& aArg2) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -632,7 +632,7 @@ public:
nsresult nsresult
operator () (uint8_t& aArg1, uint8_t& aArg2, operator () (uint8_t& aArg1, uint8_t& aArg2,
nsAutoArrayPtr<uint8_t>& aArg3) const UniquePtr<uint8_t[]>& aArg3) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -687,7 +687,7 @@ public:
nsresult nsresult
operator () (uint8_t& aArg1, operator () (uint8_t& aArg1,
nsAutoArrayPtr<BluetoothAvrcpMediaAttribute>& aArg2) const UniquePtr<BluetoothAvrcpMediaAttribute[]>& aArg2) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();

View File

@ -199,19 +199,19 @@ protected:
typedef mozilla::ipc::DaemonNotificationRunnable2< typedef mozilla::ipc::DaemonNotificationRunnable2<
NotificationHandlerWrapper, void, uint8_t, NotificationHandlerWrapper, void, uint8_t,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>, UniquePtr<BluetoothAvrcpPlayerAttribute[]>,
uint8_t, const BluetoothAvrcpPlayerAttribute*> uint8_t, const BluetoothAvrcpPlayerAttribute*>
GetPlayerAppValueNotification; GetPlayerAppValueNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2< typedef mozilla::ipc::DaemonNotificationRunnable2<
NotificationHandlerWrapper, void, uint8_t, NotificationHandlerWrapper, void, uint8_t,
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>, UniquePtr<BluetoothAvrcpPlayerAttribute[]>,
uint8_t, const BluetoothAvrcpPlayerAttribute*> uint8_t, const BluetoothAvrcpPlayerAttribute*>
GetPlayerAppAttrsTextNotification; GetPlayerAppAttrsTextNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, uint8_t, uint8_t, NotificationHandlerWrapper, void, uint8_t, uint8_t,
nsAutoArrayPtr<uint8_t>, uint8_t, uint8_t, const uint8_t*> UniquePtr<uint8_t[]>, uint8_t, uint8_t, const uint8_t*>
GetPlayerAppValuesTextNotification; GetPlayerAppValuesTextNotification;
typedef mozilla::ipc::DaemonNotificationRunnable1< typedef mozilla::ipc::DaemonNotificationRunnable1<
@ -221,7 +221,7 @@ protected:
typedef mozilla::ipc::DaemonNotificationRunnable2< typedef mozilla::ipc::DaemonNotificationRunnable2<
NotificationHandlerWrapper, void, uint8_t, NotificationHandlerWrapper, void, uint8_t,
nsAutoArrayPtr<BluetoothAvrcpMediaAttribute>, UniquePtr<BluetoothAvrcpMediaAttribute[]>,
uint8_t, const BluetoothAvrcpMediaAttribute*> uint8_t, const BluetoothAvrcpMediaAttribute*>
GetElementAttrNotification; GetElementAttrNotification;
@ -234,7 +234,7 @@ protected:
VolumeChangeNotification; VolumeChangeNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2< typedef mozilla::ipc::DaemonNotificationRunnable2<
NotificationHandlerWrapper, void, uint8_t, uint8_t, int, int> NotificationHandlerWrapper, void, uint8_t, uint8_t, uint8_t, uint8_t>
PassthroughCmdNotification; PassthroughCmdNotification;
class GetElementAttrInitOp; class GetElementAttrInitOp;

View File

@ -796,7 +796,7 @@ public:
nsresult nsresult
operator () (BluetoothStatus& aArg1, int& aArg2, operator () (BluetoothStatus& aArg1, int& aArg2,
nsAutoArrayPtr<BluetoothProperty>& aArg3) const UniquePtr<BluetoothProperty[]>& aArg3) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -845,7 +845,7 @@ public:
nsresult nsresult
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2, int& aArg3, operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2, int& aArg3,
nsAutoArrayPtr<BluetoothProperty>& aArg4) const UniquePtr<BluetoothProperty[]>& aArg4) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -899,7 +899,7 @@ public:
{ } { }
nsresult nsresult
operator () (int& aArg1, nsAutoArrayPtr<BluetoothProperty>& aArg2) const operator () (int& aArg1, UniquePtr<BluetoothProperty[]>& aArg2) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -986,7 +986,7 @@ public:
{ } { }
nsresult nsresult
operator () (uint16_t& aArg1, nsAutoArrayPtr<uint8_t>& aArg2, operator () (uint16_t& aArg1, UniquePtr<uint8_t[]>& aArg2,
uint8_t& aArg3) const uint8_t& aArg3) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();

View File

@ -244,18 +244,18 @@ private:
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, BluetoothStatus, int, NotificationHandlerWrapper, void, BluetoothStatus, int,
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus, int, UniquePtr<BluetoothProperty[]>, BluetoothStatus, int,
const BluetoothProperty*> const BluetoothProperty*>
AdapterPropertiesNotification; AdapterPropertiesNotification;
typedef mozilla::ipc::DaemonNotificationRunnable4< typedef mozilla::ipc::DaemonNotificationRunnable4<
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, int, NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, int,
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus, UniquePtr<BluetoothProperty[]>, BluetoothStatus,
const BluetoothAddress&, int, const BluetoothProperty*> const BluetoothAddress&, int, const BluetoothProperty*>
RemoteDevicePropertiesNotification; RemoteDevicePropertiesNotification;
typedef mozilla::ipc::DaemonNotificationRunnable2< typedef mozilla::ipc::DaemonNotificationRunnable2<
NotificationHandlerWrapper, void, int, nsAutoArrayPtr<BluetoothProperty>, NotificationHandlerWrapper, void, int, UniquePtr<BluetoothProperty[]>,
int, const BluetoothProperty*> int, const BluetoothProperty*>
DeviceFoundNotification; DeviceFoundNotification;
@ -288,7 +288,7 @@ private:
AclStateChangedNotification; AclStateChangedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, uint16_t, nsAutoArrayPtr<uint8_t>, NotificationHandlerWrapper, void, uint16_t, UniquePtr<uint8_t[]>,
uint8_t, uint16_t, const uint8_t*> uint8_t, uint16_t, const uint8_t*>
DutModeRecvNotification; DutModeRecvNotification;

View File

@ -1972,7 +1972,7 @@ public:
BluetoothAttributeHandle& aArg4, BluetoothAttributeHandle& aArg4,
int& aArg5, int& aArg5,
int& aArg6, int& aArg6,
nsAutoArrayPtr<uint8_t>& aArg7, UniquePtr<uint8_t[]>& aArg7,
bool& aArg8, bool& aArg8,
bool& aArg9) const bool& aArg9) const
{ {

View File

@ -653,7 +653,7 @@ protected:
typedef mozilla::ipc::DaemonNotificationRunnable9< typedef mozilla::ipc::DaemonNotificationRunnable9<
NotificationHandlerWrapper, void, NotificationHandlerWrapper, void,
int, int, BluetoothAddress, BluetoothAttributeHandle, int, int, BluetoothAddress, BluetoothAttributeHandle,
int, int, nsAutoArrayPtr<uint8_t>, bool, bool, int, int, UniquePtr<uint8_t[]>, bool, bool,
int, int, const BluetoothAddress&, const BluetoothAttributeHandle&, int, int, const BluetoothAddress&, const BluetoothAttributeHandle&,
int, int, const uint8_t*, bool, bool> int, int, const uint8_t*, bool, bool>
ServerRequestWriteNotification; ServerRequestWriteNotification;

View File

@ -1444,7 +1444,7 @@ BluetoothMapSmsManager::HandleSmsMmsPushMessage(const ObexHeaderSet& aHeader)
// Get Body // Get Body
uint8_t* bodyPtr = nullptr; uint8_t* bodyPtr = nullptr;
aHeader.GetBody(&bodyPtr, &mBodySegmentLength); aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
mBodySegment = bodyPtr; mBodySegment.reset(bodyPtr);
RefPtr<BluetoothMapBMessage> bmsg = RefPtr<BluetoothMapBMessage> bmsg =
new BluetoothMapBMessage(bodyPtr, mBodySegmentLength); new BluetoothMapBMessage(bodyPtr, mBodySegmentLength);

View File

@ -285,7 +285,7 @@ private:
RefPtr<BluetoothSocket> mMnsSocket; RefPtr<BluetoothSocket> mMnsSocket;
int mBodySegmentLength; int mBodySegmentLength;
nsAutoArrayPtr<uint8_t> mBodySegment; UniquePtr<uint8_t[]> mBodySegment;
/** /**
* The bMessage/message-listing data stream for current processing response * The bMessage/message-listing data stream for current processing response

View File

@ -803,7 +803,7 @@ BluetoothOppManager::ExtractPacketHeaders(const ObexHeaderSet& aHeader)
aHeader.Has(ObexHeaderId::EndOfBody)) { aHeader.Has(ObexHeaderId::EndOfBody)) {
uint8_t* bodyPtr; uint8_t* bodyPtr;
aHeader.GetBody(&bodyPtr, &mBodySegmentLength); aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
mBodySegment = bodyPtr; mBodySegment.reset(bodyPtr);
} }
} }
@ -934,7 +934,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketBuffer* aMessage)
* so here we keep a variable mPutPacketReceivedLength to indicate if * so here we keep a variable mPutPacketReceivedLength to indicate if
* current PUT request is done. * current PUT request is done.
*/ */
mReceivedDataBuffer = new uint8_t[mPacketLength]; mReceivedDataBuffer.reset(new uint8_t[mPacketLength]);
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal); mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
} }

View File

@ -207,8 +207,8 @@ private:
uint32_t mSentFileLength; uint32_t mSentFileLength;
bool mWaitingToSendPutFinal; bool mWaitingToSendPutFinal;
nsAutoArrayPtr<uint8_t> mBodySegment; UniquePtr<uint8_t[]> mBodySegment;
nsAutoArrayPtr<uint8_t> mReceivedDataBuffer; UniquePtr<uint8_t[]> mReceivedDataBuffer;
int mCurrentBlobIndex; int mCurrentBlobIndex;
RefPtr<Blob> mBlob; RefPtr<Blob> mBlob;

View File

@ -795,14 +795,14 @@ BluetoothPbapManager::ReplyToConnect(const nsAString& aPassword)
// The request-digest is required and calculated as follows: // The request-digest is required and calculated as follows:
// H(nonce ":" password) // H(nonce ":" password)
uint32_t hashStringLength = DIGEST_LENGTH + aPassword.Length() + 1; uint32_t hashStringLength = DIGEST_LENGTH + aPassword.Length() + 1;
nsAutoArrayPtr<char> hashString(new char[hashStringLength]); UniquePtr<char[]> hashString(new char[hashStringLength]);
memcpy(hashString, mRemoteNonce, DIGEST_LENGTH); memcpy(hashString.get(), mRemoteNonce, DIGEST_LENGTH);
hashString[DIGEST_LENGTH] = ':'; hashString[DIGEST_LENGTH] = ':';
memcpy(&hashString[DIGEST_LENGTH + 1], memcpy(&hashString[DIGEST_LENGTH + 1],
NS_ConvertUTF16toUTF8(aPassword).get(), NS_ConvertUTF16toUTF8(aPassword).get(),
aPassword.Length()); aPassword.Length());
MD5Hash(hashString, hashStringLength); MD5Hash(hashString.get(), hashStringLength);
// 2 tag-length-value triplets: <request-digest:16><nonce:16> // 2 tag-length-value triplets: <request-digest:16><nonce:16>
uint8_t digestResponse[(DIGEST_LENGTH + 2) * 2]; uint8_t digestResponse[(DIGEST_LENGTH + 2) * 2];
@ -1090,8 +1090,8 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
// Read vCard data from input stream // Read vCard data from input stream
uint32_t numRead = 0; uint32_t numRead = 0;
nsAutoArrayPtr<char> buf(new char[remainingPacketSize]); UniquePtr<char[]> buf(new char[remainingPacketSize]);
rv = mVCardDataStream->Read(buf, remainingPacketSize, &numRead); rv = mVCardDataStream->Read(buf.get(), remainingPacketSize, &numRead);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
BT_LOGR("Failed to read from input stream. rv=0x%x", BT_LOGR("Failed to read from input stream. rv=0x%x",
static_cast<uint32_t>(rv)); static_cast<uint32_t>(rv));

View File

@ -721,7 +721,7 @@ BluetoothOppManager::ExtractPacketHeaders(const ObexHeaderSet& aHeader)
aHeader.Has(ObexHeaderId::EndOfBody)) { aHeader.Has(ObexHeaderId::EndOfBody)) {
uint8_t* bodyPtr; uint8_t* bodyPtr;
aHeader.GetBody(&bodyPtr, &mBodySegmentLength); aHeader.GetBody(&bodyPtr, &mBodySegmentLength);
mBodySegment = bodyPtr; mBodySegment.reset(bodyPtr);
} }
} }
@ -851,7 +851,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketBuffer* aMessage)
* so here we keep a variable mPutPacketReceivedLength to indicate if * so here we keep a variable mPutPacketReceivedLength to indicate if
* current PUT request is done. * current PUT request is done.
*/ */
mReceivedDataBuffer = new uint8_t[mPacketLength]; mReceivedDataBuffer.reset(new uint8_t[mPacketLength]);
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal); mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
} }

View File

@ -191,8 +191,8 @@ private:
uint32_t mSentFileLength; uint32_t mSentFileLength;
bool mWaitingToSendPutFinal; bool mWaitingToSendPutFinal;
nsAutoArrayPtr<uint8_t> mBodySegment; UniquePtr<uint8_t[]> mBodySegment;
nsAutoArrayPtr<uint8_t> mReceivedDataBuffer; UniquePtr<uint8_t[]> mReceivedDataBuffer;
int mCurrentBlobIndex; int mCurrentBlobIndex;
RefPtr<Blob> mBlob; RefPtr<Blob> mBlob;

View File

@ -565,7 +565,7 @@ BluetoothAvrcpNotificationHandler::VolumeChangeNotification(
void void
BluetoothAvrcpNotificationHandler::PassthroughCmdNotification( BluetoothAvrcpNotificationHandler::PassthroughCmdNotification(
int aId, int aKeyState) uint8_t aId, uint8_t aKeyState)
{ } { }
// Result handling // Result handling

View File

@ -562,7 +562,7 @@ public:
VolumeChangeNotification(uint8_t aVolume, uint8_t aCType); VolumeChangeNotification(uint8_t aVolume, uint8_t aCType);
virtual void virtual void
PassthroughCmdNotification(int aId, int aKeyState); PassthroughCmdNotification(uint8_t aId, uint8_t aKeyState);
protected: protected:
BluetoothAvrcpNotificationHandler(); BluetoothAvrcpNotificationHandler();

View File

@ -144,8 +144,8 @@ public:
, mDataLength(aDataLength) , mDataLength(aDataLength)
, mData(nullptr) , mData(nullptr)
{ {
mData = new uint8_t[mDataLength]; mData.reset(new uint8_t[mDataLength]);
memcpy(mData, aData, aDataLength); memcpy(mData.get(), aData, aDataLength);
} }
~ObexHeader() ~ObexHeader()
@ -154,7 +154,7 @@ public:
ObexHeaderId mId; ObexHeaderId mId;
int mDataLength; int mDataLength;
nsAutoArrayPtr<uint8_t> mData; UniquePtr<uint8_t[]> mData;
}; };
class ObexHeaderSet class ObexHeaderSet

View File

@ -421,8 +421,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
} }
} else { } else {
bc->mWorkerFeature = new BroadcastChannelFeature(bc); bc->mWorkerFeature = new BroadcastChannelFeature(bc);
JSContext* cx = workerPrivate->GetJSContext(); if (NS_WARN_IF(!workerPrivate->AddFeature(bc->mWorkerFeature))) {
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, bc->mWorkerFeature))) {
NS_WARNING("Failed to register the BroadcastChannel worker feature."); NS_WARNING("Failed to register the BroadcastChannel worker feature.");
bc->mWorkerFeature = nullptr; bc->mWorkerFeature = nullptr;
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
@ -546,7 +545,7 @@ BroadcastChannel::Shutdown()
if (mWorkerFeature) { if (mWorkerFeature) {
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
workerPrivate->RemoveFeature(workerPrivate->GetJSContext(), mWorkerFeature); workerPrivate->RemoveFeature(mWorkerFeature);
mWorkerFeature = nullptr; mWorkerFeature = nullptr;
} }

View File

@ -25,7 +25,7 @@ Feature::Create(WorkerPrivate* aWorkerPrivate)
RefPtr<Feature> feature = new Feature(aWorkerPrivate); RefPtr<Feature> feature = new Feature(aWorkerPrivate);
if (!aWorkerPrivate->AddFeature(aWorkerPrivate->GetJSContext(), feature)) { if (!aWorkerPrivate->AddFeature(feature)) {
return nullptr; return nullptr;
} }
@ -102,7 +102,7 @@ Feature::~Feature()
NS_ASSERT_OWNINGTHREAD(Feature); NS_ASSERT_OWNINGTHREAD(Feature);
MOZ_ASSERT(mActorList.IsEmpty()); MOZ_ASSERT(mActorList.IsEmpty());
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
} }
} // namespace cache } // namespace cache

View File

@ -184,7 +184,7 @@ WebGLContextLossHandler::RunTimer()
nsCOMPtr<nsIEventTarget> target = workerPrivate->GetEventTarget(); nsCOMPtr<nsIEventTarget> target = workerPrivate->GetEventTarget();
mTimer->SetTarget(new ContextLossWorkerEventTarget(target)); mTimer->SetTarget(new ContextLossWorkerEventTarget(target));
if (!mFeatureAdded) { if (!mFeatureAdded) {
workerPrivate->AddFeature(workerPrivate->GetJSContext(), this); workerPrivate->AddFeature(this);
mFeatureAdded = true; mFeatureAdded = true;
} }
} }
@ -207,7 +207,7 @@ WebGLContextLossHandler::DisableTimer()
dom::workers::WorkerPrivate* workerPrivate = dom::workers::WorkerPrivate* workerPrivate =
dom::workers::GetCurrentThreadWorkerPrivate(); dom::workers::GetCurrentThreadWorkerPrivate();
MOZ_RELEASE_ASSERT(workerPrivate); MOZ_RELEASE_ASSERT(workerPrivate);
workerPrivate->RemoveFeature(workerPrivate->GetJSContext(), this); workerPrivate->RemoveFeature(this);
mFeatureAdded = false; mFeatureAdded = false;
} }

View File

@ -324,7 +324,7 @@ struct TreeForType {};
template<> template<>
struct TreeForType<uint8_t> struct TreeForType<uint8_t>
{ {
static ScopedDeletePtr<WebGLElementArrayCacheTree<uint8_t>>& static UniquePtr<WebGLElementArrayCacheTree<uint8_t>>&
Value(WebGLElementArrayCache* b) { Value(WebGLElementArrayCache* b) {
return b->mUint8Tree; return b->mUint8Tree;
} }
@ -333,7 +333,7 @@ struct TreeForType<uint8_t>
template<> template<>
struct TreeForType<uint16_t> struct TreeForType<uint16_t>
{ {
static ScopedDeletePtr<WebGLElementArrayCacheTree<uint16_t>>& static UniquePtr<WebGLElementArrayCacheTree<uint16_t>>&
Value(WebGLElementArrayCache* b) { Value(WebGLElementArrayCache* b) {
return b->mUint16Tree; return b->mUint16Tree;
} }
@ -342,7 +342,7 @@ struct TreeForType<uint16_t>
template<> template<>
struct TreeForType<uint32_t> struct TreeForType<uint32_t>
{ {
static ScopedDeletePtr<WebGLElementArrayCacheTree<uint32_t>>& static UniquePtr<WebGLElementArrayCacheTree<uint32_t>>&
Value(WebGLElementArrayCache* b) { Value(WebGLElementArrayCache* b) {
return b->mUint32Tree; return b->mUint32Tree;
} }
@ -536,9 +536,9 @@ WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement,
if (!mBytes.Length() || !countElements) if (!mBytes.Length() || !countElements)
return true; return true;
ScopedDeletePtr<WebGLElementArrayCacheTree<T>>& tree = TreeForType<T>::Value(this); UniquePtr<WebGLElementArrayCacheTree<T>>& tree = TreeForType<T>::Value(this);
if (!tree) { if (!tree) {
tree = new WebGLElementArrayCacheTree<T>(*this); tree = MakeUnique<WebGLElementArrayCacheTree<T>>(*this);
if (mBytes.Length()) { if (mBytes.Length()) {
bool valid = tree->Update(0, mBytes.Length() - 1); bool valid = tree->Update(0, mBytes.Length() - 1);
if (!valid) { if (!valid) {

View File

@ -8,7 +8,7 @@
#include "GLDefs.h" #include "GLDefs.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/Scoped.h" #include "mozilla/UniquePtr.h"
#include "nscore.h" #include "nscore.h"
#include "nsTArray.h" #include "nsTArray.h"
#include <stdint.h> #include <stdint.h>
@ -93,9 +93,9 @@ private:
friend struct TreeForType; friend struct TreeForType;
FallibleTArray<uint8_t> mBytes; FallibleTArray<uint8_t> mBytes;
ScopedDeletePtr<WebGLElementArrayCacheTree<uint8_t>> mUint8Tree; UniquePtr<WebGLElementArrayCacheTree<uint8_t>> mUint8Tree;
ScopedDeletePtr<WebGLElementArrayCacheTree<uint16_t>> mUint16Tree; UniquePtr<WebGLElementArrayCacheTree<uint16_t>> mUint16Tree;
ScopedDeletePtr<WebGLElementArrayCacheTree<uint32_t>> mUint32Tree; UniquePtr<WebGLElementArrayCacheTree<uint32_t>> mUint32Tree;
}; };
} // end namespace mozilla } // end namespace mozilla

View File

@ -199,6 +199,7 @@ x-euc-jp=EUC-JP
csiso2022jp=ISO-2022-JP csiso2022jp=ISO-2022-JP
iso-2022-jp=ISO-2022-JP iso-2022-jp=ISO-2022-JP
csshiftjis=Shift_JIS csshiftjis=Shift_JIS
ms932=Shift_JIS
ms_kanji=Shift_JIS ms_kanji=Shift_JIS
shift-jis=Shift_JIS shift-jis=Shift_JIS
shift_jis=Shift_JIS shift_jis=Shift_JIS

View File

@ -359,7 +359,7 @@ function testDecoderGetEncoding()
{encoding: "big5", labels: ["big5", "cn-big5", "csbig5", "x-x-big5", "big5-hkscs"]}, {encoding: "big5", labels: ["big5", "cn-big5", "csbig5", "x-x-big5", "big5-hkscs"]},
{encoding: "euc-jp", labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"]}, {encoding: "euc-jp", labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"]},
{encoding: "iso-2022-jp", labels: ["csiso2022jp", "iso-2022-jp"]}, {encoding: "iso-2022-jp", labels: ["csiso2022jp", "iso-2022-jp"]},
{encoding: "shift_jis", labels: ["csshiftjis", "ms_kanji", "shift-jis", "shift_jis", "sjis", "windows-31j", "x-sjis"]}, {encoding: "shift_jis", labels: ["csshiftjis", "ms932", "ms_kanji", "shift-jis", "shift_jis", "sjis", "windows-31j", "x-sjis"]},
{encoding: "euc-kr", labels: ["cseuckr", "csksc56011987", "euc-kr", "iso-ir-149", "korean", "ks_c_5601-1987", "ks_c_5601-1989", "ksc5601", "ksc_5601", "windows-949"]}, {encoding: "euc-kr", labels: ["cseuckr", "csksc56011987", "euc-kr", "iso-ir-149", "korean", "ks_c_5601-1987", "ks_c_5601-1989", "ksc5601", "ksc_5601", "windows-949"]},
{encoding: "utf-16le", labels: ["utf-16", "utf-16le"]}, {encoding: "utf-16le", labels: ["utf-16", "utf-16le"]},
{encoding: "utf-16be", labels: ["utf-16be"]}, {encoding: "utf-16be", labels: ["utf-16be"]},

View File

@ -309,7 +309,6 @@ function testPointerEventCTORS()
} }
function runTests() { function runTests() {
SpecialPowers.setBoolPref("dom.w3c_pointer_events.enabled", true); // Enable Pointer Events
testTarget = document.getElementById("testTarget"); testTarget = document.getElementById("testTarget");
parent = testTarget.parentNode; parent = testTarget.parentNode;
gOnPointerPropHandled = new Array; gOnPointerPropHandled = new Array;

View File

@ -43,7 +43,7 @@
</div> </div>
<div id="spacerForBody"></div> <div id="spacerForBody"></div>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<script type="application/javascript"> <script type="application/javascript">
@ -93,26 +93,28 @@ function onZoomReset(aCallback) {
}, topic, false); }, topic, false);
} }
function setDeltaMultiplierSettings(aSettings) function setDeltaMultiplierSettings(aSettings, aCallback)
{ {
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", aSettings.deltaMultiplierX * 100); SpecialPowers.pushPrefEnv({"set": [
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.default.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.default.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_x", aSettings.deltaMultiplierX * 100); ["mousewheel.default.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.with_alt.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.with_alt.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_x", aSettings.deltaMultiplierX * 100); ["mousewheel.with_alt.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.with_control.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.with_control.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_x", aSettings.deltaMultiplierX * 100); ["mousewheel.with_control.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.with_meta.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.with_meta.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_x", aSettings.deltaMultiplierX * 100); ["mousewheel.with_meta.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.with_shift.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.with_shift.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_x", aSettings.deltaMultiplierX * 100); ["mousewheel.with_shift.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_y", aSettings.deltaMultiplierY * 100); ["mousewheel.with_win.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_z", aSettings.deltaMultiplierZ * 100); ["mousewheel.with_win.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
["mousewheel.with_win.delta_multiplier_z", aSettings.deltaMultiplierZ * 100]
]}, aCallback);
} }
function doTestScroll(aSettings, aCallback) function doTestScroll(aSettings, aCallback)
@ -502,8 +504,8 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll, expected: kNoScroll,
prepare: function () { SpecialPowers.setIntPref("mousewheel.default.action", 0); }, prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup: function () { SpecialPowers.setIntPref("mousewheel.default.action", 1); } }, cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
// momentum scroll should cause scroll even if the action is history, but if the default action is none, // momentum scroll should cause scroll even if the action is history, but if the default action is none,
// shouldn't do it. // shouldn't do it.
@ -605,8 +607,8 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll, expected: kNoScroll,
prepare: function () { SpecialPowers.setIntPref("mousewheel.default.action", 0); }, prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup: function () { SpecialPowers.setIntPref("mousewheel.default.action", 1); } }, cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
// Don't scroll along axis whose overflow style is hidden. // Don't scroll along axis whose overflow style is hidden.
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden", { description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
@ -616,7 +618,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollDown, expected: kScrollDown,
prepare: function() { gScrollableElement.style.overflowX = "hidden"; } }, prepare: function(cb) { gScrollableElement.style.overflowX = "hidden"; cb(); } },
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden", { description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE, event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0, deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@ -652,7 +654,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollUp, expected: kScrollUp,
cleanup: function () { gScrollableElement.style.overflowX = "auto"; } }, cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden", { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL, event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0, deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@ -660,7 +662,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollRight, expected: kScrollRight,
prepare: function() { gScrollableElement.style.overflowY = "hidden"; } }, prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden", { description: "Scroll to only right by oblique line wheel event with overflow-y: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE, event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0, deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@ -696,7 +698,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollLeft, expected: kScrollLeft,
cleanup: function () { gScrollableElement.style.overflowY = "auto"; } }, cleanup: function (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
{ description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden", { description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL, event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0, deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@ -704,7 +706,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1, expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll, expected: kNoScroll,
prepare: function() { gScrollableElement.style.overflow = "hidden"; } }, prepare: function(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
{ description: "Don't be scrolled by oblique line wheel event with overflow: hidden", { description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE, event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0, deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@ -740,7 +742,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1, expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll, expected: kNoScroll,
cleanup: function () { gScrollableElement.style.overflow = "auto"; } }, cleanup: function (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
// Don't scroll along axis whose overflow style is hidden and overflow delta values should // Don't scroll along axis whose overflow style is hidden and overflow delta values should
// be zero if there is ancestor scrollable element. // be zero if there is ancestor scrollable element.
@ -751,7 +753,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollDown, expected: kScrollDown,
prepare: function() { prepare: function(cb) {
gScrollableElement.style.overflowX = "hidden"; gScrollableElement.style.overflowX = "hidden";
gScrollableElement.style.position = "fixed"; gScrollableElement.style.position = "fixed";
gScrollableElement.style.top = "30px"; gScrollableElement.style.top = "30px";
@ -761,6 +763,7 @@ function doTestScroll(aSettings, aCallback)
gSpacerForBodyElement.style.height = "5000px"; gSpacerForBodyElement.style.height = "5000px";
document.documentElement.scrollTop = 500; document.documentElement.scrollTop = 500;
document.documentElement.scrollLeft = 500; document.documentElement.scrollLeft = 500;
cb();
} }, } },
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden (body is scrollable)", { description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden (body is scrollable)",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE, event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
@ -796,7 +799,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollUp, expected: kScrollUp,
cleanup: function () { gScrollableElement.style.overflowX = "auto"; } }, cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)", { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL, event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0, deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@ -804,7 +807,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollRight, expected: kScrollRight,
prepare: function() { gScrollableElement.style.overflowY = "hidden"; } }, prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)", { description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE, event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0, deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@ -840,11 +843,12 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0, expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false }, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollLeft, expected: kScrollLeft,
cleanup: function () { cleanup: function (cb) {
gScrollableElement.style.overflowY = "auto"; gScrollableElement.style.overflowY = "auto";
gScrollableElement.style.position = "static"; gScrollableElement.style.position = "static";
gSpacerForBodyElement.style.width = ""; gSpacerForBodyElement.style.width = "";
gSpacerForBodyElement.style.height = ""; gSpacerForBodyElement.style.height = "";
cb();
} }, } },
]; ];
@ -867,9 +871,14 @@ function doTestScroll(aSettings, aCallback)
var currentTest = kTests[currentTestIndex]; var currentTest = kTests[currentTestIndex];
description = "doTestScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": "; description = "doTestScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": ";
if (currentTest.prepare) { if (currentTest.prepare) {
currentTest.prepare(); currentTest.prepare(doTestCurrentScroll);
} else {
doTestCurrentScroll();
} }
}
function doTestCurrentScroll() {
var currentTest = kTests[currentTestIndex];
sendWheelAndWait(10, 10, currentTest.event, function () { sendWheelAndWait(10, 10, currentTest.event, function () {
if (currentTest.expected == kNoScroll) { if (currentTest.expected == kNoScroll) {
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical"); is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
@ -899,10 +908,15 @@ function doTestScroll(aSettings, aCallback)
} }
} }
if (currentTest.cleanup) { if (currentTest.cleanup) {
currentTest.cleanup(); currentTest.cleanup(nextStep);
} else {
nextStep();
}
function nextStep() {
winUtils.advanceTimeAndRefresh(100);
doNextTest();
} }
winUtils.advanceTimeAndRefresh(100);
doNextTest();
}, 10); }, 10);
} }
doNextTest(); doNextTest();
@ -1334,9 +1348,14 @@ function doTestZoomedScroll(aCallback)
function doTestWholeScroll(aCallback) function doTestWholeScroll(aCallback)
{ {
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 99999999); SpecialPowers.pushPrefEnv({"set": [
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_y", 99999999); ["mousewheel.default.delta_multiplier_x", 99999999],
["mousewheel.default.delta_multiplier_y", 99999999]]},
function() { doTestWholeScroll2(aCallback); });
}
function doTestWholeScroll2(aCallback)
{
const kTests = [ const kTests = [
{ description: "try whole-scroll to top (line)", { description: "try whole-scroll to top (line)",
prepare: function () { prepare: function () {
@ -1574,9 +1593,6 @@ function doTestWholeScroll(aCallback)
is(gScrollableElement.scrollLeft, kTest.expectedScrollLeft, is(gScrollableElement.scrollLeft, kTest.expectedScrollLeft,
"doTestWholeScroll, " + kTest.description + ": unexpected scrollLeft"); "doTestWholeScroll, " + kTest.description + ": unexpected scrollLeft");
if (++index == kTests.length) { if (++index == kTests.length) {
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_z");
SimpleTest.executeSoon(aCallback); SimpleTest.executeSoon(aCallback);
} else { } else {
doIt(); doIt();
@ -1708,14 +1724,22 @@ function doTestActionOverride(aCallback)
var index = 0; var index = 0;
function doIt() function doIt()
{
const kTest = kTests[index];
SpecialPowers.pushPrefEnv({"set": [
["mousewheel.default.action", kTest.action],
["mousewheel.default.action.override_x", kTest.override_x]]},
doIt2
);
}
function doIt2()
{ {
const kTest = kTests[index]; const kTest = kTests[index];
description = "doTestActionOverride(action=" + kTest.action + ", " + description = "doTestActionOverride(action=" + kTest.action + ", " +
"override_x=" + kTest.override_x + ", " + "override_x=" + kTest.override_x + ", " +
"deltaX=" + kTest.event.deltaX + ", " + "deltaX=" + kTest.event.deltaX + ", " +
"deltaY=" + kTest.event.deltaY + "): "; "deltaY=" + kTest.event.deltaY + "): ";
SpecialPowers.setIntPref("mousewheel.default.action", kTest.action);
SpecialPowers.setIntPref("mousewheel.default.action.override_x", kTest.override_x);
gScrollableElement.scrollTop = 1000; gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000; gScrollableElement.scrollLeft = 1000;
sendWheelAndWait(10, 10, kTest.event, function () { sendWheelAndWait(10, 10, kTest.event, function () {
@ -1734,8 +1758,6 @@ function doTestActionOverride(aCallback)
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal"); is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
} }
if (++index == kTests.length) { if (++index == kTests.length) {
SpecialPowers.setIntPref("mousewheel.default.action", 1);
SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1);
SimpleTest.executeSoon(aCallback); SimpleTest.executeSoon(aCallback);
} else { } else {
doIt(); doIt();
@ -1747,15 +1769,19 @@ function doTestActionOverride(aCallback)
function runTests() function runTests()
{ {
SpecialPowers.setBoolPref("general.smoothScroll", false); SpecialPowers.pushPrefEnv({"set": [
["general.smoothScroll", false],
SpecialPowers.setIntPref("mousewheel.default.action", 1); // scroll ["mousewheel.default.action", 1], // scroll
SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1); ["mousewheel.default.action.override_x", -1],
SpecialPowers.setIntPref("mousewheel.with_shift.action", 2); // history ["mousewheel.with_shift.action", 2], // history
SpecialPowers.setIntPref("mousewheel.with_shift.action.override_x", -1); ["mousewheel.with_shift.action.override_x", -1],
SpecialPowers.setIntPref("mousewheel.with_control.action", 3); // zoom ["mousewheel.with_control.action", 3], // zoom
SpecialPowers.setIntPref("mousewheel.with_control.action.override_x", -1); ["mousewheel.with_control.action.override_x", -1]]},
runTests2);
}
function runTests2()
{
const kSettings = [ const kSettings = [
{ description: "all delta values are not customized", { description: "all delta values are not customized",
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 }, deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
@ -1782,21 +1808,23 @@ function runTests()
var index = 0; var index = 0;
function doTest() { function doTest() {
setDeltaMultiplierSettings(kSettings[index]); setDeltaMultiplierSettings(kSettings[index], function () {
doTestScroll(kSettings[index], function () { doTestScroll(kSettings[index], function () {
doTestZoom(kSettings[index], function() { doTestZoom(kSettings[index], function() {
if (++index == kSettings.length) { if (++index == kSettings.length) {
setDeltaMultiplierSettings(kSettings[0]); setDeltaMultiplierSettings(kSettings[0], function() {
doTestZoomedScroll(function() { doTestZoomedScroll(function() {
doTestWholeScroll(function() { doTestWholeScroll(function() {
doTestActionOverride(function() { doTestActionOverride(function() {
finishTests(); finishTests();
});
});
}); });
}); });
}); } else {
} else { doTest();
doTest(); }
} });
}); });
}); });
} }
@ -1805,33 +1833,7 @@ function runTests()
function finishTests() function finishTests()
{ {
SpecialPowers.clearUserPref("general.smoothScroll");
SpecialPowers.clearUserPref("mousewheel.default.action"); SpecialPowers.clearUserPref("mousewheel.default.action");
SpecialPowers.clearUserPref("mousewheel.default.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_shift.action");
SpecialPowers.clearUserPref("mousewheel.with_shift.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_control.action");
SpecialPowers.clearUserPref("mousewheel.with_control.action.override_x");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_z");
winUtils.restoreNormalRefresh(); winUtils.restoreNormalRefresh();

View File

@ -307,7 +307,7 @@ public:
MOZ_ASSERT(aWorkerPrivate); MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();
mResolver->mPromiseProxy->CleanUp(aCx); mResolver->mPromiseProxy->CleanUp();
return true; return true;
} }
}; };
@ -818,7 +818,7 @@ FetchBody<Derived>::RegisterFeature()
MOZ_ASSERT(!mFeature); MOZ_ASSERT(!mFeature);
mFeature = new FetchBodyFeature<Derived>(this); mFeature = new FetchBodyFeature<Derived>(this);
if (!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), mFeature)) { if (!mWorkerPrivate->AddFeature(mFeature)) {
NS_WARNING("Failed to add feature"); NS_WARNING("Failed to add feature");
mFeature = nullptr; mFeature = nullptr;
return false; return false;
@ -835,7 +835,7 @@ FetchBody<Derived>::UnregisterFeature()
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mFeature); MOZ_ASSERT(mFeature);
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), mFeature); mWorkerPrivate->RemoveFeature(mFeature);
mFeature = nullptr; mFeature = nullptr;
} }

View File

@ -141,6 +141,12 @@ public:
, mUnsafeRequest(false) , mUnsafeRequest(false)
, mUseURLCredentials(false) , mUseURLCredentials(false)
{ {
// Normally we strip the fragment from the URL in Request::Constructor.
// If internal code is directly constructing this object they must
// strip the fragment first. Since these should be well formed URLs we
// can use a simple check for a fragment here. The full parser is
// difficult to use off the main thread.
MOZ_ASSERT(mURL.Find(NS_LITERAL_CSTRING("#")) == kNotFound);
} }
already_AddRefed<InternalRequest> Clone(); already_AddRefed<InternalRequest> Clone();

View File

@ -959,8 +959,7 @@ public:
mActor = nullptr; mActor = nullptr;
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
JSContext* cx = mWorkerPrivate->GetJSContext(); mWorkerPrivate->RemoveFeature(this);
mWorkerPrivate->RemoveFeature(cx, this);
} }
private: private:
@ -1412,10 +1411,7 @@ BackgroundFactoryRequestChild::RecvPermissionChallenge(
new WorkerPermissionChallenge(workerPrivate, this, mFactory, new WorkerPermissionChallenge(workerPrivate, this, mFactory,
aPrincipalInfo); aPrincipalInfo);
JSContext* cx = workerPrivate->GetJSContext(); if (NS_WARN_IF(!workerPrivate->AddFeature(challenge))) {
MOZ_ASSERT(cx);
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, challenge))) {
return false; return false;
} }

View File

@ -491,7 +491,7 @@ public:
MOZ_COUNT_DTOR(IDBOpenDBRequest::WorkerFeature); MOZ_COUNT_DTOR(IDBOpenDBRequest::WorkerFeature);
if (mWorkerPrivate) { if (mWorkerPrivate) {
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
} }
} }
@ -572,11 +572,8 @@ IDBOpenDBRequest::CreateForJS(IDBFactory* aFactory,
workerPrivate->AssertIsOnWorkerThread(); workerPrivate->AssertIsOnWorkerThread();
JSContext* cx = workerPrivate->GetJSContext();
MOZ_ASSERT(cx);
nsAutoPtr<WorkerFeature> feature(new WorkerFeature(workerPrivate)); nsAutoPtr<WorkerFeature> feature(new WorkerFeature(workerPrivate));
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, feature))) { if (NS_WARN_IF(!workerPrivate->AddFeature(feature))) {
feature->NoteAddFeatureFailed(); feature->NoteAddFeatureFailed();
return nullptr; return nullptr;
} }

View File

@ -62,7 +62,7 @@ public:
MOZ_COUNT_DTOR(IDBTransaction::WorkerFeature); MOZ_COUNT_DTOR(IDBTransaction::WorkerFeature);
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
} }
private: private:
@ -239,11 +239,8 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
workerPrivate->AssertIsOnWorkerThread(); workerPrivate->AssertIsOnWorkerThread();
JSContext* cx = workerPrivate->GetJSContext();
MOZ_ASSERT(cx);
transaction->mWorkerFeature = new WorkerFeature(workerPrivate, transaction); transaction->mWorkerFeature = new WorkerFeature(workerPrivate, transaction);
MOZ_ALWAYS_TRUE(workerPrivate->AddFeature(cx, transaction->mWorkerFeature)); MOZ_ALWAYS_TRUE(workerPrivate->AddFeature(transaction->mWorkerFeature));
} }
return transaction.forget(); return transaction.forget();

View File

@ -3254,15 +3254,6 @@ ContentChild::RecvEndDragSession(const bool& aDoneDrag,
return true; return true;
} }
bool
ContentChild::RecvTestGraphicsDeviceReset(const uint32_t& aResetReason)
{
#if defined(XP_WIN)
gfxPlatform::GetPlatform()->TestDeviceReset(DeviceResetReason(aResetReason));
#endif
return true;
}
bool bool
ContentChild::RecvPush(const nsCString& aScope, ContentChild::RecvPush(const nsCString& aScope,
const IPC::Principal& aPrincipal) const IPC::Principal& aPrincipal)

View File

@ -610,8 +610,6 @@ public:
virtual bool RecvGamepadUpdate(const GamepadChangeEvent& aGamepadEvent) override; virtual bool RecvGamepadUpdate(const GamepadChangeEvent& aGamepadEvent) override;
virtual bool RecvTestGraphicsDeviceReset(const uint32_t& aResetReason) override;
private: private:
virtual void ActorDestroy(ActorDestroyReason why) override; virtual void ActorDestroy(ActorDestroyReason why) override;

View File

@ -710,12 +710,6 @@ child:
*/ */
async GamepadUpdate(GamepadChangeEvent aGamepadEvent); async GamepadUpdate(GamepadChangeEvent aGamepadEvent);
/**
* Tell the child that for testing purposes, a graphics device reset has
* occurred.
*/
async TestGraphicsDeviceReset(uint32_t aReason);
/** /**
* Notify the child that presentation receiver has been launched with the * Notify the child that presentation receiver has been launched with the
* correspondent iframe. * correspondent iframe.

View File

@ -109,6 +109,7 @@
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "nsDeviceContext.h" #include "nsDeviceContext.h"
#include "FrameLayerBuilder.h"
#define BROWSER_ELEMENT_CHILD_SCRIPT \ #define BROWSER_ELEMENT_CHILD_SCRIPT \
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js") NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
@ -2830,8 +2831,7 @@ TabChild::DidComposite(uint64_t aTransactionId,
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() == MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
LayersBackend::LAYERS_CLIENT); LayersBackend::LAYERS_CLIENT);
ClientLayerManager *manager = ClientLayerManager *manager = mPuppetWidget->GetLayerManager()->AsClientLayerManager();
static_cast<ClientLayerManager*>(mPuppetWidget->GetLayerManager());
manager->DidComposite(aTransactionId, aCompositeStart, aCompositeEnd); manager->DidComposite(aTransactionId, aCompositeStart, aCompositeEnd);
} }
@ -2864,11 +2864,35 @@ TabChild::ClearCachedResources()
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() == MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
LayersBackend::LAYERS_CLIENT); LayersBackend::LAYERS_CLIENT);
ClientLayerManager *manager = ClientLayerManager *manager = mPuppetWidget->GetLayerManager()->AsClientLayerManager();
static_cast<ClientLayerManager*>(mPuppetWidget->GetLayerManager());
manager->ClearCachedResources(); manager->ClearCachedResources();
} }
void
TabChild::InvalidateLayers()
{
MOZ_ASSERT(mPuppetWidget);
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
LayersBackend::LAYERS_CLIENT);
RefPtr<LayerManager> lm = mPuppetWidget->GetLayerManager();
FrameLayerBuilder::InvalidateAllLayers(lm);
}
void
TabChild::CompositorUpdated(const TextureFactoryIdentifier& aNewIdentifier)
{
gfxPlatform::GetPlatform()->UpdateRenderModeIfDeviceReset();
RefPtr<LayerManager> lm = mPuppetWidget->GetLayerManager();
ClientLayerManager* clm = lm->AsClientLayerManager();
mTextureFactoryIdentifier = aNewIdentifier;
clm->UpdateTextureFactoryIdentifier(aNewIdentifier);
FrameLayerBuilder::InvalidateAllLayers(clm);
}
NS_IMETHODIMP NS_IMETHODIMP
TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText) TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText)
{ {

View File

@ -545,6 +545,8 @@ public:
const TimeStamp& aCompositeReqEnd); const TimeStamp& aCompositeReqEnd);
void ClearCachedResources(); void ClearCachedResources();
void InvalidateLayers();
void CompositorUpdated(const TextureFactoryIdentifier& aNewIdentifier);
static inline TabChild* GetFrom(nsIDOMWindow* aWindow) static inline TabChild* GetFrom(nsIDOMWindow* aWindow)
{ {

View File

@ -249,11 +249,25 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment)
VideoSegment::ChunkIterator iter(const_cast<VideoSegment&>(aSegment)); VideoSegment::ChunkIterator iter(const_cast<VideoSegment&>(aSegment));
while (!iter.IsEnded()) { while (!iter.IsEnded()) {
VideoChunk chunk = *iter; VideoChunk chunk = *iter;
RefPtr<layers::Image> image = chunk.mFrame.GetImage(); mTotalFrameDuration += chunk.GetDuration();
mRawSegment.AppendFrame(image.forget(), // Send only the unique video frames for encoding
chunk.GetDuration(), if (mLastFrame != chunk.mFrame) {
chunk.mFrame.GetIntrinsicSize(), RefPtr<layers::Image> image = chunk.mFrame.GetImage();
chunk.mFrame.GetForceBlack()); // Because we may get chunks with a null image (due to input blocking),
// accumulate duration and give it to the next frame that arrives.
// Canonically incorrect - the duration should go to the previous frame
// - but that would require delaying until the next frame arrives.
// Best would be to do like OMXEncoder and pass an effective timestamp
// in with each frame (don't zero mTotalFrameDuration)
if (image) {
mRawSegment.AppendFrame(image.forget(),
mTotalFrameDuration,
chunk.mFrame.GetIntrinsicSize(),
chunk.mFrame.GetForceBlack());
mTotalFrameDuration = 0;
}
}
mLastFrame.TakeFrom(&chunk.mFrame);
iter.Next(); iter.Next();
} }

View File

@ -112,7 +112,9 @@ VP8TrackEncoder::Init(int32_t aWidth, int32_t aHeight, int32_t aDisplayWidth,
config.rc_dropframe_thresh = 0; config.rc_dropframe_thresh = 0;
config.rc_end_usage = VPX_CBR; config.rc_end_usage = VPX_CBR;
config.g_pass = VPX_RC_ONE_PASS; config.g_pass = VPX_RC_ONE_PASS;
config.rc_resize_allowed = 1; // ffmpeg doesn't currently support streams that use resize.
// Therefore, for safety, we should turn it off until it does.
config.rc_resize_allowed = 0;
config.rc_undershoot_pct = 100; config.rc_undershoot_pct = 100;
config.rc_overshoot_pct = 15; config.rc_overshoot_pct = 15;
config.rc_buf_initial_sz = 500; config.rc_buf_initial_sz = 500;

View File

@ -56,7 +56,7 @@ VorbisTrackEncoder::Init(int aChannels, int aSamplingRate)
double quality = mAudioBitrate ? (double)mAudioBitrate/aSamplingRate : double quality = mAudioBitrate ? (double)mAudioBitrate/aSamplingRate :
BASE_QUALITY; BASE_QUALITY;
printf("quality %f \n", quality); VORBISLOG("quality %f", quality);
ret = vorbis_encode_init_vbr(&mVorbisInfo, mChannels, mSamplingRate, ret = vorbis_encode_init_vbr(&mVorbisInfo, mChannels, mSamplingRate,
quality); quality);

View File

@ -347,8 +347,7 @@ MessagePort::Initialize(const nsID& aUUID,
MOZ_ASSERT(!mWorkerFeature); MOZ_ASSERT(!mWorkerFeature);
nsAutoPtr<WorkerFeature> feature(new MessagePortFeature(this)); nsAutoPtr<WorkerFeature> feature(new MessagePortFeature(this));
JSContext* cx = workerPrivate->GetJSContext(); if (NS_WARN_IF(!workerPrivate->AddFeature(feature))) {
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, feature))) {
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
} }
@ -884,8 +883,7 @@ MessagePort::UpdateMustKeepAlive()
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate); MOZ_ASSERT(workerPrivate);
workerPrivate->RemoveFeature(workerPrivate->GetJSContext(), workerPrivate->RemoveFeature(mWorkerFeature);
mWorkerFeature);
mWorkerFeature = nullptr; mWorkerFeature = nullptr;
} }

View File

@ -389,7 +389,7 @@ protected:
{ {
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();
aWorkerPrivate->ModifyBusyCountFromWorker(true); aWorkerPrivate->ModifyBusyCountFromWorker(true);
WorkerRunInternal(aCx, aWorkerPrivate); WorkerRunInternal(aWorkerPrivate);
return true; return true;
} }
@ -401,7 +401,7 @@ protected:
} }
virtual void virtual void
WorkerRunInternal(JSContext* aCx, WorkerPrivate* aWorkerPrivate) = 0; WorkerRunInternal(WorkerPrivate* aWorkerPrivate) = 0;
}; };
// Overrides dispatch and run handlers so we can directly dispatch from main // Overrides dispatch and run handlers so we can directly dispatch from main
@ -419,7 +419,7 @@ public:
{} {}
void void
WorkerRunInternal(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRunInternal(WorkerPrivate* aWorkerPrivate) override
{ {
mNotification->DispatchTrustedEvent(mEventName); mNotification->DispatchTrustedEvent(mEventName);
} }
@ -435,7 +435,7 @@ public:
{} {}
void void
WorkerRunInternal(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRunInternal(WorkerPrivate* aWorkerPrivate) override
{ {
mNotification->ReleaseObject(); mNotification->ReleaseObject();
} }
@ -1364,7 +1364,7 @@ public:
} }
void void
WorkerRunInternal(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRunInternal(WorkerPrivate* aWorkerPrivate) override
{ {
bool doDefaultAction = mNotification->DispatchClickEvent(); bool doDefaultAction = mNotification->DispatchClickEvent();
MOZ_ASSERT_IF(mWorkerPrivate->IsServiceWorker(), !doDefaultAction); MOZ_ASSERT_IF(mWorkerPrivate->IsServiceWorker(), !doDefaultAction);
@ -2080,7 +2080,7 @@ public:
} }
void void
WorkerRunInternal(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRunInternal(WorkerPrivate* aWorkerPrivate) override
{ {
RefPtr<Promise> workerPromise = mPromiseProxy->WorkerPromise(); RefPtr<Promise> workerPromise = mPromiseProxy->WorkerPromise();
@ -2110,7 +2110,7 @@ public:
} }
workerPromise->MaybeResolve(notifications); workerPromise->MaybeResolve(notifications);
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
} }
}; };
@ -2510,8 +2510,7 @@ Notification::RegisterFeature()
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(!mFeature); MOZ_ASSERT(!mFeature);
mFeature = MakeUnique<NotificationFeature>(this); mFeature = MakeUnique<NotificationFeature>(this);
bool added = mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), bool added = mWorkerPrivate->AddFeature(mFeature.get());
mFeature.get());
if (!added) { if (!added) {
mFeature = nullptr; mFeature = nullptr;
} }
@ -2525,8 +2524,7 @@ Notification::UnregisterFeature()
MOZ_ASSERT(mWorkerPrivate); MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mFeature); MOZ_ASSERT(mFeature);
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), mWorkerPrivate->RemoveFeature(mFeature.get());
mFeature.get());
mFeature = nullptr; mFeature = nullptr;
} }

View File

@ -694,7 +694,6 @@ NP_GetValue(void* future, NPPVariable aVariable, void* aValue) {
break; break;
default: default:
return NPERR_INVALID_PARAM; return NPERR_INVALID_PARAM;
break;
} }
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
@ -2206,7 +2205,9 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
return false; return false;
} }
switch (var1->type) { // Cast var1->type from NPVariantType to int to avoid compiler warnings about
// not needing a default case when we have cases for every enum value.
switch (static_cast<int>(var1->type)) {
case NPVariantType_Int32: { case NPVariantType_Int32: {
int32_t result = NPVARIANT_TO_INT32(*var1); int32_t result = NPVARIANT_TO_INT32(*var1);
int32_t expected = NPVARIANT_TO_INT32(*var2); int32_t expected = NPVARIANT_TO_INT32(*var2);
@ -2299,6 +2300,7 @@ compareVariants(NPP instance, const NPVariant* var1, const NPVariant* var2)
default: default:
id->err << "Unknown variant type"; id->err << "Unknown variant type";
success = false; success = false;
MOZ_ASSERT_UNREACHABLE("Unknown variant type?!");
} }
return success; return success;
@ -3981,4 +3983,3 @@ getAudioMuted(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria
BOOLEAN_TO_NPVARIANT(id->audioMuted, *result); BOOLEAN_TO_NPVARIANT(id->audioMuted, *result);
return true; return true;
} }

View File

@ -471,8 +471,7 @@ int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)
case EDGE_BOTTOM: case EDGE_BOTTOM:
return pluginY + pluginHeight; return pluginY + pluginHeight;
} }
MOZ_CRASH("Unexpected RectEdge?!");
return NPTEST_INT32_ERROR;
} }
#ifdef MOZ_X11 #ifdef MOZ_X11

View File

@ -275,7 +275,7 @@ int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)
case EDGE_BOTTOM: case EDGE_BOTTOM:
return w->y + w->height; return w->y + w->height;
} }
return NPTEST_INT32_ERROR; MOZ_CRASH("Unexpected RectEdge?!");
} }
int32_t pluginGetClipRegionRectCount(InstanceData* instanceData) int32_t pluginGetClipRegionRectCount(InstanceData* instanceData)
@ -304,7 +304,7 @@ int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData,
case EDGE_BOTTOM: case EDGE_BOTTOM:
return w->clipRect.bottom + COCOA_TITLEBAR_HEIGHT; return w->clipRect.bottom + COCOA_TITLEBAR_HEIGHT;
} }
return NPTEST_INT32_ERROR; MOZ_CRASH("Unexpected RectEdge?!");
} }
void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error) void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error)

View File

@ -2607,7 +2607,7 @@ Promise::Settle(JS::Handle<JS::Value> aValue, PromiseState aState)
worker->AssertIsOnWorkerThread(); worker->AssertIsOnWorkerThread();
mFeature = new PromiseReportRejectFeature(this); mFeature = new PromiseReportRejectFeature(this);
if (NS_WARN_IF(!worker->AddFeature(worker->GetJSContext(), mFeature))) { if (NS_WARN_IF(!worker->AddFeature(mFeature))) {
// To avoid a false RemoveFeature(). // To avoid a false RemoveFeature().
mFeature = nullptr; mFeature = nullptr;
// Worker is shutting down, report rejection immediately since it is // Worker is shutting down, report rejection immediately since it is
@ -2657,7 +2657,7 @@ Promise::RemoveFeature()
if (mFeature) { if (mFeature) {
workers::WorkerPrivate* worker = GetCurrentThreadWorkerPrivate(); workers::WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker); MOZ_ASSERT(worker);
worker->RemoveFeature(worker->GetJSContext(), mFeature); worker->RemoveFeature(mFeature);
mFeature = nullptr; mFeature = nullptr;
} }
} }
@ -2747,7 +2747,7 @@ public:
(workerPromise->*mFunc)(aCx, value); (workerPromise->*mFunc)(aCx, value);
// Release the Promise because it has been resolved/rejected for sure. // Release the Promise because it has been resolved/rejected for sure.
mPromiseWorkerProxy->CleanUp(aCx); mPromiseWorkerProxy->CleanUp();
return true; return true;
} }
@ -2833,8 +2833,7 @@ PromiseWorkerProxy::AddRefObject()
MOZ_ASSERT(mWorkerPrivate); MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(!mFeatureAdded); MOZ_ASSERT(!mFeatureAdded);
if (!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), if (!mWorkerPrivate->AddFeature(this)) {
this)) {
return false; return false;
} }
@ -2926,14 +2925,14 @@ bool
PromiseWorkerProxy::Notify(JSContext* aCx, Status aStatus) PromiseWorkerProxy::Notify(JSContext* aCx, Status aStatus)
{ {
if (aStatus >= Canceling) { if (aStatus >= Canceling) {
CleanUp(aCx); CleanUp();
} }
return true; return true;
} }
void void
PromiseWorkerProxy::CleanUp(JSContext* aCx) PromiseWorkerProxy::CleanUp()
{ {
// Can't release Mutex while it is still locked, so scope the lock. // Can't release Mutex while it is still locked, so scope the lock.
{ {
@ -2947,13 +2946,12 @@ PromiseWorkerProxy::CleanUp(JSContext* aCx)
MOZ_ASSERT(mWorkerPrivate); MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mWorkerPrivate->GetJSContext() == aCx);
// Release the Promise and remove the PromiseWorkerProxy from the features of // Release the Promise and remove the PromiseWorkerProxy from the features of
// the worker thread since the Promise has been resolved/rejected or the // the worker thread since the Promise has been resolved/rejected or the
// worker thread has been cancelled. // worker thread has been cancelled.
MOZ_ASSERT(mFeatureAdded); MOZ_ASSERT(mFeatureAdded);
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
mFeatureAdded = false; mFeatureAdded = false;
CleanProperties(); CleanProperties();
} }

View File

@ -101,7 +101,7 @@ class WorkerPrivate;
// aWorkerPrivate->AssertIsOnWorkerThread(); // aWorkerPrivate->AssertIsOnWorkerThread();
// RefPtr<Promise> promise = mProxy->WorkerPromise(); // RefPtr<Promise> promise = mProxy->WorkerPromise();
// promise->MaybeResolve(mResult); // promise->MaybeResolve(mResult);
// mProxy->CleanUp(aCx); // mProxy->CleanUp();
// } // }
// //
// Note: If a PromiseWorkerProxy is not cleaned up by a WorkerRunnable - this // Note: If a PromiseWorkerProxy is not cleaned up by a WorkerRunnable - this
@ -154,7 +154,7 @@ public:
// sure this is the last thing you do. // sure this is the last thing you do.
// 1. WorkerPrivate() will no longer return a valid worker. // 1. WorkerPrivate() will no longer return a valid worker.
// 2. WorkerPromise() will crash! // 2. WorkerPromise() will crash!
void CleanUp(JSContext* aCx); void CleanUp();
Mutex& Lock() Mutex& Lock()
{ {

View File

@ -406,7 +406,7 @@ public:
promise->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE); promise->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE);
} }
mProxy->CleanUp(aCx); mProxy->CleanUp();
return true; return true;
} }
private: private:
@ -601,7 +601,7 @@ public:
promise->MaybeReject(NS_ERROR_DOM_PUSH_ABORT_ERR); promise->MaybeReject(NS_ERROR_DOM_PUSH_ABORT_ERR);
} }
mProxy->CleanUp(aCx); mProxy->CleanUp();
return true; return true;
} }
private: private:
@ -872,7 +872,7 @@ public:
promise->MaybeReject(aCx, JS::UndefinedHandleValue); promise->MaybeReject(aCx, JS::UndefinedHandleValue);
} }
mProxy->CleanUp(aCx); mProxy->CleanUp();
return true; return true;
} }

View File

@ -773,6 +773,11 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
} }
} }
// set hasMixedContentObjectSubrequest on this object if necessary
if (aContentType == TYPE_OBJECT_SUBREQUEST) {
rootDoc->SetHasMixedContentObjectSubrequest(true);
}
// If the content is display content, and the pref says display content should be blocked, block it. // If the content is display content, and the pref says display content should be blocked, block it.
if (sBlockMixedDisplay && classification == eMixedDisplay) { if (sBlockMixedDisplay && classification == eMixedDisplay) {
if (allowMixedContent) { if (allowMixedContent) {

View File

@ -911,7 +911,7 @@ DataStoreChangeEventProxy::DataStoreChangeEventProxy(
// We do this to make sure the worker thread won't shut down before the event // We do this to make sure the worker thread won't shut down before the event
// is dispatched to the WorkerStore on the worker thread. // is dispatched to the WorkerStore on the worker thread.
if (!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), this)) { if (!mWorkerPrivate->AddFeature(this)) {
MOZ_ASSERT(false, "cannot add the worker feature!"); MOZ_ASSERT(false, "cannot add the worker feature!");
return; return;
} }
@ -980,7 +980,7 @@ DataStoreChangeEventProxy::Notify(JSContext* aCx, Status aStatus)
// features of the worker thread since the worker thread has been cancelled. // features of the worker thread since the worker thread has been cancelled.
if (aStatus >= Canceling) { if (aStatus >= Canceling) {
mWorkerStore = nullptr; mWorkerStore = nullptr;
mWorkerPrivate->RemoveFeature(aCx, this); mWorkerPrivate->RemoveFeature(this);
mCleanedUp = true; mCleanedUp = true;
} }

View File

@ -1776,7 +1776,7 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
MOZ_ASSERT(!mScriptLoader.mRv.Failed(), "Who failed it and why?"); MOZ_ASSERT(!mScriptLoader.mRv.Failed(), "Who failed it and why?");
mScriptLoader.mRv.MightThrowJSException(); mScriptLoader.mRv.MightThrowJSException();
if (NS_FAILED(loadInfo.mLoadResult)) { if (NS_FAILED(loadInfo.mLoadResult)) {
scriptloader::ReportLoadError(aCx, mScriptLoader.mRv, scriptloader::ReportLoadError(mScriptLoader.mRv,
loadInfo.mLoadResult, loadInfo.mURL); loadInfo.mLoadResult, loadInfo.mURL);
// Top level scripts only! // Top level scripts only!
if (mIsWorkerScript) { if (mIsWorkerScript) {
@ -1897,7 +1897,7 @@ ScriptExecutorRunnable::ShutdownScriptLoader(JSContext* aCx,
} }
} }
aWorkerPrivate->RemoveFeature(aCx, &mScriptLoader); aWorkerPrivate->RemoveFeature(&mScriptLoader);
aWorkerPrivate->StopSyncLoop(mSyncLoopTarget, aResult); aWorkerPrivate->StopSyncLoop(mSyncLoopTarget, aResult);
} }
@ -1933,7 +1933,7 @@ ScriptExecutorRunnable::LogExceptionToConsole(JSContext* aCx,
} }
void void
LoadAllScripts(JSContext* aCx, WorkerPrivate* aWorkerPrivate, LoadAllScripts(WorkerPrivate* aWorkerPrivate,
nsTArray<ScriptLoadInfo>& aLoadInfos, bool aIsMainScript, nsTArray<ScriptLoadInfo>& aLoadInfos, bool aIsMainScript,
WorkerScriptType aWorkerScriptType, ErrorResult& aRv) WorkerScriptType aWorkerScriptType, ErrorResult& aRv)
{ {
@ -1949,7 +1949,7 @@ LoadAllScripts(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
NS_ASSERTION(aLoadInfos.IsEmpty(), "Should have swapped!"); NS_ASSERTION(aLoadInfos.IsEmpty(), "Should have swapped!");
if (!aWorkerPrivate->AddFeature(aCx, loader)) { if (!aWorkerPrivate->AddFeature(loader)) {
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
} }
@ -1957,7 +1957,7 @@ LoadAllScripts(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
if (NS_FAILED(NS_DispatchToMainThread(loader))) { if (NS_FAILED(NS_DispatchToMainThread(loader))) {
NS_ERROR("Failed to dispatch!"); NS_ERROR("Failed to dispatch!");
aWorkerPrivate->RemoveFeature(aCx, loader); aWorkerPrivate->RemoveFeature(loader);
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
} }
@ -2019,7 +2019,7 @@ ChannelFromScriptURLWorkerThread(JSContext* aCx,
return getter->GetResult(); return getter->GetResult();
} }
void ReportLoadError(JSContext* aCx, ErrorResult& aRv, nsresult aLoadResult, void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
const nsAString& aScriptURL) const nsAString& aScriptURL)
{ {
MOZ_ASSERT(!aRv.Failed()); MOZ_ASSERT(!aRv.Failed());
@ -2072,23 +2072,21 @@ void ReportLoadError(JSContext* aCx, ErrorResult& aRv, nsresult aLoadResult,
} }
void void
LoadMainScript(JSContext* aCx, const nsAString& aScriptURL, LoadMainScript(WorkerPrivate* aWorkerPrivate,
const nsAString& aScriptURL,
WorkerScriptType aWorkerScriptType, WorkerScriptType aWorkerScriptType,
ErrorResult& aRv) ErrorResult& aRv)
{ {
WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
NS_ASSERTION(worker, "This should never be null!");
nsTArray<ScriptLoadInfo> loadInfos; nsTArray<ScriptLoadInfo> loadInfos;
ScriptLoadInfo* info = loadInfos.AppendElement(); ScriptLoadInfo* info = loadInfos.AppendElement();
info->mURL = aScriptURL; info->mURL = aScriptURL;
LoadAllScripts(aCx, worker, loadInfos, true, aWorkerScriptType, aRv); LoadAllScripts(aWorkerPrivate, loadInfos, true, aWorkerScriptType, aRv);
} }
void void
Load(JSContext* aCx, WorkerPrivate* aWorkerPrivate, Load(WorkerPrivate* aWorkerPrivate,
const nsTArray<nsString>& aScriptURLs, WorkerScriptType aWorkerScriptType, const nsTArray<nsString>& aScriptURLs, WorkerScriptType aWorkerScriptType,
ErrorResult& aRv) ErrorResult& aRv)
{ {
@ -2110,7 +2108,7 @@ Load(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
loadInfos[index].mURL = aScriptURLs[index]; loadInfos[index].mURL = aScriptURLs[index];
} }
LoadAllScripts(aCx, aWorkerPrivate, loadInfos, false, aWorkerScriptType, aRv); LoadAllScripts(aWorkerPrivate, loadInfos, false, aWorkerScriptType, aRv);
} }
} // namespace scriptloader } // namespace scriptloader

View File

@ -47,15 +47,15 @@ ChannelFromScriptURLWorkerThread(JSContext* aCx,
const nsAString& aScriptURL, const nsAString& aScriptURL,
nsIChannel** aChannel); nsIChannel** aChannel);
void ReportLoadError(JSContext* aCx, ErrorResult& aRv, nsresult aLoadResult, void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
const nsAString& aScriptURL); const nsAString& aScriptURL);
void LoadMainScript(JSContext* aCx, const nsAString& aScriptURL, void LoadMainScript(WorkerPrivate* aWorkerPrivate,
const nsAString& aScriptURL,
WorkerScriptType aWorkerScriptType, WorkerScriptType aWorkerScriptType,
ErrorResult& aRv); ErrorResult& aRv);
void Load(JSContext* aCx, void Load(WorkerPrivate* aWorkerPrivate,
WorkerPrivate* aWorkerPrivate,
const nsTArray<nsString>& aScriptURLs, const nsTArray<nsString>& aScriptURLs,
WorkerScriptType aWorkerScriptType, WorkerScriptType aWorkerScriptType,
mozilla::ErrorResult& aRv); mozilla::ErrorResult& aRv);

View File

@ -94,7 +94,7 @@ class GetRunnable final : public nsRunnable
} else { } else {
promise->MaybeResolve(JS::UndefinedHandleValue); promise->MaybeResolve(JS::UndefinedHandleValue);
} }
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }
}; };
@ -172,7 +172,7 @@ class MatchAllRunnable final : public nsRunnable
} }
promise->MaybeResolve(ret); promise->MaybeResolve(ret);
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }
}; };
@ -246,7 +246,7 @@ public:
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR); promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
} }
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }
}; };
@ -326,7 +326,7 @@ public:
promise->MaybeResolve(JS::NullHandleValue); promise->MaybeResolve(JS::NullHandleValue);
} }
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }

View File

@ -390,8 +390,7 @@ class LifeCycleEventWatcher final : public PromiseNativeHandler,
// the resulting Promise.all will be cycle collected and it will drop its // the resulting Promise.all will be cycle collected and it will drop its
// native handlers (including this object). Instead of waiting for a timeout // native handlers (including this object). Instead of waiting for a timeout
// we report the failure now. // we report the failure now.
JSContext* cx = mWorkerPrivate->GetJSContext(); ReportResult(false);
ReportResult(cx, false);
} }
public: public:
@ -412,7 +411,6 @@ public:
{ {
MOZ_ASSERT(mWorkerPrivate); MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
JSContext* cx = mWorkerPrivate->GetJSContext();
// We need to listen for worker termination in case the event handler // We need to listen for worker termination in case the event handler
// never completes or never resolves the waitUntil promise. There are // never completes or never resolves the waitUntil promise. There are
@ -421,9 +419,9 @@ public:
// case the registration/update promise will be rejected // case the registration/update promise will be rejected
// 2. A new service worker is registered which will terminate the current // 2. A new service worker is registered which will terminate the current
// installing worker. // installing worker.
if (NS_WARN_IF(!mWorkerPrivate->AddFeature(cx, this))) { if (NS_WARN_IF(!mWorkerPrivate->AddFeature(this))) {
NS_WARNING("LifeCycleEventWatcher failed to add feature."); NS_WARNING("LifeCycleEventWatcher failed to add feature.");
ReportResult(cx, false); ReportResult(false);
return false; return false;
} }
@ -438,13 +436,13 @@ public:
} }
MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate); MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate);
ReportResult(aCx, false); ReportResult(false);
return true; return true;
} }
void void
ReportResult(JSContext* aCx, bool aResult) ReportResult(bool aResult)
{ {
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
@ -459,7 +457,7 @@ public:
NS_RUNTIMEABORT("Failed to dispatch life cycle event handler."); NS_RUNTIMEABORT("Failed to dispatch life cycle event handler.");
} }
mWorkerPrivate->RemoveFeature(aCx, this); mWorkerPrivate->RemoveFeature(this);
} }
void void
@ -468,7 +466,7 @@ public:
MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate); MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
ReportResult(aCx, true); ReportResult(true);
} }
void void
@ -477,7 +475,7 @@ public:
MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate); MOZ_ASSERT(GetCurrentThreadWorkerPrivate() == mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
ReportResult(aCx, false); ReportResult(false);
// Note, all WaitUntil() rejections are reported to client consoles // Note, all WaitUntil() rejections are reported to client consoles
// by the WaitUntilHandler in ServiceWorkerEvents. This ensures that // by the WaitUntilHandler in ServiceWorkerEvents. This ensures that
@ -525,7 +523,7 @@ LifecycleEventWorkerRunnable::DispatchLifecycleEvent(JSContext* aCx,
if (waitUntil) { if (waitUntil) {
waitUntil->AppendNativeHandler(watcher); waitUntil->AppendNativeHandler(watcher);
} else { } else {
watcher->ReportResult(aCx, false); watcher->ReportResult(false);
} }
return true; return true;
@ -1044,7 +1042,15 @@ public:
rv = mInterceptedChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri)); rv = mInterceptedChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = uri->GetSpec(mSpec); // Normally we rely on the Request constructor to strip the fragment, but
// when creating the FetchEvent we bypass the constructor. So strip the
// fragment manually here instead. We can't do it later when we create
// the Request because that code executes off the main thread.
nsCOMPtr<nsIURI> uriNoFragment;
rv = uri->CloneIgnoringRef(getter_AddRefs(uriNoFragment));
NS_ENSURE_SUCCESS(rv, rv);
rv = uriNoFragment->GetSpec(mSpec);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
uint32_t loadFlags; uint32_t loadFlags;

View File

@ -333,7 +333,7 @@ public:
promise->MaybeResolve(JS::UndefinedHandleValue); promise->MaybeResolve(JS::UndefinedHandleValue);
} }
mStatus.SuppressException(); mStatus.SuppressException();
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }
@ -498,7 +498,7 @@ public:
promise->MaybeReject(NS_ERROR_DOM_SECURITY_ERR); promise->MaybeReject(NS_ERROR_DOM_SECURITY_ERR);
} }
mPromiseWorkerProxy->CleanUp(aCx); mPromiseWorkerProxy->CleanUp();
return true; return true;
} }
}; };
@ -1070,7 +1070,7 @@ ServiceWorkerRegistrationWorkerThread::InitListener()
worker->AssertIsOnWorkerThread(); worker->AssertIsOnWorkerThread();
mListener = new WorkerListener(worker, this); mListener = new WorkerListener(worker, this);
if (!worker->AddFeature(worker->GetJSContext(), this)) { if (!worker->AddFeature(this)) {
mListener = nullptr; mListener = nullptr;
NS_WARNING("Could not add feature"); NS_WARNING("Could not add feature");
return; return;
@ -1128,7 +1128,7 @@ ServiceWorkerRegistrationWorkerThread::ReleaseListener(Reason aReason)
// be null and we won't reach here. // be null and we won't reach here.
// 2) Otherwise, worker is still around even if we are going away. // 2) Otherwise, worker is still around even if we are going away.
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this); mWorkerPrivate->RemoveFeature(this);
mListener->ClearRegistration(); mListener->ClearRegistration();

View File

@ -63,7 +63,7 @@ public:
} }
// Release the reference on the worker thread. // Release the reference on the worker thread.
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }

View File

@ -504,7 +504,7 @@ private:
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();
ErrorResult rv; ErrorResult rv;
scriptloader::LoadMainScript(aCx, mScriptURL, WorkerScript, rv); scriptloader::LoadMainScript(aWorkerPrivate, mScriptURL, WorkerScript, rv);
rv.WouldReportJSException(); rv.WouldReportJSException();
// Explicitly ignore NS_BINDING_ABORTED on rv. Or more precisely, still // Explicitly ignore NS_BINDING_ABORTED on rv. Or more precisely, still
// return false and don't SetWorkerScriptExecutedSuccessfully() in that // return false and don't SetWorkerScriptExecutedSuccessfully() in that
@ -563,7 +563,8 @@ private:
ErrorResult rv; ErrorResult rv;
JSAutoCompartment ac(aCx, global); JSAutoCompartment ac(aCx, global);
scriptloader::LoadMainScript(aCx, mScriptURL, DebuggerScript, rv); scriptloader::LoadMainScript(aWorkerPrivate, mScriptURL,
DebuggerScript, rv);
rv.WouldReportJSException(); rv.WouldReportJSException();
// Explicitly ignore NS_BINDING_ABORTED on rv. Or more precisely, still // Explicitly ignore NS_BINDING_ABORTED on rv. Or more precisely, still
// return false and don't SetWorkerScriptExecutedSuccessfully() in that // return false and don't SetWorkerScriptExecutedSuccessfully() in that
@ -574,7 +575,7 @@ private:
return false; return false;
} }
// Make sure to propagate exceptions from rv onto aCx, so that our PostRun // Make sure to propagate exceptions from rv onto aCx, so that our PostRun
// can report it. We do this for alll failures on rv, because now we're // can report it. We do this for all failures on rv, because now we're
// using rv to track all the state we care about. // using rv to track all the state we care about.
if (rv.MaybeSetPendingException(aCx)) { if (rv.MaybeSetPendingException(aCx)) {
return false; return false;
@ -607,9 +608,6 @@ private:
virtual bool virtual bool
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{ {
JS::Rooted<JSObject*> target(aCx, JS::CurrentGlobalOrNull(aCx));
NS_ASSERTION(target, "This must never be null!");
aWorkerPrivate->CloseHandlerStarted(); aWorkerPrivate->CloseHandlerStarted();
WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope(); WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope();
@ -903,7 +901,7 @@ private:
virtual bool virtual bool
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{ {
return aWorkerPrivate->FreezeInternal(aCx); return aWorkerPrivate->FreezeInternal();
} }
}; };
@ -918,7 +916,7 @@ private:
virtual bool virtual bool
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{ {
return aWorkerPrivate->ThawInternal(aCx); return aWorkerPrivate->ThawInternal();
} }
}; };
@ -4031,7 +4029,7 @@ WorkerPrivate::Constructor(JSContext* aCx,
aWorkerType, stackLoadInfo.ptr()); aWorkerType, stackLoadInfo.ptr());
aRv.MightThrowJSException(); aRv.MightThrowJSException();
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
scriptloader::ReportLoadError(aCx, aRv, rv, aScriptURL); scriptloader::ReportLoadError(aRv, rv, aScriptURL);
return nullptr; return nullptr;
} }
@ -5000,7 +4998,7 @@ WorkerPrivate::RemainingRunTimeMS() const
} }
bool bool
WorkerPrivate::FreezeInternal(JSContext* aCx) WorkerPrivate::FreezeInternal()
{ {
AssertIsOnWorkerThread(); AssertIsOnWorkerThread();
@ -5011,7 +5009,7 @@ WorkerPrivate::FreezeInternal(JSContext* aCx)
} }
bool bool
WorkerPrivate::ThawInternal(JSContext* aCx) WorkerPrivate::ThawInternal()
{ {
AssertIsOnWorkerThread(); AssertIsOnWorkerThread();
@ -5102,7 +5100,7 @@ WorkerPrivate::RemoveChildWorker(JSContext* aCx, ParentType* aChildWorker)
} }
bool bool
WorkerPrivate::AddFeature(JSContext* aCx, WorkerFeature* aFeature) WorkerPrivate::AddFeature(WorkerFeature* aFeature)
{ {
AssertIsOnWorkerThread(); AssertIsOnWorkerThread();
@ -5125,7 +5123,7 @@ WorkerPrivate::AddFeature(JSContext* aCx, WorkerFeature* aFeature)
} }
void void
WorkerPrivate::RemoveFeature(JSContext* aCx, WorkerFeature* aFeature) WorkerPrivate::RemoveFeature(WorkerFeature* aFeature)
{ {
AssertIsOnWorkerThread(); AssertIsOnWorkerThread();

View File

@ -1053,10 +1053,10 @@ public:
} }
bool bool
FreezeInternal(JSContext* aCx); FreezeInternal();
bool bool
ThawInternal(JSContext* aCx); ThawInternal();
void void
TraceTimeouts(const TraceCallbacks& aCallbacks, void* aClosure) const; TraceTimeouts(const TraceCallbacks& aCallbacks, void* aClosure) const;
@ -1071,10 +1071,10 @@ public:
RemoveChildWorker(JSContext* aCx, ParentType* aChildWorker); RemoveChildWorker(JSContext* aCx, ParentType* aChildWorker);
bool bool
AddFeature(JSContext* aCx, WorkerFeature* aFeature); AddFeature(WorkerFeature* aFeature);
void void
RemoveFeature(JSContext* aCx, WorkerFeature* aFeature); RemoveFeature(WorkerFeature* aFeature);
void void
NotifyFeatures(JSContext* aCx, Status aStatus); NotifyFeatures(JSContext* aCx, Status aStatus);

View File

@ -213,12 +213,11 @@ WorkerGlobalScope::SetOnerror(OnErrorEventHandlerNonNull* aHandler)
} }
void void
WorkerGlobalScope::ImportScripts(JSContext* aCx, WorkerGlobalScope::ImportScripts(const Sequence<nsString>& aScriptURLs,
const Sequence<nsString>& aScriptURLs,
ErrorResult& aRv) ErrorResult& aRv)
{ {
mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->AssertIsOnWorkerThread();
scriptloader::Load(aCx, mWorkerPrivate, aScriptURLs, WorkerScript, aRv); scriptloader::Load(mWorkerPrivate, aScriptURLs, WorkerScript, aRv);
} }
int32_t int32_t
@ -560,7 +559,7 @@ public:
promise->MaybeResolve(JS::UndefinedHandleValue); promise->MaybeResolve(JS::UndefinedHandleValue);
// Release the reference on the worker thread. // Release the reference on the worker thread.
mPromiseProxy->CleanUp(aCx); mPromiseProxy->CleanUp();
return true; return true;
} }
@ -887,7 +886,7 @@ WorkerDebuggerGlobalScope::LoadSubScript(JSContext* aCx,
nsTArray<nsString> urls; nsTArray<nsString> urls;
urls.AppendElement(aURL); urls.AppendElement(aURL);
scriptloader::Load(aCx, mWorkerPrivate, urls, DebuggerScript, aRv); scriptloader::Load(mWorkerPrivate, urls, DebuggerScript, aRv);
} }
void void

View File

@ -105,8 +105,7 @@ public:
SetOnerror(OnErrorEventHandlerNonNull* aHandler); SetOnerror(OnErrorEventHandlerNonNull* aHandler);
void void
ImportScripts(JSContext* aCx, const Sequence<nsString>& aScriptURLs, ImportScripts(const Sequence<nsString>& aScriptURLs, ErrorResult& aRv);
ErrorResult& aRv);
int32_t int32_t
SetTimeout(JSContext* aCx, Function& aHandler, const int32_t aTimeout, SetTimeout(JSContext* aCx, Function& aHandler, const int32_t aTimeout,

View File

@ -13,6 +13,8 @@
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
#include "jsfriendapi.h" #include "jsfriendapi.h"
#include "js/TracingAPI.h"
#include "js/GCPolicyAPI.h"
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/dom/Exceptions.h" #include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/File.h" #include "mozilla/dom/File.h"
@ -30,11 +32,19 @@
#include "WorkerRunnable.h" #include "WorkerRunnable.h"
#include "XMLHttpRequestUpload.h" #include "XMLHttpRequestUpload.h"
#include "mozilla/UniquePtr.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
USING_WORKERS_NAMESPACE USING_WORKERS_NAMESPACE
/* static */ void
XMLHttpRequest::StateData::trace(JSTracer *aTrc)
{
JS::TraceEdge(aTrc, &mResponse, "XMLHttpRequest::StateData::mResponse");
}
/** /**
* XMLHttpRequest in workers * XMLHttpRequest in workers
* *
@ -559,27 +569,6 @@ class EventRunnable final : public MainThreadProxyRunnable
JS::PersistentRooted<JSObject*> mScopeObj; JS::PersistentRooted<JSObject*> mScopeObj;
public: public:
class MOZ_RAII StateDataAutoRooter : private JS::CustomAutoRooter
{
XMLHttpRequest::StateData* mStateData;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit StateDataAutoRooter(JSContext* aCx, XMLHttpRequest::StateData* aData
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: CustomAutoRooter(aCx), mStateData(aData)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
private:
virtual void trace(JSTracer* aTrc)
{
JS::TraceEdge(aTrc, &mStateData->mResponse,
"XMLHttpRequest::StateData::mResponse");
}
};
EventRunnable(Proxy* aProxy, bool aUploadEvent, const nsString& aType, EventRunnable(Proxy* aProxy, bool aUploadEvent, const nsString& aType,
bool aLengthComputable, uint64_t aLoaded, uint64_t aTotal, bool aLengthComputable, uint64_t aLoaded, uint64_t aTotal,
JS::Handle<JSObject*> aScopeObj) JS::Handle<JSObject*> aScopeObj)
@ -1347,8 +1336,7 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
} }
} }
nsAutoPtr<XMLHttpRequest::StateData> state(new XMLHttpRequest::StateData()); JS::Rooted<UniquePtr<XMLHttpRequest::StateData>> state(aCx, new XMLHttpRequest::StateData());
StateDataAutoRooter rooter(aCx, state);
state->mResponseTextResult = mResponseTextResult; state->mResponseTextResult = mResponseTextResult;
state->mResponseText = mResponseText; state->mResponseText = mResponseText;
@ -1391,7 +1379,7 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
state->mResponseURL = mResponseURL; state->mResponseURL = mResponseURL;
XMLHttpRequest* xhr = mProxy->mXMLHttpRequestPrivate; XMLHttpRequest* xhr = mProxy->mXMLHttpRequestPrivate;
xhr->UpdateState(*state, mUseCachedArrayBufferResponse); xhr->UpdateState(*state.get(), mUseCachedArrayBufferResponse);
if (mUploadEvent && !xhr->GetUploadObjectNoCreate()) { if (mUploadEvent && !xhr->GetUploadObjectNoCreate()) {
return true; return true;
@ -1726,9 +1714,7 @@ XMLHttpRequest::MaybePin(ErrorResult& aRv)
return; return;
} }
JSContext* cx = GetCurrentThreadJSContext(); if (!mWorkerPrivate->AddFeature(this)) {
if (!mWorkerPrivate->AddFeature(cx, this)) {
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
} }
@ -1846,9 +1832,7 @@ XMLHttpRequest::Unpin()
MOZ_ASSERT(mRooted, "Mismatched calls to Unpin!"); MOZ_ASSERT(mRooted, "Mismatched calls to Unpin!");
JSContext* cx = GetCurrentThreadJSContext(); mWorkerPrivate->RemoveFeature(this);
mWorkerPrivate->RemoveFeature(cx, this);
mRooted = false; mRooted = false;

View File

@ -50,6 +50,8 @@ public:
mResponseTextResult(NS_OK), mStatusResult(NS_OK), mResponseTextResult(NS_OK), mStatusResult(NS_OK),
mResponseResult(NS_OK) mResponseResult(NS_OK)
{ } { }
void trace(JSTracer* trc);
}; };
private: private:

View File

@ -20,7 +20,23 @@
function start() { function start() {
return navigator.serviceWorker.register("xslt_worker.js", return navigator.serviceWorker.register("xslt_worker.js",
{ scope: "./" }) { scope: "./" })
.then((swr) => registration = swr); .then((swr) => {
registration = swr;
// Ensure the registration is active before continuing
var worker = registration.installing;
return new Promise((resolve) => {
if (worker.state === 'activated') {
resolve();
return;
}
worker.addEventListener('statechange', () => {
if (worker.state === 'activated') {
resolve();
}
});
});
});
} }
function unregister() { function unregister() {

View File

@ -32,7 +32,7 @@ namespace gl {
class GLXLibrary class GLXLibrary
{ {
public: public:
GLXLibrary() MOZ_CONSTEXPR GLXLibrary()
: xDestroyContextInternal(nullptr) : xDestroyContextInternal(nullptr)
, xMakeCurrentInternal(nullptr) , xMakeCurrentInternal(nullptr)
, xGetCurrentContextInternal(nullptr) , xGetCurrentContextInternal(nullptr)

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */ /* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
@ -8,7 +8,7 @@
#define HEAPCOPYOFSTACKARRAY_H_ #define HEAPCOPYOFSTACKARRAY_H_
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Scoped.h" #include "mozilla/UniquePtr.h"
#include <string.h> #include <string.h>
@ -25,12 +25,12 @@ public:
template<size_t N> template<size_t N>
MOZ_IMPLICIT HeapCopyOfStackArray(ElemType (&array)[N]) MOZ_IMPLICIT HeapCopyOfStackArray(ElemType (&array)[N])
: mArrayLength(N) : mArrayLength(N)
, mArrayData(new ElemType[N]) , mArrayData(MakeUnique<ElemType[]>(N))
{ {
memcpy(mArrayData, &array[0], N * sizeof(ElemType)); memcpy(mArrayData.get(), &array[0], N * sizeof(ElemType));
} }
ElemType* Data() const { return mArrayData; } ElemType* Data() const { return mArrayData.get(); }
size_t ArrayLength() const { return mArrayLength; } size_t ArrayLength() const { return mArrayLength; }
size_t ByteLength() const { return mArrayLength * sizeof(ElemType); } size_t ByteLength() const { return mArrayLength * sizeof(ElemType); }
@ -39,7 +39,7 @@ private:
HeapCopyOfStackArray(const HeapCopyOfStackArray&) = delete; HeapCopyOfStackArray(const HeapCopyOfStackArray&) = delete;
const size_t mArrayLength; const size_t mArrayLength;
ScopedDeletePtr<ElemType> const mArrayData; UniquePtr<ElemType[]> const mArrayData;
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -1,3 +1,3 @@
This directory contains the Graphite2 library release 1.3.5 from This directory contains the Graphite2 library release 1.3.6 from
https://github.com/silnrsi/graphite/releases/download/1.3.5/graphite2-minimal-1.3.5.tgz https://github.com/silnrsi/graphite/releases/download/1.3.6/graphite-minimal-1.3.6.tgz
See gfx/graphite2/moz-gr-update.sh for update procedure. See ./gfx/graphite2/moz-gr-update.sh for update procedure.

View File

@ -30,7 +30,7 @@
#define GR2_VERSION_MAJOR 1 #define GR2_VERSION_MAJOR 1
#define GR2_VERSION_MINOR 3 #define GR2_VERSION_MINOR 3
#define GR2_VERSION_BUGFIX 5 #define GR2_VERSION_BUGFIX 6
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

Some files were not shown because too many files have changed in this diff Show More