зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to m-c. a=merge
This commit is contained in:
Коммит
792273e467
|
@ -160,14 +160,14 @@ this.Utils = { // jshint ignore:line
|
|||
},
|
||||
|
||||
get AllMessageManagers() {
|
||||
let messageManagers = [];
|
||||
let messageManagers = new Set();
|
||||
|
||||
function collectLeafMessageManagers(mm) {
|
||||
for (let i = 0; i < mm.childCount; i++) {
|
||||
let childMM = mm.getChildAt(i);
|
||||
|
||||
if ('sendAsyncMessage' in childMM) {
|
||||
messageManagers.push(childMM);
|
||||
messageManagers.add(childMM);
|
||||
} else {
|
||||
collectLeafMessageManagers(childMM);
|
||||
}
|
||||
|
@ -179,12 +179,19 @@ this.Utils = { // jshint ignore:line
|
|||
let document = this.CurrentContentDoc;
|
||||
|
||||
if (document) {
|
||||
if (document.location.host === 'b2g') {
|
||||
// The document is a b2g app chrome (ie. Mulet).
|
||||
let contentBrowser = this.win.content.shell.contentBrowser;
|
||||
messageManagers.add(this.getMessageManager(contentBrowser));
|
||||
document = contentBrowser.contentDocument;
|
||||
}
|
||||
|
||||
let remoteframes = document.querySelectorAll('iframe');
|
||||
|
||||
for (let i = 0; i < remoteframes.length; ++i) {
|
||||
let mm = this.getMessageManager(remoteframes[i]);
|
||||
if (mm) {
|
||||
messageManagers.push(mm);
|
||||
messageManagers.add(mm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
|||
XPCOMUtils.defineLazyModuleGetter(this, 'States',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
Logger.debug('content-script.js');
|
||||
Logger.info('content-script.js', content.document.location);
|
||||
|
||||
let eventManager = null;
|
||||
let contentControl = null;
|
||||
|
|
|
@ -12,6 +12,7 @@ ADDONS = $(patsubst $(ADDONSRC)/%/package.json,$(TESTADDONS)/%.xpi,$(wildcard $(
|
|||
INSTALL_TARGETS += test_addons
|
||||
test_addons_FILES = $(ADDONS)
|
||||
test_addons_DEST = $(TESTROOT)
|
||||
test_addons_TARGET := misc
|
||||
|
||||
sinclude $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
# 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/.
|
||||
|
||||
HAS_MISC_RULE = True
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||
JETPACK_PACKAGE_MANIFESTS += ['source/test/jetpack-package.ini']
|
||||
JETPACK_ADDON_MANIFESTS += ['source/test/addons/jetpack-addon.ini']
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
"unpack": "True"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
"unpack": "True"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"filename": "clang.tar.bz2"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "gcc.tar.xz"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"filename": "clang.tar.bz2"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -1108,14 +1108,14 @@ toolbarpaletteitem[dragover] {
|
|||
|
||||
#customization-palette:not([hidden]) {
|
||||
display: block;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
overflow: auto;
|
||||
min-height: 3em;
|
||||
}
|
||||
|
||||
#customization-footer-spacer,
|
||||
#customization-spacer {
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
#customization-footer {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "gcc.tar.xz"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "gcc.tar.xz"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"filename": "clang.tar.bz2"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"size": 166506,
|
||||
"digest": "f3c214fd571f21d64937584645212f8d7c2d12c9016be613bd2bc9cecd80b3d52a741423cc1ca69bd85fb924c3d0572c85a1734d12db1616df37abcc397e9252",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
.html-editor-inner {
|
||||
border: solid .1px;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
|
||||
/* Keep the editor away from the markup view floating scrollbars */
|
||||
-moz-margin-end: 12px;
|
||||
|
|
|
@ -57,7 +57,7 @@ body {
|
|||
min-width: 0;
|
||||
color: #000000;
|
||||
opacity: 1;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
#filter-input:-moz-placeholder {
|
||||
|
@ -193,7 +193,7 @@ li {
|
|||
|
||||
.pref-value {
|
||||
color: rgba(0,0,0,0.5);
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
border: none;
|
||||
-moz-appearance: none;
|
||||
background-image: none;
|
||||
|
@ -227,7 +227,7 @@ li {
|
|||
}
|
||||
|
||||
#new-pref-value-boolean {
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
/* Disable newPref dialog spinbuttons, use custom version from Android */
|
||||
|
@ -239,7 +239,7 @@ li {
|
|||
#new-pref-container .pref-button.toggle {
|
||||
display: inline-block;
|
||||
opacity: 1;
|
||||
flex: 0 1 main-size;
|
||||
flex: 0 1 auto;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ li {
|
|||
#new-pref-container .pref-button.create {
|
||||
display: inline-block;
|
||||
opacity: 1;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.pref-item-line {
|
||||
|
|
|
@ -255,7 +255,7 @@ panelview:not([mainview]) .toolbarbutton-text,
|
|||
|
||||
#PanelUI-contents {
|
||||
display: block;
|
||||
flex: 1 0 main-size;
|
||||
flex: 1 0 auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: .5em 0;
|
||||
|
|
|
@ -124,7 +124,7 @@ a {
|
|||
|
||||
.message-flex-body > .message-body {
|
||||
display: block;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ a {
|
|||
}
|
||||
|
||||
.message[category=network]:not(.navigation-marker) .url {
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
/* Make sure the URL is very small initially, let flex change width as needed. */
|
||||
width: 100px;
|
||||
min-width: 5em;
|
||||
|
@ -457,7 +457,7 @@ a {
|
|||
|
||||
.stacktrace .function {
|
||||
display: block;
|
||||
flex: 1 1 main-size;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.cm-s-mozilla a[class] {
|
||||
|
|
|
@ -161,6 +161,7 @@ MOZ_PATH_PROGS(AS, "${target_alias}-as" "${target}-as", :)
|
|||
AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", :)
|
||||
AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", :)
|
||||
AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", :)
|
||||
AC_CHECK_PROGS(OTOOL, "${target_alias}-otool" "${target}-otool", :)
|
||||
AC_DEFINE(CROSS_COMPILE)
|
||||
CROSS_COMPILE=1
|
||||
|
||||
|
|
|
@ -42,12 +42,13 @@ if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "x86_64"; then
|
|||
AS=$CC
|
||||
LD=ld
|
||||
STRIP="strip"
|
||||
OTOOL="otool"
|
||||
|
||||
# Each per-CPU build should be entirely oblivious to the fact that a
|
||||
# universal binary will be produced. The exception is packager.mk, which
|
||||
# needs to know to look for universal bits when building the .dmg.
|
||||
UNIVERSAL_BINARY=1
|
||||
|
||||
export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP
|
||||
export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP OTOOL
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -6,6 +6,7 @@ import sys
|
|||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
from buildconfig import substs
|
||||
|
||||
'''
|
||||
Scans the given directories for binaries referencing the AddressSanitizer
|
||||
|
@ -28,7 +29,7 @@ def scan_directory(path):
|
|||
continue
|
||||
|
||||
try:
|
||||
otoolOut = subprocess.check_output(['otool', '-L', filename])
|
||||
otoolOut = subprocess.check_output([substs['OTOOL'], '-L', filename])
|
||||
except:
|
||||
# Errors are expected on non-mach executables, ignore them and continue
|
||||
continue
|
||||
|
|
|
@ -48,6 +48,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
HOST_CFLAGS += -DUNICODE -D_UNICODE
|
||||
|
||||
ifndef JS_STANDALONE
|
||||
ifndef MOZ_PROFILE_USE
|
||||
# Generate a new buildid every time we "export" in config... that's only
|
||||
# supposed to be once per-build!
|
||||
export::
|
||||
|
@ -57,6 +58,7 @@ else
|
|||
$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid > buildid
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef WRAP_SYSTEM_INCLUDES
|
||||
export-preqs = \
|
||||
|
@ -106,7 +108,7 @@ GARBAGE_DIRS += stl_wrappers
|
|||
endif
|
||||
|
||||
GARBAGE += \
|
||||
$(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES) buildid $(srcdir)/*.pyc *.pyc
|
||||
$(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES) $(srcdir)/*.pyc *.pyc
|
||||
|
||||
FORCE:
|
||||
|
||||
|
|
|
@ -370,6 +370,7 @@ else
|
|||
AC_CHECK_PROGS(LD, ld, :)
|
||||
AC_CHECK_PROGS(STRIP, strip, :)
|
||||
AC_CHECK_PROGS(WINDRES, windres, :)
|
||||
AC_CHECK_PROGS(OTOOL, otool, :)
|
||||
if test -z "$HOST_CC"; then
|
||||
HOST_CC="$CC"
|
||||
fi
|
||||
|
@ -7173,12 +7174,12 @@ elif test -n "$MOZ_REPLACE_MALLOC"; then
|
|||
dnl - classic info only (for OSX < 10.6)
|
||||
dnl - dyld info only
|
||||
dnl - both
|
||||
if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
|
||||
if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
|
||||
_CLASSIC_INFO=
|
||||
else
|
||||
_CLASSIC_INFO=1
|
||||
fi
|
||||
if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
|
||||
if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
|
||||
_DYLD_INFO=1
|
||||
else
|
||||
_DYLD_INFO=
|
||||
|
|
|
@ -125,7 +125,7 @@ PostMessageReadStructuredClone(JSContext* cx,
|
|||
{
|
||||
nsRefPtr<File> blob = new File(scInfo->mPort->GetParentObject(),
|
||||
blobImpl);
|
||||
if (!WrapNewBindingObject(cx, blob, &val)) {
|
||||
if (!GetOrCreateDOMReflector(cx, blob, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2056,7 +2056,7 @@ Navigator::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
|||
nsISupports* existingObject = mCachedResolveResults.GetWeak(name);
|
||||
if (existingObject) {
|
||||
// We know all of our WebIDL objects here are wrappercached, so just go
|
||||
// ahead and WrapObject() them. We can't use WrapNewBindingObject,
|
||||
// ahead and WrapObject() them. We can't use GetOrCreateDOMReflector,
|
||||
// because we don't have the concrete type.
|
||||
JS::Rooted<JS::Value> wrapped(aCx);
|
||||
if (!dom::WrapObject(aCx, existingObject, &wrapped)) {
|
||||
|
|
|
@ -6041,7 +6041,7 @@ nsContentUtils::CreateBlobBuffer(JSContext* aCx,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!WrapNewBindingObject(aCx, blob, aBlob)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, blob, aBlob)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -7912,7 +7912,7 @@ PostMessageReadStructuredClone(JSContext* cx,
|
|||
JS::Rooted<JS::Value> val(cx);
|
||||
{
|
||||
nsRefPtr<File> blob = new File(scInfo->window, blobImpl);
|
||||
if (!WrapNewBindingObject(cx, blob, &val)) {
|
||||
if (!GetOrCreateDOMReflector(cx, blob, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -11071,6 +11071,10 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
|||
nsresult rv;
|
||||
AutoJSContext cx;
|
||||
|
||||
if (Preferences::GetBool("dom.always_stop_slow_scripts")) {
|
||||
return KillSlowScript;
|
||||
}
|
||||
|
||||
// If it isn't safe to run script, then it isn't safe to bring up the prompt
|
||||
// (since that spins the event loop). In that (rare) case, we just kill the
|
||||
// script and report a warning.
|
||||
|
@ -14030,7 +14034,7 @@ nsGlobalWindow::GetConsole(JSContext* aCx,
|
|||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
if (!WrapNewBindingObject(aCx, console, aConsole)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, console, aConsole)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ nsJSUtils::GetScopeChainForElement(JSContext* aCx,
|
|||
{
|
||||
for (nsINode* cur = aElement; cur; cur = cur->GetScopeChainParent()) {
|
||||
JS::RootedValue val(aCx);
|
||||
if (!WrapNewBindingObject(aCx, cur, &val)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, cur, &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1014,7 +1014,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx,
|
|||
return;
|
||||
}
|
||||
|
||||
WrapNewBindingObject(aCx, mResponseBlob, aResponse);
|
||||
GetOrCreateDOMReflector(aCx, mResponseBlob, aResponse);
|
||||
return;
|
||||
}
|
||||
case XML_HTTP_RESPONSE_TYPE_DOCUMENT:
|
||||
|
|
|
@ -2533,7 +2533,7 @@ ConvertExceptionToPromise(JSContext* cx,
|
|||
return false;
|
||||
}
|
||||
|
||||
return WrapNewBindingObject(cx, promise, rval);
|
||||
return GetOrCreateDOMReflector(cx, promise, rval);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -855,18 +855,25 @@ MaybeWrapValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
|
|||
return MaybeWrapObjectValue(cx, rval);
|
||||
}
|
||||
|
||||
// Create a JSObject wrapping "value", if there isn't one already, and store it
|
||||
// in rval. "value" must be a concrete class that implements a
|
||||
// GetWrapperPreserveColor() which can return its existing wrapper, if any, and
|
||||
// a WrapObject() which will try to create a wrapper. Typically, this is done by
|
||||
// having "value" inherit from nsWrapperCache.
|
||||
//
|
||||
// The value stored in rval will be ready to be exposed to whatever JS
|
||||
// is running on cx right now. In particular, it will be in the
|
||||
// compartment of cx, and outerized as needed.
|
||||
namespace binding_detail {
|
||||
enum GetOrCreateReflectorWrapBehavior {
|
||||
eWrapIntoContextCompartment,
|
||||
eDontWrapIntoContextCompartment
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct TypeNeedsOuterization
|
||||
{
|
||||
// We only need to outerize Window objects, so anything inheriting from
|
||||
// nsGlobalWindow (which inherits from EventTarget itself).
|
||||
static const bool value =
|
||||
IsBaseOf<nsGlobalWindow, T>::value || IsSame<EventTarget, T>::value;
|
||||
};
|
||||
|
||||
template <class T, GetOrCreateReflectorWrapBehavior wrapBehavior>
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
WrapNewBindingObject(JSContext* cx, T* value, JS::MutableHandle<JS::Value> rval)
|
||||
DoGetOrCreateDOMReflector(JSContext* cx, T* value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
MOZ_ASSERT(value);
|
||||
JSObject* obj = value->GetWrapperPreserveColor();
|
||||
|
@ -910,14 +917,53 @@ WrapNewBindingObject(JSContext* cx, T* value, JS::MutableHandle<JS::Value> rval)
|
|||
bool sameCompartment =
|
||||
js::GetObjectCompartment(obj) == js::GetContextCompartment(cx);
|
||||
if (sameCompartment && couldBeDOMBinding) {
|
||||
// We only need to outerize Window objects, so anything inheriting from
|
||||
// nsGlobalWindow (which inherits from EventTarget itself).
|
||||
return IsBaseOf<nsGlobalWindow, T>::value || IsSame<EventTarget, T>::value ?
|
||||
TryToOuterize(cx, rval) : true;
|
||||
return TypeNeedsOuterization<T>::value ? TryToOuterize(cx, rval) : true;
|
||||
}
|
||||
|
||||
if (wrapBehavior == eDontWrapIntoContextCompartment) {
|
||||
if (TypeNeedsOuterization<T>::value) {
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
return TryToOuterize(cx, rval);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return JS_WrapValue(cx, rval);
|
||||
}
|
||||
} // namespace binding_detail
|
||||
|
||||
// Create a JSObject wrapping "value", if there isn't one already, and store it
|
||||
// in rval. "value" must be a concrete class that implements a
|
||||
// GetWrapperPreserveColor() which can return its existing wrapper, if any, and
|
||||
// a WrapObject() which will try to create a wrapper. Typically, this is done by
|
||||
// having "value" inherit from nsWrapperCache.
|
||||
//
|
||||
// The value stored in rval will be ready to be exposed to whatever JS
|
||||
// is running on cx right now. In particular, it will be in the
|
||||
// compartment of cx, and outerized as needed.
|
||||
template <class T>
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
GetOrCreateDOMReflector(JSContext* cx, T* value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
using namespace binding_detail;
|
||||
return DoGetOrCreateDOMReflector<T, eWrapIntoContextCompartment>(cx, value,
|
||||
rval);
|
||||
}
|
||||
|
||||
// Like GetOrCreateDOMReflector but doesn't wrap into the context compartment,
|
||||
// and hence does not actually require cx to be in a compartment.
|
||||
template <class T>
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
GetOrCreateDOMReflectorNoWrap(JSContext* cx, T* value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
using namespace binding_detail;
|
||||
return DoGetOrCreateDOMReflector<T, eDontWrapIntoContextCompartment>(cx,
|
||||
value,
|
||||
rval);
|
||||
}
|
||||
|
||||
// Create a JSObject wrapping "value", for cases when "value" is a
|
||||
// non-wrapper-cached object using WebIDL bindings. "value" must implement a
|
||||
|
@ -1279,8 +1325,8 @@ VariantToJsval(JSContext* aCx, nsIVariant* aVariant,
|
|||
|
||||
// Wrap an object "p" which is not using WebIDL bindings yet. This _will_
|
||||
// actually work on WebIDL binding objects that are wrappercached, but will be
|
||||
// much slower than WrapNewBindingObject. "cache" must either be null or be the
|
||||
// nsWrapperCache for "p".
|
||||
// much slower than GetOrCreateDOMReflector. "cache" must either be null or be
|
||||
// the nsWrapperCache for "p".
|
||||
template<class T>
|
||||
inline bool
|
||||
WrapObject(JSContext* cx, T* p, nsWrapperCache* cache, const nsIID* iid,
|
||||
|
@ -1583,44 +1629,76 @@ WrapCallThisObject<JS::Rooted<JSObject*>>(JSContext* cx,
|
|||
return obj;
|
||||
}
|
||||
|
||||
// Helper for calling WrapNewBindingObject with smart pointers
|
||||
// Helper for calling GetOrCreateDOMReflector with smart pointers
|
||||
// (nsAutoPtr/nsRefPtr/nsCOMPtr) or references.
|
||||
template <class T, bool isSmartPtr=HasgetMember<T>::Value>
|
||||
struct WrapNewBindingObjectHelper
|
||||
struct GetOrCreateDOMReflectorHelper
|
||||
{
|
||||
static inline bool Wrap(JSContext* cx, const T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
static inline bool GetOrCreate(JSContext* cx, const T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return WrapNewBindingObject(cx, value.get(), rval);
|
||||
return GetOrCreateDOMReflector(cx, value.get(), rval);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct WrapNewBindingObjectHelper<T, false>
|
||||
struct GetOrCreateDOMReflectorHelper<T, false>
|
||||
{
|
||||
static inline bool Wrap(JSContext* cx, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
static inline bool GetOrCreate(JSContext* cx, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return WrapNewBindingObject(cx, &value, rval);
|
||||
return GetOrCreateDOMReflector(cx, &value, rval);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline bool
|
||||
WrapNewBindingObject(JSContext* cx, T& value, JS::MutableHandle<JS::Value> rval)
|
||||
GetOrCreateDOMReflector(JSContext* cx, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return WrapNewBindingObjectHelper<T>::Wrap(cx, value, rval);
|
||||
return GetOrCreateDOMReflectorHelper<T>::GetOrCreate(cx, value, rval);
|
||||
}
|
||||
|
||||
// We need this version of WrapNewBindingObject for codegen, so it'll have the
|
||||
// same signature as WrapNewBindingNonWrapperCachedObject and
|
||||
// We need this version of GetOrCreateDOMReflector for codegen, so it'll have
|
||||
// the same signature as WrapNewBindingNonWrapperCachedObject and
|
||||
// WrapNewBindingNonWrapperCachedOwnedObject, which still need the scope.
|
||||
template<class T>
|
||||
inline bool
|
||||
WrapNewBindingObject(JSContext* cx, JS::Handle<JSObject*> scope, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
GetOrCreateDOMReflector(JSContext* cx, JS::Handle<JSObject*> scope, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return WrapNewBindingObject(cx, value, rval);
|
||||
return GetOrCreateDOMReflector(cx, value, rval);
|
||||
}
|
||||
|
||||
// Helper for calling GetOrCreateDOMReflectorNoWrap with smart pointers
|
||||
// (nsAutoPtr/nsRefPtr/nsCOMPtr) or references.
|
||||
template <class T, bool isSmartPtr=HasgetMember<T>::Value>
|
||||
struct GetOrCreateDOMReflectorNoWrapHelper
|
||||
{
|
||||
static inline bool GetOrCreate(JSContext* cx, const T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return GetOrCreateDOMReflectorNoWrap(cx, value.get(), rval);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct GetOrCreateDOMReflectorNoWrapHelper<T, false>
|
||||
{
|
||||
static inline bool GetOrCreate(JSContext* cx, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return GetOrCreateDOMReflectorNoWrap(cx, &value, rval);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline bool
|
||||
GetOrCreateDOMReflectorNoWrap(JSContext* cx, T& value,
|
||||
JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
return
|
||||
GetOrCreateDOMReflectorNoWrapHelper<T>::GetOrCreate(cx, value, rval);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -417,7 +417,7 @@ DOMInterfaces = {
|
|||
|
||||
'EventTarget': {
|
||||
# When we get rid of hasXPConnectImpls, we can get rid of the
|
||||
# couldBeDOMBinding stuff in WrapNewBindingObject.
|
||||
# couldBeDOMBinding stuff in GetOrCreateDOMReflector.
|
||||
#
|
||||
# We can also get rid of the UnwrapArg bits in
|
||||
# the dom QueryInterface (in BindingUtils.cpp) at that point.
|
||||
|
|
|
@ -1735,7 +1735,7 @@ class CGConstructNavigatorObject(CGAbstractMethod):
|
|||
ThrowMethodFailedWithDetails(aCx, rv, "${descriptorName}", "navigatorConstructor");
|
||||
return nullptr;
|
||||
}
|
||||
if (!WrapNewBindingObject(aCx, result, &v)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, result, &v)) {
|
||||
//XXX Assertion disabled for now, see bug 991271.
|
||||
MOZ_ASSERT(true || JS_IsExceptionPending(aCx));
|
||||
return nullptr;
|
||||
|
@ -5764,7 +5764,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
if not descriptor.interface.isExternal() and not descriptor.skipGen:
|
||||
if descriptor.wrapperCache:
|
||||
assert descriptor.nativeOwnership != 'owned'
|
||||
wrapMethod = "WrapNewBindingObject"
|
||||
wrapMethod = "GetOrCreateDOMReflector"
|
||||
else:
|
||||
if not returnsNewObject:
|
||||
raise MethodNotNewObjectError(descriptor.interface.identifier.name)
|
||||
|
@ -5854,7 +5854,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
return wrapCode, False
|
||||
|
||||
if type.isAny():
|
||||
# See comments in WrapNewBindingObject explaining why we need
|
||||
# See comments in GetOrCreateDOMReflector explaining why we need
|
||||
# to wrap here.
|
||||
# NB: _setValue(..., type-that-is-any) calls JS_WrapValue(), so is fallible
|
||||
head = "JS::ExposeValueToActiveJS(%s);\n" % result
|
||||
|
@ -5862,7 +5862,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
|
||||
if (type.isObject() or (type.isSpiderMonkeyInterface() and
|
||||
not typedArraysAreStructs)):
|
||||
# See comments in WrapNewBindingObject explaining why we need
|
||||
# See comments in GetOrCreateDOMReflector explaining why we need
|
||||
# to wrap here.
|
||||
if type.nullable():
|
||||
toValue = "%s"
|
||||
|
@ -5895,7 +5895,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
|
||||
if type.isSpiderMonkeyInterface():
|
||||
assert typedArraysAreStructs
|
||||
# See comments in WrapNewBindingObject explaining why we need
|
||||
# See comments in GetOrCreateDOMReflector explaining why we need
|
||||
# to wrap here.
|
||||
# NB: setObject(..., some-object-type) calls JS_WrapValue(), so is fallible
|
||||
return (setObject("*%s.Obj()" % result,
|
||||
|
@ -13255,7 +13255,7 @@ class CGJSImplMethod(CGJSImplMember):
|
|||
JS::Rooted<JSObject*> scopeObj(cx, globalHolder->GetGlobalJSObject());
|
||||
MOZ_ASSERT(js::IsObjectInContextCompartment(scopeObj, cx));
|
||||
JS::Rooted<JS::Value> wrappedVal(cx);
|
||||
if (!WrapNewBindingObject(cx, impl, &wrappedVal)) {
|
||||
if (!GetOrCreateDOMReflector(cx, impl, &wrappedVal)) {
|
||||
//XXX Assertion disabled for now, see bug 991271.
|
||||
MOZ_ASSERT(true || JS_IsExceptionPending(cx));
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
|
@ -13545,7 +13545,7 @@ class CGJSImplClass(CGBindingImplClass):
|
|||
JS::Rooted<JSObject*> arg(cx, &args[1].toObject());
|
||||
nsRefPtr<${implName}> impl = new ${implName}(arg, window);
|
||||
MOZ_ASSERT(js::IsObjectInContextCompartment(arg, cx));
|
||||
return WrapNewBindingObject(cx, impl, args.rval());
|
||||
return GetOrCreateDOMReflector(cx, impl, args.rval());
|
||||
""",
|
||||
ifaceName=self.descriptor.interface.identifier.name,
|
||||
implName=self.descriptor.name)
|
||||
|
|
|
@ -76,7 +76,7 @@ ThrowExceptionObject(JSContext* aCx, Exception* aException)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!WrapNewBindingObject(aCx, aException, &thrown)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, aException, &thrown)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ ToJSValue(JSContext* aCx,
|
|||
// Make sure non-webidl objects don't sneak in here
|
||||
MOZ_ASSERT(aArgument.IsDOMBinding());
|
||||
|
||||
return WrapNewBindingObject(aCx, aArgument, aValue);
|
||||
return GetOrCreateDOMReflector(aCx, aArgument, aValue);
|
||||
}
|
||||
|
||||
// Accept typed arrays built from appropriate nsTArray values
|
||||
|
|
|
@ -88,7 +88,8 @@ WebGLContext::WebGLObjectAsJSValue(JSContext *cx, const WebGLObjectType *object,
|
|||
JS::Rooted<JS::Value> v(cx);
|
||||
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
if (!dom::WrapNewBindingObject(cx, const_cast<WebGLObjectType*>(object), &v)) {
|
||||
if (!dom::GetOrCreateDOMReflector(cx, const_cast<WebGLObjectType*>(object),
|
||||
&v)) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
|
|
@ -499,6 +499,7 @@ support-files = webgl-conformance/../webgl-mochitest/driver-info.js
|
|||
[webgl-conformance/_wrappers/test_conformance__buffers__index-validation-with-resized-buffer.html]
|
||||
[webgl-conformance/_wrappers/test_conformance__buffers__index-validation.html]
|
||||
[webgl-conformance/_wrappers/test_conformance__canvas__buffer-offscreen-test.html]
|
||||
skip-if = os == 'android' # Bug 1102402 - It fails intermittently and causes a lot of retried jobs
|
||||
[webgl-conformance/_wrappers/test_conformance__canvas__buffer-preserve-test.html]
|
||||
[webgl-conformance/_wrappers/test_conformance__canvas__canvas-test.html]
|
||||
[webgl-conformance/_wrappers/test_conformance__canvas__canvas-zero-size.html]
|
||||
|
|
|
@ -900,7 +900,7 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
|
|||
NS_ENSURE_TRUE(jsStr, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Get the reflector for |aElement|, so that we can pass to setElement.
|
||||
if (NS_WARN_IF(!WrapNewBindingObject(cx, target, aElement, &v))) {
|
||||
if (NS_WARN_IF(!GetOrCreateDOMReflector(cx, target, aElement, &v))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS::CompileOptions options(cx);
|
||||
|
|
|
@ -35,7 +35,8 @@ var testsForEventOrder = [
|
|||
doPreventDefaultAt: kUnknownEvent
|
||||
},
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling preventDefault() at \"mozbrowserbeforekeydown\" event",
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"mozbrowserbeforekeydown\" event",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kAfterEvent | kKeyDownEvent ],
|
||||
[ kParent | kBeforeEvent | kKeyUpEvent,
|
||||
|
@ -47,7 +48,8 @@ var testsForEventOrder = [
|
|||
doPreventDefaultAt: kParent | kBeforeEvent | kKeyDownEvent
|
||||
},
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling preventDefault() at \"mozbrowserbeforekeyup\" event",
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"mozbrowserbeforekeyup\" event",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kKeyDownEvent,
|
||||
kChild | kKeyDownEvent,
|
||||
|
@ -58,9 +60,23 @@ var testsForEventOrder = [
|
|||
classifiedEvents: [ [], [] ],
|
||||
doPreventDefaultAt: kParent | kBeforeEvent | kKeyUpEvent
|
||||
},
|
||||
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling preventDefault() at \"keydown\" event",
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"keydown\" event in parent process",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kKeyDownEvent,
|
||||
kParent | kAfterEvent | kKeyDownEvent ],
|
||||
[ kParent | kBeforeEvent | kKeyUpEvent,
|
||||
kParent | kKeyUpEvent,
|
||||
kChild | kKeyUpEvent,
|
||||
kParent | kAfterEvent | kKeyUpEvent ] ],
|
||||
resultEvents: [],
|
||||
classifiedEvents: [ [], [] ],
|
||||
doPreventDefaultAt: kParent | kKeyDownEvent
|
||||
},
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"keydown\" event in child process",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kKeyDownEvent,
|
||||
kChild | kKeyDownEvent,
|
||||
|
@ -74,7 +90,22 @@ var testsForEventOrder = [
|
|||
doPreventDefaultAt: kChild | kKeyDownEvent
|
||||
},
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling preventDefault() at \"keyup\" event",
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"keyup\" event in parent process",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kKeyDownEvent,
|
||||
kChild | kKeyDownEvent,
|
||||
kParent | kAfterEvent | kKeyDownEvent ],
|
||||
[ kParent | kBeforeEvent | kKeyUpEvent,
|
||||
kParent | kKeyUpEvent,
|
||||
kParent | kAfterEvent | kKeyUpEvent ] ],
|
||||
resultEvents: [],
|
||||
classifiedEvents: [ [], [] ],
|
||||
doPreventDefaultAt: kParent | kKeyUpEvent
|
||||
},
|
||||
{
|
||||
description: "Testing the order of the events (OOP), calling " +
|
||||
"preventDefault() at \"keyup\" event in child process",
|
||||
expectedEvents: [ [ kParent | kBeforeEvent | kKeyDownEvent,
|
||||
kParent | kKeyDownEvent,
|
||||
kChild | kKeyDownEvent,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
|
@ -159,6 +160,10 @@ HTMLCanvasElement::GetWidthHeight()
|
|||
size.height = value->GetIntegerValue();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(size.width >= 0 && size.height >= 0,
|
||||
"we should've required <canvas> width/height attrs to be "
|
||||
"unsigned (non-negative) values");
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
|
@ -2151,6 +2151,7 @@ HTMLInputElement::GetValueIfStepped(int32_t aStep,
|
|||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
Decimal stepBase = GetStepBase();
|
||||
Decimal step = GetStep();
|
||||
if (step == kStepAny) {
|
||||
if (aCallerType != CALLED_FOR_USER_EVENT) {
|
||||
|
@ -2160,47 +2161,44 @@ HTMLInputElement::GetValueIfStepped(int32_t aStep,
|
|||
step = GetDefaultStep();
|
||||
}
|
||||
|
||||
Decimal value = GetValueAsDecimal();
|
||||
if (value.isNaN()) {
|
||||
value = Decimal(0);
|
||||
}
|
||||
|
||||
Decimal minimum = GetMinimum();
|
||||
|
||||
Decimal maximum = GetMaximum();
|
||||
|
||||
if (!maximum.isNaN()) {
|
||||
// "max - (max - stepBase) % step" is the nearest valid value to max.
|
||||
maximum = maximum - NS_floorModulo(maximum - GetStepBase(), step);
|
||||
}
|
||||
|
||||
// Cases where we are clearly going in the wrong way.
|
||||
// We don't use ValidityState because we can be higher than the maximal
|
||||
// allowed value and still not suffer from range overflow in the case of
|
||||
// of the value specified in @max isn't in the step.
|
||||
if ((value <= minimum && aStep < 0) ||
|
||||
(value >= maximum && aStep > 0)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the current value isn't aligned on a step, then shift the value to the
|
||||
// nearest step that will cause the addition of aStep steps (further below)
|
||||
// to |value| to hit the required value.
|
||||
// (Instead of using GetValidityState(VALIDITY_STATE_STEP_MISMATCH) we have
|
||||
// to check HasStepMismatch and pass true as its aUseZeroIfValueNaN argument
|
||||
// since we need to treat the value "" as zero for stepping purposes even
|
||||
// though we don't suffer from a step mismatch when our value is the empty
|
||||
// string.)
|
||||
if (HasStepMismatch(true) &&
|
||||
value != minimum && value != maximum) {
|
||||
if (aStep > 0) {
|
||||
value -= NS_floorModulo(value - GetStepBase(), step);
|
||||
} else if (aStep < 0) {
|
||||
value -= NS_floorModulo(value - GetStepBase(), step);
|
||||
value += step;
|
||||
maximum = maximum - NS_floorModulo(maximum - stepBase, step);
|
||||
if (!minimum.isNaN()) {
|
||||
if (minimum > maximum) {
|
||||
// Either the minimum was greater than the maximum prior to our
|
||||
// adjustment to align maximum on a step, or else (if we adjusted
|
||||
// maximum) there is no valid step between minimum and the unadjusted
|
||||
// maximum.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
value += step * Decimal(aStep);
|
||||
Decimal value = GetValueAsDecimal();
|
||||
bool valueWasNaN = false;
|
||||
if (value.isNaN()) {
|
||||
value = Decimal(0);
|
||||
valueWasNaN = true;
|
||||
}
|
||||
Decimal valueBeforeStepping = value;
|
||||
|
||||
Decimal deltaFromStep = NS_floorModulo(value - stepBase, step);
|
||||
|
||||
if (deltaFromStep != Decimal(0)) {
|
||||
if (aStep > 0) {
|
||||
value += step - deltaFromStep; // partial step
|
||||
value += step * Decimal(aStep - 1); // then remaining steps
|
||||
} else if (aStep < 0) {
|
||||
value -= deltaFromStep; // partial step
|
||||
value += step * Decimal(aStep + 1); // then remaining steps
|
||||
}
|
||||
} else {
|
||||
value += step * Decimal(aStep);
|
||||
}
|
||||
|
||||
// For date inputs, the value can hold a string that is not a day. We do not
|
||||
// want to round it, as it might result in a step mismatch. Instead we want to
|
||||
|
@ -2218,27 +2216,30 @@ HTMLInputElement::GetValueIfStepped(int32_t aStep,
|
|||
}
|
||||
}
|
||||
|
||||
// When stepUp() is called and the value is below minimum, we should clamp on
|
||||
// minimum unless stepUp() moves us higher than minimum.
|
||||
if (GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW) && aStep > 0 &&
|
||||
value <= minimum) {
|
||||
MOZ_ASSERT(!minimum.isNaN(), "Can't be NaN if we are here");
|
||||
if (value < minimum) {
|
||||
value = minimum;
|
||||
// Same goes for stepDown() and maximum.
|
||||
} else if (GetValidityState(VALIDITY_STATE_RANGE_OVERFLOW) && aStep < 0 &&
|
||||
value >= maximum) {
|
||||
MOZ_ASSERT(!maximum.isNaN(), "Can't be NaN if we are here");
|
||||
deltaFromStep = NS_floorModulo(value - stepBase, step);
|
||||
if (deltaFromStep != Decimal(0)) {
|
||||
value += step - deltaFromStep;
|
||||
}
|
||||
}
|
||||
if (value > maximum) {
|
||||
value = maximum;
|
||||
// If we go down, we want to clamp on min.
|
||||
} else if (aStep < 0 && minimum == minimum) {
|
||||
value = std::max(value, minimum);
|
||||
// If we go up, we want to clamp on max.
|
||||
} else if (aStep > 0 && maximum == maximum) {
|
||||
value = std::min(value, maximum);
|
||||
deltaFromStep = NS_floorModulo(value - stepBase, step);
|
||||
if (deltaFromStep != Decimal(0)) {
|
||||
value -= deltaFromStep;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valueWasNaN && // value="", resulting in us using "0"
|
||||
((aStep > 0 && value < valueBeforeStepping) ||
|
||||
(aStep < 0 && value > valueBeforeStepping))) {
|
||||
// We don't want step-up to effectively step down, or step-down to
|
||||
// effectively step up, so return;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aNextStep = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3701,7 +3702,10 @@ HTMLInputElement::StopNumberControlSpinnerSpin()
|
|||
void
|
||||
HTMLInputElement::StepNumberControlForUserEvent(int32_t aDirection)
|
||||
{
|
||||
if (!IsValid()) {
|
||||
// We can't use GetValidityState here because the validity state is not set
|
||||
// if the user hasn't previously taken an action to set or change the value,
|
||||
// according to the specs.
|
||||
if (HasBadInput()) {
|
||||
// If the user has typed a value into the control and inadvertently made a
|
||||
// mistake (e.g. put a thousand separator at the wrong point) we do not
|
||||
// want to wipe out what they typed if they try to increment/decrement the
|
||||
|
|
|
@ -905,7 +905,7 @@ nsHTMLDocument::GetDomain(nsAString& aDomain, ErrorResult& rv)
|
|||
nsCOMPtr<nsIURI> uri = GetDomainURI();
|
||||
|
||||
if (!uri) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
SetDOMStringToNull(aDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,13 @@ function checkStepDown()
|
|||
[ '10', '2', '0', '4', '10', '0', false ],
|
||||
[ '10', '2', '0', '4', '5', '0', false ],
|
||||
// value = "" (NaN).
|
||||
[ '', null, null, null, null, '-1', false ],
|
||||
[ '', null, null, null, null, '-1', false ],
|
||||
[ '', '2', null, null, null, '-2', false ],
|
||||
[ '', '2', '3', null, null, '3', false ],
|
||||
[ '', null, '3', null, null, '3', false ],
|
||||
[ '', '2', '3', '8', null, '3', false ],
|
||||
[ '', null, '-10', '10', null, '-1', false ],
|
||||
[ '', '3', '-10', '10', null, '-1', false ],
|
||||
// With step = 'any'.
|
||||
[ '0', 'any', null, null, 1, null, true ],
|
||||
[ '0', 'ANY', null, null, 1, null, true ],
|
||||
|
@ -484,7 +490,14 @@ function checkStepUp()
|
|||
[ '-3', '2', '-6', '-2', null, '-2', false ],
|
||||
[ '-3', '2', '-6', '-1', null, '-2', false ],
|
||||
// value = "" (NaN).
|
||||
[ '', null, null, null, null, '1', false ],
|
||||
[ '', null, null, null, null, '1', false ],
|
||||
[ '', null, null, null, null, '1', false ],
|
||||
[ '', '2', null, null, null, '2', false ],
|
||||
[ '', '2', '3', null, null, '3', false ],
|
||||
[ '', null, '3', null, null, '3', false ],
|
||||
[ '', '2', '3', '8', null, '3', false ],
|
||||
[ '', null, '-10', '10', null, '1', false ],
|
||||
[ '', '3', '-10', '10', null, '2', false ],
|
||||
// With step = 'any'.
|
||||
[ '0', 'any', null, null, 1, null, true ],
|
||||
[ '0', 'ANY', null, null, 1, null, true ],
|
||||
|
|
|
@ -628,7 +628,7 @@ public:
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> wrappedBlob(aCx);
|
||||
if (!WrapNewBindingObject(aCx, aFile.mFile, &wrappedBlob)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, aFile.mFile, &wrappedBlob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ public:
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> wrappedFile(aCx);
|
||||
if (!WrapNewBindingObject(aCx, aFile.mFile, &wrappedFile)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, aFile.mFile, &wrappedFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ IndexedDatabaseManager::DefineIndexedDB(JSContext* aCx,
|
|||
|
||||
JS::Rooted<JS::Value> indexedDB(aCx);
|
||||
js::AssertSameCompartment(aCx, aGlobal);
|
||||
if (!WrapNewBindingObject(aCx, factory, &indexedDB)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, factory, &indexedDB)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag,
|
|||
MOZ_ASSERT(global);
|
||||
|
||||
nsRefPtr<File> newBlob = new File(global, blob->Impl());
|
||||
if (!WrapNewBindingObject(aCx, newBlob, &val)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, newBlob, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2126,6 +2126,7 @@ MediaDecoderStateMachine::DecodeFirstFrame()
|
|||
mReader->RequestAudioData();
|
||||
}
|
||||
if (HasVideo()) {
|
||||
mVideoDecodeStartTime = TimeStamp::Now();
|
||||
ReentrantMonitorAutoExit unlock(mDecoder->GetReentrantMonitor());
|
||||
mReader->RequestVideoData(false, 0);
|
||||
}
|
||||
|
|
|
@ -456,6 +456,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
|
|||
*aInfo = mInfo;
|
||||
*aTags = nullptr;
|
||||
|
||||
MonitorAutoLock mon(mIndexMonitor);
|
||||
UpdateIndex();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -851,17 +852,9 @@ MP4Reader::Seek(int64_t aTime,
|
|||
GetCallback()->OnSeekCompleted(NS_OK);
|
||||
}
|
||||
|
||||
void
|
||||
MP4Reader::NotifyDataArrived(const char* aBuffer, uint32_t aLength,
|
||||
int64_t aOffset)
|
||||
{
|
||||
UpdateIndex();
|
||||
}
|
||||
|
||||
void
|
||||
MP4Reader::UpdateIndex()
|
||||
{
|
||||
MonitorAutoLock mon(mIndexMonitor);
|
||||
if (!mIndexReady) {
|
||||
return;
|
||||
}
|
||||
|
@ -891,6 +884,7 @@ MP4Reader::GetBuffered(dom::TimeRanges* aBuffered)
|
|||
if (!mIndexReady) {
|
||||
return NS_OK;
|
||||
}
|
||||
UpdateIndex();
|
||||
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
|
||||
|
||||
AutoPinned<MediaResource> resource(mDecoder->GetResource());
|
||||
|
|
|
@ -57,9 +57,6 @@ public:
|
|||
|
||||
virtual bool IsMediaSeekable() MOZ_OVERRIDE;
|
||||
|
||||
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength,
|
||||
int64_t aOffset) MOZ_OVERRIDE;
|
||||
|
||||
virtual int64_t GetEvictionOffset(double aTime) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered) MOZ_OVERRIDE;
|
||||
|
|
|
@ -204,6 +204,12 @@ GonkAudioDecoderManager::Output(int64_t aStreamOffset,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GonkAudioDecoderManager::Flush()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void GonkAudioDecoderManager::ReleaseAudioBuffer() {
|
||||
if (mAudioBuffer) {
|
||||
mDecoder->ReleaseMediaBuffer(mAudioBuffer);
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
|
||||
virtual nsresult Output(int64_t aStreamOffset,
|
||||
nsRefPtr<MediaData>& aOutput) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Flush() MOZ_OVERRIDE;
|
||||
private:
|
||||
|
||||
nsresult CreateAudioData(int64_t aStreamOffset,
|
||||
|
|
|
@ -135,8 +135,7 @@ GonkMediaDataDecoder::Flush()
|
|||
// flushing.
|
||||
mTaskQueue->Flush();
|
||||
|
||||
status_t err = mDecoder->flush();
|
||||
return err == OK ? NS_OK : NS_ERROR_FAILURE;
|
||||
return mManager->Flush();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) = 0;
|
||||
virtual nsresult Output(int64_t aStreamOffset,
|
||||
nsRefPtr<MediaData>& aOutput) = 0;
|
||||
virtual nsresult Flush() = 0;
|
||||
|
||||
virtual void ReleaseMediaResources() {};
|
||||
};
|
||||
|
|
|
@ -54,6 +54,7 @@ GonkVideoDecoderManager::GonkVideoDecoderManager(
|
|||
const mp4_demuxer::VideoDecoderConfig& aConfig)
|
||||
: mImageContainer(aImageContainer)
|
||||
, mReaderCallback(nullptr)
|
||||
, mMonitor("GonkVideoDecoderManager")
|
||||
, mColorConverterBufferSize(0)
|
||||
, mNativeWindow(nullptr)
|
||||
, mPendingVideoBuffersLock("GonkVideoDecoderManager::mPendingVideoBuffersLock")
|
||||
|
@ -121,6 +122,50 @@ GonkVideoDecoderManager::Init(MediaDataDecoderCallback* aCallback)
|
|||
return mDecoder;
|
||||
}
|
||||
|
||||
void
|
||||
GonkVideoDecoderManager::QueueFrameTimeIn(int64_t aPTS, int64_t aDuration)
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
FrameTimeInfo timeInfo = {aPTS, aDuration};
|
||||
mFrameTimeInfo.AppendElement(timeInfo);
|
||||
}
|
||||
|
||||
nsresult
|
||||
GonkVideoDecoderManager::QueueFrameTimeOut(int64_t aPTS, int64_t& aDuration)
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
|
||||
// Set default to 1 here.
|
||||
// During seeking, frames could still in MediaCodec and the mFrameTimeInfo could
|
||||
// be cleared before these frames are out from MediaCodec. This is ok because
|
||||
// these frames are old frame before seeking.
|
||||
aDuration = 1;
|
||||
for (uint32_t i = 0; i < mFrameTimeInfo.Length(); i++) {
|
||||
const FrameTimeInfo& entry = mFrameTimeInfo.ElementAt(i);
|
||||
if (i == 0) {
|
||||
if (entry.pts > aPTS) {
|
||||
// Codec sent a frame with rollbacked PTS time. It could
|
||||
// be codec's problem.
|
||||
ReleaseVideoBuffer();
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
// Ideally, the first entry in mFrameTimeInfo should be the one we are looking
|
||||
// for. However, MediaCodec could dropped frame and the first entry doesn't
|
||||
// match current decoded frame's PTS.
|
||||
if (entry.pts == aPTS) {
|
||||
aDuration = entry.duration;
|
||||
if (i > 0) {
|
||||
LOG("Frame could be dropped by MediaCodec, %d dropped frames.", i);
|
||||
}
|
||||
mFrameTimeInfo.RemoveElementsAt(0, i+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
|
||||
{
|
||||
|
@ -139,6 +184,10 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
int64_t duration;
|
||||
nsresult rv = QueueFrameTimeOut(timeUs, duration);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mVideoBuffer->range_length() == 0) {
|
||||
// Some decoders may return spurious empty buffers that we just want to ignore
|
||||
// quoted from Android's AwesomePlayer.cpp
|
||||
|
@ -178,7 +227,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
|
|||
mImageContainer,
|
||||
aStreamOffset,
|
||||
timeUs,
|
||||
1, // We don't know the duration.
|
||||
duration,
|
||||
textureClient,
|
||||
keyFrame,
|
||||
-1,
|
||||
|
@ -400,6 +449,8 @@ GonkVideoDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
|
|||
mp4_demuxer::AnnexB::ConvertSample(aSample);
|
||||
// Forward sample data to the decoder.
|
||||
|
||||
QueueFrameTimeIn(aSample->composition_timestamp, aSample->duration);
|
||||
|
||||
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
|
||||
uint32_t length = aSample->size;
|
||||
rv = mDecoder->Input(data, length, aSample->composition_timestamp, 0);
|
||||
|
@ -411,6 +462,19 @@ GonkVideoDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
|
|||
return (rv == OK) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GonkVideoDecoderManager::Flush()
|
||||
{
|
||||
status_t err = mDecoder->flush();
|
||||
if (err != OK) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mFrameTimeInfo.Clear();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
GonkVideoDecoderManager::codecReserved()
|
||||
{
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
virtual nsresult Output(int64_t aStreamOffset,
|
||||
nsRefPtr<MediaData>& aOutput) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Flush() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ReleaseMediaResources();
|
||||
|
||||
static void RecycleCallback(TextureClient* aClient, void* aClosure);
|
||||
|
@ -104,6 +106,15 @@ private:
|
|||
};
|
||||
friend class VideoResourceListener;
|
||||
|
||||
// FrameTimeInfo keeps the presentation time stamp (pts) and its duration.
|
||||
// On MediaDecoderStateMachine, it needs pts and duration to display decoded
|
||||
// frame correctly. But OMX can carry one field of time info (kKeyTime) so
|
||||
// we use FrameTimeInfo to keep pts and duration.
|
||||
struct FrameTimeInfo {
|
||||
int64_t pts; // presentation time stamp of this frame.
|
||||
int64_t duration; // the playback duration.
|
||||
};
|
||||
|
||||
bool SetVideoFormat();
|
||||
|
||||
nsresult CreateVideoData(int64_t aStreamOffset, VideoData** aOutData);
|
||||
|
@ -118,6 +129,9 @@ private:
|
|||
void ReleaseAllPendingVideoBuffers();
|
||||
void PostReleaseVideoBuffer(android::MediaBuffer *aBuffer);
|
||||
|
||||
void QueueFrameTimeIn(int64_t aPTS, int64_t aDuration);
|
||||
nsresult QueueFrameTimeOut(int64_t aPTS, int64_t& aDuration);
|
||||
|
||||
uint32_t mVideoWidth;
|
||||
uint32_t mVideoHeight;
|
||||
uint32_t mDisplayWidth;
|
||||
|
@ -139,6 +153,14 @@ private:
|
|||
android::sp<ALooper> mManagerLooper;
|
||||
FrameInfo mFrameInfo;
|
||||
|
||||
// It protects mFrameTimeInfo.
|
||||
Monitor mMonitor;
|
||||
// Array of FrameTimeInfo whose corresponding frames are sent to OMX.
|
||||
// Ideally, it is a FIFO. Input() adds the entry to the end element and
|
||||
// CreateVideoData() takes the first entry. However, there are exceptions
|
||||
// due to MediaCodec error or seeking.
|
||||
nsTArray<FrameTimeInfo> mFrameTimeInfo;
|
||||
|
||||
// color converter
|
||||
android::I420ColorConverterHelper mColorConverter;
|
||||
nsAutoArrayPtr<uint8_t> mColorConverterBuffer;
|
||||
|
|
|
@ -276,6 +276,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TimestampsFuzzyEqual(int64_t aLhs, int64_t aRhs)
|
||||
{
|
||||
return llabs(aLhs - aRhs) <= 1000;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<mp4_demuxer::BufferStream> mStream;
|
||||
nsAutoPtr<mp4_demuxer::MoofParser> mParser;
|
||||
|
|
|
@ -108,7 +108,7 @@ AudioNodeExternalInputStream::ProcessInput(GraphTime aFrom, GraphTime aTo,
|
|||
uint32_t aFlags)
|
||||
{
|
||||
// According to spec, number of outputs is always 1.
|
||||
mLastChunks.SetLength(1);
|
||||
MOZ_ASSERT(mLastChunks.Length() == 1);
|
||||
|
||||
// GC stuff can result in our input stream being destroyed before this stream.
|
||||
// Handle that.
|
||||
|
|
|
@ -25,6 +25,27 @@ namespace mozilla {
|
|||
* Note: This must be a different value than MEDIA_STREAM_DEST_TRACK_ID
|
||||
*/
|
||||
|
||||
AudioNodeStream::AudioNodeStream(AudioNodeEngine* aEngine,
|
||||
MediaStreamGraph::AudioNodeStreamKind aKind,
|
||||
TrackRate aSampleRate)
|
||||
: ProcessedMediaStream(nullptr),
|
||||
mEngine(aEngine),
|
||||
mSampleRate(aSampleRate),
|
||||
mKind(aKind),
|
||||
mNumberOfInputChannels(2),
|
||||
mMarkAsFinishedAfterThisBlock(false),
|
||||
mAudioParamStream(false),
|
||||
mPassThrough(false)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mChannelCountMode = ChannelCountMode::Max;
|
||||
mChannelInterpretation = ChannelInterpretation::Speakers;
|
||||
// AudioNodes are always producing data
|
||||
mHasCurrentData = true;
|
||||
mLastChunks.SetLength(std::max(uint16_t(1), mEngine->OutputCount()));
|
||||
MOZ_COUNT_CTOR(AudioNodeStream);
|
||||
}
|
||||
|
||||
AudioNodeStream::~AudioNodeStream()
|
||||
{
|
||||
MOZ_COUNT_DTOR(AudioNodeStream);
|
||||
|
@ -450,8 +471,8 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
|||
// No more tracks will be coming
|
||||
mBuffer.AdvanceKnownTracksTime(STREAM_TIME_MAX);
|
||||
|
||||
uint16_t outputCount = std::max(uint16_t(1), mEngine->OutputCount());
|
||||
mLastChunks.SetLength(outputCount);
|
||||
uint16_t outputCount = mLastChunks.Length();
|
||||
MOZ_ASSERT(outputCount == std::max(uint16_t(1), mEngine->OutputCount()));
|
||||
|
||||
// Consider this stream blocked if it has already finished output. Normally
|
||||
// mBlocked would reflect this, but due to rounding errors our audio track may
|
||||
|
@ -475,7 +496,7 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
|||
MOZ_ASSERT(outputCount == 1, "For now, we only support nodes that have one output port");
|
||||
mLastChunks[0] = inputChunks[0];
|
||||
} else {
|
||||
if (maxInputs <= 1 && mEngine->OutputCount() <= 1) {
|
||||
if (maxInputs <= 1 && outputCount <= 1) {
|
||||
mEngine->ProcessBlock(this, inputChunks[0], &mLastChunks[0], &finished);
|
||||
} else {
|
||||
mEngine->ProcessBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
|
||||
|
@ -515,7 +536,7 @@ AudioNodeStream::ProduceOutputBeforeInput(GraphTime aFrom)
|
|||
MOZ_ASSERT(mEngine->OutputCount() == 1,
|
||||
"DelayNodeEngine output count should be 1");
|
||||
MOZ_ASSERT(!InMutedCycle(), "DelayNodes should break cycles");
|
||||
mLastChunks.SetLength(1);
|
||||
MOZ_ASSERT(mLastChunks.Length() == 1);
|
||||
|
||||
// Consider this stream blocked if it has already finished output. Normally
|
||||
// mBlocked would reflect this, but due to rounding errors our audio track may
|
||||
|
|
|
@ -47,23 +47,7 @@ public:
|
|||
*/
|
||||
AudioNodeStream(AudioNodeEngine* aEngine,
|
||||
MediaStreamGraph::AudioNodeStreamKind aKind,
|
||||
TrackRate aSampleRate)
|
||||
: ProcessedMediaStream(nullptr),
|
||||
mEngine(aEngine),
|
||||
mSampleRate(aSampleRate),
|
||||
mKind(aKind),
|
||||
mNumberOfInputChannels(2),
|
||||
mMarkAsFinishedAfterThisBlock(false),
|
||||
mAudioParamStream(false),
|
||||
mPassThrough(false)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mChannelCountMode = ChannelCountMode::Max;
|
||||
mChannelInterpretation = ChannelInterpretation::Speakers;
|
||||
// AudioNodes are always producing data
|
||||
mHasCurrentData = true;
|
||||
MOZ_COUNT_CTOR(AudioNodeStream);
|
||||
}
|
||||
TrackRate aSampleRate);
|
||||
|
||||
protected:
|
||||
~AudioNodeStream();
|
||||
|
|
|
@ -580,7 +580,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachm
|
|||
nsRefPtr<File> newBlob = new File(global, attachment.content->Impl());
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!WrapNewBindingObject(aCx, newBlob, &val)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, newBlob, &val)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ MmsAttachmentDataToJSObject(JSContext* aContext,
|
|||
MOZ_ASSERT(global);
|
||||
|
||||
nsRefPtr<File> blob = new File(global, blobImpl);
|
||||
if (!WrapNewBindingObject(aContext, blob, &content)) {
|
||||
if (!GetOrCreateDOMReflector(aContext, blob, &content)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ Promise::CreateWrapper(ErrorResult& aRv)
|
|||
JSContext* cx = jsapi.cx();
|
||||
|
||||
JS::Rooted<JS::Value> wrapper(cx);
|
||||
if (!WrapNewBindingObject(cx, this, &wrapper)) {
|
||||
if (!GetOrCreateDOMReflector(cx, this, &wrapper)) {
|
||||
JS_ClearPendingException(cx);
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
|
@ -475,7 +475,7 @@ Promise::CreateFunction(JSContext* aCx, JSObject* aParent, Promise* aPromise,
|
|||
JS::Rooted<JSObject*> obj(aCx, JS_GetFunctionObject(func));
|
||||
|
||||
JS::Rooted<JS::Value> promiseObj(aCx);
|
||||
if (!dom::WrapNewBindingObject(aCx, aPromise, &promiseObj)) {
|
||||
if (!dom::GetOrCreateDOMReflector(aCx, aPromise, &promiseObj)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ Promise::CreateThenableFunction(JSContext* aCx, Promise* aPromise, uint32_t aTas
|
|||
JS::Rooted<JSObject*> obj(aCx, JS_GetFunctionObject(func));
|
||||
|
||||
JS::Rooted<JS::Value> promiseObj(aCx);
|
||||
if (!dom::WrapNewBindingObject(aCx, aPromise, &promiseObj)) {
|
||||
if (!dom::GetOrCreateDOMReflector(aCx, aPromise, &promiseObj)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,11 +151,17 @@ UpdatePromise::RejectAllPromises(const ErrorEventInit& aErrorDesc)
|
|||
JS::Rooted<JSString*> stack(cx, JS_GetEmptyString(JS_GetRuntime(cx)));
|
||||
|
||||
JS::Rooted<JS::Value> fnval(cx);
|
||||
ToJSValue(cx, aErrorDesc.mFilename, &fnval);
|
||||
if (!ToJSValue(cx, aErrorDesc.mFilename, &fnval)) {
|
||||
pendingPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||
continue;
|
||||
}
|
||||
JS::Rooted<JSString*> fn(cx, fnval.toString());
|
||||
|
||||
JS::Rooted<JS::Value> msgval(cx);
|
||||
ToJSValue(cx, aErrorDesc.mMessage, &msgval);
|
||||
if (!ToJSValue(cx, aErrorDesc.mMessage, &msgval)) {
|
||||
pendingPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||
continue;
|
||||
}
|
||||
JS::Rooted<JSString*> msg(cx, msgval.toString());
|
||||
|
||||
JS::Rooted<JS::Value> error(cx);
|
||||
|
|
|
@ -322,7 +322,7 @@ struct WorkerStructuredCloneCallbacks
|
|||
// New scope to protect |result| from a moving GC during ~nsRefPtr.
|
||||
nsRefPtr<File> blob = new File(nullptr, blobImpl);
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (WrapNewBindingObject(aCx, blob, &val)) {
|
||||
if (GetOrCreateDOMReflector(aCx, blob, &val)) {
|
||||
result = val.toObjectOrNull();
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ struct MainThreadWorkerStructuredCloneCallbacks
|
|||
JS::Rooted<JS::Value> val(aCx);
|
||||
{
|
||||
nsRefPtr<File> blob = new File(nullptr, blobImpl);
|
||||
if (!WrapNewBindingObject(aCx, blob, &val)) {
|
||||
if (!GetOrCreateDOMReflector(aCx, blob, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1072,16 +1072,13 @@ Proxy::HandleEvent(nsIDOMEvent* aEvent)
|
|||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
JS::Rooted<JSObject*> scope(cx, xpc::UnprivilegedJunkScope());
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!WrapNewBindingObject(cx, mXHR, &value)) {
|
||||
if (!GetOrCreateDOMReflectorNoWrap(cx, mXHR, &value)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
scope = js::UncheckedUnwrap(&value.toObject());
|
||||
JSAutoCompartment ac2(cx, scope);
|
||||
JS::Rooted<JSObject*> scope(cx, &value.toObject());
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
|
||||
runnable->Dispatch(cx);
|
||||
}
|
||||
|
@ -2175,7 +2172,7 @@ XMLHttpRequest::Send(File& aBody, ErrorResult& aRv)
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!WrapNewBindingObject(cx, &aBody, &value)) {
|
||||
if (!GetOrCreateDOMReflector(cx, &aBody, &value)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4943,7 +4943,7 @@ nsHTMLEditRules::AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignTyp
|
|||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
NS_ENSURE_TRUE(node && alignType, NS_ERROR_NULL_POINTER);
|
||||
nsresult res;
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsIContent> firstChild, lastChild;
|
||||
nsCOMPtr<Element> divNode;
|
||||
|
||||
|
|
|
@ -1103,7 +1103,7 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
|||
{
|
||||
NS_ENSURE_TRUE(aProperty, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsresult result;
|
||||
nsresult result = NS_OK;
|
||||
*aAny = false;
|
||||
*aAll = true;
|
||||
*aFirst = false;
|
||||
|
|
|
@ -98,12 +98,12 @@ skip-if(Android||B2G) needs-focus == 462758-grabbers-resizers.html 462758-grabbe
|
|||
== 388980-1.html 388980-1-ref.html
|
||||
needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html
|
||||
skip-if(B2G) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658
|
||||
needs-focus pref(selectioncaret.enabled,false) == 824080-1.html 824080-1-ref.html
|
||||
needs-focus == 824080-1.html 824080-1-ref.html
|
||||
needs-focus == 824080-2.html 824080-2-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html
|
||||
needs-focus test-pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html
|
||||
needs-focus != 824080-2.html 824080-3.html
|
||||
needs-focus pref(selectioncaret.enabled,false) == 824080-4.html 824080-4-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html
|
||||
needs-focus == 824080-4.html 824080-4-ref.html
|
||||
needs-focus test-pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html
|
||||
needs-focus != 824080-4.html 824080-5.html
|
||||
needs-focus == 824080-6.html 824080-6-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) == 824080-7.html 824080-7-ref.html
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,4 +1,4 @@
|
|||
57242
|
||||
57243
|
||||
0/nm
|
||||
0th/pt
|
||||
1/n1
|
||||
|
@ -34533,6 +34533,7 @@ incarnation/AM
|
|||
incendiary/SM
|
||||
incense/MGDS
|
||||
incentive/ESM
|
||||
incentivize/SDG
|
||||
inception/SM
|
||||
incessant/Y
|
||||
incest/MS
|
||||
|
|
|
@ -854,8 +854,8 @@ template <>
|
|||
struct ParamTraits<mozilla::layers::CompositableType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
mozilla::layers::CompositableType,
|
||||
mozilla::layers::CompositableType::BUFFER_UNKNOWN,
|
||||
mozilla::layers::CompositableType::BUFFER_COUNT>
|
||||
mozilla::layers::CompositableType::UNKNOWN,
|
||||
mozilla::layers::CompositableType::COUNT>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -19,32 +19,21 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
typedef int32_t SurfaceDescriptorType;
|
||||
const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
|
||||
|
||||
/**
|
||||
* Flags used by texture clients and texture hosts. These are passed from client
|
||||
* side to host side when textures and compositables are created. Usually set
|
||||
* by the compositableCient, they may be modified by either the compositable or
|
||||
* texture clients.
|
||||
*
|
||||
* XXX - switch to all caps constant names which seems to be the standard in gecko
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
|
||||
NO_FLAGS = 0,
|
||||
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
|
||||
USE_NEAREST_FILTER = 1 << 0,
|
||||
// The texture should be flipped around the y-axis when composited.
|
||||
// The texture should be flipped along the y-axis when composited.
|
||||
NEEDS_Y_FLIP = 1 << 1,
|
||||
// Force the texture to be represented using a single tile (note that this means
|
||||
// tiled textures, not tiled layers).
|
||||
DISALLOW_BIGIMAGE = 1 << 2,
|
||||
// Allow using 'repeat' mode for wrapping.
|
||||
ALLOW_REPEAT = 1 << 3,
|
||||
// The texture represents a tile which is newly created.
|
||||
NEW_TILE = 1 << 4,
|
||||
// The texture is part of a component-alpha pair
|
||||
COMPONENT_ALPHA = 1 << 5,
|
||||
// The buffer will be treated as if the RB bytes are swapped.
|
||||
// This is useful for rendering using Cairo/Thebes, because there is no
|
||||
// BGRX Android pixel format, and so we have to do byte swapping.
|
||||
|
@ -52,45 +41,32 @@ MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
|
|||
// For example, if the GraphicBuffer has an Android pixel format of
|
||||
// PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
|
||||
// (for example, with GL), a BGRA shader should be used.
|
||||
RB_SWAPPED = 1 << 6,
|
||||
|
||||
FRONT = 1 << 7,
|
||||
// A texture host on white for component alpha
|
||||
ON_WHITE = 1 << 8,
|
||||
// A texture host on black for component alpha
|
||||
ON_BLACK = 1 << 9,
|
||||
// A texture host that supports tiling
|
||||
TILE = 1 << 10,
|
||||
// A texture should be recycled when no longer in used
|
||||
RECYCLE = 1 << 11,
|
||||
// Texture contents should be initialized
|
||||
// from the previous texture.
|
||||
COPY_PREVIOUS = 1 << 12,
|
||||
// Who is responsible for deallocating the shared data.
|
||||
// if DEALLOCATE_CLIENT is set, the shared data is deallocated on the
|
||||
RB_SWAPPED = 1 << 3,
|
||||
// Data in this texture has not been alpha-premultiplied.
|
||||
// XXX - Apparently only used with ImageClient/Host
|
||||
NON_PREMULTIPLIED = 1 << 4,
|
||||
// The texture should be recycled when no longer in used
|
||||
RECYCLE = 1 << 5,
|
||||
// If DEALLOCATE_CLIENT is set, the shared data is deallocated on the
|
||||
// client side and requires some extra synchronizaion to ensure race-free
|
||||
// deallocation.
|
||||
// The default behaviour is to deallocate on the host side.
|
||||
DEALLOCATE_CLIENT = 1 << 13,
|
||||
DEALLOCATE_CLIENT = 1 << 6,
|
||||
// After being shared ith the compositor side, an immutable texture is never
|
||||
// modified, it can only be read. It is safe to not Lock/Unlock immutable
|
||||
// textures.
|
||||
IMMUTABLE = 1 << 14,
|
||||
IMMUTABLE = 1 << 7,
|
||||
// The contents of the texture must be uploaded or copied immediately
|
||||
// during the transaction, because the producer may want to write
|
||||
// to it again.
|
||||
IMMEDIATE_UPLOAD = 1 << 15,
|
||||
// The texture is going to be used as part of a double
|
||||
// buffered pair, and so we can guarantee that the producer/consumer
|
||||
// won't be racing to access its contents.
|
||||
DOUBLE_BUFFERED = 1 << 16,
|
||||
// Data in this texture has not been alpha-premultiplied.
|
||||
NON_PREMULTIPLIED = 1 << 18,
|
||||
IMMEDIATE_UPLOAD = 1 << 8,
|
||||
// The texture is part of a component-alpha pair
|
||||
COMPONENT_ALPHA = 1 << 9,
|
||||
|
||||
// OR union of all valid bits
|
||||
ALL_BITS = (1 << 19) - 1,
|
||||
ALL_BITS = (1 << 10) - 1,
|
||||
// the default flags
|
||||
DEFAULT = FRONT
|
||||
DEFAULT = NO_FLAGS
|
||||
MOZ_END_ENUM_CLASS(TextureFlags)
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
|
||||
|
||||
|
@ -101,7 +77,6 @@ TextureRequiresLocking(TextureFlags aFlags)
|
|||
// within a transaction, then we need to support
|
||||
// locking correctly.
|
||||
return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
|
||||
TextureFlags::DOUBLE_BUFFERED |
|
||||
TextureFlags::IMMUTABLE));
|
||||
}
|
||||
|
||||
|
@ -158,24 +133,21 @@ MOZ_END_ENUM_CLASS(EffectTypes)
|
|||
* How the Compositable should manage textures.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
|
||||
BUFFER_UNKNOWN,
|
||||
// the deprecated compositable types
|
||||
BUFFER_CONTENT_INC, // painted layer interface, only sends incremental
|
||||
// updates to a texture on the compositor side.
|
||||
// somewhere in the middle
|
||||
BUFFER_TILED, // tiled painted layer
|
||||
BUFFER_SIMPLE_TILED,
|
||||
// the new compositable types
|
||||
UNKNOWN,
|
||||
CONTENT_INC, // painted layer interface, only sends incremental
|
||||
// updates to a texture on the compositor side.
|
||||
CONTENT_TILED, // tiled painted layer
|
||||
IMAGE, // image with single buffering
|
||||
IMAGE_OVERLAY, // image without buffer
|
||||
IMAGE_BRIDGE, // ImageBridge protocol
|
||||
CONTENT_SINGLE, // painted layer interface, single buffering
|
||||
CONTENT_DOUBLE, // painted layer interface, double buffering
|
||||
BUFFER_COUNT
|
||||
COUNT
|
||||
MOZ_END_ENUM_CLASS(CompositableType)
|
||||
|
||||
/**
|
||||
* How the texture host is used for composition,
|
||||
* XXX - Only used by ContentClientIncremental
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
|
||||
DEFAULT = 0, // The default texture host for the given SurfaceDescriptor
|
||||
|
@ -217,8 +189,8 @@ struct TextureFactoryIdentifier
|
|||
/**
|
||||
* Identify a texture to a compositable. Many textures can have the same id, but
|
||||
* the id is unique for any texture owned by a particular compositable.
|
||||
* XXX - This is now redundant with TextureFlags. it ill be removed along with
|
||||
* deprecated texture classes.
|
||||
* XXX - We don't really need this, it will be removed along with the incremental
|
||||
* ContentClient/Host.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
|
||||
Front = 1,
|
||||
|
@ -238,19 +210,21 @@ MOZ_END_ENUM_CLASS(TextureIdentifier)
|
|||
struct TextureInfo
|
||||
{
|
||||
CompositableType mCompositableType;
|
||||
// XXX - only used by ContentClientIncremental
|
||||
DeprecatedTextureHostFlags mDeprecatedTextureHostFlags;
|
||||
TextureFlags mTextureFlags;
|
||||
|
||||
TextureInfo()
|
||||
: mCompositableType(CompositableType::BUFFER_UNKNOWN)
|
||||
: mCompositableType(CompositableType::UNKNOWN)
|
||||
, mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
|
||||
, mTextureFlags(TextureFlags::NO_FLAGS)
|
||||
{}
|
||||
|
||||
explicit TextureInfo(CompositableType aType)
|
||||
explicit TextureInfo(CompositableType aType,
|
||||
TextureFlags aTextureFlags = TextureFlags::DEFAULT)
|
||||
: mCompositableType(aType)
|
||||
, mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
|
||||
, mTextureFlags(TextureFlags::NO_FLAGS)
|
||||
, mTextureFlags(aTextureFlags)
|
||||
{}
|
||||
|
||||
bool operator==(const TextureInfo& aOther) const
|
||||
|
|
|
@ -291,8 +291,6 @@ AppendToString(std::stringstream& aStream, TextureFlags flags,
|
|||
AppendFlag(TextureFlags::USE_NEAREST_FILTER);
|
||||
AppendFlag(TextureFlags::NEEDS_Y_FLIP);
|
||||
AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
|
||||
AppendFlag(TextureFlags::ALLOW_REPEAT);
|
||||
AppendFlag(TextureFlags::NEW_TILE);
|
||||
|
||||
#undef AppendFlag
|
||||
}
|
||||
|
|
|
@ -537,7 +537,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
|
|||
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
|
||||
RefPtr<DrawTarget> destDTBuffer;
|
||||
RefPtr<DrawTarget> destDTBufferOnWhite;
|
||||
uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
|
||||
uint32_t bufferFlags = 0;
|
||||
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
||||
bufferFlags |= BUFFER_COMPONENT_ALPHA;
|
||||
}
|
||||
|
|
|
@ -302,14 +302,12 @@ public:
|
|||
DrawIterator* aIter = nullptr);
|
||||
|
||||
enum {
|
||||
ALLOW_REPEAT = 0x01,
|
||||
BUFFER_COMPONENT_ALPHA = 0x02 // Dual buffers should be created for drawing with
|
||||
// component alpha.
|
||||
};
|
||||
/**
|
||||
* Return a new surface of |aSize| and |aType|.
|
||||
* @param aFlags if ALLOW_REPEAT is set, then the buffer should be configured
|
||||
* to allow repeat-mode, otherwise it should be in pad (clamp) mode
|
||||
*
|
||||
* If the created buffer supports azure content, then the result(s) will
|
||||
* be returned in aBlackDT/aWhiteDT, otherwise aBlackSurface/aWhiteSurface
|
||||
* will be used.
|
||||
|
|
|
@ -127,7 +127,7 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
|
|||
// the most effective way to make this work.
|
||||
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
|
||||
aFormat, aSize, BackendType::CAIRO,
|
||||
mTextureInfo.mTextureFlags | aFlags);
|
||||
mTextureFlags | aFlags);
|
||||
}
|
||||
|
||||
gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
|
||||
|
@ -138,7 +138,7 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
|
|||
// to use double buffering.
|
||||
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
|
||||
aFormat, aSize, backend,
|
||||
mTextureInfo.mTextureFlags | aFlags);
|
||||
mTextureFlags | aFlags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
CanvasClient(CompositableForwarder* aFwd, TextureFlags aFlags)
|
||||
: CompositableClient(aFwd, aFlags)
|
||||
{
|
||||
mTextureInfo.mTextureFlags = aFlags;
|
||||
mTextureFlags = aFlags;
|
||||
}
|
||||
|
||||
virtual ~CanvasClient() {}
|
||||
|
@ -64,9 +64,6 @@ public:
|
|||
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
|
||||
|
||||
virtual void Updated() { }
|
||||
|
||||
protected:
|
||||
TextureInfo mTextureInfo;
|
||||
};
|
||||
|
||||
// Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
|
||||
|
@ -81,7 +78,7 @@ public:
|
|||
|
||||
TextureInfo GetTextureInfo() const
|
||||
{
|
||||
return TextureInfo(CompositableType::IMAGE);
|
||||
return TextureInfo(CompositableType::IMAGE, mTextureFlags);
|
||||
}
|
||||
|
||||
virtual void Clear() MOZ_OVERRIDE
|
||||
|
@ -93,7 +90,7 @@ public:
|
|||
|
||||
virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT((mTextureInfo.mTextureFlags & aTexture->GetFlags()) == mTextureInfo.mTextureFlags);
|
||||
MOZ_ASSERT((mTextureFlags & aTexture->GetFlags()) == mTextureFlags);
|
||||
return CompositableClient::AddTextureClient(aTexture);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
explicit ClientImageLayer(ClientLayerManager* aLayerManager)
|
||||
: ImageLayer(aLayerManager,
|
||||
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
|
||||
, mImageClientTypeContainer(CompositableType::BUFFER_UNKNOWN)
|
||||
, mImageClientTypeContainer(CompositableType::UNKNOWN)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientImageLayer);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ protected:
|
|||
virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
|
||||
{
|
||||
ImageLayer::SetContainer(aContainer);
|
||||
mImageClientTypeContainer = CompositableType::BUFFER_UNKNOWN;
|
||||
mImageClientTypeContainer = CompositableType::UNKNOWN;
|
||||
}
|
||||
|
||||
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
|
||||
|
@ -96,7 +96,7 @@ protected:
|
|||
|
||||
CompositableType GetImageClientType()
|
||||
{
|
||||
if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
|
||||
if (mImageClientTypeContainer != CompositableType::UNKNOWN) {
|
||||
return mImageClientTypeContainer;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ protected:
|
|||
|
||||
mImageClientTypeContainer = autoLock.GetImage()
|
||||
? CompositableType::IMAGE
|
||||
: CompositableType::BUFFER_UNKNOWN;
|
||||
: CompositableType::UNKNOWN;
|
||||
return mImageClientTypeContainer;
|
||||
}
|
||||
|
||||
|
@ -142,10 +142,10 @@ ClientImageLayer::RenderLayer()
|
|||
if (!mImageClient ||
|
||||
!mImageClient->UpdateImage(mContainer, GetContentFlags())) {
|
||||
CompositableType type = GetImageClientType();
|
||||
if (type == CompositableType::BUFFER_UNKNOWN) {
|
||||
if (type == CompositableType::UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
TextureFlags flags = TextureFlags::FRONT;
|
||||
TextureFlags flags = TextureFlags::DEFAULT;
|
||||
if (mDisallowBigImage) {
|
||||
flags |= TextureFlags::DISALLOW_BIGIMAGE;
|
||||
}
|
||||
|
|
|
@ -56,10 +56,6 @@ static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFla
|
|||
result |= TextureFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
|
||||
if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
|
||||
result |= TextureFlags::ALLOW_REPEAT;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -286,10 +282,10 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
|
|||
|
||||
mSurfaceFormat = aFormat;
|
||||
mSize = gfx::IntSize(aRect.width, aRect.height);
|
||||
mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
|
||||
mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
|
||||
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
|
||||
mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
|
||||
CreateBackBuffer(mBufferRect);
|
||||
|
@ -301,7 +297,7 @@ ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
|
|||
// gfx::BackendType::NONE means fallback to the content backend
|
||||
mTextureClient = CreateTextureClientForDrawing(
|
||||
mSurfaceFormat, mSize, gfx::BackendType::NONE,
|
||||
mTextureInfo.mTextureFlags,
|
||||
mTextureFlags,
|
||||
TextureAllocationFlags::ALLOC_CLEAR_BUFFER
|
||||
);
|
||||
if (!mTextureClient || !AddTextureClient(mTextureClient)) {
|
||||
|
@ -309,9 +305,9 @@ ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
|
|||
return;
|
||||
}
|
||||
|
||||
if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
|
||||
if (mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
|
||||
mTextureClientOnWhite = mTextureClient->CreateSimilar(
|
||||
mTextureInfo.mTextureFlags,
|
||||
mTextureFlags,
|
||||
TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE
|
||||
);
|
||||
if (!mTextureClientOnWhite || !AddTextureClient(mTextureClientOnWhite)) {
|
||||
|
@ -702,9 +698,7 @@ ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer,
|
|||
neededRegion = aLayer->GetVisibleRegion();
|
||||
// If we're going to resample, we need a buffer that's in clamp mode.
|
||||
canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
|
||||
mHasBuffer &&
|
||||
(!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
|
||||
!(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
|
||||
mHasBuffer && !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
|
||||
|
||||
if (canReuseBuffer) {
|
||||
if (mBufferRect.Contains(neededRegion.GetBounds())) {
|
||||
|
@ -800,9 +794,6 @@ ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer,
|
|||
bool createdBuffer = false;
|
||||
|
||||
TextureFlags bufferFlags = TextureFlags::NO_FLAGS;
|
||||
if (canHaveRotation) {
|
||||
bufferFlags |= TextureFlags::ALLOW_REPEAT;
|
||||
}
|
||||
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
|
||||
bufferFlags |= TextureFlags::COMPONENT_ALPHA;
|
||||
}
|
||||
|
|
|
@ -253,11 +253,6 @@ public:
|
|||
virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
|
||||
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return mTextureInfo;
|
||||
}
|
||||
|
||||
protected:
|
||||
void DestroyBuffers();
|
||||
|
||||
|
@ -271,7 +266,6 @@ protected:
|
|||
|
||||
void CreateBackBuffer(const nsIntRect& aBufferRect);
|
||||
|
||||
|
||||
// Ensure we have a valid back buffer if we have a valid front buffer (i.e.
|
||||
// if a backbuffer has been created.)
|
||||
virtual void EnsureBackBufferIfFrontBuffer() {}
|
||||
|
@ -294,7 +288,6 @@ protected:
|
|||
// painting.
|
||||
nsTArray<RefPtr<TextureClient> > mOldTextures;
|
||||
|
||||
TextureInfo mTextureInfo;
|
||||
bool mIsNewBuffer;
|
||||
bool mFrontAndBackBufferDiffer;
|
||||
gfx::IntSize mSize;
|
||||
|
@ -317,9 +310,8 @@ class ContentClientDoubleBuffered : public ContentClientRemoteBuffer
|
|||
public:
|
||||
explicit ContentClientDoubleBuffered(CompositableForwarder* aFwd)
|
||||
: ContentClientRemoteBuffer(aFwd)
|
||||
{
|
||||
mTextureInfo.mCompositableType = CompositableType::CONTENT_DOUBLE;
|
||||
}
|
||||
{}
|
||||
|
||||
virtual ~ContentClientDoubleBuffered() {}
|
||||
|
||||
virtual void Clear() MOZ_OVERRIDE
|
||||
|
@ -341,6 +333,11 @@ public:
|
|||
|
||||
virtual void EnsureBackBufferIfFrontBuffer() MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return TextureInfo(CompositableType::CONTENT_DOUBLE, mTextureFlags);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -377,11 +374,15 @@ public:
|
|||
explicit ContentClientSingleBuffered(CompositableForwarder* aFwd)
|
||||
: ContentClientRemoteBuffer(aFwd)
|
||||
{
|
||||
mTextureInfo.mCompositableType = CompositableType::CONTENT_SINGLE;
|
||||
}
|
||||
virtual ~ContentClientSingleBuffered() {}
|
||||
|
||||
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return TextureInfo(CompositableType::CONTENT_SINGLE, mTextureFlags);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -400,7 +401,7 @@ public:
|
|||
, mHasBuffer(false)
|
||||
, mHasBufferOnWhite(false)
|
||||
{
|
||||
mTextureInfo.mCompositableType = CompositableType::BUFFER_CONTENT_INC;
|
||||
mTextureInfo.mCompositableType = CompositableType::CONTENT_INC;
|
||||
}
|
||||
|
||||
typedef RotatedContentBuffer::PaintState PaintState;
|
||||
|
|
|
@ -54,7 +54,7 @@ ImageClient::CreateImageClient(CompositableType aCompositableHostType,
|
|||
case CompositableType::IMAGE_BRIDGE:
|
||||
result = new ImageClientBridge(aForwarder, aFlags);
|
||||
break;
|
||||
case CompositableType::BUFFER_UNKNOWN:
|
||||
case CompositableType::UNKNOWN:
|
||||
result = nullptr;
|
||||
break;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|
|
|
@ -475,6 +475,9 @@ TextureClient::TextureClient(TextureFlags aFlags)
|
|||
, mShared(false)
|
||||
, mValid(true)
|
||||
, mAddedToCompositableClient(false)
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
, mPoolTracker(nullptr)
|
||||
#endif
|
||||
{}
|
||||
|
||||
TextureClient::~TextureClient()
|
||||
|
|
|
@ -37,6 +37,12 @@ class GLContext;
|
|||
class SharedSurface;
|
||||
}
|
||||
|
||||
// When defined, we track which pool the tile came from and test for
|
||||
// any inconsistencies. This can be defined in release build as well.
|
||||
#ifdef DEBUG
|
||||
#define GFX_DEBUG_TRACK_CLIENTS_IN_POOL 1
|
||||
#endif
|
||||
|
||||
namespace layers {
|
||||
|
||||
class AsyncTransactionTracker;
|
||||
|
@ -51,6 +57,9 @@ class PTextureChild;
|
|||
class TextureChild;
|
||||
class BufferTextureClient;
|
||||
class TextureClient;
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
class TextureClientPool;
|
||||
#endif
|
||||
class KeepAlive;
|
||||
|
||||
/**
|
||||
|
@ -474,6 +483,12 @@ protected:
|
|||
friend class RemoveTextureFromCompositableTracker;
|
||||
friend void TestTextureClientSurface(TextureClient*, gfxImageSurface*);
|
||||
friend void TestTextureClientYCbCr(TextureClient*, PlanarYCbCrData&);
|
||||
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
public:
|
||||
// Pointer to the pool this tile came from.
|
||||
TextureClientPool* mPoolTracker;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,8 @@ ShrinkCallback(nsITimer *aTimer, void *aClosure)
|
|||
static_cast<TextureClientPool*>(aClosure)->ShrinkToMinimumSize();
|
||||
}
|
||||
|
||||
TextureClientPool::TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
|
||||
TextureClientPool::TextureClientPool(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
uint32_t aMaxTextureClients,
|
||||
uint32_t aShrinkTimeoutMsec,
|
||||
ISurfaceAllocator *aAllocator)
|
||||
|
@ -42,6 +43,35 @@ TextureClientPool::~TextureClientPool()
|
|||
mTimer->Cancel();
|
||||
}
|
||||
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
static bool TestClientPool(const char* what,
|
||||
TextureClient* aClient,
|
||||
TextureClientPool* aPool)
|
||||
{
|
||||
TextureClientPool* actual = aClient->mPoolTracker;
|
||||
bool ok = (actual == aPool);
|
||||
if (ok) {
|
||||
ok = (aClient->GetFormat() == aPool->GetFormat());
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
if (actual) {
|
||||
gfxCriticalError() << "Pool error(" << what << "): "
|
||||
<< aPool << "-" << aPool->GetFormat() << ", "
|
||||
<< actual << "-" << actual->GetFormat() << ", "
|
||||
<< aClient->GetFormat();
|
||||
MOZ_CRASH("Crashing with actual");
|
||||
} else {
|
||||
gfxCriticalError() << "Pool error(" << what << "): "
|
||||
<< aPool << "-" << aPool->GetFormat() << ", nullptr, "
|
||||
<< aClient->GetFormat();
|
||||
MOZ_CRASH("Crashing without actual");
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
#endif
|
||||
|
||||
TemporaryRef<TextureClient>
|
||||
TextureClientPool::GetTextureClient()
|
||||
{
|
||||
|
@ -51,6 +81,10 @@ TextureClientPool::GetTextureClient()
|
|||
mOutstandingClients++;
|
||||
textureClient = mTextureClients.top();
|
||||
mTextureClients.pop();
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
DebugOnly<bool> ok = TestClientPool("fetch", textureClient, this);
|
||||
MOZ_ASSERT(ok);
|
||||
#endif
|
||||
return textureClient;
|
||||
}
|
||||
|
||||
|
@ -70,6 +104,9 @@ TextureClientPool::GetTextureClient()
|
|||
}
|
||||
|
||||
mOutstandingClients++;
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
textureClient->mPoolTracker = this;
|
||||
#endif
|
||||
return textureClient;
|
||||
}
|
||||
|
||||
|
@ -79,6 +116,10 @@ TextureClientPool::ReturnTextureClient(TextureClient *aClient)
|
|||
if (!aClient) {
|
||||
return;
|
||||
}
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
DebugOnly<bool> ok = TestClientPool("return", aClient, this);
|
||||
MOZ_ASSERT(ok);
|
||||
#endif
|
||||
// Add the client to the pool:
|
||||
MOZ_ASSERT(mOutstandingClients > mTextureClientsDeferred.size());
|
||||
mOutstandingClients--;
|
||||
|
@ -101,6 +142,10 @@ TextureClientPool::ReturnTextureClientDeferred(TextureClient *aClient)
|
|||
if (!aClient) {
|
||||
return;
|
||||
}
|
||||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
DebugOnly<bool> ok = TestClientPool("defer", aClient, this);
|
||||
MOZ_ASSERT(ok);
|
||||
#endif
|
||||
mTextureClientsDeferred.push(aClient);
|
||||
ShrinkToMaximumSize();
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ protected:
|
|||
public:
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return TextureInfo(CompositableType::BUFFER_TILED);
|
||||
return TextureInfo(CompositableType::CONTENT_TILED);
|
||||
}
|
||||
|
||||
virtual void ClearCachedResources() MOZ_OVERRIDE;
|
||||
|
|
|
@ -181,11 +181,10 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
|
|||
case CompositableType::IMAGE_BRIDGE:
|
||||
NS_ERROR("Cannot create an image bridge compositable this way");
|
||||
break;
|
||||
case CompositableType::BUFFER_CONTENT_INC:
|
||||
case CompositableType::CONTENT_INC:
|
||||
result = new ContentHostIncremental(aTextureInfo);
|
||||
break;
|
||||
case CompositableType::BUFFER_TILED:
|
||||
case CompositableType::BUFFER_SIMPLE_TILED:
|
||||
case CompositableType::CONTENT_TILED:
|
||||
result = new TiledContentHost(aTextureInfo);
|
||||
break;
|
||||
case CompositableType::IMAGE:
|
||||
|
|
|
@ -241,7 +241,7 @@ public:
|
|||
explicit ContentHostIncremental(const TextureInfo& aTextureInfo);
|
||||
~ContentHostIncremental();
|
||||
|
||||
virtual CompositableType GetType() { return CompositableType::BUFFER_CONTENT_INC; }
|
||||
virtual CompositableType GetType() { return CompositableType::CONTENT_INC; }
|
||||
|
||||
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ bool
|
|||
PaintedLayerComposite::SetCompositableHost(CompositableHost* aHost)
|
||||
{
|
||||
switch (aHost->GetType()) {
|
||||
case CompositableType::BUFFER_CONTENT_INC:
|
||||
case CompositableType::BUFFER_TILED:
|
||||
case CompositableType::CONTENT_INC:
|
||||
case CompositableType::CONTENT_TILED:
|
||||
case CompositableType::CONTENT_SINGLE:
|
||||
case CompositableType::CONTENT_DOUBLE:
|
||||
mBuffer = static_cast<ContentHost*>(aHost);
|
||||
|
|
|
@ -234,7 +234,7 @@ public:
|
|||
const gfx::Rect& aClipRect,
|
||||
const nsIntRegion* aVisibleRegion = nullptr);
|
||||
|
||||
virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; }
|
||||
virtual CompositableType GetType() { return CompositableType::CONTENT_TILED; }
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
|
|
|
@ -181,11 +181,15 @@ xh=x-western
|
|||
yi=he
|
||||
yo=x-western
|
||||
zh-cn=zh-CN
|
||||
# XXX : The following two entries are added as a quick fix (bug 251241).
|
||||
# XXX : The following five entries are added as a quick fix (bug 251241, bug 1104589).
|
||||
# When we have a general solution for ISO 15924 (script codes), the issue has
|
||||
# to be revisited.
|
||||
zh-hans=zh-CN
|
||||
zh-hant=zh-TW
|
||||
zh-latn=x-western
|
||||
ja-latn=x-western
|
||||
ko-latn=x-western
|
||||
#
|
||||
zh-tw=zh-TW
|
||||
zh-hk=zh-HK
|
||||
zh=zh-CN
|
||||
|
|
|
@ -105,25 +105,21 @@ nsLanguageAtomService::GetLanguageGroup(nsIAtom *aLanguage,
|
|||
}
|
||||
}
|
||||
|
||||
nsString langStr;
|
||||
nsAutoString langStr;
|
||||
aLanguage->ToString(langStr);
|
||||
|
||||
nsXPIDLString langGroupStr;
|
||||
res = mLangGroups->GetStringFromName(langStr.get(),
|
||||
getter_Copies(langGroupStr));
|
||||
if (NS_FAILED(res)) {
|
||||
int32_t hyphen = langStr.FindChar('-');
|
||||
if (hyphen >= 0) {
|
||||
nsAutoString truncated(langStr);
|
||||
truncated.Truncate(hyphen);
|
||||
res = mLangGroups->GetStringFromName(truncated.get(),
|
||||
getter_Copies(langGroupStr));
|
||||
if (NS_FAILED(res)) {
|
||||
langGroupStr.AssignLiteral("x-unicode");
|
||||
}
|
||||
} else {
|
||||
while (NS_FAILED(res)) {
|
||||
int32_t hyphen = langStr.RFindChar('-');
|
||||
if (hyphen <= 0) {
|
||||
langGroupStr.AssignLiteral("x-unicode");
|
||||
break;
|
||||
}
|
||||
langStr.Truncate(hyphen);
|
||||
res = mLangGroups->GetStringFromName(langStr.get(),
|
||||
getter_Copies(langGroupStr));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> langGroup = do_GetAtom(langGroupStr);
|
||||
|
|
|
@ -9,10 +9,19 @@
|
|||
#include "xpcprivate.h"
|
||||
#include "CPOWTimer.h"
|
||||
|
||||
CPOWTimer::~CPOWTimer() {
|
||||
CPOWTimer::~CPOWTimer()
|
||||
{
|
||||
/* This is a best effort to find the compartment responsible for this CPOW call */
|
||||
xpc::CompartmentPrivate* compartment = xpc::CompartmentPrivate::Get(js::GetObjectCompartment(mozilla::dom::GetIncumbentGlobal()
|
||||
->GetGlobalJSObject()));
|
||||
nsIGlobalObject *global = mozilla::dom::GetIncumbentGlobal();
|
||||
if (!global)
|
||||
return;
|
||||
JSObject *obj = global->GetGlobalJSObject();
|
||||
if (!obj)
|
||||
return;
|
||||
JSCompartment *compartment = js::GetObjectCompartment(obj);
|
||||
xpc::CompartmentPrivate *compartmentPrivate = xpc::CompartmentPrivate::Get(compartment);
|
||||
if (!compartmentPrivate)
|
||||
return;
|
||||
PRIntervalTime time = PR_IntervalNow() - startInterval;
|
||||
compartment->CPOWTime += time;
|
||||
compartmentPrivate->CPOWTime += time;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "asmjs/AsmJSModule.h"
|
||||
#include "asmjs/AsmJSValidate.h"
|
||||
#include "jit/IonMacroAssembler.h"
|
||||
#include "jit/MacroAssembler.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::jit;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "asmjs/AsmJSValidate.h"
|
||||
#include "builtin/SIMD.h"
|
||||
#include "gc/Marking.h"
|
||||
#include "jit/IonMacroAssembler.h"
|
||||
#include "jit/IonTypes.h"
|
||||
#include "jit/MacroAssembler.h"
|
||||
#ifdef JS_ION_PERF
|
||||
# include "jit/PerfSpewer.h"
|
||||
#endif
|
||||
|
|
|
@ -2293,7 +2293,7 @@ class FunctionCompiler
|
|||
MIRGraph * graph_;
|
||||
CompileInfo * info_;
|
||||
MIRGenerator * mirGen_;
|
||||
Maybe<IonContext> ionContext_;
|
||||
Maybe<JitContext> jitContext_;
|
||||
|
||||
MBasicBlock * curBlock_;
|
||||
|
||||
|
@ -2401,7 +2401,7 @@ class FunctionCompiler
|
|||
MOZ_ASSERT(locals_.count() == argTypes.length() + varInitializers_.length());
|
||||
|
||||
alloc_ = lifo_.new_<TempAllocator>(&lifo_);
|
||||
ionContext_.emplace(m_.cx(), alloc_);
|
||||
jitContext_.emplace(m_.cx(), alloc_);
|
||||
|
||||
graph_ = lifo_.new_<MIRGraph>(alloc_);
|
||||
info_ = lifo_.new_<CompileInfo>(locals_.count(), SequentialExecution);
|
||||
|
@ -7580,7 +7580,7 @@ CheckFunctionsSequential(ModuleCompiler &m)
|
|||
|
||||
int64_t before = PRMJ_Now();
|
||||
|
||||
IonContext icx(m.cx(), &mir->alloc());
|
||||
JitContext jcx(m.cx(), &mir->alloc());
|
||||
|
||||
IonSpewNewFunction(&mir->graph(), NullPtr());
|
||||
|
||||
|
@ -7687,7 +7687,7 @@ GetUsedTask(ModuleCompiler &m, ParallelGroupState &group, AsmJSParallelTask **ou
|
|||
|
||||
{
|
||||
// Perform code generation on the main thread.
|
||||
IonContext ionContext(m.cx(), &task->mir->alloc());
|
||||
JitContext jitContext(m.cx(), &task->mir->alloc());
|
||||
if (!GenerateCode(m, func, *task->mir, *task->lir))
|
||||
return false;
|
||||
}
|
||||
|
@ -8586,6 +8586,16 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
masm.storePtr(reg2, Address(reg0, offsetOfJitJSContext));
|
||||
}
|
||||
|
||||
MOZ_ASSERT(masm.framePushed() == framePushed);
|
||||
|
||||
// Reload the global register since Ion code can clobber any register.
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
|
||||
JS_STATIC_ASSERT(MaybeSavedGlobalReg > 0);
|
||||
masm.loadPtr(Address(StackPointer, savedGlobalOffset), GlobalReg);
|
||||
#else
|
||||
JS_STATIC_ASSERT(MaybeSavedGlobalReg == 0);
|
||||
#endif
|
||||
|
||||
masm.branchTestMagic(Assembler::Equal, JSReturnOperand, throwLabel);
|
||||
|
||||
Label oolConvert;
|
||||
|
@ -8609,16 +8619,6 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit
|
|||
Label done;
|
||||
masm.bind(&done);
|
||||
|
||||
MOZ_ASSERT(masm.framePushed() == framePushed);
|
||||
|
||||
// Reload the global register since Ion code can clobber any register.
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
|
||||
JS_STATIC_ASSERT(MaybeSavedGlobalReg > 0);
|
||||
masm.loadPtr(Address(StackPointer, savedGlobalOffset), GlobalReg);
|
||||
#else
|
||||
JS_STATIC_ASSERT(MaybeSavedGlobalReg == 0);
|
||||
#endif
|
||||
|
||||
// The heap pointer has to be reloaded anyway since Ion could have clobbered
|
||||
// it. Additionally, the FFI may have detached the heap buffer.
|
||||
masm.loadAsmJSHeapRegisterFromGlobalData();
|
||||
|
@ -9047,7 +9047,7 @@ FinishModule(ModuleCompiler &m,
|
|||
{
|
||||
LifoAlloc lifo(TempAllocator::PreferredLifoChunkSize);
|
||||
TempAllocator alloc(&lifo);
|
||||
IonContext ionContext(m.cx(), &alloc);
|
||||
JitContext jitContext(m.cx(), &alloc);
|
||||
|
||||
m.masm().resetForNewCodeGenerator(alloc);
|
||||
|
||||
|
|
|
@ -979,7 +979,10 @@ TypedArrayDataPtrFromArgs(JSContext *cx, const CallArgs &args, VElem **data)
|
|||
|
||||
int32_t byteStart = index * typedArray->bytesPerElement();
|
||||
if (byteStart < 0 || (uint32_t(byteStart) + NumElem * sizeof(VElem)) > typedArray->byteLength())
|
||||
return ErrorBadArgs(cx);
|
||||
{
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
return false;
|
||||
}
|
||||
|
||||
*data = reinterpret_cast<VElem*>(static_cast<char*>(typedArray->viewData()) + byteStart);
|
||||
return true;
|
||||
|
|
|
@ -2311,7 +2311,7 @@ InlineTypedObject::objectMovedDuringMinorGC(JSTracer *trc, JSObject *dst, JSObje
|
|||
uint8_t *oldData = reinterpret_cast<uint8_t *>(src) + offsetOfDataStart();
|
||||
uint8_t *newData = dst->as<InlineTypedObject>().inlineTypedMem();
|
||||
trc->runtime()->gc.nursery.maybeSetForwardingPointer(trc, oldData, newData,
|
||||
descr.size() >= sizeof(uintptr_t));
|
||||
size_t(descr.size()) >= sizeof(uintptr_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "prmjtime.h"
|
||||
|
||||
#include "gc/Heap.h"
|
||||
#include "jit/IonFrames.h"
|
||||
#include "jit/JitFrames.h"
|
||||
#include "jit/RematerializedFrame.h"
|
||||
#include "vm/ArrayObject.h"
|
||||
#include "vm/ForkJoin.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "gc/GCInternals.h"
|
||||
#include "gc/Memory.h"
|
||||
#include "jit/IonFrames.h"
|
||||
#include "jit/JitFrames.h"
|
||||
#include "vm/ArrayObject.h"
|
||||
#include "vm/Debugger.h"
|
||||
#if defined(DEBUG)
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче