Browse Source

import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1198124 - Enable -Wshadow in directories that have no -Wshadow warnings. r=glandium (d03cfc1bb6)
- Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8 (3247b5b146)
- Bug 1140120 - Remove a couple of unused test functions on ServiceWorkerContainer; r=baku (efe1119749)
- Bug 1180148 - Clear service workers registered for a site when clearing the cookies and stored data is not working in b2g. r=baku (7fb1d522ff)
- Bug 1162333 - Add stronger assertions to PromiseWorkerProxy in debug builds. r=catalinb (0005a76252)
- Bug 1190672 - Fix use of AutoReleasePromiseWorkerProxy in PushManager. r=catalinb (18f7358163)
- Bug 1191495 - Relax PushManager callback assertions. r=kitcambridge (8a3822969f)
- Bug 1189543 - pushManager.getSubscription() should return null for nonexistent push subscriptions in workers. r=nsm (b990083262)
- spacing (44b87017a7)
- Bug 1180295 - Rip out the Fennec code to set the screen render offset. r=rbarker (67183ae8bf)
- Bug 1187804 - Un-adjust fixed layers by the async transform of the scroll frame that they're fixed with respect to, not of the nearest ancestor scroll frame. r=kats (7c5e7ac29c)
- Bug 1131359 - Fix an include-what-you-use error in AsyncCompositionManager.cpp. r=kats (fe04815939)
- Bug 1187804 - When a layer is scrolled by multiple scroll frames, do an AlignFixedAndStickyLayers pass on its subtree for each of the scroll frames. r=kats (031a5686f1)
- Bug 1180295 - Stop clipping the content while the toolbar is in the process of sliding off. r=rbarker (9d806870e4)
- Bug 1186968 - Fix Compositor::SetScreenRotation() call r=nical (e554c4b4a2)
- Bug 1180295 - Implement seamless snapping to the stable state. r=rbarker (d1e7978eb7)
- Bug 1131470 - Part 1: Rename existing use of ScreenOrientation to ScreenOrientationInternal. r=baku (63f0cb994b)
- Bug 1131470 - Part 2: Update screen configuration HAL to report orientation angle. r=snorp,mwu (39b537f008)
- Bug 1167597 - Mark PromiseReportRejectFeature::mPromise as MOZ_NON_OWNING_REF. r=ehsan (3ad520790a)
- Bug 1086627 - Rename Promise constructs to more closely match the specification. r=nsm,jst (cea1d71cb1)
- Bug 1086627 - Rename ThenableResolverTask to PromiseResolveThenableJob to more closely match Promise spec. r=nsm (e7102fe506)
- Bug 1164725 - Convert flags in nsIDocument into bit fields. r=smaug (9f5d5f352d)
- Bug 1192467 - Formalize precondition that SetDisplayDocument must not be called with null. - r=peterv (1aa8e91d14)
- Bug 1153841 - Remove the 'it must be 2D' restriction for transforms on fixed-pos layers. r=BenWa,mattwoodrow (5bab86ec6a)
- Bug 1173521 - Properly handle unapplying 3D projective transforms to rectangles in APZ code. r=botond (45c9850d5c)
- Bug 1166301 - When applying an async adjustment to a fixed layer, only adjust its mask layer under the same circumstances as its clip rect. r=mattwoodrow (2801c48fe9)
- Bug 1166301 - Update an old comment in AsyncCompositionManager::AlignFixedAndStickyLayers. r=kats (7e1d5c97d0)
- Bug 1166301 - Allow async scrolling to move the clip rects of fixed background layers. r=mattwoodrow (edd889ec2b)
- Bug 1200399 - Only send the RCD's metrics to Java-land for fennec-apz. r=rbarker (3b36a52f3a)
- Bug 1201625 - Special-case B2GDroid since it doesn't have a root content document. r=rbarker (4fcdda1b0a)
- Bug 1201529 - Fall back to rootmost metrics if there is no root content document metrics. r=botond (615c2ee727)
- Bug 1201581 - Extract a helper method. r=rbarker (f2cccb8666)
- Bug 1201581 - Hook up the syncFrameMetrics call to sync metrics info from the compositor to Java-land on each composite. r=rbarker (48e15bbde8)
- Bug 1203760 P1 Allow pipe to wake up multiple streams at the same time. r=froydnj (5baed00637)
- Bug 1203760 P2 Add gtests for nsPipeInputStream AsyncRead(). r=froydnj (52e5129dc8)
- Bug 1201889 - When adjusting fixed and sticky layers in AsyncCompsitionManager, unapply all async transforms on the path from the fixed layer to the layer it's fixed with respect to. r=kats (dbb203178e)
- Bug 1165536. Don't include resolution compensation when adjusting the cliprect of ancestors of scrollbars. r=botond (3bef5f2c18)
- Fix async transforms on scrollbars not including any existing shadow transform. (bug 1128740 part 2, r=botond) (af12d76775)
- missing of Bug 943728 - Replace double quotes with single quotes in Makefiles (e11470540f)
- Bug 1188766 - Avoid exporting UPLOAD_EXTRA_FILES from mozconfig. r=mshal (4241b9e80b)
- Fixup for bug 1188766 for valgrind bustage on a CLOSED TREE. r=me (4401dedf06)
- Bug 1077622 - Fixes cp missing operand message if no .mozconfig found r=glandium (6eca1e5214)
- Bug 1200523 - Remove leftover debugging code from js/src/Makefile.in; r=ted (414b72c74e)
- spacing (99cda3f8a7)
pull/8/head
roytam1 4 months ago
parent
commit
1367963d3d
  1. 3
      accessible/windows/ia2/moz.build
  2. 3
      accessible/windows/msaa/moz.build
  3. 3
      accessible/windows/sdn/moz.build
  4. 3
      b2g/app/moz.build
  5. 3
      browser/app/moz.build
  6. 4
      browser/components/dirprovider/DirectoryProvider.cpp
  7. 40
      browser/locales/Makefile.in
  8. 2
      build/mozconfig.cache
  9. 15
      client.mk
  10. 3
      docshell/build/moz.build
  11. 3
      dom/apps/moz.build
  12. 3
      dom/archivereader/moz.build
  13. 18
      dom/base/ScreenOrientation.h
  14. 15
      dom/base/nsDOMWindowUtils.cpp
  15. 117
      dom/base/nsIDocument.h
  16. 22
      dom/base/nsScreen.cpp
  17. 2
      dom/base/nsScreen.h
  18. 3
      dom/canvas/compiledtest/moz.build
  19. 4
      dom/interfaces/base/nsIDOMWindowUtils.idl
  20. 5
      dom/ipc/PBrowser.ipdl
  21. 2
      dom/ipc/TabChild.cpp
  22. 6
      dom/ipc/TabChild.h
  23. 2
      dom/ipc/TabParent.cpp
  24. 2
      dom/ipc/TabParent.h
  25. 2
      dom/media/webrtc/MediaEngineGonkVideoSource.cpp
  26. 117
      dom/promise/Promise.cpp
  27. 15
      dom/promise/Promise.h
  28. 250
      dom/push/PushManager.cpp
  29. 3
      dom/push/moz.build
  30. 2
      dom/webidl/Promise.webidl
  31. 6
      dom/webidl/ServiceWorkerContainer.webidl
  32. 17
      dom/workers/ServiceWorkerContainer.cpp
  33. 10
      dom/workers/ServiceWorkerContainer.h
  34. 119
      dom/workers/ServiceWorkerManager.cpp
  35. 7
      dom/workers/ServiceWorkerManager.h
  36. 7
      dom/workers/ServiceWorkerWindowClient.cpp
  37. 3
      dom/xml/moz.build
  38. 3
      dom/xslt/xml/moz.build
  39. 8
      gfx/layers/client/ClientLayerManager.cpp
  40. 2
      gfx/layers/client/ClientLayerManager.h
  41. 31
      gfx/layers/client/ClientTiledPaintedLayer.cpp
  42. 35
      gfx/layers/client/TiledContentClient.cpp
  43. 5
      gfx/layers/client/TiledContentClient.h
  44. 416
      gfx/layers/composite/AsyncCompositionManager.cpp
  45. 38
      gfx/layers/composite/AsyncCompositionManager.h
  46. 12
      gfx/layers/ipc/CompositorParent.cpp
  47. 3
      gfx/layers/ipc/CompositorParent.h
  48. 14
      gfx/layers/ipc/LayerTransactionParent.cpp
  49. 4
      gfx/layers/ipc/LayerTransactionParent.h
  50. 4
      gfx/layers/ipc/LayersMessages.ipdlh
  51. 6
      gfx/layers/ipc/PLayerTransaction.ipdl
  52. 12
      gfx/layers/ipc/ShadowLayers.cpp
  53. 5
      gfx/layers/ipc/ShadowLayers.h
  54. 3
      gfx/layers/ipc/ShadowLayersManager.h
  55. 2
      gfx/vr/gfxVRCardboard.cpp
  56. 2
      hal/Hal.cpp
  57. 2
      hal/Hal.h
  58. 10
      hal/android/AndroidHal.cpp
  59. 6
      hal/fallback/FallbackScreenConfiguration.cpp
  60. 2
      hal/gonk/GonkHal.cpp
  61. 7
      hal/sandbox/PHal.ipdl
  62. 4
      hal/sandbox/SandboxHal.cpp
  63. 2
      js/src/Makefile.in
  64. 36
      layout/base/UnitTransforms.h
  65. 3
      layout/base/gtest/moz.build
  66. 3
      layout/inspector/moz.build
  67. 3
      memory/build/moz.build
  68. 3
      memory/mozjemalloc/moz.build
  69. 3
      memory/replace/dummy/moz.build
  70. 3
      memory/replace/jemalloc/moz.build
  71. 3
      netwerk/protocol/app/moz.build
  72. 3
      netwerk/protocol/device/moz.build
  73. 3
      netwerk/protocol/viewsource/moz.build
  74. 3
      netwerk/socket/moz.build
  75. 3
      parser/xml/moz.build
  76. 3
      storage/build/moz.build
  77. 4
      toolkit/components/mediasniffer/moz.build
  78. 3
      view/moz.build
  79. 14
      widget/gonk/OrientationObserver.cpp
  80. 4
      widget/gonk/OrientationObserver.h
  81. 15
      widget/gonk/nsScreenManagerGonk.cpp
  82. 3
      widget/gtkxtbin/moz.build
  83. 3
      widget/x11/moz.build
  84. 33
      xpcom/base/SystemMemoryReporter.cpp
  85. 3
      xpcom/base/moz.build
  86. 6
      xpcom/base/nsStatusReporterManager.cpp
  87. 4
      xpcom/build/moz.build
  88. 3
      xpcom/components/moz.build
  89. 3
      xpcom/ds/moz.build
  90. 6
      xpcom/ds/nsVariant.cpp
  91. 14
      xpcom/glue/GenericModule.cpp
  92. 3
      xpcom/glue/moz.build
  93. 18
      xpcom/glue/nsCRTGlue.cpp
  94. 4
      xpcom/glue/nsTArray-inl.h
  95. 3
      xpcom/glue/standalone/moz.build
  96. 3
      xpcom/glue/standalone/staticruntime/moz.build
  97. 186
      xpcom/glue/tests/gtest/TestThreadUtils.cpp
  98. 4
      xpcom/io/moz.build
  99. 42
      xpcom/io/nsEscape.cpp
  100. 6
      xpcom/io/nsLocalFileCommon.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

