зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-inbound to mozilla-central.
This commit is contained in:
Коммит
b790db0fab
2
CLOBBER
2
CLOBBER
|
@ -22,5 +22,5 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1003764 - Oh snap, Waldo did it again.
|
||||
Bug 1014976 - Windows debug bustage from linking changes.
|
||||
|
||||
|
|
|
@ -166,9 +166,6 @@ HTMLListBulletAccessible::Name(nsString &aName)
|
|||
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (blockFrame) {
|
||||
blockFrame->GetBulletText(aName);
|
||||
|
||||
// Append space otherwise bullets are jammed up against list text.
|
||||
aName.Append(' ');
|
||||
}
|
||||
|
||||
return eNameOK;
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
testText(IDs, 0, 1, kEmbedChar);
|
||||
|
||||
IDs = [ "listitem" ];
|
||||
testCharacterCount(IDs, 5);
|
||||
testText(IDs, 0, 5, "1.foo");
|
||||
testCharacterCount(IDs, 6);
|
||||
testText(IDs, 0, 6, "1. foo");
|
||||
|
||||
testText(["testbr"], 0, 3, "foo");
|
||||
|
||||
|
|
|
@ -118,17 +118,17 @@
|
|||
// list items
|
||||
|
||||
testTextAtOffset([ "li1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 5, kDiscBulletChar + "Item", 0, 5 ] ]);
|
||||
[ [ 0, 6, kDiscBulletText + "Item", 0, 6 ] ]);
|
||||
testTextAtOffset([ "li2" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 1, kDiscBulletChar, 0, 1 ] ]);
|
||||
[ [ 0, 2, kDiscBulletText, 0, 2 ] ]);
|
||||
testTextAtOffset([ "li3" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 7, kDiscBulletChar + "a long ", 0, 8 ],
|
||||
[ 8, 11, "and ", 8, 12 ] ]);
|
||||
[ [ 0, 8, kDiscBulletText + "a long ", 0, 9 ],
|
||||
[ 9, 12, "and ", 9, 13 ] ]);
|
||||
testTextAtOffset([ "li4" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 6, kDiscBulletChar + "a " + kEmbedChar + " c", 0, 6 ] ]);
|
||||
[ [ 0, 7, kDiscBulletText + "a " + kEmbedChar + " c", 0, 7 ] ]);
|
||||
testTextAtOffset([ "li5" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 1, kDiscBulletChar + "\n", 0, 2 ],
|
||||
[ 2, 6, "hello", 2, 7 ] ]);
|
||||
[ [ 0, 2, kDiscBulletText + "\n", 0, 3 ],
|
||||
[ 3, 7, "hello", 3, 8 ] ]);
|
||||
testTextAtOffset([ "ul1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 0, kEmbedChar, 0, 1 ],
|
||||
[ 1, 1, kEmbedChar, 1, 2 ],
|
||||
|
@ -137,17 +137,17 @@
|
|||
[ 4, 5, kEmbedChar, 4, 5 ] ]);
|
||||
|
||||
testTextAtOffset([ "li6" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 6, "1.Item", 0, 6 ] ]);
|
||||
[ [ 0, 7, "1. Item", 0, 7 ] ]);
|
||||
testTextAtOffset([ "li7" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 2, "2.", 0, 2 ] ]);
|
||||
[ [ 0, 3, "2. ", 0, 3 ] ]);
|
||||
testTextAtOffset([ "li8" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 8, "3.a long ", 0, 9 ],
|
||||
[ 9, 12, "and ", 9, 13 ] ]);
|
||||
[ [ 0, 9, "3. a long ", 0, 10 ],
|
||||
[ 10, 13, "and ", 10, 14 ] ]);
|
||||
testTextAtOffset([ "li9" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 7, "4.a " + kEmbedChar + " c", 0, 7 ] ]);
|
||||
[ [ 0, 8, "4. a " + kEmbedChar + " c", 0, 8 ] ]);
|
||||
testTextAtOffset([ "li10" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 2, "5.\n", 0, 3 ],
|
||||
[ 3, 7, "hello", 3, 8 ] ]);
|
||||
[ [ 0, 3, "5. \n", 0, 4 ],
|
||||
[ 4, 8, "hello", 4, 9 ] ]);
|
||||
testTextAtOffset([ "ol1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 0, kEmbedChar, 0, 1 ],
|
||||
[ 1, 1, kEmbedChar, 1, 2 ],
|
||||
|
|
|
@ -538,9 +538,9 @@
|
|||
var attrs = {
|
||||
"auto-generated": "true"
|
||||
};
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 2);
|
||||
testTextAttrs(ID, 2, { }, defAttrs, 2, 6);
|
||||
testTextAttrs(ID, 6, attrs, defAttrs, 6, 7);
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 3);
|
||||
testTextAttrs(ID, 3, { }, defAttrs, 3, 7);
|
||||
testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// area19, "HTML5 mark tag" test
|
||||
|
|
|
@ -22,8 +22,10 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
|||
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ENABLE_MARIONETTE
|
||||
DEFINES += -DENABLE_MARIONETTE=1
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
|
||||
#endif
|
||||
#ifdef XP_WIN32
|
||||
#ifndef MOZ_DEBUG
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
|
@ -81,7 +80,6 @@
|
|||
@BINPATH@/msvcr120.dll
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MOZ_SHARED_MOZGLUE
|
||||
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
|
||||
#endif
|
||||
|
@ -808,7 +806,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
|||
#endif
|
||||
|
||||
@BINPATH@/components/DataStore.manifest
|
||||
@BINPATH@/components/DataStoreService.js
|
||||
@BINPATH@/components/DataStoreImpl.js
|
||||
@BINPATH@/components/dom_datastore.xpt
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
. $topsrcdir/build/macosx/mozconfig.common
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-accessibility
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
. "$topsrcdir/browser/config/mozconfigs/common"
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-require-all-d3dc-versions
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ ac_add_options --target=x86_64-pc-mingw32
|
|||
ac_add_options --host=x86_64-pc-mingw32
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
|
|
|
@ -72,8 +72,10 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
|||
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
|
||||
DEFINES += -DMOZ_SHARED_MOZGLUE=1
|
||||
|
@ -136,6 +138,7 @@ endif
|
|||
ifdef MOZ_JEMALLOC3
|
||||
DEFINES += -DMOZ_JEMALLOC3
|
||||
endif
|
||||
DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX)
|
||||
|
||||
libs::
|
||||
$(MAKE) -C $(DEPTH)/browser/locales langpack
|
||||
|
|
|
@ -85,7 +85,6 @@
|
|||
#endif
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/plugin-hang-ui@BIN_SUFFIX@
|
||||
#ifndef MOZ_DEBUG
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
|
@ -97,19 +96,12 @@
|
|||
@BINPATH@/msvcr120.dll
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MOZ_NATIVE_ICU
|
||||
#ifdef MOZ_SHARED_ICU
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_DEBUG
|
||||
@BINPATH@/icudtd@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuind@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuucd@MOZ_ICU_VERSION@.dll
|
||||
#else
|
||||
@BINPATH@/icudt@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuin@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuuc@MOZ_ICU_VERSION@.dll
|
||||
#endif
|
||||
@BINPATH@/icudt@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuin@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuuc@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
#elif defined(XP_MACOSX)
|
||||
@BINPATH@/libicudata.@MOZ_ICU_VERSION@.dylib
|
||||
@BINPATH@/libicui18n.@MOZ_ICU_VERSION@.dylib
|
||||
|
@ -861,7 +853,7 @@ bin/libfreebl_32int64_3.so
|
|||
#endif
|
||||
|
||||
@BINPATH@/components/DataStore.manifest
|
||||
@BINPATH@/components/DataStoreService.js
|
||||
@BINPATH@/components/DataStoreImpl.js
|
||||
@BINPATH@/components/dom_datastore.xpt
|
||||
|
||||
|
||||
|
|
|
@ -122,7 +122,13 @@ MOZ_ARG_ENABLE_STRING(debug,
|
|||
fi ],
|
||||
MOZ_DEBUG=)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
|
||||
if test -z "$MOZ_DEBUG"; then
|
||||
MOZ_NO_DEBUG_RTL=1
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_NO_DEBUG_RTL)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -DTRACING"
|
||||
MOZ_ARG_WITH_STRING(debug-label,
|
||||
[ --with-debug-label=LABELS
|
||||
Define DEBUG_<value> for each comma-separated
|
||||
|
|
|
@ -48,17 +48,21 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
|||
CFLAGS=
|
||||
ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" \
|
||||
CXXCPP=\"cl -nologo -EP\" SHELL=sh.exe"
|
||||
rtl=
|
||||
if test -z "$MOZ_NO_DEBUG_RTL" -a -n "$MOZ_DEBUG"; then
|
||||
rtl=" -DUSE_DEBUG_RTL"
|
||||
fi
|
||||
case "${target_cpu}" in
|
||||
x86_64)
|
||||
# Need target since MSYS tools into mozilla-build may be 32bit
|
||||
ac_configure_args="$ac_configure_args \
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\""
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$rtl\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$rtl\""
|
||||
;;
|
||||
*)
|
||||
ac_configure_args="$ac_configure_args \
|
||||
CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh \
|
||||
CXX=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh"
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$rtl\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$rtl\""
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
|
|
@ -85,11 +85,11 @@ if test -n "$ENABLE_INTL_API"; then
|
|||
WINNT)
|
||||
ICU_LIB_NAMES="icuin icuuc icudt"
|
||||
if test -n "$MOZ_SHARED_ICU"; then
|
||||
DBG_SUFFIX=
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
DBG_SUFFIX=d
|
||||
MOZ_ICU_DBG_SUFFIX=
|
||||
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
MOZ_ICU_DBG_SUFFIX=d
|
||||
fi
|
||||
MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(DBG_SUFFIX).$(LIB_SUFFIX))'
|
||||
MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(MOZ_ICU_DBG_SUFFIX).$(LIB_SUFFIX))'
|
||||
fi
|
||||
;;
|
||||
Darwin)
|
||||
|
@ -113,7 +113,7 @@ if test -n "$ENABLE_INTL_API"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(DBG_SUFFIX)
|
||||
AC_SUBST(MOZ_ICU_DBG_SUFFIX)
|
||||
AC_SUBST(ENABLE_INTL_API)
|
||||
AC_SUBST(ICU_LIB_NAMES)
|
||||
AC_SUBST(MOZ_ICU_LIBS)
|
||||
|
@ -259,7 +259,7 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
|||
# But, not debug build.
|
||||
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
|
||||
else
|
||||
elif test -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
|
||||
fi
|
||||
fi
|
||||
|
@ -284,7 +284,7 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
|||
fi
|
||||
|
||||
# Add RTL flags for MSVCRT.DLL
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
ICU_CFLAGS="$ICU_CFLAGS -MDd"
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
|
||||
else
|
||||
|
|
|
@ -27,6 +27,8 @@ gyp_vars = {
|
|||
'build_libyuv': 0,
|
||||
'libyuv_dir': '/media/libyuv',
|
||||
'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
|
||||
# don't use openssl
|
||||
'use_openssl': 0,
|
||||
|
||||
# saves 4MB when webrtc_trace is off
|
||||
'enable_lazy_trace_alloc': 1,
|
||||
|
|
|
@ -7,7 +7,6 @@ MOZ_GLUE_LDFLAGS =
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifndef MOZ_DEBUG
|
||||
|
||||
ifeq (1600,$(_MSC_VER))
|
||||
REDIST_FILES = \
|
||||
|
@ -39,7 +38,6 @@ libs:: $(libs-preqs)
|
|||
install --preserve-timestamps $(foreach f,$(REDIST_FILES),'$(WIN32_REDIST_DIR)'/$(f)) $(FINAL_TARGET)
|
||||
endif
|
||||
|
||||
endif # ! MOZ_DEBUG
|
||||
endif # WIN32_REDIST_DIR
|
||||
|
||||
# run the binscope tool to make sure the binary and all libraries
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
# error "STL code can only be used with infallible ::operator new()"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef _DEBUG
|
||||
// From
|
||||
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
|
||||
// and
|
||||
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
|
||||
// there appear to be two types of STL container checking. The
|
||||
// former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
|
||||
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
|
||||
// looks to be full generation/mutation checked iterators as done by
|
||||
// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
|
||||
// is enabled by the following macros. It appears that the _DEBUG
|
||||
|
|
|
@ -347,7 +347,6 @@ commdlg.h
|
|||
compat.h
|
||||
condapi.h
|
||||
ConditionalMacros.h
|
||||
config.h
|
||||
conio.h
|
||||
console.h
|
||||
ControlDefinitions.h
|
||||
|
|
13
configure.in
13
configure.in
|
@ -2189,6 +2189,7 @@ ia64*-hpux*)
|
|||
dnl both SSSE3 and SSE4.1.
|
||||
HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
|
||||
HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
|
||||
MOZ_MEMORY=1
|
||||
fi
|
||||
AC_DEFINE(HAVE_SNPRINTF)
|
||||
AC_DEFINE(_WINDOWS)
|
||||
|
@ -7114,16 +7115,13 @@ else
|
|||
;;
|
||||
*-mingw*)
|
||||
AC_DEFINE(MOZ_MEMORY_WINDOWS)
|
||||
if test -z "$MOZ_DEBUG"; then
|
||||
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
|
||||
else
|
||||
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
|
||||
fi
|
||||
export MOZ_NO_DEBUG_RTL=1
|
||||
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
|
||||
dnl Look for a broken crtdll.obj
|
||||
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
|
||||
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
|
||||
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
|
||||
MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
|
||||
MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
|
||||
dnl Also pass this to NSPR/NSS
|
||||
DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
|
||||
else
|
||||
|
@ -9215,6 +9213,9 @@ if test -z "$MOZ_NATIVE_NSPR"; then
|
|||
ac_configure_args="$ac_configure_args --disable-debug"
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-debug"
|
||||
if test -n "$MOZ_NO_DEBUG_RTL"; then
|
||||
ac_configure_args="$ac_configure_args --disable-debug-rtl"
|
||||
fi
|
||||
fi
|
||||
if test "$MOZ_OPTIMIZE" = "1"; then
|
||||
ac_configure_args="$ac_configure_args --enable-optimize"
|
||||
|
|
|
@ -32,7 +32,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
|||
mAllowZoom(aAllowZoom),
|
||||
mAllowDoubleTapZoom(aAllowDoubleTapZoom)
|
||||
{
|
||||
mSize = mozilla::gfx::RoundedToInt(mozilla::ScreenSize(aDisplaySize) / mDefaultZoom);
|
||||
mSize = mozilla::ScreenSize(aDisplaySize) / mDefaultZoom;
|
||||
mozilla::CSSToLayoutDeviceScale pixelRatio(1.0f);
|
||||
mMinZoom = pixelRatio * kViewportMinScale;
|
||||
mMaxZoom = pixelRatio * kViewportMaxScale;
|
||||
|
@ -42,7 +42,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
|||
nsViewportInfo(const mozilla::CSSToScreenScale& aDefaultZoom,
|
||||
const mozilla::CSSToScreenScale& aMinZoom,
|
||||
const mozilla::CSSToScreenScale& aMaxZoom,
|
||||
const mozilla::CSSIntSize& aSize,
|
||||
const mozilla::CSSSize& aSize,
|
||||
bool aAutoSize,
|
||||
bool aAllowZoom,
|
||||
bool aAllowDoubleTapZoom) :
|
||||
|
@ -62,7 +62,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
|||
mozilla::CSSToScreenScale GetMinZoom() { return mMinZoom; }
|
||||
mozilla::CSSToScreenScale GetMaxZoom() { return mMaxZoom; }
|
||||
|
||||
mozilla::CSSIntSize GetSize() { return mSize; }
|
||||
mozilla::CSSSize GetSize() { return mSize; }
|
||||
|
||||
bool IsAutoSizeEnabled() { return mAutoSize; }
|
||||
bool IsZoomAllowed() { return mAllowZoom; }
|
||||
|
@ -90,7 +90,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
|||
mozilla::CSSToScreenScale mMaxZoom;
|
||||
|
||||
// The size of the viewport, specified by the <meta name="viewport"> tag.
|
||||
mozilla::CSSIntSize mSize;
|
||||
mozilla::CSSSize mSize;
|
||||
|
||||
// Whether or not we should automatically size the viewport to the device's
|
||||
// width. This is true if the document has been optimized for mobile, and
|
||||
|
|
|
@ -647,7 +647,7 @@ ContentSecurityPolicy.prototype = {
|
|||
}
|
||||
policy.log(WARN_FLAG, violationMessage,
|
||||
(aSourceFile) ? aSourceFile : null,
|
||||
(aScriptSample) ? decodeURIComponent(aScriptSample) : null,
|
||||
(aScriptSample) ? aScriptSample : null,
|
||||
(aLineNum) ? aLineNum : null);
|
||||
},
|
||||
|
||||
|
|
|
@ -7625,11 +7625,11 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
|||
}
|
||||
case Specified:
|
||||
default:
|
||||
CSSIntSize size = mViewportSize;
|
||||
CSSSize size = mViewportSize;
|
||||
|
||||
if (!mValidWidth) {
|
||||
if (mValidHeight && !aDisplaySize.IsEmpty()) {
|
||||
size.width = int32_t(size.height * aDisplaySize.width / aDisplaySize.height);
|
||||
size.width = size.height * aDisplaySize.width / aDisplaySize.height;
|
||||
} else {
|
||||
size.width = Preferences::GetInt("browser.viewport.desktopWidth",
|
||||
kViewportDefaultScreenWidth);
|
||||
|
@ -7638,7 +7638,7 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
|||
|
||||
if (!mValidHeight) {
|
||||
if (!aDisplaySize.IsEmpty()) {
|
||||
size.height = int32_t(size.width * aDisplaySize.height / aDisplaySize.width);
|
||||
size.height = size.width * aDisplaySize.height / aDisplaySize.width;
|
||||
} else {
|
||||
size.height = size.width;
|
||||
}
|
||||
|
@ -7654,28 +7654,28 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
|||
if (mAutoSize) {
|
||||
// aDisplaySize is in screen pixels; convert them to CSS pixels for the viewport size.
|
||||
CSSToScreenScale defaultPixelScale = pixelRatio * LayoutDeviceToScreenScale(1.0f);
|
||||
size = mozilla::gfx::RoundedToInt(ScreenSize(aDisplaySize) / defaultPixelScale);
|
||||
size = ScreenSize(aDisplaySize) / defaultPixelScale;
|
||||
}
|
||||
|
||||
size.width = clamped(size.width, kViewportMinSize.width, kViewportMaxSize.width);
|
||||
size.width = clamped(size.width, float(kViewportMinSize.width), float(kViewportMaxSize.width));
|
||||
|
||||
// Also recalculate the default zoom, if it wasn't specified in the metadata,
|
||||
// and the width is specified.
|
||||
if (mScaleStrEmpty && !mWidthStrEmpty) {
|
||||
CSSToScreenScale defaultScale(float(aDisplaySize.width) / float(size.width));
|
||||
CSSToScreenScale defaultScale(float(aDisplaySize.width) / size.width);
|
||||
scaleFloat = (scaleFloat > defaultScale) ? scaleFloat : defaultScale;
|
||||
}
|
||||
|
||||
size.height = clamped(size.height, kViewportMinSize.height, kViewportMaxSize.height);
|
||||
size.height = clamped(size.height, float(kViewportMinSize.height), float(kViewportMaxSize.height));
|
||||
|
||||
// We need to perform a conversion, but only if the initial or maximum
|
||||
// scale were set explicitly by the user.
|
||||
if (mValidScaleFloat) {
|
||||
CSSIntSize displaySize = RoundedToInt(ScreenSize(aDisplaySize) / scaleFloat);
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleFloat;
|
||||
size.width = std::max(size.width, displaySize.width);
|
||||
size.height = std::max(size.height, displaySize.height);
|
||||
} else if (mValidMaxScale) {
|
||||
CSSIntSize displaySize = RoundedToInt(ScreenSize(aDisplaySize) / scaleMaxFloat);
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleMaxFloat;
|
||||
size.width = std::max(size.width, displaySize.width);
|
||||
size.height = std::max(size.height, displaySize.height);
|
||||
}
|
||||
|
|
|
@ -1692,7 +1692,7 @@ private:
|
|||
mozilla::LayoutDeviceToScreenScale mScaleFloat;
|
||||
mozilla::CSSToLayoutDeviceScale mPixelRatio;
|
||||
bool mAutoSize, mAllowZoom, mAllowDoubleTapZoom, mValidScaleFloat, mValidMaxScale, mScaleStrEmpty, mWidthStrEmpty;
|
||||
mozilla::CSSIntSize mViewportSize;
|
||||
mozilla::CSSSize mViewportSize;
|
||||
|
||||
nsrefcnt mStackRefCnt;
|
||||
bool mNeedsReleaseAfterStackRefCntRelease;
|
||||
|
|
|
@ -131,12 +131,10 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
|
|||
MutexAutoLock lock(mMutex);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
jobject context = mozilla::AndroidBridge::Bridge()->GetGlobalContextRef();
|
||||
|
||||
// get the JVM
|
||||
JavaVM *jvm = mozilla::AndroidBridge::Bridge()->GetVM();
|
||||
|
||||
if (webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
|
||||
if (webrtc::VideoEngine::SetAndroidObjects(jvm) != 0) {
|
||||
LOG(("VieCapture:SetAndroidObjects Failed"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "webrtc/voice_engine/include/voe_call_report.h"
|
||||
|
||||
// Video Engine
|
||||
// conflicts with #include of scoped_ptr.h
|
||||
#undef FF
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_engine/include/vie_render.h"
|
||||
|
|
|
@ -5565,11 +5565,19 @@ nsDocShell::GetVisibility(bool * aVisibility)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent *shellContent =
|
||||
pPresShell->GetDocument()->FindContentForSubDocument(presShell->GetDocument());
|
||||
NS_ASSERTION(shellContent, "subshell not in the map");
|
||||
vm = presShell->GetViewManager();
|
||||
if (vm) {
|
||||
view = vm->GetRootView();
|
||||
}
|
||||
|
||||
nsIFrame* frame = shellContent ? shellContent->GetPrimaryFrame() : nullptr;
|
||||
if (view) {
|
||||
view = view->GetParent(); // anonymous inner view
|
||||
if (view) {
|
||||
view = view->GetParent(); // subdocumentframe's view
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = view ? view->GetFrame() : nullptr;
|
||||
bool isDocShellOffScreen = false;
|
||||
docShell->GetIsOffScreenBrowser(&isDocShellOffScreen);
|
||||
if (frame &&
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
#endif
|
||||
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsIDataStoreService.h"
|
||||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
|
@ -1466,8 +1466,7 @@ Navigator::GetDataStores(nsPIDOMWindow* aWindow,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDataStoreService> service =
|
||||
do_GetService("@mozilla.org/datastore-service;1");
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::GetOrCreate();
|
||||
if (!service) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
|
|
@ -341,7 +341,18 @@ URL::UpdateURLSearchParams()
|
|||
void
|
||||
URL::GetHostname(nsString& aHostname) const
|
||||
{
|
||||
URL_GETTER(aHostname, GetHost);
|
||||
aHostname.Truncate();
|
||||
nsAutoCString tmp;
|
||||
nsresult rv = mURI->GetHost(tmp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (tmp.FindChar(':') != -1) { // Escape IPv6 address
|
||||
MOZ_ASSERT(!tmp.Length() ||
|
||||
(tmp[0] !='[' && tmp[tmp.Length() - 1] != ']'));
|
||||
tmp.Insert('[', 0);
|
||||
tmp.Append(']');
|
||||
}
|
||||
CopyUTF8toUTF16(tmp, aHostname);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsIDOMEventListener.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsLocation.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
@ -344,9 +343,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(WindowUtils, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(XSLTProcessor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
|
@ -854,10 +850,6 @@ nsDOMClassInfo::Init()
|
|||
#endif
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -42,9 +42,6 @@ DOMCI_CLASS(TreeColumn)
|
|||
DOMCI_CLASS(CSSMozDocumentRule)
|
||||
DOMCI_CLASS(CSSSupportsRule)
|
||||
|
||||
// WindowUtils
|
||||
DOMCI_CLASS(WindowUtils)
|
||||
|
||||
// XSLTProcessor
|
||||
DOMCI_CLASS(XSLTProcessor)
|
||||
|
||||
|
|
|
@ -103,13 +103,10 @@ class gfxContext;
|
|||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
DOMCI_DATA(WindowUtils, nsDOMWindowUtils)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WindowUtils)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMWindowUtils)
|
||||
|
@ -318,8 +315,9 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
|||
*aAllowZoom = info.IsZoomAllowed();
|
||||
*aMinZoom = info.GetMinZoom().scale;
|
||||
*aMaxZoom = info.GetMaxZoom().scale;
|
||||
*aWidth = info.GetSize().width;
|
||||
*aHeight = info.GetSize().height;
|
||||
CSSIntSize size = gfx::RoundedToInt(info.GetSize());
|
||||
*aWidth = size.width;
|
||||
*aHeight = size.height;
|
||||
*aAutoSize = info.IsAutoSizeEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1657,8 +1657,10 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
|
|||
#endif
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
// Attempt to initialize DMD functions
|
||||
::JS_DefineFunctions(cx, aGlobalObj, DMDFunctions);
|
||||
if (nsContentUtils::IsCallerChrome()) {
|
||||
// Attempt to initialize DMD functions
|
||||
::JS_DefineFunctions(cx, aGlobalObj, DMDFunctions);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
|
|
|
@ -292,5 +292,32 @@
|
|||
url.hostname = "";
|
||||
is(url.href, "http://localhost/", "Empty hostname is ignored");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/** Test for Bug 960014 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "[2001::1]";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.href, "http://[2001::1]/");
|
||||
|
||||
url.hostname = "[::192.9.5.5]";
|
||||
is(url.hostname, "[::192.9.5.5]", "IPv6 hostname");
|
||||
is(url.href, "http://[::192.9.5.5]/");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.hostname = "[::]";
|
||||
is(url.hostname, "[::]", "IPv6 hostname");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.host = "[2001::1]:30";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.port, 30, "Port");
|
||||
is(url.host, "[2001::1]:30", "IPv6 host");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
// This should silently fail since it's missing the brackets
|
||||
url.hostname = "2001::1";
|
||||
is(url.hostname, "localhost", "Setting bad hostname fails");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
component {d193d0e2-c677-4a7b-bb0a-19155b470f2e} DataStoreService.js
|
||||
contract @mozilla.org/datastore-service;1 {d193d0e2-c677-4a7b-bb0a-19155b470f2e}
|
||||
component {db5c9602-030f-4bff-a3de-881a8de370f2} DataStoreImpl.js
|
||||
contract @mozilla.org/dom/datastore;1 {db5c9602-030f-4bff-a3de-881a8de370f2}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_DataStoreCallbacks_h
|
||||
#define mozilla_dom_DataStoreCallbacks_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DataStoreDB;
|
||||
|
||||
class DataStoreDBCallback
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
||||
|
||||
virtual void Run(DataStoreDB* aDb, bool aSuccess) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DataStoreDBCallback()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DataStoreRevisionCallback
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
||||
|
||||
virtual void Run(const nsAString& aRevisionID) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DataStoreRevisionCallback()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
|
||||
#endif // mozilla_dom_DataStoreCallbacks_h
|
|
@ -12,9 +12,6 @@ function debug(s) {
|
|||
//dump('DEBUG DataStoreChangeNotifier: ' + s + '\n');
|
||||
}
|
||||
|
||||
// DataStoreServiceInternal should not be converted into a lazy getter as it
|
||||
// runs code during initialization.
|
||||
Cu.import('resource://gre/modules/DataStoreServiceInternal.jsm');
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DataStoreDB.h"
|
||||
|
||||
#include "DataStoreCallbacks.h"
|
||||
#include "mozilla/dom/IDBDatabaseBinding.h"
|
||||
#include "mozilla/dom/IDBFactoryBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IDBDatabase.h"
|
||||
#include "mozilla/dom/indexedDB/IDBFactory.h"
|
||||
#include "mozilla/dom/indexedDB/IDBIndex.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
#include "mozilla/dom/indexedDB/IDBRequest.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#define DATASTOREDB_VERSION 1
|
||||
#define DATASTOREDB_NAME "DataStoreDB"
|
||||
#define DATASTOREDB_REVISION_INDEX "revisionIndex"
|
||||
|
||||
using namespace mozilla::dom::indexedDB;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(DataStoreDB, nsIDOMEventListener)
|
||||
|
||||
DataStoreDB::DataStoreDB(const nsAString& aManifestURL, const nsAString& aName)
|
||||
: mState(Inactive)
|
||||
{
|
||||
mDatabaseName.Assign(aName);
|
||||
mDatabaseName.AppendASCII("|");
|
||||
mDatabaseName.Append(aManifestURL);
|
||||
}
|
||||
|
||||
DataStoreDB::~DataStoreDB()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::CreateFactoryIfNeeded()
|
||||
{
|
||||
if (!mFactory) {
|
||||
nsresult rv = IDBFactory::Create(nullptr, getter_AddRefs(mFactory));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::Open(IDBTransactionMode aMode, const Sequence<nsString>& aDbs,
|
||||
DataStoreDBCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(mState == Inactive);
|
||||
|
||||
nsresult rv = CreateFactoryIfNeeded();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
mRequest = mFactory->Open(mDatabaseName, DATASTOREDB_VERSION, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
rv = AddEventListeners();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mState = Active;
|
||||
mTransactionMode = aMode;
|
||||
mObjectStores = aDbs;
|
||||
mCallback = aCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataStoreDB::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsString type;
|
||||
nsresult rv = aEvent->GetType(type);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("success")) {
|
||||
RemoveEventListeners();
|
||||
mState = Inactive;
|
||||
|
||||
rv = DatabaseOpened();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mCallback->Run(this, false);
|
||||
} else {
|
||||
mCallback->Run(this, true);
|
||||
}
|
||||
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("upgradeneeded")) {
|
||||
return UpgradeSchema();
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("error") || type.EqualsASCII("blocked")) {
|
||||
RemoveEventListeners();
|
||||
mState = Inactive;
|
||||
mCallback->Run(this, false);
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::UpgradeSchema()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
ErrorResult error;
|
||||
JS::Rooted<JS::Value> result(cx, mRequest->GetResult(error));
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.isObject());
|
||||
|
||||
IDBDatabase* database = nullptr;
|
||||
nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Didn't get the object we expected!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
{
|
||||
RootedDictionary<IDBObjectStoreParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true }"));
|
||||
nsRefPtr<IDBObjectStore> store =
|
||||
database->CreateObjectStore(cx, NS_LITERAL_STRING(DATASTOREDB_NAME),
|
||||
params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<IDBObjectStore> store;
|
||||
|
||||
{
|
||||
RootedDictionary<IDBObjectStoreParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true, \"keyPath\": \"internalRevisionId\" }"));
|
||||
|
||||
store =
|
||||
database->CreateObjectStore(cx, NS_LITERAL_STRING(DATASTOREDB_REVISION),
|
||||
params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RootedDictionary<IDBIndexParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"unique\": true }"));
|
||||
nsRefPtr<IDBIndex> index =
|
||||
store->CreateIndex(cx, NS_LITERAL_STRING(DATASTOREDB_REVISION_INDEX),
|
||||
NS_LITERAL_STRING("revisionId"), params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::DatabaseOpened()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
ErrorResult error;
|
||||
JS::Rooted<JS::Value> result(cx, mRequest->GetResult(error));
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.isObject());
|
||||
|
||||
nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), mDatabase);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Didn't get the object we expected!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBTransaction> txn = mDatabase->Transaction(mObjectStores,
|
||||
mTransactionMode,
|
||||
error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
mTransaction = txn.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::Delete()
|
||||
{
|
||||
MOZ_ASSERT(mState == Inactive);
|
||||
|
||||
nsresult rv = CreateFactoryIfNeeded();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mTransaction = nullptr;
|
||||
|
||||
if (mDatabase) {
|
||||
rv = mDatabase->Close();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mDatabase = nullptr;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
nsRefPtr<IDBOpenDBRequest> request =
|
||||
mFactory->DeleteDatabase(mDatabaseName, IDBOpenDBOptions(), error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
indexedDB::IDBTransaction*
|
||||
DataStoreDB::Transaction() const
|
||||
{
|
||||
MOZ_ASSERT(mTransaction);
|
||||
MOZ_ASSERT(mTransaction->IsOpen());
|
||||
return mTransaction;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::AddEventListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("upgradeneeded"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("error"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("blocked"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::RemoveEventListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("upgradeneeded"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("error"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("blocked"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,82 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_DataStoreDB_h
|
||||
#define mozilla_dom_DataStoreDB_h
|
||||
|
||||
#include "mozilla/dom/IDBTransactionBinding.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define DATASTOREDB_REVISION "revision"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace indexedDB {
|
||||
class IDBDatabase;
|
||||
class IDBFactory;
|
||||
class IDBObjectStore;
|
||||
class IDBOpenDBRequest;
|
||||
class IDBTransaction;
|
||||
}
|
||||
|
||||
class DataStoreDBCallback;
|
||||
|
||||
class DataStoreDB MOZ_FINAL : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DataStoreDB(const nsAString& aManifestURL, const nsAString& aName);
|
||||
~DataStoreDB();
|
||||
|
||||
nsresult Open(IDBTransactionMode aMode, const Sequence<nsString>& aDb,
|
||||
DataStoreDBCallback* aCallback);
|
||||
|
||||
nsresult Delete();
|
||||
|
||||
indexedDB::IDBTransaction* Transaction() const;
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
private:
|
||||
nsresult CreateFactoryIfNeeded();
|
||||
|
||||
nsresult UpgradeSchema();
|
||||
|
||||
nsresult DatabaseOpened();
|
||||
|
||||
nsresult AddEventListeners();
|
||||
|
||||
nsresult RemoveEventListeners();
|
||||
|
||||
nsString mDatabaseName;
|
||||
|
||||
nsRefPtr<indexedDB::IDBFactory> mFactory;
|
||||
nsRefPtr<indexedDB::IDBOpenDBRequest> mRequest;
|
||||
nsRefPtr<indexedDB::IDBDatabase> mDatabase;
|
||||
nsRefPtr<indexedDB::IDBTransaction> mTransaction;
|
||||
|
||||
nsRefPtr<DataStoreDBCallback> mCallback;
|
||||
|
||||
// Internal state to avoid strange use of this class.
|
||||
enum StateType {
|
||||
Inactive,
|
||||
Active
|
||||
} mState;
|
||||
|
||||
IDBTransactionMode mTransactionMode;
|
||||
Sequence<nsString> mObjectStores;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DataStoreDB_h
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
'use strict'
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DataStore"];
|
||||
|
||||
function debug(s) {
|
||||
//dump('DEBUG DataStore: ' + s + '\n');
|
||||
}
|
||||
|
@ -59,17 +57,16 @@ function validateId(aId) {
|
|||
}
|
||||
|
||||
/* DataStore object */
|
||||
this.DataStore = function(aWindow, aName, aOwner, aReadOnly) {
|
||||
function DataStore() {
|
||||
debug("DataStore created");
|
||||
this.init(aWindow, aName, aOwner, aReadOnly);
|
||||
}
|
||||
|
||||
this.DataStore.prototype = {
|
||||
DataStore.prototype = {
|
||||
classDescription: "DataStore XPCOM Component",
|
||||
classID: Components.ID("{db5c9602-030f-4bff-a3de-881a8de370f2}"),
|
||||
contractID: "@mozilla.org/dom/datastore-impl;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports,
|
||||
Components.interfaces.nsIObserver]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDataStore, Ci.nsISupports,
|
||||
Ci.nsIObserver]),
|
||||
|
||||
callbacks: [],
|
||||
|
||||
|
@ -536,3 +533,5 @@ this.DataStore.prototype = {
|
|||
return exposedCursor;
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataStore]);
|
|
@ -0,0 +1,102 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DataStoreRevision.h"
|
||||
|
||||
#include "DataStoreCallbacks.h"
|
||||
#include "DataStoreService.h"
|
||||
#include "mozilla/dom/DataStoreBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace indexedDB;
|
||||
|
||||
NS_IMPL_ISUPPORTS(DataStoreRevision, nsIDOMEventListener)
|
||||
|
||||
// Note: this code in it must not assume anything about the compartment cx is
|
||||
// in.
|
||||
nsresult
|
||||
DataStoreRevision::AddRevision(JSContext* aCx,
|
||||
IDBObjectStore* aStore,
|
||||
uint32_t aObjectId,
|
||||
RevisionType aRevisionType,
|
||||
DataStoreRevisionCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(aStore);
|
||||
MOZ_ASSERT(aCallback);
|
||||
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::Get();
|
||||
if (!service) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsString id;
|
||||
nsresult rv = service->GenerateUUID(mRevisionID);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
DataStoreRevisionData data;
|
||||
data.mRevisionId = mRevisionID;
|
||||
data.mObjectId = aObjectId;
|
||||
|
||||
switch (aRevisionType) {
|
||||
case RevisionVoid:
|
||||
data.mOperation = NS_LITERAL_STRING("void");
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
break;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!data.ToObject(aCx, &value)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
mRequest = aStore->Put(aCx, value, JS::UndefinedHandleValue, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mCallback = aCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataStoreRevision::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsString type;
|
||||
nsresult rv = aEvent->GetType(type);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!type.EqualsASCII("success")) {
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mRequest->RemoveEventListener(NS_LITERAL_STRING("success"), this, false);
|
||||
mRequest = nullptr;
|
||||
|
||||
mCallback->Run(mRevisionID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
|
@ -0,0 +1,52 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_DataStoreRevision_h
|
||||
#define mozilla_dom_DataStoreRevision_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace indexedDB {
|
||||
class IDBObjectStore;
|
||||
class IDBRequest;
|
||||
}
|
||||
|
||||
class DataStoreRevisionCallback;
|
||||
|
||||
class DataStoreRevision MOZ_FINAL : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
enum RevisionType {
|
||||
RevisionVoid
|
||||
};
|
||||
|
||||
nsresult AddRevision(JSContext* aCx,
|
||||
indexedDB::IDBObjectStore* aStore,
|
||||
uint32_t aObjectId,
|
||||
RevisionType aRevisionType,
|
||||
DataStoreRevisionCallback* aCallback);
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
private:
|
||||
nsRefPtr<DataStoreRevisionCallback> mCallback;
|
||||
nsRefPtr<indexedDB::IDBRequest> mRequest;
|
||||
nsString mRevisionID;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DataStoreRevision_h
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,110 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_DataStoreService_h
|
||||
#define mozilla_dom_DataStoreService_h
|
||||
|
||||
#include "mozilla/dom/PContent.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsIDataStoreService.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
class nsIUUIDGenerator;
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DataStoreInfo;
|
||||
class FirstRevisionIdCallback;
|
||||
class PendingRequest;
|
||||
class Promise;
|
||||
class RetrieveRevisionsCounter;
|
||||
class RevisionAddedEnableStoreCallback;
|
||||
|
||||
class DataStoreService MOZ_FINAL : public nsIDataStoreService
|
||||
, public nsIObserver
|
||||
{
|
||||
friend class ContentChild;
|
||||
friend class FirstRevisionIdCallback;
|
||||
friend class RetrieveRevisionsCounter;
|
||||
friend class RevisionAddedEnableStoreCallback;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIDATASTORESERVICE
|
||||
|
||||
// Returns the DataStoreService singleton. Only to be called from main
|
||||
// thread.
|
||||
static already_AddRefed<DataStoreService> GetOrCreate();
|
||||
|
||||
static already_AddRefed<DataStoreService> Get();
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
nsresult GenerateUUID(nsAString& aID);
|
||||
|
||||
nsresult GetDataStoresFromIPC(const nsAString& aName,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<DataStoreSetting>* aValue);
|
||||
|
||||
private:
|
||||
DataStoreService();
|
||||
~DataStoreService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
typedef nsClassHashtable<nsUint32HashKey, DataStoreInfo> HashApp;
|
||||
|
||||
nsresult AddPermissions(uint32_t aAppId, const nsAString& aName,
|
||||
const nsAString& aOriginURL,
|
||||
const nsAString& aManifestURL,
|
||||
bool aReadOnly);
|
||||
|
||||
nsresult AddAccessPermissions(uint32_t aAppId, const nsAString& aName,
|
||||
const nsAString& aOriginURL,
|
||||
const nsAString& aManifestURL,
|
||||
bool aReadOnly);
|
||||
|
||||
nsresult CreateFirstRevisionId(uint32_t aAppId, const nsAString& aName,
|
||||
const nsAString& aManifestURL);
|
||||
|
||||
void GetDataStoresCreate(nsPIDOMWindow* aWindow, Promise* aPromise,
|
||||
const nsTArray<DataStoreInfo>& aStores);
|
||||
|
||||
void GetDataStoresResolve(nsPIDOMWindow* aWindow, Promise* aPromise,
|
||||
const nsTArray<DataStoreInfo>& aStores);
|
||||
|
||||
nsresult GetDataStoreInfos(const nsAString& aName, uint32_t aAppId,
|
||||
nsTArray<DataStoreInfo>& aStores);
|
||||
|
||||
void DeleteDataStores(uint32_t aAppId);
|
||||
|
||||
nsresult EnableDataStore(uint32_t aAppId, const nsAString& aName,
|
||||
const nsAString& aManifestURL);
|
||||
|
||||
already_AddRefed<RetrieveRevisionsCounter> GetCounter(uint32_t aId) const;
|
||||
|
||||
void RemoveCounter(uint32_t aId);
|
||||
|
||||
nsClassHashtable<nsStringHashKey, HashApp> mStores;
|
||||
nsClassHashtable<nsStringHashKey, HashApp> mAccessStores;
|
||||
|
||||
typedef nsTArray<PendingRequest> PendingRequests;
|
||||
nsClassHashtable<nsStringHashKey, PendingRequests> mPendingRequests;
|
||||
|
||||
nsRefPtrHashtable<nsUint32HashKey, RetrieveRevisionsCounter> mPendingCounters;
|
||||
|
||||
nsCOMPtr<nsIUUIDGenerator> mUUIDGenerator;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DataStoreService_h
|
|
@ -1,522 +0,0 @@
|
|||
/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
'use strict'
|
||||
|
||||
/* static functions */
|
||||
|
||||
function debug(s) {
|
||||
//dump('DEBUG DataStoreService: ' + s + '\n');
|
||||
}
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/DataStoreImpl.jsm');
|
||||
Cu.import("resource://gre/modules/DataStoreDB.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "permissionManager",
|
||||
"@mozilla.org/permissionmanager;1",
|
||||
"nsIPermissionManager");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "secMan",
|
||||
"@mozilla.org/scriptsecuritymanager;1",
|
||||
"nsIScriptSecurityManager");
|
||||
|
||||
/* DataStoreService */
|
||||
|
||||
const DATASTORESERVICE_CID = Components.ID('{d193d0e2-c677-4a7b-bb0a-19155b470f2e}');
|
||||
const REVISION_VOID = "void";
|
||||
|
||||
function DataStoreService() {
|
||||
debug('DataStoreService Constructor');
|
||||
|
||||
this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
|
||||
if (this.inParent) {
|
||||
let obs = Services.obs;
|
||||
if (!obs) {
|
||||
debug("DataStore Error: observer-service is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
obs.addObserver(this, 'webapps-clear-data', false);
|
||||
}
|
||||
|
||||
let self = this;
|
||||
cpmm.addMessageListener("datastore-first-revision-created",
|
||||
function(aMsg) { self.receiveMessage(aMsg); });
|
||||
}
|
||||
|
||||
DataStoreService.prototype = {
|
||||
inParent: false,
|
||||
|
||||
// Hash of DataStores
|
||||
stores: {},
|
||||
accessStores: {},
|
||||
pendingRequests: {},
|
||||
|
||||
installDataStore: function(aAppId, aName, aOrigin, aOwner, aReadOnly) {
|
||||
debug('installDataStore - appId: ' + aAppId + ', aName: ' +
|
||||
aName + ', aOrigin: ' + aOrigin + ', aOwner:' + aOwner +
|
||||
', aReadOnly: ' + aReadOnly);
|
||||
|
||||
this.checkIfInParent();
|
||||
|
||||
if (aName in this.stores && aAppId in this.stores[aName]) {
|
||||
debug('This should not happen');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(aName in this.stores)) {
|
||||
this.stores[aName] = {};
|
||||
}
|
||||
|
||||
// A DataStore is enabled when it has a first valid revision.
|
||||
this.stores[aName][aAppId] = { origin: aOrigin, owner: aOwner,
|
||||
readOnly: aReadOnly, enabled: false };
|
||||
|
||||
this.addPermissions(aAppId, aName, aOrigin, aOwner, aReadOnly);
|
||||
|
||||
this.createFirstRevisionId(aAppId, aName, aOwner);
|
||||
},
|
||||
|
||||
installAccessDataStore: function(aAppId, aName, aOrigin, aOwner, aReadOnly) {
|
||||
debug('installAccessDataStore - appId: ' + aAppId + ', aName: ' +
|
||||
aName + ', aOrigin: ' + aOrigin + ', aOwner:' + aOwner +
|
||||
', aReadOnly: ' + aReadOnly);
|
||||
|
||||
this.checkIfInParent();
|
||||
|
||||
if (aName in this.accessStores && aAppId in this.accessStores[aName]) {
|
||||
debug('This should not happen');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(aName in this.accessStores)) {
|
||||
this.accessStores[aName] = {};
|
||||
}
|
||||
|
||||
this.accessStores[aName][aAppId] = { origin: aOrigin, owner: aOwner,
|
||||
readOnly: aReadOnly };
|
||||
this.addAccessPermissions(aAppId, aName, aOrigin, aOwner, aReadOnly);
|
||||
},
|
||||
|
||||
checkIfInParent: function() {
|
||||
if (!this.inParent) {
|
||||
throw "DataStore can execute this operation just in the parent process";
|
||||
}
|
||||
},
|
||||
|
||||
createFirstRevisionId: function(aAppId, aName, aOwner) {
|
||||
debug("createFirstRevisionId database: " + aName);
|
||||
|
||||
let self = this;
|
||||
let db = new DataStoreDB();
|
||||
db.init(aOwner, aName);
|
||||
db.revisionTxn(
|
||||
'readwrite',
|
||||
function(aTxn, aRevisionStore) {
|
||||
debug("createFirstRevisionId - transaction success");
|
||||
|
||||
let request = aRevisionStore.openCursor(null, 'prev');
|
||||
request.onsuccess = function(aEvent) {
|
||||
let cursor = aEvent.target.result;
|
||||
if (cursor) {
|
||||
debug("First revision already created.");
|
||||
self.enableDataStore(aAppId, aName, aOwner);
|
||||
} else {
|
||||
// If the revision doesn't exist, let's create the first one.
|
||||
db.addRevision(aRevisionStore, 0, REVISION_VOID, function() {
|
||||
debug("First revision created.");
|
||||
self.enableDataStore(aAppId, aName, aOwner);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
enableDataStore: function(aAppId, aName, aOwner) {
|
||||
if (aName in this.stores && aAppId in this.stores[aName]) {
|
||||
this.stores[aName][aAppId].enabled = true;
|
||||
ppmm.broadcastAsyncMessage('datastore-first-revision-created',
|
||||
{ name: aName, owner: aOwner });
|
||||
}
|
||||
},
|
||||
|
||||
addPermissions: function(aAppId, aName, aOrigin, aOwner, aReadOnly) {
|
||||
// When a new DataStore is installed, the permissions must be set for the
|
||||
// owner app.
|
||||
let permission = "indexedDB-chrome-" + aName + '|' + aOwner;
|
||||
this.resetPermissions(aAppId, aOrigin, aOwner, permission, aReadOnly);
|
||||
|
||||
// For any app that wants to have access to this DataStore we add the
|
||||
// permissions.
|
||||
if (aName in this.accessStores) {
|
||||
for (let appId in this.accessStores[aName]) {
|
||||
// ReadOnly is decided by the owner first.
|
||||
let readOnly = aReadOnly || this.accessStores[aName][appId].readOnly;
|
||||
this.resetPermissions(appId, this.accessStores[aName][appId].origin,
|
||||
this.accessStores[aName][appId].owner,
|
||||
permission, readOnly);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addAccessPermissions: function(aAppId, aName, aOrigin, aOwner, aReadOnly) {
|
||||
// When an app wants to have access to a DataStore, the permissions must be
|
||||
// set.
|
||||
if (!(aName in this.stores)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let appId in this.stores[aName]) {
|
||||
let permission = "indexedDB-chrome-" + aName + '|' + this.stores[aName][appId].owner;
|
||||
// The ReadOnly is decied by the owenr first.
|
||||
let readOnly = this.stores[aName][appId].readOnly || aReadOnly;
|
||||
this.resetPermissions(aAppId, aOrigin, aOwner, permission, readOnly);
|
||||
}
|
||||
},
|
||||
|
||||
resetPermissions: function(aAppId, aOrigin, aOwner, aPermission, aReadOnly) {
|
||||
debug("ResetPermissions - appId: " + aAppId + " - origin: " + aOrigin +
|
||||
" - owner: " + aOwner + " - permissions: " + aPermission +
|
||||
" - readOnly: " + aReadOnly);
|
||||
|
||||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let principal = secMan.getAppCodebasePrincipal(uri, aAppId, false);
|
||||
|
||||
let result = permissionManager.testExactPermissionFromPrincipal(principal,
|
||||
aPermission + '-write');
|
||||
|
||||
if (aReadOnly && result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
debug("Write permission removed");
|
||||
permissionManager.removeFromPrincipal(principal, aPermission + '-write');
|
||||
} else if (!aReadOnly && result != Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
debug("Write permission added");
|
||||
permissionManager.addFromPrincipal(principal, aPermission + '-write',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
|
||||
result = permissionManager.testExactPermissionFromPrincipal(principal,
|
||||
aPermission + '-read');
|
||||
if (result != Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
debug("Read permission added");
|
||||
permissionManager.addFromPrincipal(principal, aPermission + '-read',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
|
||||
result = permissionManager.testExactPermissionFromPrincipal(principal, aPermission);
|
||||
if (result != Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
debug("Generic permission added");
|
||||
permissionManager.addFromPrincipal(principal, aPermission,
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
}
|
||||
},
|
||||
|
||||
getDataStores: function(aWindow, aName) {
|
||||
debug('getDataStores - aName: ' + aName);
|
||||
|
||||
let self = this;
|
||||
return new aWindow.Promise(function(resolve, reject) {
|
||||
// If this request comes from the main process, we have access to the
|
||||
// window, so we can skip the ipc communication.
|
||||
if (self.inParent) {
|
||||
let stores = self.getDataStoresInfo(aName, aWindow.document.nodePrincipal.appId);
|
||||
if (stores === null) {
|
||||
reject(new aWindow.DOMError("SecurityError", "Access denied"));
|
||||
return;
|
||||
}
|
||||
self.getDataStoreCreate(aWindow, resolve, stores);
|
||||
} else {
|
||||
// This method can be called in the child so we need to send a request
|
||||
// to the parent and create DataStore object here.
|
||||
new DataStoreServiceChild(aWindow, aName, function(aStores) {
|
||||
debug("DataStoreServiceChild success callback!");
|
||||
self.getDataStoreCreate(aWindow, resolve, aStores);
|
||||
}, function() {
|
||||
debug("DataStoreServiceChild error callback!");
|
||||
reject(new aWindow.DOMError("SecurityError", "Access denied"));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getDataStoresInfo: function(aName, aAppId) {
|
||||
debug('GetDataStoresInfo');
|
||||
|
||||
let appsService = Cc["@mozilla.org/AppsService;1"]
|
||||
.getService(Ci.nsIAppsService);
|
||||
let app = appsService.getAppByLocalId(aAppId);
|
||||
if (!app) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let prefName = "dom.testing.datastore_enabled_for_hosted_apps";
|
||||
if (app.appStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED &&
|
||||
(Services.prefs.getPrefType(prefName) == Services.prefs.PREF_INVALID ||
|
||||
!Services.prefs.getBoolPref(prefName))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let results = [];
|
||||
|
||||
if (aName in this.stores) {
|
||||
if (aAppId in this.stores[aName]) {
|
||||
results.push({ name: aName,
|
||||
owner: this.stores[aName][aAppId].owner,
|
||||
readOnly: false,
|
||||
enabled: this.stores[aName][aAppId].enabled });
|
||||
}
|
||||
|
||||
for (var i in this.stores[aName]) {
|
||||
if (i == aAppId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let access = this.getDataStoreAccess(aName, aAppId);
|
||||
if (!access) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let readOnly = this.stores[aName][i].readOnly || access.readOnly;
|
||||
results.push({ name: aName,
|
||||
owner: this.stores[aName][i].owner,
|
||||
readOnly: readOnly,
|
||||
enabled: this.stores[aName][i].enabled });
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
|
||||
getDataStoreCreate: function(aWindow, aResolve, aStores) {
|
||||
debug("GetDataStoreCreate");
|
||||
|
||||
let results = new aWindow.Array();
|
||||
|
||||
if (!aStores.length) {
|
||||
aResolve(results);
|
||||
return;
|
||||
}
|
||||
|
||||
let pendingDataStores = [];
|
||||
|
||||
for (let i = 0; i < aStores.length; ++i) {
|
||||
if (!aStores[i].enabled) {
|
||||
pendingDataStores.push(aStores[i].owner);
|
||||
}
|
||||
}
|
||||
|
||||
if (!pendingDataStores.length) {
|
||||
this.getDataStoreResolve(aWindow, aResolve, aStores);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(aStores[0].name in this.pendingRequests)) {
|
||||
this.pendingRequests[aStores[0].name] = [];
|
||||
}
|
||||
|
||||
this.pendingRequests[aStores[0].name].push({ window: aWindow,
|
||||
resolve: aResolve,
|
||||
stores: aStores,
|
||||
pendingDataStores: pendingDataStores });
|
||||
},
|
||||
|
||||
getDataStoreResolve: function(aWindow, aResolve, aStores) {
|
||||
debug("GetDataStoreResolve");
|
||||
|
||||
let callbackPending = aStores.length;
|
||||
let results = new aWindow.Array();
|
||||
|
||||
if (!callbackPending) {
|
||||
aResolve(results);
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < aStores.length; ++i) {
|
||||
let obj = new DataStore(aWindow, aStores[i].name,
|
||||
aStores[i].owner, aStores[i].readOnly);
|
||||
|
||||
let storeImpl = aWindow.DataStoreImpl._create(aWindow, obj);
|
||||
|
||||
let exposedStore = new aWindow.DataStore();
|
||||
exposedStore.setDataStoreImpl(storeImpl);
|
||||
|
||||
obj.exposedObject = exposedStore;
|
||||
|
||||
results.push(exposedStore);
|
||||
|
||||
obj.retrieveRevisionId(
|
||||
function() {
|
||||
--callbackPending;
|
||||
if (!callbackPending) {
|
||||
aResolve(results);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
getDataStoreAccess: function(aName, aAppId) {
|
||||
if (!(aName in this.accessStores) ||
|
||||
!(aAppId in this.accessStores[aName])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.accessStores[aName][aAppId];
|
||||
},
|
||||
|
||||
observe: function observe(aSubject, aTopic, aData) {
|
||||
debug('observe - aTopic: ' + aTopic);
|
||||
if (aTopic != 'webapps-clear-data') {
|
||||
return;
|
||||
}
|
||||
|
||||
let params =
|
||||
aSubject.QueryInterface(Ci.mozIApplicationClearPrivateDataParams);
|
||||
|
||||
// DataStore is explosed to apps, not browser content.
|
||||
if (params.browserOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
function isEmpty(aMap) {
|
||||
for (var key in aMap) {
|
||||
if (aMap.hasOwnProperty(key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
for (let key in this.stores) {
|
||||
if (params.appId in this.stores[key]) {
|
||||
this.deleteDatabase(key, this.stores[key][params.appId].owner);
|
||||
delete this.stores[key][params.appId];
|
||||
}
|
||||
|
||||
if (isEmpty(this.stores[key])) {
|
||||
delete this.stores[key];
|
||||
}
|
||||
}
|
||||
|
||||
for (let key in this.accessStores) {
|
||||
if (params.appId in this.accessStores[key]) {
|
||||
delete this.accessStores[key][params.appId];
|
||||
}
|
||||
|
||||
if (isEmpty(this.accessStores[key])) {
|
||||
delete this.accessStores[key];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
deleteDatabase: function(aName, aOwner) {
|
||||
debug("delete database: " + aName);
|
||||
|
||||
let db = new DataStoreDB();
|
||||
db.init(aOwner, aName);
|
||||
db.delete();
|
||||
},
|
||||
|
||||
receiveMessage: function(aMsg) {
|
||||
debug("receiveMessage");
|
||||
let data = aMsg.json;
|
||||
|
||||
if (!(data.name in this.pendingRequests)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.pendingRequests[data.name].length;) {
|
||||
let pos = this.pendingRequests[data.name][i].pendingDataStores.indexOf(data.owner);
|
||||
if (pos != -1) {
|
||||
this.pendingRequests[data.name][i].pendingDataStores.splice(pos, 1);
|
||||
if (!this.pendingRequests[data.name][i].pendingDataStores.length) {
|
||||
this.getDataStoreResolve(this.pendingRequests[data.name][i].window,
|
||||
this.pendingRequests[data.name][i].resolve,
|
||||
this.pendingRequests[data.name][i].stores);
|
||||
this.pendingRequests[data.name].splice(i, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!this.pendingRequests[data.name].length) {
|
||||
delete this.pendingRequests[data.name];
|
||||
}
|
||||
},
|
||||
|
||||
classID : DATASTORESERVICE_CID,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDataStoreService,
|
||||
Ci.nsIObserver]),
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: DATASTORESERVICE_CID,
|
||||
contractID: '@mozilla.org/datastore-service;1',
|
||||
interfaces: [Ci.nsIDataStoreService, Ci.nsIObserver],
|
||||
flags: Ci.nsIClassInfo.SINGLETON
|
||||
})
|
||||
};
|
||||
|
||||
/* DataStoreServiceChild */
|
||||
|
||||
function DataStoreServiceChild(aWindow, aName, aSuccessCb, aErrorCb) {
|
||||
debug("DataStoreServiceChild created");
|
||||
this.init(aWindow, aName, aSuccessCb, aErrorCb);
|
||||
}
|
||||
|
||||
DataStoreServiceChild.prototype = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
|
||||
init: function(aWindow, aName, aSuccessCb, aErrorCb) {
|
||||
debug("DataStoreServiceChild init");
|
||||
this._successCb = aSuccessCb;
|
||||
this._errorCb = aErrorCb;
|
||||
this._name = aName;
|
||||
|
||||
this.initDOMRequestHelper(aWindow, [ "DataStore:Get:Return:OK",
|
||||
"DataStore:Get:Return:KO" ]);
|
||||
|
||||
cpmm.sendAsyncMessage("DataStore:Get",
|
||||
{ name: aName }, null, aWindow.document.nodePrincipal );
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("DataStoreServiceChild receiveMessage");
|
||||
|
||||
if (aMessage.data.name != this._name) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case 'DataStore:Get:Return:OK':
|
||||
this.destroyDOMRequestHelper();
|
||||
this._successCb(aMessage.data.stores);
|
||||
break;
|
||||
|
||||
case 'DataStore:Get:Return:KO':
|
||||
this.destroyDOMRequestHelper();
|
||||
this._errorCb();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataStoreService]);
|
|
@ -1,68 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict"
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DataStoreServiceInternal"];
|
||||
|
||||
function debug(s) {
|
||||
//dump('DEBUG DataStoreServiceInternal: ' + s + '\n');
|
||||
}
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "dataStoreService",
|
||||
"@mozilla.org/datastore-service;1",
|
||||
"nsIDataStoreService");
|
||||
|
||||
this.DataStoreServiceInternal = {
|
||||
init: function() {
|
||||
debug("init");
|
||||
|
||||
let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
if (inParent) {
|
||||
ppmm.addMessageListener("DataStore:Get", this);
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("receiveMessage");
|
||||
|
||||
if (aMessage.name != 'DataStore:Get') {
|
||||
return;
|
||||
}
|
||||
|
||||
let prefName = 'dom.testing.datastore_enabled_for_hosted_apps';
|
||||
if ((Services.prefs.getPrefType(prefName) == Services.prefs.PREF_INVALID ||
|
||||
!Services.prefs.getBoolPref(prefName)) &&
|
||||
!aMessage.target.assertAppHasStatus(Ci.nsIPrincipal.APP_STATUS_CERTIFIED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let msg = aMessage.data;
|
||||
|
||||
if (!aMessage.principal ||
|
||||
aMessage.principal.appId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID) {
|
||||
aMessage.target.sendAsyncMessage("DataStore:Get:Return:KO");
|
||||
return;
|
||||
}
|
||||
|
||||
msg.stores = dataStoreService.getDataStoresInfo(msg.name, aMessage.principal.appId);
|
||||
if (msg.stores === null) {
|
||||
aMessage.target.sendAsyncMessage("DataStore:Get:Return:KO");
|
||||
return;
|
||||
}
|
||||
aMessage.target.sendAsyncMessage("DataStore:Get:Return:OK", msg);
|
||||
}
|
||||
}
|
||||
|
||||
DataStoreServiceInternal.init();
|
|
@ -5,6 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDataStore.idl',
|
||||
'nsIDataStoreService.idl',
|
||||
]
|
||||
|
||||
|
@ -13,11 +14,15 @@ XPIDL_MODULE = 'dom_datastore'
|
|||
EXPORTS.mozilla.dom += [
|
||||
'DataStore.h',
|
||||
'DataStoreCursor.h',
|
||||
'DataStoreService.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'DataStore.cpp',
|
||||
'DataStoreCursor.cpp',
|
||||
'DataStoreDB.cpp',
|
||||
'DataStoreRevision.cpp',
|
||||
'DataStoreService.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
@ -26,17 +31,18 @@ LOCAL_INCLUDES += [
|
|||
|
||||
EXTRA_COMPONENTS += [
|
||||
'DataStore.manifest',
|
||||
'DataStoreService.js',
|
||||
'DataStoreImpl.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'DataStoreChangeNotifier.jsm',
|
||||
'DataStoreCursorImpl.jsm',
|
||||
'DataStoreDB.jsm',
|
||||
'DataStoreImpl.jsm',
|
||||
'DataStoreServiceInternal.jsm',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
// NOTE: This is a temporary interface.
|
||||
// It will be removed in the next patches for rewriting DataStore in C++.
|
||||
[scriptable, uuid(0b41fef5-14ba-48b0-923c-3d8fb64692ae)]
|
||||
interface nsIDataStore : nsISupports
|
||||
{
|
||||
void init(in nsIDOMWindow window,
|
||||
in DOMString name,
|
||||
in DOMString manifestURL,
|
||||
in boolean readOnly);
|
||||
|
||||
attribute jsval exposedObject;
|
||||
|
||||
void retrieveRevisionId(in jsval cb);
|
||||
};
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(bd02d09c-41ab-47b7-9319-57aa8e5059b0)]
|
||||
[scriptable, uuid(0a050c4f-d292-4a14-8712-09bc1019840a)]
|
||||
interface nsIDataStoreService : nsISupports
|
||||
{
|
||||
void installDataStore(in unsigned long appId,
|
||||
|
@ -24,12 +24,4 @@ interface nsIDataStoreService : nsISupports
|
|||
|
||||
nsISupports getDataStores(in nsIDOMWindow window,
|
||||
in DOMString name);
|
||||
|
||||
// This is an array of objects composed by:
|
||||
// - readOnly: boolean
|
||||
// - name: DOMString
|
||||
// - owner: DOMString
|
||||
// - enabled: true/false - true if this dataStore is ready to be used.
|
||||
jsval getDataStoresInfo(in DOMString name,
|
||||
in unsigned long appId);
|
||||
};
|
||||
|
|
|
@ -235,9 +235,6 @@ IDBFactory::Create(ContentParent* aContentParent,
|
|||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
|
||||
NS_ASSERTION(nsContentUtils::IsCallerChrome(), "Only for chrome!");
|
||||
NS_ASSERTION(aContentParent, "Null ContentParent!");
|
||||
|
||||
NS_ASSERTION(!nsContentUtils::GetCurrentJSContext(), "Should be called from C++");
|
||||
|
||||
// We need to get this information before we push a null principal to avoid
|
||||
// IsCallerChrome() assertion in quota manager.
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
IDBFactory** aFactory);
|
||||
|
||||
// Called when using IndexedDB from a JS component or a JSM in a different
|
||||
// process.
|
||||
// process or from a C++ component.
|
||||
static nsresult Create(ContentParent* aContentParent,
|
||||
IDBFactory** aFactory);
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ IDBRequest::WrapObject(JSContext* aCx)
|
|||
}
|
||||
|
||||
JS::Value
|
||||
IDBRequest::GetResult(JSContext* aCx, mozilla::ErrorResult& aRv) const
|
||||
IDBRequest::GetResult(mozilla::ErrorResult& aRv) const
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
|
|
|
@ -132,7 +132,13 @@ public:
|
|||
}
|
||||
|
||||
JS::Value
|
||||
GetResult(JSContext* aCx, ErrorResult& aRv) const;
|
||||
GetResult(ErrorResult& aRv) const;
|
||||
|
||||
JS::Value
|
||||
GetResult(JSContext* aCx, ErrorResult& aRv) const
|
||||
{
|
||||
return GetResult(aRv);
|
||||
}
|
||||
|
||||
IDBTransaction*
|
||||
GetTransaction() const
|
||||
|
|
|
@ -142,6 +142,7 @@
|
|||
#include "nsDeviceStorage.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "JavaScriptChild.h"
|
||||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "mozilla/dom/telephony/PTelephonyChild.h"
|
||||
#include "mozilla/dom/time/DateCacheCleaner.h"
|
||||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
|
@ -768,6 +769,24 @@ ContentChild::RecvAudioChannelNotify()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvDataStoreNotify(const uint32_t& aAppId,
|
||||
const nsString& aName,
|
||||
const nsString& aManifestURL)
|
||||
{
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::GetOrCreate();
|
||||
if (NS_WARN_IF(!service)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = service->EnableDataStore(aAppId, aName, aManifestURL);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor)
|
||||
{
|
||||
|
|
|
@ -157,6 +157,10 @@ public:
|
|||
virtual bool
|
||||
RecvAudioChannelNotify() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
RecvDataStoreNotify(const uint32_t& aAppId, const nsString& aName,
|
||||
const nsString& aManifestURL) MOZ_OVERRIDE;
|
||||
|
||||
virtual PTestShellChild* AllocPTestShellChild() MOZ_OVERRIDE;
|
||||
virtual bool DeallocPTestShellChild(PTestShellChild*) MOZ_OVERRIDE;
|
||||
virtual bool RecvPTestShellConstructor(PTestShellChild*) MOZ_OVERRIDE;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "mozilla/dom/ExternalHelperAppParent.h"
|
||||
#include "mozilla/dom/PFileDescriptorSetParent.h"
|
||||
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
|
||||
|
@ -1495,6 +1496,7 @@ ContentParent::InitializeMembers()
|
|||
mNumDestroyingTabs = 0;
|
||||
mIsAlive = true;
|
||||
mSendPermissionUpdates = false;
|
||||
mSendDataStoreInfos = false;
|
||||
mCalledClose = false;
|
||||
mCalledCloseWithError = false;
|
||||
mCalledKillHard = false;
|
||||
|
@ -2076,6 +2078,26 @@ ContentParent::RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvDataStoreGetStores(
|
||||
const nsString& aName,
|
||||
const IPC::Principal& aPrincipal,
|
||||
InfallibleTArray<DataStoreSetting>* aValue)
|
||||
{
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::GetOrCreate();
|
||||
if (NS_WARN_IF(!service)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = service->GetDataStoresFromIPC(aName, aPrincipal, aValue);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mSendDataStoreInfos = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvBroadcastVolume(const nsString& aVolumeName)
|
||||
{
|
||||
|
|
|
@ -160,10 +160,14 @@ public:
|
|||
|
||||
int32_t Pid();
|
||||
|
||||
bool NeedsPermissionsUpdate() {
|
||||
bool NeedsPermissionsUpdate() const {
|
||||
return mSendPermissionUpdates;
|
||||
}
|
||||
|
||||
bool NeedsDataStoreInfos() const {
|
||||
return mSendDataStoreInfos;
|
||||
}
|
||||
|
||||
BlobParent* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
|
||||
|
||||
/**
|
||||
|
@ -526,6 +530,11 @@ private:
|
|||
virtual bool RecvGetSystemMemory(const uint64_t& getterId) MOZ_OVERRIDE;
|
||||
virtual bool RecvBroadcastVolume(const nsString& aVolumeName) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvDataStoreGetStores(
|
||||
const nsString& aName,
|
||||
const IPC::Principal& aPrincipal,
|
||||
InfallibleTArray<DataStoreSetting>* aValue) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvSpeakerManagerGetSpeakerStatus(bool* aValue) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvSpeakerManagerForceSpeaker(const bool& aEnable) MOZ_OVERRIDE;
|
||||
|
@ -600,6 +609,7 @@ private:
|
|||
bool mIsAlive;
|
||||
|
||||
bool mSendPermissionUpdates;
|
||||
bool mSendDataStoreInfos;
|
||||
bool mIsForBrowser;
|
||||
bool mIsNuwaProcess;
|
||||
|
||||
|
|
|
@ -262,6 +262,14 @@ struct PrefSetting {
|
|||
MaybePrefValue userValue;
|
||||
};
|
||||
|
||||
struct DataStoreSetting {
|
||||
nsString name;
|
||||
nsString originURL;
|
||||
nsString manifestURL;
|
||||
bool readOnly;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
intr protocol PContent
|
||||
{
|
||||
parent opens PCompositor;
|
||||
|
@ -338,6 +346,9 @@ child:
|
|||
|
||||
async SpeakerManagerNotify();
|
||||
|
||||
async DataStoreNotify(uint32_t aAppId, nsString aName,
|
||||
nsString aManifestURL);
|
||||
|
||||
/**
|
||||
* Dump this process's GC and CC logs to the provided files.
|
||||
*
|
||||
|
@ -550,6 +561,9 @@ parent:
|
|||
async AudioChannelChangedNotification();
|
||||
async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden);
|
||||
|
||||
sync DataStoreGetStores(nsString aName, Principal aPrincipal)
|
||||
returns (DataStoreSetting[] dataStores);
|
||||
|
||||
async FilePathUpdateNotify(nsString aType,
|
||||
nsString aStorageName,
|
||||
nsString aFilepath,
|
||||
|
|
|
@ -111,8 +111,7 @@ typedef nsDataHashtable<nsUint64HashKey, TabChild*> TabChildMap;
|
|||
static TabChildMap* sTabChildren;
|
||||
|
||||
TabChildBase::TabChildBase()
|
||||
: mOldViewportWidth(0.0f)
|
||||
, mContentDocumentIsDisplayed(false)
|
||||
: mContentDocumentIsDisplayed(false)
|
||||
, mTabChildGlobal(nullptr)
|
||||
, mInnerSize(0, 0)
|
||||
{
|
||||
|
@ -151,7 +150,7 @@ TabChildBase::InitializeRootMetrics()
|
|||
void
|
||||
TabChildBase::SetCSSViewport(const CSSSize& aSize)
|
||||
{
|
||||
mOldViewportWidth = aSize.width;
|
||||
mOldViewportSize = aSize;
|
||||
|
||||
if (mContentDocumentIsDisplayed) {
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
|
@ -221,10 +220,10 @@ TabChildBase::HandlePossibleViewportChange()
|
|||
return false;
|
||||
}
|
||||
|
||||
float oldBrowserWidth = mOldViewportWidth;
|
||||
CSSSize oldBrowserSize = mOldViewportSize;
|
||||
mLastRootMetrics.mViewport.SizeTo(viewport);
|
||||
if (!oldBrowserWidth) {
|
||||
oldBrowserWidth = kDefaultViewportSize.width;
|
||||
if (oldBrowserSize == CSSSize()) {
|
||||
oldBrowserSize = kDefaultViewportSize;
|
||||
}
|
||||
SetCSSViewport(viewport);
|
||||
|
||||
|
@ -241,9 +240,11 @@ TabChildBase::HandlePossibleViewportChange()
|
|||
return false;
|
||||
}
|
||||
|
||||
float oldScreenWidth = mLastRootMetrics.mCompositionBounds.width;
|
||||
if (!oldScreenWidth) {
|
||||
oldScreenWidth = mInnerSize.width;
|
||||
ScreenIntSize oldScreenSize = ViewAs<ScreenPixel>(
|
||||
mLastRootMetrics.mCompositionBounds.Size(),
|
||||
PixelCastJustification::ScreenToParentLayerForRoot);
|
||||
if (oldScreenSize == ScreenIntSize()) {
|
||||
oldScreenSize = mInnerSize;
|
||||
}
|
||||
|
||||
FrameMetrics metrics(mLastRootMetrics);
|
||||
|
@ -266,7 +267,9 @@ TabChildBase::HandlePossibleViewportChange()
|
|||
// In all of these cases, we maintain how much actual content is visible
|
||||
// within the screen width. Note that "actual content" may be different with
|
||||
// respect to CSS pixels because of the CSS viewport size changing.
|
||||
float oldIntrinsicScale = oldScreenWidth / oldBrowserWidth;
|
||||
float oldIntrinsicScale =
|
||||
std::max(oldScreenSize.width / oldBrowserSize.width,
|
||||
oldScreenSize.height / oldBrowserSize.height);
|
||||
metrics.ZoomBy(metrics.CalculateIntrinsicScale().scale / oldIntrinsicScale);
|
||||
|
||||
// Changing the zoom when we're not doing a first paint will get ignored
|
||||
|
@ -2499,6 +2502,7 @@ TabChild::InitRenderingState()
|
|||
if (!sTabChildren) {
|
||||
sTabChildren = new TabChildMap;
|
||||
}
|
||||
MOZ_ASSERT(!sTabChildren->Get(id));
|
||||
sTabChildren->Put(id, this);
|
||||
mLayersId = id;
|
||||
}
|
||||
|
@ -2708,14 +2712,14 @@ TabChild::GetFrom(uint64_t aLayersId)
|
|||
}
|
||||
|
||||
void
|
||||
TabChild::DidComposite()
|
||||
TabChild::DidComposite(uint64_t aTransactionId)
|
||||
{
|
||||
MOZ_ASSERT(mWidget);
|
||||
MOZ_ASSERT(mWidget->GetLayerManager());
|
||||
MOZ_ASSERT(mWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT);
|
||||
|
||||
ClientLayerManager *manager = static_cast<ClientLayerManager*>(mWidget->GetLayerManager());
|
||||
manager->DidComposite();
|
||||
manager->DidComposite(aTransactionId);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -212,7 +212,7 @@ protected:
|
|||
bool UpdateFrameHandler(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
||||
|
||||
protected:
|
||||
float mOldViewportWidth;
|
||||
CSSSize mOldViewportSize;
|
||||
bool mContentDocumentIsDisplayed;
|
||||
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
||||
ScreenIntSize mInnerSize;
|
||||
|
@ -446,7 +446,7 @@ public:
|
|||
static TabChild* GetFrom(nsIPresShell* aPresShell);
|
||||
static TabChild* GetFrom(uint64_t aLayersId);
|
||||
|
||||
void DidComposite();
|
||||
void DidComposite(uint64_t aTransactionId);
|
||||
|
||||
static inline TabChild*
|
||||
GetFrom(nsIDOMWindow* aWindow)
|
||||
|
|
|
@ -68,7 +68,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
|
|||
[test_bug394769.html]
|
||||
[test_bug396843.html]
|
||||
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
|
||||
[test_bug397571.html]
|
||||
[test_bug400204.html]
|
||||
[test_bug404748.html]
|
||||
[test_bug406375.html]
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=397571
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 397571</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=397571">
|
||||
Mozilla Bug 397571</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 397571 **/
|
||||
|
||||
// Get the interface
|
||||
var utils = SpecialPowers.DOMWindowUtils.SpecialPowers_wrappedObject;
|
||||
|
||||
// Try to call functions without privileges
|
||||
var success = false;
|
||||
try {
|
||||
isForced = utils.docCharsetIsForced;
|
||||
}
|
||||
catch(e) {
|
||||
success = true;
|
||||
}
|
||||
ok(success == true, "should throw");
|
||||
|
||||
success = false;
|
||||
try {
|
||||
contentDisposition = utils.getDocumentMetadata("content-disposition");
|
||||
}
|
||||
catch(e) {
|
||||
success = true;
|
||||
}
|
||||
ok(success == true, "should throw");
|
||||
|
||||
var success = false;
|
||||
try {
|
||||
utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0);
|
||||
}
|
||||
catch(e) {
|
||||
success = true;
|
||||
}
|
||||
ok(success, "should throw");
|
||||
|
||||
var success = false;
|
||||
try {
|
||||
utils.sendKeyEvent("keydown", 0, 0, 0);
|
||||
}
|
||||
catch(e) {
|
||||
success = true;
|
||||
}
|
||||
ok(success, "should throw");
|
||||
|
||||
var success = false;
|
||||
try {
|
||||
utils.focus(null);
|
||||
}
|
||||
catch(e) {
|
||||
success = true;
|
||||
}
|
||||
ok(success, "should throw");
|
||||
|
||||
// Get privilege
|
||||
utils = SpecialPowers.wrap(utils);
|
||||
|
||||
// Try again
|
||||
var success = true;
|
||||
try {
|
||||
isForced = utils.docCharsetIsForced;
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
var success = true;
|
||||
try {
|
||||
contentDisposition = utils.getDocumentMetadata("content-disposition");
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
var success = true;
|
||||
try {
|
||||
utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0);
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
var success = true;
|
||||
try {
|
||||
utils.sendKeyEvent("keydown", 0, 0, 0);
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
var success = true;
|
||||
try {
|
||||
utils.focus(null);
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
// TEMPORARY workaround for leak bug 524037: send a mouseup event as
|
||||
// well so that we don't leak.
|
||||
var success = true;
|
||||
try {
|
||||
utils.sendMouseEvent("mouseup", 0, 0, 0, 1, 0);
|
||||
}
|
||||
catch(e) {
|
||||
success = false;
|
||||
}
|
||||
ok(success, "shouldn't throw");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1200,8 +1200,6 @@ var interfaceNamesInGlobalScope =
|
|||
"WheelEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"Window",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"WindowUtils",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"Worker",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -108,3 +108,10 @@ dictionary DataStoreTask {
|
|||
DataStoreKey? id;
|
||||
any data;
|
||||
};
|
||||
|
||||
// For internal use.
|
||||
dictionary DataStoreRevisionData {
|
||||
DOMString revisionId = "";
|
||||
unsigned long objectId = 0;
|
||||
DOMString operation = "";
|
||||
};
|
||||
|
|
|
@ -637,21 +637,18 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
|
||||
/* Setup quad geometry */
|
||||
mGL->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
|
||||
mGL->fEnableVertexAttribArray(0);
|
||||
mGL->fEnableVertexAttribArray(1);
|
||||
|
||||
float w = (aTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE) ? (float) aSize.width : 1.0f;
|
||||
float h = (aTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE) ? (float) aSize.height : 1.0f;
|
||||
|
||||
|
||||
const float
|
||||
vertexArray[4*2] = {
|
||||
-1.0f, -1.0f,
|
||||
1.0f, -1.0f,
|
||||
-1.0f, 1.0f,
|
||||
1.0f, 1.0f
|
||||
};
|
||||
mGL->fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, vertexArray);
|
||||
};
|
||||
ScopedVertexAttribPointer autoAttrib0(mGL, 0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, 0, vertexArray);
|
||||
|
||||
const float u0 = 0.0f;
|
||||
const float u1 = w;
|
||||
|
@ -661,7 +658,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
u1, v0,
|
||||
u0, v1,
|
||||
u1, v1 };
|
||||
mGL->fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, texCoordArray);
|
||||
ScopedVertexAttribPointer autoAttrib1(mGL, 1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, 0, texCoordArray);
|
||||
|
||||
/* Bind the texture */
|
||||
if (aTextureId) {
|
||||
|
@ -677,16 +674,12 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
|
||||
CLEANUP_IF_GLERROR_OCCURRED("when drawing texture");
|
||||
|
||||
mGL->fDisableVertexAttribArray(1);
|
||||
mGL->fDisableVertexAttribArray(0);
|
||||
|
||||
/* Read-back draw results */
|
||||
ReadPixelsIntoDataSurface(mGL, isurf);
|
||||
CLEANUP_IF_GLERROR_OCCURRED("when reading pixels into surface");
|
||||
} while (false);
|
||||
|
||||
/* Restore GL state */
|
||||
//cleanup:
|
||||
mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, oldrb);
|
||||
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, oldfb);
|
||||
mGL->fUseProgram(oldprog);
|
||||
|
|
|
@ -187,7 +187,9 @@ public:
|
|||
// into its composition bounds.
|
||||
CSSToScreenScale CalculateIntrinsicScale() const
|
||||
{
|
||||
return CSSToScreenScale(float(mCompositionBounds.width) / float(mViewport.width));
|
||||
return CSSToScreenScale(
|
||||
std::max(float(mCompositionBounds.width) / mViewport.width,
|
||||
float(mCompositionBounds.height) / mViewport.height));
|
||||
}
|
||||
|
||||
// Return the scale factor for converting from CSS pixels (for this layer)
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef GFX_TRANSACTION_ID_ALLOCATOR_H
|
||||
#define GFX_TRANSACTION_ID_ALLOCATOR_H
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class TransactionIdAllocator {
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(TransactionIdAllocator)
|
||||
|
||||
virtual ~TransactionIdAllocator() {}
|
||||
|
||||
/**
|
||||
* Allocate a unique id number for the current refresh tick, can
|
||||
* only be called while IsInRefresh().
|
||||
*
|
||||
* If too many id's are allocated without being returned then
|
||||
* the refresh driver will suspend until they catch up.
|
||||
*/
|
||||
virtual uint64_t GetTransactionId() = 0;
|
||||
|
||||
/**
|
||||
* Notify that all work (including asynchronous composites)
|
||||
* for a given transaction id has been completed.
|
||||
*
|
||||
* If the refresh driver has been suspended because
|
||||
* of having too many outstanding id's, then this may
|
||||
* resume it.
|
||||
*/
|
||||
virtual void NotifyTransactionCompleted(uint64_t aTransactionId) = 0;
|
||||
|
||||
/**
|
||||
* Revoke a transaction id that isn't needed to track
|
||||
* completion of asynchronous work. This is similar
|
||||
* to NotifyTransactionCompleted except avoids
|
||||
* return ordering issues.
|
||||
*/
|
||||
virtual void RevokeTransactionId(uint64_t aTransactionId) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* GFX_TRANSACTION_ID_ALLOCATOR_H */
|
|
@ -2101,6 +2101,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mFrameMetrics.mHasScrollgrab = aLayerMetrics.mHasScrollgrab;
|
||||
|
||||
if (scrollOffsetUpdated) {
|
||||
CancelAnimation();
|
||||
|
||||
APZC_LOG("%p updating scroll offset from (%f, %f) to (%f, %f)\n", this,
|
||||
mFrameMetrics.GetScrollOffset().x, mFrameMetrics.GetScrollOffset().y,
|
||||
aLayerMetrics.GetScrollOffset().x, aLayerMetrics.GetScrollOffset().y);
|
||||
|
|
|
@ -203,7 +203,7 @@ void Axis::CancelTouch() {
|
|||
}
|
||||
|
||||
bool Axis::CanScroll() const {
|
||||
return GetCompositionLength() < GetPageLength();
|
||||
return GetPageLength() - GetCompositionLength() > COORDINATE_EPSILON;
|
||||
}
|
||||
|
||||
bool Axis::CanScrollNow() const {
|
||||
|
|
|
@ -40,6 +40,7 @@ using namespace mozilla::gfx;
|
|||
ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
: mPhase(PHASE_NONE)
|
||||
, mWidget(aWidget)
|
||||
, mLatestTransactionId(0)
|
||||
, mTargetRotation(ROTATION_0)
|
||||
, mRepeatTransaction(false)
|
||||
, mIsRepeatTransaction(false)
|
||||
|
@ -54,6 +55,9 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
|||
|
||||
ClientLayerManager::~ClientLayerManager()
|
||||
{
|
||||
if (mTransactionIdAllocator) {
|
||||
DidComposite(mLatestTransactionId);
|
||||
}
|
||||
ClearCachedResources();
|
||||
// Stop receiveing AsyncParentMessage at Forwarder.
|
||||
// After the call, the message is directly handled by LayerTransactionChild.
|
||||
|
@ -285,7 +289,7 @@ ClientLayerManager::Composite()
|
|||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::DidComposite()
|
||||
ClientLayerManager::DidComposite(uint64_t aTransactionId)
|
||||
{
|
||||
MOZ_ASSERT(mWidget);
|
||||
nsIWidgetListener *listener = mWidget->GetWidgetListener();
|
||||
|
@ -296,6 +300,7 @@ ClientLayerManager::DidComposite()
|
|||
if (listener) {
|
||||
listener->DidCompositeWindow();
|
||||
}
|
||||
mTransactionIdAllocator->NotifyTransactionCompleted(aTransactionId);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -421,11 +426,13 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
|||
{
|
||||
mPhase = PHASE_FORWARD;
|
||||
|
||||
mLatestTransactionId = mTransactionIdAllocator->GetTransactionId();
|
||||
|
||||
// forward this transaction's changeset to our LayerManagerComposite
|
||||
bool sent;
|
||||
AutoInfallibleTArray<EditReply, 10> replies;
|
||||
if (HasShadowManager() && mForwarder->EndTransaction(&replies, mRegionToClear,
|
||||
aScheduleComposite, mPaintSequenceNumber, &sent)) {
|
||||
mLatestTransactionId, aScheduleComposite, mPaintSequenceNumber, &sent)) {
|
||||
for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
|
||||
const EditReply& reply = replies[i];
|
||||
|
||||
|
@ -479,6 +486,12 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
|||
if (sent) {
|
||||
mNeedsComposite = false;
|
||||
}
|
||||
if (!sent || mForwarder->GetShadowManager()->HasNoCompositor()) {
|
||||
// Clear the transaction id so that it doesn't get returned
|
||||
// unless we forwarded to somewhere that doesn't actually
|
||||
// have a compositor.
|
||||
mTransactionIdAllocator->RevokeTransactionId(mLatestTransactionId);
|
||||
}
|
||||
} else if (HasShadowManager()) {
|
||||
NS_WARNING("failed to forward Layers transaction");
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsRect.h" // for nsIntRect
|
||||
#include "nsTArray.h" // for nsTArray
|
||||
#include "nscore.h" // for nsAString
|
||||
#include "mozilla/layers/TransactionIdAllocator.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
|
@ -166,7 +167,7 @@ public:
|
|||
virtual bool RequestOverfill(mozilla::dom::OverfillCallback* aCallback) MOZ_OVERRIDE;
|
||||
virtual void RunOverfillCallback(const uint32_t aOverfill) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DidComposite();
|
||||
virtual void DidComposite(uint64_t aTransactionId);
|
||||
|
||||
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -210,6 +211,8 @@ public:
|
|||
// Get a copy of the compositor-side APZ test data for our layers ID.
|
||||
void GetCompositorSideAPZTestData(APZTestData* aData) const;
|
||||
|
||||
void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) { mTransactionIdAllocator = aAllocator; }
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
|
@ -256,6 +259,9 @@ private:
|
|||
// back to mShadowTarget.
|
||||
nsRefPtr<gfxContext> mShadowTarget;
|
||||
|
||||
nsRefPtr<TransactionIdAllocator> mTransactionIdAllocator;
|
||||
uint64_t mLatestTransactionId;
|
||||
|
||||
// Sometimes we draw to targets that don't natively support
|
||||
// landscape/portrait orientation. When we need to implement that
|
||||
// ourselves, |mTargetRotation| describes the induced transform we
|
||||
|
|
|
@ -124,15 +124,15 @@ CompositorChild::RecvInvalidateAll()
|
|||
}
|
||||
|
||||
bool
|
||||
CompositorChild::RecvDidComposite(const uint64_t& aId)
|
||||
CompositorChild::RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId)
|
||||
{
|
||||
if (mLayerManager) {
|
||||
MOZ_ASSERT(aId == 0);
|
||||
mLayerManager->DidComposite();
|
||||
mLayerManager->DidComposite(aTransactionId);
|
||||
} else if (aId != 0) {
|
||||
dom::TabChild *child = dom::TabChild::GetFrom(aId);
|
||||
if (child) {
|
||||
child->DidComposite();
|
||||
child->DidComposite(aTransactionId);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual bool RecvOverfill(const uint32_t &aOverfill) MOZ_OVERRIDE;
|
||||
void AddOverfillObserver(ClientLayerManager* aLayerManager);
|
||||
|
||||
virtual bool RecvDidComposite(const uint64_t& aId) MOZ_OVERRIDE;
|
||||
virtual bool RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
|
|
|
@ -66,6 +66,7 @@ CompositorParent::LayerTreeState::LayerTreeState()
|
|||
: mParent(nullptr)
|
||||
, mLayerManager(nullptr)
|
||||
, mCrossProcessParent(nullptr)
|
||||
, mLayerTree(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -193,6 +194,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
|||
: mWidget(aWidget)
|
||||
, mCurrentCompositeTask(nullptr)
|
||||
, mIsTesting(false)
|
||||
, mPendingTransaction(0)
|
||||
, mPaused(false)
|
||||
, mUseExternalSurfaceSize(aUseExternalSurfaceSize)
|
||||
, mEGLSurfaceSize(aSurfaceWidth, aSurfaceHeight)
|
||||
|
@ -200,7 +202,6 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
|||
, mResumeCompositionMonitor("ResumeCompositionMonitor")
|
||||
, mOverrideComposeReadiness(false)
|
||||
, mForceCompositionTask(nullptr)
|
||||
, mWantDidCompositeEvent(false)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(sCompositorThread != nullptr || sCompositorThreadID,
|
||||
"The compositor thread must be Initialized before instanciating a COmpositorParent.");
|
||||
|
@ -417,6 +418,7 @@ CompositorParent::PauseComposition()
|
|||
mPaused = true;
|
||||
|
||||
mCompositor->Pause();
|
||||
DidComposite();
|
||||
}
|
||||
|
||||
// if anyone's waiting to make sure that composition really got paused, tell them
|
||||
|
@ -443,7 +445,7 @@ CompositorParent::ResumeComposition()
|
|||
|
||||
mPaused = false;
|
||||
|
||||
Composite();
|
||||
CompositeToTarget(nullptr);
|
||||
|
||||
// if anyone's waiting to make sure that composition really got resumed, tell them
|
||||
lock.NotifyAll();
|
||||
|
@ -541,8 +543,6 @@ CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint,
|
|||
if (aScheduleComposite) {
|
||||
ScheduleComposition();
|
||||
}
|
||||
|
||||
mWantDidCompositeEvent = true;
|
||||
}
|
||||
|
||||
// Used when layout.frame_rate is -1. Needs to be kept in sync with
|
||||
|
@ -585,7 +585,7 @@ CompositorParent::ScheduleComposition()
|
|||
rate == 0 ? 0.0 : std::max(0.0, 1000.0 / rate));
|
||||
|
||||
|
||||
mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::Composite);
|
||||
mCurrentCompositeTask = NewRunnableMethod(this, &CompositorParent::CompositeCallback);
|
||||
|
||||
if (!initialComposition && delta < minFrameDelta) {
|
||||
TimeDuration delay = minFrameDelta - delta;
|
||||
|
@ -602,8 +602,9 @@ CompositorParent::ScheduleComposition()
|
|||
}
|
||||
|
||||
void
|
||||
CompositorParent::Composite()
|
||||
CompositorParent::CompositeCallback()
|
||||
{
|
||||
mCurrentCompositeTask = nullptr;
|
||||
CompositeToTarget(nullptr);
|
||||
}
|
||||
|
||||
|
@ -624,14 +625,10 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (mCurrentCompositeTask) {
|
||||
mCurrentCompositeTask->Cancel();
|
||||
mCurrentCompositeTask = nullptr;
|
||||
}
|
||||
|
||||
mLastCompose = TimeStamp::Now();
|
||||
|
||||
if (!CanComposite()) {
|
||||
DidComposite();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -672,9 +669,8 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
|
|||
mLayerManager->SetDebugOverlayWantsNextFrame(false);
|
||||
mLayerManager->EndEmptyTransaction();
|
||||
|
||||
if (!aTarget && mWantDidCompositeEvent) {
|
||||
if (!aTarget) {
|
||||
DidComposite();
|
||||
mWantDidCompositeEvent = false;
|
||||
}
|
||||
|
||||
if (mLayerManager->DebugOverlayWantsNextFrame()) {
|
||||
|
@ -704,20 +700,6 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
|
|||
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_END);
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::DidComposite()
|
||||
{
|
||||
unused << SendDidComposite(0);
|
||||
|
||||
for (LayerTreeMap::iterator it = sIndirectLayerTrees.begin();
|
||||
it != sIndirectLayerTrees.end(); it++) {
|
||||
LayerTreeState* lts = &it->second;
|
||||
if (lts->mParent == this && lts->mCrossProcessParent) {
|
||||
unused << lts->mCrossProcessParent->SendDidComposite(it->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
|
||||
{
|
||||
|
@ -773,6 +755,7 @@ CompositorParent::ScheduleRotationOnCompositorThread(const TargetConfig& aTarget
|
|||
|
||||
void
|
||||
CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
|
@ -796,11 +779,17 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
|||
mRootLayerTreeID, aPaintSequenceNumber);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aTransactionId > mPendingTransaction);
|
||||
mPendingTransaction = aTransactionId;
|
||||
|
||||
if (root) {
|
||||
SetShadowProperties(root);
|
||||
}
|
||||
if (aScheduleComposite) {
|
||||
ScheduleComposition();
|
||||
if (mPaused) {
|
||||
DidComposite();
|
||||
}
|
||||
// When testing we synchronously update the shadow tree with the animated
|
||||
// values to avoid race conditions when calling GetAnimationTransform etc.
|
||||
// (since the above SetShadowProperties will remove animation effects).
|
||||
|
@ -813,11 +802,12 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
|||
mCompositionManager->TransformShadowTree(mTestTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
// Pretend we composited in case someone is wating for this event.
|
||||
DidComposite();
|
||||
}
|
||||
}
|
||||
}
|
||||
mLayerManager->NotifyShadowTreeTransaction();
|
||||
mWantDidCompositeEvent = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -843,6 +833,8 @@ CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
|||
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
// Pretend we composited in case someone is wating for this event.
|
||||
DidComposite();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1151,6 +1143,7 @@ public:
|
|||
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
|
@ -1164,6 +1157,7 @@ public:
|
|||
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE;
|
||||
|
||||
void DidComposite(uint64_t aId);
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
virtual ~CrossProcessCompositorParent();
|
||||
|
@ -1179,6 +1173,23 @@ private:
|
|||
base::ProcessId mChildProcessId;
|
||||
};
|
||||
|
||||
void
|
||||
CompositorParent::DidComposite()
|
||||
{
|
||||
if (mPendingTransaction) {
|
||||
unused << SendDidComposite(0, mPendingTransaction);
|
||||
mPendingTransaction = 0;
|
||||
}
|
||||
|
||||
for (LayerTreeMap::iterator it = sIndirectLayerTrees.begin();
|
||||
it != sIndirectLayerTrees.end(); it++) {
|
||||
LayerTreeState* lts = &it->second;
|
||||
if (lts->mParent == this && lts->mCrossProcessParent) {
|
||||
static_cast<CrossProcessCompositorParent*>(lts->mCrossProcessParent)->DidComposite(it->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
OpenCompositor(CrossProcessCompositorParent* aCompositor,
|
||||
Transport* aTransport, ProcessHandle aHandle,
|
||||
|
@ -1253,7 +1264,6 @@ RemoveIndirectTree(uint64_t aId)
|
|||
void
|
||||
CrossProcessCompositorParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
fprintf(stderr, " --- CrossProcessCompositorParent ActorDestroy\n");
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &CrossProcessCompositorParent::DeferredDestroy));
|
||||
|
@ -1280,6 +1290,7 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<Layers
|
|||
*aSuccess = true;
|
||||
LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId, mChildProcessId);
|
||||
p->AddIPDLReference();
|
||||
sIndirectLayerTrees[aId].mLayerTree = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -1317,6 +1328,7 @@ CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child)
|
|||
void
|
||||
CrossProcessCompositorParent::ShadowLayersUpdated(
|
||||
LayerTransactionParent* aLayerTree,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
|
@ -1341,6 +1353,17 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
|
|||
|
||||
state->mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite,
|
||||
aPaintSequenceNumber);
|
||||
aLayerTree->SetPendingTransactionId(aTransactionId);
|
||||
}
|
||||
|
||||
void
|
||||
CrossProcessCompositorParent::DidComposite(uint64_t aId)
|
||||
{
|
||||
LayerTransactionParent *layerTree = sIndirectLayerTrees[aId].mLayerTree;
|
||||
if (layerTree && layerTree->GetPendingTransactionId()) {
|
||||
unused << SendDidComposite(aId, layerTree->GetPendingTransactionId());
|
||||
layerTree->SetPendingTransactionId(0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1406,8 +1429,6 @@ CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLay
|
|||
void
|
||||
CrossProcessCompositorParent::DeferredDestroy()
|
||||
{
|
||||
|
||||
fprintf(stderr, " --- CrossProcessCompositorParent DeferredDestroy\n");
|
||||
CrossProcessCompositorParent* self;
|
||||
mSelfRef.forget(&self);
|
||||
|
||||
|
@ -1418,8 +1439,6 @@ CrossProcessCompositorParent::DeferredDestroy()
|
|||
|
||||
CrossProcessCompositorParent::~CrossProcessCompositorParent()
|
||||
{
|
||||
fprintf(stderr, " --- CrossProcessCompositorParent destructor\n");
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
new DeleteTask<Transport>(mTransport));
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
|
@ -226,6 +227,7 @@ public:
|
|||
PCompositorParent* mCrossProcessParent;
|
||||
TargetConfig mTargetConfig;
|
||||
APZTestData mApzTestData;
|
||||
LayerTransactionParent* mLayerTree;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -253,7 +255,7 @@ protected:
|
|||
bool* aSuccess) MOZ_OVERRIDE;
|
||||
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
|
||||
virtual void ScheduleTask(CancelableTask*, int);
|
||||
void Composite();
|
||||
void CompositeCallback();
|
||||
void CompositeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
|
||||
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
|
||||
|
||||
|
@ -327,6 +329,8 @@ protected:
|
|||
TimeStamp mExpectedComposeStartTime;
|
||||
#endif
|
||||
|
||||
uint64_t mPendingTransaction;
|
||||
|
||||
bool mPaused;
|
||||
|
||||
bool mUseExternalSurfaceSize;
|
||||
|
@ -343,8 +347,6 @@ protected:
|
|||
|
||||
nsRefPtr<APZCTreeManager> mApzcTreeManager;
|
||||
|
||||
bool mWantDidCompositeEvent;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
|
||||
};
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ public:
|
|||
|
||||
bool IPCOpen() const { return mIPCOpen; }
|
||||
|
||||
void SetHasNoCompositor() { mHasNoCompositor = true; }
|
||||
bool HasNoCompositor() { return mHasNoCompositor; }
|
||||
|
||||
void SetForwarder(ShadowLayerForwarder* aForwarder)
|
||||
{
|
||||
mForwarder = aForwarder;
|
||||
|
@ -46,9 +49,10 @@ public:
|
|||
|
||||
protected:
|
||||
LayerTransactionChild()
|
||||
: mIPCOpen(false)
|
||||
: mForwarder(nullptr)
|
||||
, mIPCOpen(false)
|
||||
, mDestroyed(false)
|
||||
, mForwarder(nullptr)
|
||||
, mHasNoCompositor(false)
|
||||
{}
|
||||
~LayerTransactionChild() { }
|
||||
|
||||
|
@ -80,9 +84,10 @@ protected:
|
|||
friend class CompositorChild;
|
||||
friend class layout::RenderFrameChild;
|
||||
|
||||
ShadowLayerForwarder* mForwarder;
|
||||
bool mIPCOpen;
|
||||
bool mDestroyed;
|
||||
ShadowLayerForwarder* mForwarder;
|
||||
bool mHasNoCompositor;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -148,6 +148,7 @@ LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
|
|||
: mLayerManager(aManager)
|
||||
, mShadowLayersManager(aLayersManager)
|
||||
, mId(aId)
|
||||
, mPendingTransaction(0)
|
||||
, mChildProcessId(aOtherProcess)
|
||||
, mDestroyed(false)
|
||||
, mIPCOpen(false)
|
||||
|
@ -179,17 +180,19 @@ LayerTransactionParent::GetCompositorBackendType() const
|
|||
|
||||
bool
|
||||
LayerTransactionParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber)
|
||||
{
|
||||
return RecvUpdate(cset, targetConfig, isFirstPaint, scheduleComposite,
|
||||
paintSequenceNumber, nullptr);
|
||||
return RecvUpdate(cset, aTransactionId, targetConfig, isFirstPaint,
|
||||
scheduleComposite, paintSequenceNumber, nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
|
@ -549,8 +552,8 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||
// other's buffer contents.
|
||||
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
|
||||
|
||||
mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint,
|
||||
scheduleComposite, paintSequenceNumber);
|
||||
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
|
||||
isFirstPaint, scheduleComposite, paintSequenceNumber);
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
|
||||
|
|
|
@ -81,6 +81,9 @@ public:
|
|||
|
||||
virtual bool IsSameProcess() const MOZ_OVERRIDE;
|
||||
|
||||
const uint64_t& GetPendingTransactionId() { return mPendingTransaction; }
|
||||
void SetPendingTransactionId(uint64_t aId) { mPendingTransaction = aId; }
|
||||
|
||||
// CompositableParentManager
|
||||
virtual void SendFenceHandle(AsyncTransactionTracker* aTracker,
|
||||
PTextureParent* aTexture,
|
||||
|
@ -95,6 +98,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual bool RecvUpdate(const EditArray& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
|
@ -102,6 +106,7 @@ protected:
|
|||
EditReplyArray* reply) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvUpdateNoSwap(const EditArray& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
|
@ -164,6 +169,8 @@ private:
|
|||
// mId != 0 => mRoot == null
|
||||
// because the "real tree" is owned by the compositor.
|
||||
uint64_t mId;
|
||||
|
||||
uint64_t mPendingTransaction;
|
||||
// When the widget/frame/browser stuff in this process begins its
|
||||
// destruction process, we need to Disconnect() all the currently
|
||||
// live shadow layers, because some of them might be orphaned from
|
||||
|
|
|
@ -42,7 +42,7 @@ child:
|
|||
// The compositor completed a layers transaction. id is the layers id
|
||||
// of the child layer tree that was composited (or 0 when notifying
|
||||
// the root layer tree).
|
||||
async DidComposite(uint64_t id);
|
||||
async DidComposite(uint64_t id, uint64_t transactionId);
|
||||
|
||||
// The parent sends the child the requested fill ratio numbers.
|
||||
async Overfill(uint32_t aOverfill);
|
||||
|
|
|
@ -52,9 +52,14 @@ parent:
|
|||
|
||||
// The isFirstPaint flag can be used to indicate that this is the first update
|
||||
// for a particular document.
|
||||
sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint,
|
||||
sync Update(Edit[] cset, uint64_t id, TargetConfig targetConfig, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber)
|
||||
returns (EditReply[] reply);
|
||||
|
||||
// We don't need to send a sync transaction if
|
||||
// no transaction operate require a swap.
|
||||
async UpdateNoSwap(Edit[] cset, uint64_t id, TargetConfig targetConfig, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber);
|
||||
|
||||
// Testing APIs
|
||||
|
||||
|
@ -78,11 +83,6 @@ parent:
|
|||
// Useful for testing rendering of async scrolling.
|
||||
async SetAsyncScrollOffset(PLayer layer, int32_t x, int32_t y);
|
||||
|
||||
// We don't need to send a sync transaction if
|
||||
// no transaction operate require a swap.
|
||||
async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber);
|
||||
|
||||
// Drop any front buffers that might be retained on the compositor
|
||||
// side.
|
||||
async ClearCachedResources();
|
||||
|
|
|
@ -451,12 +451,15 @@ ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
|
|||
bool
|
||||
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
const nsIntRegion& aRegionToClear,
|
||||
uint64_t aId,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool* aSent)
|
||||
{
|
||||
*aSent = false;
|
||||
|
||||
MOZ_ASSERT(aId);
|
||||
|
||||
PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation");
|
||||
RenderTraceScope rendertrace("Foward Transaction", "000091");
|
||||
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
||||
|
@ -562,7 +565,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
|||
RenderTraceScope rendertrace3("Forward Transaction", "000093");
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen() ||
|
||||
!mShadowManager->SendUpdate(cset, targetConfig, mIsFirstPaint,
|
||||
!mShadowManager->SendUpdate(cset, aId, targetConfig, mIsFirstPaint,
|
||||
aScheduleComposite, aPaintSequenceNumber,
|
||||
aReplies)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
|
@ -575,7 +578,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
|||
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen() ||
|
||||
!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint,
|
||||
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mIsFirstPaint,
|
||||
aPaintSequenceNumber, aScheduleComposite)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
return false;
|
||||
|
|
|
@ -295,6 +295,7 @@ public:
|
|||
*/
|
||||
bool EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
const nsIntRegion& aRegionToClear,
|
||||
uint64_t aId,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool* aSent);
|
||||
|
|
|
@ -19,6 +19,7 @@ class ShadowLayersManager
|
|||
{
|
||||
public:
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const uint64_t& aTransactionId,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
|
|
|
@ -163,6 +163,7 @@ EXPORTS.mozilla.layers += [
|
|||
'opengl/TextureClientOGL.h',
|
||||
'opengl/TextureHostOGL.h',
|
||||
'RenderTrace.h',
|
||||
'TransactionIdAllocator.h',
|
||||
'YCbCrImageDataSerializer.h',
|
||||
]
|
||||
|
||||
|
|
|
@ -268,6 +268,52 @@ inline nscoord NSToCoordCeilClamped(double aValue)
|
|||
return NSToCoordCeil(aValue);
|
||||
}
|
||||
|
||||
// The NSToCoordTrunc* functions remove the fractional component of
|
||||
// aValue, and are thus equivalent to NSToCoordFloor* for positive
|
||||
// values and NSToCoordCeil* for negative values.
|
||||
|
||||
inline nscoord NSToCoordTrunc(float aValue)
|
||||
{
|
||||
// There's no need to use truncf() since it matches the default
|
||||
// rules for float to integer conversion.
|
||||
return nscoord(aValue);
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordTrunc(double aValue)
|
||||
{
|
||||
// There's no need to use trunc() since it matches the default
|
||||
// rules for float to integer conversion.
|
||||
return nscoord(aValue);
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordTruncClamped(float aValue)
|
||||
{
|
||||
#ifndef NS_COORD_IS_FLOAT
|
||||
// Bounds-check before converting out of float, to avoid overflow
|
||||
if (aValue >= nscoord_MAX) {
|
||||
return nscoord_MAX;
|
||||
}
|
||||
if (aValue <= nscoord_MIN) {
|
||||
return nscoord_MIN;
|
||||
}
|
||||
#endif
|
||||
return NSToCoordTrunc(aValue);
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordTruncClamped(double aValue)
|
||||
{
|
||||
#ifndef NS_COORD_IS_FLOAT
|
||||
// Bounds-check before converting out of double, to avoid overflow
|
||||
if (aValue >= nscoord_MAX) {
|
||||
return nscoord_MAX;
|
||||
}
|
||||
if (aValue <= nscoord_MIN) {
|
||||
return nscoord_MIN;
|
||||
}
|
||||
#endif
|
||||
return NSToCoordTrunc(aValue);
|
||||
}
|
||||
|
||||
/*
|
||||
* Int Rounding Functions
|
||||
*/
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "nsXULAppAPI.h"
|
||||
#include "OrientationObserver.h"
|
||||
#include "UeventPoller.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include <algorithm>
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
|
||||
|
@ -290,6 +291,25 @@ public:
|
|||
hal_impl::SetLight(hal::eHalLightID_Battery, aConfig);
|
||||
|
||||
hal::NotifyBatteryChange(info);
|
||||
|
||||
{
|
||||
// bug 975667
|
||||
// Gecko gonk hal is required to emit battery charging/level notification via nsIObserverService.
|
||||
// This is useful for XPCOM components that are not statically linked to Gecko and cannot call
|
||||
// hal::EnableBatteryNotifications
|
||||
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
|
||||
nsCOMPtr<nsIWritablePropertyBag2> propbag =
|
||||
do_CreateInstance("@mozilla.org/hash-property-bag;1");
|
||||
if (obsService && propbag) {
|
||||
propbag->SetPropertyAsBool(NS_LITERAL_STRING("charging"),
|
||||
info.charging());
|
||||
propbag->SetPropertyAsDouble(NS_LITERAL_STRING("level"),
|
||||
info.level());
|
||||
|
||||
obsService->NotifyObservers(propbag, "gonkhal-battery-notifier", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,15 +9,10 @@ ifdef ENABLE_INTL_API
|
|||
ifndef MOZ_NATIVE_ICU
|
||||
# Library names: On Windows, ICU uses modified library names for static
|
||||
# and debug libraries.
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef MOZ_DEBUG
|
||||
ICU_LIB_SUFFIX=d
|
||||
endif
|
||||
endif # WINNT
|
||||
ifdef MOZ_SHARED_ICU
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef JS_SHARED_LIBRARY
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(libname)$(ICU_LIB_SUFFIX)$(MOZ_ICU_VERSION).dll)
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(libname)$(MOZ_ICU_DBG_SUFFIX)$(MOZ_ICU_VERSION).dll)
|
||||
endif
|
||||
else # ! WINNT
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
|
@ -39,7 +34,7 @@ ifdef ENABLE_INTL_API
|
|||
else # !MOZ_SHARED_ICU
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\
|
||||
cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(ICU_LIB_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname).lib;)
|
||||
cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(MOZ_ICU_DBG_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname).lib;)
|
||||
endif
|
||||
endif # MOZ_SHARED_ICU
|
||||
endif # !MOZ_NATIVE_ICU
|
||||
|
|
|
@ -169,13 +169,15 @@ inline To implicit_cast(From const &f) {
|
|||
// the expression is false, most compilers will issue a warning/error
|
||||
// containing the name of the variable.
|
||||
|
||||
// Avoid multiple definitions for webrtc
|
||||
#if !defined(COMPILE_ASSERT)
|
||||
template <bool>
|
||||
struct CompileAssert {
|
||||
};
|
||||
|
||||
#undef COMPILE_ASSERT
|
||||
#define COMPILE_ASSERT(expr, msg) \
|
||||
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
// Implementation details of COMPILE_ASSERT:
|
||||
//
|
||||
|
|
|
@ -709,6 +709,21 @@ public:
|
|||
m_formatter.oneByteOp64(OP_AND_GvEv, dst, base, offset);
|
||||
}
|
||||
|
||||
void andq_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst)
|
||||
{
|
||||
spew("andq %s0x%x(%s,%s,%d), %s",
|
||||
PRETTY_PRINT_OFFSET(offset), nameIReg(8,base), nameIReg(8,index), 1<<scale,
|
||||
nameIReg(8,dst));
|
||||
m_formatter.oneByteOp64(OP_AND_GvEv, dst, base, index, scale, offset);
|
||||
}
|
||||
|
||||
void andq_mr(const void *addr, RegisterID dst)
|
||||
{
|
||||
spew("andq %p, %s",
|
||||
addr, nameIReg(8,dst));
|
||||
m_formatter.oneByteOp64(OP_AND_GvEv, dst, addr);
|
||||
}
|
||||
|
||||
void orq_mr(int offset, RegisterID base, RegisterID dst)
|
||||
{
|
||||
spew("orq %s0x%x(%s), %s",
|
||||
|
@ -1492,6 +1507,14 @@ public:
|
|||
m_formatter.immediate32(imm);
|
||||
}
|
||||
|
||||
void testl_i32m(int imm, const void *addr)
|
||||
{
|
||||
spew("testl $0x%x, %p",
|
||||
imm, addr);
|
||||
m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, addr);
|
||||
m_formatter.immediate32(imm);
|
||||
}
|
||||
|
||||
void testb_im(int imm, int offset, RegisterID base)
|
||||
{
|
||||
FIXME_INSN_PRINTING;
|
||||
|
|
|
@ -257,7 +257,7 @@ function String_sup() {
|
|||
function EscapeAttributeValue(v) {
|
||||
var inputStr = ToString(v);
|
||||
var inputLen = inputStr.length;
|
||||
var outputStr = '';
|
||||
var outputStr = "";
|
||||
var chunkStart = 0;
|
||||
for (var i = 0; i < inputLen; i++) {
|
||||
if (inputStr[i] === '"') {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
Bug 1014976 - Don't make --enable-debug imply using the debug CRT in FFI
|
||||
|
||||
diff --git a/js/src/ctypes/libffi/msvcc.sh b/js/src/ctypes/libffi/msvcc.sh
|
||||
--- a/js/src/ctypes/libffi/msvcc.sh
|
||||
+++ b/js/src/ctypes/libffi/msvcc.sh
|
||||
@@ -100,19 +100,23 @@ do
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
# Enable debug symbol generation.
|
||||
args="$args -Zi"
|
||||
shift 1
|
||||
;;
|
||||
-DFFI_DEBUG)
|
||||
- # Link against debug CRT and enable runtime error checks.
|
||||
+ # Enable runtime error checks.
|
||||
args="$args -RTC1"
|
||||
defines="$defines $1"
|
||||
+ shift 1
|
||||
+ ;;
|
||||
+ -DUSE_DEBUG_RTL)
|
||||
+ # Link against debug CRT.
|
||||
md=-MDd
|
||||
shift 1
|
||||
;;
|
||||
-c)
|
||||
args="$args -c"
|
||||
args="$(echo $args | sed 's%/Fe%/Fo%g')"
|
||||
single="-c"
|
||||
shift 1
|
|
@ -105,9 +105,13 @@ do
|
|||
shift 1
|
||||
;;
|
||||
-DFFI_DEBUG)
|
||||
# Link against debug CRT and enable runtime error checks.
|
||||
# Enable runtime error checks.
|
||||
args="$args -RTC1"
|
||||
defines="$defines $1"
|
||||
shift 1
|
||||
;;
|
||||
-DUSE_DEBUG_RTL)
|
||||
# Link against debug CRT.
|
||||
md=-MDd
|
||||
shift 1
|
||||
;;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// Test that we can OSR with the same script on the stack multiple times.
|
||||
|
||||
var g = newGlobal();
|
||||
var dbg = new Debugger;
|
||||
|
||||
g.toggle = function toggle() {
|
||||
dbg.addDebuggee(g);
|
||||
var frame = dbg.getNewestFrame();
|
||||
}
|
||||
|
||||
g.eval("" + function f(x) {
|
||||
if (x == 0) {
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
f(x - 1);
|
||||
});
|
||||
|
||||
g.eval("f(3);");
|
|
@ -128,6 +128,43 @@ struct DebugModeOSREntry
|
|||
|
||||
typedef js::Vector<DebugModeOSREntry> DebugModeOSREntryVector;
|
||||
|
||||
class UniqueScriptOSREntryIter
|
||||
{
|
||||
const DebugModeOSREntryVector &entries_;
|
||||
size_t index_;
|
||||
|
||||
public:
|
||||
UniqueScriptOSREntryIter(const DebugModeOSREntryVector &entries)
|
||||
: entries_(entries),
|
||||
index_(0)
|
||||
{ }
|
||||
|
||||
bool done() {
|
||||
return index_ == entries_.length();
|
||||
}
|
||||
|
||||
const DebugModeOSREntry &entry() {
|
||||
MOZ_ASSERT(!done());
|
||||
return entries_[index_];
|
||||
}
|
||||
|
||||
UniqueScriptOSREntryIter &operator++() {
|
||||
MOZ_ASSERT(!done());
|
||||
while (++index_ < entries_.length()) {
|
||||
bool unique = true;
|
||||
for (size_t i = 0; i < index_; i++) {
|
||||
if (entries_[i].script == entries_[index_].script) {
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique)
|
||||
break;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
static bool
|
||||
CollectOnStackScripts(JSContext *cx, const JitActivationIterator &activation,
|
||||
DebugModeOSREntryVector &entries)
|
||||
|
@ -551,11 +588,12 @@ UndoRecompileBaselineScriptsForDebugMode(JSContext *cx,
|
|||
{
|
||||
// In case of failure, roll back the entire set of active scripts so that
|
||||
// we don't have to patch return addresses on the stack.
|
||||
for (size_t i = 0; i < entries.length(); i++) {
|
||||
JSScript *script = entries[i].script;
|
||||
for (UniqueScriptOSREntryIter iter(entries); !iter.done(); ++iter) {
|
||||
const DebugModeOSREntry &entry = iter.entry();
|
||||
JSScript *script = entry.script;
|
||||
BaselineScript *baselineScript = script->baselineScript();
|
||||
if (entries[i].recompiled()) {
|
||||
script->setBaselineScript(cx, entries[i].oldBaselineScript);
|
||||
if (entry.recompiled()) {
|
||||
script->setBaselineScript(cx, entry.oldBaselineScript);
|
||||
BaselineScript::Destroy(cx->runtime()->defaultFreeOp(), baselineScript);
|
||||
}
|
||||
}
|
||||
|
@ -602,9 +640,10 @@ jit::RecompileOnStackBaselineScriptsForDebugMode(JSContext *cx, JSCompartment *c
|
|||
//
|
||||
// After this point the function must be infallible.
|
||||
|
||||
for (size_t i = 0; i < entries.length(); i++) {
|
||||
if (entries[i].recompiled())
|
||||
BaselineScript::Destroy(cx->runtime()->defaultFreeOp(), entries[i].oldBaselineScript);
|
||||
for (UniqueScriptOSREntryIter iter(entries); !iter.done(); ++iter) {
|
||||
const DebugModeOSREntry &entry = iter.entry();
|
||||
if (entry.recompiled())
|
||||
BaselineScript::Destroy(cx->runtime()->defaultFreeOp(), entry.oldBaselineScript);
|
||||
}
|
||||
|
||||
size_t processed = 0;
|
||||
|
|
|
@ -859,9 +859,9 @@ static const VMFunctionsModal PrimitiveToStringInfo = VMFunctionsModal(
|
|||
FunctionInfo<PrimitiveToStringParFn>(PrimitiveToStringPar));
|
||||
|
||||
bool
|
||||
CodeGenerator::visitPrimitiveToString(LPrimitiveToString *lir)
|
||||
CodeGenerator::visitValueToString(LValueToString *lir)
|
||||
{
|
||||
ValueOperand input = ToValue(lir, LPrimitiveToString::Input);
|
||||
ValueOperand input = ToValue(lir, LValueToString::Input);
|
||||
Register output = ToRegister(lir->output());
|
||||
|
||||
OutOfLineCode *ool = oolCallVM(PrimitiveToStringInfo, lir, (ArgList(), input),
|
||||
|
@ -931,9 +931,18 @@ CodeGenerator::visitPrimitiveToString(LPrimitiveToString *lir)
|
|||
masm.bind(¬Boolean);
|
||||
}
|
||||
|
||||
// Object
|
||||
if (lir->mir()->input()->mightBeType(MIRType_Object)) {
|
||||
// Bail.
|
||||
JS_ASSERT(lir->mir()->fallible());
|
||||
Label bail;
|
||||
masm.branchTestObject(Assembler::Equal, tag, &bail);
|
||||
if (!bailoutFrom(&bail, lir->snapshot()))
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Objects are not supported or we see a type that wasn't accounted for.
|
||||
masm.assumeUnreachable("Unexpected type for MPrimitiveToString.");
|
||||
masm.assumeUnreachable("Unexpected type for MValueToString.");
|
||||
#endif
|
||||
|
||||
masm.bind(&done);
|
||||
|
@ -5833,7 +5842,7 @@ CodeGenerator::emitArrayPopShift(LInstruction *lir, const MArrayPopShift *mir, R
|
|||
}
|
||||
|
||||
// VM call if a write barrier is necessary.
|
||||
masm.branchTestNeedsBarrier(Assembler::NonZero, lengthTemp, ool->entry());
|
||||
masm.branchTestNeedsBarrier(Assembler::NonZero, ool->entry());
|
||||
|
||||
// Load elements and length.
|
||||
masm.loadPtr(Address(obj, JSObject::offsetOfElements()), elementsTemp);
|
||||
|
@ -6096,7 +6105,7 @@ CodeGenerator::visitIteratorStart(LIteratorStart *lir)
|
|||
masm.branchPtr(Assembler::NotEqual, objAddr, obj, ool->entry());
|
||||
#else
|
||||
Label noBarrier;
|
||||
masm.branchTestNeedsBarrier(Assembler::Zero, temp1, &noBarrier);
|
||||
masm.branchTestNeedsBarrier(Assembler::Zero, &noBarrier);
|
||||
|
||||
Address objAddr(niTemp, offsetof(NativeIterator, obj));
|
||||
masm.branchPtr(Assembler::NotEqual, objAddr, obj, ool->entry());
|
||||
|
|
|
@ -93,7 +93,7 @@ class CodeGenerator : public CodeGeneratorSpecific
|
|||
void emitIntToString(Register input, Register output, Label *ool);
|
||||
bool visitIntToString(LIntToString *lir);
|
||||
bool visitDoubleToString(LDoubleToString *lir);
|
||||
bool visitPrimitiveToString(LPrimitiveToString *lir);
|
||||
bool visitValueToString(LValueToString *lir);
|
||||
bool visitInteger(LInteger *lir);
|
||||
bool visitRegExp(LRegExp *lir);
|
||||
bool visitRegExpExec(LRegExpExec *lir);
|
||||
|
|
|
@ -736,6 +736,7 @@ class IonBuilder : public MIRGenerator
|
|||
InliningStatus inlineHaveSameClass(CallInfo &callInfo);
|
||||
InliningStatus inlineToObject(CallInfo &callInfo);
|
||||
InliningStatus inlineToInteger(CallInfo &callInfo);
|
||||
InliningStatus inlineToString(CallInfo &callInfo);
|
||||
InliningStatus inlineDump(CallInfo &callInfo);
|
||||
InliningStatus inlineHasClass(CallInfo &callInfo, const Class *clasp) {
|
||||
return inlineHasClasses(callInfo, clasp, nullptr);
|
||||
|
|
|
@ -645,11 +645,10 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
branch32(cond, length, Imm32(key.constant()), label);
|
||||
}
|
||||
|
||||
void branchTestNeedsBarrier(Condition cond, Register scratch, Label *label) {
|
||||
void branchTestNeedsBarrier(Condition cond, Label *label) {
|
||||
JS_ASSERT(cond == Zero || cond == NonZero);
|
||||
CompileZone *zone = GetIonContext()->compartment->zone();
|
||||
movePtr(ImmPtr(zone->addressOfNeedsBarrier()), scratch);
|
||||
Address needsBarrierAddr(scratch, 0);
|
||||
AbsoluteAddress needsBarrierAddr(zone->addressOfNeedsBarrier());
|
||||
branchTest32(cond, needsBarrierAddr, Imm32(0x1), label);
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче