Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE
authorRazvan Maries <rmaries@mozilla.com>
Tue, 20 Nov 2018 00:36:35 +0200
changeset 506336 81b77c4f014e368ae8fb20bde050ddeef1357195
parent 506335 300e5ba9c14285bd5c5db15bb365287e1de8c1b9 (current diff)
parent 506256 bd4cebdbed4bcd34d449f67d51f139f9bdf75edc (diff)
child 506337 657e6091286d30ffdfb6f0b17043e5b1d539536a
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE
.clang-format-ignore
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsIDocument.h
js/public/ProtoKey.h
js/src/jsapi.cpp
js/src/jsapi.h
mobile/android/gradle/m2repo/README
modules/libpref/init/all.js
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/antitracking/AntiTrackingCommon.h
toolkit/components/antitracking/test/browser/head.js
tools/rewriting/ThirdPartyPaths.txt
--- a/.clang-format
+++ b/.clang-format
@@ -1,9 +1,9 @@
-BasedOnStyle: Mozilla
+BasedOnStyle: Google
 
 # Prevent the loss of indentation with these macros
 MacroBlockBegin: "^\
 NS_INTERFACE_MAP_BEGIN|\
 NS_INTERFACE_TABLE_HEAD|\
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION|\
 NS_IMPL_CYCLE_COLLECTION_.*_BEGIN|\
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED|\
@@ -15,17 +15,8 @@ NS_INTERFACE_MAP_END|\
 NS_IMPL_CYCLE_COLLECTION_.*_END|\
 NS_INTERFACE_TABLE_END|\
 NS_INTERFACE_MAP_END_INHERITING|\
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END_INHERITED|\
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED$"
 
 SortIncludes: false
 
-
-BreakBeforeBraces: Custom
-BraceWrapping:
-  AfterEnum: true
-  AfterStruct: true
-  AfterFunction: true
-  AfterClass: true
-  SplitEmptyFunction: true
-
--- a/.clang-format-ignore
+++ b/.clang-format-ignore
@@ -9,18 +9,16 @@ dom/media/gtest/.*
 gfx/testsd/.*
 .*/gtest/ExampleStylesheet.h
 image/test/.*
 ipc/ipdl/test/.*
 ipc/testshell/.*
 # Generated code
 js/src/builtin/intl/TimeZoneDataGenerated.h
 js/src/jsapi-tests/.*
-# See bug 1395584
-js/src/vm/Opcodes.h
 
 # Ignored because of bug 1506117 & 1342657
 layout/style/nsCSSAnonBoxList.h
 layout/style/nsCSSCounterDescList.h
 layout/style/nsCSSFontDescList.h
 layout/style/nsCSSKeywordList.h
 layout/style/nsCSSPseudoElementList.h
 layout/style/nsCSSVisitedDependentPropList.h
@@ -39,21 +37,33 @@ xpcom/tests/.*
 
 # Generated from ./tools/rewriting/ThirdPartyPaths.txt
 # awk '{print ""$1".*"}' ./tools/rewriting/ThirdPartyPaths.txt
 browser/components/translation/cld2/.*
 browser/extensions/mortar/ppapi/.*
 db/sqlite3/src/.*
 devtools/client/sourceeditor/codemirror/.*
 devtools/client/sourceeditor/tern/.*
-dom/canvas/test/webgl-conf/checkout/closure-library/
+dom/canvas/test/webgl-conf/checkout/closure-library/.*
+dom/media/gmp/rlz/.*
 dom/media/gmp/widevine-adapter/content_decryption_module.h
 dom/media/gmp/widevine-adapter/content_decryption_module_export.h
 dom/media/gmp/widevine-adapter/content_decryption_module_ext.h
 dom/media/gmp/widevine-adapter/content_decryption_module_proxy.h
+dom/media/platforms/ffmpeg/libav53/.*
+dom/media/platforms/ffmpeg/libav54/.*
+dom/media/platforms/ffmpeg/libav55/.*
+dom/media/webaudio/FFTBlock.cpp
+dom/media/webaudio/blink/.*
+dom/media/webspeech/recognition/endpointer.cc
+dom/media/webspeech/recognition/endpointer.h
+dom/media/webspeech/recognition/energy_endpointer.cc
+dom/media/webspeech/recognition/energy_endpointer.h
+dom/media/webspeech/recognition/energy_endpointer_params.cc
+dom/media/webspeech/recognition/energy_endpointer_params.h
 editor/libeditor/tests/browserscope/lib/richtext/.*
 editor/libeditor/tests/browserscope/lib/richtext2/.*
 extensions/spellcheck/hunspell/src/.*
 gfx/angle/.*
 gfx/cairo/.*
 gfx/graphite2/.*
 gfx/harfbuzz/.*
 gfx/ots/.*
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -834,17 +834,17 @@ dependencies = [
 
 [[package]]
 name = "error-chain"
 version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "euclid"
-version = "0.19.0"
+version = "0.19.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "failure"
@@ -1413,17 +1413,17 @@ dependencies = [
 ]
 
 [[package]]
 name = "malloc_size_of"
 version = "0.0.1"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "hashglobe 0.1.0",
  "selectors 0.20.0",
  "servo_arc 0.1.1",
  "smallbitvec 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1869,17 +1869,17 @@ version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "plane-split"
 version = "0.13.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "podio"
 version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2363,17 +2363,17 @@ dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bindgen 0.43.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "fallible 0.0.1",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "hashglobe 0.1.0",
  "itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
@@ -2419,17 +2419,17 @@ dependencies = [
 
 [[package]]
 name = "style_traits"
 version = "0.0.1"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
  "malloc_size_of_derive 0.0.1",
  "selectors 0.20.0",
  "servo_arc 0.1.1",
 ]
 
 [[package]]
 name = "stylo_tests"
@@ -2941,17 +2941,16 @@ dependencies = [
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "plane-split 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2969,33 +2968,33 @@ version = "0.57.2"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.80 (git+https://github.com/servo/serde?branch=deserialize_from_enums9)",
  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "webrender_bindings"
 version = "0.1.0"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "nsstring 0.1.0",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3200,17 +3199,17 @@ dependencies = [
 "checksum dtoa-short 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "068d4026697c1a18f0b0bb8cfcad1b0c151b90d8edb9bf4c235ad68128920d1d"
 "checksum dwrote 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "18e895b763d82cafef31c7c1e2f4f17fb70f385ac651b0918a46ff5790664a63"
 "checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
 "checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
 "checksum encoding_c 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "769ecb8b33323998e482b218c0d13cd64c267609023b4b7ec3ee740714c318ee"
 "checksum encoding_rs 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a79fa56c329a5b087de13748054fb3b974c4a672c12c71f0b66e35c5addec5"
 "checksum env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0561146661ae44c579e993456bc76d11ce1e0c7d745e57b2fa7146b6e49fa2ad"
 "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
-"checksum euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70a2ebdf55fb9d6329046e026329a55ef8fbaae5ea833f56e170beb3125a8a5f"
+"checksum euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)" = "600657e7e5c03bfbccdc68721bc3b5abcb761553973387124eae9c9e4f02c210"
 "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
 "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
 "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
 "checksum fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "85cb8fec437468d86dc7c83ca7cfc933341d561873275f22dd5eedefa63a6478"
 "checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909"
 "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
 "checksum foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ebc04f19019fff1f2d627b5581574ead502f80c48c88900575a46e0840fe5d0"
 "checksum freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b659e75b7a7338fe75afd7f909fc2b71937845cffb6ebe54ba2e50f13d8e903d"
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1380,20 +1380,16 @@ pref("geo.provider.ms-windows-location",
 #endif
 
 #if defined(MOZ_WIDGET_GTK) && defined(MOZ_GPSD)
 pref("geo.provider.use_gpsd", true);
 #endif
 
 #endif
 
-// Necko IPC security checks only needed for app isolation for cookies/cache/etc:
-// currently irrelevant for desktop e10s
-pref("network.disable.ipc.security", true);
-
 // CustomizableUI debug logging.
 pref("browser.uiCustomization.debug", false);
 
 // CustomizableUI state of the browser's user interface
 pref("browser.uiCustomization.state", "");
 
 // If set to false, FxAccounts and Sync will be unavailable.
 // A restart is mandatory after flipping that preference.
--- a/browser/base/content/test/general/browser_alltabslistener.js
+++ b/browser/base/content/test/general/browser_alltabslistener.js
@@ -1,79 +1,113 @@
 const gCompleteState = Ci.nsIWebProgressListener.STATE_STOP +
                        Ci.nsIWebProgressListener.STATE_IS_NETWORK;
 
 var gFrontProgressListener = {
   onProgressChange(aWebProgress, aRequest,
-                             aCurSelfProgress, aMaxSelfProgress,
-                             aCurTotalProgress, aMaxTotalProgress) {
+                   aCurSelfProgress, aMaxSelfProgress,
+                   aCurTotalProgress, aMaxTotalProgress) {
   },
 
   onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onStateChange";
     info("FrontProgress: " + state + " 0x" + aStateFlags.toString(16));
     ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
     is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
     gFrontNotificationsPos++;
   },
 
   onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onLocationChange";
     info("FrontProgress: " + state + " " + aLocationURI.spec);
     ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
     is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
     gFrontNotificationsPos++;
   },
 
   onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
   },
 
   onSecurityChange(aWebProgress, aRequest, aOldState, aState,
                    aContentBlockingLogJSON) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onSecurityChange";
     info("FrontProgress: " + state + " 0x" + aState.toString(16));
     ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
     is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
     gFrontNotificationsPos++;
   },
 };
 
 var gAllProgressListener = {
   onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onStateChange";
     info("AllProgress: " + state + " 0x" + aStateFlags.toString(16));
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
     ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
     is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
     gAllNotificationsPos++;
 
     if ((aStateFlags & gCompleteState) == gCompleteState) {
       ok(gAllNotificationsPos == gAllNotifications.length, "Saw the expected number of notifications");
       ok(gFrontNotificationsPos == gFrontNotifications.length, "Saw the expected number of frontnotifications");
       executeSoon(gNextTest);
     }
   },
 
-  onLocationChange(aBrowser, aWebProgress, aRequest, aLocationURI,
-                             aFlags) {
+  onLocationChange(aBrowser, aWebProgress, aRequest, aLocationURI, aFlags) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onLocationChange";
     info("AllProgress: " + state + " " + aLocationURI.spec);
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
     ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
     is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
     gAllNotificationsPos++;
   },
 
   onStatusChange(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onStatusChange";
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
   },
 
   onSecurityChange(aBrowser, aWebProgress, aRequest, aOldState, aState,
                    aContentBlockingLogJSON) {
+    if (aRequest &&
+        aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
+      // ignore initial about blank
+      return;
+    }
     var state = "onSecurityChange";
     info("AllProgress: " + state + " 0x" + aState.toString(16));
     ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
     ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
     is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
     gAllNotificationsPos++;
   },
 };
--- a/build.gradle
+++ b/build.gradle
@@ -39,31 +39,28 @@ buildDir "${topobjdir}/gradle/build"
 
 buildscript {
     repositories {
         gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
             maven {
                 url repository
             }
         }
-        // For in tree plugins.
-        maven {
-            url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
-        }
     }
 
     ext.kotlin_version = '1.2.41'
     ext.support_library_version = '26.1.0'
     ext.jacoco_version = '0.8.1'
 
     if (gradle.mozconfig.substs.MOZ_ANDROID_GOOGLE_PLAY_SERVICES) {
         ext.google_play_services_version = '15.0.1'
     }
 
     dependencies {
+        classpath 'org.mozilla.apilint:apilint:0.1.3'
         classpath 'com.android.tools.build:gradle:3.1.4'
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
     }
 }
 
 if ('multi' == System.env.AB_CD) {
     // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale.  This
--- a/caps/nsJSPrincipals.cpp
+++ b/caps/nsJSPrincipals.cpp
@@ -79,17 +79,17 @@ nsJSPrincipals::Destroy(JSPrincipals *js
     nsjsprin->refcount++;
 #endif
     nsjsprin->Release();
 }
 
 #ifdef DEBUG
 
 // Defined here so one can do principals->dump() in the debugger
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JSPrincipals::dump()
 {
     if (debugToken == nsJSPrincipals::DEBUG_TOKEN) {
       nsAutoCString str;
       nsresult rv = static_cast<nsJSPrincipals *>(this)->GetScriptLocation(str);
       fprintf(stderr, "nsIPrincipal (%p) = %s\n", static_cast<void*>(this),
               NS_SUCCEEDED(rv) ? str.get() : "(unknown)");
     } else if (debugToken == dom::workerinternals::kJSPrincipalsDebugToken) {
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -2289,17 +2289,17 @@ Inspector.prototype = {
     // To avoid that, we have to hide it before taking the screenshot. The `hideBoxModel`
     // will do that, calling `hide` for the highlighter only if previously shown.
     await this.highlighter.hideBoxModel();
 
     const clipboardEnabled = Services.prefs
       .getBoolPref("devtools.screenshot.clipboard.enabled");
     const args = {
       file: true,
-      selector: this.selectionCssSelector,
+      nodeActorID: this.selection.nodeFront.actorID,
       clipboard: clipboardEnabled,
     };
     const screenshotFront = this.target.getFront("screenshot");
     const screenshot = await screenshotFront.capture(args);
     await saveScreenshot(this.panelWin, args, screenshot);
   },
 
   /**
--- a/devtools/client/inspector/markup/test/browser.ini
+++ b/devtools/client/inspector/markup/test/browser.ini
@@ -47,16 +47,17 @@ support-files =
   events_bundle.js.map
   events_original.js
   head.js
   helper_attributes_test_runner.js
   helper_diff.js
   helper_events_test_runner.js
   helper_markup_accessibility_navigation.js
   helper_outerhtml_test_runner.js
+  helper_screenshot_node.js
   helper_style_attr_test_runner.js
   lib_babel_6.21.0_min.js
   lib_jquery_1.0.js
   lib_jquery_1.1.js
   lib_jquery_1.2_min.js
   lib_jquery_1.3_min.js
   lib_jquery_1.4_min.js
   lib_jquery_1.6_min.js
@@ -165,16 +166,19 @@ skip-if = verify
 [browser_markup_node_names.js]
 [browser_markup_node_names_namespaced.js]
 [browser_markup_node_not_displayed_01.js]
 [browser_markup_node_not_displayed_02.js]
 [browser_markup_pagesize_01.js]
 [browser_markup_pagesize_02.js]
 [browser_markup_pseudo_on_reload.js]
 [browser_markup_remove_xul_attributes.js]
+[browser_markup_screenshot_node.js]
+[browser_markup_screenshot_node_iframe.js]
+[browser_markup_screenshot_node_shadowdom.js]
 [browser_markup_search_01.js]
 [browser_markup_shadowdom.js]
 [browser_markup_shadowdom_clickreveal.js]
 [browser_markup_shadowdom_clickreveal_scroll.js]
 [browser_markup_shadowdom_copy_paths.js]
 subsuite = clipboard
 [browser_markup_shadowdom_delete.js]
 [browser_markup_shadowdom_dynamic.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_screenshot_node.js
@@ -0,0 +1,24 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* import-globals-from helper_screenshot_node.js */
+
+"use strict";
+
+loadHelperScript("helper_screenshot_node.js");
+
+const TEST_URL = `data:text/html;charset=utf8,
+  <div id="blue-node" style="width:30px;height:30px;background:rgb(0, 0, 255)"></div>`;
+
+// Test that the "Screenshot Node" feature works with a regular node in the main document.
+add_task(async function() {
+  const { inspector, toolbox } = await openInspectorForURL(encodeURI(TEST_URL));
+
+  info("Select the blue node");
+  await selectNode("#blue-node", inspector);
+
+  info("Take a screenshot of the blue node and verify it looks as expected");
+  const blueScreenshot = await takeNodeScreenshot(inspector);
+  await assertSingleColorScreenshotImage(blueScreenshot, 30, 30, { r: 0, g: 0, b: 255 });
+
+  await toolbox.destroy();
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_screenshot_node_iframe.js
@@ -0,0 +1,27 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* import-globals-from helper_screenshot_node.js */
+
+"use strict";
+
+loadHelperScript("helper_screenshot_node.js");
+
+const TEST_URL = `data:text/html;charset=utf8,
+  <iframe
+    src="data:text/html;charset=utf8,
+      <div style='width:30px;height:30px;background:rgb(255, 0, 0)'></div>"></iframe>`;
+
+// Test that the "Screenshot Node" feature works with a node inside an iframe.
+add_task(async function() {
+  const { inspector, toolbox } = await openInspectorForURL(encodeURI(TEST_URL));
+
+  info("Select the red node");
+  const redNode = await getNodeFrontInFrame("div", "iframe", inspector);
+  await selectNode(redNode, inspector);
+
+  info("Take a screenshot of the red node and verify it looks as expected");
+  const redScreenshot = await takeNodeScreenshot(inspector);
+  await assertSingleColorScreenshotImage(redScreenshot, 30, 30, { r: 255, g: 0, b: 0 });
+
+  await toolbox.destroy();
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_screenshot_node_shadowdom.js
@@ -0,0 +1,36 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* import-globals-from helper_screenshot_node.js */
+
+"use strict";
+
+loadHelperScript("helper_screenshot_node.js");
+
+const TEST_URL = `data:text/html;charset=utf8,
+  <test-component></test-component>
+  <script>
+    'use strict';
+    customElements.define('test-component', class extends HTMLElement {
+      constructor() {
+        super();
+        let shadowRoot = this.attachShadow({mode: 'open'});
+        shadowRoot.innerHTML =
+          '<div style="width:30px;height:30px;background:rgb(0, 128, 0)"></div>';
+      }
+    });
+  </script>`;
+
+// Test that the "Screenshot Node" feature works with a node inside a shadow root.
+add_task(async function() {
+  const { inspector, toolbox } = await openInspectorForURL(encodeURI(TEST_URL));
+
+  info("Select the green node");
+  const greenNode = await getNodeFrontInShadowDom("div", "test-component", inspector);
+  await selectNode(greenNode, inspector);
+
+  info("Take a screenshot of the green node and verify it looks as expected");
+  const greenScreenshot = await takeNodeScreenshot(inspector);
+  await assertSingleColorScreenshotImage(greenScreenshot, 30, 30, { r: 0, g: 128, b: 0 });
+
+  await toolbox.destroy();
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/markup/test/helper_screenshot_node.js
@@ -0,0 +1,84 @@
+/* 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";
+
+function colorAt(image, x, y) {
+  // Create a test canvas element.
+  const HTML_NS = "http://www.w3.org/1999/xhtml";
+  const canvas = document.createElementNS(HTML_NS, "canvas");
+  canvas.width = image.width;
+  canvas.height = image.height;
+
+  // Draw the image in the canvas
+  const context = canvas.getContext("2d");
+  context.drawImage(image, 0, 0, image.width, image.height);
+
+  // Return the color found at the provided x,y coordinates as a "r, g, b" string.
+  const [r, g, b] = context.getImageData(x, y, 1, 1).data;
+  return { r, g, b };
+}
+
+function waitUntilScreenshot() {
+  return new Promise(async function(resolve) {
+    const { Downloads } = require("resource://gre/modules/Downloads.jsm");
+    const list = await Downloads.getList(Downloads.ALL);
+
+    const view = {
+      onDownloadAdded: download => {
+        download.whenSucceeded().then(() => {
+          resolve(download.target.path);
+          list.removeView(view);
+        });
+      },
+    };
+
+    await list.addView(view);
+  });
+}
+
+async function resetDownloads() {
+  info("Reset downloads");
+  const { Downloads } = require("resource://gre/modules/Downloads.jsm");
+  const publicList = await Downloads.getList(Downloads.PUBLIC);
+  const downloads = await publicList.getAll();
+  for (const download of downloads) {
+    publicList.remove(download);
+    await download.finalize(true);
+  }
+}
+
+async function takeNodeScreenshot(inspector) {
+  // Cleanup all downloads at the end of the test.
+  registerCleanupFunction(resetDownloads);
+
+  info("Call screenshotNode() and wait until the screenshot is found in the Downloads");
+  const whenScreenshotSucceeded = waitUntilScreenshot();
+  inspector.screenshotNode();
+  const filePath = await whenScreenshotSucceeded;
+
+  info("Create an image using the downloaded fileas source");
+  const image = new Image();
+  image.src = OS.Path.toFileURI(filePath);
+  await once(image, "load");
+
+  return image;
+}
+/* exported takeNodeScreenshot */
+
+/**
+ * Check that the provided image has the expected width, height, and color.
+ * NOTE: This test assumes that the image is only made of a single color and will only
+ * check one pixel.
+ */
+async function assertSingleColorScreenshotImage(image, width, height, { r, g, b }) {
+  is(image.width, width, "node screenshot has the expected width");
+  is(image.height, height, "node screenshot has the expected height");
+
+  const color = colorAt(image, 0, 0);
+  is(color.r, r, "node screenshot has the expected red component");
+  is(color.g, g, "node screenshot has the expected green component");
+  is(color.b, b, "node screenshot has the expected blue component");
+}
+/* exported assertSingleColorScreenshotImage */
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -231,16 +231,41 @@ var clickOnInspectMenuItem = async funct
  */
 var getNodeFrontInFrame = async function(selector, frameSelector,
                                                 inspector) {
   const iframe = await getNodeFront(frameSelector, inspector);
   const {nodes} = await inspector.walker.children(iframe);
   return inspector.walker.querySelector(nodes[0], selector);
 };
 
+/**
+ * Get the NodeFront for a node that matches a given css selector inside a shadow root.
+ *
+ * @param {String} selector
+ *        CSS selector of the node inside the shadow root.
+ * @param {String|NodeFront} hostSelector
+ *        Selector or front of the element to which the shadow root is attached.
+ * @param {InspectorPanel} inspector
+ *        The instance of InspectorPanel currently loaded in the toolbox
+ * @return {Promise} Resolves the node front when the inspector is updated with the new
+ *         node.
+ */
+var getNodeFrontInShadowDom = async function(selector, hostSelector, inspector) {
+  const hostFront = await getNodeFront(hostSelector, inspector);
+  const {nodes} = await inspector.walker.children(hostFront);
+
+  // Find the shadow root in the children of the host element.
+  const shadowRoot = nodes.filter(node => node.isShadowRoot)[0];
+  if (!shadowRoot) {
+    throw new Error("Could not find a shadow root under selector: " + hostSelector);
+  }
+
+  return inspector.walker.querySelector(shadowRoot, selector);
+};
+
 var focusSearchBoxUsingShortcut = async function(panelWin, callback) {
   info("Focusing search box");
   const searchBox = panelWin.document.getElementById("inspector-searchbox");
   const focused = once(searchBox, "focus");
 
   panelWin.focus();
 
   synthesizeKeyShortcut(INSPECTOR_L10N.getStr("inspector.searchHTML.key"));
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -267,17 +267,17 @@ WebConsole.prototype = {
       return this._parserService;
     }
 
     this._parserService =
       require("devtools/client/debugger/new/src/workers/parser/index");
 
     this._parserService.start(
       "resource://devtools/client/debugger/new/dist/parser-worker.js",
-      this.browserWindow);
+      this.chromeUtilsWindow);
     return this._parserService;
   },
 
   /**
    * Retrieves the current selection from the Inspector, if such a selection
    * exists. This is used to pass the ID of the selected actor to the Web
    * Console server for the $0 helper.
    *
--- a/devtools/server/actors/screenshot.js
+++ b/devtools/server/actors/screenshot.js
@@ -10,11 +10,19 @@ const {screenshotSpec} = require("devtoo
 
 exports.ScreenshotActor = protocol.ActorClassWithSpec(screenshotSpec, {
   initialize: function(conn, targetActor) {
     protocol.Actor.prototype.initialize.call(this, conn);
     this.document = targetActor.window.document;
   },
 
   capture: function(args) {
+    if (args.nodeActorID) {
+      const nodeActor = this.conn.getActor(args.nodeActorID);
+      if (!nodeActor) {
+        throw new Error(
+          `Screenshot actor failed to find Node actor for '${args.nodeActorID}'`);
+      }
+      args.rawNode = nodeActor.rawNode;
+    }
     return captureScreenshot(args, this.document);
   },
 });
--- a/devtools/shared/screenshot/capture.js
+++ b/devtools/shared/screenshot/capture.js
@@ -43,33 +43,36 @@ function captureScreenshot(args, documen
 
 exports.captureScreenshot = captureScreenshot;
 
 /**
  * This does the dirty work of creating a base64 string out of an
  * area of the browser window
  */
 function createScreenshotDataURL(document, args) {
-  const window = document.defaultView;
+  let window = document.defaultView;
   let left = 0;
   let top = 0;
   let width;
   let height;
   const currentX = window.scrollX;
   const currentY = window.scrollY;
 
   let filename = getFilename(args.filename);
 
   if (args.fullpage) {
     // Bug 961832: Screenshot shows fixed position element in wrong
     // position if we don't scroll to top
     window.scrollTo(0, 0);
     width = window.innerWidth + window.scrollMaxX - window.scrollMinX;
     height = window.innerHeight + window.scrollMaxY - window.scrollMinY;
     filename = filename.replace(".png", "-fullpage.png");
+  } else if (args.rawNode) {
+    window = args.rawNode.ownerDocument.defaultView;
+    ({ top, left, width, height } = getRect(window, args.rawNode, window));
   } else if (args.selector) {
     const node = window.document.querySelector(args.selector);
     ({ top, left, width, height } = getRect(window, node, window));
   } else {
     left = window.scrollX;
     top = window.scrollY;
     width = window.innerWidth;
     height = window.innerHeight;
--- a/devtools/shared/webconsole/GenerateReservedWordsJS.py
+++ b/devtools/shared/webconsole/GenerateReservedWordsJS.py
@@ -2,17 +2,17 @@
 # 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/.
 
 from __future__ import absolute_import
 import re
 import sys
 
 def read_reserved_word_list(filename):
-    macro_pat = re.compile(r"^\s*macro\(([^,]+), *[^,]+, *[^\)]+\)\s*\\?$")
+    macro_pat = re.compile(r"^\s*MACRO\(([^,]+), *[^,]+, *[^\)]+\)\s*\\?$")
 
     reserved_word_list = []
     with open(filename, 'r') as f:
         for line in f:
             m = macro_pat.search(line)
             if m:
                 reserved_word_list.append(m.group(1))
 
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -2246,18 +2246,19 @@ nsGlobalWindowOuter::DetachFromDocShell(
 
 void
 nsGlobalWindowOuter::SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
                                      bool aOriginalOpener)
 {
   nsWeakPtr opener = do_GetWeakReference(aOpener);
   if (opener == mOpener) {
     MOZ_DIAGNOSTIC_ASSERT(
-      !aOpener || (GetBrowsingContext() && GetBrowsingContext()->GetOpener() ==
-                                             aOpener->GetBrowsingContext()));
+      !aOpener || !aOpener->GetDocShell() ||
+      (GetBrowsingContext() &&
+       GetBrowsingContext()->GetOpener() == aOpener->GetBrowsingContext()));
     return;
   }
 
   NS_ASSERTION(!aOriginalOpener || !mSetOpenerWindowCalled,
                "aOriginalOpener is true, but not first call to "
                "SetOpenerWindow!");
   NS_ASSERTION(aOpener || !aOriginalOpener,
                "Shouldn't set mHadOriginalOpener if aOpener is null");
--- a/dom/base/nsWindowSizes.h
+++ b/dom/base/nsWindowSizes.h
@@ -87,20 +87,20 @@ struct nsStyleSizes
 
   // Present just to absorb the trailing comma in the constructor.
   int dummy;
 };
 
 #define NS_ARENA_SIZES_FIELD(classname) mArena##classname
 
 struct nsArenaSizes {
-#define FOR_EACH_SIZE(macro) \
-  macro(Other, mLineBoxes) \
-  macro(Style, mRuleNodes) \
-  macro(Style, mComputedStyles)
+#define FOR_EACH_SIZE(MACRO) \
+  MACRO(Other, mLineBoxes) \
+  MACRO(Style, mRuleNodes) \
+  MACRO(Style, mComputedStyles)
 
   nsArenaSizes()
     :
       FOR_EACH_SIZE(ZERO_SIZE)
 
       #define FRAME_ID(classname, ...) \
         NS_ARENA_SIZES_FIELD(classname)(0),
       #define ABSTRACT_FRAME_ID(...)
@@ -151,45 +151,45 @@ struct nsArenaSizes {
   // Present just to absorb the trailing comma in the constructor.
   int dummy;
 
 #undef FOR_EACH_SIZE
 };
 
 class nsWindowSizes
 {
-#define FOR_EACH_SIZE(macro) \
-  macro(DOM,   mDOMElementNodesSize) \
-  macro(DOM,   mDOMTextNodesSize) \
-  macro(DOM,   mDOMCDATANodesSize) \
-  macro(DOM,   mDOMCommentNodesSize) \
-  macro(DOM,   mDOMEventTargetsSize) \
-  macro(DOM,   mDOMMediaQueryLists) \
-  macro(DOM,   mDOMPerformanceUserEntries) \
-  macro(DOM,   mDOMPerformanceResourceEntries) \
-  macro(DOM,   mDOMOtherSize) \
-  macro(Style, mLayoutStyleSheetsSize) \
-  macro(Style, mLayoutShadowDomStyleSheetsSize) \
-  macro(Style, mLayoutShadowDomAuthorStyles) \
-  macro(Other, mLayoutPresShellSize) \
-  macro(Style, mLayoutStyleSetsStylistRuleTree) \
-  macro(Style, mLayoutStyleSetsStylistElementAndPseudosMaps) \
-  macro(Style, mLayoutStyleSetsStylistInvalidationMap) \
-  macro(Style, mLayoutStyleSetsStylistRevalidationSelectors) \
-  macro(Style, mLayoutStyleSetsStylistOther) \
-  macro(Style, mLayoutStyleSetsOther) \
-  macro(Style, mLayoutElementDataObjects) \
-  macro(Other, mLayoutTextRunsSize) \
-  macro(Other, mLayoutPresContextSize) \
-  macro(Other, mLayoutFramePropertiesSize) \
-  macro(Style, mLayoutComputedValuesDom) \
-  macro(Style, mLayoutComputedValuesNonDom) \
-  macro(Style, mLayoutComputedValuesVisited) \
-  macro(Other, mPropertyTablesSize) \
-  macro(Other, mBindingsSize) \
+#define FOR_EACH_SIZE(MACRO) \
+  MACRO(DOM,   mDOMElementNodesSize) \
+  MACRO(DOM,   mDOMTextNodesSize) \
+  MACRO(DOM,   mDOMCDATANodesSize) \
+  MACRO(DOM,   mDOMCommentNodesSize) \
+  MACRO(DOM,   mDOMEventTargetsSize) \
+  MACRO(DOM,   mDOMMediaQueryLists) \
+  MACRO(DOM,   mDOMPerformanceUserEntries) \
+  MACRO(DOM,   mDOMPerformanceResourceEntries) \
+  MACRO(DOM,   mDOMOtherSize) \
+  MACRO(Style, mLayoutStyleSheetsSize) \
+  MACRO(Style, mLayoutShadowDomStyleSheetsSize) \
+  MACRO(Style, mLayoutShadowDomAuthorStyles) \
+  MACRO(Other, mLayoutPresShellSize) \
+  MACRO(Style, mLayoutStyleSetsStylistRuleTree) \
+  MACRO(Style, mLayoutStyleSetsStylistElementAndPseudosMaps) \
+  MACRO(Style, mLayoutStyleSetsStylistInvalidationMap) \
+  MACRO(Style, mLayoutStyleSetsStylistRevalidationSelectors) \
+  MACRO(Style, mLayoutStyleSetsStylistOther) \
+  MACRO(Style, mLayoutStyleSetsOther) \
+  MACRO(Style, mLayoutElementDataObjects) \
+  MACRO(Other, mLayoutTextRunsSize) \
+  MACRO(Other, mLayoutPresContextSize) \
+  MACRO(Other, mLayoutFramePropertiesSize) \
+  MACRO(Style, mLayoutComputedValuesDom) \
+  MACRO(Style, mLayoutComputedValuesNonDom) \
+  MACRO(Style, mLayoutComputedValuesVisited) \
+  MACRO(Other, mPropertyTablesSize) \
+  MACRO(Other, mBindingsSize) \
 
 public:
   explicit nsWindowSizes(mozilla::SizeOfState& aState)
     :
       FOR_EACH_SIZE(ZERO_SIZE)
       mDOMEventTargetsCount(0),
       mDOMEventListenersCount(0),
       mArenaSizes(),
--- a/dom/security/nsCSPUtils.h
+++ b/dom/security/nsCSPUtils.h
@@ -114,25 +114,25 @@ inline CSPDirective CSP_StringToCSPDirec
     if (lowerDir.EqualsASCII(CSPStrDirectives[i])) {
       return static_cast<CSPDirective>(i);
     }
   }
   NS_ASSERTION(false, "Can not convert unknown Directive to Integer");
   return nsIContentSecurityPolicy::NO_DIRECTIVE;
 }
 
-#define FOR_EACH_CSP_KEYWORD(macro) \
-  macro(CSP_SELF,            "'self'") \
-  macro(CSP_UNSAFE_INLINE,   "'unsafe-inline'") \
-  macro(CSP_UNSAFE_EVAL,     "'unsafe-eval'") \
-  macro(CSP_NONE,            "'none'") \
-  macro(CSP_NONCE,           "'nonce-") \
-  macro(CSP_REQUIRE_SRI_FOR, "require-sri-for") \
-  macro(CSP_REPORT_SAMPLE,   "'report-sample'") \
-  macro(CSP_STRICT_DYNAMIC,  "'strict-dynamic'")
+#define FOR_EACH_CSP_KEYWORD(MACRO) \
+  MACRO(CSP_SELF,            "'self'") \
+  MACRO(CSP_UNSAFE_INLINE,   "'unsafe-inline'") \
+  MACRO(CSP_UNSAFE_EVAL,     "'unsafe-eval'") \
+  MACRO(CSP_NONE,            "'none'") \
+  MACRO(CSP_NONCE,           "'nonce-") \
+  MACRO(CSP_REQUIRE_SRI_FOR, "require-sri-for") \
+  MACRO(CSP_REPORT_SAMPLE,   "'report-sample'") \
+  MACRO(CSP_STRICT_DYNAMIC,  "'strict-dynamic'")
 
 enum CSPKeyword {
   #define KEYWORD_ENUM(id_, string_) id_,
   FOR_EACH_CSP_KEYWORD(KEYWORD_ENUM)
   #undef KEYWORD_ENUM
 
   // CSP_LAST_KEYWORD_VALUE always needs to be the last element in the enum
   // because we use it to calculate the size for the char* array.
--- a/gfx/webrender/Cargo.toml
+++ b/gfx/webrender/Cargo.toml
@@ -20,17 +20,16 @@ serialize_program = ["serde"]
 
 [dependencies]
 app_units = "0.7"
 base64 = { optional = true, version = "0.9" }
 bincode = "1.0"
 bitflags = "1.0"
 byteorder = "1.0"
 cfg-if = "0.1.2"
-euclid = "0.19"
 fxhash = "0.2.1"
 gleam = "0.6.3"
 image = { optional = true, version = "0.20" }
 lazy_static = "1"
 log = "0.4"
 num-traits = "0.2"
 plane-split = "0.13.3"
 png = { optional = true, version = "0.12" }
--- a/gfx/webrender/src/lib.rs
+++ b/gfx/webrender/src/lib.rs
@@ -154,17 +154,16 @@ extern crate core_text;
 extern crate freetype;
 
 #[cfg(target_os = "windows")]
 extern crate dwrote;
 
 extern crate app_units;
 extern crate bincode;
 extern crate byteorder;
-extern crate euclid;
 extern crate fxhash;
 extern crate gleam;
 extern crate num_traits;
 #[cfg(feature = "pathfinder")]
 extern crate pathfinder_font_renderer;
 #[cfg(feature = "pathfinder")]
 extern crate pathfinder_gfx_utils;
 #[cfg(feature = "pathfinder")]
@@ -197,9 +196,10 @@ pub use device::{Device, total_gpu_bytes
 pub use frame_builder::ChasePrimitive;
 pub use renderer::{AsyncPropertySampler, CpuProfile, DebugFlags, OutputImageHandler, RendererKind};
 pub use renderer::{ExternalImage, ExternalImageHandler, ExternalImageSource, GpuProfile};
 pub use renderer::{GraphicsApi, GraphicsApiInfo, PipelineInfo, Renderer, RendererOptions};
 pub use renderer::{RendererStats, SceneBuilderHooks, ThreadListener, ShaderPrecacheFlags};
 pub use renderer::MAX_VERTEX_TEXTURE_WIDTH;
 pub use shade::{Shaders, WrShaders};
 pub use webrender_api as api;
-pub use resource_cache::intersect_for_tile;
+pub use webrender_api::euclid;
+pub use resource_cache::intersect_for_tile;
\ No newline at end of file
--- a/gfx/webrender_api/Cargo.toml
+++ b/gfx/webrender_api/Cargo.toml
@@ -13,17 +13,17 @@ serialize = []
 deserialize = []
 
 [dependencies]
 app_units = "0.7"
 bincode = "1.0"
 bitflags = "1.0"
 byteorder = "1.2.1"
 ipc-channel = {version = "0.11.0", optional = true}
-euclid = { version = "0.19", features = ["serde"] }
+euclid = { version = "0.19.3", features = ["serde"] }
 serde = { version = "=1.0.80", features = ["rc"] }
 serde_derive = { version = "=1.0.80", features = ["deserialize_in_place"] }
 serde_bytes = "0.10"
 time = "0.1"
 
 [target.'cfg(target_os = "macos")'.dependencies]
 core-foundation = "0.6"
 core-graphics = "0.17.1"
--- a/gfx/webrender_api/src/lib.rs
+++ b/gfx/webrender_api/src/lib.rs
@@ -22,17 +22,17 @@ extern crate byteorder;
 #[cfg(feature = "nightly")]
 extern crate core;
 #[cfg(target_os = "macos")]
 extern crate core_foundation;
 #[cfg(target_os = "macos")]
 extern crate core_graphics;
 #[cfg(target_os = "windows")]
 extern crate dwrote;
-extern crate euclid;
+pub extern crate euclid;
 #[cfg(feature = "ipc")]
 extern crate ipc_channel;
 extern crate serde;
 #[macro_use]
 extern crate serde_derive;
 extern crate time;
 
 
--- a/gfx/webrender_bindings/Cargo.toml
+++ b/gfx/webrender_bindings/Cargo.toml
@@ -2,17 +2,17 @@
 name = "webrender_bindings"
 version = "0.1.0"
 authors = ["The Mozilla Project Developers"]
 license = "MPL-2.0"
 
 [dependencies]
 rayon = "1"
 thread_profiler = "0.1.1"
-euclid = { version = "0.19", features = ["serde"] }
+euclid = { version = "0.19.3", features = ["serde"] }
 app_units = "0.7"
 gleam = "0.6.3"
 log = "0.4"
 nsstring = { path = "../../servo/support/gecko/nsstring" }
 bincode = "1.0"
 uuid = { version = "0.6", features = ["v4"] }
 fxhash = "0.2.1"
 
--- a/gfx/webrender_bindings/revision.txt
+++ b/gfx/webrender_bindings/revision.txt
@@ -1,1 +1,1 @@
-9ab93fda1abe8a7ce5c9e83cdfd577946bfcd53c
+262edcb7d48deb72509141e14e1c7d914c1970fb
--- a/js/public/AllocPolicy.h
+++ b/js/public/AllocPolicy.h
@@ -12,17 +12,17 @@
  */
 
 #ifndef js_AllocPolicy_h
 #define js_AllocPolicy_h
 
 #include "js/TypeDecls.h"
 #include "js/Utility.h"
 
-extern MOZ_COLD JS_PUBLIC_API(void) JS_ReportOutOfMemory(JSContext* cx);
+extern MOZ_COLD JS_PUBLIC_API void JS_ReportOutOfMemory(JSContext* cx);
 
 namespace js {
 
 enum class AllocFunction {
     Malloc,
     Calloc,
     Realloc
 };
@@ -49,17 +49,17 @@ class SystemAllocPolicy : public AllocPo
 {
   public:
     void reportAllocOverflow() const {}
     bool checkSimulatedOOM() const {
         return !js::oom::ShouldFailWithOOM();
     }
 };
 
-MOZ_COLD JS_FRIEND_API(void) ReportOutOfMemory(JSContext* cx);
+MOZ_COLD JS_FRIEND_API void ReportOutOfMemory(JSContext* cx);
 
 /*
  * Allocation policy that calls the system memory functions and reports errors
  * to the context. Since the JSContext given on construction is stored for
  * the lifetime of the container, this policy may only be used for containers
  * whose lifetime is a shorter than the given JSContext.
  *
  * FIXME bug 647103 - rewrite this in terms of temporary allocation functions,
@@ -68,18 +68,18 @@ MOZ_COLD JS_FRIEND_API(void) ReportOutOf
 class TempAllocPolicy : public AllocPolicyBase
 {
     JSContext* const cx_;
 
     /*
      * Non-inline helper to call JSRuntime::onOutOfMemory with minimal
      * code bloat.
      */
-    JS_FRIEND_API(void*) onOutOfMemory(AllocFunction allocFunc, size_t nbytes,
-                                       void* reallocPtr = nullptr);
+    JS_FRIEND_API void* onOutOfMemory(AllocFunction allocFunc, size_t nbytes,
+                                      void* reallocPtr = nullptr);
 
     template <typename T>
     T* onOutOfMemoryTyped(AllocFunction allocFunc, size_t numElems, void* reallocPtr = nullptr) {
         size_t bytes;
         if (MOZ_UNLIKELY(!CalculateAllocSize<T>(numElems, &bytes))) {
             return nullptr;
         }
         return static_cast<T*>(onOutOfMemory(allocFunc, bytes, reallocPtr));
@@ -115,17 +115,17 @@ class TempAllocPolicy : public AllocPoli
         return p2;
     }
 
     template <typename T>
     void free_(T* p, size_t numElems = 0) {
         js_free(p);
     }
 
-    JS_FRIEND_API(void) reportAllocOverflow() const;
+    JS_FRIEND_API void reportAllocOverflow() const;
 
     bool checkSimulatedOOM() const {
         if (js::oom::ShouldFailWithOOM()) {
             ReportOutOfMemory(cx_);
             return false;
         }
 
         return true;
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -73,29 +73,29 @@
 #include "js/Value.h"
 
 /* Typedef for native functions called by the JS VM. */
 typedef bool
 (* JSNative)(JSContext* cx, unsigned argc, JS::Value* vp);
 
 namespace JS {
 
-extern JS_PUBLIC_DATA(const HandleValue) UndefinedHandleValue;
+extern JS_PUBLIC_DATA const HandleValue UndefinedHandleValue;
 
 namespace detail {
 
 /*
  * Compute |this| for the |vp| inside a JSNative, either boxing primitives or
  * replacing with the global object as necessary.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ComputeThis(JSContext* cx, JS::Value* vp, MutableHandleObject thisObject);
 
 #ifdef JS_DEBUG
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 CheckIsValidConstructible(const Value& v);
 #endif
 
 class MOZ_STACK_CLASS IncludeUsedRval
 {
     mutable bool usedRval_;
 
   public:
@@ -321,17 +321,17 @@ class MOZ_STACK_CLASS CallArgs : public 
         return args;
     }
 
   public:
     /*
      * Returns true if there are at least |required| arguments passed in. If
      * false, it reports an error message on the context.
      */
-    JS_PUBLIC_API(bool) requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const;
+    JS_PUBLIC_API bool requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const;
 
 };
 
 MOZ_ALWAYS_INLINE CallArgs
 CallArgsFromVp(unsigned argc, Value* vp)
 {
     return CallArgs::create(argc, vp + 2, vp[1].isMagic(JS_IS_CONSTRUCTING));
 }
--- a/js/public/CallNonGenericMethod.h
+++ b/js/public/CallNonGenericMethod.h
@@ -18,17 +18,17 @@ typedef bool (*IsAcceptableThis)(HandleV
 
 // Implements the guts of a method; guaranteed to be provided an acceptable
 // this-value, as determined by a corresponding IsAcceptableThis method.
 typedef bool (*NativeImpl)(JSContext* cx, const CallArgs& args);
 
 namespace detail {
 
 // DON'T CALL THIS DIRECTLY.  It's for use only by CallNonGenericMethod!
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CallMethodIfWrapped(JSContext* cx, IsAcceptableThis test, NativeImpl impl, const CallArgs& args);
 
 } // namespace detail
 
 // Methods usually act upon |this| objects only from a single global object and
 // compartment.  Sometimes, however, a method must act upon |this| values from
 // multiple global objects or compartments.  In such cases the |this| value a
 // method might see will be wrapped, such that various access to the object --
--- a/js/public/CharacterEncoding.h
+++ b/js/public/CharacterEncoding.h
@@ -124,17 +124,17 @@ class UTF8CharsZ : public mozilla::Range
 };
 
 /*
  * A wrapper for a "const char*" that is encoded using UTF-8.
  * This class does not manage ownership of the data; that is left
  * to others.  This differs from UTF8CharsZ in that the chars are
  * const and it disallows assignment.
  */
-class JS_PUBLIC_API(ConstUTF8CharsZ)
+class JS_PUBLIC_API ConstUTF8CharsZ
 {
     const char* data_;
 
   public:
     using CharT = unsigned char;
 
     ConstUTF8CharsZ() : data_(nullptr)
     {}
@@ -237,65 +237,65 @@ LossyTwoByteCharsToNewLatin1CharsZ(JSCon
     const mozilla::Range<const char16_t> tbchars(begin, length);
     return JS::LossyTwoByteCharsToNewLatin1CharsZ(cx, tbchars);
 }
 
 template <typename CharT>
 extern UTF8CharsZ
 CharsToNewUTF8CharsZ(JSContext* maybeCx, const mozilla::Range<CharT> chars);
 
-JS_PUBLIC_API(uint32_t)
+JS_PUBLIC_API uint32_t
 Utf8ToOneUcs4Char(const uint8_t* utf8Buffer, int utf8Length);
 
 /*
  * Inflate bytes in UTF-8 encoding to char16_t.
  * - On error, returns an empty TwoByteCharsZ.
  * - On success, returns a malloc'd TwoByteCharsZ, and updates |outlen| to hold
  *   its length;  the length value excludes the trailing null.
  */
-extern JS_PUBLIC_API(TwoByteCharsZ)
+extern JS_PUBLIC_API TwoByteCharsZ
 UTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen);
 
 /*
  * Like UTF8CharsToNewTwoByteCharsZ, but for ConstUTF8CharsZ.
  */
-extern JS_PUBLIC_API(TwoByteCharsZ)
+extern JS_PUBLIC_API TwoByteCharsZ
 UTF8CharsToNewTwoByteCharsZ(JSContext* cx, const ConstUTF8CharsZ& utf8, size_t* outlen);
 
 /*
  * The same as UTF8CharsToNewTwoByteCharsZ(), except that any malformed UTF-8 characters
  * will be replaced by \uFFFD. No exception will be thrown for malformed UTF-8
  * input.
  */
-extern JS_PUBLIC_API(TwoByteCharsZ)
+extern JS_PUBLIC_API TwoByteCharsZ
 LossyUTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen);
 
-extern JS_PUBLIC_API(TwoByteCharsZ)
+extern JS_PUBLIC_API TwoByteCharsZ
 LossyUTF8CharsToNewTwoByteCharsZ(JSContext* cx, const ConstUTF8CharsZ& utf8, size_t* outlen);
 
 /*
  * Returns the length of the char buffer required to encode |s| as UTF8.
  * Does not include the null-terminator.
  */
-JS_PUBLIC_API(size_t)
+JS_PUBLIC_API size_t
 GetDeflatedUTF8StringLength(JSFlatString* s);
 
 /*
  * Encode |src| as UTF8. The caller must either ensure |dst| has enough space
  * to encode the entire string or pass the length of the buffer as |dstlenp|,
  * in which case the function will encode characters from the string until
  * the buffer is exhausted. Does not write the null terminator.
  *
  * If |dstlenp| is provided, it will be updated to hold the number of bytes
  * written to the buffer. If |numcharsp| is provided, it will be updated to hold
  * the number of Unicode characters written to the buffer (which can be less
  * than the length of the string, if the buffer is exhausted before the string
  * is fully encoded).
  */
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 DeflateStringToUTF8Buffer(JSFlatString* src, mozilla::RangedPtr<char> dst,
                           size_t* dstlenp = nullptr, size_t* numcharsp = nullptr);
 
 /*
  * The smallest character encoding capable of fully representing a particular
  * string.
  */
 enum class SmallestEncoding {
@@ -304,41 +304,41 @@ enum class SmallestEncoding {
     UTF16
 };
 
 /*
  * Returns the smallest encoding possible for the given string: if all
  * codepoints are <128 then ASCII, otherwise if all codepoints are <256
  * Latin-1, else UTF16.
  */
-JS_PUBLIC_API(SmallestEncoding)
+JS_PUBLIC_API SmallestEncoding
 FindSmallestEncoding(UTF8Chars utf8);
 
 /*
   * Return a null-terminated Latin-1 string copied from the input string,
   * storing its length (excluding null terminator) in |*outlen|.  Fail and
   * report an error if the string contains non-Latin-1 codepoints.  Returns
   * Latin1CharsZ() on failure.
  */
-extern JS_PUBLIC_API(Latin1CharsZ)
+extern JS_PUBLIC_API Latin1CharsZ
 UTF8CharsToNewLatin1CharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen);
 
 /*
  * Return a null-terminated Latin-1 string copied from the input string,
  * storing its length (excluding null terminator) in |*outlen|.  Non-Latin-1
  * codepoints are replaced by '?'.  Returns Latin1CharsZ() on failure.
  */
-extern JS_PUBLIC_API(Latin1CharsZ)
+extern JS_PUBLIC_API Latin1CharsZ
 LossyUTF8CharsToNewLatin1CharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen);
 
 /*
  * Returns true if all characters in the given null-terminated string are
  * ASCII, i.e. < 0x80, false otherwise.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 StringIsASCII(const char* s);
 
 } // namespace JS
 
 inline void JS_free(JS::Latin1CharsZ& ptr) { js_free((void*)ptr.get()); }
 inline void JS_free(JS::UTF8CharsZ& ptr) { js_free((void*)ptr.get()); }
 
 /**
@@ -350,17 +350,17 @@ inline void JS_free(JS::UTF8CharsZ& ptr)
  * the memory.
  *
  * This function *loses information* when it copies the characters of |str| if
  * |str| contains code units greater than 0xFF.  Additionally, users that
  * depend on null-termination will misinterpret the copied characters if |str|
  * contains any nulls.  Avoid using this function if possible, because it will
  * eventually be removed.
  */
-extern JS_PUBLIC_API(JS::UniqueChars)
+extern JS_PUBLIC_API JS::UniqueChars
 JS_EncodeStringToLatin1(JSContext* cx, JSString* str);
 
 /**
  * DEPRECATED
  *
  * Same behavior as JS_EncodeStringToLatin1(), but encode into a UTF-8 string.
  *
  * This function *loses information* when it copies the characters of |str| if
@@ -370,17 +370,17 @@ JS_EncodeStringToLatin1(JSContext* cx, J
  * The returned string is also subject to misinterpretation if |str| contains
  * any nulls (which are faithfully transcribed into the returned string, but
  * which will implicitly truncate the string if it's passed to functions that
  * expect null-terminated strings).
  *
  * Avoid using this function if possible, because we'll remove it once we can
  * devise a better API for the task.
  */
-extern JS_PUBLIC_API(JS::UniqueChars)
+extern JS_PUBLIC_API JS::UniqueChars
 JS_EncodeStringToUTF8(JSContext* cx, JS::Handle<JSString*> str);
 
 /**
  * DEPRECATED
  *
  * Same behavior as JS_EncodeStringToLatin1(), but encode into an ASCII string.
  *
  * This function asserts in debug mode that the input string contains only
@@ -389,12 +389,12 @@ JS_EncodeStringToUTF8(JSContext* cx, JS:
  * The returned string is also subject to misinterpretation if |str| contains
  * any nulls (which are faithfully transcribed into the returned string, but
  * which will implicitly truncate the string if it's passed to functions that
  * expect null-terminated strings).
  *
  * Avoid using this function if possible, because we'll remove it once we can
  * devise a better API for the task.
  */
-extern JS_PUBLIC_API(JS::UniqueChars)
+extern JS_PUBLIC_API JS::UniqueChars
 JS_EncodeStringToASCII(JSContext* cx, JSString* str);
 
 #endif /* js_CharacterEncoding_h */
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -31,17 +31,17 @@ struct JSFunctionSpec;
 namespace js {
 
 struct Class;
 class FreeOp;
 class Shape;
 
 // This is equal to JSFunction::class_.  Use it in places where you don't want
 // to #include jsfun.h.
-extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr;
+extern JS_FRIEND_DATA const js::Class* const FunctionClassPtr;
 
 } // namespace js
 
 namespace JS {
 
 /**
  * The answer to a successful query as to whether an object is an Array per
  * ES6's internal |IsArray| operation (as exposed by |Array.isArray|).
@@ -60,28 +60,28 @@ enum class IsArrayAnswer
  * indicating whether the object passes ECMAScript's IsArray test.  This is the
  * same test performed by |Array.isArray|.
  *
  * This is NOT the same as asking whether |obj| is an Array or a wrapper around
  * one.  If |obj| is a proxy created by |Proxy.revocable()| and has been
  * revoked, or if |obj| is a proxy whose target (at any number of hops) is a
  * revoked proxy, this method throws a TypeError and returns false.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsArray(JSContext* cx, HandleObject obj, bool* isArray);
 
 /**
  * Identical to IsArray above, but the nature of the object (if successfully
  * determined) is communicated via |*answer|.  In particular this method
  * returns true and sets |*answer = IsArrayAnswer::RevokedProxy| when called on
  * a revoked proxy.
  *
  * Most users will want the overload above, not this one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsArray(JSContext* cx, HandleObject obj, IsArrayAnswer* answer);
 
 /**
  * Per ES6, the [[DefineOwnProperty]] internal method has three different
  * possible outcomes:
  *
  * -   It can throw an exception (which we indicate by returning false).
  *
@@ -187,30 +187,30 @@ class ObjectOpResult
      * Always returns true, as a convenience.
      */
     bool failSoft(uint32_t msg) {
         // The msg code is currently never extracted again.
         code_ = msg | SoftFailBit;
         return true;
     }
 
-    JS_PUBLIC_API(bool) failCantRedefineProp();
-    JS_PUBLIC_API(bool) failReadOnly();
-    JS_PUBLIC_API(bool) failGetterOnly();
-    JS_PUBLIC_API(bool) failCantDelete();
+    JS_PUBLIC_API bool failCantRedefineProp();
+    JS_PUBLIC_API bool failReadOnly();
+    JS_PUBLIC_API bool failGetterOnly();
+    JS_PUBLIC_API bool failCantDelete();
 
-    JS_PUBLIC_API(bool) failCantSetInterposed();
-    JS_PUBLIC_API(bool) failCantDefineWindowElement();
-    JS_PUBLIC_API(bool) failCantDeleteWindowElement();
-    JS_PUBLIC_API(bool) failCantDeleteWindowNamedProperty();
-    JS_PUBLIC_API(bool) failCantPreventExtensions();
-    JS_PUBLIC_API(bool) failCantSetProto();
-    JS_PUBLIC_API(bool) failNoNamedSetter();
-    JS_PUBLIC_API(bool) failNoIndexedSetter();
-    JS_PUBLIC_API(bool) failNotDataDescriptor();
+    JS_PUBLIC_API bool failCantSetInterposed();
+    JS_PUBLIC_API bool failCantDefineWindowElement();
+    JS_PUBLIC_API bool failCantDeleteWindowElement();
+    JS_PUBLIC_API bool failCantDeleteWindowNamedProperty();
+    JS_PUBLIC_API bool failCantPreventExtensions();
+    JS_PUBLIC_API bool failCantSetProto();
+    JS_PUBLIC_API bool failNoNamedSetter();
+    JS_PUBLIC_API bool failNoIndexedSetter();
+    JS_PUBLIC_API bool failNotDataDescriptor();
 
     uint32_t failureCode() const {
         MOZ_ASSERT(!ok());
         return uint32_t(code_);
     }
 
     /*
      * Report an error or warning if necessary; return true to proceed and
@@ -252,18 +252,18 @@ class ObjectOpResult
      * The same as reportError(cx, obj, id), except the operation is not
      * associated with a particular property id.
      */
     bool reportError(JSContext* cx, HandleObject obj) {
         return reportStrictErrorOrWarning(cx, obj, true);
     }
 
     /* Helper function for checkStrictErrorOrWarning's slow path. */
-    JS_PUBLIC_API(bool) reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, HandleId id, bool strict);
-    JS_PUBLIC_API(bool) reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, bool strict);
+    JS_PUBLIC_API bool reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, HandleId id, bool strict);
+    JS_PUBLIC_API bool reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, bool strict);
 
     /*
      * Convenience method. Return true if ok() or if strict is false; otherwise
      * throw a TypeError and return false.
      */
     bool checkStrict(JSContext* cx, HandleObject obj, HandleId id) {
         return checkStrictErrorOrWarning(cx, obj, id, true);
     }
@@ -553,17 +553,17 @@ typedef bool
                   JS::HandleValue receiver, JS::ObjectOpResult& result);
 typedef bool
 (* GetOwnPropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
                      JS::MutableHandle<JS::PropertyDescriptor> desc);
 typedef bool
 (* DeletePropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
                      JS::ObjectOpResult& result);
 
-class JS_FRIEND_API(ElementAdder)
+class JS_FRIEND_API ElementAdder
 {
   public:
     enum GetBehavior {
         // Check if the element exists before performing the Get and preserve
         // holes.
         CheckHasElemPreserveHoles,
 
         // Perform a Get operation, like obj[index] in JS.
@@ -1062,15 +1062,15 @@ enum class ESClass {
     Other
 };
 
 /* Fills |vp| with the unboxed value for boxed types, or undefined otherwise. */
 bool
 Unbox(JSContext* cx, JS::HandleObject obj, JS::MutableHandleValue vp);
 
 #ifdef DEBUG
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 HasObjectMovedOp(JSObject* obj);
 #endif
 
 }  /* namespace js */
 
 #endif  /* js_Class_h */
--- a/js/public/CompilationAndEvaluation.h
+++ b/js/public/CompilationAndEvaluation.h
@@ -38,17 +38,17 @@ template<typename UnitT> class SourceTex
  *
  * The intent of this function is to enable interactive compilation: accumulate
  * lines in a buffer until JS_Utf8BufferIsCompilableUnit is true, then pass it
  * to the compiler.
  *
  * The provided buffer is interpreted as UTF-8 data.  An error is reported if
  * a UTF-8 encoding error is encountered.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_Utf8BufferIsCompilableUnit(JSContext* cx, JS::Handle<JSObject*> obj,
                               const char* utf8, size_t length);
 
 /*
  * NB: JS_ExecuteScript and the JS::Evaluate APIs come in two flavors: either
  * they use the global as the scope, or they take an AutoObjectVector of objects
  * to use as the scope chain.  In the former case, the global is also used as
  * the "this" keyword value and the variables object (ECMA parlance for where
@@ -62,226 +62,226 @@ JS_Utf8BufferIsCompilableUnit(JSContext*
  * would not tend to be used.  The ContextOptionsRef adjustment, OTOH, can be
  * more easily hacked into existing code that does not depend on the bug; such
  * code can continue to use the familiar JS::Evaluate, etc., entry points.
  */
 
 /**
  * Evaluate a script in the scope of the current global of cx.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ExecuteScript(JSContext* cx, JS::Handle<JSScript*> script, JS::MutableHandle<JS::Value> rval);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ExecuteScript(JSContext* cx, JS::Handle<JSScript*> script);
 
 /**
  * As above, but providing an explicit scope chain.  envChain must not include
  * the global object on it; that's implicit.  It needs to contain the other
  * objects that should end up on the script's scope chain.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ExecuteScript(JSContext* cx, JS::AutoVector<JSObject*>& envChain,
                  JS::Handle<JSScript*> script, JS::MutableHandle<JS::Value> rval);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ExecuteScript(JSContext* cx, JS::AutoVector<JSObject*>& envChain, JS::Handle<JSScript*> script);
 
 namespace JS {
 
 /**
  * Like the above, but handles a cross-compartment script. If the script is
  * cross-compartment, it is cloned into the current compartment before executing.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CloneAndExecuteScript(JSContext* cx, Handle<JSScript*> script, MutableHandle<Value> rval);
 
 /**
  * Like CloneAndExecuteScript above, but allows executing under a non-syntactic
  * environment chain.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CloneAndExecuteScript(JSContext* cx, AutoVector<JSObject*>& envChain, Handle<JSScript*> script,
                       MutableHandle<Value> rval);
 
 /**
  * Evaluate the given source buffer in the scope of the current global of cx.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
          SourceText<char16_t>& srcBuf, MutableHandle<Value> rval);
 
 /**
  * As above, but providing an explicit scope chain.  envChain must not include
  * the global object on it; that's implicit.  It needs to contain the other
  * objects that should end up on the script's scope chain.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 Evaluate(JSContext* cx, AutoVector<JSObject*>& envChain, const ReadOnlyCompileOptions& options,
          SourceText<char16_t>& srcBuf, MutableHandle<Value> rval);
 
 /**
  * Evaluate the provided UTF-8 data in the scope of the current global of |cx|,
  * and return the completion value in |rval|.  If the data contains invalid
  * UTF-8, an error is reported.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 EvaluateUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
              const char* bytes, size_t length, MutableHandle<Value> rval);
 
 /**
  * Evaluate the provided Latin-1 data (i.e. each byte directly corresponds to
  * the same Unicode code point) in the scope of the current global of |cx|, and
  * return the completion value in |rval|.
  *
  * This function may eventually be removed, such that *only* bytes containing
  * UTF-8 source text may be directly compiled.  Avoid using it if you can.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 EvaluateLatin1(JSContext* cx, const ReadOnlyCompileOptions& options,
                const char* bytes, size_t length, MutableHandle<Value> rval);
 
 /**
  * Evaluate the UTF-8 contents of the file at the given path, and return the
  * completion value in |rval|.  (The path itself is in the system encoding, not
  * [necessarily] UTF-8.)  If the contents contain any malformed UTF-8, an error
  * is reported.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 EvaluateUtf8Path(JSContext* cx, const ReadOnlyCompileOptions& options,
                  const char* filename, MutableHandle<Value> rval);
 
 /**
  * |script| will always be set. On failure, it will be set to nullptr.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 Compile(JSContext* cx, const ReadOnlyCompileOptions& options,
         SourceText<char16_t>& srcBuf, MutableHandle<JSScript*> script);
 
 /**
  * Compile the provided UTF-8 data into a script.  If the data contains invalid
  * UTF-8, an error is reported.
  *
  * |script| is always set to the compiled script or to null in case of error.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
             const char* bytes, size_t length, MutableHandle<JSScript*> script);
 
 /**
  * Compile the provided UTF-8 data into a script.  If the data contains invalid
  * UTF-8, an error is reported.
  *
  * |script| is always set to the compiled script or to null in case of error.
  *
  * NOTE: This function DOES NOT INFLATE the UTF-8 bytes to UTF-16 before
  *       compiling them.  UTF-8 compilation is currently experimental and has
  *       known bugs.  Use only if you're willing to tolerate unspecified bugs!
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileUtf8DontInflate(JSContext* cx, const ReadOnlyCompileOptions& options,
                        const char* bytes, size_t length, MutableHandle<JSScript*> script);
 
 /**
  * Compile the provided Latin-1 data (i.e. each byte directly corresponds to
  * the same Unicode code point) into a script.
  *
  * This function may eventually be removed, such that *only* bytes containing
  * UTF-8 source text may be directly compiled.  Avoid using it if you can.
  *
  * |script| is always set to the compiled script or to null in case of error.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileLatin1(JSContext* cx, const ReadOnlyCompileOptions& options,
               const char* bytes, size_t length, MutableHandle<JSScript*> script);
 
 /**
  * Compile the UTF-8 contents of the given file into a script.  If the contents
  * contain any malformed UTF-8, an error is reported.
  *
  * |script| is always set to the compiled script or to null in case of error.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileUtf8File(JSContext* cx, const ReadOnlyCompileOptions& options,
                 FILE* file, MutableHandle<JSScript*> script);
 
 /**
  * Compile the UTF-8 contents of the given file into a script.  If the contents
  * contain any malformed UTF-8, an error is reported.
  *
  * |script| is always set to the compiled script or to null in case of error.
  *
  * NOTE: This function DOES NOT INFLATE the UTF-8 bytes to UTF-16 before
  *       compiling them.  UTF-8 compilation is currently experimental and has
  *       known bugs.  Use only if you're willing to tolerate unspecified bugs!
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileUtf8FileDontInflate(JSContext* cx, const ReadOnlyCompileOptions& options,
                            FILE* file, MutableHandle<JSScript*> script);
 
 /**
  * Compile the UTF-8 contents of the file at the given path into a script.
  * (The path itself is in the system encoding, not [necessarily] UTF-8.)  If
  * the contents contain any malformed UTF-8, an error is reported.
  *
  * |script| is always set to the compiled script or to null in case of error.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileUtf8Path(JSContext* cx, const ReadOnlyCompileOptions& options,
                 const char* filename, MutableHandle<JSScript*> script);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileForNonSyntacticScope(JSContext* cx, const ReadOnlyCompileOptions& options,
                             SourceText<char16_t>& srcBuf, MutableHandle<JSScript*> script);
 
 /**
  * Compile the given Latin-1 data for non-syntactic scope.
  *
  * There is no way to compile UTF-8 data for non-syntactic scope because no
  * user currently needs it.  Such way could be added in the future if it's ever
  * needed.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileLatin1ForNonSyntacticScope(JSContext* cx, const ReadOnlyCompileOptions& options,
                                   const char* bytes, size_t length,
                                   MutableHandle<JSScript*> script);
 
 /**
  * Compile a function with envChain plus the global as its scope chain.
  * envChain must contain objects in the current compartment of cx.  The actual
  * scope chain used for the function will consist of With wrappers for those
  * objects, followed by the current global of the compartment cx is in.  This
  * global must not be explicitly included in the scope chain.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileFunction(JSContext* cx, AutoVector<JSObject*>& envChain,
                 const ReadOnlyCompileOptions& options,
                 const char* name, unsigned nargs, const char* const* argnames,
                 SourceText<char16_t>& srcBuf, MutableHandle<JSFunction*> fun);
 
 /**
  * Same as above, but taking UTF-8 encoded const char* for the function body.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileFunctionUtf8(JSContext* cx, AutoVector<JSObject*>& envChain,
                     const ReadOnlyCompileOptions& options,
                     const char* name, unsigned nargs, const char* const* argnames,
                     const char* utf8, size_t length, MutableHandle<JSFunction*> fun);
 
 /*
  * Associate an element wrapper and attribute name with a previously compiled
  * script, for debugging purposes. Calling this function is optional, but should
  * be done before script execution if it is required.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 InitScriptSourceElement(JSContext* cx, Handle<JSScript*> script,
                         Handle<JSObject*> element, Handle<JSString*> elementAttrName = nullptr);
 
 /*
  * For a script compiled with the hideScriptFromDebugger option, expose the
  * script to the debugger by calling the debugger's onNewScript hook.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 ExposeScriptToDebugger(JSContext* cx, Handle<JSScript*> script);
 
 } /* namespace JS */
 
 #endif /* js_CompilationAndEvaluation_h */
--- a/js/public/CompileOptions.h
+++ b/js/public/CompileOptions.h
@@ -77,17 +77,17 @@ enum class AsmJSOption : uint8_t
 };
 
 /**
  * The common base class for the CompileOptions hierarchy.
  *
  * Use this in code that needs to propagate compile options from one
  * compilation unit to another.
  */
-class JS_PUBLIC_API(TransitiveCompileOptions)
+class JS_PUBLIC_API TransitiveCompileOptions
 {
   protected:
     /**
      * The Web Platform allows scripts to be loaded from arbitrary cross-origin
      * sources. This allows an attack by which a malicious website loads a
      * sensitive file (say, a bank statement) cross-origin (using the user's
      * cookies), and sniffs the generated syntax errors (via a window.onerror
      * handler) for juicy morsels of its contents.
@@ -146,27 +146,27 @@ class JS_PUBLIC_API(TransitiveCompileOpt
     virtual JSObject* element() const = 0;
     virtual JSString* elementAttributeName() const = 0;
     virtual JSScript* introductionScript() const = 0;
 
   private:
     void operator=(const TransitiveCompileOptions&) = delete;
 };
 
-class JS_PUBLIC_API(CompileOptions);
+class JS_PUBLIC_API CompileOptions;
 
 /**
  * The class representing a full set of compile options.
  *
  * Use this in code that only needs to access compilation options created
  * elsewhere, like the compiler.  Don't instantiate this class (the constructor
  * is protected anyway); instead, create instances only of the derived classes:
  * CompileOptions and OwningCompileOptions.
  */
-class JS_PUBLIC_API(ReadOnlyCompileOptions)
+class JS_PUBLIC_API ReadOnlyCompileOptions
   : public TransitiveCompileOptions
 {
   public:
     // POD options.
     unsigned lineno  = 1;
     unsigned column = 0;
 
     // The offset within the ScriptSource's full uncompressed text of the first
@@ -223,17 +223,17 @@ class JS_PUBLIC_API(ReadOnlyCompileOptio
  * unlike CompileOptions, it can outlive any given stack frame.
  *
  * Note that this *roots* any JS values it refers to - they're live
  * unconditionally. Thus, instances of this type can't be owned, directly
  * or indirectly, by a JavaScript object: if any value that this roots ever
  * comes to refer to the object that owns this, then the whole cycle, and
  * anything else it entrains, will never be freed.
  */
-class JS_PUBLIC_API(OwningCompileOptions) final
+class JS_PUBLIC_API OwningCompileOptions final
   : public ReadOnlyCompileOptions
 {
     PersistentRooted<JSObject*> elementRoot;
     PersistentRooted<JSString*> elementAttributeNameRoot;
     PersistentRooted<JSScript*> introductionScriptRoot;
 
   public:
     // A minimal constructor, for use with OwningCompileOptions::copy.
@@ -354,17 +354,17 @@ class JS_PUBLIC_API(OwningCompileOptions
 
 /**
  * Compilation options stored on the stack. An instance of this type
  * simply holds references to dynamically allocated resources (element;
  * filename; source map URL) that are owned by something else. If you
  * create an instance of this type, it's up to you to guarantee that
  * everything you store in it will outlive it.
  */
-class MOZ_STACK_CLASS JS_PUBLIC_API(CompileOptions) final
+class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
   : public ReadOnlyCompileOptions
 {
   private:
     Rooted<JSObject*> elementRoot;
     Rooted<JSString*> elementAttributeNameRoot;
     Rooted<JSScript*> introductionScriptRoot;
 
   public:
--- a/js/public/Conversions.h
+++ b/js/public/Conversions.h
@@ -21,93 +21,93 @@
 #include "jspubtd.h"
 
 #include "js/RootingAPI.h"
 #include "js/Value.h"
 
 namespace js {
 
 /* DO NOT CALL THIS. Use JS::ToBoolean. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToBooleanSlow(JS::HandleValue v);
 
 /* DO NOT CALL THIS.  Use JS::ToNumber. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToNumberSlow(JSContext* cx, JS::HandleValue v, double* dp);
 
 /* DO NOT CALL THIS. Use JS::ToInt8. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToInt8Slow(JSContext *cx, JS::HandleValue v, int8_t *out);
 
 /* DO NOT CALL THIS. Use JS::ToUint8. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToUint8Slow(JSContext *cx, JS::HandleValue v, uint8_t *out);
 
 /* DO NOT CALL THIS. Use JS::ToInt16. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToInt16Slow(JSContext *cx, JS::HandleValue v, int16_t *out);
 
 /* DO NOT CALL THIS. Use JS::ToInt32. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToInt32Slow(JSContext* cx, JS::HandleValue v, int32_t* out);
 
 /* DO NOT CALL THIS. Use JS::ToUint32. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToUint32Slow(JSContext* cx, JS::HandleValue v, uint32_t* out);
 
 /* DO NOT CALL THIS. Use JS::ToUint16. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToUint16Slow(JSContext* cx, JS::HandleValue v, uint16_t* out);
 
 /* DO NOT CALL THIS. Use JS::ToInt64. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToInt64Slow(JSContext* cx, JS::HandleValue v, int64_t* out);
 
 /* DO NOT CALL THIS. Use JS::ToUint64. */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToUint64Slow(JSContext* cx, JS::HandleValue v, uint64_t* out);
 
 /* DO NOT CALL THIS. Use JS::ToString. */
-extern JS_PUBLIC_API(JSString*)
+extern JS_PUBLIC_API JSString*
 ToStringSlow(JSContext* cx, JS::HandleValue v);
 
 /* DO NOT CALL THIS. Use JS::ToObject. */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 ToObjectSlow(JSContext* cx, JS::HandleValue v, bool reportScanStack);
 
 } // namespace js
 
 namespace JS {
 
 namespace detail {
 
 #ifdef JS_DEBUG
 /**
  * Assert that we're not doing GC on cx, that we're in a request as
  * needed, and that the compartments for cx and v are correct.
  * Also check that GC would be safe at this point.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 AssertArgumentsAreSane(JSContext* cx, HandleValue v);
 #else
 inline void AssertArgumentsAreSane(JSContext* cx, HandleValue v)
 {}
 #endif /* JS_DEBUG */
 
 } // namespace detail
 
 /**
  * ES6 draft 20141224, 7.1.1, second algorithm.
  *
  * Most users shouldn't call this -- use JS::ToBoolean, ToNumber, or ToString
  * instead.  This will typically only be called from custom convert hooks that
  * wish to fall back to the ES6 default conversion behavior shared by most
  * objects in JS, codified as OrdinaryToPrimitive.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType type, MutableHandleValue vp);
 
 /* ES6 draft 20141224, 7.1.2. */
 MOZ_ALWAYS_INLINE bool
 ToBoolean(HandleValue v)
 {
     if (v.isBoolean()) {
         return v.toBoolean();
--- a/js/public/Date.h
+++ b/js/public/Date.h
@@ -45,17 +45,17 @@ namespace JS {
  *
  * Left to its own devices, SpiderMonkey itself may occasionally try to detect
  * system time changes.  However, no particular frequency of checking is
  * guaranteed.  Embedders unable to accept occasional inaccuracies should call
  * this method in response to system time changes, or immediately before
  * operations requiring instantaneous correctness, to guarantee correct
  * behavior.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 ResetTimeZone();
 
 class ClippedTime;
 inline ClippedTime TimeClip(double time);
 
 /*
  * |ClippedTime| represents the limited subset of dates/times described above.
  *
@@ -117,77 +117,77 @@ inline Value
 TimeValue(ClippedTime time)
 {
     return DoubleValue(JS::CanonicalizeNaN(time.toDouble()));
 }
 
 // Create a new Date object whose [[DateValue]] internal slot contains the
 // clipped |time|.  (Users who must represent times outside that range must use
 // another representation.)
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 NewDateObject(JSContext* cx, ClippedTime time);
 
 // Year is a year, month is 0-11, day is 1-based.  The return value is a number
 // of milliseconds since the epoch.
 //
 // Consistent with the MakeDate algorithm defined in ECMAScript, this value is
 // *not* clipped!  Use JS::TimeClip if you need a clipped date.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 MakeDate(double year, unsigned month, unsigned day);
 
 // Year is a year, month is 0-11, day is 1-based, and time is in milliseconds.
 // The return value is a number of milliseconds since the epoch.
 //
 // Consistent with the MakeDate algorithm defined in ECMAScript, this value is
 // *not* clipped!  Use JS::TimeClip if you need a clipped date.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 MakeDate(double year, unsigned month, unsigned day, double time);
 
 // Takes an integer number of milliseconds since the epoch and returns the
 // year.  Can return NaN, and will do so if NaN is passed in.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 YearFromTime(double time);
 
 // Takes an integer number of milliseconds since the epoch and returns the
 // month (0-11).  Can return NaN, and will do so if NaN is passed in.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 MonthFromTime(double time);
 
 // Takes an integer number of milliseconds since the epoch and returns the
 // day (1-based).  Can return NaN, and will do so if NaN is passed in.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 DayFromTime(double time);
 
 // Takes an integer year and returns the number of days from epoch to the given
 // year.
 // NOTE: The calculation performed by this function is literally that given in
 // the ECMAScript specification.  Nonfinite years, years containing fractional
 // components, and years outside ECMAScript's date range are not handled with
 // any particular intelligence.  Garbage in, garbage out.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 DayFromYear(double year);
 
 // Takes an integer number of milliseconds since the epoch and an integer year,
 // returns the number of days in that year. If |time| is nonfinite, returns NaN.
 // Otherwise |time| *must* correspond to a time within the valid year |year|.
 // This should usually be ensured by computing |year| as |JS::DayFromYear(time)|.
-JS_PUBLIC_API(double)
+JS_PUBLIC_API double
 DayWithinYear(double time, double year);
 
 // The callback will be a wrapper function that accepts a single double (the time
 // to clamp and jitter.) Inside the JS Engine, other parameters that may be needed
 // are all constant, so they are handled inside the wrapper function
 using ReduceMicrosecondTimePrecisionCallback = double(*)(double);
 
 // Set a callback into the toolkit/components/resistfingerprinting function that
 // will centralize time resolution and jitter into one place.
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 SetReduceMicrosecondTimePrecisionCallback(ReduceMicrosecondTimePrecisionCallback callback);
 
 // Sets the time resolution for fingerprinting protection, and whether jitter
 // should occur. If resolution is set to zero, then no rounding or jitter will
 // occur. This is used if the callback above is not specified.
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 SetTimeResolutionUsec(uint32_t resolution, bool jitter);
 
 } // namespace JS
 
 #endif /* js_Date_h */
--- a/js/public/Debug.h
+++ b/js/public/Debug.h
@@ -257,22 +257,22 @@ class BuilderOrigin : public Builder {
 //
 // Debugger.Memory wants to be able to report how many bytes items in memory are
 // consuming. To do this, it needs a function that accepts a pointer to a block,
 // and returns the number of bytes allocated to that block. SpiderMonkey itself
 // doesn't know which function is appropriate to use, but the embedding does.
 
 // Tell Debuggers in |cx| to use |mallocSizeOf| to find the size of
 // malloc'd blocks.
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 SetDebuggerMallocSizeOf(JSContext* cx, mozilla::MallocSizeOf mallocSizeOf);
 
 // Get the MallocSizeOf function that the given context is using to find the
 // size of malloc'd blocks.
-JS_PUBLIC_API(mozilla::MallocSizeOf)
+JS_PUBLIC_API mozilla::MallocSizeOf
 GetDebuggerMallocSizeOf(JSContext* cx);
 
 
 
 // Debugger and Garbage Collection Events
 // --------------------------------------
 //
 // The Debugger wants to report about its debuggees' GC cycles, however entering
@@ -280,49 +280,49 @@ GetDebuggerMallocSizeOf(JSContext* cx);
 // force a GC and then rely on the nursery being empty. If we call into some
 // Debugger's hook after the GC, then JS runs and the nursery won't be
 // empty. Instead, we rely on embedders to call back into SpiderMonkey after a
 // GC and notify Debuggers to call their onGarbageCollection hook.
 
 // Determine whether it's necessary to call FireOnGarbageCollectionHook() after
 // a GC. This is only required if there are debuggers with an
 // onGarbageCollection hook observing a global in the set of collected zones.
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 FireOnGarbageCollectionHookRequired(JSContext* cx);
 
 // For each Debugger that observed a debuggee involved in the given GC event,
 // call its `onGarbageCollection` hook.
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 FireOnGarbageCollectionHook(JSContext* cx, GarbageCollectionEvent::Ptr&& data);
 
 
 // Return true if the given value is a Debugger object, false otherwise.
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 IsDebugger(JSObject& obj);
 
 // Append each of the debuggee global objects observed by the Debugger object
 // |dbgObj| to |vector|. Returns true on success, false on failure.
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 GetDebuggeeGlobals(JSContext* cx, JSObject& dbgObj, AutoObjectVector& vector);
 
 
 // Hooks for reporting where JavaScript execution began.
 //
 // Our performance tools would like to be able to label blocks of JavaScript
 // execution with the function name and source location where execution began:
 // the event handler, the callback, etc.
 //
 // Construct an instance of this class on the stack, providing a JSContext
 // belonging to the runtime in which execution will occur. Each time we enter
 // JavaScript --- specifically, each time we push a JavaScript stack frame that
 // has no older JS frames younger than this AutoEntryMonitor --- we will
 // call the appropriate |Entry| member function to indicate where we've begun
 // execution.
 
-class MOZ_STACK_CLASS JS_PUBLIC_API(AutoEntryMonitor) {
+class MOZ_STACK_CLASS JS_PUBLIC_API AutoEntryMonitor {
     JSContext* cx_;
     AutoEntryMonitor* savedMonitor_;
 
   public:
     explicit AutoEntryMonitor(JSContext* cx);
     ~AutoEntryMonitor();
 
     // SpiderMonkey reports the JavaScript entry points occuring within this
--- a/js/public/ErrorReport.h
+++ b/js/public/ErrorReport.h
@@ -165,17 +165,17 @@ class JSErrorNotes
                        const char* filename, unsigned lineno, unsigned column,
                        JSErrorCallback errorCallback, void* userRef,
                        const unsigned errorNumber, ...);
     bool addNoteUTF8(JSContext* cx,
                      const char* filename, unsigned lineno, unsigned column,
                      JSErrorCallback errorCallback, void* userRef,
                      const unsigned errorNumber, ...);
 
-    JS_PUBLIC_API(size_t) length();
+    JS_PUBLIC_API size_t length();
 
     // Create a deep copy of notes.
     js::UniquePtr<JSErrorNotes> copy(JSContext* cx);
 
     class iterator final
       : public std::iterator<std::input_iterator_tag, js::UniquePtr<Note>>
     {
       private:
@@ -195,18 +195,18 @@ class JSErrorNotes
             note_++;
             return *this;
         }
         reference operator*() {
             return *note_;
         }
     };
 
-    JS_PUBLIC_API(iterator) begin();
-    JS_PUBLIC_API(iterator) end();
+    JS_PUBLIC_API iterator begin();
+    JS_PUBLIC_API iterator end();
 };
 
 /**
  * Describes a single error or warning that occurs in the execution of script.
  */
 class JSErrorReport : public JSErrorBase
 {
   private:
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -21,17 +21,17 @@
 
 struct JSFreeOp;
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wattributes"
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
-class JS_PUBLIC_API(JSTracer);
+class JS_PUBLIC_API JSTracer;
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic pop
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
 namespace js {
 namespace gc {
 class GCRuntime;
@@ -411,17 +411,17 @@ enum Reason {
      * cost of switching histograms is high.
      */
     NUM_TELEMETRY_REASONS = 100
 };
 
 /**
  * Get a statically allocated C string explaining the given GC reason.
  */
-extern JS_PUBLIC_API(const char*)
+extern JS_PUBLIC_API const char*
 ExplainReason(JS::gcreason::Reason reason);
 
 } /* namespace gcreason */
 
 /*
  * Zone GC:
  *
  * SpiderMonkey's GC is capable of performing a collection on an arbitrary
@@ -433,45 +433,45 @@ ExplainReason(JS::gcreason::Reason reaso
  * to select the zones to be collected. To do this, you can call
  * PrepareZoneForGC on each zone, or you can call PrepareForFullGC to select
  * all zones. Failing to select any zone is an error.
  */
 
 /**
  * Schedule the given zone to be collected as part of the next GC.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 PrepareZoneForGC(Zone* zone);
 
 /**
  * Schedule all zones to be collected in the next GC.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 PrepareForFullGC(JSContext* cx);
 
 /**
  * When performing an incremental GC, the zones that were selected for the
  * previous incremental slice must be selected in subsequent slices as well.
  * This function selects those slices automatically.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 PrepareForIncrementalGC(JSContext* cx);
 
 /**
  * Returns true if any zone in the system has been scheduled for GC with one of
  * the functions above or by the JS engine.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsGCScheduled(JSContext* cx);
 
 /**
  * Undoes the effect of the Prepare methods above. The given zone will not be
  * collected in the next GC.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SkipZoneForGC(Zone* zone);
 
 /*
  * Non-Incremental GC:
  *
  * The following functions perform a non-incremental GC.
  */
 
@@ -479,17 +479,17 @@ SkipZoneForGC(Zone* zone);
  * Performs a non-incremental collection of all selected zones.
  *
  * If the gckind argument is GC_NORMAL, then some objects that are unreachable
  * from the program may still be alive afterwards because of internal
  * references; if GC_SHRINK is passed then caches and other temporary references
  * to objects will be cleared and all unreferenced objects will be removed from
  * the system.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 NonIncrementalGC(JSContext* cx, JSGCInvocationKind gckind, gcreason::Reason reason);
 
 /*
  * Incremental GC:
  *
  * Incremental GC divides the full mark-and-sweep collection into multiple
  * slices, allowing client JavaScript code to run between each slice. This
  * allows interactive apps to avoid long collection pauses. Incremental GC does
@@ -511,47 +511,47 @@ NonIncrementalGC(JSContext* cx, JSGCInvo
  * Begin an incremental collection and perform one slice worth of work. When
  * this function returns, the collection may not be complete.
  * IncrementalGCSlice() must be called repeatedly until
  * !IsIncrementalGCInProgress(cx).
  *
  * Note: SpiderMonkey's GC is not realtime. Slices in practice may be longer or
  *       shorter than the requested interval.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 StartIncrementalGC(JSContext* cx, JSGCInvocationKind gckind, gcreason::Reason reason,
                    int64_t millis = 0);
 
 /**
  * Perform a slice of an ongoing incremental collection. When this function
  * returns, the collection may not be complete. It must be called repeatedly
  * until !IsIncrementalGCInProgress(cx).
  *
  * Note: SpiderMonkey's GC is not realtime. Slices in practice may be longer or
  *       shorter than the requested interval.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 IncrementalGCSlice(JSContext* cx, gcreason::Reason reason, int64_t millis = 0);
 
 /**
  * If IsIncrementalGCInProgress(cx), this call finishes the ongoing collection
  * by performing an arbitrarily long slice. If !IsIncrementalGCInProgress(cx),
  * this is equivalent to NonIncrementalGC. When this function returns,
  * IsIncrementalGCInProgress(cx) will always be false.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 FinishIncrementalGC(JSContext* cx, gcreason::Reason reason);
 
 /**
  * If IsIncrementalGCInProgress(cx), this call aborts the ongoing collection and
  * performs whatever work needs to be done to return the collector to its idle
  * state. This may take an arbitrarily long time. When this function returns,
  * IsIncrementalGCInProgress(cx) will always be false.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 AbortIncrementalGC(JSContext* cx);
 
 namespace dbg {
 
 // The `JS::dbg::GarbageCollectionEvent` class is essentially a view of the
 // `js::gcstats::Statistics` data without the uber implementation-specific bits.
 // It should generally be palatable for web developers.
 class GarbageCollectionEvent
@@ -607,17 +607,17 @@ enum GCProgress {
      */
 
     GC_CYCLE_BEGIN,
     GC_SLICE_BEGIN,
     GC_SLICE_END,
     GC_CYCLE_END
 };
 
-struct JS_PUBLIC_API(GCDescription) {
+struct JS_PUBLIC_API GCDescription {
     bool isZone_;
     bool isComplete_;
     JSGCInvocationKind invocationKind_;
     gcreason::Reason reason_;
 
     GCDescription(bool isZone, bool isComplete, JSGCInvocationKind kind, gcreason::Reason reason)
       : isZone_(isZone), isComplete_(isComplete), invocationKind_(kind), reason_(reason) {}
 
@@ -631,28 +631,28 @@ struct JS_PUBLIC_API(GCDescription) {
     mozilla::TimeStamp lastSliceEnd(JSContext* cx) const;
 
     JS::UniqueChars sliceToJSON(JSContext* cx) const;
     JS::UniqueChars summaryToJSON(JSContext* cx) const;
 
     JS::dbg::GarbageCollectionEvent::Ptr toGCEvent(JSContext* cx) const;
 };
 
-extern JS_PUBLIC_API(UniqueChars)
+extern JS_PUBLIC_API UniqueChars
 MinorGcToJSON(JSContext* cx);
 
 typedef void
 (* GCSliceCallback)(JSContext* cx, GCProgress progress, const GCDescription& desc);
 
 /**
  * The GC slice callback is called at the beginning and end of each slice. This
  * callback may be used for GC notifications as well as to perform additional
  * marking.
  */
-extern JS_PUBLIC_API(GCSliceCallback)
+extern JS_PUBLIC_API GCSliceCallback
 SetGCSliceCallback(JSContext* cx, GCSliceCallback callback);
 
 /**
  * Describes the progress of an observed nursery collection.
  */
 enum class GCNurseryProgress {
     /**
      * The nursery collection is starting.
@@ -670,115 +670,115 @@ enum class GCNurseryProgress {
  */
 using GCNurseryCollectionCallback = void(*)(JSContext* cx, GCNurseryProgress progress,
                                             gcreason::Reason reason);
 
 /**
  * Set the nursery collection callback for the given runtime. When set, it will
  * be called at the start and end of every nursery collection.
  */
-extern JS_PUBLIC_API(GCNurseryCollectionCallback)
+extern JS_PUBLIC_API GCNurseryCollectionCallback
 SetGCNurseryCollectionCallback(JSContext* cx, GCNurseryCollectionCallback callback);
 
 typedef void
 (* DoCycleCollectionCallback)(JSContext* cx);
 
 /**
  * The purge gray callback is called after any COMPARTMENT_REVIVED GC in which
  * the majority of compartments have been marked gray.
  */
-extern JS_PUBLIC_API(DoCycleCollectionCallback)
+extern JS_PUBLIC_API DoCycleCollectionCallback
 SetDoCycleCollectionCallback(JSContext* cx, DoCycleCollectionCallback callback);
 
 /**
  * Incremental GC defaults to enabled, but may be disabled for testing or in
  * embeddings that have not yet implemented barriers on their native classes.
  * There is not currently a way to re-enable incremental GC once it has been
  * disabled on the runtime.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 DisableIncrementalGC(JSContext* cx);
 
 /**
  * Returns true if incremental GC is enabled. Simply having incremental GC
  * enabled is not sufficient to ensure incremental collections are happening.
  * See the comment "Incremental GC" above for reasons why incremental GC may be
  * suppressed. Inspection of the "nonincremental reason" field of the
  * GCDescription returned by GCSliceCallback may help narrow down the cause if
  * collections are not happening incrementally when expected.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsIncrementalGCEnabled(JSContext* cx);
 
 /**
  * Returns true while an incremental GC is ongoing, both when actively
  * collecting and between slices.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsIncrementalGCInProgress(JSContext* cx);
 
 /**
  * Returns true while an incremental GC is ongoing, both when actively
  * collecting and between slices.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsIncrementalGCInProgress(JSRuntime* rt);
 
 /**
  * Returns true if the most recent GC ran incrementally.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 WasIncrementalGC(JSRuntime* rt);
 
 /*
  * Generational GC:
  *
  * Note: Generational GC is not yet enabled by default. The following class
  *       is non-functional unless SpiderMonkey was configured with
  *       --enable-gcgenerational.
  */
 
 /** Ensure that generational GC is disabled within some scope. */
-class JS_PUBLIC_API(AutoDisableGenerationalGC)
+class JS_PUBLIC_API AutoDisableGenerationalGC
 {
     JSContext* cx;
 
   public:
     explicit AutoDisableGenerationalGC(JSContext* cx);
     ~AutoDisableGenerationalGC();
 };
 
 /**
  * Returns true if generational allocation and collection is currently enabled
  * on the given runtime.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsGenerationalGCEnabled(JSRuntime* rt);
 
 /**
  * Pass a subclass of this "abstract" class to callees to require that they
  * never GC. Subclasses can use assertions or the hazard analysis to ensure no
  * GC happens.
  */
-class JS_PUBLIC_API(AutoRequireNoGC)
+class JS_PUBLIC_API AutoRequireNoGC
 {
   protected:
     AutoRequireNoGC() {}
     ~AutoRequireNoGC() {}
 };
 
 /**
  * Diagnostic assert (see MOZ_DIAGNOSTIC_ASSERT) that GC cannot occur while this
  * class is live. This class does not disable the static rooting hazard
  * analysis.
  *
  * This works by entering a GC unsafe region, which is checked on allocation and
  * on GC.
  */
-class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
+class JS_PUBLIC_API AutoAssertNoGC : public AutoRequireNoGC
 {
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
     JSContext* cx_;
 
   public:
     // This gets the context from TLS if it is not passed in.
     explicit AutoAssertNoGC(JSContext* cx = nullptr);
     ~AutoAssertNoGC();
@@ -800,38 +800,38 @@ class JS_PUBLIC_API(AutoAssertNoGC) : pu
  *       non-deterministic in practice. The fact that this guard has not
  *       asserted is not a guarantee that a GC cannot happen in the guarded
  *       region. As a rule, anyone performing a GC unsafe action should
  *       understand the GC properties of all code in that region and ensure
  *       that the hazard analysis is correct for that code, rather than relying
  *       on this class.
  */
 #ifdef DEBUG
-class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoAssertNoGC
+class JS_PUBLIC_API AutoSuppressGCAnalysis : public AutoAssertNoGC
 {
   public:
     explicit AutoSuppressGCAnalysis(JSContext* cx = nullptr) : AutoAssertNoGC(cx) {}
 } JS_HAZ_GC_SUPPRESSED;
 #else
-class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoRequireNoGC
+class JS_PUBLIC_API AutoSuppressGCAnalysis : public AutoRequireNoGC
 {
   public:
     explicit AutoSuppressGCAnalysis(JSContext* cx = nullptr) {}
 } JS_HAZ_GC_SUPPRESSED;
 #endif
 
 /**
  * Assert that code is only ever called from a GC callback, disable the static
  * rooting hazard analysis and assert if any allocation that could potentially
  * trigger a GC occurs while this guard object is live.
  *
  * This is useful to make the static analysis ignore code that runs in GC
  * callbacks.
  */
-class JS_PUBLIC_API(AutoAssertGCCallback) : public AutoSuppressGCAnalysis
+class JS_PUBLIC_API AutoAssertGCCallback : public AutoSuppressGCAnalysis
 {
   public:
 #ifdef DEBUG
     AutoAssertGCCallback();
 #else
     AutoAssertGCCallback() {}
 #endif
 };
@@ -844,68 +844,68 @@ class JS_PUBLIC_API(AutoAssertGCCallback
  * complain if it is live across a GC call.) It is useful when dealing with
  * internal pointers to GC things where the GC thing itself may not be present
  * for the static analysis: e.g. acquiring inline chars from a JSString* on the
  * heap.
  *
  * We only do the assertion checking in DEBUG builds.
  */
 #ifdef DEBUG
-class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertNoGC
+class JS_PUBLIC_API AutoCheckCannotGC : public AutoAssertNoGC
 {
   public:
     explicit AutoCheckCannotGC(JSContext* cx = nullptr) : AutoAssertNoGC(cx) {}
 } JS_HAZ_GC_INVALIDATED;
 #else
-class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoRequireNoGC
+class JS_PUBLIC_API AutoCheckCannotGC : public AutoRequireNoGC
 {
   public:
     explicit AutoCheckCannotGC(JSContext* cx = nullptr) {}
 } JS_HAZ_GC_INVALIDATED;
 #endif
 
 /*
  * Internal to Firefox.
  */
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 NotifyGCRootsRemoved(JSContext* cx);
 
 } /* namespace JS */
 
 /**
  * Register externally maintained GC roots.
  *
  * traceOp: the trace operation. For each root the implementation should call
  *          JS::TraceEdge whenever the root contains a traceable thing.
  * data:    the data argument to pass to each invocation of traceOp.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_AddExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data);
 
 /** Undo a call to JS_AddExtraGCRootsTracer. */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_RemoveExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_GC(JSContext* cx);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_MaybeGC(JSContext* cx);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetGCCallback(JSContext* cx, JSGCCallback cb, void* data);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetObjectsTenuredCallback(JSContext* cx, JSObjectsTenuredCallback cb,
                              void* data);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_AddFinalizeCallback(JSContext* cx, JSFinalizeCallback cb, void* data);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_RemoveFinalizeCallback(JSContext* cx, JSFinalizeCallback cb);
 
 /*
  * Weak pointers and garbage collection
  *
  * Weak pointers are by their nature not marked as part of garbage collection,
  * but they may need to be updated in two cases after a GC:
  *
@@ -932,100 +932,100 @@ JS_RemoveFinalizeCallback(JSContext* cx,
  * location.
  *
  * Callers of this method are responsible for updating any state that is
  * dependent on the object's address. For example, if the object's address is
  * used as a key in a hashtable, then the object must be removed and
  * re-inserted with the correct hash.
  */
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_AddWeakPointerZonesCallback(JSContext* cx, JSWeakPointerZonesCallback cb, void* data);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_RemoveWeakPointerZonesCallback(JSContext* cx, JSWeakPointerZonesCallback cb);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_AddWeakPointerCompartmentCallback(JSContext* cx, JSWeakPointerCompartmentCallback cb,
                                      void* data);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_RemoveWeakPointerCompartmentCallback(JSContext* cx, JSWeakPointerCompartmentCallback cb);
 
 namespace JS {
 template <typename T> class Heap;
 }
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_UpdateWeakPointerAfterGC(JS::Heap<JSObject*>* objp);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_UpdateWeakPointerAfterGCUnbarriered(JSObject** objp);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetGCParameter(JSContext* cx, JSGCParamKey key, uint32_t value);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_ResetGCParameter(JSContext* cx, JSGCParamKey key);
 
-extern JS_PUBLIC_API(uint32_t)
+extern JS_PUBLIC_API uint32_t
 JS_GetGCParameter(JSContext* cx, JSGCParamKey key);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetGCParametersBasedOnAvailableMemory(JSContext* cx, uint32_t availMem);
 
 /**
  * Create a new JSString whose chars member refers to external memory, i.e.,
  * memory requiring application-specific finalization.
  */
-extern JS_PUBLIC_API(JSString*)
+extern JS_PUBLIC_API JSString*
 JS_NewExternalString(JSContext* cx, const char16_t* chars, size_t length,
                      const JSStringFinalizer* fin);
 
 /**
  * Create a new JSString whose chars member may refer to external memory.
  * If a new external string is allocated, |*allocatedExternal| is set to true.
  * Otherwise the returned string is either not an external string or an
  * external string allocated by a previous call and |*allocatedExternal| is set
  * to false. If |*allocatedExternal| is false, |fin| won't be called.
  */
-extern JS_PUBLIC_API(JSString*)
+extern JS_PUBLIC_API JSString*
 JS_NewMaybeExternalString(JSContext* cx, const char16_t* chars, size_t length,
                           const JSStringFinalizer* fin, bool* allocatedExternal);
 
 /**
  * Return whether 'str' was created with JS_NewExternalString or
  * JS_NewExternalStringWithClosure.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_IsExternalString(JSString* str);
 
 /**
  * Return the 'fin' arg passed to JS_NewExternalString.
  */
-extern JS_PUBLIC_API(const JSStringFinalizer*)
+extern JS_PUBLIC_API const JSStringFinalizer*
 JS_GetExternalStringFinalizer(JSString* str);
 
 namespace JS {
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsIdleGCTaskNeeded(JSRuntime* rt);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 RunIdleTimeGCTask(JSRuntime* rt);
 
 } // namespace JS
 
 namespace js {
 namespace gc {
 
 /**
  * Create an object providing access to the garbage collector's internal notion
  * of the current state of memory (both GC heap memory and GCthing-controlled
  * malloc memory.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 NewMemoryInfoObject(JSContext* cx);
 
 } /* namespace gc */
 } /* namespace js */
 
 #endif /* js_GCAPI_h */
--- a/js/public/HeapAPI.h
+++ b/js/public/HeapAPI.h
@@ -14,17 +14,17 @@
 #include "js/TraceKind.h"
 #include "js/Utility.h"
 
 struct JSStringFinalizer;
 
 /* These values are private to the JS engine. */
 namespace js {
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 CurrentThreadCanAccessZone(JS::Zone* zone);
 
 namespace gc {
 
 struct Cell;
 
 const size_t ArenaShift = 12;
 const size_t ArenaSize = size_t(1) << ArenaShift;
@@ -92,17 +92,17 @@ enum class ChunkLocation : uint32_t
 {
     Invalid = 0,
     Nursery = 1,
     TenuredHeap = 2
 };
 
 #ifdef JS_DEBUG
 /* When downcasting, ensure we are actually the right type. */
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind);
 #else
 inline void
 AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind) {}
 #endif
 
 MOZ_ALWAYS_INLINE bool IsInsideNursery(const js::gc::Cell* cell);
 
@@ -252,17 +252,17 @@ struct Symbol {
 
 /**
  * A GC pointer, tagged with the trace kind.
  *
  * In general, a GC pointer should be stored with an exact type. This class
  * is for use when that is not possible because a single pointer must point
  * to several kinds of GC thing.
  */
-class JS_FRIEND_API(GCCellPtr)
+class JS_FRIEND_API GCCellPtr
 {
   public:
     // Construction from a void* and trace kind.
     GCCellPtr(void* gcthing, JS::TraceKind traceKind) : ptr(checkedCast(gcthing, traceKind)) {}
 
     // Automatically construct a null GCCellPtr from nullptr.
     MOZ_IMPLICIT GCCellPtr(decltype(nullptr)) : ptr(checkedCast(nullptr, JS::TraceKind::Null)) {}
 
@@ -447,24 +447,24 @@ CellIsMarkedGray(const Cell* cell)
 {
     MOZ_ASSERT(cell);
     if (js::gc::IsInsideNursery(cell)) {
         return false;
     }
     return TenuredCellIsMarkedGray(cell);
 }
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CellIsMarkedGrayIfKnown(const Cell* cell);
 
 #ifdef DEBUG
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CellIsNotGray(const Cell* cell);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ObjectIsMarkedBlack(const JSObject* obj);
 #endif
 
 MOZ_ALWAYS_INLINE ChunkLocation
 GetCellLocation(const void* cell)
 {
     uintptr_t addr = uintptr_t(cell);
     addr &= ~js::gc::ChunkMask;
@@ -527,78 +527,78 @@ namespace JS {
 
 static MOZ_ALWAYS_INLINE Zone*
 GetTenuredGCThingZone(GCCellPtr thing)
 {
     MOZ_ASSERT(!js::gc::IsInsideNursery(thing.asCell()));
     return js::gc::detail::GetGCThingZone(thing.unsafeAsUIntPtr());
 }
 
-extern JS_PUBLIC_API(Zone*)
+extern JS_PUBLIC_API Zone*
 GetNurseryStringZone(JSString* str);
 
 static MOZ_ALWAYS_INLINE Zone*
 GetStringZone(JSString* str)
 {
     if (!js::gc::IsInsideNursery(reinterpret_cast<js::gc::Cell*>(str))) {
         return js::gc::detail::GetGCThingZone(reinterpret_cast<uintptr_t>(str));
     }
     return GetNurseryStringZone(str);
 }
 
-extern JS_PUBLIC_API(Zone*)
+extern JS_PUBLIC_API Zone*
 GetObjectZone(JSObject* obj);
 
 static MOZ_ALWAYS_INLINE bool
 GCThingIsMarkedGray(GCCellPtr thing)
 {
     if (thing.mayBeOwnedByOtherRuntime()) {
         return false;
     }
     return js::gc::detail::CellIsMarkedGrayIfKnown(thing.asCell());
 }
 
-extern JS_PUBLIC_API(JS::TraceKind)
+extern JS_PUBLIC_API JS::TraceKind
 GCThingTraceKind(void* thing);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 EnableNurseryStrings(JSContext* cx);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 DisableNurseryStrings(JSContext* cx);
 
 /*
  * Returns true when writes to GC thing pointers (and reads from weak pointers)
  * must call an incremental barrier. This is generally only true when running
  * mutator code in-between GC slices. At other times, the barrier may be elided
  * for performance.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsIncrementalBarrierNeeded(JSContext* cx);
 
 /*
  * Notify the GC that a reference to a JSObject is about to be overwritten.
  * This method must be called if IsIncrementalBarrierNeeded.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 IncrementalPreWriteBarrier(JSObject* obj);
 
 /*
  * Notify the GC that a weak reference to a GC thing has been read.
  * This method must be called if IsIncrementalBarrierNeeded.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 IncrementalReadBarrier(GCCellPtr thing);
 
 /**
  * Unsets the gray bit for anything reachable from |thing|. |kind| should not be
  * JS::TraceKind::Shape. |thing| should be non-null. The return value indicates
  * if anything was unmarked.
  */
-extern JS_FRIEND_API(bool)
+extern JS_FRIEND_API bool
 UnmarkGrayGCThingRecursively(GCCellPtr thing);
 
 } // namespace JS
 
 namespace js {
 namespace gc {
 
 static MOZ_ALWAYS_INLINE bool
@@ -637,17 +637,17 @@ ExposeGCThingToActiveJS(JS::GCCellPtr th
     } else if (js::gc::detail::TenuredCellIsMarkedGray(thing.asCell())) {
         JS::UnmarkGrayGCThingRecursively(thing);
     }
 
     MOZ_ASSERT(!js::gc::detail::TenuredCellIsMarkedGray(thing.asCell()));
 }
 
 template <typename T>
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 EdgeNeedsSweepUnbarrieredSlow(T* thingp);
 
 static MOZ_ALWAYS_INLINE bool
 EdgeNeedsSweepUnbarriered(JSObject** objp)
 {
     // This function does not handle updating nursery pointers. Raw JSObject
     // pointers should be updated separately or replaced with
     // JS::Heap<JSObject*> which handles this automatically.
--- a/js/public/Id.h
+++ b/js/public/Id.h
@@ -76,17 +76,17 @@ JSID_TO_STRING(jsid id)
 
 /**
  * Only JSStrings that have been interned via the JSAPI can be turned into
  * jsids by API clients.
  *
  * N.B. if a jsid is backed by a string which has not been interned, that
  * string must be appropriately rooted to avoid being collected by the GC.
  */
-JS_PUBLIC_API(jsid)
+JS_PUBLIC_API jsid
 INTERNED_STRING_TO_JSID(JSContext* cx, JSString* str);
 
 static MOZ_ALWAYS_INLINE bool
 JSID_IS_INT(jsid id)
 {
     return !!(JSID_BITS(id) & JSID_TYPE_INT_BIT);
 }
 
@@ -172,18 +172,18 @@ JSID_IS_EMPTY(const jsid id)
     MOZ_ASSERT_IF((JSID_BITS(id) & JSID_TYPE_MASK) == JSID_TYPE_EMPTY,
                   JSID_BITS(id) == JSID_TYPE_EMPTY);
     return JSID_BITS(id) == JSID_TYPE_EMPTY;
 }
 
 constexpr const jsid JSID_VOID;
 constexpr const jsid JSID_EMPTY = jsid::fromRawBits(JSID_TYPE_EMPTY);
 
-extern JS_PUBLIC_DATA(const JS::HandleId) JSID_VOIDHANDLE;
-extern JS_PUBLIC_DATA(const JS::HandleId) JSID_EMPTYHANDLE;
+extern JS_PUBLIC_DATA const JS::HandleId JSID_VOIDHANDLE;
+extern JS_PUBLIC_DATA const JS::HandleId JSID_EMPTYHANDLE;
 
 namespace JS {
 
 template <>
 struct GCPolicy<jsid>
 {
     static void trace(JSTracer* trc, jsid* idp, const char* name) {
         js::UnsafeTraceManuallyBarrieredEdge(trc, idp, name);
--- a/js/public/Initialization.h
+++ b/js/public/Initialization.h
@@ -22,20 +22,20 @@ enum class InitState {
 
 /**
  * SpiderMonkey's initialization status is tracked here, and it controls things
  * that should happen only once across all runtimes.  It's an API requirement
  * that JS_Init (and JS_ShutDown, if called) be called in a thread-aware
  * manner, so this (internal -- embedders, don't use!) variable doesn't need to
  * be atomic.
  */
-extern JS_PUBLIC_DATA(InitState)
+extern JS_PUBLIC_DATA InitState
 libraryInitState;
 
-extern JS_PUBLIC_API(const char*)
+extern JS_PUBLIC_API const char*
 InitWithFailureDiagnostic(bool isDebugBuild);
 
 } // namespace detail
 } // namespace JS
 
 // These are equivalent to ICU's |UMemAllocFn|, |UMemReallocFn|, and
 // |UMemFreeFn| types.  The first argument (called |context| in the ICU docs)
 // will always be nullptr and should be ignored.
@@ -43,34 +43,34 @@ typedef void* (*JS_ICUAllocFn)(const voi
 typedef void* (*JS_ICUReallocFn)(const void*, void* p, size_t size);
 typedef void (*JS_ICUFreeFn)(const void*, void* p);
 
 /**
  * This function can be used to track memory used by ICU.  If it is called, it
  * *must* be called before JS_Init.  Don't use it unless you know what you're
  * doing!
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn,
                          JS_ICUReallocFn reallocFn,
                          JS_ICUFreeFn freeFn);
 
 #ifdef ENABLE_BIGINT
 namespace JS {
 
 // These types are documented as allocate_function, reallocate_function,
 // and free_function in the Info node `(gmp)Custom Allocation`.
 using GMPAllocFn = void* (*)(size_t allocSize);
 using GMPReallocFn = void* (*)(void* p, size_t oldSize, size_t newSize);
 using GMPFreeFn = void (*)(void* p, size_t size);
 
 // This function can be used to track memory used by GMP. If it is
 // called, it *must* be called before JS_Init so that same functions are
 // used for all allocations.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SetGMPMemoryFunctions(GMPAllocFn allocFn,
                       GMPReallocFn reallocFn,
                       GMPFreeFn freeFn);
 
 }; // namespace JS
 #endif
 
 /**
@@ -139,12 +139,12 @@ JS_IsInitialized(void)
  * Failure to call this method, at present, has no adverse effects other than
  * leaking memory.  This may not always be the case; it's recommended that all
  * embedders call this method when all other JSAPI operations have completed.
  *
  * It is currently not possible to initialize SpiderMonkey multiple times (that
  * is, calling JS_Init/JSAPI methods/JS_ShutDown in that order, then doing so
  * again).  This restriction may eventually be lifted.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_ShutDown(void);
 
 #endif /* js_Initialization_h */
--- a/js/public/JSON.h
+++ b/js/public/JSON.h
@@ -24,17 +24,17 @@ namespace JS { union Value; }
 
 using JSONWriteCallback = bool (*)(const char16_t* buf, uint32_t len, void* data);
 
 /**
  * Performs the JSON.stringify operation, as specified by ECMAScript, except
  * writing stringified data by repeated calls of |callback|, with each such
  * call passed |data| as argument.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_Stringify(JSContext* cx, JS::MutableHandle<JS::Value> value, JS::Handle<JSObject*> replacer,
              JS::Handle<JS::Value> space, JSONWriteCallback callback, void* data);
 
 namespace JS {
 
 /**
  * An API akin to JS_Stringify but with the goal of not having observable
  * side-effects when the stringification is performed.  This means it does not
@@ -47,45 +47,45 @@ namespace JS {
  *    string object!), a boolean, a finite number (i.e. no NaN or Infinity or
  *    -Infinity), a plain object with no accessor properties, or an Array with
  *    no holes.
  *
  * The actual behavior differs from JS_Stringify only in asserting the above and
  * NOT attempting to get the "toJSON" property from things, since that could
  * clearly have side-effects.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ToJSONMaybeSafely(JSContext* cx, JS::Handle<JSObject*> input,
                   JSONWriteCallback callback, void* data);
 
 } /* namespace JS */
 
 /**
  * Performs the JSON.parse operation as specified by ECMAScript.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ParseJSON(JSContext* cx, const char16_t* chars, uint32_t len, JS::MutableHandle<JS::Value> vp);
 
 /**
  * Performs the JSON.parse operation as specified by ECMAScript.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ParseJSON(JSContext* cx, JS::Handle<JSString*> str, JS::MutableHandle<JS::Value> vp);
 
 /**
  * Performs the JSON.parse operation as specified by ECMAScript, using the
  * given |reviver| argument as the corresponding optional argument to that
  * function.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ParseJSONWithReviver(JSContext* cx, const char16_t* chars, uint32_t len,
                         JS::Handle<JS::Value> reviver, JS::MutableHandle<JS::Value> vp);
 
 /**
  * Performs the JSON.parse operation as specified by ECMAScript, using the
  * given |reviver| argument as the corresponding optional argument to that
  * function.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_ParseJSONWithReviver(JSContext* cx, JS::Handle<JSString*> str, JS::Handle<JS::Value> reviver,
                         JS::MutableHandle<JS::Value> vp);
 
 #endif /* js_JSON_h */
--- a/js/public/LocaleSensitive.h
+++ b/js/public/LocaleSensitive.h
@@ -27,32 +27,32 @@ namespace JS { union Value; }
  * (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat, and others that will
  * arise as time passes).  (Note that the Internationalization API encourages
  * clients to specify their own locales; this default locale is only used when
  * no locale is specified, e.g. calling a toLocaleString function without
  * passing a locale argument to it.)
  *
  * The locale string remains owned by the caller.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 JS_SetDefaultLocale(JSRuntime* rt, const char* locale);
 
 /**
  * Return a copy of the default locale for the ECMAScript Internationalization
  * API (and for various ECMAScript functions that will invoke it).  The locale
  * is retrieved from the |JSRuntime| that corresponds to |cx|.
  *
  * XXX Bug 1483961 means it's difficult to interpret the meaning of a null
  *     return value for the time being, and we should fix this!
  */
-extern JS_PUBLIC_API(JS::UniqueChars)
+extern JS_PUBLIC_API JS::UniqueChars
 JS_GetDefaultLocale(JSContext* cx);
 
 /** Reset the default locale to OS defaults. */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_ResetDefaultLocale(JSRuntime* rt);
 
 using JSLocaleToUpperCase =
     bool (*)(JSContext* cx, JS::Handle<JSString*> src, JS::MutableHandle<JS::Value> rval);
 
 using JSLocaleToLowerCase =
     bool (*)(JSContext* cx, JS::Handle<JSString*> src, JS::MutableHandle<JS::Value> rval);
 
@@ -82,18 +82,18 @@ struct JSLocaleCallbacks
     JSLocaleToUnicode localeToUnicode;
 };
 
 /**
  * Set locale callbacks to be used in builds not compiled --with-intl-api.
  * |callbacks| must persist as long as the |JSRuntime|.  Pass |nullptr| to
  * restore default behavior.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetLocaleCallbacks(JSRuntime* rt, const JSLocaleCallbacks* callbacks);
 
 /**
  * Return the current locale callbacks, which may be nullptr.
  */
-extern JS_PUBLIC_API(const JSLocaleCallbacks*)
+extern JS_PUBLIC_API const JSLocaleCallbacks*
 JS_GetLocaleCallbacks(JSRuntime* rt);
 
 #endif /* js_LocaleSensitive_h */
--- a/js/public/MemoryFunctions.h
+++ b/js/public/MemoryFunctions.h
@@ -11,32 +11,32 @@
 #include "mozilla/Attributes.h" // MOZ_MUST_USE
 
 #include <stddef.h> // size_t
 
 #include "jstypes.h" // JS_PUBLIC_API
 
 struct JSContext;
 
-extern JS_PUBLIC_API(void*)
+extern JS_PUBLIC_API void*
 JS_malloc(JSContext* cx, size_t nbytes);
 
-extern JS_PUBLIC_API(void*)
+extern JS_PUBLIC_API void*
 JS_realloc(JSContext* cx, void* p, size_t oldBytes, size_t newBytes);
 
 /**
  * A wrapper for |js_free(p)| that may delay |js_free(p)| invocation as a
  * performance optimization.  |cx| may be nullptr.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_free(JSContext* cx, void* p);
 
 /**
  * A wrapper for |js_free(p)| that may delay |js_free(p)| invocation as a
  * performance optimization as specified by the given JSFreeOp instance.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_freeop(JSFreeOp* fop, void* p);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_updateMallocCounter(JSContext* cx, size_t nbytes);
 
 #endif /* js_MemoryFunctions_h */
--- a/js/public/MemoryMetrics.h
+++ b/js/public/MemoryMetrics.h
@@ -104,17 +104,17 @@ namespace js {
  * In memory reporting, we have concept of "sundries", line items which are too
  * small to be worth reporting individually.  Under some circumstances, a memory
  * reporter gets tossed into the sundries bucket if it's smaller than
  * MemoryReportingSundriesThreshold() bytes.
  *
  * We need to define this value here, rather than in the code which actually
  * generates the memory reports, because NotableStringInfo uses this value.
  */
-JS_FRIEND_API(size_t) MemoryReportingSundriesThreshold();
+JS_FRIEND_API size_t MemoryReportingSundriesThreshold();
 
 /**
  * This hash policy avoids flattening ropes (which perturbs the site being
  * measured and requires a JSContext) at the expense of doing a FULL ROPE COPY
  * on every hash and match! Beware.
  */
 struct InefficientNonFlatteningStringHashPolicy
 {
@@ -156,26 +156,26 @@ struct InefficientNonFlatteningStringHas
 #define ADD_TO_SERVO_SIZES(tabKind, servoKind, mSize)             sizes->add(JS::ServoSizes::servoKind, mSize);
 
 } // namespace js
 
 namespace JS {
 
 struct ClassInfo
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(Objects, GCHeapUsed, objectsGCHeap) \
-    macro(Objects, MallocHeap, objectsMallocHeapSlots) \
-    macro(Objects, MallocHeap, objectsMallocHeapElementsNormal) \
-    macro(Objects, MallocHeap, objectsMallocHeapElementsAsmJS) \
-    macro(Objects, MallocHeap, objectsMallocHeapMisc) \
-    macro(Objects, NonHeap,    objectsNonHeapElementsNormal) \
-    macro(Objects, NonHeap,    objectsNonHeapElementsShared) \
-    macro(Objects, NonHeap,    objectsNonHeapElementsWasm) \
-    macro(Objects, NonHeap,    objectsNonHeapCodeWasm)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Objects, GCHeapUsed, objectsGCHeap) \
+    MACRO(Objects, MallocHeap, objectsMallocHeapSlots) \
+    MACRO(Objects, MallocHeap, objectsMallocHeapElementsNormal) \
+    MACRO(Objects, MallocHeap, objectsMallocHeapElementsAsmJS) \
+    MACRO(Objects, MallocHeap, objectsMallocHeapMisc) \
+    MACRO(Objects, NonHeap,    objectsNonHeapElementsNormal) \
+    MACRO(Objects, NonHeap,    objectsNonHeapElementsShared) \
+    MACRO(Objects, NonHeap,    objectsNonHeapElementsWasm) \
+    MACRO(Objects, NonHeap,    objectsNonHeapCodeWasm)
 
     ClassInfo()
       : FOR_EACH_SIZE(ZERO_SIZE)
         wasmGuardPages(0)
     {}
 
     void add(const ClassInfo& other) {
         FOR_EACH_SIZE(ADD_OTHER_SIZE)
@@ -213,23 +213,23 @@ struct ClassInfo
     FOR_EACH_SIZE(DECL_SIZE)
     size_t wasmGuardPages;
 
 #undef FOR_EACH_SIZE
 };
 
 struct ShapeInfo
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(Other,   GCHeapUsed, shapesGCHeapTree) \
-    macro(Other,   GCHeapUsed, shapesGCHeapDict) \
-    macro(Other,   GCHeapUsed, shapesGCHeapBase) \
-    macro(Other,   MallocHeap, shapesMallocHeapTreeTables) \
-    macro(Other,   MallocHeap, shapesMallocHeapDictTables) \
-    macro(Other,   MallocHeap, shapesMallocHeapTreeKids)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Other,   GCHeapUsed, shapesGCHeapTree) \
+    MACRO(Other,   GCHeapUsed, shapesGCHeapDict) \
+    MACRO(Other,   GCHeapUsed, shapesGCHeapBase) \
+    MACRO(Other,   MallocHeap, shapesMallocHeapTreeTables) \
+    MACRO(Other,   MallocHeap, shapesMallocHeapDictTables) \
+    MACRO(Other,   MallocHeap, shapesMallocHeapTreeKids)
 
     ShapeInfo()
       : FOR_EACH_SIZE(ZERO_SIZE)
         dummy()
     {}
 
     void add(const ShapeInfo& other) {
         FOR_EACH_SIZE(ADD_OTHER_SIZE)
@@ -288,22 +288,22 @@ struct NotableClassInfo : public ClassIn
 
   private:
     NotableClassInfo(const NotableClassInfo& info) = delete;
 };
 
 /** Data for tracking JIT-code memory usage. */
 struct CodeSizes
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(_, NonHeap, ion) \
-    macro(_, NonHeap, baseline) \
-    macro(_, NonHeap, regexp) \
-    macro(_, NonHeap, other) \
-    macro(_, NonHeap, unused)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, NonHeap, ion) \
+    MACRO(_, NonHeap, baseline) \
+    MACRO(_, NonHeap, regexp) \
+    MACRO(_, NonHeap, other) \
+    MACRO(_, NonHeap, unused)
 
     CodeSizes()
       : FOR_EACH_SIZE(ZERO_SIZE)
         dummy()
     {}
 
     void addToServoSizes(ServoSizes *sizes) const {
         FOR_EACH_SIZE(ADD_TO_SERVO_SIZES)
@@ -315,25 +315,25 @@ struct CodeSizes
 #undef FOR_EACH_SIZE
 };
 
 /** Data for tracking GC memory usage. */
 struct GCSizes
 {
     // |nurseryDecommitted| is marked as NonHeap rather than GCHeapDecommitted
     // because we don't consider the nursery to be part of the GC heap.
-#define FOR_EACH_SIZE(macro) \
-    macro(_, MallocHeap, marker) \
-    macro(_, NonHeap,    nurseryCommitted) \
-    macro(_, MallocHeap, nurseryMallocedBuffers) \
-    macro(_, MallocHeap, storeBufferVals) \
-    macro(_, MallocHeap, storeBufferCells) \
-    macro(_, MallocHeap, storeBufferSlots) \
-    macro(_, MallocHeap, storeBufferWholeCells) \
-    macro(_, MallocHeap, storeBufferGenerics)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, MallocHeap, marker) \
+    MACRO(_, NonHeap,    nurseryCommitted) \
+    MACRO(_, MallocHeap, nurseryMallocedBuffers) \
+    MACRO(_, MallocHeap, storeBufferVals) \
+    MACRO(_, MallocHeap, storeBufferCells) \
+    MACRO(_, MallocHeap, storeBufferSlots) \
+    MACRO(_, MallocHeap, storeBufferWholeCells) \
+    MACRO(_, MallocHeap, storeBufferGenerics)
 
     GCSizes()
       : FOR_EACH_SIZE(ZERO_SIZE)
         dummy()
     {}
 
     void addToServoSizes(ServoSizes *sizes) const {
         FOR_EACH_SIZE(ADD_TO_SERVO_SIZES)
@@ -349,21 +349,21 @@ struct GCSizes
  * This class holds information about the memory taken up by identical copies of
  * a particular string.  Multiple JSStrings may have their sizes aggregated
  * together into one StringInfo object.  Note that two strings with identical
  * chars will not be aggregated together if one is a short string and the other
  * is not.
  */
 struct StringInfo
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(Strings, GCHeapUsed, gcHeapLatin1) \
-    macro(Strings, GCHeapUsed, gcHeapTwoByte) \
-    macro(Strings, MallocHeap, mallocHeapLatin1) \
-    macro(Strings, MallocHeap, mallocHeapTwoByte)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Strings, GCHeapUsed, gcHeapLatin1) \
+    MACRO(Strings, GCHeapUsed, gcHeapTwoByte) \
+    MACRO(Strings, MallocHeap, mallocHeapLatin1) \
+    MACRO(Strings, MallocHeap, mallocHeapTwoByte)
 
     StringInfo()
       : FOR_EACH_SIZE(ZERO_SIZE)
         numCopies(0)
     {}
 
     void add(const StringInfo& other) {
         FOR_EACH_SIZE(ADD_OTHER_SIZE);
@@ -430,18 +430,18 @@ struct NotableStringInfo : public String
 };
 
 /**
  * This class holds information about the memory taken up by script sources
  * from a particular file.
  */
 struct ScriptSourceInfo
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(_, MallocHeap, misc)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, MallocHeap, misc)
 
     ScriptSourceInfo()
       : FOR_EACH_SIZE(ZERO_SIZE)
         numScripts(0)
     {}
 
     void add(const ScriptSourceInfo& other) {
         FOR_EACH_SIZE(ADD_OTHER_SIZE)
@@ -493,21 +493,21 @@ struct NotableScriptSourceInfo : public 
     char* filename_;
 
   private:
     NotableScriptSourceInfo(const NotableScriptSourceInfo& info) = delete;
 };
 
 struct HelperThreadStats
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(_, MallocHeap, stateData) \
-    macro(_, MallocHeap, parseTask) \
-    macro(_, MallocHeap, ionBuilder) \
-    macro(_, MallocHeap, wasmCompile)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, MallocHeap, stateData) \
+    MACRO(_, MallocHeap, parseTask) \
+    MACRO(_, MallocHeap, ionBuilder) \
+    MACRO(_, MallocHeap, wasmCompile)
 
     explicit HelperThreadStats()
       : FOR_EACH_SIZE(ZERO_SIZE)
         idleThreadCount(0),
         activeThreadCount(0)
     { }
 
     FOR_EACH_SIZE(DECL_SIZE)
@@ -518,18 +518,18 @@ struct HelperThreadStats
 #undef FOR_EACH_SIZE
 };
 
 /**
  * Measurements that not associated with any individual runtime.
  */
 struct GlobalStats
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(_, MallocHeap, tracelogger)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, MallocHeap, tracelogger)
 
     explicit GlobalStats(mozilla::MallocSizeOf mallocSizeOf)
       : FOR_EACH_SIZE(ZERO_SIZE)
         mallocSizeOf_(mallocSizeOf)
     { }
 
     FOR_EACH_SIZE(DECL_SIZE)
 
@@ -541,30 +541,30 @@ struct GlobalStats
 };
 
 /**
  * These measurements relate directly to the JSRuntime, and not to zones,
  * compartments, and realms within it.
  */
 struct RuntimeSizes
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(_, MallocHeap, object) \
-    macro(_, MallocHeap, atomsTable) \
-    macro(_, MallocHeap, atomsMarkBitmaps) \
-    macro(_, MallocHeap, contexts) \
-    macro(_, MallocHeap, temporary) \
-    macro(_, MallocHeap, interpreterStack) \
-    macro(_, MallocHeap, sharedImmutableStringsCache) \
-    macro(_, MallocHeap, sharedIntlData) \
-    macro(_, MallocHeap, uncompressedSourceCache) \
-    macro(_, MallocHeap, scriptData) \
-    macro(_, MallocHeap, tracelogger) \
-    macro(_, MallocHeap, wasmRuntime) \
-    macro(_, MallocHeap, jitLazyLink)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, MallocHeap, object) \
+    MACRO(_, MallocHeap, atomsTable) \
+    MACRO(_, MallocHeap, atomsMarkBitmaps) \
+    MACRO(_, MallocHeap, contexts) \
+    MACRO(_, MallocHeap, temporary) \
+    MACRO(_, MallocHeap, interpreterStack) \
+    MACRO(_, MallocHeap, sharedImmutableStringsCache) \
+    MACRO(_, MallocHeap, sharedIntlData) \
+    MACRO(_, MallocHeap, uncompressedSourceCache) \
+    MACRO(_, MallocHeap, scriptData) \
+    MACRO(_, MallocHeap, tracelogger) \
+    MACRO(_, MallocHeap, wasmRuntime) \
+    MACRO(_, MallocHeap, jitLazyLink)
 
     RuntimeSizes()
       : FOR_EACH_SIZE(ZERO_SIZE)
         scriptSourceInfo(),
         code(),
         gc(),
         notableScriptSources()
     {
@@ -608,29 +608,29 @@ struct RuntimeSizes
     ScriptSourcesHashMap* allScriptSources;
     js::Vector<NotableScriptSourceInfo, 0, js::SystemAllocPolicy> notableScriptSources;
 
 #undef FOR_EACH_SIZE
 };
 
 struct UnusedGCThingSizes
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(Other, GCHeapUnused, object) \
-    macro(Other, GCHeapUnused, script) \
-    macro(Other, GCHeapUnused, lazyScript) \
-    macro(Other, GCHeapUnused, shape) \
-    macro(Other, GCHeapUnused, baseShape) \
-    macro(Other, GCHeapUnused, objectGroup) \
-    macro(Other, GCHeapUnused, string) \
-    macro(Other, GCHeapUnused, symbol) \
-    IF_BIGINT(macro(Other, GCHeapUnused, bigInt),) \
-    macro(Other, GCHeapUnused, jitcode) \
-    macro(Other, GCHeapUnused, scope) \
-    macro(Other, GCHeapUnused, regExpShared)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Other, GCHeapUnused, object) \
+    MACRO(Other, GCHeapUnused, script) \
+    MACRO(Other, GCHeapUnused, lazyScript) \
+    MACRO(Other, GCHeapUnused, shape) \
+    MACRO(Other, GCHeapUnused, baseShape) \
+    MACRO(Other, GCHeapUnused, objectGroup) \
+    MACRO(Other, GCHeapUnused, string) \
+    MACRO(Other, GCHeapUnused, symbol) \
+    IF_BIGINT(MACRO(Other, GCHeapUnused, bigInt),) \
+    MACRO(Other, GCHeapUnused, jitcode) \
+    MACRO(Other, GCHeapUnused, scope) \
+    MACRO(Other, GCHeapUnused, regExpShared)
 
     UnusedGCThingSizes()
       : FOR_EACH_SIZE(ZERO_SIZE)
         dummy()
     {}
 
     UnusedGCThingSizes(UnusedGCThingSizes&& other)
       : FOR_EACH_SIZE(COPY_OTHER_SIZE)
@@ -679,40 +679,40 @@ struct UnusedGCThingSizes
     FOR_EACH_SIZE(DECL_SIZE)
     int dummy;  // present just to absorb the trailing comma from FOR_EACH_SIZE(ZERO_SIZE)
 
 #undef FOR_EACH_SIZE
 };
 
 struct ZoneStats
 {
-#define FOR_EACH_SIZE(macro) \
-    macro(Other,   GCHeapUsed,  symbolsGCHeap) \
-    IF_BIGINT(macro(Other,   GCHeapUsed,  bigIntsGCHeap),) \
-    IF_BIGINT(macro(Other,   MallocHeap,  bigIntsMallocHeap),) \
-    macro(Other,   GCHeapAdmin, gcHeapArenaAdmin) \
-    macro(Other,   GCHeapUsed,  lazyScriptsGCHeap) \
-    macro(Other,   MallocHeap,  lazyScriptsMallocHeap) \
-    macro(Other,   GCHeapUsed,  jitCodesGCHeap) \
-    macro(Other,   GCHeapUsed,  objectGroupsGCHeap) \
-    macro(Other,   MallocHeap,  objectGroupsMallocHeap) \
-    macro(Other,   GCHeapUsed,  scopesGCHeap) \
-    macro(Other,   MallocHeap,  scopesMallocHeap) \
-    macro(Other,   GCHeapUsed,  regExpSharedsGCHeap) \
-    macro(Other,   MallocHeap,  regExpSharedsMallocHeap) \
-    macro(Other,   MallocHeap,  typePool) \
-    macro(Other,   MallocHeap,  regexpZone) \
-    macro(Other,   MallocHeap,  jitZone) \
-    macro(Other,   MallocHeap,  baselineStubsOptimized) \
-    macro(Other,   MallocHeap,  cachedCFG) \
-    macro(Other,   MallocHeap,  uniqueIdMap) \
-    macro(Other,   MallocHeap,  shapeTables) \
-    macro(Other,   MallocHeap,  compartmentObjects) \
-    macro(Other,   MallocHeap,  crossCompartmentWrappersTables) \
-    macro(Other,   MallocHeap,  compartmentsPrivateData)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Other,   GCHeapUsed,  symbolsGCHeap) \
+    IF_BIGINT(MACRO(Other,   GCHeapUsed,  bigIntsGCHeap),) \
+    IF_BIGINT(MACRO(Other,   MallocHeap,  bigIntsMallocHeap),) \
+    MACRO(Other,   GCHeapAdmin, gcHeapArenaAdmin) \
+    MACRO(Other,   GCHeapUsed,  lazyScriptsGCHeap) \
+    MACRO(Other,   MallocHeap,  lazyScriptsMallocHeap) \
+    MACRO(Other,   GCHeapUsed,  jitCodesGCHeap) \
+    MACRO(Other,   GCHeapUsed,  objectGroupsGCHeap) \
+    MACRO(Other,   MallocHeap,  objectGroupsMallocHeap) \
+    MACRO(Other,   GCHeapUsed,  scopesGCHeap) \
+    MACRO(Other,   MallocHeap,  scopesMallocHeap) \
+    MACRO(Other,   GCHeapUsed,  regExpSharedsGCHeap) \
+    MACRO(Other,   MallocHeap,  regExpSharedsMallocHeap) \
+    MACRO(Other,   MallocHeap,  typePool) \
+    MACRO(Other,   MallocHeap,  regexpZone) \
+    MACRO(Other,   MallocHeap,  jitZone) \
+    MACRO(Other,   MallocHeap,  baselineStubsOptimized) \
+    MACRO(Other,   MallocHeap,  cachedCFG) \
+    MACRO(Other,   MallocHeap,  uniqueIdMap) \
+    MACRO(Other,   MallocHeap,  shapeTables) \
+    MACRO(Other,   MallocHeap,  compartmentObjects) \
+    MACRO(Other,   MallocHeap,  crossCompartmentWrappersTables) \
+    MACRO(Other,   MallocHeap,  compartmentsPrivateData)
 
     ZoneStats()
       : FOR_EACH_SIZE(ZERO_SIZE)
         unusedGCThings(),
         stringInfo(),
         shapeInfo(),
         extra(),
         allStrings(nullptr),
@@ -802,37 +802,37 @@ struct ZoneStats
 };
 
 struct RealmStats
 {
     // We assume that |objectsPrivate| is on the malloc heap, but it's not
     // actually guaranteed. But for Servo, at least, it's a moot point because
     // it doesn't provide an ObjectPrivateVisitor so the value will always be
     // zero.
-#define FOR_EACH_SIZE(macro) \
-    macro(Private, MallocHeap, objectsPrivate) \
-    macro(Other,   GCHeapUsed, scriptsGCHeap) \
-    macro(Other,   MallocHeap, scriptsMallocHeapData) \
-    macro(Other,   MallocHeap, baselineData) \
-    macro(Other,   MallocHeap, baselineStubsFallback) \
-    macro(Other,   MallocHeap, ionData) \
-    macro(Other,   MallocHeap, typeInferenceTypeScripts) \
-    macro(Other,   MallocHeap, typeInferenceAllocationSiteTables) \
-    macro(Other,   MallocHeap, typeInferenceArrayTypeTables) \
-    macro(Other,   MallocHeap, typeInferenceObjectTypeTables) \
-    macro(Other,   MallocHeap, realmObject) \
-    macro(Other,   MallocHeap, realmTables) \
-    macro(Other,   MallocHeap, innerViewsTable) \
-    macro(Other,   MallocHeap, lazyArrayBuffersTable) \
-    macro(Other,   MallocHeap, objectMetadataTable) \
-    macro(Other,   MallocHeap, savedStacksSet) \
-    macro(Other,   MallocHeap, varNamesSet) \
-    macro(Other,   MallocHeap, nonSyntacticLexicalScopesTable) \
-    macro(Other,   MallocHeap, jitRealm) \
-    macro(Other,   MallocHeap, scriptCountsMap)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(Private, MallocHeap, objectsPrivate) \
+    MACRO(Other,   GCHeapUsed, scriptsGCHeap) \
+    MACRO(Other,   MallocHeap, scriptsMallocHeapData) \
+    MACRO(Other,   MallocHeap, baselineData) \
+    MACRO(Other,   MallocHeap, baselineStubsFallback) \
+    MACRO(Other,   MallocHeap, ionData) \
+    MACRO(Other,   MallocHeap, typeInferenceTypeScripts) \
+    MACRO(Other,   MallocHeap, typeInferenceAllocationSiteTables) \
+    MACRO(Other,   MallocHeap, typeInferenceArrayTypeTables) \
+    MACRO(Other,   MallocHeap, typeInferenceObjectTypeTables) \
+    MACRO(Other,   MallocHeap, realmObject) \
+    MACRO(Other,   MallocHeap, realmTables) \
+    MACRO(Other,   MallocHeap, innerViewsTable) \
+    MACRO(Other,   MallocHeap, lazyArrayBuffersTable) \
+    MACRO(Other,   MallocHeap, objectMetadataTable) \
+    MACRO(Other,   MallocHeap, savedStacksSet) \
+    MACRO(Other,   MallocHeap, varNamesSet) \
+    MACRO(Other,   MallocHeap, nonSyntacticLexicalScopesTable) \
+    MACRO(Other,   MallocHeap, jitRealm) \
+    MACRO(Other,   MallocHeap, scriptCountsMap)
 
     RealmStats()
       : FOR_EACH_SIZE(ZERO_SIZE)
         classInfo(),
         extra(),
         allClasses(nullptr),
         notableClasses(),
         isTotals(true)
@@ -911,23 +911,23 @@ typedef js::Vector<ZoneStats, 0, js::Sys
 
 struct RuntimeStats
 {
     // |gcHeapChunkTotal| is ignored because it's the sum of all the other
     // values. |gcHeapGCThings| is ignored because it's the sum of some of the
     // values from the zones and compartments. Both of those values are not
     // reported directly, but are just present for sanity-checking other
     // values.
-#define FOR_EACH_SIZE(macro) \
-    macro(_, Ignore,            gcHeapChunkTotal) \
-    macro(_, GCHeapDecommitted, gcHeapDecommittedArenas) \
-    macro(_, GCHeapUnused,      gcHeapUnusedChunks) \
-    macro(_, GCHeapUnused,      gcHeapUnusedArenas) \
-    macro(_, GCHeapAdmin,       gcHeapChunkAdmin) \
-    macro(_, Ignore,            gcHeapGCThings)
+#define FOR_EACH_SIZE(MACRO) \
+    MACRO(_, Ignore,            gcHeapChunkTotal) \
+    MACRO(_, GCHeapDecommitted, gcHeapDecommittedArenas) \
+    MACRO(_, GCHeapUnused,      gcHeapUnusedChunks) \
+    MACRO(_, GCHeapUnused,      gcHeapUnusedArenas) \
+    MACRO(_, GCHeapAdmin,       gcHeapChunkAdmin) \
+    MACRO(_, Ignore,            gcHeapGCThings)
 
     explicit RuntimeStats(mozilla::MallocSizeOf mallocSizeOf)
       : FOR_EACH_SIZE(ZERO_SIZE)
         runtime(),
         realmTotals(),
         zTotals(),
         realmStatsVector(),
         zoneStatsVector(),
@@ -992,36 +992,36 @@ class ObjectPrivateVisitor
     typedef bool(*GetISupportsFun)(JSObject* obj, nsISupports** iface);
     GetISupportsFun getISupports_;
 
     explicit ObjectPrivateVisitor(GetISupportsFun getISupports)
       : getISupports_(getISupports)
     {}
 };
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CollectGlobalStats(GlobalStats* gStats);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CollectRuntimeStats(JSContext* cx, RuntimeStats* rtStats, ObjectPrivateVisitor* opv, bool anonymize);
 
-extern JS_PUBLIC_API(size_t)
+extern JS_PUBLIC_API size_t
 SystemRealmCount(JSContext* cx);
 
-extern JS_PUBLIC_API(size_t)
+extern JS_PUBLIC_API size_t
 UserRealmCount(JSContext* cx);
 
-extern JS_PUBLIC_API(size_t)
+extern JS_PUBLIC_API size_t
 PeakSizeOfTemporary(const JSContext* cx);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 AddSizeOfTab(JSContext* cx, JS::HandleObject obj, mozilla::MallocSizeOf mallocSizeOf,
              ObjectPrivateVisitor* opv, TabSizes* sizes);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 AddServoSizeOf(JSContext* cx, mozilla::MallocSizeOf mallocSizeOf,
                ObjectPrivateVisitor* opv, ServoSizes* sizes);
 
 } // namespace JS
 
 #undef DECL_SIZE
 #undef ZERO_SIZE
 #undef COPY_OTHER_SIZE
--- a/js/public/OffThreadScriptCompilation.h
+++ b/js/public/OffThreadScriptCompilation.h
@@ -32,20 +32,20 @@ template<typename UnitT> class SourceTex
 } // namespace JS
 
 namespace JS {
 
 class OffThreadToken;
 
 using OffThreadCompileCallback = void (*)(OffThreadToken* token, void* callbackData);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CanCompileOffThread(JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CanDecodeOffThread(JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
 
 /*
  * Off thread compilation control flow.
  *
  * After successfully triggering an off thread compile of a script, the
  * callback will eventually be invoked with the specified data and a token
  * for the compilation. The callback will be invoked while off thread,
@@ -55,68 +55,68 @@ CanDecodeOffThread(JSContext* cx, const 
  * - FinishOffThreadScript, to get the result script (or nullptr on failure).
  * - CancelOffThreadScript, to free the resources without creating a script.
  *
  * The characters passed in to CompileOffThread must remain live until the
  * callback is invoked, and the resulting script will be rooted until the call
  * to FinishOffThreadScript.
  */
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileOffThread(JSContext* cx, const ReadOnlyCompileOptions& options,
                  SourceText<char16_t>& srcBuf, OffThreadCompileCallback callback,
                  void* callbackData);
 
-extern JS_PUBLIC_API(JSScript*)
+extern JS_PUBLIC_API JSScript*
 FinishOffThreadScript(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 CancelOffThreadScript(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CompileOffThreadModule(JSContext* cx, const ReadOnlyCompileOptions& options,
                        SourceText<char16_t>& srcBuf, OffThreadCompileCallback callback,
                        void* callbackData);
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 FinishOffThreadModule(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 CancelOffThreadModule(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 DecodeOffThreadScript(JSContext* cx, const ReadOnlyCompileOptions& options,
                       mozilla::Vector<uint8_t>& buffer /* TranscodeBuffer& */, size_t cursor,
                       OffThreadCompileCallback callback, void* callbackData);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 DecodeOffThreadScript(JSContext* cx, const ReadOnlyCompileOptions& options,
                       const mozilla::Range<uint8_t>& range /* TranscodeRange& */,
                       OffThreadCompileCallback callback, void* callbackData);
 
-extern JS_PUBLIC_API(JSScript*)
+extern JS_PUBLIC_API JSScript*
 FinishOffThreadScriptDecoder(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 CancelOffThreadScriptDecoder(JSContext* cx, OffThreadToken* token);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 DecodeMultiOffThreadScripts(JSContext* cx, const ReadOnlyCompileOptions& options,
                             mozilla::Vector<TranscodeSource>& sources,
                             OffThreadCompileCallback callback, void* callbackData);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 FinishMultiOffThreadScriptsDecoder(JSContext* cx, OffThreadToken* token,
                                    MutableHandle<GCVector<JSScript*>> scripts);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 CancelMultiOffThreadScriptsDecoder(JSContext* cx, OffThreadToken* token);
 
 #if defined(JS_BUILD_BINAST)
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 CanDecodeBinASTOffThread(JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
 
 #endif // defined(JS_BUILD_BINAST)
 
 } // namespace JS
 
 #endif /* js_OffThreadScriptCompilation_h */
--- a/js/public/Principals.h
+++ b/js/public/Principals.h
@@ -14,17 +14,17 @@
 #include <stdint.h>
 
 #include "jspubtd.h"
 
 struct JSStructuredCloneReader;
 struct JSStructuredCloneWriter;
 
 namespace js {
-    struct JS_PUBLIC_API(PerformanceGroup);
+    struct JS_PUBLIC_API PerformanceGroup;
 } // namespace js
 
 struct JSPrincipals {
     /* Don't call "destroy"; use reference counting macros below. */
     mozilla::Atomic<int32_t,
                     mozilla::SequentiallyConsistent,
                     mozilla::recordreplay::Behavior::DontPreserve> refcount;
 
@@ -46,23 +46,23 @@ struct JSPrincipals {
      * true on success.
      */
     virtual bool write(JSContext* cx, JSStructuredCloneWriter* writer) = 0;
 
     /*
      * This is not defined by the JS engine but should be provided by the
      * embedding.
      */
-    JS_PUBLIC_API(void) dump();
+    JS_PUBLIC_API void dump();
 };
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_HoldPrincipals(JSPrincipals* principals);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_DropPrincipals(JSContext* cx, JSPrincipals* principals);
 
 // Return whether the first principal subsumes the second. The exact meaning of
 // 'subsumes' is left up to the browser. Subsumption is checked inside the JS
 // engine when determining, e.g., which stack frames to display in a backtrace.
 typedef bool
 (* JSSubsumesOp)(JSPrincipals* first, JSPrincipals* second);
 
@@ -73,46 +73,46 @@ typedef bool
 typedef bool
 (* JSCSPEvalChecker)(JSContext* cx, JS::HandleValue value);
 
 struct JSSecurityCallbacks {
     JSCSPEvalChecker           contentSecurityPolicyAllows;
     JSSubsumesOp               subsumes;
 };
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetSecurityCallbacks(JSContext* cx, const JSSecurityCallbacks* callbacks);
 
-extern JS_PUBLIC_API(const JSSecurityCallbacks*)
+extern JS_PUBLIC_API const JSSecurityCallbacks*
 JS_GetSecurityCallbacks(JSContext* cx);
 
 /*
  * Code running with "trusted" principals will be given a deeper stack
  * allocation than ordinary scripts. This allows trusted script to run after
  * untrusted script has exhausted the stack. This function sets the
  * runtime-wide trusted principal.
  *
  * This principals is not held (via JS_HoldPrincipals/JS_DropPrincipals).
  * Instead, the caller must ensure that the given principals stays valid for as
  * long as 'cx' may point to it. If the principals would be destroyed before
  * 'cx', JS_SetTrustedPrincipals must be called again, passing nullptr for
  * 'prin'.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_SetTrustedPrincipals(JSContext* cx, JSPrincipals* prin);
 
 typedef void
 (* JSDestroyPrincipalsOp)(JSPrincipals* principals);
 
 /*
  * Initialize the callback that is called to destroy JSPrincipals instance
  * when its reference counter drops to zero. The initialization can be done
  * only once per JS runtime.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_InitDestroyPrincipalsCallback(JSContext* cx, JSDestroyPrincipalsOp destroyPrincipals);
 
 /*
  * Read a JSPrincipals instance from the given |reader| and initialize the out
  * paratemer |outPrincipals| to the JSPrincipals instance read.
  *
  * Return false on failure, true on success. The |outPrincipals| parameter
  * should not be modified if false is returned.
@@ -123,13 +123,13 @@ JS_InitDestroyPrincipalsCallback(JSConte
  */
 using JSReadPrincipalsOp = bool (*)(JSContext* cx, JSStructuredCloneReader* reader,
                                     JSPrincipals** outPrincipals);
 
 /*
  * Initialize the callback that is called to read JSPrincipals instances from a
  * buffer. The initialization can be done only once per JS runtime.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_InitReadPrincipalsCallback(JSContext* cx, JSReadPrincipalsOp read);
 
 
 #endif  /* js_Principals_h */
--- a/js/public/Printf.h
+++ b/js/public/Printf.h
@@ -12,22 +12,22 @@
 #include <stdarg.h>
 
 #include "jstypes.h"
 #include "js/Utility.h"
 
 /* Wrappers for mozilla::Smprintf and friends that are used throughout
    JS.  */
 
-extern JS_PUBLIC_API(JS::UniqueChars) JS_smprintf(const char* fmt, ...)
+extern JS_PUBLIC_API JS::UniqueChars JS_smprintf(const char* fmt, ...)
     MOZ_FORMAT_PRINTF(1, 2);
 
-extern JS_PUBLIC_API(JS::UniqueChars) JS_sprintf_append(JS::UniqueChars&& last,
-                                                        const char* fmt, ...)
+extern JS_PUBLIC_API JS::UniqueChars JS_sprintf_append(JS::UniqueChars&& last,
+                                                       const char* fmt, ...)
      MOZ_FORMAT_PRINTF(2, 3);
 
-extern JS_PUBLIC_API(JS::UniqueChars) JS_vsmprintf(const char* fmt, va_list ap)
+extern JS_PUBLIC_API JS::UniqueChars JS_vsmprintf(const char* fmt, va_list ap)
     MOZ_FORMAT_PRINTF(1, 0);
-extern JS_PUBLIC_API(JS::UniqueChars) JS_vsprintf_append(JS::UniqueChars&& last,
-                                                         const char* fmt, va_list ap)
+extern JS_PUBLIC_API JS::UniqueChars JS_vsprintf_append(JS::UniqueChars&& last,
+                                                        const char* fmt, va_list ap)
     MOZ_FORMAT_PRINTF(2, 0);
 
 #endif /* js_Printf_h */
--- a/js/public/ProfilingFrameIterator.h
+++ b/js/public/ProfilingFrameIterator.h
@@ -34,17 +34,17 @@ struct ForEachTrackedOptimizationTypeInf
 // This iterator can be used to walk the stack of a thread suspended at an
 // arbitrary pc. To provide accurate results, profiling must have been enabled
 // (via EnableRuntimeProfilingStack) before executing the callstack being
 // unwound.
 //
 // Note that the caller must not do anything that could cause GC to happen while
 // the iterator is alive, since this could invalidate Ion code and cause its
 // contents to become out of date.
-class MOZ_NON_PARAM JS_PUBLIC_API(ProfilingFrameIterator)
+class MOZ_NON_PARAM JS_PUBLIC_API ProfilingFrameIterator
 {
   public:
     enum class Kind : bool {
         JSJit,
         Wasm
     };
 
   private:
@@ -136,28 +136,28 @@ class MOZ_NON_PARAM JS_PUBLIC_API(Profil
     mozilla::Maybe<Frame> getPhysicalFrameAndEntry(js::jit::JitcodeGlobalEntry* entry) const;
 
     void iteratorConstruct(const RegisterState& state);
     void iteratorConstruct();
     void iteratorDestroy();
     bool iteratorDone();
 } JS_HAZ_GC_INVALIDATED;
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 IsProfilingEnabledForContext(JSContext* cx);
 
 /**
  * After each sample run, this method should be called with the current buffer
  * position at which the buffer contents start. This will update the
  * corresponding field on the JSRuntime.
  *
  * See the field |profilerSampleBufferRangeStart| on JSRuntime for documentation
  * about what this value is used for.
  */
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 SetJSContextProfilerSampleBufferRangeStart(JSContext* cx, uint64_t rangeStart);
 
 class ProfiledFrameRange;
 
 // A handle to the underlying JitcodeGlobalEntry, so as to avoid repeated
 // lookups on JitcodeGlobalTable.
 class MOZ_STACK_CLASS ProfiledFrameHandle
 {
@@ -177,55 +177,55 @@ class MOZ_STACK_CLASS ProfiledFrameHandl
     void updateHasTrackedOptimizations();
 
 public:
     const char* label() const { return label_; }
     uint32_t depth() const { return depth_; }
     bool hasTrackedOptimizations() const { return optsIndex_.isSome(); }
     void* canonicalAddress() const { return canonicalAddr_; }
 
-    JS_PUBLIC_API(ProfilingFrameIterator::FrameKind) frameKind() const;
-    JS_PUBLIC_API(void) forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
-                                                    JSScript** scriptOut,
-                                                    jsbytecode** pcOut) const;
+    JS_PUBLIC_API ProfilingFrameIterator::FrameKind frameKind() const;
+    JS_PUBLIC_API void forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
+                                                  JSScript** scriptOut,
+                                                  jsbytecode** pcOut) const;
 
-    JS_PUBLIC_API(void)
+    JS_PUBLIC_API void
     forEachOptimizationTypeInfo(ForEachTrackedOptimizationTypeInfoOp& op) const;
 };
 
 class ProfiledFrameRange
 {
 public:
     class Iter final
     {
     public:
         Iter(const ProfiledFrameRange& range, uint32_t index)
           : range_(range)
           , index_(index)
         {}
 
-        JS_PUBLIC_API(ProfiledFrameHandle) operator*() const;
+        JS_PUBLIC_API ProfiledFrameHandle operator*() const;
 
         // Provide the bare minimum of iterator methods that are needed for
         // C++ ranged for loops.
         Iter& operator++() { ++index_; return *this; }
         bool operator==(const Iter& rhs) { return index_ == rhs.index_; }
         bool operator!=(const Iter& rhs) { return !(*this == rhs); }
 
     private:
         const ProfiledFrameRange& range_;
         uint32_t index_;
     };
 
     Iter begin() const { return Iter(*this, 0); }
     Iter end() const { return Iter(*this, depth_); }
 
 private:
-    friend JS_PUBLIC_API(ProfiledFrameRange) GetProfiledFrames(JSContext* cx,
-                                                               void* addr);
+    friend JS_PUBLIC_API ProfiledFrameRange GetProfiledFrames(JSContext* cx,
+                                                              void* addr);
 
     ProfiledFrameRange(JSRuntime* rt, void* addr, js::jit::JitcodeGlobalEntry* entry)
       : rt_(rt)
       , addr_(addr)
       , entry_(entry)
       , depth_(0)
     {}
 
@@ -233,14 +233,14 @@ private:
     void* addr_;
     js::jit::JitcodeGlobalEntry* entry_;
     // Assume maximum inlining depth is <64
     const char* labels_[64];
     uint32_t depth_;
 };
 
 // Returns a range that can be iterated over using C++ ranged for loops.
-JS_PUBLIC_API(ProfiledFrameRange)
+JS_PUBLIC_API ProfiledFrameRange
 GetProfiledFrames(JSContext* cx, void* addr);
 
 } // namespace JS
 
 #endif  /* js_ProfilingFrameIterator_h */
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -15,17 +15,17 @@
 #include "js/TypeDecls.h"
 #include "js/Utility.h"
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wattributes"
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
-class JS_PUBLIC_API(JSTracer);
+class JS_PUBLIC_API JSTracer;
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic pop
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
 class ProfilingStack;
 
 // This file defines the classes ProfilingStack and ProfilingStackFrame.
@@ -315,59 +315,59 @@ class ProfilingStackFrame
         return Category(flagsAndCategory_ >> uint32_t(Flags::FLAGS_BITCOUNT));
     }
 
     void* stackAddress() const {
         MOZ_ASSERT(!isJsFrame());
         return spOrScript;
     }
 
-    JS_PUBLIC_API(JSScript*) script() const;
+    JS_PUBLIC_API JSScript* script() const;
 
     // Note that the pointer returned might be invalid.
     JSScript* rawScript() const {
         MOZ_ASSERT(isJsFrame());
         void* script = spOrScript;
         return static_cast<JSScript*>(script);
     }
 
     // We can't know the layout of JSScript, so look in vm/GeckoProfiler.cpp.
-    JS_FRIEND_API(jsbytecode*) pc() const;
+    JS_FRIEND_API jsbytecode* pc() const;
     void setPC(jsbytecode* pc);
 
     void trace(JSTracer* trc);
 
     // The offset of a pc into a script's code can actually be 0, so to
     // signify a nullptr pc, use a -1 index. This is checked against in
     // pc() and setPC() to set/get the right pc.
     static const int32_t NullPCOffset = -1;
 };
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 SetContextProfilingStack(JSContext* cx, ProfilingStack* profilingStack);
 
 // GetContextProfilingStack also exists, but it's defined in RootingAPI.h.
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 EnableContextProfilingStack(JSContext* cx, bool enabled);
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 RegisterContextProfilingEventMarker(JSContext* cx, void (*fn)(const char*));
 
 } // namespace js
 
 namespace JS {
 
 typedef ProfilingStack*
 (* RegisterThreadCallback)(const char* threadName, void* stackBase);
 
 typedef void
 (* UnregisterThreadCallback)();
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 SetProfilingThreadCallbacks(RegisterThreadCallback registerThread,
                             UnregisterThreadCallback unregisterThread);
 
 } // namespace JS
 
 // Each thread has its own ProfilingStack. That thread modifies the ProfilingStack,
 // pushing and popping elements as necessary.
 //
--- a/js/public/ProtoKey.h
+++ b/js/public/ProtoKey.h
@@ -5,121 +5,130 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef js_ProtoKey_h
 #define js_ProtoKey_h
 
 /* A higher-order macro for enumerating all JSProtoKey values. */
 /*
  * Consumers define macros as follows:
- * macro(name, init, clasp)
+ * MACRO(name, init, clasp)
  *   name:    The canonical name of the class.
  *   init:    Initialization function. These are |extern "C";|, and clients should use
  *            |extern "C" {}| as appropriate when using this macro.
  *   clasp:   The JSClass for this object, or "dummy" if it doesn't exist.
  *
  *
  * Consumers wishing to iterate over all the JSProtoKey values, can use
  * JS_FOR_EACH_PROTOTYPE. However, there are certain values that don't correspond
  * to real constructors, like Null or constructors that are disabled via
  * preprocessor directives. We still need to include these in the JSProtoKey list
  * in order to maintain binary XDR compatibility, but we need to provide a tool
  * to handle them differently. JS_FOR_PROTOTYPES fills this niche.
  *
- * Consumers pass two macros to JS_FOR_PROTOTYPES - |real| and |imaginary|. The
+ * Consumers pass two macros to JS_FOR_PROTOTYPES - |REAL| and |IMAGINARY|. The
  * former is invoked for entries that have real client-exposed constructors, and
  * the latter is called for the rest. Consumers that don't care about this
  * distinction can simply pass the same macro to both, which is exactly what
  * JS_FOR_EACH_PROTOTYPE does.
  */
 
-#define CLASP(name)                 (&name##Class)
-#define OCLASP(name)                (&name##Object::class_)
-#define TYPED_ARRAY_CLASP(type)     (&TypedArrayObject::classes[Scalar::type])
-#define ERROR_CLASP(type)           (&ErrorObject::classes[type])
+#define CLASP(NAME)                 (&NAME##Class)
+#define OCLASP(NAME)                (&NAME##Object::class_)
+#define TYPED_ARRAY_CLASP(TYPE)     (&TypedArrayObject::classes[Scalar::TYPE])
+#define ERROR_CLASP(TYPE)           (&ErrorObject::classes[TYPE])
 
 #ifdef EXPOSE_INTL_API
-#define IF_INTL(real,imaginary) real
+#define IF_INTL(REAL,IMAGINARY) REAL
 #else
-#define IF_INTL(real,imaginary) imaginary
+#define IF_INTL(REAL,IMAGINARY) IMAGINARY
 #endif
 
 #ifdef ENABLE_BINARYDATA
-#define IF_BDATA(real,imaginary) real
+#define IF_BDATA(REAL,IMAGINARY) REAL
 #else
-#define IF_BDATA(real,imaginary) imaginary
+#define IF_BDATA(REAL,IMAGINARY) IMAGINARY
 #endif
 
 #ifdef ENABLE_SHARED_ARRAY_BUFFER
-#define IF_SAB(real,imaginary) real
+#define IF_SAB(REAL,IMAGINARY) REAL
 #else
-#define IF_SAB(real,imaginary) imaginary
+#define IF_SAB(REAL,IMAGINARY) IMAGINARY
 #endif
 
-#define JS_FOR_PROTOTYPES(real,imaginary) \
-    imaginary(Null,             InitNullClass,          dummy) \
-    real(Object,                InitViaClassSpec,       OCLASP(Plain)) \
-    real(Function,              InitViaClassSpec,       &JSFunction::class_) \
-    real(Array,                 InitViaClassSpec,       OCLASP(Array)) \
-    real(Boolean,               InitBooleanClass,       OCLASP(Boolean)) \
-    real(JSON,                  InitJSONClass,          CLASP(JSON)) \
-    real(Date,                  InitViaClassSpec,       OCLASP(Date)) \
-    real(Math,                  InitMathClass,          CLASP(Math)) \
-    real(Number,                InitNumberClass,        OCLASP(Number)) \
-    real(String,                InitStringClass,        OCLASP(String)) \
-    real(RegExp,                InitViaClassSpec,       OCLASP(RegExp)) \
-    real(Error,                 InitViaClassSpec,       ERROR_CLASP(JSEXN_ERR)) \
-    real(InternalError,         InitViaClassSpec,       ERROR_CLASP(JSEXN_INTERNALERR)) \
-    real(EvalError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_EVALERR)) \
-    real(RangeError,            InitViaClassSpec,       ERROR_CLASP(JSEXN_RANGEERR)) \
-    real(ReferenceError,        InitViaClassSpec,       ERROR_CLASP(JSEXN_REFERENCEERR)) \
-    real(SyntaxError,           InitViaClassSpec,       ERROR_CLASP(JSEXN_SYNTAXERR)) \
-    real(TypeError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_TYPEERR)) \
-    real(URIError,              InitViaClassSpec,       ERROR_CLASP(JSEXN_URIERR)) \
-    real(DebuggeeWouldRun,      InitViaClassSpec,       ERROR_CLASP(JSEXN_DEBUGGEEWOULDRUN)) \
-    real(CompileError,          InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMCOMPILEERROR)) \
-    real(LinkError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMLINKERROR)) \
-    real(RuntimeError,          InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMRUNTIMEERROR)) \
-    real(ArrayBuffer,           InitViaClassSpec,       OCLASP(ArrayBuffer)) \
-    real(Int8Array,             InitViaClassSpec,       TYPED_ARRAY_CLASP(Int8)) \
-    real(Uint8Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8)) \
-    real(Int16Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Int16)) \
-    real(Uint16Array,           InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint16)) \
-    real(Int32Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Int32)) \
-    real(Uint32Array,           InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint32)) \
-    real(Float32Array,          InitViaClassSpec,       TYPED_ARRAY_CLASP(Float32)) \
-    real(Float64Array,          InitViaClassSpec,       TYPED_ARRAY_CLASP(Float64)) \
-    real(Uint8ClampedArray,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8Clamped)) \
-IF_BIGINT(real,imaginary)(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
-    real(Proxy,                 InitProxyClass,         &js::ProxyClass) \
-    real(WeakMap,               InitWeakMapClass,       OCLASP(WeakMap)) \
-    real(Map,                   InitViaClassSpec,       OCLASP(Map)) \
-    real(Set,                   InitViaClassSpec,       OCLASP(Set)) \
-    real(DataView,              InitViaClassSpec,       OCLASP(DataView)) \
-    real(Symbol,                InitSymbolClass,        OCLASP(Symbol)) \
-    real(SharedArrayBuffer,    InitViaClassSpec,       OCLASP(SharedArrayBuffer)) \
-IF_INTL(real,imaginary) (Intl,                  InitIntlClass,          CLASP(Intl)) \
-IF_BDATA(real,imaginary)(TypedObject,           InitTypedObjectModuleObject,   OCLASP(TypedObjectModule)) \
-    real(Reflect,               InitReflect,            nullptr) \
-    real(WeakSet,               InitWeakSetClass,       OCLASP(WeakSet)) \
-    real(TypedArray,            InitViaClassSpec,       &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
-    real(Atomics,               InitAtomicsClass,       OCLASP(Atomics)) \
-    real(SavedFrame,            InitViaClassSpec,       &js::SavedFrame::class_) \
-    real(Promise,               InitViaClassSpec,       OCLASP(Promise)) \
-    real(ReadableStream,        InitViaClassSpec,       &js::ReadableStream::class_) \
-    real(ReadableStreamDefaultReader,           InitViaClassSpec, &js::ReadableStreamDefaultReader::class_) \
-    real(ReadableStreamDefaultController,       InitViaClassSpec, &js::ReadableStreamDefaultController::class_) \
-    real(ReadableByteStreamController,          InitViaClassSpec, &js::ReadableByteStreamController::class_) \
-    imaginary(WritableStream,   dummy,                  dummy) \
-    imaginary(WritableStreamDefaultWriter,      dummy,  dummy) \
-    imaginary(WritableStreamDefaultController,  dummy,  dummy) \
-    real(ByteLengthQueuingStrategy,             InitViaClassSpec, &js::ByteLengthQueuingStrategy::class_) \
-    real(CountQueuingStrategy,  InitViaClassSpec,       &js::CountQueuingStrategy::class_) \
-    real(WebAssembly,           InitWebAssemblyClass,   CLASP(WebAssembly)) \
-    imaginary(WasmModule,       dummy,                  dummy) \
-    imaginary(WasmInstance,     dummy,                  dummy) \
-    imaginary(WasmMemory,       dummy,                  dummy) \
-    imaginary(WasmTable,        dummy,                  dummy) \
-    imaginary(WasmGlobal,       dummy,                  dummy) \
+#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, \
+                           REAL_IF_INTL, REAL_IF_BDATA, REAL_IF_SAB, REAL_IF_BIGINT) \
+    IMAGINARY(Null,             InitNullClass,          dummy) \
+    REAL(Object,                InitViaClassSpec,       OCLASP(Plain)) \
+    REAL(Function,              InitViaClassSpec,       &JSFunction::class_) \
+    REAL(Array,                 InitViaClassSpec,       OCLASP(Array)) \
+    REAL(Boolean,               InitBooleanClass,       OCLASP(Boolean)) \
+    REAL(JSON,                  InitJSONClass,          CLASP(JSON)) \
+    REAL(Date,                  InitViaClassSpec,       OCLASP(Date)) \
+    REAL(Math,                  InitMathClass,          CLASP(Math)) \
+    REAL(Number,                InitNumberClass,        OCLASP(Number)) \
+    REAL(String,                InitStringClass,        OCLASP(String)) \
+    REAL(RegExp,                InitViaClassSpec,       OCLASP(RegExp)) \
+    REAL(Error,                 InitViaClassSpec,       ERROR_CLASP(JSEXN_ERR)) \
+    REAL(InternalError,         InitViaClassSpec,       ERROR_CLASP(JSEXN_INTERNALERR)) \
+    REAL(EvalError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_EVALERR)) \
+    REAL(RangeError,            InitViaClassSpec,       ERROR_CLASP(JSEXN_RANGEERR)) \
+    REAL(ReferenceError,        InitViaClassSpec,       ERROR_CLASP(JSEXN_REFERENCEERR)) \
+    REAL(SyntaxError,           InitViaClassSpec,       ERROR_CLASP(JSEXN_SYNTAXERR)) \
+    REAL(TypeError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_TYPEERR)) \
+    REAL(URIError,              InitViaClassSpec,       ERROR_CLASP(JSEXN_URIERR)) \
+    REAL(DebuggeeWouldRun,      InitViaClassSpec,       ERROR_CLASP(JSEXN_DEBUGGEEWOULDRUN)) \
+    REAL(CompileError,          InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMCOMPILEERROR)) \
+    REAL(LinkError,             InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMLINKERROR)) \
+    REAL(RuntimeError,          InitViaClassSpec,       ERROR_CLASP(JSEXN_WASMRUNTIMEERROR)) \
+    REAL(ArrayBuffer,           InitViaClassSpec,       OCLASP(ArrayBuffer)) \
+    REAL(Int8Array,             InitViaClassSpec,       TYPED_ARRAY_CLASP(Int8)) \
+    REAL(Uint8Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8)) \
+    REAL(Int16Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Int16)) \
+    REAL(Uint16Array,           InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint16)) \
+    REAL(Int32Array,            InitViaClassSpec,       TYPED_ARRAY_CLASP(Int32)) \
+    REAL(Uint32Array,           InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint32)) \
+    REAL(Float32Array,          InitViaClassSpec,       TYPED_ARRAY_CLASP(Float32)) \
+    REAL(Float64Array,          InitViaClassSpec,       TYPED_ARRAY_CLASP(Float64)) \
+    REAL(Uint8ClampedArray,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8Clamped)) \
+    REAL_IF_BIGINT(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
+    REAL(Proxy,                 InitProxyClass,         &js::ProxyClass) \
+    REAL(WeakMap,               InitWeakMapClass,       OCLASP(WeakMap)) \
+    REAL(Map,                   InitViaClassSpec,       OCLASP(Map)) \
+    REAL(Set,                   InitViaClassSpec,       OCLASP(Set)) \
+    REAL(DataView,              InitViaClassSpec,       OCLASP(DataView)) \
+    REAL(Symbol,                InitSymbolClass,        OCLASP(Symbol)) \
+    REAL(SharedArrayBuffer,     InitViaClassSpec,       OCLASP(SharedArrayBuffer)) \
+    REAL_IF_INTL(Intl, InitIntlClass, CLASP(Intl)) \
+    REAL_IF_BDATA(TypedObject, InitTypedObjectModuleObject, OCLASP(TypedObjectModule)) \
+    REAL(Reflect,               InitReflect,            nullptr) \
+    REAL(WeakSet,               InitWeakSetClass,       OCLASP(WeakSet)) \
+    REAL(TypedArray,            InitViaClassSpec,       &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
+    REAL(Atomics,               InitAtomicsClass,       OCLASP(Atomics)) \
+    REAL(SavedFrame,            InitViaClassSpec,       &js::SavedFrame::class_) \
+    REAL(Promise,               InitViaClassSpec,       OCLASP(Promise)) \
+    REAL(ReadableStream,        InitViaClassSpec,       &js::ReadableStream::class_) \
+    REAL(ReadableStreamDefaultReader,           InitViaClassSpec, &js::ReadableStreamDefaultReader::class_) \
+    REAL(ReadableStreamDefaultController,       InitViaClassSpec, &js::ReadableStreamDefaultController::class_) \
+    REAL(ReadableByteStreamController,          InitViaClassSpec, &js::ReadableByteStreamController::class_) \
+    IMAGINARY(WritableStream,   dummy,                  dummy) \
+    IMAGINARY(WritableStreamDefaultWriter,      dummy,  dummy) \
+    IMAGINARY(WritableStreamDefaultController,  dummy,  dummy) \
+    REAL(ByteLengthQueuingStrategy,             InitViaClassSpec, &js::ByteLengthQueuingStrategy::class_) \
+    REAL(CountQueuingStrategy,  InitViaClassSpec,       &js::CountQueuingStrategy::class_) \
+    REAL(WebAssembly,           InitWebAssemblyClass,   CLASP(WebAssembly)) \
+    IMAGINARY(WasmModule,       dummy,                  dummy) \
+    IMAGINARY(WasmInstance,     dummy,                  dummy) \
+    IMAGINARY(WasmMemory,       dummy,                  dummy) \
+    IMAGINARY(WasmTable,        dummy,                  dummy) \
+    IMAGINARY(WasmGlobal,       dummy,                  dummy) \
 
-#define JS_FOR_EACH_PROTOTYPE(macro) JS_FOR_PROTOTYPES(macro,macro)
+#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \
+    JS_FOR_PROTOTYPES_(REAL, \
+                       IMAGINARY, \
+                       IF_INTL(REAL, IMAGINARY), \
+                       IF_BDATA(REAL, IMAGINARY), \
+                       IF_SAB(REAL, IMAGINARY), \
+                       IF_BIGINT(REAL, IMAGINARY))
+
+#define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO,MACRO)
 
 #endif /* js_ProtoKey_h */
--- a/js/public/Proxy.h
+++ b/js/public/Proxy.h
@@ -29,17 +29,17 @@ using JS::MutableHandleValue;
 using JS::NativeImpl;
 using JS::ObjectOpResult;
 using JS::PrivateValue;
 using JS::PropertyDescriptor;
 using JS::Value;
 
 class RegExpShared;
 
-class JS_FRIEND_API(Wrapper);
+class JS_FRIEND_API Wrapper;
 
 /*
  * [SMDOC] Proxy Objects
  *
  * A proxy is a JSObject with highly customizable behavior. ES6 specifies a
  * single kind of proxy, but the customization mechanisms we use to implement
  * ES6 Proxy objects are also useful wherever an object with weird behavior is
  * wanted. Proxies are used to implement:
@@ -161,17 +161,17 @@ class JS_FRIEND_API(Wrapper);
  * default implementation for most methods. As a convenience, a few high-level
  * methods, like get() and set(), are given default implementations that work by
  * calling the low-level methods, like getOwnPropertyDescriptor().
  *
  * Important: If you add a method here, you should probably also add a
  * Proxy::foo entry point with an AutoEnterPolicy. If you don't, you need an
  * explicit override for the method in SecurityWrapper. See bug 945826 comment 0.
  */
-class JS_FRIEND_API(BaseProxyHandler)
+class JS_FRIEND_API BaseProxyHandler
 {
     /*
      * Sometimes it's desirable to designate groups of proxy handlers as "similar".
      * For this, we use the notion of a "family": A consumer-provided opaque pointer
      * that designates the larger group to which this proxy belongs.
      *
      * If it will never be important to differentiate this proxy from others as
      * part of a distinct group, nullptr may be used instead.
@@ -364,17 +364,17 @@ class JS_FRIEND_API(BaseProxyHandler)
     virtual bool getElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
                              ElementAdder* adder) const;
 
     /* See comment for weakmapKeyDelegateOp in js/Class.h. */
     virtual JSObject* weakmapKeyDelegate(JSObject* proxy) const;
     virtual bool isScripted() const { return false; }
 };
 
-extern JS_FRIEND_DATA(const js::Class) ProxyClass;
+extern JS_FRIEND_DATA const js::Class ProxyClass;
 
 inline bool IsProxy(const JSObject* obj)
 {
     return GetObjectClass(obj)->isProxy();
 }
 
 namespace detail {
 
@@ -477,17 +477,17 @@ GetProxyDataLayout(JSObject* obj)
 inline const ProxyDataLayout*
 GetProxyDataLayout(const JSObject* obj)
 {
     MOZ_ASSERT(IsProxy(obj));
     return reinterpret_cast<const ProxyDataLayout*>(reinterpret_cast<const uint8_t*>(obj) +
                                                     ProxyDataOffset);
 }
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 SetValueInProxy(Value* slot, const Value& value);
 
 inline void
 SetProxyReservedSlotUnchecked(JSObject* obj, size_t n, const Value& extra)
 {
     MOZ_ASSERT(n < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)));
 
     Value* vp = &GetProxyDataLayout(obj)->reservedSlots->slots[n];
@@ -597,24 +597,24 @@ class MOZ_STACK_CLASS ProxyOptions {
     }
 
   private:
     bool singleton_;
     bool lazyProto_;
     const Class* clasp_;
 };
 
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 NewProxyObject(JSContext* cx, const BaseProxyHandler* handler, HandleValue priv,
                JSObject* proto, const ProxyOptions& options = ProxyOptions());
 
 JSObject*
 RenewProxyObject(JSContext* cx, JSObject* obj, BaseProxyHandler* handler, const Value& priv);
 
-class JS_FRIEND_API(AutoEnterPolicy)
+class JS_FRIEND_API AutoEnterPolicy
 {
   public:
     typedef BaseProxyHandler::Action Action;
     AutoEnterPolicy(JSContext* cx, const BaseProxyHandler* handler,
                     HandleObject wrapper, HandleId id, Action act, bool mayThrow)
 #ifdef JS_DEBUG
         : context(nullptr)
 #endif
@@ -656,17 +656,17 @@ class JS_FRIEND_API(AutoEnterPolicy)
 
     // NB: We explicitly don't track the entered action here, because sometimes
     // set() methods do an implicit get() during their implementation, leading
     // to spurious assertions.
     AutoEnterPolicy* prev;
     void recordEnter(JSContext* cx, HandleObject proxy, HandleId id, Action act);
     void recordLeave();
 
-    friend JS_FRIEND_API(void) assertEnteredPolicy(JSContext* cx, JSObject* proxy, jsid id, Action act);
+    friend JS_FRIEND_API void assertEnteredPolicy(JSContext* cx, JSObject* proxy, jsid id, Action act);
 #else
     inline void recordEnter(JSContext* cx, JSObject* proxy, jsid id, Action act) {}
     inline void recordLeave() {}
 #endif
 
   private:
     // This operator needs to be deleted explicitly, otherwise Visual C++ will
     // create it automatically when it is part of the export JS API. In that
@@ -674,47 +674,47 @@ class JS_FRIEND_API(AutoEnterPolicy)
     // and consequently instantiation of assign operator of mozilla::Maybe
     // would fail. See bug 1325351 comment 16. Copy constructor is removed at
     // the same time for consistency.
     AutoEnterPolicy(const AutoEnterPolicy&) = delete;
     AutoEnterPolicy& operator=(const AutoEnterPolicy&) = delete;
 };
 
 #ifdef JS_DEBUG
-class JS_FRIEND_API(AutoWaivePolicy) : public AutoEnterPolicy {
+class JS_FRIEND_API AutoWaivePolicy : public AutoEnterPolicy {
 public:
     AutoWaivePolicy(JSContext* cx, HandleObject proxy, HandleId id,
                     BaseProxyHandler::Action act)
     {
         allow = true;
         recordEnter(cx, proxy, id, act);
     }
 };
 #else
-class JS_FRIEND_API(AutoWaivePolicy) {
+class JS_FRIEND_API AutoWaivePolicy {
   public:
     AutoWaivePolicy(JSContext* cx, HandleObject proxy, HandleId id,
                     BaseProxyHandler::Action act)
     {}
 };
 #endif
 
 #ifdef JS_DEBUG
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 assertEnteredPolicy(JSContext* cx, JSObject* obj, jsid id,
                     BaseProxyHandler::Action act);
 #else
 inline void assertEnteredPolicy(JSContext* cx, JSObject* obj, jsid id,
                                 BaseProxyHandler::Action act)
 {}
 #endif
 
-extern JS_FRIEND_DATA(const js::ClassOps) ProxyClassOps;
-extern JS_FRIEND_DATA(const js::ClassExtension) ProxyClassExtension;
-extern JS_FRIEND_DATA(const js::ObjectOps) ProxyObjectOps;
+extern JS_FRIEND_DATA const js::ClassOps ProxyClassOps;
+extern JS_FRIEND_DATA const js::ClassExtension ProxyClassExtension;
+extern JS_FRIEND_DATA const js::ObjectOps ProxyObjectOps;
 
 template <unsigned Flags>
 constexpr unsigned
 CheckProxyFlags()
 {
     // For now assert each Proxy Class has at least 1 reserved slot. This is
     // not a hard requirement, but helps catch Classes that need an explicit
     // JSCLASS_HAS_RESERVED_SLOTS since bug 1360523.
--- a/js/public/Realm.h
+++ b/js/public/Realm.h
@@ -8,18 +8,18 @@
 #define js_Realm_h
 
 #include "jspubtd.h"
 #include "js/GCPolicyAPI.h"
 #include "js/TypeDecls.h"  // forward-declaration of JS::Realm
 
 namespace js {
 namespace gc {
-JS_PUBLIC_API(void) TraceRealm(JSTracer* trc, JS::Realm* realm, const char* name);
-JS_PUBLIC_API(bool) RealmNeedsSweep(JS::Realm* realm);
+JS_PUBLIC_API void TraceRealm(JSTracer* trc, JS::Realm* realm, const char* name);
+JS_PUBLIC_API bool RealmNeedsSweep(JS::Realm* realm);
 }
 }
 
 namespace JS {
 
 // Each Realm holds a strong reference to its GlobalObject, and vice versa.
 template <>
 struct GCPolicy<Realm*> : public NonGCPointerPolicy<Realm*>
@@ -31,17 +31,17 @@ struct GCPolicy<Realm*> : public NonGCPo
     }
     static bool needsSweep(Realm** vp) {
         return *vp && ::js::gc::RealmNeedsSweep(*vp);
     }
 };
 
 // Get the current realm, if any. The ECMAScript spec calls this "the current
 // Realm Record".
-extern JS_PUBLIC_API(Realm*)
+extern JS_PUBLIC_API Realm*
 GetCurrentRealmOrNull(JSContext* cx);
 
 namespace shadow {
 
 class Realm
 {
   protected:
     JS::Compartment* compartment_;
@@ -66,77 +66,77 @@ inline JS::Compartment*
 GetCompartmentForRealm(Realm* realm)
 {
     return shadow::Realm::get(realm)->compartment();
 }
 
 // Return an object's realm. All objects except cross-compartment wrappers are
 // created in a particular realm, which never changes. Returns null if obj is
 // a cross-compartment wrapper.
-extern JS_PUBLIC_API(Realm*)
+extern JS_PUBLIC_API Realm*
 GetObjectRealmOrNull(JSObject* obj);
 
 // Get the value of the "private data" internal field of the given Realm.
 // This field is initially null and is set using SetRealmPrivate.
 // It's a pointer to embeddding-specific data that SpiderMonkey never uses.
-extern JS_PUBLIC_API(void*)
+extern JS_PUBLIC_API void*
 GetRealmPrivate(Realm* realm);
 
 // Set the "private data" internal field of the given Realm.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SetRealmPrivate(Realm* realm, void* data);
 
 typedef void
 (* DestroyRealmCallback)(JSFreeOp* fop, Realm* realm);
 
 // Set the callback SpiderMonkey calls just before garbage-collecting a realm.
 // Embeddings can use this callback to free private data associated with the
 // realm via SetRealmPrivate.
 //
 // By the time this is called, the global object for the realm has already been
 // collected.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SetDestroyRealmCallback(JSContext* cx, DestroyRealmCallback callback);
 
 typedef void
 (* RealmNameCallback)(JSContext* cx, Handle<Realm*> realm, char* buf, size_t bufsize);
 
 // Set the callback SpiderMonkey calls to get the name of a realm, for
 // diagnostic output.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SetRealmNameCallback(JSContext* cx, RealmNameCallback callback);
 
 // Get the global object for the given realm. This only returns nullptr during
 // GC, between collecting the global object and destroying the Realm.
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmGlobalOrNull(Handle<Realm*> realm);
 
 // Initialize standard JS class constructors, prototypes, and any top-level
 // functions and constants associated with the standard classes (e.g. isNaN
 // for Number).
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 InitRealmStandardClasses(JSContext* cx);
 
 /*
  * Ways to get various per-Realm objects. All the getters declared below operate
  * on the JSContext's current Realm.
  */
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmObjectPrototype(JSContext* cx);
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmFunctionPrototype(JSContext* cx);
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmArrayPrototype(JSContext* cx);
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmErrorPrototype(JSContext* cx);
 
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 GetRealmIteratorPrototype(JSContext* cx);
 
 } // namespace JS
 
 #endif // js_Realm_h
 
 
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -194,18 +194,18 @@ struct PersistentRootedMarker;
 
 } /* namespace js */
 
 namespace JS {
 
 template <typename T> class Rooted;
 template <typename T> class PersistentRooted;
 
-JS_FRIEND_API(void) HeapObjectPostBarrier(JSObject** objp, JSObject* prev, JSObject* next);
-JS_FRIEND_API(void) HeapStringPostBarrier(JSString** objp, JSString* prev, JSString* next);
+JS_FRIEND_API void HeapObjectPostBarrier(JSObject** objp, JSObject* prev, JSObject* next);
+JS_FRIEND_API void HeapStringPostBarrier(JSString** objp, JSString* prev, JSString* next);
 
 /**
  * Create a safely-initialized |T|, suitable for use as a default value in
  * situations requiring a safe but arbitrary |T| value.
  */
 template<typename T>
 inline T
 SafelyInitialized()
@@ -236,19 +236,19 @@ SafelyInitialized()
     return T();
 }
 
 #ifdef JS_DEBUG
 /**
  * For generational GC, assert that an object is in the tenured generation as
  * opposed to being in the nursery.
  */
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 AssertGCThingMustBeTenured(JSObject* obj);
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 AssertGCThingIsNotNurseryAllocable(js::gc::Cell* cell);
 #else
 inline void
 AssertGCThingMustBeTenured(JSObject* obj) {}
 inline void
 AssertGCThingIsNotNurseryAllocable(js::gc::Cell* cell) {}
 #endif
 
@@ -745,30 +745,30 @@ struct BarrierMethods<JSString*>
 //
 // Note: this hasher, like PointerHasher can "hash" a nullptr. While a nullptr
 // would not likely be a useful key, there are some cases where being able to
 // hash a nullptr is useful, either on purpose or because of bugs:
 // (1) existence checks where the key may happen to be null and (2) some
 // aggregate Lookup kinds embed a JSObject* that is frequently null and do not
 // null test before dispatching to the hasher.
 template <typename T>
-struct JS_PUBLIC_API(MovableCellHasher)
+struct JS_PUBLIC_API MovableCellHasher
 {
     using Key = T;
     using Lookup = T;
 
     static bool hasHash(const Lookup& l);
     static bool ensureHash(const Lookup& l);
     static HashNumber hash(const Lookup& l);
     static bool match(const Key& k, const Lookup& l);
     static void rekey(Key& k, const Key& newKey) { k = newKey; }
 };
 
 template <typename T>
-struct JS_PUBLIC_API(MovableCellHasher<JS::Heap<T>>)
+struct JS_PUBLIC_API MovableCellHasher<JS::Heap<T>>
 {
     using Key = JS::Heap<T>;
     using Lookup = T;
 
     static bool hasHash(const Lookup& l) { return MovableCellHasher<T>::hasHash(l); }
     static bool ensureHash(const Lookup& l) { return MovableCellHasher<T>::ensureHash(l); }
     static HashNumber hash(const Lookup& l) { return MovableCellHasher<T>::hash(l); }
     static bool match(const Key& k, const Lookup& l) {
@@ -835,17 +835,17 @@ class alignas(8) DispatchWrapper
         wrapper->tracer(trc, &wrapper->storage, name);
     }
 };
 
 } /* namespace js */
 
 namespace JS {
 
-class JS_PUBLIC_API(AutoGCRooter);
+class JS_PUBLIC_API AutoGCRooter;
 
 // Our instantiations of Rooted<void*> and PersistentRooted<void*> require an
 // instantiation of MapTypeToRootKind.
 template <>
 struct MapTypeToRootKind<void*> {
     static const RootKind kind = RootKind::Traceable;
 };
 
@@ -900,17 +900,17 @@ class RootingContext
     static RootingContext* get(JSContext* cx) {
         return reinterpret_cast<RootingContext*>(cx);
     }
 
     friend JS::Realm* js::GetContextRealm(const JSContext* cx);
     friend JS::Zone* js::GetContextZone(const JSContext* cx);
 };
 
-class JS_PUBLIC_API(AutoGCRooter)
+class JS_PUBLIC_API AutoGCRooter
 {
   protected:
     enum class Tag : uint8_t {
         Array,          /* js::AutoArrayRooter */
         ValueArray,     /* js::AutoValueArray */
         Parser,         /* js::frontend::Parser */
 #if defined(JS_BUILD_BINAST)
         BinParser,      /* js::frontend::BinSource */
@@ -1214,20 +1214,20 @@ template <typename T>
 inline
 MutableHandle<T>::MutableHandle(PersistentRooted<T>* root)
 {
     static_assert(sizeof(MutableHandle<T>) == sizeof(T*),
                   "MutableHandle must be binary compatible with T*.");
     ptr = root->address();
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 AddPersistentRoot(RootingContext* cx, RootKind kind, PersistentRooted<void*>* root);
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 AddPersistentRoot(JSRuntime* rt, RootKind kind, PersistentRooted<void*>* root);
 
 /**
  * A copyable, assignable global GC root type with arbitrary lifetime, an
  * infallible constructor, and automatic unrooting on destruction.
  *
  * These roots can be used in heap-allocated data structures, so they are not
  * associated with any particular JSContext or stack. They are registered with
@@ -1381,17 +1381,17 @@ class PersistentRooted : public js::Root
     void set(U&& value) {
         MOZ_ASSERT(initialized());
         ptr = std::forward<U>(value);
     }
 
     detail::MaybeWrapped<T> ptr;
 } JS_HAZ_ROOTED;
 
-class JS_PUBLIC_API(ObjectPtr)
+class JS_PUBLIC_API ObjectPtr
 {
     Heap<JSObject*> value;
 
   public:
     using ElementType = JSObject*;
 
     ObjectPtr() : value(nullptr) {}
 
--- a/js/public/SavedFrameAPI.h
+++ b/js/public/SavedFrameAPI.h
@@ -61,85 +61,85 @@ enum class SavedFrameSelfHosted {
     Include,
     Exclude
 };
 
 /**
  * Given a SavedFrame JSObject, get its source property. Defaults to the empty
  * string.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameSource(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                     MutableHandle<JSString*> sourcep,
                     SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its line property. Defaults to 0.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameLine(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                   uint32_t* linep,
                   SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its column property. Defaults to 0.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameColumn(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                     uint32_t* columnp,
                     SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its functionDisplayName string, or nullptr
  * if SpiderMonkey was unable to infer a name for the captured frame's
  * function. Defaults to nullptr.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameFunctionDisplayName(JSContext* cx, JSPrincipals* principals,
                                  Handle<JSObject*> savedFrame,
                                  MutableHandle<JSString*> namep,
                                  SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its asyncCause string. Defaults to nullptr.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameAsyncCause(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                         MutableHandle<JSString*> asyncCausep,
                         SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its asyncParent SavedFrame object or nullptr
  * if there is no asyncParent. The `asyncParentp` out parameter is _NOT_
  * guaranteed to be in the cx's compartment. Defaults to nullptr.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameAsyncParent(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                          MutableHandle<JSObject*> asyncParentp,
                          SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 /**
  * Given a SavedFrame JSObject, get its parent SavedFrame object or nullptr if
  * it is the oldest frame in the stack. The `parentp` out parameter is _NOT_
  * guaranteed to be in the cx's compartment. Defaults to nullptr.
  */
-extern JS_PUBLIC_API(SavedFrameResult)
+extern JS_PUBLIC_API SavedFrameResult
 GetSavedFrameParent(JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
                     MutableHandle<JSObject*> parentp,
                     SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
 
 } // namespace JS
 
 namespace js {
 
 /**
  * Get the first SavedFrame object in this SavedFrame stack whose principals are
  * subsumed by the given |principals|. If there is no such frame, return nullptr.
  *
  * Do NOT pass a non-SavedFrame object here.
  */
-extern JS_FRIEND_API(JSObject*)
+extern JS_FRIEND_API JSObject*
 GetFirstSubsumedSavedFrame(JSContext* cx, JSPrincipals* principals,
                            JS::Handle<JSObject*> savedFrame, JS::SavedFrameSelfHosted selfHosted);
 
 } // namespace js
 
 #endif /* js_SavedFrameAPI_h */
--- a/js/public/SliceBudget.h
+++ b/js/public/SliceBudget.h
@@ -10,37 +10,37 @@
 #include "mozilla/TimeStamp.h"
 
 #include <stdint.h>
 
 #include "jstypes.h"
 
 namespace js {
 
-struct JS_PUBLIC_API(TimeBudget)
+struct JS_PUBLIC_API TimeBudget
 {
     int64_t budget;
 
     explicit TimeBudget(int64_t milliseconds) { budget = milliseconds; }
 };
 
-struct JS_PUBLIC_API(WorkBudget)
+struct JS_PUBLIC_API WorkBudget
 {
     int64_t budget;
 
     explicit WorkBudget(int64_t work) { budget = work; }
 };
 
 /*
  * This class records how much work has been done in a given collection slice,
  * so that we can return before pausing for too long. Some slices are allowed
  * to run for unlimited time, and others are bounded. To reduce the number of
  * gettimeofday calls, we only check the time every 1000 operations.
  */
-class JS_PUBLIC_API(SliceBudget)
+class JS_PUBLIC_API SliceBudget
 {
     static mozilla::TimeStamp unlimitedDeadline;
     static const intptr_t unlimitedStartCounter = INTPTR_MAX;
 
     bool checkOverBudget();
 
     SliceBudget();
 
--- a/js/public/SourceText.h
+++ b/js/public/SourceText.h
@@ -58,17 +58,17 @@
 
 #include "js/UniquePtr.h" // js::UniquePtr
 #include "js/Utility.h" // JS::FreePolicy
 
 namespace JS {
 
 namespace detail {
 
-MOZ_COLD extern JS_PUBLIC_API(void)
+MOZ_COLD extern JS_PUBLIC_API void
 ReportSourceTooLong(JSContext* cx);
 
 } // namespace detail
 
 enum class SourceOwnership
 {
     Borrowed,
     TakeOwnership,
--- a/js/public/StableStringChars.h
+++ b/js/public/StableStringChars.h
@@ -40,17 +40,17 @@ GetStringLength(JSString* s)
  * This class provides safe access to a string's chars across a GC. Once
  * we allocate strings and chars in the nursery (bug 903519), this class
  * will have to make a copy of the string's chars if they are allocated
  * in the nursery, so it's best to avoid using this class unless you really
  * need it. It's usually more efficient to use the latin1Chars/twoByteChars
  * JSString methods and often the code can be rewritten so that only indexes
  * instead of char pointers are used in parts of the code that can GC.
  */
-class MOZ_STACK_CLASS JS_FRIEND_API(AutoStableStringChars) final
+class MOZ_STACK_CLASS JS_FRIEND_API AutoStableStringChars final
 {
     /*
      * When copying string char, use this many bytes of inline storage.  This is
      * chosen to allow the inline string types to be copied without allocating.
      * This is asserted in AutoStableStringChars::allocOwnChars.
      */
     static const size_t InlineCapacity = 24;
 
--- a/js/public/Stream.h
+++ b/js/public/Stream.h
@@ -147,35 +147,35 @@ typedef void
 (* ReadableStreamFinalizeCallback)(void* underlyingSource, uint8_t flags);
 
 /**
  * Sets runtime-wide callbacks to use for interacting with embedding-provided
  * hooks for operating on ReadableStream instances.
  *
  * See the documentation for the individual callback types for details.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 SetReadableStreamCallbacks(JSContext* cx,
                            RequestReadableStreamDataCallback dataRequestCallback,
                            WriteIntoReadRequestBufferCallback writeIntoReadRequestCallback,
                            CancelReadableStreamCallback cancelCallback,
                            ReadableStreamClosedCallback closedCallback,
                            ReadableStreamErroredCallback erroredCallback,
                            ReadableStreamFinalizeCallback finalizeCallback);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 HasReadableStreamCallbacks(JSContext* cx);
 
 /**
  * Returns a new instance of the ReadableStream builtin class in the current
  * compartment, configured as a default stream.
  * If a |proto| is passed, that gets set as the instance's [[Prototype]]
  * instead of the original value of |ReadableStream.prototype|.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 NewReadableDefaultStreamObject(JSContext* cx, HandleObject underlyingSource = nullptr,
                                HandleFunction size = nullptr, double highWaterMark = 1,
                                HandleObject proto = nullptr);
 
 /**
  * Returns a new instance of the ReadableStream builtin class in the current
  * compartment, with the right slot layout. If a |proto| is passed, that gets
  * set as the instance's [[Prototype]] instead of the original value of
@@ -192,30 +192,30 @@ NewReadableDefaultStreamObject(JSContext
  * Note: the embedding is responsible for ensuring that the pointer to the
  * underlying source stays valid as long as the stream can be read from.
  * The underlying source can be freed if the tree is canceled or errored.
  * It can also be freed if the stream is destroyed. The embedding is notified
  * of that using ReadableStreamFinalizeCallback.
  *
  * Note: |underlyingSource| must have an even address.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 NewReadableExternalSourceStreamObject(JSContext* cx, void* underlyingSource,
                                       uint8_t flags = 0, HandleObject proto = nullptr);
 
 /**
  * Returns the flags that were passed to NewReadableExternalSourceStreamObject
  * when creating the given stream.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  *
  * Asserts that the given stream has an embedding-provided underlying source.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamGetEmbeddingFlags(JSContext* cx, HandleObject stream, uint8_t* flags);
 
 /**
  * Returns the embedding-provided underlying source of the given |stream|.
  *
  * Can be used to optimize operations if both the underlying source and the
  * intended sink are embedding-provided. In that case it might be
  * preferrable to pipe data directly from source to sink without interacting
@@ -232,149 +232,149 @@ ReadableStreamGetEmbeddingFlags(JSContex
  * closed. This is different from ReadableStreamGetReader because we don't
  * have a Promise to resolve/reject, which a reader provides.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  *
  * Asserts that the stream has an embedding-provided underlying source.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamGetExternalUnderlyingSource(JSContext* cx, HandleObject stream, void** source);
 
 /**
  * Releases the embedding-provided underlying source of the given |stream|,
  * returning the stream into an unlocked state.
  *
  * Asserts that the stream was locked through
  * ReadableStreamGetExternalUnderlyingSource.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  *
  * Asserts that the stream has an embedding-provided underlying source.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamReleaseExternalUnderlyingSource(JSContext* cx, HandleObject stream);
 
 /**
  * Update the amount of data available at the underlying source of the given
  * |stream|.
  *
  * Can only be used for streams with an embedding-provided underlying source.
  * The JS engine will use the given value to satisfy read requests for the
  * stream by invoking the JS::WriteIntoReadRequestBuffer callback.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamUpdateDataAvailableFromSource(JSContext* cx, HandleObject stream,
                                             uint32_t availableData);
 
 /**
  * Returns true if the given object is a ReadableStream object or an
  * unwrappable wrapper for one, false otherwise.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsReadableStream(JSObject* obj);
 
 /**
  * Returns true if the given object is a ReadableStreamDefaultReader or
  * ReadableStreamBYOBReader object or an unwrappable wrapper for one, false
  * otherwise.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsReadableStreamReader(JSObject* obj);
 
 /**
  * Returns true if the given object is a ReadableStreamDefaultReader object
  * or an unwrappable wrapper for one, false otherwise.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 IsReadableStreamDefaultReader(JSObject* obj);
 
 enum class ReadableStreamMode {
     Default,
     Byte,
     ExternalSource
 };
 
 /**
  * Returns the stream's ReadableStreamMode. If the mode is |Byte| or
  * |ExternalSource|, it's possible to acquire a BYOB reader for more optimized
  * operations.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamGetMode(JSContext* cx, HandleObject stream, ReadableStreamMode* mode);
 
 enum class ReadableStreamReaderMode {
     Default
 };
 
 /**
  * Returns true if the given ReadableStream is readable, false if not.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamIsReadable(JSContext* cx, HandleObject stream, bool* result);
 
 /**
  * Returns true if the given ReadableStream is locked, false if not.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamIsLocked(JSContext* cx, HandleObject stream, bool* result);
 
 /**
  * Returns true if the given ReadableStream is disturbed, false if not.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamIsDisturbed(JSContext* cx, HandleObject stream, bool* result);
 
 /**
  * Cancels the given ReadableStream with the given reason and returns a
  * Promise resolved according to the result.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 ReadableStreamCancel(JSContext* cx, HandleObject stream, HandleValue reason);
 
 /**
  * Creates a reader of the type specified by the mode option and locks the
  * stream to the new reader.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one. The returned object will always be created in the
  * current cx compartment.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 ReadableStreamGetReader(JSContext* cx, HandleObject stream, ReadableStreamReaderMode mode);
 
 /**
  * Tees the given ReadableStream and stores the two resulting streams in
  * outparams. Returns false if the operation fails, e.g. because the stream is
  * locked.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamTee(JSContext* cx, HandleObject stream,
                   MutableHandleObject branch1Stream, MutableHandleObject branch2Stream);
 
 /**
  * Retrieves the desired combined size of additional chunks to fill the given
  * ReadableStream's queue. Stores the result in |value| and sets |hasValue| to
  * true on success, returns false on failure.
  *
@@ -383,41 +383,41 @@ ReadableStreamTee(JSContext* cx, HandleO
  *
  * Note: This is semantically equivalent to the |desiredSize| getter on
  * the stream controller's prototype in JS. We expose it with the stream
  * itself as a target for simplicity.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamGetDesiredSize(JSContext* cx, JSObject* stream, bool* hasValue, double* value);
 
 /**
  * Closes the given ReadableStream.
  *
  * Throws a TypeError and returns false if the closing operation fails.
  *
  * Note: This is semantically equivalent to the |close| method on
  * the stream controller's prototype in JS. We expose it with the stream
  * itself as a target for simplicity.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamClose(JSContext* cx, HandleObject stream);
 
 /**
  * Returns true if the given ReadableStream reader is locked, false otherwise.
  *
  * Asserts that |reader| is a ReadableStreamDefaultReader or
  * ReadableStreamBYOBReader object or an unwrappable wrapper for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamReaderIsClosed(JSContext* cx, HandleObject reader, bool* result);
 
 /**
  * Enqueues the given chunk in the given ReadableStream.
  *
  * Throws a TypeError and returns false if the enqueing operation fails.
  *
  * Note: This is semantically equivalent to the |enqueue| method on
@@ -426,66 +426,66 @@ ReadableStreamReaderIsClosed(JSContext* 
  *
  * If the ReadableStream has an underlying byte source, the given chunk must
  * be a typed array or a DataView. Consider using
  * ReadableByteStreamEnqueueBuffer.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamEnqueue(JSContext* cx, HandleObject stream, HandleValue chunk);
 
 /**
  * Errors the given ReadableStream, causing all future interactions to fail
  * with the given error value.
  *
  * Throws a TypeError and returns false if the erroring operation fails.
  *
  * Note: This is semantically equivalent to the |error| method on
  * the stream controller's prototype in JS. We expose it with the stream
  * itself as a target for simplicity.
  *
  * Asserts that |stream| is a ReadableStream object or an unwrappable wrapper
  * for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamError(JSContext* cx, HandleObject stream, HandleValue error);
 
 /**
  * Cancels the given ReadableStream reader's associated stream.
  *
  * Throws a TypeError and returns false if the given reader isn't active.
  *
  * Asserts that |reader| is a ReadableStreamDefaultReader or
  * ReadableStreamBYOBReader object or an unwrappable wrapper for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamReaderCancel(JSContext* cx, HandleObject reader, HandleValue reason);
 
 /**
  * Cancels the given ReadableStream reader's associated stream.
  *
  * Throws a TypeError and returns false if the given reader has pending
  * read or readInto (for default or byob readers, respectively) requests.
  *
  * Asserts that |reader| is a ReadableStreamDefaultReader or
  * ReadableStreamBYOBReader object or an unwrappable wrapper for one.
  */
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject reader);
 
 /**
  * Requests a read from the reader's associated ReadableStream and returns the
  * resulting PromiseObject.
  *
  * Returns a Promise that's resolved with the read result once available or
  * rejected immediately if the stream is errored or the operation failed.
  *
  * Asserts that |reader| is a ReadableStreamDefaultReader object or an
  * unwrappable wrapper for one.
  */
-extern JS_PUBLIC_API(JSObject*)
+extern JS_PUBLIC_API JSObject*
 ReadableStreamDefaultReaderRead(JSContext* cx, HandleObject reader);
 
 } // namespace JS
 
 #endif // js_Realm_h
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -379,17 +379,17 @@ namespace js
     template <typename T, typename AllocPolicy> struct BufferIterator;
 }
 
 /**
  * JSStructuredCloneData represents structured clone data together with the
  * information needed to read/write/transfer/free the records within it, in the
  * form of a set of callbacks.
  */
-class MOZ_NON_MEMMOVABLE JS_PUBLIC_API(JSStructuredCloneData) {
+class MOZ_NON_MEMMOVABLE JS_PUBLIC_API JSStructuredCloneData {
   public:
     using BufferList = mozilla::BufferList<js::SystemAllocPolicy>;
     using Iterator = BufferList::IterImpl;
 
   private:
     static const size_t kStandardCapacity = 4096;
 
     BufferList bufList_;
@@ -400,17 +400,17 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API(J
     JS::StructuredCloneScope scope_;
 
     const JSStructuredCloneCallbacks* callbacks_ = nullptr;
     void* closure_ = nullptr;
     OwnTransferablePolicy ownTransferables_ = OwnTransferablePolicy::NoTransferables;
     js::SharedArrayRawBufferRefs refsHeld_;
 
     friend struct JSStructuredCloneWriter;
-    friend class JS_PUBLIC_API(JSAutoStructuredCloneBuffer);
+    friend class JS_PUBLIC_API JSAutoStructuredCloneBuffer;
     template <typename T, typename AllocPolicy> friend struct js::BufferIterator;
 
   public:
     // The constructor must be infallible but SystemAllocPolicy is not, so both
     // the initial size and initial capacity of the BufferList must be zero.
     explicit JSStructuredCloneData(JS::StructuredCloneScope scope)
         : bufList_(0, 0, kStandardCapacity, js::SystemAllocPolicy())
         , scope_(scope)
@@ -540,57 +540,57 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API(J
     void discardTransferables();
 };
 
 /**
  * Implements StructuredDeserialize and StructuredDeserializeWithTransfer.
  *
  * Note: If `data` contains transferable objects, it can be read only once.
  */
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ReadStructuredClone(JSContext* cx, JSStructuredCloneData& data, uint32_t version,
                        JS::StructuredCloneScope scope,
                        JS::MutableHandleValue vp,
                        const JSStructuredCloneCallbacks* optionalCallbacks, void* closure);
 
 /**
  * Implements StructuredSerialize, StructuredSerializeForStorage, and
  * StructuredSerializeWithTransfer.
  *
  * Note: If the scope is DifferentProcess then the cloneDataPolicy must deny
  * shared-memory objects, or an error will be signaled if a shared memory object
  * is seen.
  */
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WriteStructuredClone(JSContext* cx, JS::HandleValue v, JSStructuredCloneData* data,
                         JS::StructuredCloneScope scope,
                         JS::CloneDataPolicy cloneDataPolicy,
                         const JSStructuredCloneCallbacks* optionalCallbacks,
                         void* closure, JS::HandleValue transferable);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_StructuredCloneHasTransferables(JSStructuredCloneData& data, bool* hasTransferable);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_StructuredClone(JSContext* cx, JS::HandleValue v, JS::MutableHandleValue vp,
                    const JSStructuredCloneCallbacks* optionalCallbacks, void* closure);
 
 /**
  * The C-style API calls to read and write structured clones are fragile --
  * they rely on the caller to properly handle ownership of the clone data, and
  * the handling of the input data as well as the interpretation of the contents
  * of the clone buffer are dependent on the callbacks passed in. If you
  * serialize and deserialize with different callbacks, the results are
  * questionable.
  *
  * JSAutoStructuredCloneBuffer wraps things up in an RAII class for data
  * management, and uses the same callbacks for both writing and reading
  * (serializing and deserializing).
  */
-class JS_PUBLIC_API(JSAutoStructuredCloneBuffer) {
+class JS_PUBLIC_API JSAutoStructuredCloneBuffer {
     const JS::StructuredCloneScope scope_;
     JSStructuredCloneData data_;
     uint32_t version_;
 
   public:
     JSAutoStructuredCloneBuffer(JS::StructuredCloneScope scope,
                                 const JSStructuredCloneCallbacks* callbacks, void* closure)
         : scope_(scope), data_(scope), version_(JS_STRUCTURED_CLONE_VERSION)
@@ -663,36 +663,36 @@ class JS_PUBLIC_API(JSAutoStructuredClon
 #define JS_SCTAG_USER_MAX  ((uint32_t) 0xFFFFFFFF)
 
 #define JS_SCERR_RECURSION 0
 #define JS_SCERR_TRANSFERABLE 1
 #define JS_SCERR_DUP_TRANSFERABLE 2
 #define JS_SCERR_UNSUPPORTED_TYPE 3
 #define JS_SCERR_SHMEM_TRANSFERABLE 4
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ReadUint32Pair(JSStructuredCloneReader* r, uint32_t* p1, uint32_t* p2);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ReadBytes(JSStructuredCloneReader* r, void* p, size_t len);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ReadTypedArray(JSStructuredCloneReader* r, JS::MutableHandleValue vp);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WriteUint32Pair(JSStructuredCloneWriter* w, uint32_t tag, uint32_t data);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WriteBytes(JSStructuredCloneWriter* w, const void* p, size_t len);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WriteString(JSStructuredCloneWriter* w, JS::HandleString str);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WriteTypedArray(JSStructuredCloneWriter* w, JS::HandleValue v);
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ObjectNotWritten(JSStructuredCloneWriter* w, JS::HandleObject obj);
 
-JS_PUBLIC_API(JS::StructuredCloneScope)
+JS_PUBLIC_API JS::StructuredCloneScope
 JS_GetStructuredCloneScope(JSStructuredCloneWriter* w);
 
 #endif  /* js_StructuredClone_h */
--- a/js/public/SweepingAPI.h
+++ b/js/public/SweepingAPI.h
@@ -10,19 +10,19 @@
 #include "js/HeapAPI.h"
 
 namespace JS {
 namespace detail {
 class WeakCacheBase;
 } // namespace detail
 
 namespace shadow {
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 RegisterWeakCache(JS::Zone* zone, JS::detail::WeakCacheBase* cachep);
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 RegisterWeakCache(JSRuntime* rt, JS::detail::WeakCacheBase* cachep);
 } // namespace shadow
 
 namespace detail {
 class WeakCacheBase : public mozilla::LinkedListElement<WeakCacheBase>
 {
     WeakCacheBase() = delete;
     explicit WeakCacheBase(const WeakCacheBase&) = delete;
--- a/js/public/TraceLoggerAPI.h
+++ b/js/public/TraceLoggerAPI.h
@@ -12,27 +12,27 @@
 
 namespace JS {
 #ifdef JS_TRACE_LOGGING
 
 // Begin trace logging events.  This will activate some of the
 // textId's for various events and set the global option
 // JSJITCOMPILER_ENABLE_TRACELOGGER to true.
 // This does nothing except return if the trace logger is already active.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 StartTraceLogger(JSContext *cx, mozilla::TimeStamp profilerStart);
 
 // Stop trace logging events.  All textId's will be set to false, and the
 // global JSJITCOMPILER_ENABLE_TRACELOGGER will be set to false.
 // This does nothing except return if the trace logger is not active.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 StopTraceLogger(JSContext *cx);
 
 // Clear and free any event data that was recorded by the trace logger.
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 ResetTraceLogger(void);
 
 #else
 // Define empty inline functions for when trace logging compilation is not
 // enabled.  TraceLogging.cpp will not be built in that case so we need to
 // provide something for any routines that reference these.
 inline void StartTraceLogger(JSContext *cx, mozilla::TimeStamp profilerStart) {}
 inline void StopTraceLogger(JSContext *cx) {}
--- a/js/public/TracingAPI.h
+++ b/js/public/TracingAPI.h
@@ -7,25 +7,25 @@
 #ifndef js_TracingAPI_h
 #define js_TracingAPI_h
 
 #include "js/AllocPolicy.h"
 #include "js/HashTable.h"
 #include "js/HeapAPI.h"
 #include "js/TraceKind.h"
 
-class JS_PUBLIC_API(JSTracer);
+class JS_PUBLIC_API JSTracer;
 
 namespace JS {
-class JS_PUBLIC_API(CallbackTracer);
+class JS_PUBLIC_API CallbackTracer;
 template <typename T> class Heap;
 template <typename T> class TenuredHeap;
 
 /** Returns a static string equivalent of |kind|. */
-JS_FRIEND_API(const char*)
+JS_FRIEND_API const char*
 GCTraceKindToAscii(JS::TraceKind kind);
 
 } // namespace JS
 
 enum WeakMapTraceKind {
     /**
      * Do not trace into weak map keys or values during traversal. Users must
      * handle weak maps manually.
@@ -46,17 +46,17 @@ enum WeakMapTraceKind {
 
     /**
      * Trace through to all keys and values, irrespective of whether the keys
      * are live or not. Used for non-marking tracers.
      */
     TraceWeakMapKeysValues
 };
 
-class JS_PUBLIC_API(JSTracer)
+class JS_PUBLIC_API JSTracer
 {
   public:
     // Return the runtime set on the tracer.
     JSRuntime* runtime() const { return runtime_; }
 
     // Return the weak map tracing behavior currently set on this tracer.
     WeakMapTraceKind weakMapAction() const { return weakMapAction_; }
 
@@ -129,17 +129,17 @@ class JS_PUBLIC_API(JSTracer)
 };
 
 namespace JS {
 
 class AutoTracingName;
 class AutoTracingIndex;
 class AutoTracingCallback;
 
-class JS_PUBLIC_API(CallbackTracer) : public JSTracer
+class JS_PUBLIC_API CallbackTracer : public JSTracer
 {
   public:
     CallbackTracer(JSRuntime* rt, WeakMapTraceKind weakTraceKind = TraceWeakMapValues)
       : JSTracer(rt, JSTracer::TracerKindTag::Callback, weakTraceKind),
         contextName_(nullptr), contextIndex_(InvalidIndex), contextFunctor_(nullptr)
     {}
     CallbackTracer(JSContext* cx, WeakMapTraceKind weakTraceKind = TraceWeakMapValues);
 
@@ -354,17 +354,17 @@ JSTracer::asCallbackTracer()
 {
     MOZ_ASSERT(isCallbackTracer());
     return static_cast<JS::CallbackTracer*>(this);
 }
 
 namespace js {
 namespace gc {
 template <typename T>
-JS_PUBLIC_API(void) TraceExternalEdge(JSTracer* trc, T* thingp, const char* name);
+JS_PUBLIC_API void TraceExternalEdge(JSTracer* trc, T* thingp, const char* name);
 } // namespace gc
 } // namespace js
 
 namespace JS {
 
 // The JS::TraceEdge family of functions traces the given GC thing reference.
 // This performs the tracing action configured on the given JSTracer: typically
 // calling the JSTracer::callback or marking the thing as live.
@@ -403,56 +403,56 @@ TraceEdge(JSTracer* trc, JS::TenuredHeap
 
 // Edges that are always traced as part of root marking do not require
 // incremental barriers. This function allows for marking non-barriered
 // pointers, but asserts that this happens during root marking.
 //
 // Note that while |edgep| must never be null, it is fine for |*edgep| to be
 // nullptr.
 template <typename T>
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 UnsafeTraceRoot(JSTracer* trc, T* edgep, const char* name);
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 TraceChildren(JSTracer* trc, GCCellPtr thing);
 
 using ZoneSet = js::HashSet<Zone*, js::DefaultHasher<Zone*>, js::SystemAllocPolicy>;
 using CompartmentSet = js::HashSet<JS::Compartment*, js::DefaultHasher<JS::Compartment*>,
                                    js::SystemAllocPolicy>;
 
 /**
  * Trace every value within |compartments| that is wrapped by a
  * cross-compartment wrapper from a compartment that is not an element of
  * |compartments|.
  */
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 TraceIncomingCCWs(JSTracer* trc, const JS::CompartmentSet& compartments);
 
 } // namespace JS
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc,
                      void* thing, JS::TraceKind kind, bool includeDetails);
 
 namespace js {
 
 // Trace an edge that is not a GC root and is not wrapped in a barriered
 // wrapper for some reason.
 //
 // This method does not check if |*edgep| is non-null before tracing through
 // it, so callers must check any nullable pointer before calling this method.
 template <typename T>
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 UnsafeTraceManuallyBarrieredEdge(JSTracer* trc, T* edgep, const char* name);
 
 namespace gc {
 
 // Return true if the given edge is not live and is about to be swept.
 template <typename T>
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 EdgeNeedsSweep(JS::Heap<T>* edgep);
 
 // Not part of the public API, but declared here so we can use it in GCPolicy
 // which is.
 template <typename T>
 bool
 IsAboutToBeFinalizedUnbarriered(T* thingp);
 
--- a/js/public/TrackedOptimizationInfo.h
+++ b/js/public/TrackedOptimizationInfo.h
@@ -246,23 +246,23 @@ enum class TrackedOutcome : uint32_t {
 enum class TrackedTypeSite : uint32_t {
 #define TYPESITE_OP(name) name,
     TRACKED_TYPESITE_LIST(TYPESITE_OP)
 #undef TYPESITE_OP
 
     Count
 };
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 TrackedStrategyString(TrackedStrategy strategy);
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 TrackedOutcomeString(TrackedOutcome outcome);
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 TrackedTypeSiteString(TrackedTypeSite site);
 
 struct ForEachTrackedOptimizationAttemptOp
 {
     virtual void operator()(TrackedStrategy strategy, TrackedOutcome outcome) = 0;
 };
 
 struct ForEachTrackedOptimizationTypeInfoOp
--- a/js/public/Transcoding.h
+++ b/js/public/Transcoding.h
@@ -55,46 +55,46 @@ enum TranscodeResult : uint8_t
     TranscodeResult_Failure_BadDecode =           TranscodeResult_Failure | 0x4,
     TranscodeResult_Failure_WrongCompileOption =  TranscodeResult_Failure | 0x5,
     TranscodeResult_Failure_NotInterpretedFun =   TranscodeResult_Failure | 0x6,
 
     // There is a pending exception on the context.
     TranscodeResult_Throw = 0x20
 };
 
-extern JS_PUBLIC_API(TranscodeResult)
+extern JS_PUBLIC_API TranscodeResult
 EncodeScript(JSContext* cx, TranscodeBuffer& buffer, Handle<JSScript*> script);
 
-extern JS_PUBLIC_API(TranscodeResult)
+extern JS_PUBLIC_API TranscodeResult
 EncodeInterpretedFunction(JSContext* cx, TranscodeBuffer& buffer, Handle<JSObject*> funobj);
 
-extern JS_PUBLIC_API(TranscodeResult)
+extern JS_PUBLIC_API TranscodeResult
 DecodeScript(JSContext* cx, TranscodeBuffer& buffer, MutableHandle<JSScript*> scriptp,
              size_t cursorIndex = 0);
 
-extern JS_PUBLIC_API(TranscodeResult)
+extern JS_PUBLIC_API TranscodeResult
 DecodeScript(JSContext* cx, const TranscodeRange& range, MutableHandle<JSScript*> scriptp);
 
-extern JS_PUBLIC_API(TranscodeResult)
+extern JS_PUBLIC_API TranscodeResult
 DecodeInterpretedFunction(JSContext* cx, TranscodeBuffer& buffer, MutableHandle<JSFunction*> funp,
                           size_t cursorIndex = 0);
 
 // Register an encoder on the given script source, such that all functions can
 // be encoded as they are parsed. This strategy is used to avoid blocking the
 // main thread in a non-interruptible way.
 //
 // The |script| argument of |StartIncrementalEncoding| and
 // |FinishIncrementalEncoding| should be the top-level script returned either as
 // an out-param of any of the |Compile| functions, or the result of
 // |FinishOffThreadScript|.
 //
 // The |buffer| argument of |FinishIncrementalEncoding| is used for appending
 // the encoded bytecode into the buffer. If any of these functions failed, the
 // content of |buffer| would be undefined.
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 StartIncrementalEncoding(JSContext* cx, Handle<JSScript*> script);
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 FinishIncrementalEncoding(JSContext* cx, Handle<JSScript*> script, TranscodeBuffer& buffer);
 
 } // namespace JS
 
 #endif /* js_Transcoding_h */
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -185,17 +185,17 @@ using Vector = mozilla::Vector<T, 0, js:
 
 /*** ubi::StackFrame ******************************************************************************/
 
 // Concrete JS::ubi::StackFrame instances backed by a live SavedFrame object
 // store their strings as JSAtom*, while deserialized stack frames from offline
 // heap snapshots store their strings as const char16_t*. In order to provide
 // zero-cost accessors to these strings in a single interface that works with
 // both cases, we use this variant type.
-class JS_PUBLIC_API(AtomOrTwoByteChars) : public Variant<JSAtom*, const char16_t*> {
+class JS_PUBLIC_API AtomOrTwoByteChars : public Variant<JSAtom*, const char16_t*> {
     using Base = Variant<JSAtom*, const char16_t*>;
 
   public:
     template<typename T>
     MOZ_IMPLICIT AtomOrTwoByteChars(T&& rhs) : Base(std::forward<T>(rhs)) { }
 
     template<typename T>
     AtomOrTwoByteChars& operator=(T&& rhs) {
@@ -458,17 +458,17 @@ class ConcreteStackFrame<void> : public 
     uint32_t column() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     AtomOrTwoByteChars source() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     AtomOrTwoByteChars functionDisplayName() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     StackFrame parent() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     bool isSystem() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     bool isSelfHosted(JSContext* cx) const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
 };
 
-MOZ_MUST_USE JS_PUBLIC_API(bool)
+MOZ_MUST_USE JS_PUBLIC_API bool
 ConstructSavedFrameStackSlow(JSContext* cx,
                              JS::ubi::StackFrame& frame,
                              MutableHandleObject outSavedFrameStack);
 
 
 /*** ubi::Node ************************************************************************************/
 
 // A concrete node specialization can claim its referent is a member of a
@@ -513,17 +513,17 @@ inline CoarseType
 Uint32ToCoarseType(uint32_t n)
 {
     MOZ_ASSERT(Uint32IsValidCoarseType(n));
     return static_cast<CoarseType>(n);
 }
 
 // The base class implemented by each ubi::Node referent type. Subclasses must
 // not add data members to this class.
-class JS_PUBLIC_API(Base) {
+class JS_PUBLIC_API Base {
     friend class Node;
 
     // For performance's sake, we'd prefer to avoid a virtual destructor; and
     // an empty constructor seems consistent with the 'lightweight value type'
     // visible behavior we're trying to achieve. But if the destructor isn't
     // virtual, and a subclass overrides it, the subclass's destructor will be
     // ignored. Is there a way to make the compiler catch that error?
 
@@ -981,17 +981,17 @@ class PreComputedEdgeRange : public Edge
 //
 //        // The AutoCheckCannotGC is guaranteed to exist if init returned true.
 //        MOZ_ASSERT(maybeNoGC.isSome());
 //
 //        JS::ubi::Node root(&rootList);
 //
 //        ...
 //    }
-class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
+class MOZ_STACK_CLASS JS_PUBLIC_API RootList {
     Maybe<AutoCheckCannotGC>& noGC;
 
   public:
     JSContext* cx;
     EdgeVector edges;
     bool       wantNames;
 
     RootList(JSContext* cx, Maybe<AutoCheckCannotGC>& noGC, bool wantNames = false);
@@ -1016,111 +1016,111 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(Root
     // edgeName.
     MOZ_MUST_USE bool addRoot(Node node, const char16_t* edgeName = nullptr);
 };
 
 
 /*** Concrete classes for ubi::Node referent types ************************************************/
 
 template<>
-class JS_PUBLIC_API(Concrete<RootList>) : public Base {
+class JS_PUBLIC_API Concrete<RootList> : public Base {
   protected:
     explicit Concrete(RootList* ptr) : Base(ptr) { }
     RootList& get() const { return *static_cast<RootList*>(ptr); }
 
   public:
     static void construct(void* storage, RootList* ptr) { new (storage) Concrete(ptr); }
 
     js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // A reusable ubi::Concrete specialization base class for types supported by
 // JS::TraceChildren.
 template<typename Referent>
-class JS_PUBLIC_API(TracerConcrete) : public Base {
+class JS_PUBLIC_API TracerConcrete : public Base {
     JS::Zone* zone() const override;
 
   public:
     js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
 
   protected:
     explicit TracerConcrete(Referent* ptr) : Base(ptr) { }
     Referent& get() const { return *static_cast<Referent*>(ptr); }
 };
 
 // For JS::TraceChildren-based types that have 'realm' and 'compartment'
 // methods.
 template<typename Referent>
-class JS_PUBLIC_API(TracerConcreteWithRealm) : public TracerConcrete<Referent> {
+class JS_PUBLIC_API TracerConcreteWithRealm : public TracerConcrete<Referent> {
     typedef TracerConcrete<Referent> TracerBase;
     JS::Compartment* compartment() const override;
     JS::Realm* realm() const override;
 
   protected:
     explicit TracerConcreteWithRealm(Referent* ptr) : TracerBase(ptr) { }
 };
 
 // Define specializations for some commonly-used public JSAPI types.
 // These can use the generic templates above.
 template<>
-class JS_PUBLIC_API(Concrete<JS::Symbol>) : TracerConcrete<JS::Symbol> {
+class JS_PUBLIC_API Concrete<JS::Symbol> : TracerConcrete<JS::Symbol> {
   protected:
     explicit Concrete(JS::Symbol* ptr) : TracerConcrete(ptr) { }
 
   public:
     static void construct(void* storage, JS::Symbol* ptr) {
         new (storage) Concrete(ptr);
     }
 
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 #ifdef ENABLE_BIGINT
 template<>
-class JS_PUBLIC_API(Concrete<JS::BigInt>) : TracerConcrete<JS::BigInt> {
+class JS_PUBLIC_API Concrete<JS::BigInt> : TracerConcrete<JS::BigInt> {
   protected:
     explicit Concrete(JS::BigInt* ptr) : TracerConcrete(ptr) {}
 
   public:
     static void construct(void* storage, JS::BigInt* ptr) {
         new (storage) Concrete(ptr);
     }
 
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 #endif
 
 template<>
-class JS_PUBLIC_API(Concrete<JSScript>) : TracerConcreteWithRealm<JSScript> {
+class JS_PUBLIC_API Concrete<JSScript> : TracerConcreteWithRealm<JSScript> {
   protected:
     explicit Concrete(JSScript *ptr) : TracerConcreteWithRealm<JSScript>(ptr) { }
 
   public:
     static void construct(void *storage, JSScript *ptr) { new (storage) Concrete(ptr); }
 
     CoarseType coarseType() const final { return CoarseType::Script; }
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
     const char* scriptFilename() const final;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // The JSObject specialization.
 template<>
-class JS_PUBLIC_API(Concrete<JSObject>) : public TracerConcrete<JSObject> {
+class JS_PUBLIC_API Concrete<JSObject> : public TracerConcrete<JSObject> {
   protected:
     explicit Concrete(JSObject* ptr) : TracerConcrete<JSObject>(ptr) { }
 
   public:
     static void construct(void* storage, JSObject* ptr);
 
     JS::Compartment* compartment() const override;
     JS::Realm* realm() const override;
@@ -1136,34 +1136,34 @@ class JS_PUBLIC_API(Concrete<JSObject>) 
     CoarseType coarseType() const final { return CoarseType::Object; }
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // For JSString, we extend the generic template with a 'size' implementation.
 template<>
-class JS_PUBLIC_API(Concrete<JSString>) : TracerConcrete<JSString> {
+class JS_PUBLIC_API Concrete<JSString> : TracerConcrete<JSString> {
   protected:
     explicit Concrete(JSString *ptr) : TracerConcrete<JSString>(ptr) { }
 
   public:
     static void construct(void *storage, JSString *ptr) { new (storage) Concrete(ptr); }
 
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
 
     CoarseType coarseType() const final { return CoarseType::String; }
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // The ubi::Node null pointer. Any attempt to operate on a null ubi::Node asserts.
 template<>
-class JS_PUBLIC_API(Concrete<void>) : public Base {
+class JS_PUBLIC_API Concrete<void> : public Base {
     const char16_t* typeName() const override;
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
     js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
     JS::Zone* zone() const override;
     JS::Compartment* compartment() const override;
     JS::Realm* realm() const override;
     CoarseType coarseType() const final;
 
--- a/js/public/UbiNodeCensus.h
+++ b/js/public/UbiNodeCensus.h
@@ -83,17 +83,17 @@
 namespace JS {
 namespace ubi {
 
 struct Census;
 
 class CountBase;
 
 struct CountDeleter {
-    JS_PUBLIC_API(void) operator()(CountBase*);
+    JS_PUBLIC_API void operator()(CountBase*);
 };
 
 using CountBasePtr = js::UniquePtr<CountBase, CountDeleter>;
 
 // Abstract base class for CountType nodes.
 struct CountType {
     explicit CountType() { }
     virtual ~CountType() { }
@@ -224,31 +224,31 @@ class CensusHandler {
 
     MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
         return rootCount->report(cx, report);
     }
 
     // This class needs to retain no per-node data.
     class NodeData { };
 
-    MOZ_MUST_USE JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
-                                                 Node origin, const Edge& edge,
-                                                 NodeData* referentData, bool first);
+    MOZ_MUST_USE JS_PUBLIC_API bool operator() (BreadthFirst<CensusHandler>& traversal,
+                                                Node origin, const Edge& edge,
+                                                NodeData* referentData, bool first);
 };
 
 using CensusTraversal = BreadthFirst<CensusHandler>;
 
 // Examine the census options supplied by the API consumer, and (among other
 // things) use that to build a CountType tree.
-MOZ_MUST_USE JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
-                                                    Census& census, HandleObject options,
-                                                    CountTypePtr& outResult);
+MOZ_MUST_USE JS_PUBLIC_API bool ParseCensusOptions(JSContext* cx,
+                                                   Census& census, HandleObject options,
+                                                   CountTypePtr& outResult);
 
 // Parse the breakdown language (as described in
 // js/src/doc/Debugger/Debugger.Memory.md) into a CountTypePtr. A null pointer
 // is returned on error and is reported to the cx.
-JS_PUBLIC_API(CountTypePtr) ParseBreakdown(JSContext* cx, HandleValue breakdownValue);
+JS_PUBLIC_API CountTypePtr ParseBreakdown(JSContext* cx, HandleValue breakdownValue);
 
 
 } // namespace ubi
 } // namespace JS
 
 #endif // js_UbiNodeCensus_h
--- a/js/public/UbiNodeDominatorTree.h
+++ b/js/public/UbiNodeDominatorTree.h
@@ -61,17 +61,17 @@ namespace ubi {
  * is that Cooper et al found it is faster in practice *on control flow graphs*
  * and I'm not convinced that this property also holds on *heap* graphs. That
  * said, the implementation of this algorithm is *much* simpler than
  * Lengauer-Tarjan and has been found to be fast enough at least for the time
  * being.
  *
  * [0]: http://www.cs.rice.edu/~keith/EMBED/dom.pdf
  */
-class JS_PUBLIC_API(DominatorTree)
+class JS_PUBLIC_API DominatorTree
 {
   private:
     // Types.
 
     using PredecessorSets = js::HashMap<Node, NodeSetPtr, js::DefaultHasher<Node>,
                                         js::SystemAllocPolicy>;
     using NodeToIndexMap = js::HashMap<Node, uint32_t, js::DefaultHasher<Node>,
                                        js::SystemAllocPolicy>;
--- a/js/public/UbiNodeShortestPaths.h
+++ b/js/public/UbiNodeShortestPaths.h
@@ -17,17 +17,17 @@
 #include "js/Vector.h"
 
 namespace JS {
 namespace ubi {
 
 /**
  * A back edge along a path in the heap graph.
  */
-struct JS_PUBLIC_API(BackEdge)
+struct JS_PUBLIC_API BackEdge
 {
   private:
     Node predecessor_;
     EdgeName name_;
 
   public:
     using Ptr = js::UniquePtr<BackEdge>;
 
@@ -71,17 +71,17 @@ struct JS_PUBLIC_API(BackEdge)
  */
 using Path = JS::ubi::Vector<BackEdge*>;
 
 /**
  * The `JS::ubi::ShortestPaths` type represents a collection of up to N shortest
  * retaining paths for each of a target set of nodes, starting from the same
  * root node.
  */
-struct JS_PUBLIC_API(ShortestPaths)
+struct JS_PUBLIC_API ShortestPaths
 {
   private:
     // Types, type aliases, and data members.
 
     using BackEdgeVector = JS::ubi::Vector<BackEdge::Ptr>;
     using NodeToBackEdgeVectorMap = js::HashMap<Node, BackEdgeVector, js::DefaultHasher<Node>,
                                                 js::SystemAllocPolicy>;
 
@@ -334,16 +334,16 @@ struct JS_PUBLIC_API(ShortestPaths)
 // A helper function to dump the first `maxNumPaths` shortest retaining paths to
 // `node` from the GC roots. Useful when GC things you expect to have been
 // reclaimed by the collector haven't been!
 //
 // Usage:
 //
 //     JSObject* foo = ...;
 //     JS::ubi::dumpPaths(rt, JS::ubi::Node(foo));
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 dumpPaths(JSRuntime* rt, Node node, uint32_t maxNumPaths = 10);
 #endif
 
 } // namespace ubi
 } // namespace JS
 
 #endif // js_UbiNodeShortestPaths_h
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -34,17 +34,17 @@ namespace JS {}
 namespace mozilla {}
 
 /* The private JS engine namespace. */
 namespace js {}
 
 #define JS_STATIC_ASSERT(cond)           static_assert(cond, "JS_STATIC_ASSERT")
 #define JS_STATIC_ASSERT_IF(cond, expr)  MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF")
 
-extern MOZ_NORETURN MOZ_COLD JS_PUBLIC_API(void)
+extern MOZ_NORETURN MOZ_COLD JS_PUBLIC_API void
 JS_Assert(const char* s, const char* file, int ln);
 
 /*
  * Custom allocator support for SpiderMonkey
  */
 #if defined JS_USE_CUSTOM_ALLOCATOR
 # include "jscustomallocator.h"
 #else
@@ -90,17 +90,17 @@ namespace oom {
 
 // Define the range of threads tested by simulated OOM testing and the
 // like. Testing worker threads is not supported.
 const ThreadType FirstThreadTypeToTest = THREAD_TYPE_MAIN;
 const ThreadType LastThreadTypeToTest = THREAD_TYPE_WASM_TIER2;
 
 extern bool InitThreadType(void);
 extern void SetThreadType(ThreadType);
-extern JS_FRIEND_API(uint32_t) GetThreadType(void);
+extern JS_FRIEND_API uint32_t GetThreadType(void);
 
 # else
 
 inline bool InitThreadType(void) { return true; }
 inline void SetThreadType(ThreadType t) {};
 inline uint32_t GetThreadType(void) { return 0; }
 inline uint32_t GetAllocationThreadType(void) { return 0; }
 inline uint32_t GetStackCheckThreadType(void) { return 0; }
@@ -183,17 +183,17 @@ class FailureSimulator
             return true;
         }
         return false;
     }
 
     void simulateFailureAfter(Kind kind, uint64_t checks, uint32_t thread, bool always);
     void reset();
 };
-extern JS_PUBLIC_DATA(FailureSimulator) simulator;
+extern JS_PUBLIC_DATA FailureSimulator simulator;
 
 inline bool
 IsSimulatedOOMAllocation()
 {
     return simulator.isSimulatedFailure(FailureSimulator::Kind::OOM);
 }
 
 inline bool
@@ -303,17 +303,17 @@ static inline bool ShouldFailWithOOM() {
 } /* namespace oom */
 } /* namespace js */
 
 # endif /* DEBUG || JS_OOM_BREAKPOINT */
 
 namespace js {
 
 /* Disable OOM testing in sections which are not OOM safe. */
-struct MOZ_RAII JS_PUBLIC_DATA(AutoEnterOOMUnsafeRegion)
+struct MOZ_RAII JS_PUBLIC_DATA AutoEnterOOMUnsafeRegion
 {
     MOZ_NORETURN MOZ_COLD void crash(const char* reason);
     MOZ_NORETURN MOZ_COLD void crash(size_t size, const char* reason);
 
     using AnnotateOOMAllocationSizeCallback = void(*)(size_t);
     static AnnotateOOMAllocationSizeCallback annotateOOMSizeCallback;
     static void setAnnotateOOMAllocationSizeCallback(AnnotateOOMAllocationSizeCallback callback) {
         annotateOOMSizeCallback = callback;
@@ -345,18 +345,18 @@ struct MOZ_RAII JS_PUBLIC_DATA(AutoEnter
 };
 
 } /* namespace js */
 
 // Malloc allocation.
 
 namespace js {
 
-extern JS_PUBLIC_DATA(arena_id_t) MallocArena;
-extern JS_PUBLIC_DATA(arena_id_t) ArrayBufferContentsArena;
+extern JS_PUBLIC_DATA arena_id_t MallocArena;
+extern JS_PUBLIC_DATA arena_id_t ArrayBufferContentsArena;
 
 extern void InitMallocAllocator();
 extern void ShutDownMallocAllocator();
 
 } /* namespace js */
 
 static inline void* js_arena_malloc(arena_id_t arena, size_t bytes)
 {
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1241,17 +1241,17 @@ SameType(const Value& lhs, const Value& 
 #endif
 }
 
 } // namespace JS
 
 /************************************************************************/
 
 namespace JS {
-JS_PUBLIC_API(void) HeapValuePostBarrier(Value* valuep, const Value& prev, const Value& next);
+JS_PUBLIC_API void HeapValuePostBarrier(Value* valuep, const Value& prev, const Value& next);
 
 template <>
 struct GCPolicy<JS::Value>
 {
     static void trace(JSTracer* trc, Value* v, const char* name) {
         js::UnsafeTraceManuallyBarrieredEdge(trc, v, name);
     }
     static bool isTenured(const Value& thing) {
@@ -1504,16 +1504,16 @@ ValueIsNotGray(const Heap<Value>& value)
 
 } // namespace JS
 #endif
 
 /************************************************************************/
 
 namespace JS {
 
-extern JS_PUBLIC_DATA(const HandleValue) NullHandleValue;
-extern JS_PUBLIC_DATA(const HandleValue) UndefinedHandleValue;
-extern JS_PUBLIC_DATA(const HandleValue) TrueHandleValue;
-extern JS_PUBLIC_DATA(const HandleValue) FalseHandleValue;
+extern JS_PUBLIC_DATA const HandleValue NullHandleValue;
+extern JS_PUBLIC_DATA const HandleValue UndefinedHandleValue;
+extern JS_PUBLIC_DATA const HandleValue TrueHandleValue;
+extern JS_PUBLIC_DATA const HandleValue FalseHandleValue;
 
 } // namespace JS
 
 #endif /* js_Value_h */
--- a/js/public/WeakMapPtr.h
+++ b/js/public/WeakMapPtr.h
@@ -15,17 +15,17 @@ namespace JS {
 
 // A wrapper around the internal C++ representation of SpiderMonkey WeakMaps,
 // usable outside the engine.
 //
 // The supported template specializations are enumerated in gc/WeakMapPtr.cpp.
 // If you want to use this class for a different key/value combination, add it
 // to the list and the compiler will generate the relevant machinery.
 template <typename K, typename V>
-class JS_PUBLIC_API(WeakMapPtr)
+class JS_PUBLIC_API WeakMapPtr
 {
   public:
     WeakMapPtr() : ptr(nullptr) {}
     bool init(JSContext* cx);
     bool initialized() { return ptr != nullptr; }
     void destroy();
     virtual ~WeakMapPtr() { MOZ_ASSERT(!initialized()); }
     void trace(JSTracer* tracer);
--- a/js/public/Wrapper.h
+++ b/js/public/Wrapper.h
@@ -39,17 +39,17 @@ class MOZ_STACK_CLASS WrapperOptions : p
     }
 
   private:
     mozilla::Maybe<JS::RootedObject> proto_;
 };
 
 // Base class for proxy handlers that want to forward all operations to an
 // object stored in the proxy's private slot.
-class JS_FRIEND_API(ForwardingProxyHandler) : public BaseProxyHandler
+class JS_FRIEND_API ForwardingProxyHandler : public BaseProxyHandler
 {
   public:
     using BaseProxyHandler::BaseProxyHandler;
 
     /* Standard internal methods. */
     virtual bool getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
                                           MutableHandle<PropertyDescriptor> desc) const override;
     virtual bool defineProperty(JSContext* cx, HandleObject proxy, HandleId id,
@@ -112,17 +112,17 @@ class JS_FRIEND_API(ForwardingProxyHandl
  * A wrapper can be "unwrapped" in C++, exposing the underlying object.
  * Callers should be careful to avoid unwrapping security wrappers in the wrong
  * context.
  *
  * Important: If you add a method implementation here, you probably also need
  * to add an override in CrossCompartmentWrapper. If you don't, you risk
  * compartment mismatches. See bug 945826 comment 0.
  */
-class JS_FRIEND_API(Wrapper) : public ForwardingProxyHandler
+class JS_FRIEND_API Wrapper : public ForwardingProxyHandler
 {
     unsigned mFlags;
 
   public:
     explicit constexpr Wrapper(unsigned aFlags, bool aHasPrototype = false,
                                bool aHasSecurityPolicy = false)
       : ForwardingProxyHandler(&family, aHasPrototype, aHasSecurityPolicy),
         mFlags(aFlags)
@@ -160,17 +160,17 @@ class JS_FRIEND_API(Wrapper) : public Fo
 
 inline JSObject*
 WrapperOptions::proto() const
 {
     return proto_ ? *proto_ : Wrapper::defaultProto;
 }
 
 /* Base class for all cross compartment wrapper handlers. */
-class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
+class JS_FRIEND_API CrossCompartmentWrapper : public Wrapper
 {
   public:
     explicit constexpr CrossCompartmentWrapper(unsigned aFlags, bool aHasPrototype = false,
                                                    bool aHasSecurityPolicy = false)
       : Wrapper(CROSS_COMPARTMENT | aFlags, aHasPrototype, aHasSecurityPolicy)
     { }
 
     /* Standard internal methods. */
@@ -222,17 +222,17 @@ class JS_FRIEND_API(CrossCompartmentWrap
 
     // Allocate CrossCompartmentWrappers in the nursery.
     virtual bool canNurseryAllocate() const override { return true; }
 
     static const CrossCompartmentWrapper singleton;
     static const CrossCompartmentWrapper singletonWithPrototype;
 };
 
-class JS_FRIEND_API(OpaqueCrossCompartmentWrapper) : public CrossCompartmentWrapper
+class JS_FRIEND_API OpaqueCrossCompartmentWrapper : public CrossCompartmentWrapper
 {
   public:
     explicit constexpr OpaqueCrossCompartmentWrapper() : CrossCompartmentWrapper(0)
     { }
 
     /* Standard internal methods. */
     virtual bool getOwnPropertyDescriptor(JSContext* cx, HandleObject wrapper, HandleId id,
                                           MutableHandle<PropertyDescriptor> desc) const override;
@@ -286,17 +286,17 @@ class JS_FRIEND_API(OpaqueCrossCompartme
  * all or part of some wrapped object thus SecurityWrapper defaults to denying
  * access to the wrappee. This is the opposite of Wrapper which tries to be
  * completely transparent.
  *
  * NB: Currently, only a few ProxyHandler operations are overridden to deny
  * access, relying on derived SecurityWrapper to block access when necessary.
  */
 template <class Base>
-class JS_FRIEND_API(SecurityWrapper) : public Base
+class JS_FRIEND_API SecurityWrapper : public Base
 {
   public:
     explicit constexpr SecurityWrapper(unsigned flags, bool hasPrototype = false)
       : Base(flags, hasPrototype, /* hasSecurityPolicy = */ true)
     { }
 
     virtual bool enter(JSContext* cx, HandleObject wrapper, HandleId id, Wrapper::Action act,
                        bool mayThrow, bool* bp) const override;
@@ -357,57 +357,57 @@ Wrapper::wrapperHandler(const JSObject* 
 // Given a JSObject, returns that object stripped of wrappers. If
 // stopAtWindowProxy is true, then this returns the WindowProxy if it was
 // previously wrapped. Otherwise, this returns the first object for which
 // JSObject::isWrapper returns false.
 //
 // ExposeToActiveJS is called on wrapper targets to allow gray marking
 // assertions to work while an incremental GC is in progress, but this means
 // that this cannot be called from the GC or off the main thread.
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 UncheckedUnwrap(JSObject* obj, bool stopAtWindowProxy = true, unsigned* flagsp = nullptr);
 
 // Given a JSObject, returns that object stripped of wrappers. At each stage,
 // the security wrapper has the opportunity to veto the unwrap. If
 // stopAtWindowProxy is true, then this returns the WindowProxy if it was
 // previously wrapped.
 //
 // ExposeToActiveJS is called on wrapper targets to allow gray marking
 // assertions to work while an incremental GC is in progress, but this means
 // that this cannot be called from the GC or off the main thread.
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 CheckedUnwrap(JSObject* obj, bool stopAtWindowProxy = true);
 
 // Unwrap only the outermost security wrapper, with the same semantics as
 // above. This is the checked version of Wrapper::wrappedObject.
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 UnwrapOneChecked(JSObject* obj, bool stopAtWindowProxy = true);
 
 // Given a JSObject, returns that object stripped of wrappers. This returns the
 // WindowProxy if it was previously wrapped.
 //
 // ExposeToActiveJS is not called on wrapper targets so this can be called from
 // the GC or off the main thread.
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 UncheckedUnwrapWithoutExpose(JSObject* obj);
 
 void
 ReportAccessDenied(JSContext* cx);
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 NukeCrossCompartmentWrapper(JSContext* cx, JSObject* wrapper);
 
 void
 RemapWrapper(JSContext* cx, JSObject* wobj, JSObject* newTarget);
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 RemapAllWrappersForObject(JSContext* cx, JSObject* oldTarget,
                           JSObject* newTarget);
 
 // API to recompute all cross-compartment wrappers whose source and target
 // match the given filters.
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 RecomputeWrappers(JSContext* cx, const CompartmentFilter& sourceFilter,
                   const CompartmentFilter& targetFilter);
 
 } /* namespace js */
 
 #endif /* js_Wrapper_h */
--- a/js/src/.clang-format
+++ b/js/src/.clang-format
@@ -1,12 +1,9 @@
-# Clang-format style for SpiderMonkey code which is different than the standard Mozilla style.
-BasedOnStyle: Mozilla
-ColumnLimit: 99
-IndentWidth: 4
+BasedOnStyle: Google
 
 # Prevent the loss of indentation with these macros
 MacroBlockBegin: "^JS_BEGIN_MACRO$"
 MacroBlockEnd: "^JS_END_MACRO$"
 
 # Ignore all comments because they aren't reflowed properly.
 # We require 80-col comments and 99-col code.
 CommentPragmas: "^"
--- a/js/src/builtin/Array.cpp
+++ b/js/src/builtin/Array.cpp
@@ -255,32 +255,32 @@ StringIsArrayIndexHelper(const CharT* s,
         MOZ_ASSERT(index <= MAX_ARRAY_INDEX);
         *indexp = index;
         return true;
     }
 
     return false;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::StringIsArrayIndex(JSLinearString* str, uint32_t* indexp)
 {
     AutoCheckCannotGC nogc;
     return str->hasLatin1Chars()
            ? StringIsArrayIndexHelper(str->latin1Chars(nogc), str->length(), indexp)
            : StringIsArrayIndexHelper(str->twoByteChars(nogc), str->length(), indexp);
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::StringIsArrayIndex(const char16_t* str, uint32_t length, uint32_t* indexp)
 {
     return StringIsArrayIndexHelper(str, length, indexp);
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::StringIsArrayIndex(const char* str, uint32_t length, uint32_t* indexp)
 {
     return StringIsArrayIndexHelper(str, length, indexp);
 }
 
 template <typename T>
 static bool
 ToId(JSContext* cx, T index, MutableHandleId id);
--- a/js/src/builtin/Boolean.cpp
+++ b/js/src/builtin/Boolean.cpp
@@ -166,17 +166,17 @@ js::InitBooleanClass(JSContext* cx, Hand
 }
 
 JSString*
 js::BooleanToString(JSContext* cx, bool b)
 {
     return b ? cx->names().true_ : cx->names().false_;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 js::ToBooleanSlow(HandleValue v)
 {
     if (v.isString()) {
         return v.toString()->length() != 0;
     }
 #ifdef ENABLE_BIGINT
     if (v.isBigInt()) {
         return v.toBigInt()->toBoolean();
--- a/js/src/builtin/DataViewObject.cpp
+++ b/js/src/builtin/DataViewObject.cpp
@@ -952,49 +952,49 @@ const JSFunctionSpec DataViewObject::met
 const JSPropertySpec DataViewObject::properties[] = {
     JS_PSG("buffer", DataViewObject::bufferGetter, 0),
     JS_PSG("byteLength", DataViewObject::byteLengthGetter, 0),
     JS_PSG("byteOffset", DataViewObject::byteOffsetGetter, 0),
     JS_STRING_SYM_PS(toStringTag, "DataView", JSPROP_READONLY),
     JS_PS_END
 };
 
-JS_FRIEND_API(uint32_t)
+JS_FRIEND_API uint32_t
 JS_GetDataViewByteOffset(JSObject* obj)
 {
     obj = CheckedUnwrap(obj);
     if (!obj) {
         return 0;
     }
     return obj->as<DataViewObject>().byteOffset();
 }
 
-JS_FRIEND_API(void*)
+JS_FRIEND_API void*
 JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
 {
     obj = CheckedUnwrap(obj);
     if (!obj) {
         return nullptr;
     }
     DataViewObject& dv = obj->as<DataViewObject>();
     *isSharedMemory = dv.isSharedMemory();
     return dv.dataPointerEither().unwrap(/*safe - caller sees isSharedMemory*/);
 }
 
-JS_FRIEND_API(uint32_t)
+JS_FRIEND_API uint32_t
 JS_GetDataViewByteLength(JSObject* obj)
 {
     obj = CheckedUnwrap(obj);
     if (!obj) {
         return 0;
     }
     return obj->as<DataViewObject>().byteLength();
 }
 
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 JS_NewDataView(JSContext* cx, HandleObject buffer, uint32_t byteOffset, int32_t byteLength)
 {
     JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(&DataViewObject::class_);
     RootedObject constructor(cx, GlobalObject::getOrCreateConstructor(cx, key));
     if (!constructor) {
         return nullptr;
     }
 
--- a/js/src/builtin/Eval.cpp
+++ b/js/src/builtin/Eval.cpp
@@ -485,17 +485,17 @@ ExecuteInExtensibleLexicalEnvironment(JS
         Debugger::onNewScript(cx, script);
     }
 
     RootedValue rval(cx);
     return ExecuteKernel(cx, script, *env, UndefinedValue(),
                          NullFramePtr() /* evalInFrame */, rval.address());
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::ExecuteInFrameScriptEnvironment(JSContext* cx, HandleObject objArg, HandleScript scriptArg,
                                     MutableHandleObject envArg)
 {
     RootedObject varEnv(cx, NonSyntacticVariablesObject::create(cx));
     if (!varEnv) {
         return false;
     }
 
@@ -523,17 +523,17 @@ js::ExecuteInFrameScriptEnvironment(JSCo
     if (!ExecuteInExtensibleLexicalEnvironment(cx, scriptArg, env)) {
         return false;
     }
 
     envArg.set(env);
     return true;
 }
 
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 js::NewJSMEnvironment(JSContext* cx)
 {
     RootedObject varEnv(cx, NonSyntacticVariablesObject::create(cx));
     if (!varEnv) {
         return nullptr;
     }
 
     // Force LexicalEnvironmentObject to be created.
@@ -541,24 +541,24 @@ js::NewJSMEnvironment(JSContext* cx)
     MOZ_ASSERT(!realm.getNonSyntacticLexicalEnvironment(varEnv));
     if (!realm.getOrCreateNonSyntacticLexicalEnvironment(cx, varEnv)) {
         return nullptr;
     }
 
     return varEnv;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::ExecuteInJSMEnvironment(JSContext* cx, HandleScript scriptArg, HandleObject varEnv)
 {
     AutoObjectVector emptyChain(cx);
     return ExecuteInJSMEnvironment(cx, scriptArg, varEnv, emptyChain);
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::ExecuteInJSMEnvironment(JSContext* cx, HandleScript scriptArg, HandleObject varEnv,
                             AutoObjectVector& targetObj)
 {
     cx->check(varEnv);
     MOZ_ASSERT(ObjectRealm::get(varEnv).getNonSyntacticLexicalEnvironment(varEnv));
     MOZ_DIAGNOSTIC_ASSERT(scriptArg->noScriptRval());
 
     RootedObject env(cx, JS_ExtensibleLexicalEnvironment(varEnv));
@@ -593,17 +593,17 @@ js::ExecuteInJSMEnvironment(JSContext* c
         if (!env) {
             return false;
         }
     }
 
     return ExecuteInExtensibleLexicalEnvironment(cx, scriptArg, env);
 }
 
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 js::GetJSMEnvironmentOfScriptedCaller(JSContext* cx)
 {
     FrameIter iter(cx);
     if (iter.done()) {
         return nullptr;
     }
 
     // WASM frames don't always provide their environment, but we also shouldn't
@@ -613,15 +613,15 @@ js::GetJSMEnvironmentOfScriptedCaller(JS
     RootedObject env(cx, iter.environmentChain(cx));
     while (env && !env->is<NonSyntacticVariablesObject>()) {
         env = env->enclosingEnvironment();
     }
 
     return env;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::IsJSMEnvironment(JSObject* obj)
 {
     // NOTE: This also returns true if the NonSyntacticVariablesObject was
     // created for reasons other than the JSM loader.
     return obj->is<NonSyntacticVariablesObject>();
 }
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -1837,29 +1837,29 @@ CallObjFunc(bool(*ObjFunc)(JSContext* cx
             return false;
         }
     }
     return true;
 }
 
 /*** JS public APIs **********************************************************/
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::NewMapObject(JSContext* cx)
 {
     return MapObject::create(cx);
 }
 
-JS_PUBLIC_API(uint32_t)
+JS_PUBLIC_API uint32_t
 JS::MapSize(JSContext* cx, HandleObject obj)
 {
     return CallObjFunc<uint32_t>(&MapObject::size, cx, obj);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapGet(JSContext* cx, HandleObject obj, HandleValue key, MutableHandleValue rval)
 {
     CHECK_THREAD(cx);
     cx->check(obj, key, rval);
 
     // Unwrap the object, and enter its realm. If object isn't wrapped,
     // this is essentially a noop.
     RootedObject unwrappedObj(cx);
@@ -1883,17 +1883,17 @@ JS::MapGet(JSContext* cx, HandleObject o
     if (obj != unwrappedObj) {
         if (!JS_WrapValue(cx, rval)) {
             return false;
         }
     }
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapSet(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val)
 {
     CHECK_THREAD(cx);
     cx->check(obj, key, val);
 
     // Unwrap the object, and enter its compartment. If object isn't wrapped,
     // this is essentially a noop.
     RootedObject unwrappedObj(cx);
@@ -1910,71 +1910,71 @@ JS::MapSet(JSContext *cx, HandleObject o
                 !JS_WrapValue(cx, &wrappedValue)) {
                 return false;
             }
         }
         return MapObject::set(cx, unwrappedObj, wrappedKey, wrappedValue);
     }
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapHas(JSContext* cx, HandleObject obj, HandleValue key, bool* rval)
 {
     return CallObjFunc(MapObject::has, cx, obj, key, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapDelete(JSContext *cx, HandleObject obj, HandleValue key, bool* rval)
 {
     return CallObjFunc(MapObject::delete_, cx, obj, key, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapClear(JSContext* cx, HandleObject obj)
 {
     return CallObjFunc(&MapObject::clear, cx, obj);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapKeys(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return CallObjFunc(&MapObject::iterator, cx, MapObject::Keys, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapValues(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return CallObjFunc(&MapObject::iterator, cx, MapObject::Values, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapEntries(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return CallObjFunc(&MapObject::iterator, cx, MapObject::Entries, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::MapForEach(JSContext *cx, HandleObject obj, HandleValue callbackFn, HandleValue thisVal)
 {
     return forEach("MapForEach", cx, obj, callbackFn, thisVal);
 }
 
-JS_PUBLIC_API(JSObject *)
+JS_PUBLIC_API JSObject *
 JS::NewSetObject(JSContext *cx)
 {
     return SetObject::create(cx);
 }
 
-JS_PUBLIC_API(uint32_t)
+JS_PUBLIC_API uint32_t
 JS::SetSize(JSContext *cx, HandleObject obj)
 {
     return CallObjFunc<uint32_t>(&SetObject::size, cx, obj);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetAdd(JSContext *cx, HandleObject obj, HandleValue key)
 {
     CHECK_THREAD(cx);
     cx->check(obj, key);
 
     // Unwrap the object, and enter its compartment. If object isn't wrapped,
     // this is essentially a noop.
     RootedObject unwrappedObj(cx);
@@ -1988,49 +1988,49 @@ JS::SetAdd(JSContext *cx, HandleObject o
             if (!JS_WrapValue(cx, &wrappedKey)) {
                 return false;
             }
         }
         return SetObject::add(cx, unwrappedObj, wrappedKey);
     }
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetHas(JSContext* cx, HandleObject obj, HandleValue key, bool* rval)
 {
     return CallObjFunc(SetObject::has, cx, obj, key, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetDelete(JSContext *cx, HandleObject obj, HandleValue key, bool *rval)
 {
     return CallObjFunc(SetObject::delete_, cx, obj, key, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetClear(JSContext* cx, HandleObject obj)
 {
     return CallObjFunc(&SetObject::clear, cx, obj);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetKeys(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return SetValues(cx, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetValues(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return CallObjFunc(&SetObject::iterator, cx, SetObject::Values, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetEntries(JSContext* cx, HandleObject obj, MutableHandleValue rval)
 {
     return CallObjFunc(&SetObject::iterator, cx, SetObject::Entries, obj, rval);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetForEach(JSContext *cx, HandleObject obj, HandleValue callbackFn, HandleValue thisVal)
 {
     return forEach("SetForEach", cx, obj, callbackFn, thisVal);
 }
--- a/js/src/builtin/Profilers.cpp
+++ b/js/src/builtin/Profilers.cpp
@@ -50,17 +50,17 @@ UnsafeError(const char* format, ...)
 {
     va_list args;
     va_start(args, format);
     (void) VsprintfLiteral(gLastError, format, args);
     va_end(args);
 }
 #endif
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS_UnsafeGetLastProfilingError()
 {
     return gLastError;
 }
 
 #ifdef __APPLE__
 static bool
 StartOSXProfiling(const char* profileName, pid_t pid)
@@ -78,32 +78,32 @@ StartOSXProfiling(const char* profileNam
             UnsafeError("Failed to start %s", profiler);
         }
         return false;
     }
     return true;
 }
 #endif
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_StartProfiling(const char* profileName, pid_t pid)
 {
     bool ok = true;
 #ifdef __APPLE__
     ok = StartOSXProfiling(profileName, pid);
 #endif
 #ifdef __linux__
     if (!js_StartPerf()) {
         ok = false;
     }
 #endif
     return ok;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_StopProfiling(const char* profileName)
 {
     bool ok = true;
 #ifdef __APPLE__
 #ifdef MOZ_INSTRUMENTS
     Instruments::Stop(profileName);
 #endif
 #endif
@@ -165,29 +165,29 @@ ControlProfilers(bool toState)
 /*
  * Pause/resume whatever profiling mechanism is currently compiled
  * in, if applicable. This will not affect things like dtrace.
  *
  * Do not mix calls to these APIs with calls to the individual
  * profilers' pause/resume functions, because only overall state is
  * tracked, not the state of each profiler.
  */
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_PauseProfilers(const char* profileName)
 {
     return ControlProfilers(false);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ResumeProfilers(const char* profileName)
 {
     return ControlProfilers(true);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_DumpProfile(const char* outfile, const char* profileName)
 {
     bool ok = true;
 #ifdef MOZ_CALLGRIND
     ok = js_DumpCallgrind(outfile);
 #endif
     return ok;
 }
@@ -403,17 +403,17 @@ static const JSFunctionSpec profiling_fu
     JS_FN("stopCallgrind",  StopCallgrind,        0,0),
     JS_FN("dumpCallgrind",  DumpCallgrind,        1,0),
 #endif
     JS_FS_END
 };
 
 #endif
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_DefineProfilingFunctions(JSContext* cx, HandleObject obj)
 {
     cx->check(obj);
 #ifdef MOZ_PROFILING
     return JS_DefineFunctions(cx, obj, profiling_functions);
 #else
     return true;
 #endif
@@ -444,32 +444,32 @@ JS_DefineProfilingFunctions(JSContext* c
 
 #if !defined(JS_SILENCE_UNUSED_VALUE_IN_EXPR)
 # define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr)                                \
     JS_BEGIN_MACRO                                                            \
         expr;                                                                 \
     JS_END_MACRO
 #endif
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js_StartCallgrind()
 {
     JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_START_INSTRUMENTATION);
     JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_ZERO_STATS);
     return true;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js_StopCallgrind()
 {
     JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_STOP_INSTRUMENTATION);
     return true;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js_DumpCallgrind(const char* outfile)
 {
     if (outfile) {
         JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS_AT(outfile));
     } else {
         JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS);
     }
 
--- a/js/src/builtin/Profilers.h
+++ b/js/src/builtin/Profilers.h
@@ -25,71 +25,71 @@ typedef int pid_t;
  *
  * The profileName is used by some profilers to describe the current profiling
  * run. It may be used for part of the filename of the output, but the
  * specifics depend on the profiler. Many profilers will ignore it. Passing in
  * nullptr is legal; some profilers may use it to output to stdout or similar.
  *
  * Returns true if no profilers fail to start.
  */
-extern MOZ_MUST_USE JS_PUBLIC_API(bool)
+extern MOZ_MUST_USE JS_PUBLIC_API bool
 JS_StartProfiling(const char* profileName, pid_t pid);
 
 /**
  * Stop any profilers that were previously started with JS_StartProfiling.
  * Returns true if no profilers fail to stop.
  */
-extern MOZ_MUST_USE JS_PUBLIC_API(bool)
+extern MOZ_MUST_USE JS_PUBLIC_API bool
 JS_StopProfiling(const char* profileName);
 
 /**
  * Write the current profile data to the given file, if applicable to whatever
  * profiler is being used.
  */
-extern MOZ_MUST_USE JS_PUBLIC_API(bool)
+extern MOZ_MUST_USE JS_PUBLIC_API bool
 JS_DumpProfile(const char* outfile, const char* profileName);
 
 /**
  * Pause currently active profilers (only supported by some profilers). Returns
  * whether any profilers failed to pause. (Profilers that do not support
  * pause/resume do not count.)
  */
-extern MOZ_MUST_USE JS_PUBLIC_API(bool)
+extern MOZ_MUST_USE JS_PUBLIC_API bool
 JS_PauseProfilers(const char* profileName);
 
 /**
  * Resume suspended profilers
  */
-extern MOZ_MUST_USE JS_PUBLIC_API(bool)
+extern MOZ_MUST_USE JS_PUBLIC_API bool
 JS_ResumeProfilers(const char* profileName);
 
 /**
  * The profiling API calls are not able to report errors, so they use a
  * thread-unsafe global memory buffer to hold the last error encountered. This
  * should only be called after something returns false.
  */
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS_UnsafeGetLastProfilingError();
 
 #ifdef MOZ_CALLGRIND
 
-extern MOZ_MUST_USE JS_FRIEND_API(bool)
+extern MOZ_MUST_USE JS_FRIEND_API bool
 js_StopCallgrind();
 
-extern MOZ_MUST_USE JS_FRIEND_API(bool)
+extern MOZ_MUST_USE JS_FRIEND_API bool
 js_StartCallgrind();
 
-extern MOZ_MUST_USE JS_FRIEND_API(bool)
+extern MOZ_MUST_USE JS_FRIEND_API bool
 js_DumpCallgrind(const char* outfile);
 
 #endif /* MOZ_CALLGRIND */
 
 #ifdef __linux__
 
-extern MOZ_MUST_USE JS_FRIEND_API(bool)
+extern MOZ_MUST_USE JS_FRIEND_API bool
 js_StartPerf();
 
-extern MOZ_MUST_USE JS_FRIEND_API(bool)
+extern MOZ_MUST_USE JS_FRIEND_API bool
 js_StopPerf();
 
 #endif /* __linux__ */
 
 #endif /* builtin_Profilers_h */
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -3861,17 +3861,17 @@ reflect_parse(JSContext* cx, uint32_t ar
         args.rval().setNull();
         return false;
     }
 
     args.rval().set(val);
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_InitReflectParse(JSContext* cx, HandleObject global)
 {
     RootedValue reflectVal(cx);
     if (!GetProperty(cx, global, global, cx->names().Reflect, &reflectVal)) {
         return false;
     }
     if (!reflectVal.isObject()) {
         JS_ReportErrorASCII(cx, "JS_InitReflectParse must be called during global initialization");
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -973,18 +973,20 @@ TeeReaderReadHandler(JSContext* cx, unsi
     // Step g: Let value1 and value2 be value.
     RootedValue value1(cx, value);
     RootedValue value2(cx, value);
 
     // Step h: If teeState.[[canceled2]] is false and cloneForBranch2 is
     //         true, set value2 to
     //         ? StructuredDeserialize(StructuredSerialize(value2),
     //                                 the current Realm Record).
-    // TODO: add StructuredClone() intrinsic.
-    MOZ_ASSERT(!unwrappedTeeState->cloneForBranch2(), "tee(cloneForBranch2=true) should not be exposed");
+    // We don't yet support any specifications that use cloneForBranch2, and
+    // the Streams spec doesn't offer any way for author code to enable it,
+    // so it's always false here.
+    MOZ_ASSERT(!unwrappedTeeState->cloneForBranch2());
 
     // Step i: If teeState.[[canceled1]] is false, perform
     //         ? ReadableStreamDefaultControllerEnqueue(branch1, value1).
     Rooted<ReadableStreamDefaultController*> unwrappedController(cx);
     if (!unwrappedTeeState->canceled1()) {
         unwrappedController = unwrappedTeeState->branch1();
         if (!ReadableStreamDefaultControllerEnqueue(cx, unwrappedController, value1)) {
             return false;
@@ -3984,26 +3986,26 @@ ValidateAndNormalizeQueuingStrategy(JSCo
 
     // Step 3: Return Record {[[size]]: size, [[highWaterMark]]: highWaterMark}.
     return true;
 }
 
 
 /*** API entry points ****************************************************************************/
 
-JS_FRIEND_API(JSObject*)
+JS_FRIEND_API JSObject*
 js::UnwrapReadableStream(JSObject* obj)
 {
     if (JSObject* unwrapped = CheckedUnwrap(obj)) {
         return unwrapped->is<ReadableStream>() ? unwrapped : nullptr;
     }
     return nullptr;
 }
 
-extern JS_PUBLIC_API(void)
+extern JS_PUBLIC_API void
 JS::SetReadableStreamCallbacks(JSContext* cx,
                                JS::RequestReadableStreamDataCallback dataRequestCallback,
                                JS::WriteIntoReadRequestBufferCallback writeIntoReadRequestCallback,
                                JS::CancelReadableStreamCallback cancelCallback,
                                JS::ReadableStreamClosedCallback closedCallback,
                                JS::ReadableStreamErroredCallback erroredCallback,
                                JS::ReadableStreamFinalizeCallback finalizeCallback)
 {
@@ -4026,23 +4028,23 @@ JS::SetReadableStreamCallbacks(JSContext
     rt->readableStreamDataRequestCallback = dataRequestCallback;
     rt->readableStreamWriteIntoReadRequestCallback = writeIntoReadRequestCallback;
     rt->readableStreamCancelCallback = cancelCallback;
     rt->readableStreamClosedCallback = closedCallback;
     rt->readableStreamErroredCallback = erroredCallback;
     rt->readableStreamFinalizeCallback = finalizeCallback;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::HasReadableStreamCallbacks(JSContext* cx)
 {
     return cx->runtime()->readableStreamDataRequestCallback;
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::NewReadableDefaultStreamObject(JSContext* cx,
                                    JS::HandleObject underlyingSource /* = nullptr */,
                                    JS::HandleFunction size /* = nullptr */,
                                    double highWaterMark /* = 1 */,
                                    JS::HandleObject proto /* = nullptr */)
 {
     MOZ_ASSERT(!cx->zone()->isAtomsZone());
     AssertHeapIsIdle();
@@ -4057,17 +4059,17 @@ JS::NewReadableDefaultStreamObject(JSCon
         }
     }
     RootedValue sourceVal(cx, ObjectValue(*source));
     RootedValue sizeVal(cx, size ? ObjectValue(*size) : UndefinedValue());
     RootedValue highWaterMarkVal(cx, NumberValue(highWaterMark));
     return ReadableStream::createDefaultStream(cx, sourceVal, sizeVal, highWaterMarkVal, proto);
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::NewReadableExternalSourceStreamObject(JSContext* cx,
                                           void* underlyingSource,
                                           uint8_t flags /* = 0 */,
                                           HandleObject proto /* = nullptr */)
 {
     MOZ_ASSERT(!cx->zone()->isAtomsZone());
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
@@ -4082,134 +4084,134 @@ JS::NewReadableExternalSourceStreamObjec
     MOZ_ASSERT(rt->readableStreamClosedCallback);
     MOZ_ASSERT(rt->readableStreamErroredCallback);
     MOZ_ASSERT(rt->readableStreamFinalizeCallback);
 #endif // DEBUG
 
     return ReadableStream::createExternalSourceStream(cx, underlyingSource, flags, proto);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsReadableStream(JSObject* obj)
 {
     return obj->canUnwrapAs<ReadableStream>();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsReadableStreamReader(JSObject* obj)
 {
     return obj->canUnwrapAs<ReadableStreamDefaultReader>();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsReadableStreamDefaultReader(JSObject* obj)
 {
     return obj->canUnwrapAs<ReadableStreamDefaultReader>();
 }
 
 template<class T>
 static MOZ_MUST_USE T*
 APIToUnwrapped(JSContext* cx, JSObject* obj)
 {
     cx->check(obj);
     return ToUnwrapped<T>(cx, obj);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamIsReadable(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     *result = unwrappedStream->readable();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamIsLocked(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     *result = unwrappedStream->locked();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamIsDisturbed(JSContext* cx, HandleObject streamObj, bool* result)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     *result = unwrappedStream->disturbed();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamGetEmbeddingFlags(JSContext* cx, HandleObject streamObj, uint8_t* flags)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     *flags = unwrappedStream->embeddingFlags();
     return true;
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::ReadableStreamCancel(JSContext* cx, HandleObject streamObj, HandleValue reason)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(reason);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
         return nullptr;
     }
 
     return ::ReadableStreamCancel(cx, unwrappedStream, reason);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamGetMode(JSContext* cx, HandleObject streamObj, JS::ReadableStreamMode* mode)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     *mode = unwrappedStream->mode();
     return true;
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::ReadableStreamGetReader(JSContext* cx, HandleObject streamObj, ReadableStreamReaderMode mode)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
         return nullptr;
     }
 
     JSObject* result = CreateReadableStreamDefaultReader(cx, unwrappedStream);
     MOZ_ASSERT_IF(result, IsObjectInContextCompartment(result, cx));
     return result;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamGetExternalUnderlyingSource(JSContext* cx, HandleObject streamObj, void** source)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
         return false;
@@ -4228,32 +4230,32 @@ JS::ReadableStreamGetExternalUnderlyingS
     }
 
     auto unwrappedController = &unwrappedStream->controller()->as<ReadableByteStreamController>();
     unwrappedController->setSourceLocked();
     *source = unwrappedController->underlyingSource().toPrivate();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamReleaseExternalUnderlyingSource(JSContext* cx, HandleObject streamObj)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     MOZ_ASSERT(unwrappedStream->mode() == JS::ReadableStreamMode::ExternalSource);
     MOZ_ASSERT(unwrappedStream->locked());
     MOZ_ASSERT(unwrappedStream->controller()->sourceLocked());
     unwrappedStream->controller()->clearSourceLocked();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamUpdateDataAvailableFromSource(JSContext* cx, JS::HandleObject streamObj,
                                                 uint32_t availableData)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
@@ -4358,17 +4360,17 @@ JS::ReadableStreamUpdateDataAvailableFro
         //                                                            byteOffset,
         //                                                            byteLength).
         // (Not needed for external underlying sources.)
     }
 
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamTee(JSContext* cx, HandleObject streamObj,
                       MutableHandleObject branch1Obj, MutableHandleObject branch2Obj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
@@ -4382,17 +4384,17 @@ JS::ReadableStreamTee(JSContext* cx, Han
     }
 
     branch1Obj.set(branch1Stream);
     branch2Obj.set(branch2Stream);
 
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamGetDesiredSize(JSContext* cx, JSObject* streamObj, bool* hasValue, double* value)
 {
     ReadableStream* unwrappedStream = APIToUnwrapped<ReadableStream>(cx, streamObj);
     if (!unwrappedStream) {
         return false;
     }
 
     if (unwrappedStream->errored()) {
@@ -4406,17 +4408,17 @@ JS::ReadableStreamGetDesiredSize(JSConte
         *value = 0;
         return true;
     }
 
     *value = ReadableStreamControllerGetDesiredSizeUnchecked(unwrappedStream->controller());
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamClose(JSContext* cx, HandleObject streamObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
         return false;
@@ -4433,17 +4435,17 @@ JS::ReadableStreamClose(JSContext* cx, H
         return ReadableStreamDefaultControllerClose(cx, unwrappedController);
     }
 
     Rooted<ReadableByteStreamController*> unwrappedController(cx);
     unwrappedController = &unwrappedControllerObj->as<ReadableByteStreamController>();
     return ReadableByteStreamControllerClose(cx, unwrappedController);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamEnqueue(JSContext* cx, HandleObject streamObj, HandleValue chunk)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(chunk);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
@@ -4461,17 +4463,17 @@ JS::ReadableStreamEnqueue(JSContext* cx,
     unwrappedController = &unwrappedStream->controller()->as<ReadableStreamDefaultController>();
 
     MOZ_ASSERT(!unwrappedController->closeRequested());
     MOZ_ASSERT(unwrappedStream->readable());
 
     return ReadableStreamDefaultControllerEnqueue(cx, unwrappedController, chunk);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamError(JSContext* cx, HandleObject streamObj, HandleValue error)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(error);
 
     Rooted<ReadableStream*> unwrappedStream(cx, APIToUnwrapped<ReadableStream>(cx, streamObj));
     if (!unwrappedStream) {
@@ -4485,46 +4487,46 @@ JS::ReadableStreamError(JSContext* cx, H
         return false;
     }
 
     // Step 4: Perform ! ReadableStreamDefaultControllerError(this, e).
     Rooted<ReadableStreamController*> unwrappedController(cx, unwrappedStream->controller());
     return ReadableStreamControllerError(cx, unwrappedController, error);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamReaderIsClosed(JSContext* cx, HandleObject readerObj, bool* result)
 {
     Rooted<ReadableStreamReader*> unwrappedReader(cx,
         APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
     if (!unwrappedReader) {
         return false;
     }
 
     *result = unwrappedReader->isClosed();
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamReaderCancel(JSContext* cx, HandleObject readerObj, HandleValue reason)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(reason);
 
     Rooted<ReadableStreamReader*> unwrappedReader(cx,
         APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
     if (!unwrappedReader) {
         return false;
     }
 
     return ReadableStreamReaderGenericCancel(cx, unwrappedReader, reason);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject readerObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStreamReader*> unwrappedReader(cx, APIToUnwrapped<ReadableStreamReader>(cx, readerObj));
     if (!unwrappedReader) {
         return false;
@@ -4536,17 +4538,17 @@ JS::ReadableStreamReaderReleaseLock(JSCo
         return false;
     }
     MOZ_ASSERT(ReadableStreamGetNumReadRequests(unwrappedStream) == 0);
 #endif // DEBUG
 
     return ReadableStreamReaderGenericRelease(cx, unwrappedReader);
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::ReadableStreamDefaultReaderRead(JSContext* cx, HandleObject readerObj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     Rooted<ReadableStreamDefaultReader*> unwrappedReader(cx);
     unwrappedReader = APIToUnwrapped<ReadableStreamDefaultReader>(cx, readerObj);
     if (!unwrappedReader) {
--- a/js/src/builtin/String.cpp
+++ b/js/src/builtin/String.cpp
@@ -110,26 +110,28 @@ str_encodeURI_Component(JSContext* cx, u
 
 
 /* ES5 B.2.1 */
 template <typename CharT>
 static bool
 Escape(JSContext* cx, const CharT* chars, uint32_t length, InlineCharBuffer<Latin1Char>& newChars,
        uint32_t* newLengthOut)
 {
+    // clang-format off
     static const uint8_t shouldPassThrough[128] = {
          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,       /*    !"#$%&'()*+,-./  */
          1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,       /*   0123456789:;<=>?  */
          1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,       /*   @ABCDEFGHIJKLMNO  */
          1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,       /*   PQRSTUVWXYZ[\]^_  */
          0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,       /*   `abcdefghijklmno  */
          1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,       /*   pqrstuvwxyz{\}~  DEL */
     };
+    // clang-format on
 
     /* Take a first pass and see how big the result string will need to be. */
     uint32_t newLength = length;
     for (size_t i = 0; i < length; i++) {
         char16_t ch = chars[i];
         if (ch < 128 && shouldPassThrough[ch]) {
             continue;
         }
--- a/js/src/builtin/TypedObject.h
+++ b/js/src/builtin/TypedObject.h
@@ -259,30 +259,30 @@ class ScalarTypeDescr : public SimpleTyp
     }
 
     static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
 };
 
 // Enumerates the cases of ScalarTypeDescr::Type which have
 // unique C representation. In particular, omits Uint8Clamped since it
 // is just a Uint8.
-#define JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(macro_)       \
-    macro_(Scalar::Int8,    int8_t,   int8)                     \
-    macro_(Scalar::Uint8,   uint8_t,  uint8)                    \
-    macro_(Scalar::Int16,   int16_t,  int16)                    \
-    macro_(Scalar::Uint16,  uint16_t, uint16)                   \
-    macro_(Scalar::Int32,   int32_t,  int32)                    \
-    macro_(Scalar::Uint32,  uint32_t, uint32)                   \
-    macro_(Scalar::Float32, float,    float32)                  \
-    macro_(Scalar::Float64, double,   float64)
+#define JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(MACRO_)       \
+    MACRO_(Scalar::Int8,    int8_t,   int8)                     \
+    MACRO_(Scalar::Uint8,   uint8_t,  uint8)                    \
+    MACRO_(Scalar::Int16,   int16_t,  int16)                    \
+    MACRO_(Scalar::Uint16,  uint16_t, uint16)                   \
+    MACRO_(Scalar::Int32,   int32_t,  int32)                    \
+    MACRO_(Scalar::Uint32,  uint32_t, uint32)                   \
+    MACRO_(Scalar::Float32, float,    float32)                  \
+    MACRO_(Scalar::Float64, double,   float64)
 
 // Must be in same order as the enum ScalarTypeDescr::Type:
-#define JS_FOR_EACH_SCALAR_TYPE_REPR(macro_)                    \
-    JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(macro_)           \
-    macro_(Scalar::Uint8Clamped, uint8_t, uint8Clamped)
+#define JS_FOR_EACH_SCALAR_TYPE_REPR(MACRO_)                    \
+    JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(MACRO_)           \
+    MACRO_(Scalar::Uint8Clamped, uint8_t, uint8Clamped)
 
 enum class ReferenceType {
     TYPE_ANY = JS_REFERENCETYPEREPR_ANY,
     TYPE_OBJECT = JS_REFERENCETYPEREPR_OBJECT,
     TYPE_STRING = JS_REFERENCETYPEREPR_STRING
 };
 
 // Type for reference type constructors like `Any`, `String`, and
@@ -309,20 +309,20 @@ class ReferenceTypeDescr : public Simple
 
     const char* typeName() const {
         return typeName(type());
     }
 
     static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
 };
 
-#define JS_FOR_EACH_REFERENCE_TYPE_REPR(macro_) \
-    macro_(ReferenceType::TYPE_ANY, GCPtrValue, Any) \
-    macro_(ReferenceType::TYPE_OBJECT, GCPtrObject, Object) \
-    macro_(ReferenceType::TYPE_STRING, GCPtrString, string)
+#define JS_FOR_EACH_REFERENCE_TYPE_REPR(MACRO_) \
+    MACRO_(ReferenceType::TYPE_ANY, GCPtrValue, Any) \
+    MACRO_(ReferenceType::TYPE_OBJECT, GCPtrObject, Object) \
+    MACRO_(ReferenceType::TYPE_STRING, GCPtrString, string)
 
 // Type descriptors whose instances are objects and hence which have
 // an associated `prototype` property.
 class ComplexTypeDescr : public TypeDescr
 {
   public:
     // Returns the prototype that instances of this type descriptor
     // will have.
--- a/js/src/builtin/WeakMapObject.cpp
+++ b/js/src/builtin/WeakMapObject.cpp
@@ -159,17 +159,17 @@ WeakCollectionObject::nondeterministicGe
                 return false;
             }
         }
     }
     ret.set(arr);
     return true;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 JS_NondeterministicGetWeakMapKeys(JSContext* cx, HandleObject objArg, MutableHandleObject ret)
 {
     RootedObject obj(cx, UncheckedUnwrap(objArg));
     if (!obj || !obj->is<WeakMapObject>()) {
         ret.set(nullptr);
         return true;
     }
     return WeakCollectionObject::nondeterministicGetKeys(cx, obj.as<WeakCollectionObject>(), ret);
@@ -187,29 +187,29 @@ static void
 WeakCollection_finalize(FreeOp* fop, JSObject* obj)
 {
     MOZ_ASSERT(fop->maybeOnHelperThread());
     if (ObjectValueMap* map = obj->as<WeakCollectionObject>().getMap()) {
         fop->delete_(map);
     }
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS::NewWeakMapObject(JSContext* cx)
 {
     return NewBuiltinClassInstance<WeakMapObject>(cx);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsWeakMapObject(JSObject* obj)
 {
     return obj->is<WeakMapObject>();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::GetWeakMapEntry(JSContext* cx, HandleObject mapObj, HandleObject key,
                     MutableHandleValue rval)
 {
     CHECK_THREAD(cx);
     cx->check(key);
     rval.setUndefined();
     ObjectValueMap* map = mapObj->as<WeakMapObject>().getMap();
     if (!map) {
@@ -219,17 +219,17 @@ JS::GetWeakMapEntry(JSContext* cx, Handl
         // Read barrier to prevent an incorrectly gray value from escaping the
         // weak map. See the comment before UnmarkGrayChildren in gc/Marking.cpp
         ExposeValueToActiveJS(ptr->value().get());
         rval.set(ptr->value());
     }
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::SetWeakMapEntry(JSContext* cx, HandleObject mapObj, HandleObject key,
                     HandleValue val)
 {
     CHECK_THREAD(cx);
     cx->check(key, val);
     Handle<WeakMapObject*> rootedMap = mapObj.as<WeakMapObject>();
     return WeakCollectionPutEntryInternal(cx, rootedMap, key, val);
 }
--- a/js/src/builtin/WeakSetObject.cpp
+++ b/js/src/builtin/WeakSetObject.cpp
@@ -245,17 +245,17 @@ WeakSetObject::construct(JSContext* cx, 
 
 
 JSObject*
 js::InitWeakSetClass(JSContext* cx, Handle<GlobalObject*> global)
 {
     return WeakSetObject::initClass(cx, global);
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 JS_NondeterministicGetWeakSetKeys(JSContext* cx, HandleObject objArg, MutableHandleObject ret)
 {
     RootedObject obj(cx, UncheckedUnwrap(objArg));
     if (!obj || !obj->is<WeakSetObject>()) {
         ret.set(nullptr);
         return true;
     }
     return WeakCollectionObject::nondeterministicGetKeys(cx, obj.as<WeakCollectionObject>(), ret);
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -2444,17 +2444,17 @@ static bool GetObjectProperty(JSContext*
 }
 
 } /* namespace ctypes */
 } /* namespace js */
 
 using namespace js;
 using namespace js::ctypes;
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_InitCTypesClass(JSContext* cx, HandleObject global)
 {
   // attach ctypes property to global object
   RootedObject ctypes(cx, JS_NewObject(cx, &sCTypesGlobalClass));
   if (!ctypes) {
     return false;
   }
 
@@ -2495,30 +2495,30 @@ JS_InitCTypesClass(JSContext* cx, Handle
                          JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT))
     return false;
 
 
   // Seal the ctypes object, to prevent modification.
   return JS_FreezeObject(cx, ctypes);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetCTypesCallbacks(JSObject* ctypesObj, const JSCTypesCallbacks* callbacks)
 {
   MOZ_ASSERT(callbacks);
   MOZ_ASSERT(IsCTypesGlobal(ctypesObj));
 
   // Set the callbacks on a reserved slot.
   JS_SetReservedSlot(ctypesObj, SLOT_CALLBACKS,
                      PrivateValue(const_cast<JSCTypesCallbacks*>(callbacks)));
 }
 
 namespace js {
 
-JS_FRIEND_API(size_t)
+JS_FRIEND_API size_t
 SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject* obj)
 {
     if (!CData::IsCData(obj)) {
         return 0;
     }
 
     size_t n = 0;
     Value slot = JS_GetReservedSlot(obj, ctypes::SLOT_OWNS);
--- a/js/src/ctypes/typedefs.h
+++ b/js/src/ctypes/typedefs.h
@@ -4,28 +4,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * This header contains the builtin types available for arguments and return
  * values, representing their C counterparts. They are used inside higher-order
  * macros that the user must call, providing a macro that will consume the
  * arguments provided to it by the higher-order macro. The macros exposed are:
  *
- *   CTYPES_FOR_EACH_BOOL_TYPE(macro)
- *   CTYPES_FOR_EACH_CHAR_TYPE(macro)
- *   CTYPES_FOR_EACH_CHAR16_TYPE(macro)
- *   CTYPES_FOR_EACH_INT_TYPE(macro)
- *   CTYPES_FOR_EACH_WRAPPED_INT_TYPE(macro)
- *   CTYPES_FOR_EACH_FLOAT_TYPE(macro)
- *   CTYPES_FOR_EACH_TYPE(macro)
+ *   CTYPES_FOR_EACH_BOOL_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_CHAR_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_CHAR16_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_INT_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_WRAPPED_INT_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_FLOAT_TYPE(MACRO)
+ *   CTYPES_FOR_EACH_TYPE(MACRO)
  *
- * The macro name provided to any of these macros will then be repeatedly
+ * The MACRO name provided to any of these macros will then be repeatedly
  * invoked as
  *
- *   macro(typename, ctype, ffitype)
+ *   MACRO(typename, ctype, ffitype)
  *
  * where 'typename' is the name of the type constructor (accessible as
  * ctypes.typename), 'ctype' is the corresponding C type declaration (from
  * which sizeof(ctype) and templated type conversions will be derived), and
  * 'ffitype' is the ffi_type to use. (Special types, such as 'void' and the
  * pointer, array, and struct types are handled separately.)
  */
 
@@ -48,59 +48,59 @@
 #define CTYPES_FFI_LONG      (sizeof(long)      == 4 ? ffi_type_sint32 : ffi_type_sint64)
 #define CTYPES_FFI_ULONG     (sizeof(long)      == 4 ? ffi_type_uint32 : ffi_type_uint64)
 #define CTYPES_FFI_SIZE_T    (sizeof(size_t)    == 4 ? ffi_type_uint32 : ffi_type_uint64)
 #define CTYPES_FFI_SSIZE_T   (sizeof(size_t)    == 4 ? ffi_type_sint32 : ffi_type_sint64)
 #define CTYPES_FFI_OFF_T     (sizeof(off_t)     == 4 ? ffi_type_sint32 : ffi_type_sint64)
 #define CTYPES_FFI_INTPTR_T  (sizeof(uintptr_t) == 4 ? ffi_type_sint32 : ffi_type_sint64)
 #define CTYPES_FFI_UINTPTR_T (sizeof(uintptr_t) == 4 ? ffi_type_uint32 : ffi_type_uint64)
 
-#define CTYPES_FOR_EACH_BOOL_TYPE(macro) \
-  macro(bool,               bool,               CTYPES_FFI_BOOL)
+#define CTYPES_FOR_EACH_BOOL_TYPE(MACRO) \
+  MACRO(bool,               bool,               CTYPES_FFI_BOOL)
 
-#define CTYPES_FOR_EACH_INT_TYPE(macro) \
-  macro(int8_t,             int8_t,             ffi_type_sint8) \
-  macro(int16_t,            int16_t,            ffi_type_sint16) \
-  macro(int32_t,            int32_t,            ffi_type_sint32) \
-  macro(uint8_t,            uint8_t,            ffi_type_uint8) \
-  macro(uint16_t,           uint16_t,           ffi_type_uint16) \
-  macro(uint32_t,           uint32_t,           ffi_type_uint32) \
-  macro(short,              short,              ffi_type_sint16) \
-  macro(unsigned_short,     unsigned short,     ffi_type_uint16) \
-  macro(int,                int,                ffi_type_sint32) \
-  macro(unsigned_int,       unsigned int,       ffi_type_uint32)
+#define CTYPES_FOR_EACH_INT_TYPE(MACRO) \
+  MACRO(int8_t,             int8_t,             ffi_type_sint8) \
+  MACRO(int16_t,            int16_t,            ffi_type_sint16) \
+  MACRO(int32_t,            int32_t,            ffi_type_sint32) \
+  MACRO(uint8_t,            uint8_t,            ffi_type_uint8) \
+  MACRO(uint16_t,           uint16_t,           ffi_type_uint16) \
+  MACRO(uint32_t,           uint32_t,           ffi_type_uint32) \
+  MACRO(short,              short,              ffi_type_sint16) \
+  MACRO(unsigned_short,     unsigned short,     ffi_type_uint16) \
+  MACRO(int,                int,                ffi_type_sint32) \
+  MACRO(unsigned_int,       unsigned int,       ffi_type_uint32)
 
-#define CTYPES_FOR_EACH_WRAPPED_INT_TYPE(macro) \
-  macro(int64_t,            int64_t,            ffi_type_sint64) \
-  macro(uint64_t,           uint64_t,           ffi_type_uint64) \
-  macro(long,               long,               CTYPES_FFI_LONG) \
-  macro(unsigned_long,      unsigned long,      CTYPES_FFI_ULONG) \
-  macro(long_long,          long long,          ffi_type_sint64) \
-  macro(unsigned_long_long, unsigned long long, ffi_type_uint64) \
-  macro(size_t,             size_t,             CTYPES_FFI_SIZE_T) \
-  macro(ssize_t,            CTYPES_SSIZE_T,     CTYPES_FFI_SSIZE_T) \
-  macro(off_t,              off_t,              CTYPES_FFI_OFF_T) \
-  macro(intptr_t,           intptr_t,           CTYPES_FFI_INTPTR_T) \
-  macro(uintptr_t,          uintptr_t,          CTYPES_FFI_UINTPTR_T)
+#define CTYPES_FOR_EACH_WRAPPED_INT_TYPE(MACRO) \
+  MACRO(int64_t,            int64_t,            ffi_type_sint64) \
+  MACRO(uint64_t,           uint64_t,           ffi_type_uint64) \
+  MACRO(long,               long,               CTYPES_FFI_LONG) \
+  MACRO(unsigned_long,      unsigned long,      CTYPES_FFI_ULONG) \
+  MACRO(long_long,          long long,          ffi_type_sint64) \
+  MACRO(unsigned_long_long, unsigned long long, ffi_type_uint64) \
+  MACRO(size_t,             size_t,             CTYPES_FFI_SIZE_T) \
+  MACRO(ssize_t,            CTYPES_SSIZE_T,     CTYPES_FFI_SSIZE_T) \
+  MACRO(off_t,              off_t,              CTYPES_FFI_OFF_T) \
+  MACRO(intptr_t,           intptr_t,           CTYPES_FFI_INTPTR_T) \
+  MACRO(uintptr_t,          uintptr_t,          CTYPES_FFI_UINTPTR_T)
 
-#define CTYPES_FOR_EACH_FLOAT_TYPE(macro) \
-  macro(float32_t,          float,              ffi_type_float) \
-  macro(float64_t,          double,             ffi_type_double) \
-  macro(float,              float,              ffi_type_float) \
-  macro(double,             double,             ffi_type_double)
+#define CTYPES_FOR_EACH_FLOAT_TYPE(MACRO) \
+  MACRO(float32_t,          float,              ffi_type_float) \
+  MACRO(float64_t,          double,             ffi_type_double) \
+  MACRO(float,              float,              ffi_type_float) \
+  MACRO(double,             double,             ffi_type_double)
 
-#define CTYPES_FOR_EACH_CHAR_TYPE(macro) \
-  macro(char,               char,               ffi_type_uint8) \
-  macro(signed_char,        signed char,        ffi_type_sint8) \
-  macro(unsigned_char,      unsigned char,      ffi_type_uint8)
+#define CTYPES_FOR_EACH_CHAR_TYPE(MACRO) \
+  MACRO(char,               char,               ffi_type_uint8) \
+  MACRO(signed_char,        signed char,        ffi_type_sint8) \
+  MACRO(unsigned_char,      unsigned char,      ffi_type_uint8)
 
-#define CTYPES_FOR_EACH_CHAR16_TYPE(macro) \
-  macro(char16_t,           char16_t,           ffi_type_uint16)
+#define CTYPES_FOR_EACH_CHAR16_TYPE(MACRO) \
+  MACRO(char16_t,           char16_t,           ffi_type_uint16)
 
-#define CTYPES_FOR_EACH_TYPE(macro) \
-  CTYPES_FOR_EACH_BOOL_TYPE(macro) \
-  CTYPES_FOR_EACH_INT_TYPE(macro) \
-  CTYPES_FOR_EACH_WRAPPED_INT_TYPE(macro) \
-  CTYPES_FOR_EACH_FLOAT_TYPE(macro) \
-  CTYPES_FOR_EACH_CHAR_TYPE(macro) \
-  CTYPES_FOR_EACH_CHAR16_TYPE(macro)
+#define CTYPES_FOR_EACH_TYPE(MACRO) \
+  CTYPES_FOR_EACH_BOOL_TYPE(MACRO) \
+  CTYPES_FOR_EACH_INT_TYPE(MACRO) \
+  CTYPES_FOR_EACH_WRAPPED_INT_TYPE(MACRO) \
+  CTYPES_FOR_EACH_FLOAT_TYPE(MACRO) \
+  CTYPES_FOR_EACH_CHAR_TYPE(MACRO) \
+  CTYPES_FOR_EACH_CHAR16_TYPE(MACRO)
 
 #endif /* ctypes_typedefs_h */
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -9399,32 +9399,32 @@ const JSSrcNoteSpec js_SrcNoteSpec[] = {
 
 static int
 SrcNoteArity(jssrcnote* sn)
 {
     MOZ_ASSERT(SN_TYPE(sn) < SRC_LAST);
     return js_SrcNoteSpec[SN_TYPE(sn)].arity;
 }
 
-JS_FRIEND_API(unsigned)
+JS_FRIEND_API unsigned
 js::SrcNoteLength(jssrcnote* sn)
 {
     unsigned arity;
     jssrcnote* base;
 
     arity = SrcNoteArity(sn);
     for (base = sn++; arity; sn++, arity--) {
         if (*sn & SN_4BYTE_OFFSET_FLAG) {
             sn += 3;
         }
     }
     return sn - base;
 }
 
-JS_FRIEND_API(ptrdiff_t)
+JS_FRIEND_API ptrdiff_t
 js::GetSrcNoteOffset(jssrcnote* sn, unsigned which)
 {
     /* Find the offset numbered which (i.e., skip exactly which offsets). */
     MOZ_ASSERT(SN_TYPE(sn) != SRC_XDELTA);
     MOZ_ASSERT((int) which < SrcNoteArity(sn));
     for (sn++; which; sn++, which--) {
         if (*sn & SN_4BYTE_OFFSET_FLAG) {
             sn += 3;
--- a/js/src/frontend/GenerateReservedWords.py
+++ b/js/src/frontend/GenerateReservedWords.py
@@ -2,17 +2,17 @@
 # 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/.
 
 import re
 import sys
 
 
 def read_reserved_word_list(filename):
-    macro_pat = re.compile(r"^\s*macro\(([^,]+), *[^,]+, *[^\)]+\)\s*\\?$")
+    macro_pat = re.compile(r"^\s*MACRO\(([^,]+), *[^,]+, *[^\)]+\)\s*\\?$")
 
     reserved_word_list = []
     index = 0
     with open(filename, 'r') as f:
         for line in f:
             m = macro_pat.search(line)
             if m:
                 reserved_word_list.append((index, m.group(1)))
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -537,60 +537,60 @@ enum ParseNodeArity
     PN_BIGINT,                          /* BigInt literal */
 #endif
     PN_REGEXP,                          /* regexp literal */
     PN_LOOP,                            /* loop control (break/continue) */
     PN_SCOPE                            /* lexical scope */
 };
 
 // FIXME: Remove `*Type` (bug 1489008)
-#define FOR_EACH_PARSENODE_SUBCLASS(macro) \
-    macro(BinaryNode, BinaryNodeType, asBinary) \
-    macro(AssignmentNode, AssignmentNodeType, asAssignment) \
-    macro(CaseClause, CaseClauseType, asCaseClause) \
-    macro(ClassMethod, ClassMethodType, asClassMethod) \
-    macro(ClassField, ClassFieldType, asClassField) \
-    macro(ClassNames, ClassNamesType, asClassNames) \
-    macro(ForNode, ForNodeType, asFor) \
-    macro(PropertyAccess, PropertyAccessType, asPropertyAccess) \
-    macro(PropertyByValue, PropertyByValueType, asPropertyByValue) \
-    macro(SwitchStatement, SwitchStatementType, asSwitchStatement) \
+#define FOR_EACH_PARSENODE_SUBCLASS(MACRO) \
+    MACRO(BinaryNode, BinaryNodeType, asBinary) \
+    MACRO(AssignmentNode, AssignmentNodeType, asAssignment) \
+    MACRO(CaseClause, CaseClauseType, asCaseClause) \
+    MACRO(ClassMethod, ClassMethodType, asClassMethod) \
+    MACRO(ClassField, ClassFieldType, asClassField) \
+    MACRO(ClassNames, ClassNamesType, asClassNames) \
+    MACRO(ForNode, ForNodeType, asFor) \
+    MACRO(PropertyAccess, PropertyAccessType, asPropertyAccess) \
+    MACRO(PropertyByValue, PropertyByValueType, asPropertyByValue) \
+    MACRO(SwitchStatement, SwitchStatementType, asSwitchStatement) \
     \
-    macro(CodeNode, CodeNodeType, asCode) \
+    MACRO(CodeNode, CodeNodeType, asCode) \
     \
-    macro(LexicalScopeNode, LexicalScopeNodeType, asLexicalScope) \
+    MACRO(LexicalScopeNode, LexicalScopeNodeType, asLexicalScope) \
     \
-    macro(ListNode, ListNodeType, asList) \
-    macro(CallSiteNode, CallSiteNodeType, asCallSite) \
+    MACRO(ListNode, ListNodeType, asList) \
+    MACRO(CallSiteNode, CallSiteNodeType, asCallSite) \
     \
-    macro(LoopControlStatement, LoopControlStatementType, asLoopControlStatement) \
-    macro(BreakStatement, BreakStatementType, asBreakStatement) \
-    macro(ContinueStatement, ContinueStatementType, asContinueStatement) \
+    MACRO(LoopControlStatement, LoopControlStatementType, asLoopControlStatement) \
+    MACRO(BreakStatement, BreakStatementType, asBreakStatement) \
+    MACRO(ContinueStatement, ContinueStatementType, asContinueStatement) \
     \
-    macro(NameNode, NameNodeType, asName) \
-    macro(LabeledStatement, LabeledStatementType, asLabeledStatement) \
+    MACRO(NameNode, NameNodeType, asName) \
+    MACRO(LabeledStatement, LabeledStatementType, asLabeledStatement) \
     \
-    macro(NullaryNode, NullaryNodeType, asNullary) \
-    macro(BooleanLiteral, BooleanLiteralType, asBooleanLiteral) \
-    macro(DebuggerStatement, DebuggerStatementType, asDebuggerStatement) \
-    macro(NullLiteral, NullLiteralType, asNullLiteral) \
-    macro(RawUndefinedLiteral, RawUndefinedLiteralType, asRawUndefinedLiteral) \
+    MACRO(NullaryNode, NullaryNodeType, asNullary) \
+    MACRO(BooleanLiteral, BooleanLiteralType, asBooleanLiteral) \
+    MACRO(DebuggerStatement, DebuggerStatementType, asDebuggerStatement) \
+    MACRO(NullLiteral, NullLiteralType, asNullLiteral) \
+    MACRO(RawUndefinedLiteral, RawUndefinedLiteralType, asRawUndefinedLiteral) \
     \
-    macro(NumericLiteral, NumericLiteralType, asNumericLiteral) \
-    IF_BIGINT(macro(BigIntLiteral, BigIntLiteralType, asBigIntLiteral),) \
+    MACRO(NumericLiteral, NumericLiteralType, asNumericLiteral) \
+    IF_BIGINT(MACRO(BigIntLiteral, BigIntLiteralType, asBigIntLiteral),) \
     \
-    macro(RegExpLiteral, RegExpLiteralType, asRegExpLiteral) \
+    MACRO(RegExpLiteral, RegExpLiteralType, asRegExpLiteral) \
     \
-    macro(TernaryNode, TernaryNodeType, asTernary) \
-    macro(ClassNode, ClassNodeType, asClass) \
-    macro(ConditionalExpression, ConditionalExpressionType, asConditionalExpression) \
-    macro(TryNode, TryNodeType, asTry) \
+    MACRO(TernaryNode, TernaryNodeType, asTernary) \
+    MACRO(ClassNode, ClassNodeType, asClass) \
+    MACRO(ConditionalExpression, ConditionalExpressionType, asConditionalExpression) \
+    MACRO(TryNode, TryNodeType, asTry) \
     \
-    macro(UnaryNode, UnaryNodeType, asUnary) \
-    macro(ThisLiteral, ThisLiteralType, asThisLiteral)
+    MACRO(UnaryNode, UnaryNodeType, asUnary) \
+    MACRO(ThisLiteral, ThisLiteralType, asThisLiteral)
 
 #define DECLARE_CLASS(typeName, longTypeName, asMethodName) \
 class typeName;
 FOR_EACH_PARSENODE_SUBCLASS(DECLARE_CLASS)
 #undef DECLARE_CLASS
 
 // ParseNodeKindArity[size_t(pnk)] is the arity of a ParseNode of kind pnk.
 extern const ParseNodeArity ParseNodeKindArity[];
--- a/js/src/frontend/ReservedWords.h
+++ b/js/src/frontend/ReservedWords.h
@@ -4,78 +4,78 @@
  * 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/. */
 
 /* A higher-order macro for enumerating reserved word tokens. */
 
 #ifndef vm_ReservedWords_h
 #define vm_ReservedWords_h
 
-#define FOR_EACH_JAVASCRIPT_RESERVED_WORD(macro) \
-    macro(false, false_, TokenKind::False) \
-    macro(true, true_, TokenKind::True) \
-    macro(null, null, TokenKind::Null) \
+#define FOR_EACH_JAVASCRIPT_RESERVED_WORD(MACRO) \
+    MACRO(false, false_, TokenKind::False) \
+    MACRO(true, true_, TokenKind::True) \
+    MACRO(null, null, TokenKind::Null) \
     \
     /* Keywords. */ \
-    macro(break, break_, TokenKind::Break) \
-    macro(case, case_, TokenKind::Case) \
-    macro(catch, catch_, TokenKind::Catch) \
-    macro(const, const_, TokenKind::Const) \
-    macro(continue, continue_, TokenKind::Continue) \
-    macro(debugger, debugger, TokenKind::Debugger) \
-    macro(default, default_, TokenKind::Default) \
-    macro(delete, delete_, TokenKind::Delete) \
-    macro(do, do_, TokenKind::Do) \
-    macro(else, else_, TokenKind::Else) \
-    macro(finally, finally_, TokenKind::Finally) \
-    macro(for, for_, TokenKind::For) \
-    macro(function, function, TokenKind::Function) \
-    macro(if, if_, TokenKind::If) \
-    macro(in, in, TokenKind::In) \
-    macro(instanceof, instanceof, TokenKind::InstanceOf) \
-    macro(new, new_, TokenKind::New) \
-    macro(return, return_, TokenKind::Return) \
-    macro(switch, switch_, TokenKind::Switch) \
-    macro(this, this_, TokenKind::This) \
-    macro(throw, throw_, TokenKind::Throw) \
-    macro(try, try_, TokenKind::Try) \
-    macro(typeof, typeof_, TokenKind::TypeOf) \
-    macro(var, var, TokenKind::Var) \
-    macro(void, void_, TokenKind::Void) \
-    macro(while, while_, TokenKind::While) \
-    macro(with, with, TokenKind::With) \
-    macro(import, import, TokenKind::Import) \
-    macro(export, export_, TokenKind::Export) \
-    macro(class, class_, TokenKind::Class) \
-    macro(extends, extends, TokenKind::Extends) \
-    macro(super, super, TokenKind::Super) \
+    MACRO(break, break_, TokenKind::Break) \
+    MACRO(case, case_, TokenKind::Case) \
+    MACRO(catch, catch_, TokenKind::Catch) \
+    MACRO(const, const_, TokenKind::Const) \
+    MACRO(continue, continue_, TokenKind::Continue) \
+    MACRO(debugger, debugger, TokenKind::Debugger) \
+    MACRO(default, default_, TokenKind::Default) \
+    MACRO(delete, delete_, TokenKind::Delete) \
+    MACRO(do, do_, TokenKind::Do) \
+    MACRO(else, else_, TokenKind::Else) \
+    MACRO(finally, finally_, TokenKind::Finally) \
+    MACRO(for, for_, TokenKind::For) \
+    MACRO(function, function, TokenKind::Function) \
+    MACRO(if, if_, TokenKind::If) \
+    MACRO(in, in, TokenKind::In) \
+    MACRO(instanceof, instanceof, TokenKind::InstanceOf) \
+    MACRO(new, new_, TokenKind::New) \
+    MACRO(return, return_, TokenKind::Return) \
+    MACRO(switch, switch_, TokenKind::Switch) \
+    MACRO(this, this_, TokenKind::This) \
+    MACRO(throw, throw_, TokenKind::Throw) \
+    MACRO(try, try_, TokenKind::Try) \
+    MACRO(typeof, typeof_, TokenKind::TypeOf) \
+    MACRO(var, var, TokenKind::Var) \
+    MACRO(void, void_, TokenKind::Void) \
+    MACRO(while, while_, TokenKind::While) \
+    MACRO(with, with, TokenKind::With) \
+    MACRO(import, import, TokenKind::Import) \
+    MACRO(export, export_, TokenKind::Export) \
+    MACRO(class, class_, TokenKind::Class) \
+    MACRO(extends, extends, TokenKind::Extends) \
+    MACRO(super, super, TokenKind::Super) \
     \
     /* Future reserved words. */ \
-    macro(enum, enum_, TokenKind::Enum) \
+    MACRO(enum, enum_, TokenKind::Enum) \
     \
     /* Future reserved words, but only in strict mode. */ \
-    macro(implements, implements, TokenKind::Implements) \
-    macro(interface, interface, TokenKind::Interface) \
-    macro(package, package, TokenKind::Package) \
-    macro(private, private_, TokenKind::Private) \
-    macro(protected, protected_, TokenKind::Protected) \
-    macro(public, public_, TokenKind::Public) \
+    MACRO(implements, implements, TokenKind::Implements) \
+    MACRO(interface, interface, TokenKind::Interface) \
+    MACRO(package, package, TokenKind::Package) \
+    MACRO(private, private_, TokenKind::Private) \
+    MACRO(protected, protected_, TokenKind::Protected) \
+    MACRO(public, public_, TokenKind::Public) \
     \
     /* Contextual keywords. */ \
-    macro(as, as, TokenKind::As) \
-    macro(async, async, TokenKind::Async) \
-    macro(await, await, TokenKind::Await) \
-    macro(from, from, TokenKind::From) \
-    macro(get, get, TokenKind::Get) \
-    macro(let, let, TokenKind::Let) \
-    macro(meta, meta, TokenKind::Meta) \
-    macro(of, of, TokenKind::Of) \
-    macro(set, set, TokenKind::Set) \
-    macro(static, static_, TokenKind::Static) \
-    macro(target, target, TokenKind::Target) \
+    MACRO(as, as, TokenKind::As) \
+    MACRO(async, async, TokenKind::Async) \
+    MACRO(await, await, TokenKind::Await) \
+    MACRO(from, from, TokenKind::From) \
+    MACRO(get, get, TokenKind::Get) \
+    MACRO(let, let, TokenKind::Let) \
+    MACRO(meta, meta, TokenKind::Meta) \
+    MACRO(of, of, TokenKind::Of) \
+    MACRO(set, set, TokenKind::Set) \
+    MACRO(static, static_, TokenKind::Static) \
+    MACRO(target, target, TokenKind::Target) \
     /* \
      * Yield is a token inside function*.  Outside of a function*, it is a \
      * future reserved word in strict mode, but a keyword in JS1.7 even \
      * when strict.  Punt logic to parser. \
      */ \
-    macro(yield, yield, TokenKind::Yield)
+    MACRO(yield, yield, TokenKind::Yield)
 
 #endif /* vm_ReservedWords_h */
--- a/js/src/frontend/SourceNotes.h
+++ b/js/src/frontend/SourceNotes.h
@@ -156,16 +156,17 @@ class SrcNote {
         enum Fields {
             // The file-absolute source line number of the current op.
             Line,
             Count
         };
     };
 };
 
+// clang-format off
 #define FOR_EACH_SRC_NOTE_TYPE(M)                                                                  \
     M(SRC_NULL,         "null",        0)  /* Terminates a note vector. */                         \
     M(SRC_IF,           "if",          0)  /* JSOP_IFEQ bytecode is from an if-then. */            \
     M(SRC_IF_ELSE,      "if-else",     0)  /* JSOP_IFEQ bytecode is from an if-then-else. */       \
     M(SRC_COND,         "cond",        0)  /* JSOP_IFEQ is from conditional ?: operator. */        \
     M(SRC_FOR,          "for",         SrcNote::For::Count) \
     M(SRC_WHILE,        "while",       SrcNote::While::Count) \
     M(SRC_DO_WHILE,     "do-while",    SrcNote::DoWhile::Count) \
@@ -184,16 +185,17 @@ class SrcNote {
     M(SRC_TRY,          "try",         SrcNote::Try::Count) \
     /* All notes above here are "gettable".  See SN_IS_GETTABLE below. */                          \
     M(SRC_COLSPAN,      "colspan",     SrcNote::ColSpan::Count) \
     M(SRC_NEWLINE,      "newline",     0)  /* Bytecode follows a source newline. */                \
     M(SRC_SETLINE,      "setline",     SrcNote::SetLine::Count) \
     M(SRC_UNUSED22,     "unused22",    0)  /* Unused. */                                           \
     M(SRC_UNUSED23,     "unused23",    0)  /* Unused. */                                           \
     M(SRC_XDELTA,       "xdelta",      0)  /* 24-31 are for extended delta notes. */
+// clang-format on
 
 enum SrcNoteType {
 #define DEFINE_SRC_NOTE_TYPE(sym, name, arity) sym,
     FOR_EACH_SRC_NOTE_TYPE(DEFINE_SRC_NOTE_TYPE)
 #undef DEFINE_SRC_NOTE_TYPE
 
     SRC_LAST,
     SRC_LAST_GETTABLE = SRC_TRY
@@ -306,24 +308,24 @@ SN_COLSPAN_TO_OFFSET(ptrdiff_t colspan) 
                                  : js::SrcNoteLength(sn))
 #define SN_NEXT(sn)             ((sn) + SN_LENGTH(sn))
 
 struct JSSrcNoteSpec {
     const char*     name;      /* name for disassembly/debugging output */
     int8_t          arity;      /* number of offset operands */
 };
 
-extern JS_FRIEND_DATA(const JSSrcNoteSpec) js_SrcNoteSpec[];
+extern JS_FRIEND_DATA const JSSrcNoteSpec js_SrcNoteSpec[];
 
 namespace js {
 
-extern JS_FRIEND_API(unsigned)
+extern JS_FRIEND_API unsigned
 SrcNoteLength(jssrcnote* sn);
 
 /*
  * Get and set the offset operand identified by which (0 for the first, etc.).
  */
-extern JS_FRIEND_API(ptrdiff_t)
+extern JS_FRIEND_API ptrdiff_t
 GetSrcNoteOffset(jssrcnote* sn, unsigned which);
 
 } // namespace js
 
 #endif /* frontend_SourceNotes_h */
--- a/js/src/frontend/TokenKind.h
+++ b/js/src/frontend/TokenKind.h
@@ -9,236 +9,236 @@
 
 #include <stdint.h>
 
 /*
  * List of token kinds and their ranges.
  *
  * The format for each line is:
  *
- *   macro(<TOKEN_KIND_NAME>, <DESCRIPTION>)
+ *   MACRO(<TOKEN_KIND_NAME>, <DESCRIPTION>)
  *
  * or
  *
- *   range(<TOKEN_RANGE_NAME>, <TOKEN_KIND_NAME>)
+ *   RANGE(<TOKEN_RANGE_NAME>, <TOKEN_KIND_NAME>)
  *
  * where ;
  * <TOKEN_KIND_NAME> is a legal C identifier of the token, that will be used in
  * the JS engine source.
  *
  * <DESCRIPTION> is a string that describe about the token, and will be used in
  * error message.
  *
  * <TOKEN_RANGE_NAME> is a legal C identifier of the range that will be used to
  * JS engine source. It should end with `First` or `Last`. This is used to check
  * TokenKind by range-testing:
  *   BinOpFirst <= tt && tt <= BinOpLast
  *
- * Second argument of `range` is the actual value of the <TOKEN_RANGE_NAME>,
- * should be same as one of <TOKEN_KIND_NAME> in other `macro`s.
+ * Second argument of `RANGE` is the actual value of the <TOKEN_RANGE_NAME>,
+ * should be same as one of <TOKEN_KIND_NAME> in other `MACRO`s.
  *
- * To use this macro, define two macros for `macro` and `range`, and pass them
+ * To use this macro, define two macros for `MACRO` and `RANGE`, and pass them
  * as arguments.
  *
  *   #define EMIT_TOKEN(name, desc) ...
  *   #define EMIT_RANGE(name, value) ...
  *   FOR_EACH_TOKEN_KIND_WITH_RANGE(EMIT_TOKEN, EMIT_RANGE)
  *   #undef EMIT_TOKEN
  *   #undef EMIT_RANGE
  *
  * If you don't need range data, use FOR_EACH_TOKEN_KIND instead.
  *
  *   #define EMIT_TOKEN(name, desc) ...
  *   FOR_EACH_TOKEN_KIND(EMIT_TOKEN)
  *   #undef EMIT_TOKEN
  *
  * Note that this list does not contain ERROR and LIMIT.
  */
-#define FOR_EACH_TOKEN_KIND_WITH_RANGE(macro, range) \
-    macro(Eof,         "end of script") \
+#define FOR_EACH_TOKEN_KIND_WITH_RANGE(MACRO, RANGE) \
+    MACRO(Eof,         "end of script") \
     \
     /* only returned by peekTokenSameLine() */ \
-    macro(Eol,          "line terminator") \
+    MACRO(Eol,          "line terminator") \
     \
-    macro(Semi,         "';'") \
-    macro(Comma,        "','") \
-    macro(Hook,         "'?'")    /* conditional */ \
-    macro(Colon,        "':'")    /* conditional */ \
-    macro(Inc,          "'++'")   /* increment */ \
-    macro(Dec,          "'--'")   /* decrement */ \
-    macro(Dot,          "'.'")    /* member operator */ \
-    macro(TripleDot,    "'...'")  /* rest arguments and spread operator */ \
-    macro(LeftBracket,  "'['") \
-    macro(RightBracket, "']'") \
-    macro(LeftCurly,    "'{'") \
-    macro(RightCurly,   "'}'") \
-    macro(LeftParen,    "'('") \
-    macro(RightParen,   "')'") \
-    macro(Name,         "identifier") \
-    macro(PrivateName,  "private identifier") \
-    macro(Number,       "numeric literal") \
-    macro(String,       "string literal") \
-    IF_BIGINT(macro(BigInt, "bigint literal"),) \
+    MACRO(Semi,         "';'") \
+    MACRO(Comma,        "','") \
+    MACRO(Hook,         "'?'")    /* conditional */ \
+    MACRO(Colon,        "':'")    /* conditional */ \
+    MACRO(Inc,          "'++'")   /* increment */ \
+    MACRO(Dec,          "'--'")   /* decrement */ \
+    MACRO(Dot,          "'.'")    /* member operator */ \
+    MACRO(TripleDot,    "'...'")  /* rest arguments and spread operator */ \
+    MACRO(LeftBracket,  "'['") \
+    MACRO(RightBracket, "']'") \
+    MACRO(LeftCurly,    "'{'") \
+    MACRO(RightCurly,   "'}'") \
+    MACRO(LeftParen,    "'('") \
+    MACRO(RightParen,   "')'") \
+    MACRO(Name,         "identifier") \
+    MACRO(PrivateName,  "private identifier") \
+    MACRO(Number,       "numeric literal") \
+    MACRO(String,       "string literal") \
+    IF_BIGINT(MACRO(BigInt, "bigint literal"),) \
     \
     /* start of template literal with substitutions */ \
-    macro(TemplateHead,    "'${'") \
+    MACRO(TemplateHead,    "'${'") \
     /* template literal without substitutions */ \
-    macro(NoSubsTemplate, "template literal") \
+    MACRO(NoSubsTemplate, "template literal") \
     \
-    macro(RegExp,       "regular expression literal") \
-    macro(True,         "boolean literal 'true'") \
-    range(ReservedWordLiteralFirst, True) \
-    macro(False,        "boolean literal 'false'") \
-    macro(Null,         "null literal") \
-    range(ReservedWordLiteralLast, Null) \
-    macro(This,         "keyword 'this'") \
-    range(KeywordFirst, This) \
-    macro(Function,     "keyword 'function'") \
-    macro(If,           "keyword 'if'") \
-    macro(Else,         "keyword 'else'") \
-    macro(Switch,       "keyword 'switch'") \
-    macro(Case,         "keyword 'case'") \
-    macro(Default,      "keyword 'default'") \
-    macro(While,        "keyword 'while'") \
-    macro(Do,           "keyword 'do'") \
-    macro(For,          "keyword 'for'") \
-    macro(Break,        "keyword 'break'") \
-    macro(Continue,     "keyword 'continue'") \
-    macro(Var,          "keyword 'var'") \
-    macro(Const,        "keyword 'const'") \
-    macro(With,         "keyword 'with'") \
-    macro(Return,       "keyword 'return'") \
-    macro(New,          "keyword 'new'") \
-    macro(Delete,       "keyword 'delete'") \
-    macro(Try,          "keyword 'try'") \
-    macro(Catch,        "keyword 'catch'") \
-    macro(Finally,      "keyword 'finally'") \
-    macro(Throw,        "keyword 'throw'") \
-    macro(Debugger,     "keyword 'debugger'") \
-    macro(Export,       "keyword 'export'") \
-    macro(Import,       "keyword 'import'") \
-    macro(Class,        "keyword 'class'") \
-    macro(Extends,      "keyword 'extends'") \
-    macro(Super,        "keyword 'super'") \
-    range(KeywordLast, Super) \
+    MACRO(RegExp,       "regular expression literal") \
+    MACRO(True,         "boolean literal 'true'") \
+    RANGE(ReservedWordLiteralFirst, True) \
+    MACRO(False,        "boolean literal 'false'") \
+    MACRO(Null,         "null literal") \
+    RANGE(ReservedWordLiteralLast, Null) \
+    MACRO(This,         "keyword 'this'") \
+    RANGE(KeywordFirst, This) \
+    MACRO(Function,     "keyword 'function'") \
+    MACRO(If,           "keyword 'if'") \
+    MACRO(Else,         "keyword 'else'") \
+    MACRO(Switch,       "keyword 'switch'") \
+    MACRO(Case,         "keyword 'case'") \
+    MACRO(Default,      "keyword 'default'") \
+    MACRO(While,        "keyword 'while'") \
+    MACRO(Do,           "keyword 'do'") \
+    MACRO(For,          "keyword 'for'") \
+    MACRO(Break,        "keyword 'break'") \
+    MACRO(Continue,     "keyword 'continue'") \
+    MACRO(Var,          "keyword 'var'") \
+    MACRO(Const,        "keyword 'const'") \
+    MACRO(With,         "keyword 'with'") \
+    MACRO(Return,       "keyword 'return'") \
+    MACRO(New,          "keyword 'new'") \
+    MACRO(Delete,       "keyword 'delete'") \
+    MACRO(Try,          "keyword 'try'") \
+    MACRO(Catch,        "keyword 'catch'") \
+    MACRO(Finally,      "keyword 'finally'") \
+    MACRO(Throw,        "keyword 'throw'") \
+    MACRO(Debugger,     "keyword 'debugger'") \
+    MACRO(Export,       "keyword 'export'") \
+    MACRO(Import,       "keyword 'import'") \
+    MACRO(Class,        "keyword 'class'") \
+    MACRO(Extends,      "keyword 'extends'") \
+    MACRO(Super,        "keyword 'super'") \
+    RANGE(KeywordLast, Super) \
     \
     /* contextual keywords */ \
-    macro(As,           "'as'") \
-    range(ContextualKeywordFirst, As) \
-    macro(Async,        "'async'") \
-    macro(Await,        "'await'") \
-    macro(Each,         "'each'") \
-    macro(From,         "'from'") \
-    macro(Get,          "'get'") \
-    macro(Let,          "'let'") \
-    macro(Meta,         "'meta'") \
-    macro(Of,           "'of'") \
-    macro(Set,          "'set'") \
-    macro(Static,       "'static'") \
-    macro(Target,       "'target'") \
-    macro(Yield,        "'yield'") \
-    range(ContextualKeywordLast, Yield) \
+    MACRO(As,           "'as'") \
+    RANGE(ContextualKeywordFirst, As) \
+    MACRO(Async,        "'async'") \
+    MACRO(Await,        "'await'") \
+    MACRO(Each,         "'each'") \
+    MACRO(From,         "'from'") \
+    MACRO(Get,          "'get'") \
+    MACRO(Let,          "'let'") \
+    MACRO(Meta,         "'meta'") \
+    MACRO(Of,           "'of'") \
+    MACRO(Set,          "'set'") \
+    MACRO(Static,       "'static'") \
+    MACRO(Target,       "'target'") \
+    MACRO(Yield,        "'yield'") \
+    RANGE(ContextualKeywordLast, Yield) \
     \
     /* future reserved words */ \
-    macro(Enum,         "reserved word 'enum'") \
-    range(FutureReservedKeywordFirst, Enum) \
-    range(FutureReservedKeywordLast, Enum) \
+    MACRO(Enum,         "reserved word 'enum'") \
+    RANGE(FutureReservedKeywordFirst, Enum) \
+    RANGE(FutureReservedKeywordLast, Enum) \
     \
     /* reserved words in strict mode */ \
-    macro(Implements,   "reserved word 'implements'") \
-    range(StrictReservedKeywordFirst, Implements) \
-    macro(Interface,    "reserved word 'interface'") \
-    macro(Package,      "reserved word 'package'") \
-    macro(Private,      "reserved word 'private'") \
-    macro(Protected,    "reserved word 'protected'") \
-    macro(Public,       "reserved word 'public'") \
-    range(StrictReservedKeywordLast, Public) \
+    MACRO(Implements,   "reserved word 'implements'") \
+    RANGE(StrictReservedKeywordFirst, Implements) \
+    MACRO(Interface,    "reserved word 'interface'") \
+    MACRO(Package,      "reserved word 'package'") \
+    MACRO(Private,      "reserved word 'private'") \
+    MACRO(Protected,    "reserved word 'protected'") \
+    MACRO(Public,       "reserved word 'public'") \
+    RANGE(StrictReservedKeywordLast, Public) \
     \
     /* \
      * The following token types occupy contiguous ranges to enable easy \
      * range-testing. \
      */ \
     /* \
      * Binary operators tokens, Or thru Pow. These must be in the same \
      * order as F(Or) and friends in FOR_EACH_PARSE_NODE_KIND in ParseNode.h. \
      */ \
-    macro(Pipeline,     "'|>'") \
-    range(BinOpFirst,   Pipeline) \
-    macro(Or,           "'||'")   /* logical or */ \
-    macro(And,          "'&&'")   /* logical and */ \
-    macro(BitOr,        "'|'")    /* bitwise-or */ \
-    macro(BitXor,       "'^'")    /* bitwise-xor */ \
-    macro(BitAnd,       "'&'")    /* bitwise-and */ \
+    MACRO(Pipeline,     "'|>'") \
+    RANGE(BinOpFirst,   Pipeline) \
+    MACRO(Or,           "'||'")   /* logical or */ \
+    MACRO(And,          "'&&'")   /* logical and */ \
+    MACRO(BitOr,        "'|'")    /* bitwise-or */ \
+    MACRO(BitXor,       "'^'")    /* bitwise-xor */ \
+    MACRO(BitAnd,       "'&'")    /* bitwise-and */ \
     \
     /* Equality operation tokens, per TokenKindIsEquality. */ \
-    macro(StrictEq,     "'==='") \
-    range(EqualityStart, StrictEq) \
-    macro(Eq,           "'=='") \
-    macro(StrictNe,     "'!=='") \
-    macro(Ne,           "'!='") \
-    range(EqualityLast, Ne) \
+    MACRO(StrictEq,     "'==='") \
+    RANGE(EqualityStart, StrictEq) \
+    MACRO(Eq,           "'=='") \
+    MACRO(StrictNe,     "'!=='") \
+    MACRO(Ne,           "'!='") \
+    RANGE(EqualityLast, Ne) \
     \
     /* Relational ops, per TokenKindIsRelational. */ \
-    macro(Lt,           "'<'") \
-    range(RelOpStart,   Lt) \
-    macro(Le,           "'<='") \
-    macro(Gt,           "'>'") \
-    macro(Ge,           "'>='") \
-    range(RelOpLast,    Ge) \
+    MACRO(Lt,           "'<'") \
+    RANGE(RelOpStart,   Lt) \
+    MACRO(Le,           "'<='") \
+    MACRO(Gt,           "'>'") \
+    MACRO(Ge,           "'>='") \
+    RANGE(RelOpLast,    Ge) \
     \
-    macro(InstanceOf,   "keyword 'instanceof'") \
-    range(KeywordBinOpFirst, InstanceOf) \
-    macro(In,           "keyword 'in'") \
-    range(KeywordBinOpLast, In) \
+    MACRO(InstanceOf,   "keyword 'instanceof'") \
+    RANGE(KeywordBinOpFirst, InstanceOf) \
+    MACRO(In,           "keyword 'in'") \
+    RANGE(KeywordBinOpLast, In) \
     \
     /* Shift ops, per TokenKindIsShift. */ \
-    macro(Lsh,          "'<<'") \
-    range(ShiftOpStart, Lsh) \
-    macro(Rsh,          "'>>'") \
-    macro(Ursh,         "'>>>'") \
-    range(ShiftOpLast,  Ursh) \
+    MACRO(Lsh,          "'<<'") \
+    RANGE(ShiftOpStart, Lsh) \
+    MACRO(Rsh,          "'>>'") \
+    MACRO(Ursh,         "'>>>'") \
+    RANGE(ShiftOpLast,  Ursh) \
     \
-    macro(Add,          "'+'") \
-    macro(Sub,          "'-'") \
-    macro(Mul,          "'*'") \
-    macro(Div,          "'/'") \
-    macro(Mod,          "'%'") \
-    macro(Pow,          "'**'") \
-    range(BinOpLast,    Pow) \
+    MACRO(Add,          "'+'") \
+    MACRO(Sub,          "'-'") \
+    MACRO(Mul,          "'*'") \
+    MACRO(Div,          "'/'") \
+    MACRO(Mod,          "'%'") \
+    MACRO(Pow,          "'**'") \
+    RANGE(BinOpLast,    Pow) \
     \
     /* Unary operation tokens. */ \
-    macro(TypeOf,       "keyword 'typeof'") \
-    range(KeywordUnOpFirst, TypeOf) \
-    macro(Void,         "keyword 'void'") \
-    range(KeywordUnOpLast, Void) \
-    macro(Not,          "'!'") \
-    macro(BitNot,       "'~'") \
+    MACRO(TypeOf,       "keyword 'typeof'") \
+    RANGE(KeywordUnOpFirst, TypeOf) \
+    MACRO(Void,         "keyword 'void'") \
+    RANGE(KeywordUnOpLast, Void) \
+    MACRO(Not,          "'!'") \
+    MACRO(BitNot,       "'~'") \
     \
-    macro(Arrow,        "'=>'")   /* function arrow */ \
+    MACRO(Arrow,        "'=>'")   /* function arrow */ \
     \
     /* Assignment ops, per TokenKindIsAssignment */ \
-    macro(Assign,       "'='") \
-    range(AssignmentStart, Assign) \
-    macro(AddAssign,    "'+='") \
-    macro(SubAssign,    "'-='") \
-    macro(BitOrAssign,  "'|='") \
-    macro(BitXorAssign, "'^='") \
-    macro(BitAndAssign, "'&='") \
-    macro(LshAssign,    "'<<='") \
-    macro(RshAssign,    "'>>='") \
-    macro(UrshAssign,   "'>>>='") \
-    macro(MulAssign,    "'*='") \
-    macro(DivAssign,    "'/='") \
-    macro(ModAssign,    "'%='") \
-    macro(PowAssign,    "'**='") \
-    range(AssignmentLast, PowAssign)
+    MACRO(Assign,       "'='") \
+    RANGE(AssignmentStart, Assign) \
+    MACRO(AddAssign,    "'+='") \
+    MACRO(SubAssign,    "'-='") \
+    MACRO(BitOrAssign,  "'|='") \
+    MACRO(BitXorAssign, "'^='") \
+    MACRO(BitAndAssign, "'&='") \
+    MACRO(LshAssign,    "'<<='") \
+    MACRO(RshAssign,    "'>>='") \
+    MACRO(UrshAssign,   "'>>>='") \
+    MACRO(MulAssign,    "'*='") \
+    MACRO(DivAssign,    "'/='") \
+    MACRO(ModAssign,    "'%='") \
+    MACRO(PowAssign,    "'**='") \
+    RANGE(AssignmentLast, PowAssign)
 
 #define TOKEN_KIND_RANGE_EMIT_NONE(name, value)
-#define FOR_EACH_TOKEN_KIND(macro) \
-    FOR_EACH_TOKEN_KIND_WITH_RANGE(macro, TOKEN_KIND_RANGE_EMIT_NONE)
+#define FOR_EACH_TOKEN_KIND(MACRO) \
+    FOR_EACH_TOKEN_KIND_WITH_RANGE(MACRO, TOKEN_KIND_RANGE_EMIT_NONE)
 
 namespace js {
 namespace frontend {
 
 // Values of this type are used to index into arrays such as isExprEnding[],
 // so the first value must be zero.
 enum class TokenKind : uint8_t
 {
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -3510,17 +3510,17 @@ TokenStreamSpecific<char16_t, ParserAnyC
 template class
 TokenStreamSpecific<char16_t, ParserAnyCharsAccess<GeneralParser<SyntaxParseHandler, char16_t>>>;
 
 } // namespace frontend
 
 } // namespace js
 
 
-JS_FRIEND_API(int)
+JS_FRIEND_API int
 js_fgets(char* buf, int size, FILE* file)
 {
     int n, i, c;
     bool crflag;
 
     n = size - 1;
     if (n < 0) {
         return -1;
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -2783,17 +2783,17 @@ TokenStreamAnyCharsAccess::anyChars(cons
 }
 
 extern const char*
 TokenKindToDesc(TokenKind tt);
 
 } // namespace frontend
 } // namespace js
 
-extern JS_FRIEND_API(int)
+extern JS_FRIEND_API int
 js_fgets(char* buf, int size, FILE* file);
 
 #ifdef DEBUG
 extern const char*
 TokenKindToString(js::frontend::TokenKind tt);
 #endif
 
 #endif /* frontend_TokenStream_h */
--- a/js/src/frontend/binsource/Cargo.toml
+++ b/js/src/frontend/binsource/Cargo.toml
@@ -1,13 +1,18 @@
 [package]
 name = "binast"
 version = "0.1.1"
 authors = ["David Teller <D.O.Teller@gmail.com>"]
+autobins = false
 
 [dependencies]
 binjs_meta = "^0.4.3"
 clap = "^2"
 env_logger = "^0.5.6"
 itertools = "^0.7.6"
 log = "0.4"
 yaml-rust = "^0.4"
 webidl = "^0.8"
+
+[[bin]]
+name = "binsource"
+path = "src/main.rs"
new file mode 100644
--- /dev/null
+++ b/js/src/frontend/binsource/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+HOST_RUST_PROGRAMS += ['binsource']
--- a/js/src/gc/AllocKind.h
+++ b/js/src/gc/AllocKind.h
@@ -31,16 +31,17 @@ namespace gc {
 //  - the corresponding AllocKind
 //  - their JS::TraceKind
 //  - their C++ base type
 //  - a C++ type of the correct size
 //  - whether they can be finalized on the background thread
 //  - whether they can be allocated in the nursery
 //  - whether they can be compacted
 
+// clang-format off
 #define FOR_EACH_OBJECT_ALLOCKIND(D) \
  /* AllocKind              TraceKind     TypeName           SizedType          BGFinal Nursery Compact */ \
     D(FUNCTION,            Object,       JSObject,          JSFunction,        true,   true,   true) \
     D(FUNCTION_EXTENDED,   Object,       JSObject,          FunctionExtended,  true,   true,   true) \
     D(OBJECT0,             Object,       JSObject,          JSObject_Slots0,   false,  false,  true) \
     D(OBJECT0_BACKGROUND,  Object,       JSObject,          JSObject_Slots0,   true,   true,   true) \
     D(OBJECT2,             Object,       JSObject,          JSObject_Slots2,   false,  false,  true) \
     D(OBJECT2_BACKGROUND,  Object,       JSObject,          JSObject_Slots2,   true,   true,   true) \
@@ -68,43 +69,44 @@ namespace gc {
     IF_BIGINT(D(BIGINT,    BigInt,       JS::BigInt,        JS::BigInt,        true,   false,  false),) \
     D(JITCODE,             JitCode,      js::jit::JitCode,  js::jit::JitCode,  false,  false,  false) \
     D(SCOPE,               Scope,        js::Scope,         js::Scope,         true,   false,  true) \
     D(REGEXP_SHARED,       RegExpShared, js::RegExpShared,  js::RegExpShared,  true,   false,  true)
 
 #define FOR_EACH_NURSERY_STRING_ALLOCKIND(D) \
     D(FAT_INLINE_STRING,   String,        JSFatInlineString, JSFatInlineString, true,   true,  true) \
     D(STRING,              String,        JSString,          JSString,          true,   true,  true)
+// clang-format on
 
 #define FOR_EACH_NONOBJECT_ALLOCKIND(D) \
     FOR_EACH_NONOBJECT_NONNURSERY_ALLOCKIND(D) \
     FOR_EACH_NURSERY_STRING_ALLOCKIND(D)
 
 #define FOR_EACH_ALLOCKIND(D)    \
     FOR_EACH_OBJECT_ALLOCKIND(D) \
     FOR_EACH_NONOBJECT_ALLOCKIND(D)
 
+#define DEFINE_ALLOC_KIND(allocKind, _1, _2, _3, _4, _5, _6) allocKind,
 enum class AllocKind : uint8_t {
-#define DEFINE_ALLOC_KIND(allocKind, _1, _2, _3, _4, _5, _6) allocKind,
-
+    // clang-format off
     FOR_EACH_OBJECT_ALLOCKIND(DEFINE_ALLOC_KIND)
 
     OBJECT_LIMIT,
     OBJECT_LAST = OBJECT_LIMIT - 1,
 
     FOR_EACH_NONOBJECT_ALLOCKIND(DEFINE_ALLOC_KIND)
 
     LIMIT,
     LAST = LIMIT - 1,
 
     FIRST = 0,
     OBJECT_FIRST = FUNCTION // Hardcoded to first object kind.
-
+    // clang-format on
+};
 #undef DEFINE_ALLOC_KIND
-};
 
 static_assert(int(AllocKind::FIRST) == 0,
               "Various places depend on AllocKind starting at 0");
 static_assert(int(AllocKind::OBJECT_FIRST) == 0,
               "OBJECT_FIRST must be defined as the first object kind");
 
 inline bool
 IsAllocKind(AllocKind kind)
--- a/js/src/gc/Barrier.cpp
+++ b/js/src/gc/Barrier.cpp
@@ -219,42 +219,42 @@ MovableCellHasher<T>::match(const Key& k
     return keyId == zone->getUniqueIdInfallible(l);
 }
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wattributes"
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
-template struct JS_PUBLIC_API(MovableCellHasher<JSObject*>);
-template struct JS_PUBLIC_API(MovableCellHasher<GlobalObject*>);
-template struct JS_PUBLIC_API(MovableCellHasher<SavedFrame*>);
-template struct JS_PUBLIC_API(MovableCellHasher<EnvironmentObject*>);
-template struct JS_PUBLIC_API(MovableCellHasher<WasmInstanceObject*>);
-template struct JS_PUBLIC_API(MovableCellHasher<JSScript*>);
-template struct JS_PUBLIC_API(MovableCellHasher<LazyScript*>);
+template struct JS_PUBLIC_API MovableCellHasher<JSObject*>;
+template struct JS_PUBLIC_API MovableCellHasher<GlobalObject*>;
+template struct JS_PUBLIC_API MovableCellHasher<SavedFrame*>;
+template struct JS_PUBLIC_API MovableCellHasher<EnvironmentObject*>;
+template struct JS_PUBLIC_API MovableCellHasher<WasmInstanceObject*>;
+template struct JS_PUBLIC_API MovableCellHasher<JSScript*>;
+template struct JS_PUBLIC_API MovableCellHasher<LazyScript*>;
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic pop
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
 } // namespace js
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::HeapObjectPostBarrier(JSObject** objp, JSObject* prev, JSObject* next)
 {
     MOZ_ASSERT(objp);
     js::InternalBarrierMethods<JSObject*>::postBarrier(objp, prev, next);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::HeapStringPostBarrier(JSString** strp, JSString* prev, JSString* next)
 {
     MOZ_ASSERT(strp);
     js::InternalBarrierMethods<JSString*>::postBarrier(strp, prev, next);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::HeapValuePostBarrier(JS::Value* valuep, const Value& prev, const Value& next)
 {
     MOZ_ASSERT(valuep);
     js::InternalBarrierMethods<JS::Value>::postBarrier(valuep, prev, next);
 }
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -2013,29 +2013,29 @@ GCRuntime::addRoot(Value* vp, const char
 
 void
 GCRuntime::removeRoot(Value* vp)
 {
     rootsHash.ref().remove(vp);
     notifyRootsRemoved();
 }
 
-extern JS_FRIEND_API(bool)
+extern JS_FRIEND_API bool
 js::AddRawValueRoot(JSContext* cx, Value* vp, const char* name)
 {
     MOZ_ASSERT(vp);
     MOZ_ASSERT(name);
     bool ok = cx->runtime()->gc.addRoot(vp, name);
     if (!ok) {
         JS_ReportOutOfMemory(cx);
     }
     return ok;
 }
 
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 js::RemoveRawValueRoot(JSContext* cx, Value* vp)
 {
     cx->runtime()->gc.removeRoot(vp);
 }
 
 void
 GCRuntime::setMaxMallocBytes(size_t value, const AutoLockGC& lock)
 {
@@ -7201,17 +7201,17 @@ AutoHeapSession::AutoHeapSession(JSRunti
 }
 
 AutoHeapSession::~AutoHeapSession()
 {
     MOZ_ASSERT(JS::RuntimeHeapIsBusy());
     runtime->heapState_ = prevState;
 }
 
-JS_PUBLIC_API(JS::HeapState)
+JS_PUBLIC_API JS::HeapState
 JS::RuntimeHeapState()
 {
     return TlsContext.get()->runtime()->heapState();
 }
 
 GCRuntime::IncrementalResult
 GCRuntime::resetIncrementalGC(gc::AbortReason reason, AutoGCSession& session)
 {
@@ -8369,17 +8369,17 @@ JS::AutoDisableGenerationalGC::AutoDisab
 
 JS::AutoDisableGenerationalGC::~AutoDisableGenerationalGC()
 {
     if (--cx->generationalDisabled == 0) {
         cx->nursery().enable();
     }
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsGenerationalGCEnabled(JSRuntime* rt)
 {
     return !rt->mainContextFromOwnThread()->generationalDisabled;
 }
 
 bool
 GCRuntime::gcIfRequested()
 {
@@ -8868,32 +8868,32 @@ AutoDisableProxyCheck::AutoDisableProxyC
     TlsContext.get()->disableStrictProxyChecking();
 }
 
 AutoDisableProxyCheck::~AutoDisableProxyCheck()
 {
     TlsContext.get()->enableStrictProxyChecking();
 }
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 JS::AssertGCThingMustBeTenured(JSObject* obj)
 {
     MOZ_ASSERT(obj->isTenured() &&
                (!IsNurseryAllocable(obj->asTenured().getAllocKind()) ||
                 obj->getClass()->hasFinalize()));
 }
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 JS::AssertGCThingIsNotNurseryAllocable(Cell* cell)
 {
     MOZ_ASSERT(cell);
     MOZ_ASSERT(!cell->is<JSObject>() && !cell->is<JSString>());
 }
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 js::gc::AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind)
 {
     if (!cell) {
         MOZ_ASSERT(kind == JS::TraceKind::Null);
         return;
     }
 
     MOZ_ASSERT(IsCellPointerValid(cell));
@@ -8957,17 +8957,17 @@ JS::AutoEnterCycleCollection::~AutoEnter
 JS::AutoAssertGCCallback::AutoAssertGCCallback()
   : AutoSuppressGCAnalysis()
 {
     MOZ_ASSERT(JS::RuntimeHeapIsCollecting());
 }
 
 #endif // DEBUG
 
-JS_FRIEND_API(const char*)
+JS_FRIEND_API const char*
 JS::GCTraceKindToAscii(JS::TraceKind kind)
 {
     switch(kind) {
 #define MAP_NAME(name, _0, _1) case JS::TraceKind::name: return #name;
 JS_FOR_EACH_TRACEKIND(MAP_NAME);
 #undef MAP_NAME
       default: return "Invalid";
     }
@@ -9033,89 +9033,89 @@ js::gc::CheckHashTablesAfterMovingGC(JSR
             if (r->debugEnvs()) {
                 r->debugEnvs()->checkHashTablesAfterMovingGC();
             }
         }
     }
 }
 #endif
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::PrepareZoneForGC(Zone* zone)
 {
     zone->scheduleGC();
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::PrepareForFullGC(JSContext* cx)
 {
     for (ZonesIter zone(cx->runtime(), WithAtoms); !zone.done(); zone.next()) {
         zone->scheduleGC();
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::PrepareForIncrementalGC(JSContext* cx)
 {
     if (!JS::IsIncrementalGCInProgress(cx)) {
         return;
     }
 
     for (ZonesIter zone(cx->runtime(), WithAtoms); !zone.done(); zone.next()) {
         if (zone->wasGCStarted()) {
             PrepareZoneForGC(zone);
         }
     }
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsGCScheduled(JSContext* cx)
 {
     for (ZonesIter zone(cx->runtime(), WithAtoms); !zone.done(); zone.next()) {
         if (zone->isGCScheduled()) {
             return true;
         }
     }
 
     return false;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::SkipZoneForGC(Zone* zone)
 {
     zone->unscheduleGC();
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::NonIncrementalGC(JSContext* cx, JSGCInvocationKind gckind, gcreason::Reason reason)
 {
     MOZ_ASSERT(gckind == GC_NORMAL || gckind == GC_SHRINK);
     cx->runtime()->gc.gc(gckind, reason);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::StartIncrementalGC(JSContext* cx, JSGCInvocationKind gckind, gcreason::Reason reason, int64_t millis)
 {
     MOZ_ASSERT(gckind == GC_NORMAL || gckind == GC_SHRINK);
     cx->runtime()->gc.startGC(gckind, reason, millis);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IncrementalGCSlice(JSContext* cx, gcreason::Reason reason, int64_t millis)
 {
     cx->runtime()->gc.gcSlice(reason, millis);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::FinishIncrementalGC(JSContext* cx, gcreason::Reason reason)
 {
     cx->runtime()->gc.finishGC(reason);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::AbortIncrementalGC(JSContext* cx)
 {
     if (IsIncrementalGCInProgress(cx)) {
         cx->runtime()->gc.abortGC();
     }
 }
 
 char16_t*
@@ -9206,104 +9206,104 @@ JS::GCDescription::sliceToJSON(JSContext
 }
 
 JS::UniqueChars
 JS::GCDescription::summaryToJSON(JSContext* cx) const
 {
     return cx->runtime()->gc.stats().renderJsonMessage(0, false);
 }
 
-JS_PUBLIC_API(JS::UniqueChars)
+JS_PUBLIC_API JS::UniqueChars
 JS::MinorGcToJSON(JSContext* cx)
 {
     JSRuntime* rt = cx->runtime();
     return rt->gc.stats().renderNurseryJson(rt);
 }
 
-JS_PUBLIC_API(JS::GCSliceCallback)
+JS_PUBLIC_API JS::GCSliceCallback
 JS::SetGCSliceCallback(JSContext* cx, GCSliceCallback callback)
 {
     return cx->runtime()->gc.setSliceCallback(callback);
 }
 
-JS_PUBLIC_API(JS::DoCycleCollectionCallback)
+JS_PUBLIC_API JS::DoCycleCollectionCallback
 JS::SetDoCycleCollectionCallback(JSContext* cx, JS::DoCycleCollectionCallback callback)
 {
     return cx->runtime()->gc.setDoCycleCollectionCallback(callback);
 }
 
-JS_PUBLIC_API(JS::GCNurseryCollectionCallback)
+JS_PUBLIC_API JS::GCNurseryCollectionCallback
 JS::SetGCNurseryCollectionCallback(JSContext* cx, GCNurseryCollectionCallback callback)
 {
     return cx->runtime()->gc.setNurseryCollectionCallback(callback);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::DisableIncrementalGC(JSContext* cx)
 {
     cx->runtime()->gc.disallowIncrementalGC();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsIncrementalGCEnabled(JSContext* cx)
 {
     return cx->runtime()->gc.isIncrementalGCEnabled()
         && !mozilla::recordreplay::IsRecordingOrReplaying();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsIncrementalGCInProgress(JSContext* cx)
 {
     return cx->runtime()->gc.isIncrementalGCInProgress() && !cx->runtime()->gc.isVerifyPreBarriersEnabled();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsIncrementalGCInProgress(JSRuntime* rt)
 {
     return rt->gc.isIncrementalGCInProgress() && !rt->gc.isVerifyPreBarriersEnabled();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::IsIncrementalBarrierNeeded(JSContext* cx)
 {
     if (JS::RuntimeHeapIsBusy()) {
         return false;
     }
 
     auto state = cx->runtime()->gc.state();
     return state != gc::State::NotActive && state <= gc::State::Sweep;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IncrementalPreWriteBarrier(JSObject* obj)
 {
     if (!obj) {
         return;
     }
 
     MOZ_ASSERT(!JS::RuntimeHeapIsMajorCollecting());
     JSObject::writeBarrierPre(obj);
 }
 
 struct IncrementalReadBarrierFunctor {
     template <typename T> void operator()(T* t) { T::readBarrier(t); }
 };
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IncrementalReadBarrier(GCCellPtr thing)
 {
     if (!thing) {
         return;
     }
 
     MOZ_ASSERT(!JS::RuntimeHeapIsMajorCollecting());
     DispatchTyped(IncrementalReadBarrierFunctor(), thing);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::WasIncrementalGC(JSRuntime* rt)
 {
     return rt->gc.isIncrementalGc();
 }
 
 uint64_t
 js::gc::NextCellUniqueId(JSRuntime* rt)
 {
@@ -9568,17 +9568,17 @@ AutoEmptyNursery::AutoEmptyNursery(JSCon
 
 #ifdef DEBUG
 
 namespace js {
 
 // We don't want jsfriendapi.h to depend on GenericPrinter,
 // so these functions are declared directly in the cpp.
 
-extern JS_FRIEND_API(void)
+extern JS_FRIEND_API void
 DumpString(JSString* str, js::GenericPrinter& out);
 
 }
 
 void
 js::gc::Cell::dump(js::GenericPrinter& out) const
 {
     switch (getTraceKind()) {
@@ -9616,17 +9616,17 @@ CanCheckGrayBits(const Cell* cell)
         return false;
     }
 
     auto tc = &cell->asTenured();
     auto rt = tc->runtimeFromAnyThread();
     return CurrentThreadCanAccessRuntime(rt) && rt->gc.areGrayBitsValid();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 js::gc::detail::CellIsMarkedGrayIfKnown(const Cell* cell)
 {
     // We ignore the gray marking state of cells and return false in the
     // following cases:
     //
     // 1) When OOM has caused us to clear the gcGrayBitsValid_ flag.
     //
     // 2) When we are in an incremental GC and examine a cell that is in a zone
@@ -9650,17 +9650,17 @@ js::gc::detail::CellIsMarkedGrayIfKnown(
         return false;
     }
 
     return detail::CellIsMarkedGray(tc);
 }
 
 #ifdef DEBUG
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 js::gc::detail::CellIsNotGray(const Cell* cell)
 {
     // Check that a cell is not marked gray.
     //
     // Since this is a debug-only check, take account of the eventual mark state
     // of cells that will be marked black by the next GC slice in an incremental
     // GC. For performance reasons we don't do this in CellIsMarkedGrayIfKnown.
 
@@ -9671,17 +9671,17 @@ js::gc::detail::CellIsNotGray(const Cell
     // TODO: I'd like to AssertHeapIsIdle() here, but this ends up getting
     // called during GC and while iterating the heap for memory reporting.
     MOZ_ASSERT(!JS::RuntimeHeapIsCycleCollecting());
 
     auto tc = &cell->asTenured();
     return !detail::CellIsMarkedGray(tc);
 }
 
-extern JS_PUBLIC_API(bool)
+extern JS_PUBLIC_API bool
 js::gc::detail::ObjectIsMarkedBlack(const JSObject* obj)
 {
     return obj->isMarkedBlack();
 }
 
 #endif
 
 js::gc::ClearEdgesTracer::ClearEdgesTracer()
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -194,19 +194,19 @@ class FreeSpan
  * <----------------------------------------------> = ArenaSize bytes
  * +---------------+---------+----+----+-----+----+
  * | header fields | padding | T0 | T1 | ... | Tn |
  * +---------------+---------+----+----+-----+----+
  * <-------------------------> = first thing offset
  */
 class Arena
 {
-    static JS_FRIEND_DATA(const uint32_t) ThingSizes[];
-    static JS_FRIEND_DATA(const uint32_t) FirstThingOffsets[];
-    static JS_FRIEND_DATA(const uint32_t) ThingsPerArena[];
+    static JS_FRIEND_DATA const uint32_t ThingSizes[];
+    static JS_FRIEND_DATA const uint32_t FirstThingOffsets[];
+    static JS_FRIEND_DATA const uint32_t ThingsPerArena[];
 
     /*
      * The first span of free things in the arena. Most of these spans are
      * stored as offsets in free regions of the data array, and most operations
      * on FreeSpans take an Arena pointer for safety. However, the FreeSpans
      * used for allocation are stored here, at the start of an Arena, and use
      * their own address to grab the next span within the same Arena.
      */
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -400,44 +400,44 @@ js::gc::AssertRootMarkingPhase(JSTracer*
 
 template <typename T> T DoCallback(JS::CallbackTracer* trc, T* thingp, const char* name);
 template <typename T> void DoMarking(GCMarker* gcmarker, T* thing);
 template <typename T> void DoMarking(GCMarker* gcmarker, const T& thing);
 template <typename T> void NoteWeakEdge(GCMarker* gcmarker, T** thingp);
 template <typename T> void NoteWeakEdge(GCMarker* gcmarker, T* thingp);
 
 template <typename T>
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 js::gc::TraceExternalEdge(JSTracer* trc, T* thingp, const char* name)
 {
     MOZ_ASSERT(InternalBarrierMethods<T>::isMarkable(*thingp));
     TraceEdgeInternal(trc, ConvertToBase(thingp), name);
 }
 
 template <typename T>
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 js::UnsafeTraceManuallyBarrieredEdge(JSTracer* trc, T* thingp, const char* name)
 {
     TraceEdgeInternal(trc, ConvertToBase(thingp), name);
 }
 
 template <typename T>
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::UnsafeTraceRoot(JSTracer* trc, T* thingp, const char* name)
 {
     MOZ_ASSERT(thingp);
     js::TraceNullableRoot(trc, thingp, name);
 }
 
 // Instantiate a copy of the Tracing templates for each public GC pointer type.
 #define INSTANTIATE_PUBLIC_TRACE_FUNCTIONS(type) \
-    template JS_PUBLIC_API(void) JS::UnsafeTraceRoot<type>(JSTracer*, type*, const char*); \
-    template JS_PUBLIC_API(void) js::UnsafeTraceManuallyBarrieredEdge<type>(JSTracer*, type*, \
-                                                                            const char*); \
-    template JS_PUBLIC_API(void) js::gc::TraceExternalEdge<type>(JSTracer*, type*, const char*);
+    template JS_PUBLIC_API void JS::UnsafeTraceRoot<type>(JSTracer*, type*, const char*); \
+    template JS_PUBLIC_API void js::UnsafeTraceManuallyBarrieredEdge<type>(JSTracer*, type*, \
+                                                                           const char*); \
+    template JS_PUBLIC_API void js::gc::TraceExternalEdge<type>(JSTracer*, type*, const char*);
 FOR_EACH_PUBLIC_GC_POINTER_TYPE(INSTANTIATE_PUBLIC_TRACE_FUNCTIONS)
 FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(INSTANTIATE_PUBLIC_TRACE_FUNCTIONS)
 #undef INSTANTIATE_PUBLIC_TRACE_FUNCTIONS
 
 namespace js {
 namespace gc {
 
 #define INSTANTIATE_INTERNAL_TRACE_FUNCTIONS(type) \
@@ -3460,33 +3460,33 @@ js::gc::IsAboutToBeFinalizedInternal(T* 
     *thingp = DispatchTyped(IsAboutToBeFinalizedInternalFunctor<T>(), *thingp, &rv);
     return rv;
 }
 
 namespace js {
 namespace gc {
 
 template <typename T>
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 EdgeNeedsSweep(JS::Heap<T>* thingp)
 {
     return IsAboutToBeFinalizedInternal(ConvertToBase(thingp->unsafeGet()));
 }
 
 template <typename T>
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 EdgeNeedsSweepUnbarrieredSlow(T* thingp)
 {
     return IsAboutToBeFinalizedInternal(ConvertToBase(thingp));
 }
 
 // Instantiate a copy of the Tracing templates for each public GC type.
 #define INSTANTIATE_ALL_VALID_HEAP_TRACE_FUNCTIONS(type) \
-    template JS_PUBLIC_API(bool) EdgeNeedsSweep<type>(JS::Heap<type>*); \
-    template JS_PUBLIC_API(bool) EdgeNeedsSweepUnbarrieredSlow<type>(type*);
+    template JS_PUBLIC_API bool EdgeNeedsSweep<type>(JS::Heap<type>*); \
+    template JS_PUBLIC_API bool EdgeNeedsSweepUnbarrieredSlow<type>(type*);
 FOR_EACH_PUBLIC_GC_POINTER_TYPE(INSTANTIATE_ALL_VALID_HEAP_TRACE_FUNCTIONS)
 FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(INSTANTIATE_ALL_VALID_HEAP_TRACE_FUNCTIONS)
 
 #define INSTANTIATE_INTERNAL_MARKING_FUNCTIONS(type) \
     template bool IsMarkedInternal(JSRuntime* rt, type* thing); \
     template bool IsAboutToBeFinalizedInternal(type* thingp);
 
 #define INSTANTIATE_INTERNAL_MARKING_FUNCTIONS_FROM_TRACEKIND(_1, type, _2) \
@@ -3643,17 +3643,17 @@ UnmarkGrayGCThing(JSRuntime* rt, JS::GCC
     mozilla::recordreplay::AutoDisallowThreadEvents d;
 
     UnmarkGrayTracer unmarker(rt);
     gcstats::AutoPhase innerPhase(rt->gc.stats(), gcstats::PhaseKind::UNMARK_GRAY);
     unmarker.unmark(thing);
     return unmarker.unmarkedAny;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 JS::UnmarkGrayGCThingRecursively(JS::GCCellPtr thing)
 {
     MOZ_ASSERT(!JS::RuntimeHeapIsCollecting());
     MOZ_ASSERT(!JS::RuntimeHeapIsCycleCollecting());
 
     JSRuntime* rt = thing.asCell()->runtimeFromMainThread();
     gcstats::AutoPhase outerPhase(rt->gc.stats(), gcstats::PhaseKind::BARRIER);
     return UnmarkGrayGCThing(rt, thing);
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -1354,23 +1354,23 @@ js::Nursery::sweepMapAndSetObjects()
     mapsWithNurseryMemory_.clearAndFree();
 
     for (auto setobj : setsWithNurseryMemory_) {
         SetObject::sweepAfterMinorGC(fop, setobj);
     }
     setsWithNurseryMemory_.clearAndFree();
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::EnableNurseryStrings(JSContext* cx)
 {
     AutoEmptyNursery empty(cx);
     ReleaseAllJITCode(cx->runtime()->defaultFreeOp());
     cx->runtime()->gc.nursery().enableStrings();
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::DisableNurseryStrings(JSContext* cx)
 {
     AutoEmptyNursery empty(cx);
     ReleaseAllJITCode(cx->runtime()->defaultFreeOp());
     cx->runtime()->gc.nursery().disableStrings();
 }
--- a/js/src/gc/PublicIterators.cpp
+++ b/js/src/gc/PublicIterators.cpp
@@ -211,40 +211,40 @@ void
 js::IterateGrayObjectsUnderCC(Zone* zone, GCThingCallback cellCallback, void* data)
 {
     mozilla::DebugOnly<JSRuntime*> rt = zone->runtimeFromMainThread();
     MOZ_ASSERT(JS::RuntimeHeapIsCycleCollecting());
     MOZ_ASSERT(!rt->gc.isIncrementalGCInProgress());
     ::IterateGrayObjects(zone, cellCallback, data);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_IterateCompartments(JSContext* cx, void* data,
                        JSIterateCompartmentCallback compartmentCallback)
 {
     AutoTraceSession session(cx->runtime());
 
     for (CompartmentsIter c(cx->runtime()); !c.done(); c.next()) {
         (*compartmentCallback)(cx, data, c);
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IterateRealms(JSContext* cx, void* data, JS::IterateRealmCallback realmCallback)
 {
     AutoTraceSession session(cx->runtime());
 
     Rooted<Realm*> realm(cx);
     for (RealmsIter r(cx->runtime()); !r.done(); r.next()) {
         realm = r;
         (*realmCallback)(cx, data, realm);
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IterateRealmsWithPrincipals(JSContext* cx, JSPrincipals* principals, void* data,
                                 JS::IterateRealmCallback realmCallback)
 {
     MOZ_ASSERT(principals);
 
     AutoTraceSession session(cx->runtime());
 
     Rooted<Realm*> realm(cx);
@@ -252,17 +252,17 @@ JS::IterateRealmsWithPrincipals(JSContex
         if (r->principals() != principals) {
             continue;
         }
         realm = r;
         (*realmCallback)(cx, data, realm);
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::IterateRealmsInCompartment(JSContext* cx, JS::Compartment* compartment, void* data,
                                JS::IterateRealmCallback realmCallback)
 {
     AutoTraceSession session(cx->runtime());
 
     Rooted<Realm*> realm(cx);
     for (RealmsInCompartmentIter r(compartment); !r.done(); r.next()) {
         realm = r;
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -616,19 +616,19 @@ GCRuntime::resetBufferedGrayRoots() cons
 {
     MOZ_ASSERT(grayBufferState != GrayBufferState::Okay,
                "Do not clear the gray buffers unless we are Failed or becoming Unused");
     for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
         zone->gcGrayRoots().clearAndFree();
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::AddPersistentRoot(JS::RootingContext* cx, RootKind kind, PersistentRooted<void*>* root)
 {
     static_cast<JSContext*>(cx)->runtime()->heapRoots.ref()[kind].insertBack(root);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::AddPersistentRoot(JSRuntime* rt, RootKind kind, PersistentRooted<void*>* root)
 {
     rt->heapRoots.ref()[kind].insertBack(root);
 }
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -63,17 +63,17 @@ js::gcstats::ExplainInvocationKind(JSGCI
     MOZ_ASSERT(gckind == GC_NORMAL || gckind == GC_SHRINK);
     if (gckind == GC_NORMAL) {
          return "Normal";
     } else {
          return "Shrinking";
     }
 }
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS::gcreason::ExplainReason(JS::gcreason::Reason reason)
 {
     switch (reason) {
 #define SWITCH_REASON(name, _)                    \
         case JS::gcreason::name:                    \
           return #name;
         GCREASONS(SWITCH_REASON)
 
--- a/js/src/gc/Tracer.cpp
+++ b/js/src/gc/Tracer.cpp
@@ -112,17 +112,17 @@ JS::CallbackTracer::getTracingEdgeName(c
         return;
     }
     snprintf(buffer, bufferSize, "%s", contextName_);
 }
 
 
 /*** Public Tracing API **************************************************************************/
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::TraceChildren(JSTracer* trc, GCCellPtr thing)
 {
     js::TraceChildren(trc, thing.asCell(), thing.kind());
 }
 
 struct TraceChildrenFunctor {
     template <typename T>
     void operator()(JSTracer* trc, void* thingArg) {
@@ -159,17 +159,17 @@ struct TraceIncomingFunctor {
     }
     // StringWrappers are just used to avoid copying strings
     // across zones multiple times, and don't hold a strong
     // reference.
     void operator()(JSString** tp) {}
 };
 } // namespace (anonymous)
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::TraceIncomingCCWs(JSTracer* trc, const JS::CompartmentSet& compartments)
 {
     for (js::CompartmentsIter comp(trc->runtime()); !comp.done(); comp.next()) {
         if (compartments.has(comp)) {
             continue;
         }
 
         for (Compartment::WrapperEnum e(comp); !e.empty(); e.popFront()) {
@@ -344,17 +344,17 @@ StringKindHeader(JSString* str)
         return "dependent: ";
     }
     if (str->isExternal()) {
         return "external: ";
     }
     return "linear: ";
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
                      JS::TraceKind kind, bool details)
 {
     const char* name = nullptr; /* silence uninitialized warning */
     size_t n;
 
     if (bufsize == 0) {
         return;
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -753,17 +753,17 @@ CheckGrayMarkingTracer::check(AutoTraceS
 {
     if (!traceHeap(session)) {
         return true; // Ignore failure.
     }
 
     return failures == 0;
 }
 
-JS_FRIEND_API(bool)
+JS_FRIEND_API bool
 js::CheckGrayMarkingState(JSRuntime* rt)
 {
     MOZ_ASSERT(!JS::RuntimeHeapIsCollecting());
     MOZ_ASSERT(!rt->gc.isIncrementalGCInProgress());
     if (!rt->gc.areGrayBitsValid()) {
         return true;
     }
 
--- a/js/src/gc/WeakMapPtr.cpp
+++ b/js/src/gc/WeakMapPtr.cpp
@@ -118,14 +118,14 @@ JS::WeakMapPtr<K, V>::removeValue(const 
     }
     return WeakMapDetails::DataType<V>::NullValue();
 }
 
 //
 // Supported specializations of JS::WeakMap:
 //
 
-template class JS_PUBLIC_API(JS::WeakMapPtr)<JSObject*, JSObject*>;
+template class JS_PUBLIC_API JS::WeakMapPtr<JSObject*, JSObject*>;
 
 #ifdef DEBUG
 // Nobody's using this at the moment, but we want to make sure it compiles.
-template class JS_PUBLIC_API(JS::WeakMapPtr)<JSObject*, JS::Value>;
+template class JS_PUBLIC_API JS::WeakMapPtr<JSObject*, JS::Value>;
 #endif
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -637,13 +637,13 @@ ZoneList::removeFront()
 void
 ZoneList::clear()
 {
     while (!isEmpty()) {
         removeFront();
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::shadow::RegisterWeakCache(JS::Zone* zone, detail::WeakCacheBase* cachep)
 {
     zone->registerWeakCache(cachep);
 }
--- a/js/src/jit/BaselineCacheIRCompiler.cpp
+++ b/js/src/jit/BaselineCacheIRCompiler.cpp
@@ -2184,16 +2184,37 @@ BaselineCacheIRCompiler::init(CacheKind 
 
     allocator.initAvailableRegs(available);
     outputUnchecked_.emplace(R0);
     return true;
 }
 
 static const size_t MaxOptimizedCacheIRStubs = 16;
 
+static void
+ResetEnteredCounts(ICFallbackStub* stub)
+{
+    for (ICStubIterator iter = stub->beginChain(); !iter.atEnd(); iter++) {
+        switch (iter->kind()) {
+          case ICStub::CacheIR_Regular:
+            iter->toCacheIR_Regular()->resetEnteredCount();
+            break;
+          case ICStub::CacheIR_Updated:
+            iter->toCacheIR_Updated()->resetEnteredCount();
+            break;
+          case ICStub::CacheIR_Monitored:
+            iter->toCacheIR_Monitored()->resetEnteredCount();
+            break;
+          default:
+            break;
+        }
+    }
+    stub->resetEnteredCount();
+}
+
 ICStub*
 js::jit::AttachBaselineCacheIRStub(JSContext* cx, const CacheIRWriter& writer,
                                    CacheKind kind, BaselineCacheIRStubKind stubKind,
                                    JSScript* outerScript, ICFallbackStub* stub,
                                    bool* attached)
 {
     // We shouldn't GC or report OOM (or any other exception) here.
     AutoAssertNoPendingException aanpe(cx);
@@ -2325,16 +2346,20 @@ js::jit::AttachBaselineCacheIRStub(JSCon
 
     ICStubSpace* stubSpace = ICStubCompiler::StubSpaceForStub(stubInfo->makesGCCalls(),
                                                               outerScript);
     void* newStubMem = stubSpace->alloc(bytesNeeded);
     if (!newStubMem) {
         return nullptr;
     }
 
+    // Resetting the entered counts on the IC chain makes subsequent reasoning
+    // about the chain much easier.
+    ResetEnteredCounts(stub);
+
     switch (stubKind) {
       case BaselineCacheIRStubKind::Regular: {
         auto newStub = new(newStubMem) ICCacheIR_Regular(code, stubInfo);
         writer.copyStubData(newStub->stubDataStart());
         stub->addNewStub(newStub);
         *attached = true;
         return newStub;
       }
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -1126,20 +1126,16 @@ DoTypeMonitorFallback(JSContext* cx, Bas
         MOZ_ASSERT(pc == script->code());
         types = TypeScript::ThisTypes(script);
         TypeScript::SetThis(cx, script, value);
     } else {
         types = TypeScript::BytecodeTypes(script, pc);
         TypeScript::Monitor(cx, script, pc, types, value);
     }
 
-    if (MOZ_UNLIKELY(stub->invalid())) {
-        return true;
-    }
-
     return stub->addMonitorStubForValue(cx, frame, types, value);
 }
 
 typedef bool (*DoTypeMonitorFallbackFn)(JSContext*, BaselineFrame*, ICTypeMonitor_Fallback*,
                                         HandleValue, MutableHandleValue);
 static const VMFunction DoTypeMonitorFallbackInfo =
     FunctionInfo<DoTypeMonitorFallbackFn>(DoTypeMonitorFallback, "DoTypeMonitorFallback",
                                           TailCall);
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -673,24 +673,16 @@ class ICFallbackStub : public ICStub
     inline ICEntry* icEntry() const {
         return icEntry_;
     }
 
     inline size_t numOptimizedStubs() const {
         return state_.numOptimizedStubs();
     }
 
-    void setInvalid() {
-        state_.setInvalid();
-    }
-
-    bool invalid() const {
-        return state_.invalid();
-    }
-
     ICState& state() {
         return state_;
     }
 
     // The icEntry and lastStubPtrAddr_ fields can't be initialized when the stub is
     // created since the stub is created at compile time, and we won't know the IC entry
     // address until after compile when the JitScript is created.  This method
     // allows these fields to be fixed up at that point.
@@ -698,17 +690,16 @@ class ICFallbackStub : public ICStub
         MOZ_ASSERT(icEntry_ == nullptr);
         MOZ_ASSERT(lastStubPtrAddr_ == nullptr);
         icEntry_ = icEntry;
         lastStubPtrAddr_ = icEntry_->addressOfFirstStub();
     }
 
     // Add a new stub to the IC chain terminated by this fallback stub.
     void addNewStub(ICStub* stub) {
-        MOZ_ASSERT(!invalid());
         MOZ_ASSERT(*lastStubPtrAddr_ == this);
         MOZ_ASSERT(stub->next() == nullptr);
         stub->setNext(this);
         *lastStubPtrAddr_ = stub;
         lastStubPtrAddr_ = stub->addressOfNext();
         state_.trackAttached();
     }
 
@@ -743,16 +734,17 @@ class ICFallbackStub : public ICStub
 
     void unlinkStub(Zone* zone, ICStub* prev, ICStub* stub);
     void unlinkStubsWithKind(JSContext* cx, ICStub::Kind kind);
 
     // Return the number of times this stub has successfully provided a value to the
     // caller.
     uint32_t enteredCount() const { return enteredCount_; }
     inline void incrementEnteredCount() { enteredCount_++; }
+    void resetEnteredCount() { enteredCount_ = 0; }
 };
 
 // Shared trait for all CacheIR stubs.
 template <typename T>
 class ICCacheIR_Trait
 {
   protected:
     const CacheIRStubInfo* stubInfo_;
@@ -771,16 +763,18 @@ class ICCacheIR_Trait
 
     const CacheIRStubInfo* stubInfo() const {
         return stubInfo_;
     }
 
     // Return the number of times this stub has successfully provided a value to the
     // caller.
     uint32_t enteredCount() const { return enteredCount_; }
+    void resetEnteredCount() { enteredCount_ = 0; }
+
     static size_t offsetOfEnteredCount() { return offsetof(T, enteredCount_); }
 };
 
 // Base class for Trait::Regular CacheIR stubs
 class ICCacheIR_Regular : public ICStub, public ICCacheIR_Trait<ICCacheIR_Regular>
 {
   public:
     ICCacheIR_Regular(JitCode* stubCode, const CacheIRStubInfo* stubInfo)
@@ -1237,45 +1231,41 @@ class ICTypeMonitor_Fallback : public IC
     // Address of the last monitor stub's field pointing to this
     // fallback monitor stub.  This will get updated when new
     // monitor stubs are created and added.
     ICStub** lastMonitorStubPtrAddr_;
 
     // Count of optimized type monitor stubs in this chain.
     uint32_t numOptimizedMonitorStubs_ : 7;
 
-    uint32_t invalid_ : 1;
-
     // Whether this has a fallback stub referring to the IC entry.
     bool hasFallbackStub_ : 1;
 
     // Index of 'this' or argument which is being monitored, or BYTECODE_INDEX
     // if this is monitoring the types of values pushed at some bytecode.
     uint32_t argumentIndex_ : 23;
 
     static const uint32_t BYTECODE_INDEX = (1 << 23) - 1;
 
     ICTypeMonitor_Fallback(JitCode* stubCode, ICMonitoredFallbackStub* mainFallbackStub,
                            uint32_t argumentIndex)
       : ICStub(ICStub::TypeMonitor_Fallback, stubCode),
         mainFallbackStub_(mainFallbackStub),
         firstMonitorStub_(thisFromCtor()),
         lastMonitorStubPtrAddr_(nullptr),
         numOptimizedMonitorStubs_(0),
-        invalid_(false),
         hasFallbackStub_(mainFallbackStub != nullptr),
         argumentIndex_(argumentIndex)
     { }
 
     ICTypeMonitor_Fallback* thisFromCtor() {
         return this;
     }
 
     void addOptimizedMonitorStub(ICStub* stub) {
-        MOZ_ASSERT(!invalid());
         stub->setNext(this);
 
         MOZ_ASSERT((lastMonitorStubPtrAddr_ != nullptr) ==
                    (numOptimizedMonitorStubs_ || !hasFallbackStub_));
 
         if (lastMonitorStubPtrAddr_) {
             *lastMonitorStubPtrAddr_ = stub;
         }
@@ -1321,24 +1311,16 @@ class ICTypeMonitor_Fallback : public IC
     static inline size_t offsetOfFirstMonitorStub() {
         return offsetof(ICTypeMonitor_Fallback, firstMonitorStub_);
     }
 
     inline uint32_t numOptimizedMonitorStubs() const {
         return numOptimizedMonitorStubs_;
     }
 
-    void setInvalid() {
-        invalid_ = 1;
-    }
-
-    bool invalid() const {
-        return invalid_;
-    }
-
     inline bool monitorsThis() const {
         return argumentIndex_ == 0;
     }
 
     inline bool monitorsArgument(uint32_t* pargument) const {
         if (argumentIndex_ > 0 && argumentIndex_ < BYTECODE_INDEX) {
             *pargument = argumentIndex_ - 1;
             return true;
--- a/js/src/jit/ICState.h
+++ b/js/src/jit/ICState.h
@@ -30,19 +30,16 @@ class ICState
     Mode mode_;
 
     // Number of optimized stubs currently attached to this IC.
     uint8_t numOptimizedStubs_;
 
     // Number of times we failed to attach a stub.
     uint8_t numFailures_;
 
-    // This is only used for shared Baseline ICs and stored here to save space.
-    bool invalid_ : 1;
-
     static const size_t MaxOptimizedStubs = 6;
 
     void transition(Mode mode) {
         MOZ_ASSERT(mode > mode_);
         mode_ = mode;
         numFailures_ = 0;
     }
 
@@ -52,17 +49,16 @@ class ICState
                       "numFailures_/maxFailures should fit in uint8_t");
         size_t res = 5 + size_t(40) * numOptimizedStubs_;
         MOZ_ASSERT(res <= UINT8_MAX, "numFailures_ should not overflow");
         return res;
     }
 
   public:
     ICState()
-      : invalid_(false)
     {
         reset();
     }
 
     Mode mode() const { return mode_; }
     size_t numOptimizedStubs() const { return numOptimizedStubs_; }
     bool hasFailures() const { return (numFailures_ != 0); }
 
@@ -71,19 +67,16 @@ class ICState
         // because old-style baseline ICs may attach more stubs than
         // MaxOptimizedStubs allows.
         if (mode_ == Mode::Generic || JitOptions.disableCacheIR) {
             return false;
         }
         return true;
     }
 
-    bool invalid() const { return invalid_; }
-    void setInvalid() { invalid_ = true; }
-
     // If this returns true, we transitioned to a new mode and the caller
     // should discard all stubs.
     MOZ_MUST_USE MOZ_ALWAYS_INLINE bool maybeTransition() {
         // Note: we cannot assert that numOptimizedStubs_ <= MaxOptimizedStubs
         // because old-style baseline ICs may attach more stubs than
         // MaxOptimizedStubs allows.
         if (mode_ == Mode::Generic) {
             return false;
--- a/js/src/jit/JitcodeMap.cpp
+++ b/js/src/jit/JitcodeMap.cpp
@@ -1695,26 +1695,26 @@ JS::ProfiledFrameHandle::ProfiledFrameHa
     if (!canonicalAddr_) {
         // If the entry has tracked optimizations, updateHasTrackedOptimizations
         // would have updated the canonical address.
         MOZ_ASSERT_IF(entry_.isIon(), !hasTrackedOptimizations());
         canonicalAddr_ = entry_.canonicalNativeAddrFor(rt_, addr_);
     }
 }
 
-JS_PUBLIC_API(JS::ProfilingFrameIterator::FrameKind)
+JS_PUBLIC_API JS::ProfilingFrameIterator::FrameKind
 JS::ProfiledFrameHandle::frameKind() const
 {
     if (entry_.isBaseline()) {
         return JS::ProfilingFrameIterator::Frame_Baseline;
     }
     return JS::ProfilingFrameIterator::Frame_Ion;
 }
 
-JS_PUBLIC_API(JS::ProfiledFrameRange)
+JS_PUBLIC_API JS::ProfiledFrameRange
 JS::GetProfiledFrames(JSContext* cx, void* addr)
 {
     JSRuntime* rt = cx->runtime();
     js::jit::JitcodeGlobalTable* table = rt->jitRuntime()->getJitcodeGlobalTable();
     js::jit::JitcodeGlobalEntry* entry = table->lookup(addr);
 
     ProfiledFrameRange result(rt, addr, entry);
 
--- a/js/src/jit/OptimizationTracking.cpp
+++ b/js/src/jit/OptimizationTracking.cpp
@@ -84,47 +84,47 @@ TrackedOptimizations::matchTypes(const T
 }
 
 bool
 TrackedOptimizations::matchAttempts(const TempOptimizationAttemptsVector& other) const
 {
     return VectorContentsMatch(&attempts_, &other);
 }
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS::TrackedStrategyString(TrackedStrategy strategy)
 {
     switch (strategy) {
 #define STRATEGY_CASE(name)                       \
       case TrackedStrategy::name:                 \
         return #name;
     TRACKED_STRATEGY_LIST(STRATEGY_CASE)
 #undef STRATEGY_CASE
 
       default:
         MOZ_CRASH("bad strategy");
     }
 }
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS::TrackedOutcomeString(TrackedOutcome outcome)
 {
     switch (outcome) {
 #define OUTCOME_CASE(name)                        \
       case TrackedOutcome::name:                  \
         return #name;
       TRACKED_OUTCOME_LIST(OUTCOME_CASE)
 #undef OUTCOME_CASE
 
       default:
         MOZ_CRASH("bad outcome");
     }
 }
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS::TrackedTypeSiteString(TrackedTypeSite site)
 {
     switch (site) {
 #define TYPESITE_CASE(name)                       \
       case TrackedTypeSite::name:                 \
         return #name;
       TRACKED_TYPESITE_LIST(TYPESITE_CASE)
 #undef TYPESITE_CASE
@@ -1335,24 +1335,24 @@ FrameHandle::updateHasTrackedOptimizatio
 
     uint32_t entryOffset;
     optsIndex_ = entry_.trackedOptimizationIndexAtAddr(rt_, addr_, &entryOffset);
     if (optsIndex_.isSome()) {
         canonicalAddr_ = (void*)(((uint8_t*) entry_.nativeStartAddr()) + entryOffset);
     }
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 FrameHandle::forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
                                         JSScript** scriptOut, jsbytecode** pcOut) const
 {
     MOZ_ASSERT(optsIndex_.isSome());
     entry_.forEachOptimizationAttempt(rt_, *optsIndex_, op);
     entry_.youngestFrameLocationAtAddr(rt_, addr_, scriptOut, pcOut);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 FrameHandle::forEachOptimizationTypeInfo(ForEachTrackedOptimizationTypeInfoOp& op) const
 {
     MOZ_ASSERT(optsIndex_.isSome());
     IonTrackedOptimizationsTypeInfo::ForEachOpAdapter adapter(op);
     entry_.forEachOptimizationTypeInfo(rt_, *optsIndex_, adapter);
 }
--- a/js/src/jit/ProcessExecutableMemory.cpp
+++ b/js/src/jit/ProcessExecutableMemory.cpp
@@ -75,17 +75,17 @@ ComputeRandomAllocationAddress()
 
     uint64_t rand = js::GenerateRandomSeed();
     return (void*) (base | (rand & mask));
 }
 
 # ifdef NEED_JIT_UNWIND_HANDLING
 static js::JitExceptionHandler sJitExceptionHandler;
 
-JS_FRIEND_API(void)
+JS_FRIEND_API void
 js::SetJitExceptionHandler(JitExceptionHandler handler)
 {
     MOZ_ASSERT(!sJitExceptionHandler);
     sJitExceptionHandler = handler;
 }
 
 // From documentation for UNWIND_INFO on
 // http://msdn.microsoft.com/en-us/library/ddssxxy8.aspx
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -117,17 +117,17 @@ using JS::ReadOnlyCompileOptions;
 using JS::SourceText;
 
 #ifdef HAVE_VA_LIST_AS_ARRAY
 #define JS_ADDRESSOF_VA_LIST(ap) ((va_list*)(ap))
 #else
 #define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
 #endif
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const
 {
     if (length() < required) {
         char numArgsStr[40];
         SprintfLiteral(numArgsStr, "%u", required - 1);
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                                   fnname, numArgsStr, required == 2 ? "" : "s");
         return false;
@@ -149,17 +149,17 @@ static bool
 ErrorTakesObjectArgument(unsigned msg)
 {
     MOZ_ASSERT(msg < JSErr_Limit);
     unsigned argCount = js_ErrorFormatString[msg].argCount;
     MOZ_ASSERT(argCount <= 2);
     return argCount == 2;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, HandleId id,
                                                bool strict)
 {
     static_assert(unsigned(OkCode) == unsigned(JSMSG_NOT_AN_ERROR),
                   "unsigned value of OkCode must not be an error code");
     MOZ_ASSERT(code_ != Uninitialized);
     MOZ_ASSERT(!ok());
     cx->check(obj);
@@ -195,137 +195,137 @@ JS::ObjectOpResult::reportStrictErrorOrW
         }
 
         return JS_ReportErrorFlagsAndNumberUTF8(cx, flags, GetErrorMessage, nullptr, code_,
                                                 propName.get());
     }
     return JS_ReportErrorFlagsAndNumberASCII(cx, flags, GetErrorMessage, nullptr, code_);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::reportStrictErrorOrWarning(JSContext* cx, HandleObject obj, bool strict)
 {
     MOZ_ASSERT(code_ != Uninitialized);
     MOZ_ASSERT(!ok());
     MOZ_ASSERT(!ErrorTakesArguments(code_));
     cx->check(obj);
 
     unsigned flags = strict ? JSREPORT_ERROR : (JSREPORT_WARNING | JSREPORT_STRICT);
     return JS_ReportErrorFlagsAndNumberASCII(cx, flags, GetErrorMessage, nullptr, code_);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantRedefineProp()
 {
     return fail(JSMSG_CANT_REDEFINE_PROP);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failReadOnly()
 {
     return fail(JSMSG_READ_ONLY);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failGetterOnly()
 {
     return fail(JSMSG_GETTER_ONLY);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantDelete()
 {
     return fail(JSMSG_CANT_DELETE);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantSetInterposed()
 {
     return fail(JSMSG_CANT_SET_INTERPOSED);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantDefineWindowElement()
 {
     return fail(JSMSG_CANT_DEFINE_WINDOW_ELEMENT);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantDeleteWindowElement()
 {
     return fail(JSMSG_CANT_DELETE_WINDOW_ELEMENT);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantDeleteWindowNamedProperty()
 {
     return fail(JSMSG_CANT_DELETE_WINDOW_NAMED_PROPERTY);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantPreventExtensions()
 {
     return fail(JSMSG_CANT_PREVENT_EXTENSIONS);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failCantSetProto()
 {
     return fail(JSMSG_CANT_SET_PROTO);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failNoNamedSetter()
 {
     return fail(JSMSG_NO_NAMED_SETTER);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failNoIndexedSetter()
 {
     return fail(JSMSG_NO_INDEXED_SETTER);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::ObjectOpResult::failNotDataDescriptor()
 {
     return fail(JSMSG_NOT_DATA_DESCRIPTOR);
 }
 
-JS_PUBLIC_API(int64_t)
+JS_PUBLIC_API int64_t
 JS_Now()
 {
     return PRMJ_Now();
 }
 
-JS_PUBLIC_API(Value)
+JS_PUBLIC_API Value
 JS_GetNaNValue(JSContext* cx)
 {
     return cx->runtime()->NaNValue;
 }
 
-JS_PUBLIC_API(Value)
+JS_PUBLIC_API Value
 JS_GetNegativeInfinityValue(JSContext* cx)
 {
     return cx->runtime()->negativeInfinityValue;
 }
 
-JS_PUBLIC_API(Value)
+JS_PUBLIC_API Value
 JS_GetPositiveInfinityValue(JSContext* cx)
 {
     return cx->runtime()->positiveInfinityValue;
 }
 
-JS_PUBLIC_API(Value)
+JS_PUBLIC_API Value
 JS_GetEmptyStringValue(JSContext* cx)
 {
     return StringValue(cx->runtime()->emptyString);
 }
 
-JS_PUBLIC_API(JSString*)
+JS_PUBLIC_API JSString*
 JS_GetEmptyString(JSContext* cx)
 {
     MOZ_ASSERT(cx->emptyString());
     return cx->emptyString();
 }
 
 namespace js {
 
@@ -348,17 +348,17 @@ AssertHeapIsIdleOrStringIsFlat(JSString*
 {
     /*
      * We allow some functions to be called during a GC as long as the argument
      * is a flat string, since that will not cause allocation.
      */
     MOZ_ASSERT_IF(JS::RuntimeHeapIsBusy(), str->isFlat());
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ValueToObject(JSContext* cx, HandleValue value, MutableHandleObject objp)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value);
     if (value.isNullOrUndefined()) {
         objp.set(nullptr);
         return true;
@@ -366,190 +366,190 @@ JS_ValueToObject(JSContext* cx, HandleVa
     JSObject* obj = ToObject(cx, value);
     if (!obj) {
         return false;
     }
     objp.set(obj);
     return true;
 }
 
-JS_PUBLIC_API(JSFunction*)
+JS_PUBLIC_API JSFunction*
 JS_ValueToFunction(JSContext* cx, HandleValue value)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value);
     return ReportIfNotFunction(cx, value);
 }
 
-JS_PUBLIC_API(JSFunction*)
+JS_PUBLIC_API JSFunction*
 JS_ValueToConstructor(JSContext* cx, HandleValue value)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value);
     return ReportIfNotFunction(cx, value);
 }
 
-JS_PUBLIC_API(JSString*)
+JS_PUBLIC_API JSString*
 JS_ValueToSource(JSContext* cx, HandleValue value)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value);
     return ValueToSource(cx, value);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_DoubleIsInt32(double d, int32_t* ip)
 {
     return mozilla::NumberIsInt32(d, ip);
 }
 
-JS_PUBLIC_API(JSType)
+JS_PUBLIC_API JSType
 JS_TypeOfValue(JSContext* cx, HandleValue value)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value);
     return TypeOfValue(value);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_StrictlyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value1, value2);
     MOZ_ASSERT(equal);
     return StrictlyEqual(cx, value1, value2, equal);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_LooselyEqual(JSContext* cx, HandleValue value1, HandleValue value2, bool* equal)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value1, value2);
     MOZ_ASSERT(equal);
     return LooselyEqual(cx, value1, value2, equal);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_SameValue(JSContext* cx, HandleValue value1, HandleValue value2, bool* same)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(value1, value2);
     MOZ_ASSERT(same);
     return SameValue(cx, value1, value2, same);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_IsBuiltinEvalFunction(JSFunction* fun)
 {
     return IsAnyBuiltinEval(fun);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_IsBuiltinFunctionConstructor(JSFunction* fun)
 {
     return fun->isBuiltinFunctionConstructor();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_IsFunctionBound(JSFunction* fun)
 {
     return fun->isBoundFunction();
 }
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS_GetBoundFunctionTarget(JSFunction* fun)
 {
     return fun->isBoundFunction() ?
                fun->getBoundFunctionTarget() : nullptr;
 }
 
 /************************************************************************/
 
-JS_PUBLIC_API(JSContext*)
+JS_PUBLIC_API JSContext*
 JS_NewContext(uint32_t maxbytes, uint32_t maxNurseryBytes, JSRuntime* parentRuntime)
 {
     MOZ_ASSERT(JS::detail::libraryInitState == JS::detail::InitState::Running,
                "must call JS_Init prior to creating any JSContexts");
 
     // Make sure that all parent runtimes are the topmost parent.
     while (parentRuntime && parentRuntime->parentRuntime) {
         parentRuntime = parentRuntime->parentRuntime;
     }
 
     return NewContext(maxbytes, maxNurseryBytes, parentRuntime);
 }
 
-JS_PUBLIC_API(JSContext*)
+JS_PUBLIC_API JSContext*
 JS_NewCooperativeContext(JSContext* siblingContext)
 {
     MOZ_CRASH("Cooperative scheduling is unsupported");
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_YieldCooperativeContext(JSContext* cx)
 {
     MOZ_CRASH("Cooperative scheduling is unsupported");
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_ResumeCooperativeContext(JSContext* cx)
 {
     MOZ_CRASH("Cooperative scheduling is unsupported");
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_DestroyContext(JSContext* cx)
 {
     DestroyContext(cx);
 }
 
-JS_PUBLIC_API(void*)
+JS_PUBLIC_API void*
 JS_GetContextPrivate(JSContext* cx)
 {
     return cx->data;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetContextPrivate(JSContext* cx, void* data)
 {
     cx->data = data;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetFutexCanWait(JSContext* cx)
 {
     cx->fx.setCanWait(true);
 }
 
-JS_PUBLIC_API(JSRuntime*)
+JS_PUBLIC_API JSRuntime*
 JS_GetParentRuntime(JSContext* cx)
 {
     return cx->runtime()->parentRuntime ? cx->runtime()->parentRuntime : cx->runtime();
 }
 
-JS_PUBLIC_API(JSRuntime*)
+JS_PUBLIC_API JSRuntime*
 JS_GetRuntime(JSContext* cx)
 {
     return cx->runtime();
 }
 
-JS_PUBLIC_API(JS::ContextOptions&)
+JS_PUBLIC_API JS::ContextOptions&
 JS::ContextOptionsRef(JSContext* cx)
 {
     return cx->options();
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS::InitSelfHostedCode(JSContext* cx)
 {
     MOZ_RELEASE_ASSERT(!cx->runtime()->hasInitializedSelfHosting(),
                        "JS::InitSelfHostedCode() called more than once");
 
     AutoNoteSingleThreadedRegion anstr;
 
     JSRuntime* rt = cx->runtime();
@@ -570,49 +570,49 @@ JS::InitSelfHostedCode(JSContext* cx)
 
     if (!rt->parentRuntime && !rt->initMainAtomsTables(cx)) {
         return false;
     }
 
     return true;
 }
 
-JS_PUBLIC_API(const char*)
+JS_PUBLIC_API const char*
 JS_GetImplementationVersion(void)
 {
     return "JavaScript-C" MOZILLA_VERSION;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetDestroyCompartmentCallback(JSContext* cx, JSDestroyCompartmentCallback callback)
 {
     cx->runtime()->destroyCompartmentCallback = callback;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetSizeOfIncludingThisCompartmentCallback(JSContext* cx,
                                              JSSizeOfIncludingThisCompartmentCallback callback)
 {
     cx->runtime()->sizeOfIncludingThisCompartmentCallback = callback;
 }
 
 #if defined(NIGHTLY_BUILD)
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetErrorInterceptorCallback(JSRuntime* rt, JSErrorInterceptor* callback)
 {
     rt->errorInterception.interceptor = callback;
 }
 
-JS_PUBLIC_API(JSErrorInterceptor*)
+JS_PUBLIC_API JSErrorInterceptor*
 JS_GetErrorInterceptorCallback(JSRuntime* rt)
 {
     return rt->errorInterception.interceptor;
 }
 
-JS_PUBLIC_API(Maybe<JSExnType>)
+JS_PUBLIC_API Maybe<JSExnType>
 JS_GetErrorType(const JS::Value& val)
 {
     // All errors are objects.
     if (!val.isObject()) {
         return mozilla::Nothing();
     }
 
     const JSObject& obj = val.toObject();
@@ -624,42 +624,42 @@ JS_GetErrorType(const JS::Value& val)
     }
 
     const js::ErrorObject& err = obj.as<js::ErrorObject>();
     return mozilla::Some(err.type());
 }
 
 #endif // defined(NIGHTLY_BUILD)
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetWrapObjectCallbacks(JSContext* cx, const JSWrapObjectCallbacks* callbacks)
 {
     cx->runtime()->wrapObjectCallbacks = callbacks;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetExternalStringSizeofCallback(JSContext* cx, JSExternalStringSizeofCallback callback)
 {
     cx->runtime()->externalStringSizeofCallback = callback;
 }
 
-JS_PUBLIC_API(Realm*)
+JS_PUBLIC_API Realm*
 JS::EnterRealm(JSContext* cx, JSObject* target)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
 
     MOZ_DIAGNOSTIC_ASSERT(!js::IsCrossCompartmentWrapper(target));
 
     Realm* oldRealm = cx->realm();
     cx->enterRealmOf(target);
     return oldRealm;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS::LeaveRealm(JSContext* cx, JS::Realm* oldRealm)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->leaveRealm(oldRealm);
 }
 
 JSAutoRealm::JSAutoRealm(JSContext* cx, JSObject* target
@@ -704,64 +704,64 @@ JSAutoNullableRealm::JSAutoNullableRealm
     }
 }
 
 JSAutoNullableRealm::~JSAutoNullableRealm()
 {
     cx_->leaveRealm(oldRealm_);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetCompartmentPrivate(JS::Compartment* compartment, void* data)
 {
     compartment->data = data;
 }
 
-JS_PUBLIC_API(void*)
+JS_PUBLIC_API void*
 JS_GetCompartmentPrivate(JS::Compartment* compartment)
 {
     return compartment->data;
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_MarkCrossZoneId(JSContext* cx, jsid id)
 {
     cx->markId(id);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_MarkCrossZoneIdValue(JSContext* cx, const Value& value)
 {
     cx->markAtomValue(value);
 }
 
-JS_PUBLIC_API(void)
+JS_PUBLIC_API void
 JS_SetZoneUserData(JS::Zone* zone, void* data)
 {
     zone->data = data;
 }
 
-JS_PUBLIC_API(void*)
+JS_PUBLIC_API void*
 JS_GetZoneUserData(JS::Zone* zone)
 {
     return zone->data;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WrapObject(JSContext* cx, MutableHandleObject objp)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     if (objp) {
         JS::ExposeObjectToActiveJS(objp);
     }
     return cx->compartment()->wrap(cx, objp);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_WrapValue(JSContext* cx, MutableHandleValue vp)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     JS::ExposeValueToActiveJS(vp);
     return cx->compartment()->wrap(cx, vp);
 }
 
@@ -835,17 +835,17 @@ ReleaseAssertObjectHasNoWrappers(JSConte
  * The reason for this last rule is that JS_TransplantObject does very strange
  * things in some cases, like swapping `target`'s brain with that of another
  * object. Leaving `target` behaving like its former self is not a goal.
  *
  * We don't have a good way to recover from failure in this function, so
  * we intentionally crash instead.
  */
 
-JS_PUBLIC_API(JSObject*)
+JS_PUBLIC_API JSObject*
 JS_TransplantObject(JSContext* cx, HandleObject origobj, HandleObject target)
 {
     AssertHeapIsIdle();
     MOZ_ASSERT(origobj != target);
     MOZ_ASSERT(!origobj->is<CrossCompartmentWrapperObject>());
     MOZ_ASSERT(!target->is<CrossCompartmentWrapperObject>());
     MOZ_ASSERT(origobj->getClass() == target->getClass());
     ReleaseAssertObjectHasNoWrappers(cx, target);
@@ -916,17 +916,17 @@ JS_TransplantObject(JSContext* cx, Handl
     return newIdentity;
 }
 
 /*
  * Recompute all cross-compartment wrappers for an object, resetting state.
  * Gecko uses this to clear Xray wrappers when doing a navigation that reuses
  * the inner window and global object.
  */
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_RefreshCrossCompartmentWrappers(JSContext* cx, HandleObject obj)
 {
     return RemapAllWrappersForObject(cx, obj, obj);
 }
 
 typedef struct JSStdName {
     size_t      atomOffset;     /* offset of atom pointer in JSAtomState */
     JSProtoKey  key;
@@ -985,17 +985,17 @@ static const JSStdName builtin_property_
     { NAME_OFFSET(encodeURI), JSProto_String },
     { NAME_OFFSET(decodeURIComponent), JSProto_String },
     { NAME_OFFSET(encodeURIComponent), JSProto_String },
     { NAME_OFFSET(uneval), JSProto_String },
 
     { 0, JSProto_LIMIT }
 };
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_ResolveStandardClass(JSContext* cx, HandleObject obj, HandleId id, bool* resolved)
 {
     const JSStdName* stdnm;
 
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(obj, id);
 
@@ -1049,17 +1049,17 @@ JS_ResolveStandardClass(JSContext* cx, H
     // There is no such property to resolve. An ordinary resolve hook would
     // just return true at this point. But the global object is special in one
     // more way: its prototype chain is lazily initialized. That is,
     // global->getProto() might be null right now because we haven't created
     // Object.prototype yet. Force it now.
     return GlobalObject::getOrCreateObjectPrototype(cx, global);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_MayResolveStandardClass(const JSAtomState& names, jsid id, JSObject* maybeObj)
 {
     MOZ_ASSERT_IF(maybeObj, maybeObj->is<GlobalObject>());
 
     // The global object's resolve hook is special: JS_ResolveStandardClass
     // initializes the prototype chain lazily. Only attempt to optimize here
     // if we know the prototype chain has been initialized.
     if (!maybeObj || !maybeObj->staticPrototype()) {
@@ -1076,17 +1076,17 @@ JS_MayResolveStandardClass(const JSAtomS
     // better, we need a JSContext here; it's fine as it is.)
 
     return atom == names.undefined ||
            atom == names.globalThis ||
            LookupStdName(names, atom, standard_class_names) ||
            LookupStdName(names, atom, builtin_property_names);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_EnumerateStandardClasses(JSContext* cx, HandleObject obj)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     cx->check(obj);
     Handle<GlobalObject*> global = obj.as<GlobalObject>();
     return GlobalObject::initStandardClasses(cx, global);
 }
@@ -1156,68 +1156,68 @@ EnumerateStandardClasses(JSContext* cx, 
     if (!EnumerateStandardClassesInTable(cx, global, properties, builtin_property_names,
                                          includeResolved)) {
         return false;
     }
 
     return true;
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_NewEnumerateStandardClasses(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
                                bool enumerableOnly)
 {
     return EnumerateStandardClasses(cx, obj, properties, enumerableOnly, false);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_NewEnumerateStandardClassesIncludingResolved(JSContext* cx, JS::HandleObject obj,
                                                 JS::AutoIdVector& properties,
                                                 bool enumerableOnly)
 {
     return EnumerateStandardClasses(cx, obj, properties, enumerableOnly, true);
 }
 
-JS_PUBLIC_API(bool)
+JS_PUBLIC_API bool
 JS_GetClassObject(JSContext* cx, JSProtoKey key, MutableHandleObject objp)
 {
     AssertHeapIsIdle();
     CHECK_THREAD(cx);
     JSObject* obj = GlobalObject::getOrCreateConstructor(cx, key);
     if (!obj) {
         return false;