3
accessible/windows/ia2/moz.build

@ -47,6 +47,9 @@ LOCAL_INCLUDES += [
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
# The midl generated code include Windows headers which defines min and max
# macros which conflicts with std::min/max. Suppress the macros:
if CONFIG['OS_ARCH'] == 'WINNT':

3
accessible/windows/msaa/moz.build

@ -60,3 +60,6 @@ LOCAL_INCLUDES += [
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']

3
accessible/windows/sdn/moz.build

@ -24,3 +24,6 @@ LOCAL_INCLUDES += [
DEFINES['NOMINMAX'] = True
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']

3
b2g/app/moz.build

@ -75,6 +75,9 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'version',
]
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
JS_PREFERENCE_FILES += [
'b2g.js',
]

3
browser/app/moz.build

@ -91,3 +91,6 @@ if CONFIG['HAVE_CLOCK_MONOTONIC']:
OS_LIBS += CONFIG['REALTIME_LIBS']
JAR_MANIFESTS += ['jar.mn']
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']

4
browser/components/dirprovider/DirectoryProvider.cpp

@ -28,8 +28,8 @@ namespace mozilla {
namespace browser {
NS_IMPL_ISUPPORTS(DirectoryProvider,
nsIDirectoryServiceProvider,
nsIDirectoryServiceProvider2)
nsIDirectoryServiceProvider,
nsIDirectoryServiceProvider2)
NS_IMETHODIMP
DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)

40
browser/locales/Makefile.in

@ -43,7 +43,7 @@ ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
endif
ifeq (WINNT,$(OS_ARCH))
@ -54,10 +54,10 @@ UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(STAGEDIST)/uninstall; \
cp ../installer/windows/l10ngen/setup.exe $(_ABS_DIST)/l10n-stage; \
$(NULL)
STUB_HOOK = $(NSINSTALL) -D "$(_ABS_DIST)/$(PKG_INST_PATH)"; \
$(RM) "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
cp ../installer/windows/l10ngen/stub.exe "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
chmod 0755 "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
STUB_HOOK = $(NSINSTALL) -D '$(_ABS_DIST)/$(PKG_INST_PATH)'; \
$(RM) '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
cp ../installer/windows/l10ngen/stub.exe '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
chmod 0755 '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
$(NULL)
endif
@ -138,20 +138,20 @@ libs-%:
repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
repackage-win32-installer: $(call ESCAPE_WILDCARD,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
@echo 'Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT).'
$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
$(MAKE) repackage-zip \
AB_CD=$(AB_CD) \
MOZ_PKG_FORMAT=SFX7Z \
ZIP_IN="$(WIN32_INSTALLER_IN)" \
ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
$(topsrcdir)/browser/installer/windows/app.tag"
ZIP_IN='$(WIN32_INSTALLER_IN)' \
ZIP_OUT='$(WIN32_INSTALLER_OUT)' \
SFX_HEADER='$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
$(topsrcdir)/browser/installer/windows/app.tag'
ifeq (WINNT,$(OS_ARCH))
repackage-win32-installer-%: $(STAGEDIST)
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)'
repackage-zip-%: repackage-win32-installer-%
else
@ -179,7 +179,7 @@ langpack: langpack-$(AB_CD)
# tinderbox scripts. Alter it with caution.
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
@echo "repackaging done"
@echo 'repackaging done'
ifdef MOZ_UPDATER
# Note that we want updater.ini to be in the top directory, not the browser/
@ -187,22 +187,22 @@ ifdef MOZ_UPDATER
libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
ifeq ($(OS_ARCH),WINNT)
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
$(FINAL_TARGET)/../updater.ini
else
cat $< | \
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
$(FINAL_TARGET)/../updater.ini
endif
endif
ident:
@printf "fx_revision "
@printf 'fx_revision '
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
$(STAGEDIST)/application.ini App SourceStamp
@printf "buildid "
@printf 'buildid '
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
$(STAGEDIST)/application.ini App BuildID
@ -219,7 +219,7 @@ l10n-check:: INNER_UNMAKE_PACKAGE=true
l10n-check::
$(RM) -rf x-test
$(NSINSTALL) -D x-test/toolkit
echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir'
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)
cd $(DIST)/l10n-stage && test $$(cat $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/update.locale) = x-test

2
build/mozconfig.cache

@ -60,7 +60,7 @@ else
ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
mk_add_options "export UPLOAD_EXTRA_FILES+=sccache.log.gz"
mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
case "$platform" in
win*)
# sccache supports a special flag to create depfiles.

15
client.mk

@ -190,9 +190,10 @@ WANT_MOZCONFIG_MK = 1
endif
ifdef WANT_MOZCONFIG_MK
# For now, only output "export" lines from mach environment --format=client.mk output.
MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
$(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
# For now, only output "export" lines and lines containing UPLOAD_EXTRA_FILES
# from mach environment --format=client.mk output.
MOZCONFIG_MK_LINES := $(filter export||% UPLOAD_EXTRA_FILES% %UPLOAD_EXTRA_FILES%,$(MOZCONFIG_OUT_LINES))
$(OBJDIR)/.mozconfig.mk: $(TOPSRCDIR)/client.mk $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
# Include that makefile so that it is created. This should not actually change
@ -201,12 +202,6 @@ $(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDI
include $(OBJDIR)/.mozconfig.mk
endif
# UPLOAD_EXTRA_FILES is appended to and exported from mozconfig, which makes
# submakes as well as configure add even more to that, so just unexport it
# for submakes to pick it from .mozconfig.mk and for configure to pick it
# from mach environment.
unexport UPLOAD_EXTRA_FILES
# Print out any options loaded from mozconfig.
all realbuild clean distclean export libs install realclean::
ifneq (,$(strip $(MOZCONFIG_OUT_FILTERED)))
@ -356,7 +351,9 @@ endif
$(OBJDIR)/.mozconfig.json: $(call mkdir_deps,$(OBJDIR)) ;
save-mozconfig: $(FOUND_MOZCONFIG)
ifdef FOUND_MOZCONFIG
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
endif
configure:: $(configure-preqs)
@echo cd $(OBJDIR);

3
docshell/build/moz.build

@ -24,3 +24,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
LOCAL_INCLUDES += ['/uriloader/exthandler/mac']
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']

3
dom/apps/moz.build

@ -51,6 +51,9 @@ EXTRA_PP_JS_MODULES += [
'Webapps.jsm',
]
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [

3
dom/archivereader/moz.build

@ -21,6 +21,9 @@ UNIFIED_SOURCES += [
'ArchiveZipFile.cpp',
]
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
LOCAL_INCLUDES += [
'../base',
]

18
dom/base/ScreenOrientation.h

@ -10,18 +10,18 @@
namespace mozilla {
namespace dom {
// Make sure that any change here is also made in
// * mobile/android/base/GeckoScreenOrientationListener.java
typedef uint32_t ScreenOrientation;
// Make sure that any change to ScreenOrientationInternal values are
// also made in mobile/android/base/GeckoScreenOrientation.java
typedef uint32_t ScreenOrientationInternal;
static const ScreenOrientation eScreenOrientation_None = 0;
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
static const ScreenOrientationInternal eScreenOrientation_None = 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientationInternal eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientationInternal eScreenOrientation_LandscapeSecondary = 1u << 3;
//eScreenOrientation_Default will use the natural orientation for the deivce,
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
static const ScreenOrientation eScreenOrientation_Default = 1u << 4;
static const ScreenOrientationInternal eScreenOrientation_Default = 1u << 4;
} // namespace dom
} // namespace mozilla

15
dom/base/nsDOMWindowUtils.cpp

@ -3893,6 +3893,21 @@ nsDOMWindowUtils::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
aRetVal);
}
NS_IMETHODIMP
nsDOMWindowUtils::SetNextPaintSyncId(int32_t aSyncId)
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
if (nsIWidget* widget = GetWidget()) {
nsRefPtr<LayerManager> lm = widget->GetLayerManager();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
ClientLayerManager* clm = static_cast<ClientLayerManager*>(lm.get());
clm->SetNextPaintSyncId(aSyncId);
}
}
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)

117
dom/base/nsIDocument.h

@ -1775,14 +1775,15 @@ public:
*/
void SetDisplayDocument(nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(!GetShell() &&
!GetContainer() &&
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
NS_PRECONDITION(aDisplayDocument != this, "Should be different document");
NS_PRECONDITION(!aDisplayDocument->GetDisplayDocument(),
"Display documents should not nest");
MOZ_ASSERT(!GetShell() &&
!GetContainer() &&
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
MOZ_ASSERT(aDisplayDocument, "Must not be null");
MOZ_ASSERT(aDisplayDocument != this, "Should be different document");
MOZ_ASSERT(!aDisplayDocument->GetDisplayDocument(),
"Display documents should not nest");
mDisplayDocument = aDisplayDocument;
mHasDisplayDocument = !!aDisplayDocument;
}
@ -1803,7 +1804,7 @@ public:
virtual ~ExternalResourceLoad() {}
void AddObserver(nsIObserver* aObserver) {
NS_PRECONDITION(aObserver, "Must have observer");
MOZ_ASSERT(aObserver, "Must have observer");
mObservers.AppendElement(aObserver);
}
@ -2794,127 +2795,119 @@ protected:
mozilla::dom::VisibilityState mVisibilityState;
// True if BIDI is enabled.
bool mBidiEnabled;
bool mBidiEnabled : 1;
// True if a MathML element has ever been owned by this document.
bool mMathMLEnabled;
bool mMathMLEnabled : 1;
// True if this document is the initial document for a window. This should
// basically be true only for documents that exist in newly-opened windows or
// documents created to satisfy a GetDocument() on a window when there's no
// document in it.
bool mIsInitialDocumentInWindow;
bool mIsInitialDocumentInWindow : 1;
// True if we're loaded as data and therefor has any dangerous stuff, such
// as scripts and plugins, disabled.
bool mLoadedAsData;
bool mLoadedAsData : 1;
// This flag is only set in XMLDocument, for e.g. documents used in XBL. We
// don't want animations to play in such documents, so we need to store the
// flag here so that we can check it in nsDocument::GetAnimationController.
bool mLoadedAsInteractiveData;
bool mLoadedAsInteractiveData : 1;
// If true, whoever is creating the document has gotten it to the
// point where it's safe to start layout on it.
bool mMayStartLayout;
bool mMayStartLayout : 1;
// True iff we've ever fired a DOMTitleChanged event for this document
bool mHaveFiredTitleChange;
bool mHaveFiredTitleChange : 1;
// True iff IsShowing() should be returning true
bool mIsShowing;
bool mIsShowing : 1;
// True iff the document "page" is not hidden (i.e. currently in the
// bfcache)
bool mVisible;
bool mVisible : 1;
// True if our content viewer has been removed from the docshell
// (it may still be displayed, but in zombie state). Form control data
// has been saved.
bool mRemovedFromDocShell;
bool mRemovedFromDocShell : 1;
// True iff DNS prefetch is allowed for this document. Note that if the
// document has no window, DNS prefetch won't be performed no matter what.
bool mAllowDNSPrefetch;
bool mAllowDNSPrefetch : 1;
// True when this document is a static clone of a normal document
bool mIsStaticDocument;
bool mIsStaticDocument : 1;
// True while this document is being cloned to a static document.
bool mCreatingStaticClone;
bool mCreatingStaticClone : 1;
// True iff the document is being unlinked or deleted.
bool mInUnlinkOrDeletion;
bool mInUnlinkOrDeletion : 1;
// True if document has ever had script handling object.
bool mHasHadScriptHandlingObject;
bool mHasHadScriptHandlingObject : 1;
// True if we're an SVG document being used as an image.
bool mIsBeingUsedAsImage;
bool mIsBeingUsedAsImage : 1;
// True is this document is synthetic : stand alone image, video, audio
// file, etc.
bool mIsSyntheticDocument;
bool mIsSyntheticDocument : 1;
// True if this document has links whose state needs updating
bool mHasLinksToUpdate;
bool mHasLinksToUpdate : 1;
// True if a layout flush might not be a no-op
bool mNeedLayoutFlush;
bool mNeedLayoutFlush : 1;
// True if a style flush might not be a no-op
bool mNeedStyleFlush;
bool mNeedStyleFlush : 1;
// True if a DOMMutationObserver is perhaps attached to a node in the document.
bool mMayHaveDOMMutationObservers;
bool mMayHaveDOMMutationObservers : 1;
// True if an nsIAnimationObserver is perhaps attached to a node in the document.
bool mMayHaveAnimationObservers;
bool mMayHaveAnimationObservers : 1;
// True if a document has loaded Mixed Active Script (see nsMixedContentBlocker.cpp)
bool mHasMixedActiveContentLoaded;
bool mHasMixedActiveContentLoaded : 1;
// True if a document has blocked Mixed Active Script (see nsMixedContentBlocker.cpp)
bool mHasMixedActiveContentBlocked;
bool mHasMixedActiveContentBlocked : 1;
// True if a document has loaded Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
bool mHasMixedDisplayContentLoaded;
bool mHasMixedDisplayContentLoaded : 1;
// True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
bool mHasMixedDisplayContentBlocked;
bool mHasMixedDisplayContentBlocked : 1;
// True if a document has blocked Tracking Content
bool mHasTrackingContentBlocked;
bool mHasTrackingContentBlocked : 1;
// True if a document has loaded Tracking Content
bool mHasTrackingContentLoaded;
bool mHasTrackingContentLoaded : 1;
// True if DisallowBFCaching has been called on this document.
bool mBFCacheDisallowed;
bool mBFCacheDisallowed : 1;
// If true, we have an input encoding. If this is false, then the
// document was created entirely in memory
bool mHaveInputEncoding;
bool mHaveInputEncoding : 1;
bool mHasHadDefaultView;
bool mHasHadDefaultView : 1;
// Whether style sheet change events will be dispatched for this document
bool mStyleSheetChangeEventsEnabled;
bool mStyleSheetChangeEventsEnabled : 1;
// Whether the document was created by a srcdoc iframe.
bool mIsSrcdocDocument;
bool mIsSrcdocDocument : 1;
// Records whether we've done a document.open. If this is true, it's possible
// for nodes from this document to have outdated wrappers in their wrapper
// caches.
bool mDidDocumentOpen;
#ifdef DEBUG
/**
* This is true while FlushPendingLinkUpdates executes. Calls to
* [Un]RegisterPendingLinkUpdate will assert when this is true.
*/
bool mIsLinkUpdateRegistrationsForbidden;
#endif
bool mDidDocumentOpen : 1;
// Whether this document has a display document and thus is considered to
// be a resource document. Normally this is the same as !!mDisplayDocument,
@ -2923,13 +2916,13 @@ protected:
bool mHasDisplayDocument : 1;
// Is the current mFontFaceSet valid?
bool mFontFaceSetDirty;
bool mFontFaceSetDirty : 1;
// Has GetUserFontSet() been called?
bool mGetUserFontSetCalled;
bool mGetUserFontSetCalled : 1;
// Do we currently have an event posted to call FlushUserFontSet?
bool mPostedFlushUserFontSet;
bool mPostedFlushUserFontSet : 1;
enum Type {
eUnknown, // should never be used
@ -2940,17 +2933,25 @@ protected:
eXUL
};
uint8_t mType;
Type mType;
uint8_t mDefaultElementType;
enum {
enum Tri {
eTriUnset = 0,
eTriFalse,
eTriTrue
};
uint8_t mAllowXULXBL;
Tri mAllowXULXBL;
#ifdef DEBUG
/**
* This is true while FlushPendingLinkUpdates executes. Calls to
* [Un]RegisterPendingLinkUpdate will assert when this is true.
*/
bool mIsLinkUpdateRegistrationsForbidden;
#endif
// The document's script global object, the object from which the
// document can get its script context and scope. This is the
@ -3030,7 +3031,7 @@ protected:
nsTArray<nsWeakPtr> mBlockedTrackingNodes;
// Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow,
// updated on every set of mSecriptGlobalObject.
// updated on every set of mScriptGlobalObject.
nsPIDOMWindow *mWindow;
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;

22
dom/base/nsScreen.cpp

@ -40,7 +40,7 @@ nsScreen::Create(nsPIDOMWindow* aWindow)
hal::RegisterScreenConfigurationObserver(screen);
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
screen->mOrientation = config.orientation();
screen->mOrientationInternal = config.orientation();
return screen.forget();
}
@ -165,16 +165,16 @@ nsScreen::GetAvailRect(nsRect& aRect)
void
nsScreen::Notify(const hal::ScreenConfiguration& aConfiguration)
{
ScreenOrientation previousOrientation = mOrientation;
mOrientation = aConfiguration.orientation();
ScreenOrientationInternal previousOrientation = mOrientationInternal;
mOrientationInternal = aConfiguration.orientation();
NS_ASSERTION(mOrientation == eScreenOrientation_PortraitPrimary ||
mOrientation == eScreenOrientation_PortraitSecondary ||
mOrientation == eScreenOrientation_LandscapePrimary ||
mOrientation == eScreenOrientation_LandscapeSecondary,
NS_ASSERTION(mOrientationInternal == eScreenOrientation_PortraitPrimary ||
mOrientationInternal == eScreenOrientation_PortraitSecondary ||
mOrientationInternal == eScreenOrientation_LandscapePrimary ||
mOrientationInternal == eScreenOrientation_LandscapeSecondary,
"Invalid orientation value passed to notify method!");
if (mOrientation != previousOrientation) {
if (mOrientationInternal != previousOrientation) {
DispatchTrustedEvent(NS_LITERAL_STRING("mozorientationchange"));
}
}
@ -185,7 +185,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
if (ShouldResistFingerprinting()) {
aOrientation.AssignLiteral("landscape-primary");
} else {
switch (mOrientation) {
switch (mOrientationInternal) {
case eScreenOrientation_PortraitPrimary:
aOrientation.AssignLiteral("portrait-primary");
break;
@ -200,7 +200,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
break;
case eScreenOrientation_None:
default:
MOZ_CRASH("Unacceptable mOrientation value");
MOZ_CRASH("Unacceptable mOrientationInternal value");
}
}
}
@ -259,7 +259,7 @@ bool
nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
ErrorResult& aRv)
{
ScreenOrientation orientation = eScreenOrientation_None;
ScreenOrientationInternal orientation = eScreenOrientation_None;
for (uint32_t i = 0; i < aOrientations.Length(); ++i) {
const nsString& item = aOrientations[i];

2
dom/base/nsScreen.h

@ -133,7 +133,7 @@ protected:
nsresult GetAvailRect(nsRect& aRect);
nsresult GetWindowInnerRect(nsRect& aRect);
mozilla::dom::ScreenOrientation mOrientation;
mozilla::dom::ScreenOrientationInternal mOrientationInternal;
private:
class FullScreenEventListener final : public nsIDOMEventListener

3
dom/canvas/compiledtest/moz.build

@ -11,6 +11,9 @@ GeckoCppUnitTests([
'TestWebGLElementArrayCache',
])
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
LOCAL_INCLUDES += [
'../',
]

4
dom/interfaces/base/nsIDOMWindowUtils.idl

@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
interface nsIObserver;
[scriptable, uuid(6af09215-d909-4d4a-866e-bdaed8fdcb96)]
[scriptable, uuid(6ddc9a79-18cd-4dbc-9975-68928e6c9857)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1836,6 +1836,8 @@ interface nsIDOMWindowUtils : nsISupports {
* running tests.
*/
void forceUseCounterFlush(in nsIDOMNode aNode);
void setNextPaintSyncId(in long aSyncId);
};
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]

5
dom/ipc/PBrowser.ipdl

@ -52,7 +52,7 @@ using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CSSPoint from "Units.h";
using mozilla::CSSToScreenScale from "Units.h";
@ -566,7 +566,8 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(CSSRect rect, CSSSize size, ScreenOrientation orientation,
UpdateDimensions(CSSRect rect, CSSSize size,
ScreenOrientationInternal orientation,
LayoutDeviceIntPoint chromeDisp) compressall;
UpdateFrame(FrameMetrics frame);

2
dom/ipc/TabChild.cpp

@ -1692,7 +1692,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
const ScreenOrientation& orientation,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp)
{
if (!mRemoteFrame) {

6
dom/ipc/TabChild.h

@ -302,7 +302,7 @@ public:
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const CSSRect& rect,
const CSSSize& size,
const ScreenOrientation& orientation,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
@ -418,7 +418,7 @@ public:
void GetMaxTouchPoints(uint32_t* aTouchPoints);
ScreenOrientation GetOrientation() { return mOrientation; }
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
void SetBackgroundColor(const nscolor& aColor);
@ -622,7 +622,7 @@ private:
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
ScreenOrientation mOrientation;
ScreenOrientationInternal mOrientation;
bool mUpdateHitRegion;
bool mIgnoreKeyPressEvent;

2
dom/ipc/TabParent.cpp

@ -1038,7 +1038,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
}
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
ScreenOrientation orientation = config.orientation();
ScreenOrientationInternal orientation = config.orientation();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
nsCOMPtr<nsIWidget> widget = GetWidget();

2
dom/ipc/TabParent.h

@ -474,7 +474,7 @@ protected:
nsIntRect mRect;
ScreenIntSize mDimensions;
ScreenOrientation mOrientation;
ScreenOrientationInternal mOrientation;
float mDPI;
CSSToLayoutDeviceScale mDefaultScale;
bool mUpdatedDimensions;

2
dom/media/webrtc/MediaEngineGonkVideoSource.cpp

@ -406,7 +406,7 @@ MediaEngineGonkVideoSource::DeallocImpl() {
// The same algorithm from bug 840244
static int
GetRotateAmount(ScreenOrientation aScreen, int aCameraMountAngle, bool aBackCamera) {
GetRotateAmount(ScreenOrientationInternal aScreen, int aCameraMountAngle, bool aBackCamera) {
int screenAngle = 0;
switch (aScreen) {
case eScreenOrientation_PortraitPrimary:

117
dom/promise/Promise.cpp

@ -47,33 +47,33 @@ Atomic<uintptr_t> gIDGenerator(0);
using namespace workers;
// This class processes the promise's callbacks with promise's result.
class PromiseCallbackTask final : public nsRunnable
class PromiseReactionJob final : public nsRunnable
{
public:
PromiseCallbackTask(Promise* aPromise,
PromiseCallback* aCallback,
const JS::Value& aValue)
PromiseReactionJob(Promise* aPromise,
PromiseCallback* aCallback,
const JS::Value& aValue)
: mPromise(aPromise)
, mCallback(aCallback)
, mValue(CycleCollectedJSRuntime::Get()->Runtime(), aValue)
{
MOZ_ASSERT(aPromise);
MOZ_ASSERT(aCallback);
MOZ_COUNT_CTOR(PromiseCallbackTask);
MOZ_COUNT_CTOR(PromiseReactionJob);
}
virtual
~PromiseCallbackTask()
~PromiseReactionJob()
{
NS_ASSERT_OWNINGTHREAD(PromiseCallbackTask);
MOZ_COUNT_DTOR(PromiseCallbackTask);
NS_ASSERT_OWNINGTHREAD(PromiseReactionJob);
MOZ_COUNT_DTOR(PromiseReactionJob);
}
protected:
NS_IMETHOD
Run() override
{
NS_ASSERT_OWNINGTHREAD(PromiseCallbackTask);
NS_ASSERT_OWNINGTHREAD(PromiseReactionJob);
ThreadsafeAutoJSContext cx;
JS::Rooted<JSObject*> wrapper(cx, mPromise->GetWrapper());
MOZ_ASSERT(wrapper); // It was preserved!
@ -174,32 +174,32 @@ GetPromise(JSContext* aCx, JS::Handle<JSObject*> aFunc)
// Runnable to resolve thenables.
// Equivalent to the specification's ResolvePromiseViaThenableTask.
class ThenableResolverTask final : public nsRunnable
class PromiseResolveThenableJob final : public nsRunnable
{
public:
ThenableResolverTask(Promise* aPromise,
JS::Handle<JSObject*> aThenable,
PromiseInit* aThen)
PromiseResolveThenableJob(Promise* aPromise,
JS::Handle<JSObject*> aThenable,
PromiseInit* aThen)
: mPromise(aPromise)
, mThenable(CycleCollectedJSRuntime::Get()->Runtime(), aThenable)
, mThen(aThen)
{
MOZ_ASSERT(aPromise);
MOZ_COUNT_CTOR(ThenableResolverTask);
MOZ_COUNT_CTOR(PromiseResolveThenableJob);
}
virtual
~ThenableResolverTask()
~PromiseResolveThenableJob()
{
NS_ASSERT_OWNINGTHREAD(ThenableResolverTask);
MOZ_COUNT_DTOR(ThenableResolverTask);
NS_ASSERT_OWNINGTHREAD(PromiseResolveThenableJob);
MOZ_COUNT_DTOR(PromiseResolveThenableJob);
}
protected:
NS_IMETHOD
Run() override
{
NS_ASSERT_OWNINGTHREAD(ThenableResolverTask);
NS_ASSERT_OWNINGTHREAD(PromiseResolveThenableJob);
ThreadsafeAutoJSContext cx;
JS::Rooted<JSObject*> wrapper(cx, mPromise->GetWrapper());
MOZ_ASSERT(wrapper); // It was preserved!
@ -275,16 +275,16 @@ private:
NS_DECL_OWNINGTHREAD;
};
// Fast version of ThenableResolverTask for use in the cases when we know we're
// Fast version of PromiseResolveThenableJob for use in the cases when we know we're
// calling the canonical Promise.prototype.then on an actual DOM Promise. In
// that case we can just bypass the jumping into and out of JS and call
// AppendCallbacks on that promise directly.
class FastThenableResolverTask final : public nsRunnable
class FastPromiseResolveThenableJob final : public nsRunnable
{
public:
FastThenableResolverTask(PromiseCallback* aResolveCallback,
PromiseCallback* aRejectCallback,
Promise* aNextPromise)
FastPromiseResolveThenableJob(PromiseCallback* aResolveCallback,
PromiseCallback* aRejectCallback,
Promise* aNextPromise)
: mResolveCallback(aResolveCallback)
, mRejectCallback(aRejectCallback)
, mNextPromise(aNextPromise)
@ -292,21 +292,21 @@ public:
MOZ_ASSERT(aResolveCallback);
MOZ_ASSERT(aRejectCallback);
MOZ_ASSERT(aNextPromise);
MOZ_COUNT_CTOR(FastThenableResolverTask);
MOZ_COUNT_CTOR(FastPromiseResolveThenableJob);
}
virtual
~FastThenableResolverTask()
~FastPromiseResolveThenableJob()
{
NS_ASSERT_OWNINGTHREAD(FastThenableResolverTask);
MOZ_COUNT_DTOR(FastThenableResolverTask);
NS_ASSERT_OWNINGTHREAD(FastPromiseResolveThenableJob);
MOZ_COUNT_DTOR(FastPromiseResolveThenableJob);
}
protected:
NS_IMETHOD
Run() override
{
NS_ASSERT_OWNINGTHREAD(FastThenableResolverTask);
NS_ASSERT_OWNINGTHREAD(FastPromiseResolveThenableJob);
mNextPromise->AppendCallbacks(mResolveCallback, mRejectCallback);
return NS_OK;
}
@ -822,7 +822,7 @@ Promise::Catch(JSContext* aCx, AnyCallback* aRejectCallback, ErrorResult& aRv)
/**
* The CountdownHolder class encapsulates Promise.all countdown functions and
* the countdown holder parts of the Promises spec. It maintains the result
* array and AllResolveHandlers use SetValue() to set the array indices.
* array and AllResolveElementFunctions use SetValue() to set the array indices.
*/
class CountdownHolder final : public nsISupports
{
@ -910,17 +910,18 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CountdownHolder)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
/**
* An AllResolveHandler is the per-promise part of the Promise.all() algorithm.
* An AllResolveElementFunction is the per-promise
* part of the Promise.all() algorithm.
* Every Promise in the handler is handed an instance of this as a resolution
* handler and it sets the relevant index in the CountdownHolder.
*/
class AllResolveHandler final : public PromiseNativeHandler
class AllResolveElementFunction final : public PromiseNativeHandler
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(AllResolveHandler)
NS_DECL_CYCLE_COLLECTION_CLASS(AllResolveElementFunction)
AllResolveHandler(CountdownHolder* aHolder, uint32_t aIndex)
AllResolveElementFunction(CountdownHolder* aHolder, uint32_t aIndex)
: mCountdownHolder(aHolder), mIndex(aIndex)
{
MOZ_ASSERT(aHolder);
@ -936,11 +937,11 @@ public:
RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override
{
// Should never be attached to Promise as a reject handler.
MOZ_ASSERT(false, "AllResolveHandler should never be attached to a Promise's reject handler!");
MOZ_CRASH("AllResolveElementFunction should never be attached to a Promise's reject handler!");
}
private:
~AllResolveHandler()
~AllResolveElementFunction()
{
}
@ -948,14 +949,14 @@ private:
uint32_t mIndex;
};
NS_IMPL_CYCLE_COLLECTING_ADDREF(AllResolveHandler)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AllResolveHandler)
NS_IMPL_CYCLE_COLLECTING_ADDREF(AllResolveElementFunction)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AllResolveElementFunction)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AllResolveHandler)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AllResolveElementFunction)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION(AllResolveHandler, mCountdownHolder)
NS_IMPL_CYCLE_COLLECTION(AllResolveElementFunction, mCountdownHolder)
/* static */ already_AddRefed<Promise>
Promise::All(const GlobalObject& aGlobal,
@ -1019,7 +1020,7 @@ Promise::All(const GlobalObject& aGlobal,
for (uint32_t i = 0; i < aPromiseList.Length(); ++i) {
nsRefPtr<PromiseNativeHandler> resolveHandler =
new AllResolveHandler(holder, i);
new AllResolveElementFunction(holder, i);
nsRefPtr<PromiseCallback> resolveCb =
new NativePromiseCallback(resolveHandler, Resolved);
@ -1132,7 +1133,7 @@ Promise::AppendCallbacks(PromiseCallback* aResolveCallback,
// callbacks with promise's result. If promise's state is rejected, queue a
// task to process our reject callbacks with promise's result.
if (mState != Pending) {
EnqueueCallbackTasks();
TriggerPromiseReactions();
}
}
@ -1299,8 +1300,8 @@ Promise::ResolveInternal(JSContext* aCx,
Promise* nextPromise;
if (PromiseBinding::IsThenMethod(thenObj) &&
NS_SUCCEEDED(UNWRAP_OBJECT(Promise, valueObj, nextPromise))) {
// If we were taking the codepath that involves ThenableResolverTask and
// PromiseInit below, then eventually, in ThenableResolverTask::Run, we
// If we were taking the codepath that involves PromiseResolveThenableJob and
// PromiseInit below, then eventually, in PromiseResolveThenableJob::Run, we
// would create some JSFunctions in the compartment of
// this->GetWrapper() and pass them to the PromiseInit. So by the time
// we'd see the resolution value it would be wrapped into the
@ -1310,16 +1311,16 @@ Promise::ResolveInternal(JSContext* aCx,
JS::Rooted<JSObject*> glob(aCx, GlobalJSObject());
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this, glob);
nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(this, glob);
nsRefPtr<FastThenableResolverTask> task =
new FastThenableResolverTask(resolveCb, rejectCb, nextPromise);
nsRefPtr<FastPromiseResolveThenableJob> task =
new FastPromiseResolveThenableJob(resolveCb, rejectCb, nextPromise);
DispatchToMicroTask(task);
return;
}
nsRefPtr<PromiseInit> thenCallback =
new PromiseInit(nullptr, thenObj, mozilla::dom::GetIncumbentGlobal());
nsRefPtr<ThenableResolverTask> task =
new ThenableResolverTask(this, valueObj, thenCallback);
nsRefPtr<PromiseResolveThenableJob> task =
new PromiseResolveThenableJob(this, valueObj, thenCallback);
DispatchToMicroTask(task);
return;
}
@ -1387,7 +1388,7 @@ Promise::Settle(JS::Handle<JS::Value> aValue, PromiseState aState)
}
#endif // defined(DOM_PROMISE_DEPRECATED_REPORTING)
EnqueueCallbackTasks();
TriggerPromiseReactions();
}
void
@ -1405,7 +1406,7 @@ Promise::MaybeSettle(JS::Handle<JS::Value> aValue,
}
void
Promise::EnqueueCallbackTasks()
Promise::TriggerPromiseReactions()
{
nsTArray<nsRefPtr<PromiseCallback>> callbacks;
callbacks.SwapElements(mState == Resolved ? mResolveCallbacks
@ -1414,8 +1415,8 @@ Promise::EnqueueCallbackTasks()
mRejectCallbacks.Clear();
for (uint32_t i = 0; i < callbacks.Length(); ++i) {
nsRefPtr<PromiseCallbackTask> task =
new PromiseCallbackTask(this, callbacks[i], mResult);
nsRefPtr<PromiseReactionJob> task =
new PromiseReactionJob(this, callbacks[i], mResult);
DispatchToMicroTask(task);
}
}
@ -1480,7 +1481,7 @@ Promise::GetDependentPromises(nsTArray<nsRefPtr<Promise>>& aPromises)
}
// A WorkerRunnable to resolve/reject the Promise on the worker thread.
// Calling thread MUST hold PromiseWorkerProxy's mutex before creating this.
class PromiseWorkerProxyRunnable : public workers::WorkerRunnable
{
public:
@ -1588,12 +1589,24 @@ PromiseWorkerProxy::GetWorkerPrivate() const
// the assertion when we should not.
MOZ_ASSERT(!mCleanedUp);
#ifdef DEBUG
if (NS_IsMainThread()) {
mCleanUpLock.AssertCurrentThreadOwns();
}
#endif
return mWorkerPrivate;
}
Promise*
PromiseWorkerProxy::GetWorkerPromise() const
{
#ifdef DEBUG
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
#endif
return mWorkerPromise;
}

15
dom/promise/Promise.h

@ -50,8 +50,9 @@ class Promise;
#if defined(DOM_PROMISE_DEPRECATED_REPORTING)
class PromiseReportRejectFeature : public workers::WorkerFeature
{
// The Promise that owns this feature.
Promise* mPromise;
// PromiseReportRejectFeature is held by an nsAutoPtr on the Promise which
// means that this object will be destroyed before the Promise is destroyed.
Promise* MOZ_NON_OWNING_REF mPromise;
public:
explicit PromiseReportRejectFeature(Promise* aPromise)
@ -74,7 +75,7 @@ class Promise : public nsISupports,
public SupportsWeakPtr<Promise>
{
friend class NativePromiseCallback;
friend class PromiseCallbackTask;
friend class PromiseReactionJob;
friend class PromiseResolverTask;
friend class PromiseTask;
#if defined(DOM_PROMISE_DEPRECATED_REPORTING)
@ -84,8 +85,8 @@ class Promise : public nsISupports,
friend class PromiseWorkerProxyRunnable;
friend class RejectPromiseCallback;
friend class ResolvePromiseCallback;
friend class ThenableResolverTask;
friend class FastThenableResolverTask;
friend class PromiseResolveThenableJob;
friend class FastPromiseResolveThenableJob;
friend class WrapperPromiseCallback;
public:
@ -273,8 +274,8 @@ private:
// This method enqueues promise's resolve/reject callbacks with promise's
// result. It's executed when the resolver.resolve() or resolver.reject() is
// called or when the promise already has a result and new callbacks are
// appended by then(), catch() or done().
void EnqueueCallbackTasks();
// appended by then() or catch().
void TriggerPromiseReactions();
void Settle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);
void MaybeSettle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);

250
dom/push/PushManager.cpp

@ -215,38 +215,29 @@ WorkerPushSubscription::Constructor(GlobalObject& aGlobal, const nsAString& aEnd
return sub.forget();
}
class MOZ_STACK_CLASS AutoReleasePromiseWorkerProxy final
namespace {
// The caller MUST take ownership of the proxy's lock before it calls this.
void
ReleasePromiseWorkerProxy(already_AddRefed<PromiseWorkerProxy> aProxy)
{
public:
explicit AutoReleasePromiseWorkerProxy(PromiseWorkerProxy* aProxy)
: mProxy(aProxy)
{
AssertIsOnMainThread();
MOZ_ASSERT(aProxy);
aProxy->GetCleanUpLock().AssertCurrentThreadOwns();
if (aProxy->IsClean()) {
mProxy = nullptr;
}
AssertIsOnMainThread();
nsRefPtr<PromiseWorkerProxy> proxy = aProxy;
MOZ_ASSERT(proxy);
proxy->GetCleanUpLock().AssertCurrentThreadOwns();
if (proxy->IsClean()) {
return;
}
~AutoReleasePromiseWorkerProxy()
{
if (mProxy) {
AutoJSAPI jsapi;
jsapi.Init();
AutoJSAPI jsapi;
jsapi.Init();
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
new PromiseWorkerProxyControlRunnable(mProxy->GetWorkerPrivate(),
mProxy);
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
new PromiseWorkerProxyControlRunnable(proxy->GetWorkerPrivate(),
proxy);
DebugOnly<bool> ok = cr->Dispatch(jsapi.cx());
MOZ_ASSERT(ok);
mProxy = nullptr;
}
}
private:
nsRefPtr<PromiseWorkerProxy> mProxy;
};
MOZ_ALWAYS_TRUE(cr->Dispatch(jsapi.cx()));
}
} // anonymous namespace
class UnsubscribeResultRunnable final : public WorkerRunnable
{
@ -281,12 +272,7 @@ public:
}
private:
~UnsubscribeResultRunnable()
{
if (mProxy) {
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
mProxy = nullptr;
}
}
{}
nsRefPtr<PromiseWorkerProxy> mProxy;
nsresult mStatus;
@ -322,18 +308,27 @@ public:
nsRefPtr<UnsubscribeResultRunnable> r =