Backed out 13 changesets (bug 1500948, bug 1509362, bug 1509591, bug 1448426, bug 1500949, bug 1487249, bug 1509930, bug 1500950, bug 1500944) for causing crashes and assertion failures on PBackgroundParent.cpp:696 CLOSED TREE
authorarthur.iakab <aiakab@mozilla.com>
Wed, 28 Nov 2018 02:57:32 +0200
changeset 504886 9bfe29337ffe3d93cd060077e2e999e72bb9b7cf
parent 504885 77c14850b8c700541cc1273f5b7f7f14fa60e713
child 504887 33da443fa05e53b8f03d20d627cf6ef6ac445045
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1500948, 1509362, 1509591, 1448426, 1500949, 1487249, 1509930, 1500950, 1500944
milestone65.0a1
backs outc3fe435e473a463fbc22d4afa531bdedb757079c
6494840edc17b976778f057b1edd0b7c03e19d0b
123b5d5a36377f409cb5c0a5e691e5eadb31626a
bce195f98895f82bd5ace5fc5ed5a5ca3b9f1afd
66db131264086346c31236ec00d02557dc5b4f06
3b5fffae2d2bf9c6825a4cfd2a9f4d6cb3a1b512
71c3b3677db81f3d07bf67f839c6a48e78cf85f3
784b3b56e2abeb125faad7738975f502e556d376
0bad27401ddb5372cabc01e63d4ea0a2f9743e6f
e0f95dd96d5458f60980f1e8b3f846beed6e5817
c60fa11538dba13f2eced54a835a4a0ff65a0ebd
0190d4ffa54fab4397afd0cd43d2f896c052235a
3cd10aba91304af8ea8502ad52d4ec64fddac0b5
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
Backed out 13 changesets (bug 1500948, bug 1509362, bug 1509591, bug 1448426, bug 1500949, bug 1487249, bug 1509930, bug 1500950, bug 1500944) for causing crashes and assertion failures on PBackgroundParent.cpp:696 CLOSED TREE Backed out changeset c3fe435e473a (bug 1509362) Backed out changeset 6494840edc17 (bug 1509591) Backed out changeset 123b5d5a3637 (bug 1509591) Backed out changeset bce195f98895 (bug 1509930) Backed out changeset 66db13126408 (bug 1500950) Backed out changeset 3b5fffae2d2b (bug 1500949) Backed out changeset 71c3b3677db8 (bug 1500948) Backed out changeset 784b3b56e2ab (bug 1500944) Backed out changeset 0bad27401ddb (bug 1500944) Backed out changeset e0f95dd96d54 (bug 1448426) Backed out changeset c60fa11538db (bug 1487249) Backed out changeset 0190d4ffa54f (bug 1487249) Backed out changeset 3cd10aba9130 (bug 1487249)
config/make-stl-wrappers.py
config/make-windows-h-wrapper.py
config/moz.build
config/system_header_util.py
config/windows-h-constant.decls.h
config/windows-h-unicode.decls.h
config/windows-h-wrapper.template.h
docshell/base/BrowsingContext.cpp
docshell/base/BrowsingContext.h
docshell/base/ChromeBrowsingContext.cpp
docshell/base/ChromeBrowsingContext.h
dom/base/moz.build
dom/base/nsContentPermissionHelper.cpp
dom/base/nsContentPermissionHelper.h
dom/base/nsDocument.cpp
dom/base/nsFrameLoader.cpp
dom/base/nsFrameLoader.h
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsPIDOMWindow.h
dom/chrome-webidl/BrowsingContext.webidl
dom/chrome-webidl/WindowGlobalActors.webidl
dom/chrome-webidl/moz.build
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/DOMTypes.ipdlh
dom/ipc/PBrowser.ipdl
dom/ipc/PWindowGlobal.ipdl
dom/ipc/ProcessHangMonitor.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/ipc/URLClassifierParent.cpp
dom/ipc/URLClassifierParent.h
dom/ipc/WindowGlobalChild.cpp
dom/ipc/WindowGlobalChild.h
dom/ipc/WindowGlobalParent.cpp
dom/ipc/WindowGlobalParent.h
dom/ipc/moz.build
dom/network/TCPServerSocketChild.cpp
dom/network/TCPServerSocketChild.h
dom/network/TCPServerSocketParent.cpp
dom/network/TCPServerSocketParent.h
dom/network/TCPSocketChild.cpp
dom/network/TCPSocketChild.h
dom/network/TCPSocketParent.cpp
dom/network/TCPSocketParent.h
dom/network/UDPSocketChild.cpp
dom/network/UDPSocketChild.h
dom/network/UDPSocketParent.cpp
dom/network/UDPSocketParent.h
dom/storage/StorageIPC.cpp
dom/storage/StorageIPC.h
dom/webidl/FrameLoader.webidl
gfx/cairo/cairo/src/moz.build
gfx/layers/client/TextureClient.cpp
gfx/layers/ipc/LayerTransactionChild.h
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayerTransactionParent.h
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/layers/wr/WebRenderBridgeChild.h
gfx/thebes/gfxDWriteFonts.cpp
gfx/vr/ipc/VRLayerChild.cpp
gfx/vr/ipc/VRLayerChild.h
gfx/vr/ipc/VRLayerParent.cpp
gfx/vr/ipc/VRLayerParent.h
gfx/vr/service/openvr/moz.build
ipc/glue/InProcessChild.cpp
ipc/glue/InProcessChild.h
ipc/glue/InProcessImpl.cpp
ipc/glue/InProcessParent.cpp
ipc/glue/InProcessParent.h
ipc/glue/MessageChannel.cpp
ipc/glue/MessageChannel.h
ipc/glue/PInProcess.ipdl
ipc/glue/ProtocolUtils.cpp
ipc/glue/ProtocolUtils.h
ipc/glue/moz.build
ipc/ipdl/ipdl/lower.py
netwerk/cookie/CookieServiceChild.cpp
netwerk/cookie/CookieServiceChild.h
netwerk/dns/DNSRequestChild.cpp
netwerk/dns/DNSRequestChild.h
netwerk/protocol/data/DataChannelChild.cpp
netwerk/protocol/data/DataChannelChild.h
netwerk/protocol/file/FileChannelChild.cpp
netwerk/protocol/file/FileChannelChild.h
netwerk/protocol/ftp/FTPChannelChild.cpp
netwerk/protocol/ftp/FTPChannelChild.h
netwerk/protocol/http/AltDataOutputStreamChild.cpp
netwerk/protocol/http/AltDataOutputStreamChild.h
netwerk/protocol/http/AltDataOutputStreamParent.cpp
netwerk/protocol/http/AltDataOutputStreamParent.h
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/WyciwygChannelChild.h
python/mozbuild/mozbuild/backend/common.py
security/manager/ssl/PSMContentListener.cpp
security/manager/ssl/PSMContentListener.h
toolkit/components/reputationservice/LoginReputationIPC.cpp
toolkit/components/reputationservice/LoginReputationIPC.h
--- a/config/make-stl-wrappers.py
+++ b/config/make-stl-wrappers.py
@@ -1,17 +1,34 @@
 # 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/.
 from __future__ import print_function
 import os
 import string
 from mozbuild.util import FileAvoidWrite
-from system_header_util import header_path
+
+
+def find_in_path(file, searchpath):
+    for dir in searchpath.split(os.pathsep):
+        f = os.path.join(dir, file)
+        if os.path.exists(f):
+            return f
+    return ''
+
 
+def header_path(header, compiler):
+    if compiler == 'gcc':
+        # we use include_next on gcc
+        return header
+    elif compiler == 'msvc':
+        return find_in_path(header, os.environ.get('INCLUDE', ''))
+    else:
+        # hope someone notices this ...
+        raise NotImplementedError(compiler)
 
 # The 'unused' arg is the output file from the file_generate action. We actually
 # generate all the files in header_list
 
 
 def gen_wrappers(unused, outdir, compiler, template_file, *header_list):
     template = open(template_file, 'r').read()
 
deleted file mode 100644
--- a/config/make-windows-h-wrapper.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import re
-import textwrap
-import string
-from system_header_util import header_path
-
-comment_re = re.compile(r'//[^\n]*\n|/\*.*\*/', re.S)
-decl_re = re.compile(r'''^(.+)\s+        # type
-                         (\w+)\s*        # name
-                         (?:\((.*)\))?$  # optional param tys
-                         ''', re.X | re.S)
-
-
-def read_decls(filename):
-    """Parse & yield C-style decls from an input file"""
-    with open(filename, 'r') as fd:
-        # Strip comments from the source text.
-        text = comment_re.sub('', fd.read())
-
-        # Parse individual declarations.
-        raw_decls = [d.strip() for d in text.split(';') if d.strip()]
-        for raw in raw_decls:
-            match = decl_re.match(raw)
-            if match is None:
-                raise "Invalid decl: %s" % raw
-
-            ty, name, params = match.groups()
-            if params is not None:
-                params = [a.strip() for a in params.split(',') if a.strip()]
-            yield ty, name, params
-
-
-def generate(fd, consts_path, unicodes_path, template_path, compiler):
-    # Parse the template
-    with open(template_path, 'r') as template_fd:
-        template = string.Template(template_fd.read())
-
-    decls = ''
-
-    # Each constant should be saved to a temporary, and then re-assigned to a
-    # constant with the correct name, allowing the value to be determined by
-    # the actual definition.
-    for ty, name, args in read_decls(consts_path):
-        assert args is None, "parameters in const decl!"
-
-        decls += textwrap.dedent("""
-            #ifdef {name}
-            constexpr {ty} _tmp_{name} = {name};
-            #undef {name}
-            constexpr {ty} {name} = _tmp_{name};
-            #endif
-            """.format(ty=ty, name=name))
-
-    # Each unicode declaration defines a static inline function with the
-    # correct types which calls the 'A' or 'W'-suffixed versions of the
-    # function. Full types are required here to ensure that '0' to 'nullptr'
-    # coersions are preserved.
-    for ty, name, args in read_decls(unicodes_path):
-        assert args is not None, "argument list required for unicode decl"
-
-        # Parameter & argument string list
-        params = ', '.join('%s a%d' % (ty, i) for i, ty in enumerate(args))
-        args = ', '.join('a%d' % i for i in range(len(args)))
-
-        decls += textwrap.dedent("""
-            #ifdef {name}
-            #undef {name}
-            static inline {ty} WINAPI
-            {name}({params})
-            {{
-            #ifdef UNICODE
-              return {name}W({args});
-            #else
-              return {name}A({args});
-            #endif
-            }}
-            #endif
-            """.format(ty=ty, name=name, params=params, args=args))
-
-    path = header_path('windows.h', compiler)
-
-    # Write out the resulting file
-    fd.write(template.substitute(header_path=path, decls=decls))
--- a/config/moz.build
+++ b/config/moz.build
@@ -58,29 +58,16 @@ if CONFIG['WRAP_STL_INCLUDES']:
         # the files in gen_wrappers()
         outputs = tuple(['stl.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers])
         GENERATED_FILES += [outputs]
         stl = GENERATED_FILES[outputs]
         stl.script = 'make-stl-wrappers.py:gen_wrappers'
         stl.flags = [output_dir, stl_compiler, template_file]
         stl.flags.extend(stl_headers)
 
-    # Wrap <windows.h> to make it easier to use correctly
-    # NOTE: If we aren't wrapping STL includes, we're building part of the browser
-    # which won't need this wrapper, such as L10N. Just don't try to generate the
-    # wrapper in that case.
-    if CONFIG['OS_ARCH'] == 'WINNT':
-        GENERATED_FILES += ['../dist/stl_wrappers/windows.h']
-        windows_h = GENERATED_FILES['../dist/stl_wrappers/windows.h']
-        windows_h.script = 'make-windows-h-wrapper.py:generate'
-        windows_h.inputs = ['windows-h-constant.decls.h',
-                            'windows-h-unicode.decls.h',
-                            'windows-h-wrapper.template.h']
-        windows_h.flags = [stl_compiler]
-
 if CONFIG['WRAP_SYSTEM_INCLUDES']:
     include('system-headers.mozbuild')
     output_dir = '../dist/system_wrappers'
     outputs = tuple(['system-header.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers + system_headers])
     GENERATED_FILES += [outputs]
     system = GENERATED_FILES[outputs]
     system.script = 'make-system-wrappers.py:gen_wrappers'
     system.flags = [output_dir]
deleted file mode 100644
--- a/config/system_header_util.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import os
-
-
-def find_in_path(file, searchpath):
-    for dir in searchpath.split(os.pathsep):
-        f = os.path.join(dir, file)
-        if os.path.exists(f):
-            return f
-    return ''
-
-
-def header_path(header, compiler):
-    if compiler == 'gcc':
-        # we use include_next on gcc
-        return header
-    elif compiler == 'msvc':
-        return find_in_path(header, os.environ.get('INCLUDE', ''))
-    else:
-        # hope someone notices this ...
-        raise NotImplementedError(compiler)
deleted file mode 100644
--- a/config/windows-h-constant.decls.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * This file contains a series of C-style declarations for constants defined in
- * windows.h using #define. Adding a new constant should be a simple as adding
- * its name (and optionally type) to this file.
- *
- * This file is processed by generate-windows-h-wrapper.py to generate a wrapper
- * for the header which removes the defines usually implementing these constants.
- *
- * Wrappers defined in this file will be declared as `constexpr` values,
- * and will have their value derived from the windows.h define.
- *
- * NOTE: This is *NOT* a real C header, but rather an input to the avove script.
- * Only basic declarations in the form found here are allowed.
- */
-
-// XXX(nika): There are a lot of these (>30k)!
-// This is just a set of ones I saw in a quick scan which looked problematic.
-
-auto CREATE_NEW;
-auto CREATE_ALWAYS;
-auto OPEN_EXISTING;
-auto OPEN_ALWAYS;
-auto TRUNCATE_EXISTING;
-auto INVALID_FILE_SIZE;
-auto INVALID_SET_FILE_POINTER;
-auto INVALID_FILE_ATTRIBUTES;
-
-auto ANSI_NULL;
-auto UNICODE_NULL;
-
-auto MINCHAR;
-auto MAXCHAR;
-auto MINSHORT;
-auto MAXSHORT;
-auto MINLONG;
-auto MAXLONG;
-auto MAXBYTE;
-auto MAXWORD;
-auto MAXDWORD;
-
-auto DELETE;
-auto READ_CONTROL;
-auto WRITE_DAC;
-auto WRITE_OWNER;
-auto SYNCHRONIZE;
-
-auto MAXIMUM_ALLOWED;
-auto GENERIC_READ;
-auto GENERIC_WRITE;
-auto GENERIC_EXECUTE;
-auto GENERIC_ALL;
deleted file mode 100644
--- a/config/windows-h-unicode.decls.h
+++ /dev/null
@@ -1,1052 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * This file contains a series of C-style function prototypes for A/W-suffixed
- * Win32 APIs defined by windows.h.
- *
- * This file is processed by generate-windows-h-wrapper.py to generate a wrapper
- * for the header which removes the defines usually implementing these aliases.
- *
- * Wrappers defined in this file will have the 'stdcall' calling convention,
- * will be defined as 'inline', and will only be defined if the corresponding
- * #define directive has not been #undef-ed.
- *
- * NOTE: This is *NOT* a real C header, but rather an input to the avove script.
- * Only basic declarations in the form found here are allowed.
- */
-
-LPTSTR GetCommandLine();
-
-BOOL FreeEnvironmentStrings(LPTCH);
-
-DWORD GetEnvironmentVariable(LPCTSTR, LPTSTR, DWORD);
-
-BOOL SetEnvironmentVariable(LPCTSTR, LPCTSTR);
-
-DWORD ExpandEnvironmentStrings(LPCTSTR, LPTSTR, DWORD);
-
-BOOL SetCurrentDirectory(LPCTSTR);
-
-DWORD GetCurrentDirectory(DWORD, LPTSTR);
-
-DWORD SearchPath(LPCTSTR, LPCTSTR, LPCTSTR, DWORD, LPTSTR, LPTSTR*);
-
-BOOL NeedCurrentDirectoryForExePath(LPCTSTR);
-
-BOOL CreateDirectory(LPCTSTR, LPSECURITY_ATTRIBUTES);
-
-HANDLE CreateFile(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
-
-BOOL DeleteFile(LPCTSTR);
-
-HANDLE FindFirstChangeNotification(LPCTSTR, BOOL, DWORD);
-
-HANDLE FindFirstFile(LPCTSTR, LPWIN32_FIND_DATA);
-
-HANDLE FindFirstFileEx(LPCTSTR, FINDEX_INFO_LEVELS, LPVOID, FINDEX_SEARCH_OPS, LPVOID, DWORD);
-
-BOOL FindNextFile(HANDLE, LPWIN32_FIND_DATA);
-
-BOOL GetDiskFreeSpace(LPCTSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
-
-BOOL GetDiskFreeSpaceEx(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
-
-UINT GetDriveType(LPCTSTR);
-
-DWORD GetFileAttributes(LPCTSTR);
-
-BOOL GetFileAttributesEx(LPCTSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
-
-DWORD GetFinalPathNameByHandle(HANDLE, LPTSTR, DWORD, DWORD);
-
-DWORD GetFullPathName(LPCTSTR, DWORD, LPTSTR, LPTSTR*);
-
-DWORD GetLongPathName(LPCTSTR, LPTSTR, DWORD);
-
-BOOL RemoveDirectory(LPCTSTR);
-
-BOOL SetFileAttributes(LPCTSTR, DWORD);
-
-DWORD GetCompressedFileSize(LPCTSTR, LPDWORD);
-
-DWORD GetTempPath(DWORD, LPTSTR);
-
-BOOL GetVolumeInformation(LPCTSTR, LPTSTR, DWORD, LPDWORD, LPDWORD, LPDWORD, LPTSTR, DWORD);
-
-UINT GetTempFileName(LPCTSTR, LPCTSTR, UINT, LPTSTR);
-
-void OutputDebugString(LPCTSTR);
-
-void FatalAppExit(UINT, LPCTSTR);
-
-HANDLE CreateMutex(LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR);
-
-HANDLE CreateEvent(LPSECURITY_ATTRIBUTES, BOOL, BOOL, LPCTSTR);
-
-HANDLE OpenEvent(DWORD, BOOL, LPCTSTR);
-
-HANDLE CreateMutexEx(LPSECURITY_ATTRIBUTES, LPCTSTR, DWORD, DWORD);
-
-HANDLE CreateEventEx(LPSECURITY_ATTRIBUTES, LPCTSTR, DWORD, DWORD);
-
-BOOL CreateProcess(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
-
-BOOL CreateProcessAsUser(HANDLE, LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
-
-UINT GetSystemDirectory(LPTSTR, UINT);
-
-UINT GetWindowsDirectory(LPTSTR, UINT);
-
-UINT GetSystemWindowsDirectory(LPTSTR, UINT);
-
-BOOL GetComputerNameEx(COMPUTER_NAME_FORMAT, LPTSTR, LPDWORD);
-
-BOOL GetVersionEx(LPOSVERSIONINFO);
-
-BOOL SetComputerName(LPCTSTR);
-
-BOOL SetComputerNameEx(COMPUTER_NAME_FORMAT, LPCTSTR);
-
-BOOL LoadEnclaveImage(LPVOID, LPCTSTR);
-
-UINT GetSystemWow64Directory(LPTSTR, UINT);
-
-DWORD GetModuleFileName(HMODULE, LPTSTR, DWORD);
-
-HMODULE GetModuleHandle(LPCTSTR);
-
-BOOL GetModuleHandleEx(DWORD, LPCTSTR, HMODULE*);
-
-HMODULE LoadLibraryEx(LPCTSTR, HANDLE, DWORD);
-
-int LoadString(HINSTANCE, UINT, LPTSTR, int);
-
-BOOL EnumResourceLanguagesEx(HMODULE, LPCTSTR, LPCTSTR, ENUMRESLANGPROC, LONG_PTR, DWORD, LANGID);
-
-BOOL EnumResourceNamesEx(HMODULE, LPCTSTR, ENUMRESNAMEPROC, LONG_PTR, DWORD, LANGID);
-
-BOOL EnumResourceTypesEx(HMODULE, ENUMRESTYPEPROC, LONG_PTR, DWORD, LANGID);
-
-HMODULE LoadLibrary(LPCTSTR);
-
-BOOL GetBinaryType(LPCTSTR, LPDWORD);
-
-DWORD GetShortPathName(LPCTSTR, LPTSTR, DWORD);
-
-DWORD GetLongPathNameTransacted(LPCTSTR, LPTSTR, DWORD, HANDLE);
-
-BOOL SetEnvironmentStrings(LPTCH);
-
-BOOL SetFileShortName(HANDLE, LPCTSTR);
-
-DWORD FormatMessage(DWORD, LPCVOID, DWORD, DWORD, LPTSTR, DWORD, va_list *);
-
-HANDLE CreateMailslot(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES);
-
-BOOL EncryptFile(LPCTSTR);
-
-BOOL DecryptFile(LPCTSTR, DWORD);
-
-BOOL FileEncryptionStatus(LPCTSTR, LPDWORD);
-
-DWORD OpenEncryptedFileRaw(LPCTSTR, ULONG, PVOID *);
-
-HANDLE OpenMutex(DWORD, BOOL, LPCTSTR);
-
-HANDLE CreateSemaphore(LPSECURITY_ATTRIBUTES, LONG, LONG, LPCTSTR);
-
-HANDLE OpenSemaphore(DWORD, BOOL, LPCTSTR);
-
-HANDLE CreateWaitableTimer(LPSECURITY_ATTRIBUTES, BOOL, LPCTSTR);
-
-HANDLE OpenWaitableTimer(DWORD, BOOL, LPCTSTR);
-
-HANDLE CreateSemaphoreEx(LPSECURITY_ATTRIBUTES, LONG, LONG, LPCTSTR, DWORD, DWORD);
-
-HANDLE CreateWaitableTimerEx(LPSECURITY_ATTRIBUTES, LPCTSTR, DWORD, DWORD);
-
-HANDLE CreateFileMapping(HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCTSTR);
-
-HANDLE CreateFileMappingNuma(HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCTSTR, DWORD);
-
-HANDLE OpenFileMapping(DWORD, BOOL, LPCTSTR);
-
-DWORD GetLogicalDriveStrings(DWORD, LPTSTR);
-
-void GetStartupInfo(LPSTARTUPINFO);
-
-DWORD GetFirmwareEnvironmentVariable(LPCTSTR, LPCTSTR, PVOID, DWORD);
-
-BOOL SetFirmwareEnvironmentVariable(LPCTSTR, LPCTSTR, PVOID, DWORD);
-
-HRSRC FindResource(HMODULE, LPCTSTR, LPCTSTR);
-
-HRSRC FindResourceEx(HMODULE, LPCTSTR, LPCTSTR, WORD);
-
-BOOL EnumResourceTypes(HMODULE, ENUMRESTYPEPROC, LONG_PTR);
-
-BOOL EnumResourceNames(HMODULE, LPCTSTR, ENUMRESNAMEPROC, LONG_PTR);
-
-BOOL EnumResourceLanguages(HMODULE, LPCTSTR, LPCTSTR, ENUMRESLANGPROC, LONG_PTR);
-
-HANDLE BeginUpdateResource(LPCTSTR, BOOL);
-
-BOOL UpdateResource(HANDLE, LPCTSTR, LPCTSTR, WORD, LPVOID, DWORD);
-
-BOOL EndUpdateResource(HANDLE, BOOL);
-
-ATOM GlobalAddAtom(LPCTSTR);
-
-ATOM GlobalAddAtomEx(LPCTSTR, DWORD);
-
-ATOM GlobalFindAtom(LPCTSTR);
-
-UINT GlobalGetAtomName(ATOM, LPTSTR, int);
-
-ATOM AddAtom(LPCTSTR);
-
-ATOM FindAtom(LPCTSTR);
-
-UINT GetAtomName(ATOM, LPTSTR, int);
-
-UINT GetProfileInt(LPCTSTR, LPCTSTR, INT);
-
-DWORD GetProfileString(LPCTSTR, LPCTSTR, LPCTSTR, LPTSTR, DWORD);
-
-BOOL WriteProfileString(LPCTSTR, LPCTSTR, LPCTSTR);
-
-DWORD GetProfileSection(LPCTSTR, LPTSTR, DWORD);
-
-BOOL WriteProfileSection(LPCTSTR, LPCTSTR);
-
-UINT GetPrivateProfileInt(LPCTSTR, LPCTSTR, INT, LPCTSTR);
-
-DWORD GetPrivateProfileString(LPCTSTR, LPCTSTR, LPCTSTR, LPTSTR, DWORD, LPCTSTR);
-
-BOOL WritePrivateProfileString(LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR);
-
-DWORD GetPrivateProfileSection(LPCTSTR, LPTSTR, DWORD, LPCTSTR);
-
-BOOL WritePrivateProfileSection(LPCTSTR, LPCTSTR, LPCTSTR);
-
-DWORD GetPrivateProfileSectionNames(LPTSTR, DWORD, LPCTSTR);
-
-BOOL GetPrivateProfileStruct(LPCTSTR, LPCTSTR, LPVOID, UINT, LPCTSTR);
-
-BOOL WritePrivateProfileStruct(LPCTSTR, LPCTSTR, LPVOID, UINT, LPCTSTR);
-
-BOOL SetDllDirectory(LPCTSTR);
-
-DWORD GetDllDirectory(DWORD, LPTSTR);
-
-BOOL CreateDirectoryEx(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES);
-
-BOOL CreateDirectoryTransacted(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES, HANDLE);
-
-BOOL RemoveDirectoryTransacted(LPCTSTR, HANDLE);
-
-DWORD GetFullPathNameTransacted(LPCTSTR, DWORD, LPTSTR, LPTSTR *, HANDLE);
-
-BOOL DefineDosDevice(DWORD, LPCTSTR, LPCTSTR);
-
-DWORD QueryDosDevice(LPCTSTR, LPTSTR, DWORD);
-
-HANDLE CreateFileTransacted(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE, HANDLE, PUSHORT, PVOID);
-
-BOOL SetFileAttributesTransacted(LPCTSTR, DWORD, HANDLE);
-
-BOOL GetFileAttributesTransacted(LPCTSTR, GET_FILEEX_INFO_LEVELS, LPVOID, HANDLE);
-
-DWORD GetCompressedFileSizeTransacted(LPCTSTR, LPDWORD, HANDLE);
-
-BOOL DeleteFileTransacted(LPCTSTR, HANDLE);
-
-BOOL CheckNameLegalDOS8Dot3(LPCTSTR, LPSTR, DWORD, PBOOL, PBOOL);
-
-HANDLE FindFirstFileTransacted(LPCTSTR, FINDEX_INFO_LEVELS, LPVOID, FINDEX_SEARCH_OPS, LPVOID, DWORD, HANDLE);
-
-BOOL CopyFile(LPCTSTR, LPCTSTR, BOOL);
-
-BOOL CopyFileEx(LPCTSTR, LPCTSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOOL, DWORD);
-
-BOOL CopyFileTransacted(LPCTSTR, LPCTSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOOL, DWORD, HANDLE);
-
-BOOL MoveFile(LPCTSTR, LPCTSTR);
-
-BOOL MoveFileEx(LPCTSTR, LPCTSTR, DWORD);
-
-BOOL MoveFileWithProgress(LPCTSTR, LPCTSTR, LPPROGRESS_ROUTINE, LPVOID, DWORD);
-
-BOOL MoveFileTransacted(LPCTSTR, LPCTSTR, LPPROGRESS_ROUTINE, LPVOID, DWORD, HANDLE);
-
-BOOL ReplaceFile(LPCTSTR, LPCTSTR, LPCTSTR, DWORD, LPVOID, LPVOID);
-
-BOOL CreateHardLink(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES);
-
-BOOL CreateHardLinkTransacted(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES, HANDLE);
-
-HANDLE CreateNamedPipe(LPCTSTR, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPSECURITY_ATTRIBUTES);
-
-BOOL GetNamedPipeHandleState(HANDLE, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPTSTR, DWORD);
-
-BOOL CallNamedPipe(LPCTSTR, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, DWORD);
-
-BOOL WaitNamedPipe(LPCTSTR, DWORD);
-
-BOOL GetNamedPipeClientComputerName(HANDLE, LPTSTR, ULONG);
-
-BOOL SetVolumeLabel(LPCTSTR, LPCTSTR);
-
-BOOL ClearEventLog(HANDLE, LPCTSTR);
-
-BOOL BackupEventLog(HANDLE, LPCTSTR);
-
-HANDLE OpenEventLog(LPCTSTR, LPCTSTR);
-
-HANDLE RegisterEventSource(LPCTSTR, LPCTSTR);
-
-HANDLE OpenBackupEventLog(LPCTSTR, LPCTSTR);
-
-BOOL ReadEventLog(HANDLE, DWORD, DWORD, LPVOID, DWORD, DWORD *, DWORD *);
-
-BOOL ReportEvent(HANDLE, WORD, WORD, DWORD, PSID, WORD, DWORD, LPCTSTR *, LPVOID);
-
-BOOL AccessCheckAndAuditAlarm(LPCTSTR, LPVOID, LPTSTR, LPTSTR, PSECURITY_DESCRIPTOR, DWORD, PGENERIC_MAPPING, BOOL, LPDWORD, LPBOOL, LPBOOL);
-
-BOOL AccessCheckByTypeAndAuditAlarm(LPCTSTR, LPVOID, LPCTSTR, LPCTSTR, PSECURITY_DESCRIPTOR, PSID, DWORD, AUDIT_EVENT_TYPE, DWORD, POBJECT_TYPE_LIST, DWORD, PGENERIC_MAPPING, BOOL, LPDWORD, LPBOOL, LPBOOL);
-
-BOOL AccessCheckByTypeResultListAndAuditAlarm(LPCTSTR, LPVOID, LPCTSTR, LPCTSTR, PSECURITY_DESCRIPTOR, PSID, DWORD, AUDIT_EVENT_TYPE, DWORD, POBJECT_TYPE_LIST, DWORD, PGENERIC_MAPPING, BOOL, LPDWORD, LPDWORD, LPBOOL);
-
-BOOL AccessCheckByTypeResultListAndAuditAlarmByHandle(LPCTSTR, LPVOID, HANDLE, LPCTSTR, LPCTSTR, PSECURITY_DESCRIPTOR, PSID, DWORD, AUDIT_EVENT_TYPE, DWORD, POBJECT_TYPE_LIST, DWORD, PGENERIC_MAPPING, BOOL, LPDWORD, LPDWORD, LPBOOL);
-
-BOOL ObjectOpenAuditAlarm(LPCTSTR, LPVOID, LPTSTR, LPTSTR, PSECURITY_DESCRIPTOR, HANDLE, DWORD, DWORD, PPRIVILEGE_SET, BOOL, BOOL, LPBOOL);
-
-BOOL ObjectPrivilegeAuditAlarm(LPCTSTR, LPVOID, HANDLE, DWORD, PPRIVILEGE_SET, BOOL);
-
-BOOL ObjectCloseAuditAlarm(LPCTSTR, LPVOID, BOOL);
-
-BOOL ObjectDeleteAuditAlarm(LPCTSTR, LPVOID, BOOL);
-
-BOOL PrivilegedServiceAuditAlarm(LPCTSTR, LPCTSTR, HANDLE, PPRIVILEGE_SET, BOOL);
-
-BOOL SetFileSecurity(LPCTSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR);
-
-BOOL GetFileSecurity(LPCTSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, LPDWORD);
-
-BOOL IsBadStringPtr(LPCTSTR, UINT_PTR);
-
-BOOL LookupAccountSid(LPCTSTR, PSID, LPTSTR, LPDWORD, LPTSTR, LPDWORD, PSID_NAME_USE);
-
-BOOL LookupAccountName(LPCTSTR, LPCTSTR, PSID, LPDWORD, LPTSTR, LPDWORD, PSID_NAME_USE);
-
-BOOL LookupAccountNameLocal(LPCTSTR, PSID, LPDWORD, LPTSTR, LPDWORD, PSID_NAME_USE);
-
-BOOL LookupAccountSidLocal(PSID, LPTSTR, LPDWORD, LPTSTR, LPDWORD, PSID_NAME_USE);
-
-BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID);
-
-BOOL LookupPrivilegeName(LPCTSTR, PLUID, LPTSTR, LPDWORD);
-
-BOOL LookupPrivilegeDisplayName(LPCTSTR, LPCTSTR, LPTSTR, LPDWORD, LPDWORD);
-
-BOOL BuildCommDCB(LPCTSTR, LPDCB);
-
-BOOL BuildCommDCBAndTimeouts(LPCTSTR, LPDCB, LPCOMMTIMEOUTS);
-
-BOOL CommConfigDialog(LPCTSTR, HWND, LPCOMMCONFIG);
-
-BOOL GetDefaultCommConfig(LPCTSTR, LPCOMMCONFIG, LPDWORD);
-
-BOOL SetDefaultCommConfig(LPCTSTR, LPCOMMCONFIG, DWORD);
-
-BOOL GetComputerName(LPTSTR, LPDWORD);
-
-BOOL DnsHostnameToComputerName(LPCTSTR, LPTSTR, LPDWORD);
-
-BOOL GetUserName(LPTSTR, LPDWORD);
-
-BOOL LogonUser(LPCTSTR, LPCTSTR, LPCTSTR, DWORD, DWORD, PHANDLE);
-
-BOOL LogonUserEx(LPCTSTR, LPCTSTR, LPCTSTR, DWORD, DWORD, PHANDLE, PSID *, PVOID *, LPDWORD, PQUOTA_LIMITS);
-
-HANDLE CreatePrivateNamespace(LPSECURITY_ATTRIBUTES, LPVOID, LPCTSTR);
-
-HANDLE OpenPrivateNamespace(LPVOID, LPCTSTR);
-
-HANDLE CreateBoundaryDescriptor(LPCTSTR, ULONG);
-
-BOOL GetCurrentHwProfile(LPHW_PROFILE_INFO);
-
-BOOL VerifyVersionInfo(LPOSVERSIONINFOEX, DWORD, DWORDLONG);
-
-HANDLE CreateJobObject(LPSECURITY_ATTRIBUTES, LPCTSTR);
-
-HANDLE OpenJobObject(DWORD, BOOL, LPCTSTR);
-
-HANDLE FindFirstVolume(LPTSTR, DWORD);
-
-BOOL FindNextVolume(HANDLE, LPTSTR, DWORD);
-
-HANDLE FindFirstVolumeMountPoint(LPCTSTR, LPTSTR, DWORD);
-
-BOOL FindNextVolumeMountPoint(HANDLE, LPTSTR, DWORD);
-
-BOOL SetVolumeMountPoint(LPCTSTR, LPCTSTR);
-
-BOOL DeleteVolumeMountPoint(LPCTSTR);
-
-BOOL GetVolumeNameForVolumeMountPoint(LPCTSTR, LPTSTR, DWORD);
-
-BOOL GetVolumePathName(LPCTSTR, LPTSTR, DWORD);
-
-BOOL GetVolumePathNamesForVolumeName(LPCTSTR, LPTCH, DWORD, PDWORD);
-
-HANDLE CreateActCtx(PCACTCTX);
-
-BOOL FindActCtxSectionString(DWORD, const GUID *, ULONG, LPCTSTR, PACTCTX_SECTION_KEYED_DATA);
-
-BOOLEAN CreateSymbolicLink(LPCTSTR, LPCTSTR, DWORD);
-
-BOOLEAN CreateSymbolicLinkTransacted(LPCTSTR, LPCTSTR, DWORD, HANDLE);
-
-int AddFontResource(LPCTSTR);
-
-HMETAFILE CopyMetaFile(HMETAFILE, LPCTSTR);
-
-HDC CreateDC(LPCTSTR, LPCTSTR, LPCTSTR, const DEVMODE *);
-
-HFONT CreateFontIndirect(const LOGFONT *);
-
-HFONT CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
-
-HDC CreateIC(LPCTSTR, LPCTSTR, LPCTSTR, const DEVMODE *);
-
-HDC CreateMetaFile(LPCTSTR);
-
-BOOL CreateScalableFontResource(DWORD, LPCTSTR, LPCTSTR, LPCTSTR);
-
-int DeviceCapabilities(LPCTSTR, LPCTSTR, WORD, LPTSTR, const DEVMODE *);
-
-int EnumFontFamiliesEx(HDC, LPLOGFONT, FONTENUMPROC, LPARAM, DWORD);
-
-int EnumFontFamilies(HDC, LPCTSTR, FONTENUMPROC, LPARAM);
-
-int EnumFonts(HDC, LPCTSTR, FONTENUMPROC, LPARAM);
-
-BOOL GetCharWidth(HDC, UINT, UINT, LPINT);
-
-BOOL GetCharWidth32(HDC, UINT, UINT, LPINT);
-
-BOOL GetCharWidthFloat(HDC, UINT, UINT, PFLOAT);
-
-BOOL GetCharABCWidths(HDC, UINT, UINT, LPABC);
-
-BOOL GetCharABCWidthsFloat(HDC, UINT, UINT, LPABCFLOAT);
-
-DWORD GetGlyphOutline(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, const MAT2 *);
-
-HMETAFILE GetMetaFile(LPCTSTR);
-
-UINT GetOutlineTextMetrics(HDC, UINT, LPOUTLINETEXTMETRIC);
-
-BOOL GetTextExtentPoint(HDC, LPCTSTR, int, LPSIZE);
-
-BOOL GetTextExtentPoint32(HDC, LPCTSTR, int, LPSIZE);
-
-BOOL GetTextExtentExPoint(HDC, LPCTSTR, int, int, LPINT, LPINT, LPSIZE);
-
-DWORD GetCharacterPlacement(HDC, LPCTSTR, int, int, LPGCP_RESULTS, DWORD);
-
-DWORD GetGlyphIndices(HDC, LPCTSTR, int, LPWORD, DWORD);
-
-int AddFontResourceEx(LPCTSTR, DWORD, PVOID);
-
-BOOL RemoveFontResourceEx(LPCTSTR, DWORD, PVOID);
-
-HFONT CreateFontIndirectEx(const ENUMLOGFONTEXDV *);
-
-HDC ResetDC(HDC, const DEVMODE *);
-
-BOOL RemoveFontResource(LPCTSTR);
-
-HENHMETAFILE CopyEnhMetaFile(HENHMETAFILE, LPCTSTR);
-
-HDC CreateEnhMetaFile(HDC, LPCTSTR, const RECT *, LPCTSTR);
-
-HENHMETAFILE GetEnhMetaFile(LPCTSTR);
-
-UINT GetEnhMetaFileDescription(HENHMETAFILE, UINT, LPTSTR);
-
-BOOL GetTextMetrics(HDC, LPTEXTMETRIC);
-
-int StartDoc(HDC, const DOCINFO *);
-
-int GetObject(HANDLE, int, LPVOID);
-
-BOOL TextOut(HDC, int, int, LPCTSTR, int);
-
-BOOL ExtTextOut(HDC, int, int, UINT, const RECT *, LPCTSTR, UINT, const INT *);
-
-BOOL PolyTextOut(HDC, const POLYTEXT *, int);
-
-int GetTextFace(HDC, int, LPTSTR);
-
-DWORD GetKerningPairs(HDC, DWORD, LPKERNINGPAIR);
-
-BOOL GetLogColorSpace(HCOLORSPACE, LPLOGCOLORSPACE, DWORD);
-
-HCOLORSPACE CreateColorSpace(LPLOGCOLORSPACE);
-
-BOOL GetICMProfile(HDC, LPDWORD, LPTSTR);
-
-BOOL SetICMProfile(HDC, LPTSTR);
-
-int EnumICMProfiles(HDC, ICMENUMPROC, LPARAM);
-
-BOOL UpdateICMRegKey(DWORD, LPTSTR, LPTSTR, UINT);
-
-HKL LoadKeyboardLayout(LPCTSTR, UINT);
-
-BOOL GetKeyboardLayoutName(LPTSTR);
-
-HDESK CreateDesktop(LPCTSTR, LPCTSTR, DEVMODE*, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES);
-
-HDESK CreateDesktopEx(LPCTSTR, LPCTSTR, DEVMODE*, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES, ULONG, PVOID);
-
-HDESK OpenDesktop(LPCTSTR, DWORD, BOOL, ACCESS_MASK);
-
-BOOL EnumDesktops(HWINSTA, DESKTOPENUMPROC, LPARAM);
-
-HWINSTA CreateWindowStation(LPCTSTR, DWORD, ACCESS_MASK, LPSECURITY_ATTRIBUTES);
-
-HWINSTA OpenWindowStation(LPCTSTR, BOOL, ACCESS_MASK);
-
-BOOL EnumWindowStations(WINSTAENUMPROC, LPARAM);
-
-BOOL GetUserObjectInformation(HANDLE, int, PVOID, DWORD, LPDWORD);
-
-BOOL SetUserObjectInformation(HANDLE, int, PVOID, DWORD);
-
-UINT RegisterWindowMessage(LPCTSTR);
-
-BOOL GetMessage(LPMSG, HWND, UINT, UINT);
-
-LRESULT DispatchMessage(const MSG *);
-
-BOOL PeekMessage(LPMSG, HWND, UINT, UINT, UINT);
-
-LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM);
-
-LRESULT SendMessageTimeout(HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR);
-
-BOOL SendNotifyMessage(HWND, UINT, WPARAM, LPARAM);
-
-BOOL SendMessageCallback(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, ULONG_PTR);
-
-long BroadcastSystemMessageEx(DWORD, LPDWORD, UINT, WPARAM, LPARAM, PBSMINFO);
-
-long BroadcastSystemMessage(DWORD, LPDWORD, UINT, WPARAM, LPARAM);
-
-HDEVNOTIFY RegisterDeviceNotification(HANDLE, LPVOID, DWORD);
-
-BOOL PostMessage(HWND, UINT, WPARAM, LPARAM);
-
-BOOL PostThreadMessage(DWORD, UINT, WPARAM, LPARAM);
-
-BOOL PostAppMessage(DWORD, UINT, WPARAM, LPARAM);
-
-LRESULT DefWindowProc(HWND, UINT, WPARAM, LPARAM);
-
-LRESULT CallWindowProc(WNDPROC, HWND, UINT, WPARAM, LPARAM);
-
-ATOM RegisterClass(const WNDCLASS *);
-
-BOOL UnregisterClass(LPCTSTR, HINSTANCE);
-
-BOOL GetClassInfo(HINSTANCE, LPCTSTR, LPWNDCLASS);
-
-ATOM RegisterClassEx(const WNDCLASSEX *);
-
-BOOL GetClassInfoEx(HINSTANCE, LPCTSTR, LPWNDCLASSEX);
-
-HWND CreateWindowEx(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
-
-HWND CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID);
-
-HWND CreateDialogParam(HINSTANCE, LPCTSTR, HWND, DLGPROC, LPARAM);
-
-HWND CreateDialogIndirectParam(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
-
-HWND CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC);
-
-HWND CreateDialogIndirect(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC);
-
-INT_PTR DialogBoxParam(HINSTANCE, LPCTSTR, HWND, DLGPROC, LPARAM);
-
-INT_PTR DialogBoxIndirectParam(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
-
-INT_PTR DialogBox(HINSTANCE, LPCTSTR, HWND, DLGPROC);
-
-INT_PTR DialogBoxIndirect(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC);
-
-BOOL SetDlgItemText(HWND, int, LPCTSTR);
-
-UINT GetDlgItemText(HWND, int, LPTSTR, int);
-
-LRESULT SendDlgItemMessage(HWND, int, UINT, WPARAM, LPARAM);
-
-LRESULT DefDlgProc(HWND, UINT, WPARAM, LPARAM);
-
-BOOL CallMsgFilter(LPMSG, int);
-
-UINT RegisterClipboardFormat(LPCTSTR);
-
-int GetClipboardFormatName(UINT, LPTSTR, int);
-
-BOOL CharToOem(LPCTSTR, LPSTR);
-
-BOOL OemToChar(LPCSTR, LPTSTR);
-
-BOOL CharToOemBuff(LPCTSTR, LPSTR, DWORD);
-
-BOOL OemToCharBuff(LPCSTR, LPTSTR, DWORD);
-
-LPTSTR CharUpper(LPTSTR);
-
-DWORD CharUpperBuff(LPTSTR, DWORD);
-
-LPTSTR CharLower(LPTSTR);
-
-DWORD CharLowerBuff(LPTSTR, DWORD);
-
-LPTSTR CharNext(LPCTSTR);
-
-LPTSTR CharPrev(LPCTSTR, LPCTSTR);
-
-BOOL IsCharAlpha(CHAR);
-
-BOOL IsCharAlphaNumeric(CHAR);
-
-BOOL IsCharUpper(CHAR);
-
-BOOL IsCharLower(CHAR);
-
-int GetKeyNameText(LONG, LPTSTR, int);
-
-SHORT VkKeyScan(CHAR);
-
-SHORT VkKeyScanEx(CHAR, HKL);
-
-UINT MapVirtualKey(UINT, UINT);
-
-UINT MapVirtualKeyEx(UINT, UINT, HKL);
-
-HACCEL LoadAccelerators(HINSTANCE, LPCTSTR);
-
-HACCEL CreateAcceleratorTable(LPACCEL, int);
-
-int CopyAcceleratorTable(HACCEL, LPACCEL, int);
-
-int TranslateAccelerator(HWND, HACCEL, LPMSG);
-
-HMENU LoadMenu(HINSTANCE, LPCTSTR);
-
-HMENU LoadMenuIndirect(const MENUTEMPLATE *);
-
-BOOL ChangeMenu(HMENU, UINT, LPCTSTR, UINT, UINT);
-
-int GetMenuString(HMENU, UINT, LPTSTR, int, UINT);
-
-BOOL InsertMenu(HMENU, UINT, UINT, UINT_PTR, LPCTSTR);
-
-BOOL AppendMenu(HMENU, UINT, UINT_PTR, LPCTSTR);
-
-BOOL ModifyMenu(HMENU, UINT, UINT, UINT_PTR, LPCTSTR);
-
-BOOL InsertMenuItem(HMENU, UINT, BOOL, LPCMENUITEMINFO);
-
-BOOL GetMenuItemInfo(HMENU, UINT, BOOL, LPMENUITEMINFO);
-
-BOOL SetMenuItemInfo(HMENU, UINT, BOOL, LPCMENUITEMINFO);
-
-int DrawText(HDC, LPCTSTR, int, LPRECT, UINT);
-
-int DrawTextEx(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
-
-BOOL GrayString(HDC, HBRUSH, GRAYSTRINGPROC, LPARAM, int, int, int, int, int);
-
-BOOL DrawState(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT);
-
-LONG TabbedTextOut(HDC, int, int, LPCTSTR, int, int, const INT *, int);
-
-DWORD GetTabbedTextExtent(HDC, LPCTSTR, int, int, const INT *);
-
-BOOL SetProp(HWND, LPCTSTR, HANDLE);
-
-HANDLE GetProp(HWND, LPCTSTR);
-
-HANDLE RemoveProp(HWND, LPCTSTR);
-
-int EnumPropsEx(HWND, PROPENUMPROCEX, LPARAM);
-
-int EnumProps(HWND, PROPENUMPROC);
-
-BOOL SetWindowText(HWND, LPCTSTR);
-
-int GetWindowText(HWND, LPTSTR, int);
-
-int GetWindowTextLength(HWND);
-
-int MessageBox(HWND, LPCTSTR, LPCTSTR, UINT);
-
-int MessageBoxEx(HWND, LPCTSTR, LPCTSTR, UINT, WORD);
-
-int MessageBoxIndirect(const MSGBOXPARAMS *);
-
-LONG GetWindowLong(HWND, int);
-
-LONG SetWindowLong(HWND, int, LONG);
-
-LONG_PTR GetWindowLongPtr(HWND, int);
-
-LONG_PTR SetWindowLongPtr(HWND, int, LONG_PTR);
-
-DWORD GetClassLong(HWND, int);
-
-DWORD SetClassLong(HWND, int, LONG);
-
-ULONG_PTR GetClassLongPtr(HWND, int);
-
-ULONG_PTR SetClassLongPtr(HWND, int, LONG_PTR);
-
-HWND FindWindow(LPCTSTR, LPCTSTR);
-
-HWND FindWindowEx(HWND, HWND, LPCTSTR, LPCTSTR);
-
-int GetClassName(HWND, LPTSTR, int);
-
-HHOOK SetWindowsHook(int, HOOKPROC);
-
-HHOOK SetWindowsHookEx(int, HOOKPROC, HINSTANCE, DWORD);
-
-HBITMAP LoadBitmap(HINSTANCE, LPCTSTR);
-
-HCURSOR LoadCursor(HINSTANCE, LPCTSTR);
-
-HCURSOR LoadCursorFromFile(LPCTSTR);
-
-HICON LoadIcon(HINSTANCE, LPCTSTR);
-
-UINT PrivateExtractIcons(LPCTSTR, int, int, int, HICON *, UINT *, UINT, UINT);
-
-HANDLE LoadImage(HINSTANCE, LPCTSTR, UINT, int, int, UINT);
-
-BOOL GetIconInfoEx(HICON, PICONINFOEX);
-
-BOOL IsDialogMessage(HWND, LPMSG);
-
-int DlgDirList(HWND, LPTSTR, int, int, UINT);
-
-BOOL DlgDirSelectEx(HWND, LPTSTR, int, int);
-
-int DlgDirListComboBox(HWND, LPTSTR, int, int, UINT);
-
-BOOL DlgDirSelectComboBoxEx(HWND, LPTSTR, int, int);
-
-LRESULT DefFrameProc(HWND, HWND, UINT, WPARAM, LPARAM);
-
-LRESULT DefMDIChildProc(HWND, UINT, WPARAM, LPARAM);
-
-HWND CreateMDIWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HINSTANCE, LPARAM);
-
-BOOL WinHelp(HWND, LPCTSTR, UINT, ULONG_PTR);
-
-LONG ChangeDisplaySettings(DEVMODE*, DWORD);
-
-LONG ChangeDisplaySettingsEx(LPCTSTR, DEVMODE*, HWND, DWORD, LPVOID);
-
-BOOL EnumDisplaySettings(LPCTSTR, DWORD, DEVMODE*);
-
-BOOL EnumDisplaySettingsEx(LPCTSTR, DWORD, DEVMODE*, DWORD);
-
-BOOL EnumDisplayDevices(LPCTSTR, DWORD, PDISPLAY_DEVICE, DWORD);
-
-BOOL SystemParametersInfo(UINT, UINT, PVOID, UINT);
-
-BOOL GetMonitorInfo(HMONITOR, LPMONITORINFO);
-
-UINT GetWindowModuleFileName(HWND, LPTSTR, UINT);
-
-UINT RealGetWindowClass(HWND, LPTSTR, UINT);
-
-BOOL GetAltTabInfo(HWND, int, PALTTABINFO, LPTSTR, UINT);
-
-UINT GetRawInputDeviceInfo(HANDLE, UINT, LPVOID, PUINT);
-
-int GetDateFormat(LCID, DWORD, const SYSTEMTIME*, LPCTSTR, LPTSTR, int);
-
-int GetTimeFormat(LCID, DWORD, const SYSTEMTIME*, LPCTSTR, LPTSTR, int);
-
-BOOL GetCPInfoEx(UINT, DWORD, LPCPINFOEX);
-
-int CompareString(LCID, DWORD, PCNZTCH, int, PCNZTCH, int);
-
-int GetLocaleInfo(LCID, LCTYPE, LPTSTR, int);
-
-BOOL SetLocaleInfo(LCID, LCTYPE, LPCTSTR);
-
-int GetCalendarInfo(LCID, CALID, CALTYPE, LPTSTR, int, LPDWORD);
-
-BOOL SetCalendarInfo(LCID, CALID, CALTYPE, LPCTSTR);
-
-int GetNumberFormat(LCID, DWORD, LPCTSTR, const NUMBERFMT *, LPTSTR, int);
-
-int GetCurrencyFormat(LCID, DWORD, LPCTSTR, const CURRENCYFMT *, LPTSTR, int);
-
-BOOL EnumCalendarInfo(CALINFO_ENUMPROC, LCID, CALID, CALTYPE);
-
-BOOL EnumCalendarInfoEx(CALINFO_ENUMPROCEX, LCID, CALID, CALTYPE);
-
-BOOL EnumTimeFormats(TIMEFMT_ENUMPROC, LCID, DWORD);
-
-BOOL EnumDateFormats(DATEFMT_ENUMPROC, LCID, DWORD);
-
-BOOL EnumDateFormatsEx(DATEFMT_ENUMPROCEX, LCID, DWORD);
-
-int GetGeoInfo(GEOID, GEOTYPE, LPTSTR, int, LANGID);
-
-BOOL GetStringTypeEx(LCID, DWORD, LPCTSTR, int, LPWORD);
-
-int FoldString(DWORD, LPCTSTR, int, LPTSTR, int);
-
-BOOL EnumSystemLocales(LOCALE_ENUMPROC, DWORD);
-
-BOOL EnumSystemLanguageGroups(LANGUAGEGROUP_ENUMPROC, DWORD, LONG_PTR);
-
-BOOL EnumLanguageGroupLocales(LANGGROUPLOCALE_ENUMPROC, LGRPID, DWORD, LONG_PTR);
-
-BOOL EnumUILanguages(UILANGUAGE_ENUMPROC, DWORD, LONG_PTR);
-
-BOOL EnumSystemCodePages(CODEPAGE_ENUMPROC, DWORD);
-
-BOOL ReadConsoleInput(HANDLE, PINPUT_RECORD, DWORD, LPDWORD);
-
-BOOL PeekConsoleInput(HANDLE, PINPUT_RECORD, DWORD, LPDWORD);
-
-BOOL ReadConsole(HANDLE, LPVOID, DWORD, LPDWORD, PCONSOLE_READCONSOLE_CONTROL);
-
-BOOL WriteConsole(HANDLE, const void*, DWORD, LPDWORD, LPVOID);
-
-BOOL FillConsoleOutputCharacter(HANDLE, CHAR, DWORD, COORD, LPDWORD);
-
-BOOL WriteConsoleOutputCharacter(HANDLE, LPCTSTR, DWORD, COORD, LPDWORD);
-
-BOOL ReadConsoleOutputCharacter(HANDLE, LPTSTR, DWORD, COORD, LPDWORD);
-
-BOOL WriteConsoleInput(HANDLE, const INPUT_RECORD*, DWORD, LPDWORD);
-
-BOOL ScrollConsoleScreenBuffer(HANDLE, const SMALL_RECT*, const SMALL_RECT*, COORD, const CHAR_INFO*);
-
-BOOL WriteConsoleOutput(HANDLE, const CHAR_INFO*, COORD, COORD, PSMALL_RECT);
-
-BOOL ReadConsoleOutput(HANDLE, PCHAR_INFO, COORD, COORD, PSMALL_RECT);
-
-DWORD GetConsoleTitle(LPTSTR, DWORD);
-
-DWORD GetConsoleOriginalTitle(LPTSTR, DWORD);
-
-BOOL SetConsoleTitle(LPCTSTR);
-
-BOOL AddConsoleAlias(LPTSTR, LPTSTR, LPTSTR);
-
-DWORD GetConsoleAlias(LPTSTR, LPTSTR, DWORD, LPTSTR);
-
-DWORD GetConsoleAliasesLength(LPTSTR);
-
-DWORD GetConsoleAliasExesLength();
-
-DWORD GetConsoleAliases(LPTSTR, DWORD, LPTSTR);
-
-DWORD GetConsoleAliasExes(LPTSTR, DWORD);
-
-void ExpungeConsoleCommandHistory(LPTSTR);
-
-BOOL SetConsoleNumberOfCommands(DWORD, LPTSTR);
-
-DWORD GetConsoleCommandHistoryLength(LPTSTR);
-
-DWORD GetConsoleCommandHistory(LPTSTR, DWORD, LPTSTR);
-
-DWORD VerFindFile(DWORD, LPTSTR, LPTSTR, LPTSTR, LPTSTR, PUINT, LPTSTR, PUINT);
-
-DWORD VerInstallFile(DWORD, LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPTSTR, PUINT);
-
-DWORD GetFileVersionInfoSize(LPCTSTR, LPDWORD);
-
-BOOL GetFileVersionInfo(LPCTSTR, DWORD, DWORD, LPVOID);
-
-DWORD GetFileVersionInfoSizeEx(DWORD, LPCTSTR, LPDWORD);
-
-BOOL GetFileVersionInfoEx(DWORD, LPCTSTR, DWORD, DWORD, LPVOID);
-
-DWORD VerLanguageName(DWORD, LPTSTR, DWORD);
-
-BOOL VerQueryValue(LPCVOID, LPCTSTR, LPVOID *, PUINT);
-
-LSTATUS RegConnectRegistry(LPCTSTR, HKEY, PHKEY);
-
-LSTATUS RegConnectRegistryEx(LPCTSTR, HKEY, ULONG, PHKEY);
-
-LSTATUS RegCreateKey(HKEY, LPCTSTR, PHKEY);
-
-LSTATUS RegCreateKeyEx(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, const LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
-
-LSTATUS RegCreateKeyTransacted(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, const LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD, HANDLE, PVOID);
-
-LSTATUS RegDeleteKey(HKEY, LPCTSTR);
-
-LSTATUS RegDeleteKeyEx(HKEY, LPCTSTR, REGSAM, DWORD);
-
-LSTATUS RegDeleteKeyTransacted(HKEY, LPCTSTR, REGSAM, DWORD, HANDLE, PVOID);
-
-LSTATUS RegDeleteValue(HKEY, LPCTSTR);
-
-LSTATUS RegEnumKey(HKEY, DWORD, LPTSTR, DWORD);
-
-LSTATUS RegEnumKeyEx(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPTSTR, LPDWORD, PFILETIME);
-
-LSTATUS RegEnumValue(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
-
-LSTATUS RegLoadKey(HKEY, LPCTSTR, LPCTSTR);
-
-LSTATUS RegOpenKey(HKEY, LPCTSTR, PHKEY);
-
-LSTATUS RegOpenKeyEx(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY);
-
-LSTATUS RegOpenKeyTransacted(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY, HANDLE, PVOID);
-
-LSTATUS RegQueryInfoKey(HKEY, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, PFILETIME);
-
-LSTATUS RegQueryValue(HKEY, LPCTSTR, LPTSTR, PLONG);
-
-LSTATUS RegQueryMultipleValues(HKEY, PVALENT, DWORD, LPTSTR, LPDWORD);
-
-LSTATUS RegQueryValueEx(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
-
-LSTATUS RegReplaceKey(HKEY, LPCTSTR, LPCTSTR, LPCTSTR);
-
-LSTATUS RegRestoreKey(HKEY, LPCTSTR, DWORD);
-
-LSTATUS RegSaveKey(HKEY, LPCTSTR, const LPSECURITY_ATTRIBUTES);
-
-LSTATUS RegSetValue(HKEY, LPCTSTR, DWORD, LPCTSTR, DWORD);
-
-LSTATUS RegSetValueEx(HKEY, LPCTSTR, DWORD, DWORD, const BYTE*, DWORD);
-
-LSTATUS RegUnLoadKey(HKEY, LPCTSTR);
-
-LSTATUS RegDeleteKeyValue(HKEY, LPCTSTR, LPCTSTR);
-
-LSTATUS RegSetKeyValue(HKEY, LPCTSTR, LPCTSTR, DWORD, LPCVOID, DWORD);
-
-LSTATUS RegDeleteTree(HKEY, LPCTSTR);
-
-LSTATUS RegCopyTree(HKEY, LPCTSTR, HKEY);
-
-LSTATUS RegGetValue(HKEY, LPCTSTR, LPCTSTR, DWORD, LPDWORD, PVOID, LPDWORD);
-
-LSTATUS RegLoadMUIString(HKEY, LPCTSTR, LPTSTR, DWORD, LPDWORD, DWORD, LPCTSTR);
-
-LSTATUS RegLoadAppKey(LPCTSTR, PHKEY, REGSAM, DWORD, DWORD);
-
-BOOL InitiateSystemShutdown(LPTSTR, LPTSTR, DWORD, BOOL, BOOL);
-
-BOOL AbortSystemShutdown(LPTSTR);
-
-BOOL InitiateSystemShutdownEx(LPTSTR, LPTSTR, DWORD, BOOL, BOOL, DWORD);
-
-DWORD InitiateShutdown(LPTSTR, LPTSTR, DWORD, DWORD, DWORD);
-
-LSTATUS RegSaveKeyEx(HKEY, LPCTSTR, const LPSECURITY_ATTRIBUTES, DWORD);
-
-DWORD MultinetGetConnectionPerformance(LPNETRESOURCE, LPNETCONNECTINFOSTRUCT);
-
-BOOL ChangeServiceConfig(SC_HANDLE, DWORD, DWORD, DWORD, LPCTSTR, LPCTSTR, LPDWORD, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR);
-
-BOOL ChangeServiceConfig2(SC_HANDLE, DWORD, LPVOID);
-
-SC_HANDLE CreateService(SC_HANDLE, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD, DWORD, LPCTSTR, LPCTSTR, LPDWORD, LPCTSTR, LPCTSTR, LPCTSTR);
-
-BOOL EnumDependentServices(SC_HANDLE, DWORD, LPENUM_SERVICE_STATUS, DWORD, LPDWORD, LPDWORD);
-
-BOOL EnumServicesStatus(SC_HANDLE, DWORD, DWORD, LPENUM_SERVICE_STATUS, DWORD, LPDWORD, LPDWORD, LPDWORD);
-
-BOOL EnumServicesStatusEx(SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD, LPDWORD, LPCTSTR);
-
-BOOL GetServiceKeyName(SC_HANDLE, LPCTSTR, LPTSTR, LPDWORD);
-
-BOOL GetServiceDisplayName(SC_HANDLE, LPCTSTR, LPTSTR, LPDWORD);
-
-SC_HANDLE OpenSCManager(LPCTSTR, LPCTSTR, DWORD);
-
-SC_HANDLE OpenService(SC_HANDLE, LPCTSTR, DWORD);
-
-BOOL QueryServiceConfig(SC_HANDLE, LPQUERY_SERVICE_CONFIG, DWORD, LPDWORD);
-
-BOOL QueryServiceConfig2(SC_HANDLE, DWORD, LPBYTE, DWORD, LPDWORD);
-
-BOOL QueryServiceLockStatus(SC_HANDLE, LPQUERY_SERVICE_LOCK_STATUS, DWORD, LPDWORD);
-
-SERVICE_STATUS_HANDLE RegisterServiceCtrlHandler(LPCTSTR, LPHANDLER_FUNCTION);
-
-SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerEx(LPCTSTR, LPHANDLER_FUNCTION_EX, LPVOID);
-
-BOOL StartServiceCtrlDispatcher(const SERVICE_TABLE_ENTRY *);
-
-BOOL StartService(SC_HANDLE, DWORD, LPCTSTR *);
-
-DWORD NotifyServiceStatusChange(SC_HANDLE, DWORD, PSERVICE_NOTIFY);
-
-BOOL ControlServiceEx(SC_HANDLE, DWORD, DWORD, PVOID);
-
-HKL ImmInstallIME(LPCTSTR, LPCTSTR);
-
-UINT ImmGetDescription(HKL, LPTSTR, UINT);
-
-UINT ImmGetIMEFileName(HKL, LPTSTR, UINT);
-
-LONG ImmGetCompositionString(HIMC, DWORD, LPVOID, DWORD);
-
-BOOL ImmSetCompositionString(HIMC, DWORD, LPVOID, DWORD, LPVOID, DWORD);
-
-DWORD ImmGetCandidateListCount(HIMC, LPDWORD);
-
-DWORD ImmGetCandidateList(HIMC, DWORD, LPCANDIDATELIST, DWORD);
-
-DWORD ImmGetGuideLine(HIMC, DWORD, LPTSTR, DWORD);
-
-BOOL ImmGetCompositionFont(HIMC, LPLOGFONT);
-
-BOOL ImmSetCompositionFont(HIMC, LPLOGFONT);
-
-BOOL ImmConfigureIME(HKL, HWND, DWORD, LPVOID);
-
-LRESULT ImmEscape(HKL, HIMC, UINT, LPVOID);
-
-DWORD ImmGetConversionList(HKL, HIMC, LPCTSTR, LPCANDIDATELIST, DWORD, UINT);
-
-BOOL ImmIsUIMessage(HWND, UINT, WPARAM, LPARAM);
-
-BOOL ImmRegisterWord(HKL, LPCTSTR, DWORD, LPCTSTR);
-
-BOOL ImmUnregisterWord(HKL, LPCTSTR, DWORD, LPCTSTR);
-
-UINT ImmGetRegisterWordStyle(HKL, UINT, LPSTYLEBUF);
-
-UINT ImmEnumRegisterWord(HKL, REGISTERWORDENUMPROC, LPCTSTR, DWORD, LPCTSTR, LPVOID);
-
-DWORD ImmGetImeMenuItems(HIMC, DWORD, DWORD, LPIMEMENUITEMINFO, LPIMEMENUITEMINFO, DWORD);
deleted file mode 100644
--- a/config/windows-h-wrapper.template.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_windows_h
-#define mozilla_windows_h
-
-// Include the "real" windows.h header. On clang/gcc, this can be done with the
-// `include_next` feature, however MSVC requires a direct include path.
-//
-// Also turn off deprecation warnings, as we may be wrapping deprecated fns.
-
-#if defined(__GNUC__) || defined(__clang__)
-#  pragma GCC system_header
-#  include_next <windows.h>
-
-#  pragma GCC diagnostic push
-#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#else
-#  include <${header_path}>
-
-#  pragma warning(push)
-#  pragma warning(disable: 4996 4995)
-#endif // defined(__GNUC__) || defined(__clang__)
-
-// Check if the header should be disabled
-#if defined(MOZ_DISABLE_WINDOWS_WRAPPER)
-#define MOZ_WINDOWS_WRAPPER_DISABLED_REASON "explicitly disabled"
-
-#elif !defined(__cplusplus)
-#define MOZ_WINDOWS_WRAPPER_DISABLED_REASON "non-C++ source file"
-
-#elif !defined(__GNUC__) && !defined(__clang__) && !defined(_DLL)
-#define MOZ_WINDOWS_WRAPPER_DISABLED_REASON "non-dynamic RTL"
-
-#else
-// We're allowed to wrap in the current context. Define `MOZ_WRAPPED_WINDOWS_H`
-// to note that fact, and perform the wrapping.
-#define MOZ_WRAPPED_WINDOWS_H
-extern "C++" {
-
-${decls}
-
-} // extern "C++"
-#endif // enabled
-
-#if defined(__GNUC__) || defined(__clang__)
-#  pragma GCC diagnostic pop
-#else
-#  pragma warning(pop)
-#endif // defined(__GNUC__) || defined(__clang__)
-
-#endif // !defined(mozilla_windows_h)
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/BrowsingContext.h"
+#include "BrowsingContext.h"
 
 #include "mozilla/dom/ChromeBrowsingContext.h"
 #include "mozilla/dom/BrowsingContextBinding.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
--- a/docshell/base/BrowsingContext.h
+++ b/docshell/base/BrowsingContext.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_BrowsingContext_h
-#define mozilla_dom_BrowsingContext_h
+#ifndef BrowsingContext_h
+#define BrowsingContext_h
 
 #include "mozilla/LinkedList.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/WeakPtr.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsString.h"
@@ -119,18 +119,18 @@ public:
   }
 
   void SetOpener(BrowsingContext* aOpener);
 
   static void GetRootBrowsingContexts(
     nsTArray<RefPtr<BrowsingContext>>& aBrowsingContexts);
 
   nsISupports* GetParentObject() const;
-  JSObject* WrapObject(JSContext* aCx,
-                       JS::Handle<JSObject*> aGivenProto) override;
+  virtual JSObject* WrapObject(JSContext* aCx,
+                               JS::Handle<JSObject*> aGivenProto) override;
 
   MOZ_DECLARE_WEAKREFERENCE_TYPENAME(BrowsingContext)
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(BrowsingContext)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(BrowsingContext)
 
   using Children = AutoCleanLinkedList<RefPtr<BrowsingContext>>;
 
 protected:
@@ -153,10 +153,9 @@ private:
   Children mChildren;
   WeakPtr<BrowsingContext> mOpener;
   nsCOMPtr<nsIDocShell> mDocShell;
   nsString mName;
 };
 
 } // namespace dom
 } // namespace mozilla
-
-#endif // !defined(mozilla_dom_BrowsingContext_h)
+#endif
--- a/docshell/base/ChromeBrowsingContext.cpp
+++ b/docshell/base/ChromeBrowsingContext.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/ChromeBrowsingContext.h"
-#include "mozilla/dom/WindowGlobalParent.h"
+#include "ChromeBrowsingContext.h"
 
 namespace mozilla {
 namespace dom {
 
 ChromeBrowsingContext::ChromeBrowsingContext(BrowsingContext* aParent,
                                              BrowsingContext* aOpener,
                                              const nsAString& aName,
                                              uint64_t aBrowsingContextId,
@@ -58,54 +57,10 @@ ChromeBrowsingContext::Cast(BrowsingCont
 
 /* static */ const ChromeBrowsingContext*
 ChromeBrowsingContext::Cast(const BrowsingContext* aContext)
 {
   MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
   return static_cast<const ChromeBrowsingContext*>(aContext);
 }
 
-void
-ChromeBrowsingContext::GetWindowGlobals(nsTArray<RefPtr<WindowGlobalParent>>& aWindows)
-{
-  aWindows.SetCapacity(mWindowGlobals.Count());
-  for (auto iter = mWindowGlobals.Iter(); !iter.Done(); iter.Next()) {
-    aWindows.AppendElement(iter.Get()->GetKey());
-  }
-}
-
-void
-ChromeBrowsingContext::RegisterWindowGlobal(WindowGlobalParent* aGlobal)
-{
-  MOZ_ASSERT(!mWindowGlobals.Contains(aGlobal), "Global already registered!");
-  mWindowGlobals.PutEntry(aGlobal);
-}
-
-void
-ChromeBrowsingContext::UnregisterWindowGlobal(WindowGlobalParent* aGlobal)
-{
-  MOZ_ASSERT(mWindowGlobals.Contains(aGlobal), "Global not registered!");
-  mWindowGlobals.RemoveEntry(aGlobal);
-}
-
-JSObject*
-ChromeBrowsingContext::WrapObject(JSContext* aCx,
-                                  JS::Handle<JSObject*> aGivenProto)
-{
-  return ChromeBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-ChromeBrowsingContext::Traverse(nsCycleCollectionTraversalCallback& cb)
-{
-  ChromeBrowsingContext* tmp = this;
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowGlobals);
-}
-
-void
-ChromeBrowsingContext::Unlink()
-{
-  ChromeBrowsingContext* tmp = this;
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowGlobals);
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/docshell/base/ChromeBrowsingContext.h
+++ b/docshell/base/ChromeBrowsingContext.h
@@ -1,31 +1,27 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_ChromeBrowsingContext_h
-#define mozilla_dom_ChromeBrowsingContext_h
+#ifndef ChromeBrowsingContext_h
+#define ChromeBrowsingContext_h
 
 #include "mozilla/dom/BrowsingContext.h"
 #include "mozilla/RefPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWrapperCache.h"
-#include "nsTHashtable.h"
-#include "nsHashKeys.h"
 
 class nsIDocShell;
 
 namespace mozilla {
 namespace dom {
 
-class WindowGlobalParent;
-
 // ChromeBrowsingContext is a BrowsingContext living in the parent
 // process, with whatever extra data that a BrowsingContext in the
 // parent needs.
 class ChromeBrowsingContext final
   : public BrowsingContext
 {
 public:
   static void CleanupContexts(uint64_t aProcessId);
@@ -33,44 +29,31 @@ public:
   static ChromeBrowsingContext* Cast(BrowsingContext* aContext);
   static const ChromeBrowsingContext* Cast(const BrowsingContext* aContext);
 
   bool IsOwnedByProcess(uint64_t aProcessId) const
   {
     return mProcessId == aProcessId;
   }
 
-  void GetWindowGlobals(nsTArray<RefPtr<WindowGlobalParent>>& aWindows);
-
-  // Called by WindowGlobalParent to register and unregister window globals.
-  void RegisterWindowGlobal(WindowGlobalParent* aGlobal);
-  void UnregisterWindowGlobal(WindowGlobalParent* aGlobal);
-
-  JSObject* WrapObject(JSContext* aCx,
-                       JS::Handle<JSObject*> aGivenProto) override;
-
 protected:
-  void Traverse(nsCycleCollectionTraversalCallback& cb);
-  void Unlink();
+  void Traverse(nsCycleCollectionTraversalCallback& cb) {}
+  void Unlink() {}
 
   using Type = BrowsingContext::Type;
   ChromeBrowsingContext(BrowsingContext* aParent,
                         BrowsingContext* aOpener,
                         const nsAString& aName,
                         uint64_t aBrowsingContextId,
                         uint64_t aProcessId,
                         Type aType = Type::Chrome);
 
 private:
   friend class BrowsingContext;
 
   // XXX(farre): Store a ContentParent pointer here rather than mProcessId?
   // Indicates which process owns the docshell.
   uint64_t mProcessId;
-
-  // All live window globals within this browsing context.
-  nsTHashtable<nsRefPtrHashKey<WindowGlobalParent>> mWindowGlobals;
 };
 
 } // namespace dom
 } // namespace mozilla
-
-#endif // !defined(mozilla_dom_ChromeBrowsingContext_h)
+#endif
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -419,17 +419,17 @@ SOURCES += [
     # Several conflicts with other bindings.
     'DOMIntersectionObserver.cpp',
     # Because of OS X headers.
     'nsContentUtils.cpp',
     # this file doesn't like windows.h
     'nsDOMWindowUtils.cpp',
     # Conflicts with windows.h's definition of SendMessage.
     'nsFrameMessageManager.cpp',
-    # These files have a #error "Never include unwrapped windows.h in this file!"
+    # These files have a #error "Never include windows.h in this file!"
     'nsGlobalWindowInner.cpp',
     'nsGlobalWindowOuter.cpp',
     # Conflicts with windows.h's definition of LoadImage.
     'nsImageLoadingContent.cpp',
     # Because of OS X headers.
     'nsObjectLoadingContent.cpp',
     # nsPluginArray.cpp includes npapi.h indirectly, and that includes a lot of system headers
     'nsPluginArray.cpp',
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -987,26 +987,26 @@ nsContentPermissionRequestProxy::GetRequ
 
 NS_IMPL_ISUPPORTS(RemotePermissionRequest, nsIContentPermissionRequestCallback);
 
 RemotePermissionRequest::RemotePermissionRequest(
   nsIContentPermissionRequest* aRequest,
   nsPIDOMWindowInner* aWindow)
   : mRequest(aRequest)
   , mWindow(aWindow)
+  , mIPCOpen(false)
   , mDestroyed(false)
 {
   mListener = new VisibilityChangeListener(mWindow);
   mListener->SetCallback(this);
 }
 
 RemotePermissionRequest::~RemotePermissionRequest()
 {
-  MOZ_ASSERT(!mozilla::ipc::IProtocol::IPCOpen(),
-             "Protocol must not be open when RemotePermissionRequest is destroyed.");
+  MOZ_ASSERT(!mIPCOpen, "Protocol must not be open when RemotePermissionRequest is destroyed.");
 }
 
 void
 RemotePermissionRequest::DoCancel()
 {
   NS_ASSERTION(mRequest, "We need a request");
   mRequest->Cancel();
 }
--- a/dom/base/nsContentPermissionHelper.h
+++ b/dom/base/nsContentPermissionHelper.h
@@ -229,36 +229,37 @@ public:
   // It will be called when prompt dismissed.
   virtual mozilla::ipc::IPCResult RecvNotifyResult(const bool &aAllow,
                                                    InfallibleTArray<PermissionChoice>&& aChoices) override;
 
   virtual mozilla::ipc::IPCResult RecvGetVisibility() override;
 
   void IPDLAddRef()
   {
+    mIPCOpen = true;
     AddRef();
   }
 
   void IPDLRelease()
   {
+    mIPCOpen = false;
     Release();
   }
 
   void Destroy();
 
-  bool IPCOpen() const {
-    return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed;
-  }
+  bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
 
 private:
   virtual ~RemotePermissionRequest();
 
   void DoAllow(JS::HandleValue aChoices);
   void DoCancel();
 
   nsCOMPtr<nsIContentPermissionRequest> mRequest;
   nsCOMPtr<nsPIDOMWindowInner>          mWindow;
+  bool                                  mIPCOpen;
   bool                                  mDestroyed;
   RefPtr<VisibilityChangeListener>    mListener;
 };
 
 #endif // nsContentPermissionHelper_h
 
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -266,18 +266,16 @@
 #include "nsXULCommandDispatcher.h"
 #include "nsXULPopupManager.h"
 #include "nsIDocShellTreeOwner.h"
 #endif
 #include "nsIPresShellInlines.h"
 
 #include "mozilla/DocLoadingTimelineMarker.h"
 
-#include "mozilla/dom/WindowGlobalChild.h"
-
 #include "nsISpeculativeConnect.h"
 
 #include "mozilla/MediaManager.h"
 
 #include "nsIURIClassifier.h"
 #include "nsIURIMutator.h"
 #include "mozilla/DocumentStyleRootIterator.h"
 #include "mozilla/PendingFullscreenEvent.h"
@@ -3092,23 +3090,16 @@ nsIDocument::SetDocumentURI(nsIURI* aURI
   if (!mOriginalURI)
     mOriginalURI = mDocumentURI;
 
   // If changing the document's URI changed the base URI of the document, we
   // need to refresh the hrefs of all the links on the page.
   if (!equalBases) {
     RefreshLinkHrefs();
   }
-
-  // Tell our WindowGlobalParent that the document's URI has been changed.
-  nsPIDOMWindowInner* inner = GetInnerWindow();
-  WindowGlobalChild* wgc = inner ? inner->GetWindowGlobalChild() : nullptr;
-  if (wgc) {
-    Unused << wgc->SendUpdateDocumentURI(mDocumentURI);
-  }
 }
 
 static void
 GetFormattedTimeString(PRTime aTime, nsAString& aFormattedTimeString)
 {
   PRExplodedTime prtime;
   PR_ExplodeTime(aTime, PR_LocalTimeParameters, &prtime);
   // "MM/DD/YYYY hh:mm:ss"
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -95,17 +95,16 @@
 #include "mozilla/dom/CustomEvent.h"
 
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/WebBrowserPersistLocalDocument.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/ParentSHistory.h"
 #include "mozilla/dom/ChildSHistory.h"
-#include "mozilla/dom/ChromeBrowsingContext.h"
 
 #include "mozilla/dom/HTMLBodyElement.h"
 
 #include "mozilla/ContentPrincipal.h"
 
 #ifdef XP_WIN
 #include "mozilla/plugins/PPluginWidgetParent.h"
 #include "../plugins/ipc/PluginWidgetParent.h"
@@ -3170,29 +3169,16 @@ nsFrameLoader::LoadContext()
       (mRemoteBrowser || TryRemoteBrowser())) {
     loadContext = mRemoteBrowser->GetLoadContext();
   } else {
     loadContext = do_GetInterface(GetDocShell(IgnoreErrors()));
   }
   return loadContext.forget();
 }
 
-already_AddRefed<BrowsingContext>
-nsFrameLoader::GetBrowsingContext()
-{
-  RefPtr<BrowsingContext> browsingContext;
-  if (IsRemoteFrame() &&
-      (mRemoteBrowser || TryRemoteBrowser())) {
-    browsingContext = mRemoteBrowser->GetBrowsingContext();
-  } else if (GetDocShell(IgnoreErrors())) {
-    browsingContext = nsDocShell::Cast(mDocShell)->GetBrowsingContext();
-  }
-  return browsingContext.forget();
-}
-
 void
 nsFrameLoader::InitializeBrowserAPI()
 {
   if (!OwnerIsMozBrowserFrame()) {
     return;
   }
   if (!IsRemoteFrame()) {
     nsresult rv = EnsureMessageManager();
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -43,17 +43,16 @@ class nsIPrintSettings;
 class nsIWebBrowserPersistDocumentReceiver;
 class nsIWebProgressListener;
 
 namespace mozilla {
 
 class OriginAttributes;
 
 namespace dom {
-class BrowsingContext;
 class ChromeMessageSender;
 class ContentParent;
 class InProcessTabChildMessageManager;
 class MessageSender;
 class PBrowserParent;
 class ProcessMessageManager;
 class Promise;
 class TabParent;
@@ -117,18 +116,16 @@ public:
   // WebIDL methods
 
   nsIDocShell* GetDocShell(mozilla::ErrorResult& aRv);
 
   already_AddRefed<nsITabParent> GetTabParent();
 
   already_AddRefed<nsILoadContext> LoadContext();
 
-  already_AddRefed<mozilla::dom::BrowsingContext> GetBrowsingContext();
-
   /**
    * Start loading the frame. This method figures out what to load
    * from the owner content in the frame loader.
    */
   void LoadFrame(bool aOriginalSrc);
 
   /**
    * Loads the specified URI in this frame. Behaves identically to loadFrame,
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -253,18 +253,16 @@
 #ifdef MOZ_WEBSPEECH
 #include "mozilla/dom/SpeechSynthesis.h"
 #endif
 
 #include "mozilla/dom/ClientManager.h"
 #include "mozilla/dom/ClientSource.h"
 #include "mozilla/dom/ClientState.h"
 
-#include "mozilla/dom/WindowGlobalChild.h"
-
 // Apple system headers seem to have a check() macro.  <sigh>
 #ifdef check
 class nsIScriptTimeoutHandler;
 #undef check
 #endif // check
 #include "AccessCheck.h"
 
 #ifdef ANDROID
@@ -1345,21 +1343,16 @@ nsGlobalWindowInner::FreeInnerObjects(bo
 
   if (mCleanMessageManager) {
     MOZ_ASSERT(mIsChrome, "only chrome should have msg manager cleaned");
     if (mChromeFields.mMessageManager) {
       mChromeFields.mMessageManager->Disconnect();
     }
   }
 
-  if (mWindowGlobalChild && !mWindowGlobalChild->IsClosed()) {
-    mWindowGlobalChild->Send__delete__(mWindowGlobalChild);
-  }
-  mWindowGlobalChild = nullptr;
-
   mIntlUtils = nullptr;
 }
 
 //*****************************************************************************
 // nsGlobalWindowInner::nsISupports
 //*****************************************************************************
 
 // QueryInterface implementation for nsGlobalWindowInner
@@ -1740,25 +1733,16 @@ nsGlobalWindowInner::InnerSetNewDocument
   mPerformance = nullptr;
 
   // This must be called after nullifying the internal objects because here we
   // could recreate them, calling the getter methods, and store them into the JS
   // slots. If we nullify them after, the slot values and the objects will be
   // out of sync.
   ClearDocumentDependentSlots(aCx);
 
-  // FIXME: Currently, devtools can crete a fallback webextension window global
-  // in the content process which does not have a corresponding TabChild actor.
-  // This means we have no actor to be our parent. (Bug 1498293)
-  MOZ_DIAGNOSTIC_ASSERT(!mWindowGlobalChild,
-                        "Shouldn't have created WindowGlobalChild yet!");
-  if (XRE_IsParentProcess() || mTabChild) {
-    mWindowGlobalChild = WindowGlobalChild::Create(this);
-  }
-
 #ifdef DEBUG
   mLastOpenedURI = aDocument->GetDocumentURI();
 #endif
 
   Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
                         mMutationBits ? 1 : 0);
   Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_TEXT_EVENT_LISTENERS,
                         mMayHaveTextEventListenerInDefaultGroup ? 1 : 0);
@@ -7827,19 +7811,18 @@ nsGlobalWindowInner::FireOnNewGlobalObje
 {
   // AutoEntryScript required to invoke debugger hook, which is a
   // Gecko-specific concept at present.
   AutoEntryScript aes(this, "nsGlobalWindowInner report new global");
   JS::Rooted<JSObject*> global(aes.cx(), GetWrapper());
   JS_FireOnNewGlobalObject(aes.cx(), global);
 }
 
-#if defined(_WINDOWS_) && !defined(MOZ_WRAPPED_WINDOWS_H)
-#pragma message("wrapper failure reason: " MOZ_WINDOWS_WRAPPER_DISABLED_REASON)
-#error "Never include unwrapped windows.h in this file!"
+#ifdef _WINDOWS_
+#error "Never include windows.h in this file!"
 #endif
 
 already_AddRefed<Promise>
 nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx,
                                        const ImageBitmapSource& aImage,
                                        ErrorResult& aRv)
 {
   return ImageBitmap::Create(this, aImage, Nothing(), aRv);
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -7729,19 +7729,18 @@ nsGlobalWindowOuter::ReportLargeAllocSta
 
   nsContentUtils::ReportToConsole(errorFlags,
                                   NS_LITERAL_CSTRING("DOM"),
                                   mDoc,
                                   nsContentUtils::eDOM_PROPERTIES,
                                   message);
 }
 
-#if defined(_WINDOWS_) && !defined(MOZ_WRAPPED_WINDOWS_H)
-#pragma message("wrapper failure reason: " MOZ_WINDOWS_WRAPPER_DISABLED_REASON)
-#error "Never include unwrapped windows.h in this file!"
+#ifdef _WINDOWS_
+#error "Never include windows.h in this file!"
 #endif
 
 // Helper called by methods that move/resize the window,
 // to ensure the presContext (if any) is aware of resolution
 // change that may happen in multi-monitor configuration.
 void
 nsGlobalWindowOuter::CheckForDPIChange()
 {
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -63,17 +63,16 @@ class Performance;
 class Report;
 class ReportBody;
 class ReportingObserver;
 class Selection;
 class ServiceWorker;
 class ServiceWorkerDescriptor;
 class Timeout;
 class TimeoutManager;
-class WindowGlobalChild;
 class CustomElementRegistry;
 enum class CallerType : uint32_t;
 } // namespace dom
 } // namespace mozilla
 
 // Popup control state enum. The values in this enum must go from most
 // permissive to least permissive so that it's safe to push state in
 // all situations. Pushing popup state onto the stack never makes the
@@ -392,21 +391,16 @@ public:
   nsIDocument* GetDoc()
   {
     if (!mDoc) {
       MaybeCreateDoc();
     }
     return mDoc;
   }
 
-  mozilla::dom::WindowGlobalChild* GetWindowGlobalChild()
-  {
-    return mWindowGlobalChild;
-  }
-
   virtual PopupControlState GetPopupControlState() const = 0;
 
   // Determine if the window is suspended or frozen.  Outer windows
   // will forward this call to the inner window for convenience.  If
   // there is no inner window then the outer window is considered
   // suspended and frozen by default.
   virtual bool IsSuspended() const = 0;
   virtual bool IsFrozen() const = 0;
@@ -732,22 +726,16 @@ protected:
   // List of Report objects for ReportingObservers.
   nsTArray<RefPtr<mozilla::dom::ReportingObserver>> mReportingObservers;
   nsTArray<RefPtr<mozilla::dom::Report>> mReportRecords;
 
   // This is a list of storage access granted for the current window. These are
   // also set as permissions, but it could happen that we need to access them
   // synchronously in this context, and for this, we need a copy here.
   nsTArray<nsCString> mStorageAccessGranted;
-
-  // The WindowGlobalChild actor for this window.
-  //
-  // This will be non-null during the full lifetime of the window, initialized
-  // during SetNewDocument, and cleared during FreeInnerObjects.
-  RefPtr<mozilla::dom::WindowGlobalChild> mWindowGlobalChild;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMWindowInner, NS_PIDOMWINDOWINNER_IID)
 
 class nsPIDOMWindowOuter : public mozIDOMWindowProxy
 {
 protected:
   explicit nsPIDOMWindowOuter(uint64_t aWindowID);
--- a/dom/chrome-webidl/BrowsingContext.webidl
+++ b/dom/chrome-webidl/BrowsingContext.webidl
@@ -12,13 +12,8 @@ interface BrowsingContext {
   sequence<BrowsingContext> getChildren();
 
   readonly attribute nsIDocShell? docShell;
 
   readonly attribute unsigned long long id;
 
   readonly attribute BrowsingContext? opener;
 };
-
-[Exposed=Window, ChromeOnly]
-interface ChromeBrowsingContext : BrowsingContext {
-  sequence<WindowGlobalParent> getWindowGlobals();
-};
deleted file mode 100644
--- a/dom/chrome-webidl/WindowGlobalActors.webidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-interface Principal;
-interface URI;
-interface nsIDocShell;
-
-[Exposed=Window, ChromeOnly]
-interface WindowGlobalParent {
-  readonly attribute boolean isClosed;
-  readonly attribute boolean isInProcess;
-  readonly attribute ChromeBrowsingContext browsingContext;
-
-  readonly attribute unsigned long long innerWindowId;
-  readonly attribute unsigned long long outerWindowId;
-
-  readonly attribute FrameLoader? rootFrameLoader; // Embedded (browser) only
-
-  readonly attribute WindowGlobalChild? childActor; // in-process only
-
-  // Information about the currently loaded document.
-  readonly attribute Principal documentPrincipal;
-  readonly attribute URI? documentURI;
-
-  static WindowGlobalParent? getByInnerWindowId(unsigned long long innerWindowId);
-};
-
-[Exposed=Window, ChromeOnly]
-interface WindowGlobalChild {
-  readonly attribute boolean isClosed;
-  readonly attribute boolean isInProcess;
-  readonly attribute BrowsingContext browsingContext;
-
-  readonly attribute unsigned long long innerWindowId;
-  readonly attribute unsigned long long outerWindowId;
-
-  readonly attribute WindowGlobalParent? parentActor; // in-process only
-
-  static WindowGlobalChild? getByInnerWindowId(unsigned long long innerWIndowId);
-};
--- a/dom/chrome-webidl/moz.build
+++ b/dom/chrome-webidl/moz.build
@@ -49,17 +49,16 @@ WEBIDL_FILES = [
     'MozStorageStatementParams.webidl',
     'MozStorageStatementRow.webidl',
     'PrecompiledScript.webidl',
     'PromiseDebugging.webidl',
     'StructuredCloneHolder.webidl',
     'TelemetryStopwatch.webidl',
     'WebExtensionContentScript.webidl',
     'WebExtensionPolicy.webidl',
-    'WindowGlobalActors.webidl',
     'XULFrameElement.webidl',
     'XULMenuElement.webidl',
     'XULScrollElement.webidl',
     'XULTextElement.webidl'
 ]
 
 if CONFIG['MOZ_PLACES']:
     WEBIDL_FILES += [
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -268,123 +268,114 @@ using mozilla::loader::PScriptCacheChild
 
 namespace mozilla {
 
 namespace dom {
 
 // IPC sender for remote GC/CC logging.
 class CycleCollectWithLogsChild final
   : public PCycleCollectWithLogsChild
+  , public nsICycleCollectorLogSink
 {
 public:
-  NS_INLINE_DECL_REFCOUNTING(CycleCollectWithLogsChild)
-
-  class Sink final : public nsICycleCollectorLogSink
+  NS_DECL_ISUPPORTS
+
+  CycleCollectWithLogsChild(const FileDescriptor& aGCLog,
+                            const FileDescriptor& aCCLog)
   {
-    NS_DECL_ISUPPORTS
-
-    Sink(CycleCollectWithLogsChild* aActor,
-         const FileDescriptor& aGCLog,
-         const FileDescriptor& aCCLog)
-    {
-      mActor = aActor;
-      mGCLog = FileDescriptorToFILE(aGCLog, "w");
-      mCCLog = FileDescriptorToFILE(aCCLog, "w");
+    mGCLog = FileDescriptorToFILE(aGCLog, "w");
+    mCCLog = FileDescriptorToFILE(aCCLog, "w");
+  }
+
+  NS_IMETHOD Open(FILE** aGCLog, FILE** aCCLog) override
+  {
+    if (NS_WARN_IF(!mGCLog) || NS_WARN_IF(!mCCLog)) {
+      return NS_ERROR_FAILURE;
     }
-
-    NS_IMETHOD Open(FILE** aGCLog, FILE** aCCLog) override
-    {
-      if (NS_WARN_IF(!mGCLog) || NS_WARN_IF(!mCCLog)) {
-        return NS_ERROR_FAILURE;
-      }
-      *aGCLog = mGCLog;
-      *aCCLog = mCCLog;
-      return NS_OK;
-    }
-
-    NS_IMETHOD CloseGCLog() override
-    {
-      MOZ_ASSERT(mGCLog);
+    *aGCLog = mGCLog;
+    *aCCLog = mCCLog;
+    return NS_OK;
+  }
+
+  NS_IMETHOD CloseGCLog() override
+  {
+    MOZ_ASSERT(mGCLog);
+    fclose(mGCLog);
+    mGCLog = nullptr;
+    SendCloseGCLog();
+    return NS_OK;
+  }
+
+  NS_IMETHOD CloseCCLog() override
+  {
+    MOZ_ASSERT(mCCLog);
+    fclose(mCCLog);
+    mCCLog = nullptr;
+    SendCloseCCLog();
+    return NS_OK;
+  }
+
+  NS_IMETHOD GetFilenameIdentifier(nsAString& aIdentifier) override
+  {
+    return UnimplementedProperty();
+  }
+
+  NS_IMETHOD SetFilenameIdentifier(const nsAString& aIdentifier) override
+  {
+    return UnimplementedProperty();
+  }
+
+  NS_IMETHOD GetProcessIdentifier(int32_t *aIdentifier) override
+  {
+    return UnimplementedProperty();
+  }
+
+  NS_IMETHOD SetProcessIdentifier(int32_t aIdentifier) override
+  {
+    return UnimplementedProperty();
+  }
+
+  NS_IMETHOD GetGcLog(nsIFile** aPath) override
+  {
+    return UnimplementedProperty();
+  }
+
+  NS_IMETHOD GetCcLog(nsIFile** aPath) override
+  {
+    return UnimplementedProperty();
+  }
+
+private:
+  ~CycleCollectWithLogsChild() override
+  {
+    if (mGCLog) {
       fclose(mGCLog);
       mGCLog = nullptr;
-      mActor->SendCloseGCLog();
-      return NS_OK;
     }
-
-    NS_IMETHOD CloseCCLog() override
-    {
-      MOZ_ASSERT(mCCLog);
+    if (mCCLog) {
       fclose(mCCLog);
       mCCLog = nullptr;
-      mActor->SendCloseCCLog();
-      return NS_OK;
     }
-
-    NS_IMETHOD GetFilenameIdentifier(nsAString& aIdentifier) override
-    {
-      return UnimplementedProperty();
-    }
-
-    NS_IMETHOD SetFilenameIdentifier(const nsAString& aIdentifier) override
-    {
-      return UnimplementedProperty();
-    }
-
-    NS_IMETHOD GetProcessIdentifier(int32_t *aIdentifier) override
-    {
-      return UnimplementedProperty();
-    }
-
-    NS_IMETHOD SetProcessIdentifier(int32_t aIdentifier) override
-    {
-      return UnimplementedProperty();
-    }
-
-    NS_IMETHOD GetGcLog(nsIFile** aPath) override
-    {
-      return UnimplementedProperty();
-    }
-
-    NS_IMETHOD GetCcLog(nsIFile** aPath) override
-    {
-      return UnimplementedProperty();
-    }
-
-  private:
-    ~Sink()
-    {
-      if (mGCLog) {
-        fclose(mGCLog);
-        mGCLog = nullptr;
-      }
-      if (mCCLog) {
-        fclose(mCCLog);
-        mCCLog = nullptr;
-      }
-      // The XPCOM refcount drives the IPC lifecycle;
-      Unused << mActor->Send__delete__(mActor);
-    }
-
-    nsresult UnimplementedProperty()
-    {
-      MOZ_ASSERT(false, "This object is a remote GC/CC logger;"
-                        " this property isn't meaningful.");
-      return NS_ERROR_UNEXPECTED;
-    }
-
-    RefPtr<CycleCollectWithLogsChild> mActor;
-    FILE* mGCLog;
-    FILE* mCCLog;
-  };
-
-private:
-  ~CycleCollectWithLogsChild() {}
+    // The XPCOM refcount drives the IPC lifecycle; see also
+    // DeallocPCycleCollectWithLogsChild.
+    Unused << Send__delete__(this);
+  }
+
+  nsresult UnimplementedProperty()
+  {
+    MOZ_ASSERT(false, "This object is a remote GC/CC logger;"
+                      " this property isn't meaningful.");
+    return NS_ERROR_UNEXPECTED;
+  }
+
+  FILE* mGCLog;
+  FILE* mCCLog;
 };
 
-NS_IMPL_ISUPPORTS(CycleCollectWithLogsChild::Sink, nsICycleCollectorLogSink);
+NS_IMPL_ISUPPORTS(CycleCollectWithLogsChild, nsICycleCollectorLogSink);
 
 class AlertObserver
 {
 public:
 
   AlertObserver(nsIObserver *aObserver, const nsString& aData)
     : mObserver(aObserver)
     , mData(aData)
@@ -958,36 +949,34 @@ ContentChild::ProvideWindowCommon(TabChi
     tabGroup = aTabOpener->TabGroup();
   } else {
     tabGroup = new TabGroup();
   }
 
   TabContext newTabContext = aTabOpener ? *aTabOpener : TabContext();
   RefPtr<TabChild> newChild = new TabChild(this, tabId, tabGroup,
                                            newTabContext, aChromeFlags);
+  if (NS_FAILED(newChild->Init(aParent))) {
+    return NS_ERROR_ABORT;
+  }
 
   if (aTabOpener) {
     MOZ_ASSERT(ipcContext->type() == IPCTabContext::TPopupIPCTabContext);
     ipcContext->get_PopupIPCTabContext().opener() = aTabOpener;
   }
 
   nsCOMPtr<nsIEventTarget> target = tabGroup->EventTargetFor(TaskCategory::Other);
   SetEventTargetForActor(newChild, target);
 
   Unused << SendPBrowserConstructor(
     // We release this ref in DeallocPBrowserChild
     RefPtr<TabChild>(newChild).forget().take(),
     tabId, TabId(0), *ipcContext, aChromeFlags,
     GetID(), IsForBrowser());
 
-  // Now that |newChild| has had its IPC link established, call |Init| to set it up.
-  if (NS_FAILED(newChild->Init(aParent))) {
-    return NS_ERROR_ABORT;
-  }
-
   nsCOMPtr<nsPIDOMWindowInner> parentTopInnerWindow;
   if (aParent) {
     nsCOMPtr<nsPIDOMWindowOuter> parentTopWindow =
       nsPIDOMWindowOuter::From(aParent)->GetTop();
     if (parentTopWindow) {
       parentTopInnerWindow = parentTopWindow->GetCurrentInnerWindow();
     }
   }
@@ -1327,42 +1316,44 @@ ContentChild::RecvRequestMemoryReport(co
   return IPC_OK();
 }
 
 PCycleCollectWithLogsChild*
 ContentChild::AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces,
                                               const FileDescriptor& aGCLog,
                                               const FileDescriptor& aCCLog)
 {
-  return do_AddRef(new CycleCollectWithLogsChild()).take();
+  auto* actor = new CycleCollectWithLogsChild(aGCLog, aCCLog);
+  // Return actor with refcount 0, which is safe because it has a non-XPCOM type.
+  return actor;
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvPCycleCollectWithLogsConstructor(PCycleCollectWithLogsChild* aActor,
                                                    const bool& aDumpAllTraces,
                                                    const FileDescriptor& aGCLog,
                                                    const FileDescriptor& aCCLog)
 {
-  // The sink's destructor is called when the last reference goes away, which
-  // will cause the actor to be closed down.
-  auto* actor = static_cast<CycleCollectWithLogsChild*>(aActor);
-  RefPtr<CycleCollectWithLogsChild::Sink> sink =
-    new CycleCollectWithLogsChild::Sink(actor, aGCLog, aCCLog);
-
-  // Invoke the dumper, which will take a reference to the sink.
+  // Take a reference here, where the XPCOM type is regained.
+  RefPtr<CycleCollectWithLogsChild> sink = static_cast<CycleCollectWithLogsChild*>(aActor);
   nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
+
   dumper->DumpGCAndCCLogsToSink(aDumpAllTraces, sink);
+
+  // The actor's destructor is called when the last reference goes away...
   return IPC_OK();
 }
 
 bool
-ContentChild::DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* aActor)
+ContentChild::DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* /* aActor */)
 {
-  RefPtr<CycleCollectWithLogsChild> actor =
-    dont_AddRef(static_cast<CycleCollectWithLogsChild*>(aActor));
+  // ...so when we get here, there's nothing for us to do.
+  //
+  // Also, we're already in ~CycleCollectWithLogsChild (q.v.) at
+  // this point, so we shouldn't touch the actor in any case.
   return true;
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvInitContentBridgeChild(Endpoint<PContentBridgeChild>&& aEndpoint)
 {
   ContentBridgeChild::Create(std::move(aEndpoint));
   return IPC_OK();
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1479,17 +1479,17 @@ ContentParent::ShutDownProcess(ShutDownM
           !NS_FAILED(file->AppendNative(nsPrintfCString("Recording.%d.%d",
                                                         base::GetCurrentProcId(),
                                                         ++sNumSavedRecordings)))) {
         bool unused;
         SaveRecording(file, &unused);
       }
     }
 
-    if (IPCOpen() && !mShutdownPending) {
+    if (mIPCOpen && !mShutdownPending) {
       // Stop sending input events with input priority when shutting down.
       SetInputPriorityEventEnabled(false);
       if (SendShutdown()) {
         mShutdownPending = true;
         // Start the force-kill timer if we haven't already.
         StartForceKillTimer();
       }
     }
@@ -1682,16 +1682,20 @@ ContentParent::ActorDestroy(ActorDestroy
   RefPtr<ContentParent> kungFuDeathGrip(mSelfRef.forget());
   MOZ_RELEASE_ASSERT(kungFuDeathGrip);
 
   if (mForceKillTimer) {
     mForceKillTimer->Cancel();
     mForceKillTimer = nullptr;
   }
 
+  // Signal shutdown completion regardless of error state, so we can
+  // finish waiting in the xpcom-shutdown/profile-before-change observer.
+  mIPCOpen = false;
+
   if (mHangMonitorActor) {
     ProcessHangMonitor::RemoveProcess(mHangMonitorActor);
     mHangMonitorActor = nullptr;
   }
 
   RefPtr<FileSystemSecurity> fss = FileSystemSecurity::Get();
   if (fss) {
     fss->Forget(ChildID());
@@ -1935,17 +1939,17 @@ ContentParent::NotifyTabDestroying(const
   } else {
     ContentChild::GetSingleton()->SendNotifyTabDestroying(aTabId, aCpId);
   }
 }
 
 void
 ContentParent::StartForceKillTimer()
 {
-  if (mForceKillTimer || !IPCOpen()) {
+  if (mForceKillTimer || !mIPCOpen) {
     return;
   }
 
   int32_t timeoutSecs = StaticPrefs::dom_ipc_tabs_shutdownTimeoutSecs();
   if (timeoutSecs > 0) {
     NS_NewTimerWithFuncCallback(getter_AddRefs(mForceKillTimer),
                                 ContentParent::ForceKillTimerCallback,
                                 this,
@@ -2392,16 +2396,17 @@ ContentParent::ContentParent(ContentPare
   , mIsAlive(true)
   , mIsForBrowser(!mRemoteType.IsEmpty())
   , mRecordReplayState(aRecordReplayState)
   , mRecordingFile(aRecordingFile)
   , mCalledClose(false)
   , mCalledKillHard(false)
   , mCreatedPairedMinidumps(false)
   , mShutdownPending(false)
+  , mIPCOpen(true)
   , mIsRemoteInputEventQueueEnabled(false)
   , mIsInputPriorityEventEnabled(false)
   , mHangMonitorActor(nullptr)
 {
   // Insert ourselves into the global linked list of ContentParent objects.
   if (!sContentParents) {
     sContentParents = new LinkedList<ContentParent>();
   }
@@ -2896,17 +2901,17 @@ ContentParent::IsInputEventQueueSupporte
     sInitialized = true;
   }
   return sSupported;
 }
 
 void
 ContentParent::OnVarChanged(const GfxVarUpdate& aVar)
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return;
   }
   Unused << SendVarUpdate(aVar);
 }
 
 mozilla::ipc::IPCResult
 ContentParent::RecvReadFontList(InfallibleTArray<FontListEntry>* retValue)
 {
@@ -3130,17 +3135,17 @@ ContentParent::Observe(nsISupports* aSub
 
     // Okay to call ShutDownProcess multiple times.
     ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
     MarkAsDead();
 
     // Wait for shutdown to complete, so that we receive any shutdown
     // data (e.g. telemetry) from the child before we quit.
     // This loop terminate prematurely based on mForceKillTimer.
-    SpinEventLoopUntil([&]() { return !IPCOpen() || mCalledKillHard; });
+    SpinEventLoopUntil([&]() { return !mIPCOpen || mCalledKillHard; });
     NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
   }
 
   if (!mIsAlive || !mSubprocess)
     return NS_OK;
 
   // listening for memory pressure event
   if (!strcmp(aTopic, "memory-pressure")) {
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -283,17 +283,17 @@ public:
    *
    * aWidget - the eWindowType_plugin_ipc_chrome widget associated with
    *           this plugin window.
    */
   static void SendAsyncUpdate(nsIWidget* aWidget);
 #endif
 
   // Let managees query if it is safe to send messages.
-  bool IsDestroyed() const { return !IPCOpen(); }
+  bool IsDestroyed() const { return !mIPCOpen; }
 
   virtual mozilla::ipc::IPCResult RecvCreateChildProcess(const IPCTabContext& aContext,
                                                          const hal::ProcessPriority& aPriority,
                                                          const TabId& aOpenerTabId,
                                                          const TabId& aTabId,
                                                          ContentParentId* aCpId,
                                                          bool* aIsForBrowser) override;
 
@@ -1346,16 +1346,17 @@ private:
   Vector<mozilla::ipc::GeckoChildProcessHost*> mReplayingChildren;
 
   // These variables track whether we've called Close() and KillHard() on our
   // channel.
   bool mCalledClose;
   bool mCalledKillHard;
   bool mCreatedPairedMinidumps;
   bool mShutdownPending;
+  bool mIPCOpen;
 
   // True if the input event queue on the main thread of the content process is
   // enabled.
   bool mIsRemoteInputEventQueueEnabled;
 
   // True if we send input events with input priority. Otherwise, we send input
   // events with normal priority.
   bool mIsInputPriorityEventEnabled;
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -21,18 +21,16 @@ using LayoutDeviceIntRect from "Units.h"
 using DesktopIntRect from "Units.h";
 using DesktopToLayoutDeviceScale from "Units.h";
 using CSSToLayoutDeviceScale from "Units.h";
 using CSSRect from "Units.h";
 using CSSSize from "Units.h";
 using mozilla::LayoutDeviceIntPoint from "Units.h";
 using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
 using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
-using refcounted class nsIPrincipal from "mozilla/dom/PermissionMessageUtils.h";
-using mozilla::dom::BrowsingContextId from "mozilla/dom/ipc/IdType.h";
 
 
 namespace mozilla {
 namespace dom {
 
 struct MessagePortIdentifier
 {
   nsID uuid;
@@ -180,18 +178,10 @@ struct PerformanceInfo
   // True if the document window is the top window
   bool isTopLevel;
   // Memory
   PerformanceMemoryInfo memory;
   // Counters per category. For workers, a single entry
   CategoryDispatch[] items;
 };
 
-struct WindowGlobalInit
-{
-  nsIPrincipal principal;
-  BrowsingContextId browsingContextId;
-  uint64_t innerWindowId;
-  uint64_t outerWindowId;
-};
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -13,17 +13,16 @@ include protocol PFilePicker;
 include protocol PIndexedDBPermissionRequest;
 include protocol PPluginWidget;
 include protocol PRemotePrintJob;
 include protocol PChildToParentStream;
 include protocol PParentToChildStream;
 include protocol PFileDescriptorSet;
 include protocol PIPCBlobInputStream;
 include protocol PPaymentRequest;
-include protocol PWindowGlobal;
 
 include DOMTypes;
 include IPCBlob;
 include IPCStream;
 include JavaScriptTypes;
 include URIParams;
 include PPrintingTypes;
 include PTabContext;
@@ -82,17 +81,16 @@ using mozilla::EventMessage from "mozill
 using nsEventStatus from "mozilla/EventForwards.h";
 using mozilla::Modifiers from "mozilla/EventForwards.h";
 using nsSizeMode from "nsIWidgetListener.h";
 using mozilla::widget::CandidateWindowPosition from "ipc/nsGUIEventIPC.h";
 using class mozilla::NativeEventData from "ipc/nsGUIEventIPC.h";
 using mozilla::FontRange from "ipc/nsGUIEventIPC.h";
 using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";
 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
-using mozilla::dom::BrowsingContextId from "mozilla/dom/ipc/IdType.h";
 
 namespace mozilla {
 namespace dom {
 
 struct ShowInfo
 {
   nsString name;
   bool fullscreenAllowed;
@@ -115,17 +113,16 @@ nested(upto inside_cpow) sync protocol P
     manager PContent or PContentBridge;
 
     manages PColorPicker;
     manages PDocAccessible;
     manages PFilePicker;
     manages PIndexedDBPermissionRequest;
     manages PPluginWidget;
     manages PPaymentRequest;
-    manages PWindowGlobal;
 
 both:
     async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
                        Principal aPrincipal, ClonedMessageData aData);
 
 parent:
     /**
      * Tell the parent process a new accessible document has been created.
@@ -143,22 +140,16 @@ parent:
      * in e10s mode. This is always initiated from the child in response
      * to windowed plugin creation.
      */
     sync PPluginWidget();
 
     async PPaymentRequest();
 
     /**
-     * Construct a new WindowGlobal actor for a window global in the given
-     * BrowsingContext and with the given principal.
-     */
-    async PWindowGlobal(WindowGlobalInit init);
-
-    /**
      * Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
      * widget's shareable window on the chrome side. Only used on Windows.
      */
     async SetNativeChildOfShareableWindow(uintptr_t childWindow);
 
     /**
      * When content moves focus from a native plugin window that's a child
      * of the native browser window we need to move native focus to the
@@ -583,18 +574,16 @@ parent:
     async ShowCanvasPermissionPrompt(nsCString aFirstPartyURI);
 
     sync SetSystemFont(nsCString aFontName);
     sync GetSystemFont() returns (nsCString retval);
 
     sync SetPrefersReducedMotionOverrideForTest(bool aValue);
     sync ResetPrefersReducedMotionOverrideForTest();
 
-    async RootBrowsingContext(BrowsingContextId aId);
-
 child:
     /**
      * Notify the remote browser that it has been Show()n on this
      * side, with the given |visibleRect|.  This message is expected
      * to trigger creation of the remote browser's "widget".
      *
      * |Show()| and |Move()| take IntSizes rather than Rects because
      * content processes always render to a virtual <0, 0> top-left
deleted file mode 100644
--- a/dom/ipc/PWindowGlobal.ipdl
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PBrowser;
-include protocol PInProcess;
-
-include DOMTypes;
-
-using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
-
-namespace mozilla {
-namespace dom {
-
-/**
- * A PWindowGlobal actor has a lifetime matching that of a single Window Global,
- * specifically a |nsGlobalWindowInner|. These actors will form a parent/child
- * link either between the chrome/content process, or will be in-process, for
- * documents which are loaded in the chrome process.
- */
-async protocol PWindowGlobal
-{
-  manager PBrowser or PInProcess;
-
-parent:
-  /// Update the URI of the document in this WindowGlobal.
-  async UpdateDocumentURI(nsIURI aUri);
-
-  async __delete__();
-};
-
-} // namespace dom
-} // namespace mozilla
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -149,16 +149,19 @@ class HangMonitorChild
   bool mFinishedStartingDebugger;
   bool mPaintWhileInterruptingJS;
   bool mPaintWhileInterruptingJSForce;
   TabId mPaintWhileInterruptingJSTab;
   MOZ_INIT_OUTSIDE_CTOR LayersObserverEpoch mPaintWhileInterruptingJSEpoch;
   JSContext* mContext;
   bool mShutdownDone;
 
+  // This field is only accessed on the hang thread.
+  bool mIPCOpen;
+
   // Allows us to ensure we NotifyActivity only once, allowing
   // either thread to do so.
   Atomic<bool> mPaintWhileInterruptingJSActive;
 };
 
 Atomic<HangMonitorChild*, SequentiallyConsistent,
        recordreplay::Behavior::DontPreserve> HangMonitorChild::sInstance;
 
@@ -268,16 +271,19 @@ private:
 
   void ShutdownOnThread();
 
   const RefPtr<ProcessHangMonitor> mHangMonitor;
 
   // This field is read-only after construction.
   bool mReportHangs;
 
+  // This field is only accessed on the hang thread.
+  bool mIPCOpen;
+
   Monitor mMonitor;
 
   // Must be accessed with mMonitor held.
   RefPtr<HangMonitoredProcess> mProcess;
   bool mShutdownDone;
   // Map from plugin ID to crash dump ID. Protected by mBrowserCrashDumpHashLock.
   nsDataHashtable<nsUint32HashKey, nsString> mBrowserCrashDumpIds;
   Mutex mBrowserCrashDumpHashLock;
@@ -300,16 +306,17 @@ HangMonitorChild::HangMonitorChild(Proce
    mSentReport(false),
    mTerminateScript(false),
    mTerminateGlobal(false),
    mStartDebugger(false),
    mFinishedStartingDebugger(false),
    mPaintWhileInterruptingJS(false),
    mPaintWhileInterruptingJSForce(false),
    mShutdownDone(false),
+   mIPCOpen(true),
    mPaintWhileInterruptingJSActive(false)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   mContext = danger::GetJSContext();
 
   BackgroundHangMonitor::RegisterAnnotator(*this);
 }
 
@@ -381,16 +388,18 @@ HangMonitorChild::ShutdownOnThread()
   mMonitor.Notify();
 }
 
 void
 HangMonitorChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
+  mIPCOpen = false;
+
   // We use a task here to ensure that IPDL is finished with this
   // HangMonitorChild before it gets deleted on the main thread.
   Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ShutdownOnThread",
                                       this,
                                       &HangMonitorChild::ShutdownOnThread));
 }
 
 mozilla::ipc::IPCResult
@@ -474,17 +483,17 @@ HangMonitorChild::Bind(Endpoint<PProcess
   MOZ_ASSERT(ok);
 }
 
 void
 HangMonitorChild::NotifySlowScriptAsync(TabId aTabId,
                                         const nsCString& aFileName,
                                         const nsString& aAddonId)
 {
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendHangEvidence(SlowScriptData(aTabId, aFileName, aAddonId));
   }
 }
 
 HangMonitorChild::SlowScriptAction
 HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild,
                                    const char* aFileName,
                                    const nsString& aAddonId)
@@ -560,17 +569,17 @@ HangMonitorChild::NotifyPluginHang(uint3
 }
 
 void
 HangMonitorChild::NotifyPluginHangAsync(uint32_t aPluginId)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
   // bounce back to parent on background thread
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendHangEvidence(PluginHangData(aPluginId,
                                               base::GetCurrentProcId()));
   }
 }
 
 void
 HangMonitorChild::ClearHang()
 {
@@ -592,25 +601,26 @@ HangMonitorChild::ClearHang()
 }
 
 void
 HangMonitorChild::ClearHangAsync()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
   // bounce back to parent on background thread
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendClearHang();
   }
 }
 
 /* HangMonitorParent implementation */
 
 HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
  : mHangMonitor(aMonitor),
+   mIPCOpen(true),
    mMonitor("HangMonitorParent lock"),
    mShutdownDone(false),
    mBrowserCrashDumpHashLock("mBrowserCrashDumpIds lock"),
    mMainThreadTaskFactory(this)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   mReportHangs = mozilla::Preferences::GetBool("dom.ipc.reportProcessHangs", false);
 
@@ -655,19 +665,20 @@ HangMonitorParent::Shutdown()
   }
 }
 
 void
 HangMonitorParent::ShutdownOnThread()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
-  // Don't take the lock until after IPCOpen() is checked, as the actor lives on
-  // this thread and ActorDestroy will also take a lock.
-  if (IPCOpen()) {
+  // mIPCOpen is only written from this thread, so need need to take the lock
+  // here. We'd be shooting ourselves in the foot, because ActorDestroy takes
+  // it.
+  if (mIPCOpen) {
     Close();
   }
 
   MonitorAutoLock lock(mMonitor);
   mShutdownDone = true;
   mMonitor.Notify();
 }
 
@@ -691,25 +702,26 @@ HangMonitorParent::PaintWhileInterruptin
 
 void
 HangMonitorParent::PaintWhileInterruptingJSOnThread(TabId aTabId,
                                                     bool aForceRepaint,
                                                     const LayersObserverEpoch& aEpoch)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendPaintWhileInterruptingJS(aTabId, aForceRepaint, aEpoch);
   }
 }
 
 void
 HangMonitorParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
+  mIPCOpen = false;
 }
 
 void
 HangMonitorParent::Bind(Endpoint<PProcessHangMonitorParent>&& aEndpoint)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
   DebugOnly<bool> ok = aEndpoint.Bind(this);
@@ -842,37 +854,37 @@ HangMonitorParent::RecvClearHang()
   return IPC_OK();
 }
 
 void
 HangMonitorParent::TerminateScript(bool aTerminateGlobal)
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendTerminateScript(aTerminateGlobal);
   }
 }
 
 void
 HangMonitorParent::BeginStartingDebugger()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendBeginStartingDebugger();
   }
 }
 
 void
 HangMonitorParent::EndStartingDebugger()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << SendEndStartingDebugger();
   }
 }
 
 void
 HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles)
 {
   MutexAutoLock lock(mBrowserCrashDumpHashLock);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -118,17 +118,16 @@
 #include "nsQueryObject.h"
 #include "nsIHttpChannel.h"
 #include "mozilla/dom/DocGroup.h"
 #include "nsString.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/Telemetry.h"
 #include "nsDocShellLoadState.h"
 #include "nsWebBrowser.h"
-#include "mozilla/dom/WindowGlobalChild.h"
 
 #ifdef XP_WIN
 #include "mozilla/plugins/PluginWidgetChild.h"
 #endif
 
 #ifdef NS_PRINTING
 #include "nsIPrintSession.h"
 #include "nsIPrintSettings.h"
@@ -406,16 +405,17 @@ TabChild::TabChild(nsIContentChild* aMan
   , mTriedBrowserInit(false)
   , mOrientation(hal::eScreenOrientation_PortraitPrimary)
   , mIgnoreKeyPressEvent(false)
   , mHasValidInnerSize(false)
   , mDestroyed(false)
   , mUniqueId(aTabId)
   , mHasSiblings(false)
   , mIsTransparent(false)
+  , mIPCOpen(false)
   , mParentIsActive(false)
   , mDidSetRealShowInfo(false)
   , mDidLoadURLInit(false)
   , mAwaitingLA(false)
   , mSkipKeyPress(false)
   , mLayersObserverEpoch{1}
 #if defined(XP_WIN) && defined(ACCESSIBILITY)
   , mNativeWindowHandle(0)
@@ -581,21 +581,16 @@ TabChild::Init(mozIDOMWindowProxy* aPare
   docShell->SetAffectPrivateSessionLifetime(
       mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME);
   nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(WebNavigation());
   MOZ_ASSERT(loadContext);
   loadContext->SetPrivateBrowsing(OriginAttributesRef().mPrivateBrowsingId > 0);
   loadContext->SetRemoteTabs(
       mChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW);
 
-  // Send our browsing context to the parent process.
-  RefPtr<BrowsingContext> browsingContext =
-    nsDocShell::Cast(docShell)->GetBrowsingContext();
-  SendRootBrowsingContext(BrowsingContextId(browsingContext->Id()));
-
   // Few lines before, baseWindow->Create() will end up creating a new
   // window root in nsGlobalWindow::SetDocShell.
   // Then this chrome event handler, will be inherited to inner windows.
   // We want to also set it to the docshell so that inner windows
   // and any code that has access to the docshell
   // can all listen to the same chrome event handler.
   // XXX: ideally, we would set a chrome event handler earlier,
   // and all windows, even the root one, will use the docshell one.
@@ -621,16 +616,18 @@ TabChild::Init(mozIDOMWindowProxy* aPare
                     bool aPreventDefault)
       {
         if (nsCOMPtr<nsITabChild> tabChild = do_QueryReferent(weakPtrThis)) {
           static_cast<TabChild*>(tabChild.get())->ContentReceivedInputBlock(aGuid, aInputBlockId, aPreventDefault);
         }
       });
   mAPZEventState = new APZEventState(mPuppetWidget, std::move(callback));
 
+  mIPCOpen = true;
+
   // Recording/replaying processes use their own compositor.
   if (recordreplay::IsRecordingOrReplaying()) {
     mPuppetWidget->CreateCompositor();
   }
 
   return NS_OK;
 }
 
@@ -1031,16 +1028,18 @@ TabChild::DestroyWindow()
       }
       mLayersId = layers::LayersId{0};
     }
 }
 
 void
 TabChild::ActorDestroy(ActorDestroyReason why)
 {
+  mIPCOpen = false;
+
   DestroyWindow();
 
   if (mTabChildMessageManager) {
     // We should have a message manager if the global is alive, but it
     // seems sometimes we don't.  Assert in aurora/nightly, but don't
     // crash in release builds.
     MOZ_DIAGNOSTIC_ASSERT(mTabChildMessageManager->GetMessageManager());
     if (mTabChildMessageManager->GetMessageManager()) {
@@ -3431,31 +3430,16 @@ TabChild::AllocPPaymentRequestChild()
 
 bool
 TabChild::DeallocPPaymentRequestChild(PPaymentRequestChild* actor)
 {
   delete actor;
   return true;
 }
 
-PWindowGlobalChild*
-TabChild::AllocPWindowGlobalChild(const WindowGlobalInit&)
-{
-  MOZ_CRASH("We should never be manually allocating PWindowGlobalChild actors");
-  return nullptr;
-}
-
-bool
-TabChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor)
-{
-  // This reference was added in WindowGlobalChild::Create.
-  static_cast<WindowGlobalChild*>(aActor)->Release();
-  return true;
-}
-
 ScreenIntSize
 TabChild::GetInnerSize()
 {
   LayoutDeviceIntSize innerSize =
     RoundedToInt(mUnscaledInnerSize * mPuppetWidget->GetDefaultScale());
   return ViewAs<ScreenPixel>(innerSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
 };
 
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -583,16 +583,18 @@ public:
   AllocPPaymentRequestChild() override;
 
   virtual bool
   DeallocPPaymentRequestChild(PPaymentRequestChild* aActor) override;
 
   LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; }
   LayoutDeviceIntPoint GetChromeOffset() const { return mChromeOffset; };
 
+  bool IPCOpen() const { return mIPCOpen; }
+
   bool ParentIsActive() const
   {
     return mParentIsActive;
   }
 
   const mozilla::layers::CompositorOptions& GetCompositorOptions() const;
   bool AsyncPanZoomEnabled() const;
 
@@ -698,20 +700,16 @@ public:
   {
     MOZ_ASSERT(HasVisibleTabs());
     return *sVisibleTabs;
   }
 
 protected:
   virtual ~TabChild();
 
-  virtual PWindowGlobalChild* AllocPWindowGlobalChild(const WindowGlobalInit& aInit) override;
-
-  virtual bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) override;
-
   virtual mozilla::ipc::IPCResult RecvDestroy() override;
 
   virtual mozilla::ipc::IPCResult RecvSetDocShellIsActive(const bool& aIsActive) override;
 
   virtual mozilla::ipc::IPCResult RecvRenderLayers(const bool& aEnabled, const bool& aForce, const layers::LayersObserverEpoch& aEpoch) override;
 
   virtual mozilla::ipc::IPCResult RecvRequestRootPaint(const IntRect& aRect, const float& aScale, const nscolor& aBackgroundColor, RequestRootPaintResolver&& aResolve) override;
 
@@ -845,16 +843,17 @@ private:
   // Holds the compositor options for the compositor rendering this tab,
   // once we find out which compositor that is.
   Maybe<mozilla::layers::CompositorOptions> mCompositorOptions;
 
   friend class ContentChild;
 
   bool mIsTransparent;
 
+  bool mIPCOpen;
   bool mParentIsActive;
   CSSSize mUnscaledInnerSize;
   bool mDidSetRealShowInfo;
   bool mDidLoadURLInit;
   bool mAwaitingLA;
 
   bool mSkipKeyPress;
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -95,18 +95,16 @@
 #include "ImageOps.h"
 #include "UnitTransforms.h"
 #include <algorithm>
 #include "mozilla/NullPrincipal.h"
 #include "mozilla/WebBrowserPersistDocumentParent.h"
 #include "ProcessPriorityManager.h"
 #include "nsString.h"
 #include "IHistory.h"
-#include "mozilla/dom/WindowGlobalParent.h"
-#include "mozilla/dom/ChromeBrowsingContext.h"
 
 #ifdef XP_WIN
 #include "mozilla/plugins/PluginWidgetParent.h"
 #endif
 
 #if defined(XP_WIN) && defined(ACCESSIBILITY)
 #include "mozilla/a11y/AccessibleWrap.h"
 #include "mozilla/a11y/Compatibility.h"
@@ -1059,39 +1057,16 @@ TabParent::DeallocPIndexedDBPermissionRe
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aActor);
 
   return
     mozilla::dom::indexedDB::DeallocPIndexedDBPermissionRequestParent(aActor);
 }
 
-IPCResult
-TabParent::RecvPWindowGlobalConstructor(PWindowGlobalParent* aActor,
-                                        const WindowGlobalInit& aInit)
-{
-  static_cast<WindowGlobalParent*>(aActor)->Init(aInit);
-  return IPC_OK();
-}
-
-PWindowGlobalParent*
-TabParent::AllocPWindowGlobalParent(const WindowGlobalInit& aInit)
-{
-  // Reference freed in DeallocPWindowGlobalParent.
-  return do_AddRef(new WindowGlobalParent(aInit, /* inproc */ false)).take();
-}
-
-bool
-TabParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor)
-{
-  // Free reference from AllocPWindowGlobalParent.
-  static_cast<WindowGlobalParent*>(aActor)->Release();
-  return true;
-}
-
 void
 TabParent::SendMouseEvent(const nsAString& aType, float aX, float aY,
                           int32_t aButton, int32_t aClickCount,
                           int32_t aModifiers, bool aIgnoreRootScrollFrame)
 {
   if (!mIsDestroyed) {
     Unused << PBrowserParent::SendMouseEvent(nsString(aType), aX, aY,
                                              aButton, aClickCount,
@@ -3743,25 +3718,16 @@ TabParent::RecvGetSystemFont(nsCString* 
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (widget) {
     widget->GetSystemFont(*aFontName);
   }
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult
-TabParent::RecvRootBrowsingContext(const BrowsingContextId& aId)
-{
-  MOZ_ASSERT(!mBrowsingContext, "May only set browsing context once!");
-  mBrowsingContext = ChromeBrowsingContext::Get(aId);
-  MOZ_ASSERT(mBrowsingContext, "Invalid ID!");
-  return IPC_OK();
-}
-
 NS_IMETHODIMP
 FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
 {
   nsAuthInformationHolder* holder =
     static_cast<nsAuthInformationHolder*>(aAuthInfo);
 
   if (!net::gNeckoChild->SendOnAuthAvailable(mCallbackId,
                                              holder->User(),
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -62,17 +62,16 @@ struct IMENotification;
 
 namespace gfx {
 class SourceSurface;
 class DataSourceSurface;
 } // namespace gfx
 
 namespace dom {
 
-class ChromeBrowsingContext;
 class ClonedMessageData;
 class nsIContentParent;
 class Element;
 class DataTransfer;
 
 namespace ipc {
 class StructuredCloneData;
 } // ipc namespace
@@ -126,18 +125,16 @@ public:
   }
 
   already_AddRefed<nsILoadContext> GetLoadContext();
 
   already_AddRefed<nsIWidget> GetTopLevelWidget();
 
   nsIXULBrowserWindow* GetXULBrowserWindow();
 
-  ChromeBrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
-
   void Destroy();
 
   void RemoveWindowListeners();
 
   void AddWindowListeners();
 
   virtual mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
                                                 const bool& aForDocumentNavigation) override;
@@ -325,26 +322,16 @@ public:
                                 const uint32_t& aMsaaID,
                                 const IAccessibleHolder& aDocCOMProxy) override;
 
   /**
    * Return the top level doc accessible parent for this tab.
    */
   a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
 
-  virtual PWindowGlobalParent*
-  AllocPWindowGlobalParent(const WindowGlobalInit& aInit) override;
-
-  virtual bool
-  DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) override;
-
-  virtual mozilla::ipc::IPCResult
-  RecvPWindowGlobalConstructor(PWindowGlobalParent* aActor,
-                               const WindowGlobalInit& aInit) override;
-
   void LoadURL(nsIURI* aURI);
 
   void InitRendering();
   void MaybeShowFrame();
 
   // XXX/cjones: it's not clear what we gain by hiding these
   // message-sending functions under a layer of indirection and
   // eating the return values
@@ -631,18 +618,16 @@ protected:
   virtual mozilla::ipc::IPCResult RecvPaintWhileInterruptingJSNoOp(const LayersObserverEpoch& aEpoch) override;
 
   virtual mozilla::ipc::IPCResult RecvSetDimensions(const uint32_t& aFlags,
                                                     const int32_t& aX, const int32_t& aY,
                                                     const int32_t& aCx, const int32_t& aCy) override;
 
   virtual mozilla::ipc::IPCResult RecvShowCanvasPermissionPrompt(const nsCString& aFirstPartyURI) override;
 
-  virtual mozilla::ipc::IPCResult RecvRootBrowsingContext(const BrowsingContextId& aId) override;
-
   mozilla::ipc::IPCResult
   RecvSetSystemFont(const nsCString& aFontName) override;
   mozilla::ipc::IPCResult
   RecvGetSystemFont(nsCString* aFontName) override;
 
   virtual mozilla::ipc::IPCResult
   RecvVisitURI(const URIParams& aURI, const OptionalURIParams& aLastVisitedURI,
                const uint32_t& aFlags) override;
@@ -708,19 +693,16 @@ private:
 
   nsCOMPtr<nsILoadContext> mLoadContext;
 
   // We keep a strong reference to the frameloader after we've sent the
   // Destroy message and before we've received __delete__. This allows us to
   // dispatch message manager messages during this time.
   RefPtr<nsFrameLoader> mFrameLoader;
 
-  // The root browsing context loaded in this TabParent.
-  RefPtr<ChromeBrowsingContext> mBrowsingContext;
-
   TabId mTabId;
 
   // When loading a new tab or window via window.open, the child is
   // responsible for loading the URL it wants into the new TabChild. When the
   // parent receives the CreateWindow message, though, it sends a LoadURL
   // message, usually for about:blank. It's important for the about:blank load
   // to get processed because the Firefox frontend expects every new window to
   // immediately start loading something (see bug 1123090). However, we want
--- a/dom/ipc/URLClassifierParent.cpp
+++ b/dom/ipc/URLClassifierParent.cpp
@@ -39,16 +39,22 @@ URLClassifierParent::StartClassify(nsIPr
     // This means that code using this in the child process will only get a hit
     // on its callback if some classification actually happens.
     *aSuccess = false;
     ClassificationFailed();
   }
   return IPC_OK();
 }
 
+void
+URLClassifierParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
+
 /////////////////////////////////////////////////////////////////////
 //URLClassifierLocalParent.
 
 NS_IMPL_ISUPPORTS(URLClassifierLocalParent, nsIURIClassifierCallback)
 
 mozilla::ipc::IPCResult
 URLClassifierLocalParent::StartClassify(nsIURI* aURI, const nsACString& aTables)
 {
@@ -68,8 +74,14 @@ URLClassifierLocalParent::StartClassify(
     // Cannot do ClassificationFailed() because the child side
     // is expecting a callback. Only the second parameter will
     // be used, which is the "matched list". We treat "unable
     // to classify" as "not on any list".
     OnClassifyComplete(NS_OK, EmptyCString(), EmptyCString(), EmptyCString());
   }
   return IPC_OK();
 }
+
+void
+URLClassifierLocalParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
--- a/dom/ipc/URLClassifierParent.h
+++ b/dom/ipc/URLClassifierParent.h
@@ -20,62 +20,70 @@ class URLClassifierParentBase : public n
 {
 public:
   // nsIURIClassifierCallback.
   NS_IMETHOD OnClassifyComplete(nsresult aErrorCode,
                                 const nsACString& aList,
                                 const nsACString& aProvider,
                                 const nsACString& aFullHash) override
   {
-    if (BaseProtocol::IPCOpen()) {
+    if (mIPCOpen) {
       ClassifierInfo info = ClassifierInfo(nsCString(aList),
                                            nsCString(aProvider),
                                            nsCString(aFullHash));
       Unused << BaseProtocol::Send__delete__(this, info, aErrorCode);
     }
     return NS_OK;
   }
 
   // Custom.
   void ClassificationFailed()
   {
-    if (BaseProtocol::IPCOpen()) {
+    if (mIPCOpen) {
       Unused << BaseProtocol::Send__delete__(this, void_t(), NS_ERROR_FAILURE);
     }
   }
 
 protected:
   ~URLClassifierParentBase() = default;
+  bool mIPCOpen = true;
 };
 
 //////////////////////////////////////////////////////////////
 // URLClassifierParent
 
 class URLClassifierParent : public URLClassifierParentBase<PURLClassifierParent>
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   mozilla::ipc::IPCResult StartClassify(nsIPrincipal* aPrincipal,
                                         bool aUseTrackingProtection,
                                         bool* aSuccess);
 private:
   ~URLClassifierParent() = default;
+
+  // Override PURLClassifierParent::ActorDestroy. We seem to unable to
+  // override from the base template class.
+  void ActorDestroy(ActorDestroyReason aWhy) override;
 };
 
 //////////////////////////////////////////////////////////////
 // URLClassifierLocalParent
 
 class URLClassifierLocalParent : public URLClassifierParentBase<PURLClassifierLocalParent>
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   mozilla::ipc::IPCResult StartClassify(nsIURI* aURI, const nsACString& aTables);
 
 private:
   ~URLClassifierLocalParent() = default;
+
+  // Override PURLClassifierParent::ActorDestroy.
+  void ActorDestroy(ActorDestroyReason aWhy) override;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_URLClassifierParent_h
deleted file mode 100644
--- a/dom/ipc/WindowGlobalChild.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/WindowGlobalChild.h"
-#include "mozilla/ipc/InProcessChild.h"
-#include "mozilla/dom/BrowsingContext.h"
-#include "mozilla/dom/WindowGlobalActorsBinding.h"
-
-namespace mozilla {
-namespace dom {
-
-typedef nsRefPtrHashtable<nsUint64HashKey, WindowGlobalChild> WGCByIdMap;
-static StaticAutoPtr<WGCByIdMap> gWindowGlobalChildById;
-
-WindowGlobalChild::WindowGlobalChild(nsGlobalWindowInner* aWindow,
-                                     dom::BrowsingContext* aBrowsingContext)
-  : mWindowGlobal(aWindow)
-  , mBrowsingContext(aBrowsingContext)
-  , mInnerWindowId(aWindow->WindowID())
-  , mOuterWindowId(aWindow->GetOuterWindow()->WindowID())
-  , mIPCClosed(true)
-{
-}
-
-already_AddRefed<WindowGlobalChild>
-WindowGlobalChild::Create(nsGlobalWindowInner* aWindow)
-{
-  nsCOMPtr<nsIPrincipal> principal = aWindow->GetPrincipal();
-  MOZ_ASSERT(principal);
-
-  RefPtr<nsDocShell> docshell = nsDocShell::Cast(aWindow->GetDocShell());
-  MOZ_ASSERT(docshell);
-
-  // Initalize our WindowGlobalChild object.
-  RefPtr<dom::BrowsingContext> bc = docshell->GetBrowsingContext();
-  RefPtr<WindowGlobalChild> wgc = new WindowGlobalChild(aWindow, bc);
-
-  WindowGlobalInit init(principal,
-                        BrowsingContextId(wgc->BrowsingContext()->Id()),
-                        wgc->mInnerWindowId,
-                        wgc->mOuterWindowId);
-
-  // Send the link constructor over PInProcessChild or PBrowser.
-  if (XRE_IsParentProcess()) {
-    InProcessChild* ipc = InProcessChild::Singleton();
-    if (!ipc) {
-      return nullptr;
-    }
-
-    // Note: ref is released in DeallocPWindowGlobalChild
-    ipc->SendPWindowGlobalConstructor(do_AddRef(wgc).take(), init);
-  } else {
-    RefPtr<TabChild> tabChild = TabChild::GetFrom(static_cast<mozIDOMWindow*>(aWindow));
-    MOZ_ASSERT(tabChild);
-
-    // Note: ref is released in DeallocPWindowGlobalChild
-    tabChild->SendPWindowGlobalConstructor(do_AddRef(wgc).take(), init);
-  }
-  wgc->mIPCClosed = false;
-
-  // Register this WindowGlobal in the gWindowGlobalParentsById map.
-  if (!gWindowGlobalChildById) {
-    gWindowGlobalChildById = new WGCByIdMap();
-    ClearOnShutdown(&gWindowGlobalChildById);
-  }
-  auto entry = gWindowGlobalChildById->LookupForAdd(wgc->mInnerWindowId);
-  MOZ_RELEASE_ASSERT(!entry, "Duplicate WindowGlobalChild entry for ID!");
-  entry.OrInsert([&] { return wgc; });
-
-  return wgc.forget();
-}
-
-/* static */ already_AddRefed<WindowGlobalChild>
-WindowGlobalChild::GetByInnerWindowId(uint64_t aInnerWindowId)
-{
-  if (!gWindowGlobalChildById) {
-    return nullptr;
-  }
-  return gWindowGlobalChildById->Get(aInnerWindowId);
-}
-
-already_AddRefed<WindowGlobalParent>
-WindowGlobalChild::GetParentActor()
-{
-  if (mIPCClosed) {
-    return nullptr;
-  }
-  IProtocol* otherSide = InProcessChild::ParentActorFor(this);
-  return do_AddRef(static_cast<WindowGlobalParent*>(otherSide));
-}
-
-void
-WindowGlobalChild::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mIPCClosed = true;
-  gWindowGlobalChildById->Remove(mInnerWindowId);
-}
-
-WindowGlobalChild::~WindowGlobalChild()
-{
-  MOZ_ASSERT(!gWindowGlobalChildById ||
-             !gWindowGlobalChildById->Contains(mInnerWindowId));
-}
-
-JSObject*
-WindowGlobalChild::WrapObject(JSContext* aCx,
-                               JS::Handle<JSObject*> aGivenProto)
-{
-  return WindowGlobalChild_Binding::Wrap(aCx, this, aGivenProto);
-}
-
-nsISupports*
-WindowGlobalChild::GetParentObject()
-{
-  return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
-}
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalChild,
-                                      mWindowGlobal,
-                                      mBrowsingContext)
-
-NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WindowGlobalChild, AddRef)
-NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WindowGlobalChild, Release)
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/ipc/WindowGlobalChild.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_WindowGlobalChild_h
-#define mozilla_dom_WindowGlobalChild_h
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/dom/PWindowGlobalChild.h"
-#include "nsWrapperCache.h"
-
-class nsGlobalWindowInner;
-class nsDocShell;
-
-namespace mozilla {
-namespace dom  {
-
-class BrowsingContext;
-class WindowGlobalParent;
-
-/**
- * Actor for a single nsGlobalWindowInner. This actor is used to communicate
- * information to the parent process asynchronously.
- */
-class WindowGlobalChild : public nsWrapperCache
-                        , public PWindowGlobalChild
-{
-public:
-  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WindowGlobalChild)
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WindowGlobalChild)
-
-  static already_AddRefed<WindowGlobalChild>
-  GetByInnerWindowId(uint64_t aInnerWindowId);
-
-  static already_AddRefed<WindowGlobalChild>
-  GetByInnerWindowId(const GlobalObject& aGlobal, uint64_t aInnerWindowId) {
-    return GetByInnerWindowId(aInnerWindowId);
-  }
-
-  dom::BrowsingContext* BrowsingContext() { return mBrowsingContext; }
-  nsGlobalWindowInner* WindowGlobal() { return mWindowGlobal; }
-
-  // Has this actor been shut down
-  bool IsClosed() { return mIPCClosed; }
-
-  // Check if this actor is managed by PInProcess, as-in the document is loaded
-  // in the chrome process.
-  bool IsInProcess() { return XRE_IsParentProcess(); }
-
-  // The Window ID for this WindowGlobal
-  uint64_t InnerWindowId() { return mInnerWindowId; }
-  uint64_t OuterWindowId() { return mOuterWindowId; }
-
-  // Get the other side of this actor if it is an in-process actor. Returns
-  // |nullptr| if the actor has been torn down, or is not in-process.
-  already_AddRefed<WindowGlobalParent> GetParentActor();
-
-  // Create and initialize the WindowGlobalChild object.
-  static already_AddRefed<WindowGlobalChild>
-  Create(nsGlobalWindowInner* aWindow);
-
-  nsISupports* GetParentObject();
-  JSObject* WrapObject(JSContext* aCx,
-                       JS::Handle<JSObject*> aGivenProto) override;
-
-protected:
-  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
-
-private:
-  WindowGlobalChild(nsGlobalWindowInner* aWindow, dom::BrowsingContext* aBc);
-  ~WindowGlobalChild();
-
-  RefPtr<nsGlobalWindowInner> mWindowGlobal;
-  RefPtr<dom::BrowsingContext> mBrowsingContext;
-  uint64_t mInnerWindowId;
-  uint64_t mOuterWindowId;
-  bool mIPCClosed;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // !defined(mozilla_dom_WindowGlobalChild_h)
deleted file mode 100644
--- a/dom/ipc/WindowGlobalParent.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/WindowGlobalParent.h"
-#include "mozilla/ipc/InProcessParent.h"
-#include "mozilla/dom/ChromeBrowsingContext.h"
-#include "mozilla/dom/WindowGlobalActorsBinding.h"
-
-using namespace mozilla::ipc;
-
-namespace mozilla {
-namespace dom {
-
-typedef nsRefPtrHashtable<nsUint64HashKey, WindowGlobalParent> WGPByIdMap;
-static StaticAutoPtr<WGPByIdMap> gWindowGlobalParentsById;
-
-WindowGlobalParent::WindowGlobalParent(const WindowGlobalInit& aInit,
-                                       bool aInProcess)
-  : mDocumentPrincipal(aInit.principal())
-  , mInnerWindowId(aInit.innerWindowId())
-  , mOuterWindowId(aInit.outerWindowId())
-  , mInProcess(aInProcess)
-  , mIPCClosed(true)  // Closed until WGP::Init
-{
-  MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess(), "Parent process only");
-  MOZ_RELEASE_ASSERT(mDocumentPrincipal, "Must have a valid principal");
-
-  // NOTE: mBrowsingContext initialized in Init()
-  MOZ_RELEASE_ASSERT(aInit.browsingContextId() != 0,
-                     "Must be made in BrowsingContext");
-}
-
-void
-WindowGlobalParent::Init(const WindowGlobalInit& aInit)
-{
-  MOZ_ASSERT(Manager(), "Should have a manager!");
-  MOZ_ASSERT(!mFrameLoader, "Cannot Init() a WindowGlobalParent twice!");
-
-  MOZ_ASSERT(mIPCClosed, "IPC shouldn't be open yet");
-  mIPCClosed = false;
-
-  // Register this WindowGlobal in the gWindowGlobalParentsById map.
-  if (!gWindowGlobalParentsById) {
-    gWindowGlobalParentsById = new WGPByIdMap();
-    ClearOnShutdown(&gWindowGlobalParentsById);
-  }
-  auto entry = gWindowGlobalParentsById->LookupForAdd(mInnerWindowId);
-  MOZ_RELEASE_ASSERT(!entry, "Duplicate WindowGlobalParent entry for ID!");
-  entry.OrInsert([&] { return this; });
-
-  // Determine which content process the window global is coming from.
-  ContentParentId processId(0);
-  if (!mInProcess) {
-    processId = static_cast<ContentParent*>(Manager()->Manager())->ChildID();
-  }
-
-  mBrowsingContext = ChromeBrowsingContext::Get(aInit.browsingContextId());
-  MOZ_ASSERT(mBrowsingContext);
-
-  // XXX(nika): This won't be the case soon, but for now this is a good
-  // assertion as we can't switch processes. We should relax this eventually.
-  MOZ_ASSERT(mBrowsingContext->IsOwnedByProcess(processId));
-
-  // Attach ourself to the browsing context.
-  mBrowsingContext->RegisterWindowGlobal(this);
-
-  // Determine what toplevel frame element our WindowGlobalParent is being
-  // embedded in.
-  RefPtr<Element> frameElement;
-  if (mInProcess) {
-    // In the in-process case, we can get it from the other side's
-    // WindowGlobalChild.
-    MOZ_ASSERT(Manager()->GetProtocolTypeId() == PInProcessMsgStart);
-    RefPtr<WindowGlobalChild> otherSide = GetChildActor();
-    if (otherSide && otherSide->WindowGlobal()) {
-      // Get the toplevel window from the other side.
-      RefPtr<nsDocShell> docShell = nsDocShell::Cast(otherSide->WindowGlobal()->GetDocShell());
-      if (docShell) {
-        docShell->GetTopFrameElement(getter_AddRefs(frameElement));
-      }
-    }
-  } else {
-    // In the cross-process case, we can get the frame element from our manager.
-    MOZ_ASSERT(Manager()->GetProtocolTypeId() == PBrowserMsgStart);
-    frameElement = static_cast<TabParent*>(Manager())->GetOwnerElement();
-  }
-
-  // Extract the nsFrameLoader from the current frame element. We may not have a
-  // nsFrameLoader if we are a chrome document.
-  nsCOMPtr<nsIFrameLoaderOwner> flOwner = do_QueryInterface(frameElement);
-  if (flOwner) {
-    mFrameLoader = flOwner->GetFrameLoader();
-  }
-}
-
-/* static */ already_AddRefed<WindowGlobalParent>
-WindowGlobalParent::GetByInnerWindowId(uint64_t aInnerWindowId)
-{
-  if (!gWindowGlobalParentsById) {
-    return nullptr;
-  }
-  return gWindowGlobalParentsById->Get(aInnerWindowId);
-}
-
-already_AddRefed<WindowGlobalChild>
-WindowGlobalParent::GetChildActor()
-{
-  if (mIPCClosed) {
-    return nullptr;
-  }
-  IProtocol* otherSide = InProcessParent::ChildActorFor(this);
-  return do_AddRef(static_cast<WindowGlobalChild*>(otherSide));
-}
-
-IPCResult
-WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI)
-{
-  // XXX(nika): Assert that the URI change was one which makes sense (either
-  // about:blank -> a real URI, or a legal push/popstate URI change?)
-  mDocumentURI = aURI;
-  return IPC_OK();
-}
-
-void
-WindowGlobalParent::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mIPCClosed = true;
-  gWindowGlobalParentsById->Remove(mInnerWindowId);
-  mBrowsingContext->UnregisterWindowGlobal(this);
-}
-
-WindowGlobalParent::~WindowGlobalParent()
-{
-  MOZ_ASSERT(!gWindowGlobalParentsById ||
-             !gWindowGlobalParentsById->Contains(mInnerWindowId));
-}
-
-JSObject*
-WindowGlobalParent::WrapObject(JSContext* aCx,
-                               JS::Handle<JSObject*> aGivenProto)
-{
-  return WindowGlobalParent_Binding::Wrap(aCx, this, aGivenProto);
-}
-
-nsISupports*
-WindowGlobalParent::GetParentObject()
-{
-  return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
-}
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WindowGlobalParent,
-                                      mFrameLoader,
-                                      mBrowsingContext)
-
-NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WindowGlobalParent, AddRef)
-NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WindowGlobalParent, Release)
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/ipc/WindowGlobalParent.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_WindowGlobalParent_h
-#define mozilla_dom_WindowGlobalParent_h
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/dom/PWindowGlobalParent.h"
-#include "nsWrapperCache.h"
-
-class nsIPrincipal;
-class nsIURI;
-class nsFrameLoader;
-
-namespace mozilla {
-namespace dom  {
-
-class ChromeBrowsingContext;
-class WindowGlobalChild;
-
-/**
- * A handle in the parent process to a specific nsGlobalWindowInner object.
- */
-class WindowGlobalParent final : public nsWrapperCache
-                               , public PWindowGlobalParent
-{
-public:
-  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WindowGlobalParent)
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WindowGlobalParent)
-
-  static already_AddRefed<WindowGlobalParent>
-  GetByInnerWindowId(uint64_t aInnerWindowId);
-
-  static already_AddRefed<WindowGlobalParent>
-  GetByInnerWindowId(const GlobalObject& aGlobal, uint64_t aInnerWindowId) {
-    return GetByInnerWindowId(aInnerWindowId);
-  }
-
-  // Has this actor been shut down
-  bool IsClosed() { return mIPCClosed; }
-
-  // Check if this actor is managed by PInProcess, as-in the document is loaded
-  // in-process.
-  bool IsInProcess() { return mInProcess; }
-
-  // Get the other side of this actor if it is an in-process actor. Returns
-  // |nullptr| if the actor has been torn down, or is not in-process.
-  already_AddRefed<WindowGlobalChild> GetChildActor();
-
-  // The principal of this WindowGlobal. This value will not change over the
-  // lifetime of the WindowGlobal object, even to reflect changes in
-  // |document.domain|.
-  nsIPrincipal* DocumentPrincipal() { return mDocumentPrincipal; }
-
-  // The BrowsingContext which this WindowGlobal has been loaded into.
-  ChromeBrowsingContext* BrowsingContext() { return mBrowsingContext; }
-
-  // Get the root nsFrameLoader object for the tree of BrowsingContext nodes
-  // which this WindowGlobal is a part of. This will be the nsFrameLoader
-  // holding the TabParent for remote tabs, and the root content frameloader for
-  // non-remote tabs.
-  nsFrameLoader* GetRootFrameLoader() { return mFrameLoader; }
-
-  // The current URI which loaded in the document.
-  nsIURI* GetDocumentURI() { return mDocumentURI; }
-
-  // Window IDs for inner/outer windows.
-  uint64_t OuterWindowId() { return mOuterWindowId; }
-  uint64_t InnerWindowId() { return mInnerWindowId; }
-
-  // Create a WindowGlobalParent from over IPC. This method should not be called
-  // from outside of the IPC constructors.
-  WindowGlobalParent(const WindowGlobalInit& aInit, bool aInProcess);
-
-  // Initialize the mFrameLoader fields for a created WindowGlobalParent. Must
-  // be called after setting the Manager actor.
-  void Init(const WindowGlobalInit& aInit);
-
-  nsISupports* GetParentObject();
-  JSObject* WrapObject(JSContext* aCx,
-                       JS::Handle<JSObject*> aGivenProto) override;
-
-protected:
-  // IPC messages
-  mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI) override;
-
-  void ActorDestroy(ActorDestroyReason aWhy) override;
-
-private:
-  ~WindowGlobalParent();
-
-  // NOTE: This document principal doesn't reflect possible |document.domain|
-  // mutations which may have been made in the actual document.
-  nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
-  nsCOMPtr<nsIURI> mDocumentURI;
-  RefPtr<nsFrameLoader> mFrameLoader;
-  RefPtr<ChromeBrowsingContext> mBrowsingContext;
-  uint64_t mInnerWindowId;
-  uint64_t mOuterWindowId;
-  bool mInProcess;
-  bool mIPCClosed;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // !defined(mozilla_dom_WindowGlobalParent_h)
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -45,18 +45,16 @@ EXPORTS.mozilla.dom += [
     'nsIContentParent.h',
     'PermissionMessageUtils.h',
     'TabChild.h',
     'TabContext.h',
     'TabMessageUtils.h',
     'TabParent.h',
     'URLClassifierChild.h',
     'URLClassifierParent.h',
-    'WindowGlobalChild.h',
-    'WindowGlobalParent.h',
 ]
 
 EXPORTS.mozilla += [
     'PreallocatedProcessManager.h',
     'ProcessHangMonitor.h',
     'ProcessHangMonitorIPC.h',
     'ProcessPriorityManager.h',
 ]
@@ -82,18 +80,16 @@ UNIFIED_SOURCES += [
     'SharedMap.cpp',
     'SharedStringMap.cpp',
     'StructuredCloneData.cpp',
     'TabChild.cpp',
     'TabContext.cpp',
     'TabMessageUtils.cpp',
     'TabParent.cpp',
     'URLClassifierParent.cpp',
-    'WindowGlobalChild.cpp',
-    'WindowGlobalParent.cpp',
 ]
 
 # ContentChild.cpp cannot be compiled in unified mode on  linux due to Time conflict
 SOURCES += [
     'ContentChild.cpp',
     'ProcessHangMonitor.cpp',
 ]
 
@@ -111,17 +107,16 @@ IPDL_SOURCES += [
     'PFilePicker.ipdl',
     'PLoginReputation.ipdl',
     'PPluginWidget.ipdl',
     'PProcessHangMonitor.ipdl',
     'PTabContext.ipdlh',
     'PURLClassifier.ipdl',
     'PURLClassifierInfo.ipdlh',
     'PURLClassifierLocal.ipdl',
-    'PWindowGlobal.ipdl',
     'ServiceWorkerConfiguration.ipdlh',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] == 'Darwin':
--- a/dom/network/TCPServerSocketChild.cpp
+++ b/dom/network/TCPServerSocketChild.cpp
@@ -22,27 +22,28 @@ NS_IMPL_CYCLE_COLLECTION(TCPServerSocket
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TCPServerSocketChildBase)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(TCPServerSocketChildBase)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TCPServerSocketChildBase)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 TCPServerSocketChildBase::TCPServerSocketChildBase()
+: mIPCOpen(false)
 {
 }
 
 TCPServerSocketChildBase::~TCPServerSocketChildBase()
 {
 }
 
 NS_IMETHODIMP_(MozExternalRefCountType) TCPServerSocketChild::Release(void)
 {
   nsrefcnt refcnt = TCPServerSocketChildBase::Release();
-  if (refcnt == 1 && IPCOpen()) {
+  if (refcnt == 1 && mIPCOpen) {
     PTCPServerSocketChild::SendRequestDelete();
     return 1;
   }
   return refcnt;
 }
 
 TCPServerSocketChild::TCPServerSocketChild(TCPServerSocket* aServerSocket, uint16_t aLocalPort,
                                            uint16_t aBacklog, bool aUseArrayBuffers,
@@ -54,22 +55,26 @@ TCPServerSocketChild::TCPServerSocketChi
   }
   AddIPDLReference();
   gNeckoChild->SendPTCPServerSocketConstructor(this, aLocalPort, aBacklog, aUseArrayBuffers);
 }
 
 void
 TCPServerSocketChildBase::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   this->Release();
 }
 
 void
 TCPServerSocketChildBase::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen);
+  mIPCOpen = true;
   this->AddRef();
 }
 
 TCPServerSocketChild::~TCPServerSocketChild()
 {
 }
 
 mozilla::ipc::IPCResult
--- a/dom/network/TCPServerSocketChild.h
+++ b/dom/network/TCPServerSocketChild.h
@@ -29,16 +29,17 @@ public:
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
 protected:
   TCPServerSocketChildBase();
   virtual ~TCPServerSocketChildBase();
 
   RefPtr<TCPServerSocket> mServerSocket;
+  bool mIPCOpen;
 };
 
 class TCPServerSocketChild : public mozilla::net::PTCPServerSocketChild
                            , public TCPServerSocketChildBase
 {
 public:
   NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
--- a/dom/network/TCPServerSocketParent.cpp
+++ b/dom/network/TCPServerSocketParent.cpp
@@ -21,30 +21,35 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(TCPServ
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TCPServerSocketParent)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 void
 TCPServerSocketParent::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   this->Release();
 }
 
 void
 TCPServerSocketParent::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen);
+  mIPCOpen = true;
   this->AddRef();
 }
 
 TCPServerSocketParent::TCPServerSocketParent(PNeckoParent* neckoParent,
                                              uint16_t aLocalPort,
                                              uint16_t aBacklog,
                                              bool aUseArrayBuffers)
 : mNeckoParent(neckoParent)
+, mIPCOpen(false)
 {
   mServerSocket = new TCPServerSocket(nullptr, aLocalPort, aUseArrayBuffers, aBacklog);
   mServerSocket->SetServerBridgeParent(this);
 }
 
 TCPServerSocketParent::~TCPServerSocketParent()
 {
 }
--- a/dom/network/TCPServerSocketParent.h
+++ b/dom/network/TCPServerSocketParent.h
@@ -43,14 +43,15 @@ private:
   ~TCPServerSocketParent();
 
   nsresult SendCallbackAccept(TCPSocketParent *socket);
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
 
   PNeckoParent* mNeckoParent;
   RefPtr<TCPServerSocket> mServerSocket;
+  bool mIPCOpen;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_TCPServerSocketParent_h
--- a/dom/network/TCPSocketChild.cpp
+++ b/dom/network/TCPSocketChild.cpp
@@ -64,29 +64,30 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TCPSocketChildBase)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(TCPSocketChildBase)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TCPSocketChildBase)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 TCPSocketChildBase::TCPSocketChildBase()
+: mIPCOpen(false)
 {
   mozilla::HoldJSObjects(this);
 }
 
 TCPSocketChildBase::~TCPSocketChildBase()
 {
   mozilla::DropJSObjects(this);
 }
 
 NS_IMETHODIMP_(MozExternalRefCountType) TCPSocketChild::Release(void)
 {
   nsrefcnt refcnt = TCPSocketChildBase::Release();
-  if (refcnt == 1 && IPCOpen()) {
+  if (refcnt == 1 && mIPCOpen) {
     PTCPSocketChild::SendRequestDelete();
     return 1;
   }
   return refcnt;
 }
 
 TCPSocketChild::TCPSocketChild(const nsAString& aHost,
                                const uint16_t& aPort,
@@ -132,23 +133,27 @@ TCPSocketChild::SendWindowlessOpenBind(n
                                 nsCString(aLocalHost), aLocalPort,
                                 aUseSSL, aReuseAddrPort,
                                 true, mFilterName);
 }
 
 void
 TCPSocketChildBase::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   mSocket = nullptr;
   this->Release();
 }
 
 void
 TCPSocketChildBase::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen);
+  mIPCOpen = true;
   this->AddRef();
 }
 
 TCPSocketChild::~TCPSocketChild()
 {
 }
 
 mozilla::ipc::IPCResult
--- a/dom/network/TCPSocketChild.h
+++ b/dom/network/TCPSocketChild.h
@@ -35,16 +35,17 @@ public:
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
 protected:
   TCPSocketChildBase();
   virtual ~TCPSocketChildBase();
 
   nsCOMPtr<nsITCPSocketCallback> mSocket;
+  bool mIPCOpen;
 };
 
 class TCPSocketChild : public mozilla::net::PTCPSocketChild
                      , public TCPSocketChildBase
 {
 public:
   NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
--- a/dom/network/TCPSocketParent.cpp
+++ b/dom/network/TCPSocketParent.cpp
@@ -57,39 +57,44 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION(TCPSocketParentBase, mSocket)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(TCPSocketParentBase)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(TCPSocketParentBase)
 
 TCPSocketParentBase::TCPSocketParentBase()
+: mIPCOpen(false)
 {
 }
 
 TCPSocketParentBase::~TCPSocketParentBase()
 {
 }
 
 void
 TCPSocketParentBase::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   this->Release();
 }
 
 void
 TCPSocketParentBase::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen);
+  mIPCOpen = true;
   this->AddRef();
 }
 
 NS_IMETHODIMP_(MozExternalRefCountType) TCPSocketParent::Release(void)
 {
   nsrefcnt refcnt = TCPSocketParentBase::Release();
-  if (refcnt == 1 && IPCOpen()) {
+  if (refcnt == 1 && mIPCOpen) {
     mozilla::Unused << PTCPSocketParent::SendRequestDelete();
     return 1;
   }
   return refcnt;
 }
 
 mozilla::ipc::IPCResult
 TCPSocketParent::RecvOpen(const nsString& aHost, const uint16_t& aPort, const bool& aUseSSL,
@@ -320,17 +325,17 @@ TCPSocketParent::FireStringDataEvent(con
   MOZ_ASSERT(!mFilter, "Socket filtering doesn't support nsCString");
 
   SendEvent(NS_LITERAL_STRING("data"), data, aReadyState);
 }
 
 void
 TCPSocketParent::SendEvent(const nsAString& aType, CallbackData aData, TCPReadyState aReadyState)
 {
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     mozilla::Unused << PTCPSocketParent::SendCallback(nsString(aType),
                                                       aData,
                                                       static_cast<uint32_t>(aReadyState));
   }
 }
 
 void
 TCPSocketParent::SetSocket(TCPSocket *socket)
--- a/dom/network/TCPSocketParent.h
+++ b/dom/network/TCPSocketParent.h
@@ -31,16 +31,17 @@ public:
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
 protected:
   TCPSocketParentBase();
   virtual ~TCPSocketParentBase();
 
   RefPtr<TCPSocket> mSocket;
+  bool mIPCOpen;
 };
 
 class TCPSocketParent : public mozilla::net::PTCPSocketParent
                       , public TCPSocketParentBase
 {
 public:
   NS_IMETHOD_(MozExternalRefCountType) Release() override;
 
--- a/dom/network/UDPSocketChild.cpp
+++ b/dom/network/UDPSocketChild.cpp
@@ -18,40 +18,45 @@
 using mozilla::net::gNeckoChild;
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ISUPPORTS(UDPSocketChildBase, nsIUDPSocketChild)
 
 UDPSocketChildBase::UDPSocketChildBase()
+: mIPCOpen(false)
 {
 }
 
 UDPSocketChildBase::~UDPSocketChildBase()
 {
 }
 
 void
 UDPSocketChildBase::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   mSocket = nullptr;
   this->Release();
 }
 
 void
 UDPSocketChildBase::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen);
+  mIPCOpen = true;
   this->AddRef();
 }
 
 NS_IMETHODIMP_(MozExternalRefCountType) UDPSocketChild::Release(void)
 {
   nsrefcnt refcnt = UDPSocketChildBase::Release();
-  if (refcnt == 1 && IPCOpen()) {
+  if (refcnt == 1 && mIPCOpen) {
     PUDPSocketChild::SendRequestDelete();
     return 1;
   }
   return refcnt;
 }
 
 UDPSocketChild::UDPSocketChild()
 :mBackgroundManager(nullptr)
--- a/dom/network/UDPSocketChild.h
+++ b/dom/network/UDPSocketChild.h
@@ -24,16 +24,17 @@ public:
 
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
 protected:
   UDPSocketChildBase();
   virtual ~UDPSocketChildBase();
   nsCOMPtr<nsIUDPSocketInternal> mSocket;
+  bool mIPCOpen;
 };
 
 class UDPSocketChild : public mozilla::net::PUDPSocketChild
                      , public UDPSocketChildBase
 {
 public:
   NS_DECL_NSIUDPSOCKETCHILD
   NS_IMETHOD_(MozExternalRefCountType) Release() override;
--- a/dom/network/UDPSocketParent.cpp
+++ b/dom/network/UDPSocketParent.cpp
@@ -25,21 +25,23 @@ namespace mozilla {
 using namespace net;
 
 namespace dom {
 
 NS_IMPL_ISUPPORTS(UDPSocketParent, nsIUDPSocketListener)
 
 UDPSocketParent::UDPSocketParent(PBackgroundParent* aManager)
   : mBackgroundManager(aManager)
+  , mIPCOpen(true)
 {
 }
 
 UDPSocketParent::UDPSocketParent(PNeckoParent* aManager)
   : mBackgroundManager(nullptr)
+  , mIPCOpen(true)
 {
 }
 
 UDPSocketParent::~UDPSocketParent()
 {
 }
 
 bool
@@ -503,29 +505,31 @@ UDPSocketParent::RecvRequestDelete()
 {
   mozilla::Unused << Send__delete__(this);
   return IPC_OK();
 }
 
 void
 UDPSocketParent::ActorDestroy(ActorDestroyReason why)
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   if (mSocket) {
     mSocket->Close();
   }
   mSocket = nullptr;
 }
 
 // nsIUDPSocketListener
 
 NS_IMETHODIMP
 UDPSocketParent::OnPacketReceived(nsIUDPSocket* aSocket, nsIUDPMessage* aMessage)
 {
   // receiving packet from remote host, forward the message content to child process
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return NS_OK;
   }
 
   uint16_t port;
   nsCString ip;
   nsCOMPtr<nsINetAddr> fromAddr;
   aMessage->GetFromAddr(getter_AddRefs(fromAddr));
   fromAddr->GetPort(&port);
@@ -568,26 +572,26 @@ UDPSocketParent::OnPacketReceived(nsIUDP
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 UDPSocketParent::OnStopListening(nsIUDPSocket* aSocket, nsresult aStatus)
 {
   // underlying socket is dead, send state update to child process
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     mozilla::Unused << SendCallbackClosed();
   }
   return NS_OK;
 }
 
 void
 UDPSocketParent::FireInternalError(uint32_t aLineNo)
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return;
   }
 
   mozilla::Unused << SendCallbackError(NS_LITERAL_CSTRING("Internal error"),
                                        NS_LITERAL_CSTRING(__FILE__), aLineNo);
 }
 
 void
--- a/dom/network/UDPSocketParent.h
+++ b/dom/network/UDPSocketParent.h
@@ -65,16 +65,17 @@ private:
                         const uint32_t& sendBufferSize);
   nsresult ConnectInternal(const nsCString& aHost, const uint16_t& aPort);
   void FireInternalError(uint32_t aLineNo);
   void SendInternalError(nsIEventTarget *aThread,
                          uint32_t aLineNo);
 
   PBackgroundParent* mBackgroundManager;
 
+  bool mIPCOpen;
   nsCOMPtr<nsIUDPSocket> mSocket;
   nsCOMPtr<nsISocketFilter> mFilter;
   nsCOMPtr<nsIPrincipal> mPrincipal;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/storage/StorageIPC.cpp
+++ b/dom/storage/StorageIPC.cpp
@@ -124,28 +124,33 @@ private:
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
 };
 
 void
 StorageDBChild::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
+  mIPCOpen = true;
   AddRef();
 }
 
 void
 StorageDBChild::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
+  mIPCOpen = false;
   Release();
 }
 
 StorageDBChild::StorageDBChild(LocalStorageManager* aManager)
   : mManager(aManager)
   , mStatus(NS_OK)
+  , mIPCOpen(false)
 {
 }
 
 StorageDBChild::~StorageDBChild()
 {
 }
 
 // static
@@ -238,45 +243,45 @@ StorageDBChild::Shutdown()
   // the actual thread running on the parent process will also stop
   // automatically in profile-before-change topic observer.
   return NS_OK;
 }
 
 void
 StorageDBChild::AsyncPreload(LocalStorageCacheBridge* aCache, bool aPriority)
 {
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     // Adding ref to cache for the time of preload.  This ensures a reference to
     // to the cache and that all keys will load into this cache object.
     mLoadingCaches.PutEntry(aCache);
     SendAsyncPreload(aCache->OriginSuffix(), aCache->OriginNoSuffix(),
                      aPriority);
   } else {
     // No IPC, no love.  But the LoadDone call is expected.
     aCache->LoadDone(NS_ERROR_UNEXPECTED);
   }
 }
 
 void
 StorageDBChild::AsyncGetUsage(StorageUsageBridge* aUsage)
 {
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     SendAsyncGetUsage(aUsage->OriginScope());
   }
 }
 
 void
 StorageDBChild::SyncPreload(LocalStorageCacheBridge* aCache, bool aForceSync)
 {
   if (NS_FAILED(mStatus)) {
     aCache->LoadDone(mStatus);
     return;
   }
 
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     aCache->LoadDone(NS_ERROR_UNEXPECTED);
     return;
   }
 
   // There is no way to put the child process to a wait state to receive all
   // incoming async responses from the parent, hence we have to do a sync
   // preload instead.  We are smart though, we only demand keys that are left to
   // load in case the async preload has already loaded some keys.
@@ -292,58 +297,58 @@ StorageDBChild::SyncPreload(LocalStorage
   aCache->LoadDone(rv);
 }
 
 nsresult
 StorageDBChild::AsyncAddItem(LocalStorageCacheBridge* aCache,
                              const nsAString& aKey,
                              const nsAString& aValue)
 {
-  if (NS_FAILED(mStatus) || !IPCOpen()) {
+  if (NS_FAILED(mStatus) || !mIPCOpen) {
     return mStatus;
   }
 
   SendAsyncAddItem(aCache->OriginSuffix(), aCache->OriginNoSuffix(),
                    nsString(aKey), nsString(aValue));
   OriginsHavingData().PutEntry(aCache->Origin());
   return NS_OK;
 }
 
 nsresult
 StorageDBChild::AsyncUpdateItem(LocalStorageCacheBridge* aCache,
                                 const nsAString& aKey,
                                 const nsAString& aValue)
 {
-  if (NS_FAILED(mStatus) || !IPCOpen()) {
+  if (NS_FAILED(mStatus) || !mIPCOpen) {
     return mStatus;
   }
 
   SendAsyncUpdateItem(aCache->OriginSuffix(), aCache->OriginNoSuffix(),
                       nsString(aKey), nsString(aValue));
   OriginsHavingData().PutEntry(aCache->Origin());
   return NS_OK;
 }
 
 nsresult
 StorageDBChild::AsyncRemoveItem(LocalStorageCacheBridge* aCache,
                                 const nsAString& aKey)
 {
-  if (NS_FAILED(mStatus) || !IPCOpen()) {
+  if (NS_FAILED(mStatus) || !mIPCOpen) {
     return mStatus;
   }
 
   SendAsyncRemoveItem(aCache->OriginSuffix(), aCache->OriginNoSuffix(),
                       nsString(aKey));
   return NS_OK;
 }
 
 nsresult
 StorageDBChild::AsyncClear(LocalStorageCacheBridge* aCache)
 {
-  if (NS_FAILED(mStatus) || !IPCOpen()) {
+  if (NS_FAILED(mStatus) || !mIPCOpen) {
     return mStatus;
   }
 
   SendAsyncClear(aCache->OriginSuffix(), aCache->OriginNoSuffix());
   OriginsHavingData().RemoveEntry(aCache->Origin());
   return NS_OK;
 }
 
@@ -597,31 +602,36 @@ private:
 };
 
 NS_IMPL_ADDREF(StorageDBParent)
 NS_IMPL_RELEASE(StorageDBParent)
 
 void
 StorageDBParent::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references");
+  mIPCOpen = true;
   AddRef();
 }
 
 void
 StorageDBParent::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference");
+  mIPCOpen = false;
   Release();
 }
 
 namespace {
 
 } // namespace
 
 StorageDBParent::StorageDBParent(const nsString& aProfilePath)
   : mProfilePath(aProfilePath)
+  , mIPCOpen(false)
 {
   AssertIsOnBackgroundThread();
 
   // We are always open by IPC only
   AddIPDLReference();
 }
 
 StorageDBParent::~StorageDBParent()
@@ -829,17 +839,17 @@ StorageDBParent::RecvAsyncAddItem(const 
   if (!storageThread) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   nsresult rv =
     storageThread->AsyncAddItem(NewCache(aOriginSuffix, aOriginNoSuffix),
                                 aKey,
                                 aValue);
-  if (NS_FAILED(rv) && IPCOpen()) {
+  if (NS_FAILED(rv) && mIPCOpen) {
     mozilla::Unused << SendError(rv);
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 StorageDBParent::RecvAsyncUpdateItem(const nsCString& aOriginSuffix,
@@ -851,17 +861,17 @@ StorageDBParent::RecvAsyncUpdateItem(con
   if (!storageThread) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   nsresult rv =
     storageThread->AsyncUpdateItem(NewCache(aOriginSuffix, aOriginNoSuffix),
                                    aKey,
                                    aValue);
-  if (NS_FAILED(rv) && IPCOpen()) {
+  if (NS_FAILED(rv) && mIPCOpen) {
     mozilla::Unused << SendError(rv);
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 StorageDBParent::RecvAsyncRemoveItem(const nsCString& aOriginSuffix,
@@ -871,17 +881,17 @@ StorageDBParent::RecvAsyncRemoveItem(con
   StorageDBThread* storageThread = StorageDBThread::GetOrCreate(mProfilePath);
   if (!storageThread) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   nsresult rv =
     storageThread->AsyncRemoveItem(NewCache(aOriginSuffix, aOriginNoSuffix),
                                    aKey);
-  if (NS_FAILED(rv) && IPCOpen()) {
+  if (NS_FAILED(rv) && mIPCOpen) {
     mozilla::Unused << SendError(rv);
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 StorageDBParent::RecvAsyncClear(const nsCString& aOriginSuffix,
@@ -889,17 +899,17 @@ StorageDBParent::RecvAsyncClear(const ns
 {
   StorageDBThread* storageThread = StorageDBThread::GetOrCreate(mProfilePath);
   if (!storageThread) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   nsresult rv =
     storageThread->AsyncClear(NewCache(aOriginSuffix, aOriginNoSuffix));
-  if (NS_FAILED(rv) && IPCOpen()) {
+  if (NS_FAILED(rv) && mIPCOpen) {
     mozilla::Unused << SendError(rv);
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 StorageDBParent::RecvAsyncFlush()
@@ -965,17 +975,17 @@ StorageDBParent::RecvClearMatchingOrigin
   return IPC_OK();
 }
 
 void
 StorageDBParent::Observe(const nsCString& aTopic,
                          const nsString& aOriginAttributesPattern,
                          const nsCString& aOriginScope)
 {
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     mozilla::Unused <<
       SendObserve(aTopic, aOriginAttributesPattern, aOriginScope);
   }
 }
 
 namespace {
 
 // Results must be sent back on the main thread
--- a/dom/storage/StorageIPC.h
+++ b/dom/storage/StorageIPC.h
@@ -173,16 +173,18 @@ private:
   nsAutoPtr<nsTHashtable<nsCStringHashKey>> mOriginsHavingData;
 
   // List of caches waiting for preload.  This ensures the contract that
   // AsyncPreload call references the cache for time of the preload.
   nsTHashtable<nsRefPtrHashKey<LocalStorageCacheBridge>> mLoadingCaches;
 
   // Status of the remote database
   nsresult mStatus;
+
+  bool mIPCOpen;
 };
 
 class LocalStorageCacheParent final
   : public PBackgroundLocalStorageCacheParent
 {
   const PrincipalInfo mPrincipalInfo;
   const nsCString mOriginKey;
   uint32_t mPrivateBrowsingId;
@@ -232,16 +234,18 @@ public:
   Init();
 
   NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
   NS_IMETHOD_(MozExternalRefCountType) Release(void);
 
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
+  bool IPCOpen() { return mIPCOpen; }
+
 public:
   // Fake cache class receiving async callbacks from DB thread, sending
   // them back to appropriate cache object on the child process.
   class CacheParentBridge : public LocalStorageCacheBridge {
   public:
     CacheParentBridge(StorageDBParent* aParentDB,
                       const nsACString& aOriginSuffix,
                       const nsACString& aOriginNoSuffix)
@@ -358,16 +362,19 @@ private:
   // background thread when invoking StorageDBThread::GetOrCreate because it
   // cannot safely perform a synchronous dispatch back to the main thread
   // (because we are already synchronously doing things on the stack).
   // Populated for the same process actors, empty for other process actors.
   nsString mProfilePath;
 
   ThreadSafeAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
+
+  // True when IPC channel is open and Send*() methods are OK to use.
+  bool mIPCOpen;
 };
 
 PBackgroundLocalStorageCacheParent*
 AllocPBackgroundLocalStorageCacheParent(
                               const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
                               const nsCString& aOriginKey,
                               const uint32_t& aPrivateBrowsingId);
 
--- a/dom/webidl/FrameLoader.webidl
+++ b/dom/webidl/FrameLoader.webidl
@@ -29,22 +29,16 @@ interface FrameLoader {
   /**
    * Get an nsILoadContext for the top-level docshell. For remote
    * frames, a shim is returned that contains private browsing and app
    * information.
    */
   readonly attribute LoadContext loadContext;
 
   /**
-   * Get the root BrowsingContext within the frame.
-   * This may be null immediately after creating a remote frame.
-   */
-  readonly attribute BrowsingContext? browsingContext;
-
-  /**
    * Get the ParentSHistory for the nsFrameLoader. May return null if this
    * frameloader is not for a toplevel frame.
    */
   readonly attribute ParentSHistory? parentSHistory;
 
   /**
    * Find out whether the loader's frame is at too great a depth in
    * the frame tree.  This can be used to decide what operations may
--- a/gfx/cairo/cairo/src/moz.build
+++ b/gfx/cairo/cairo/src/moz.build
@@ -29,17 +29,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] not in (
         'cairo-pdf-surface.c',
         'cairo-truetype-subset.c',
         # cairo-type1-subset.c should be here, but it's only supported on freetype platforms
         'cairo-type1-fallback.c',
         'cairo-type3-glyph-surface.c',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    DEFINES['MOZ_DISABLE_WINDOWS_WRAPPER'] = True
     EXPORTS.cairo += [
         'cairo-win32.h',
     ]
     SOURCES += [
         'cairo-dwrite-font.cpp',
     ]
     if CONFIG['MOZ_ENABLE_D2D_SURFACE']:
         SOURCES += [
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -101,32 +101,49 @@ public:
 
   TextureChild()
   : mCompositableForwarder(nullptr)
   , mTextureForwarder(nullptr)
   , mTextureClient(nullptr)
   , mTextureData(nullptr)
   , mDestroyed(false)
   , mMainThreadOnly(false)
+  , mIPCOpen(false)
   , mOwnsTextureData(false)
   , mOwnerCalledDestroy(false)
   {}
 
   mozilla::ipc::IPCResult Recv__delete__() override { return IPC_OK(); }
 
   LayersIPCChannel* GetAllocator() { return mTextureForwarder; }
 
   void ActorDestroy(ActorDestroyReason why) override;
 
+  bool IPCOpen() const { return mIPCOpen; }
+
   void Lock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Enter(); } }
 
   void Unlock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Leave(); } }
 
 private:
 
+  // AddIPDLReference and ReleaseIPDLReference are only to be called by CreateIPDLActor
+  // and DestroyIPDLActor, respectively. We intentionally make them private to prevent misuse.
+  // The purpose of these methods is to be aware of when the IPC system around this
+  // actor goes down: mIPCOpen is then set to false.
+  void AddIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == false);
+    mIPCOpen = true;
+    AddRef();
+  }
+  void ReleaseIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == false);
+    Release();
+  }
+
   /// The normal way to destroy the actor.
   ///
   /// This will asynchronously send a Destroy message to the parent actor, whom
   /// will send the delete message.
   void Destroy(const TextureDeallocParams& aParams);
 
   // This lock is used order to prevent several threads to access the
   // TextureClient's data concurrently. In particular, it prevents shutdown
@@ -195,16 +212,17 @@ private:
 
   RefPtr<CompositableForwarder> mCompositableForwarder;
   RefPtr<TextureForwarder> mTextureForwarder;
 
   TextureClient* mTextureClient;
   TextureData* mTextureData;
   Atomic<bool> mDestroyed;
   bool mMainThreadOnly;
+  bool mIPCOpen;
   bool mOwnsTextureData;
   bool mOwnerCalledDestroy;
 
   friend class TextureClient;
   friend void DeallocateTextureClient(TextureDeallocParams params);
 };
 
 
@@ -232,16 +250,18 @@ static void DestroyTextureData(TextureDa
   }
   delete aTextureData;
 }
 
 void
 TextureChild::ActorDestroy(ActorDestroyReason why)
 {
   AUTO_PROFILER_LABEL("TextureChild::ActorDestroy", GRAPHICS);
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
 
   if (mTextureData) {
     DestroyTextureData(mTextureData, GetAllocator(), mOwnsTextureData, mMainThreadOnly);
     mTextureData = nullptr;
   }
 }
 
 void
@@ -719,25 +739,26 @@ TextureClient::ToSurfaceDescriptor(Surfa
 
   return mData ? mData->Serialize(aOutDescriptor) : false;
 }
 
 // static
 PTextureChild*
 TextureClient::CreateIPDLActor()
 {
-  RefPtr<TextureChild> c = new TextureChild();
-  return c.forget().take();
+  TextureChild* c = new TextureChild();
+  c->AddIPDLReference();
+  return c;
 }
 
 // static
 bool
 TextureClient::DestroyIPDLActor(PTextureChild* actor)
 {
-  RefPtr<TextureChild> tc = dont_AddRef(static_cast<TextureChild*>(actor));
+  static_cast<TextureChild*>(actor)->ReleaseIPDLReference();
   return true;
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::AsTextureClient(PTextureChild* actor)
 {
   if (!actor) {
--- a/gfx/layers/ipc/LayerTransactionChild.h
+++ b/gfx/layers/ipc/LayerTransactionChild.h
@@ -28,51 +28,55 @@ public:
    * to be sent from the parent side.
    *
    * It is expected (checked with an assert) that all shadow layers
    * created by this have already been destroyed and
    * Send__delete__()d by the time this method is called.
    */
   void Destroy();
 
-  bool IPCOpen() const {
-    return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed;
-  }
+  bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
   bool IsDestroyed() const { return mDestroyed; }
 
   void SetForwarder(ShadowLayerForwarder* aForwarder)
   {
     mForwarder = aForwarder;
   }
 
   LayersId GetId() const { return mId; }
 
   void MarkDestroyed() {
     mDestroyed = true;
   }
 
 protected:
   explicit LayerTransactionChild(const LayersId& aId)
     : mForwarder(nullptr)
+    , mIPCOpen(false)
     , mDestroyed(false)
     , mId(aId)
   {}
   ~LayerTransactionChild() { }
 
   void ActorDestroy(ActorDestroyReason why) override;
 
   void AddIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == false);
+    mIPCOpen = true;
     AddRef();
   }
   void ReleaseIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == true);
+    mIPCOpen = false;
     Release();
   }
   friend class CompositorBridgeChild;
 
   ShadowLayerForwarder* mForwarder;
+  bool mIPCOpen;
   bool mDestroyed;
   LayersId mId;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -53,16 +53,17 @@ LayerTransactionParent::LayerTransaction
   , mCompositorBridge(aBridge)
   , mAnimStorage(aAnimStorage)
   , mId(aId)
   , mChildEpoch{0}
   , mParentEpoch{0}
   , mVsyncRate(aVsyncRate)
   , mPendingTransaction{0}
   , mDestroyed(false)
+  , mIPCOpen(false)
   , mUpdateHitTestingTree(false)
 {
   MOZ_ASSERT(mId.IsValid());
 }
 
 LayerTransactionParent::~LayerTransactionParent()
 {
 }
@@ -878,38 +879,38 @@ LayerTransactionParent::ActorDestroy(Act
   Destroy();
 }
 
 bool
 LayerTransactionParent::AllocShmem(size_t aSize,
                                    ipc::SharedMemory::SharedMemoryType aType,
                                    ipc::Shmem* aShmem)
 {
-  if (!IPCOpen() || mDestroyed) {
+  if (!mIPCOpen || mDestroyed) {
     return false;
   }
   return PLayerTransactionParent::AllocShmem(aSize, aType, aShmem);
 }
 
 bool
 LayerTransactionParent::AllocUnsafeShmem(size_t aSize,
                                          ipc::SharedMemory::SharedMemoryType aType,
                                          ipc::Shmem* aShmem)
 {
-  if (!IPCOpen() || mDestroyed) {
+  if (!mIPCOpen || mDestroyed) {
     return false;
   }
 
   return PLayerTransactionParent::AllocUnsafeShmem(aSize, aType, aShmem);
 }
 
 void
 LayerTransactionParent::DeallocShmem(ipc::Shmem& aShmem)
 {
-  if (!IPCOpen() || mDestroyed) {
+  if (!mIPCOpen || mDestroyed) {
     return;
   }
   PLayerTransactionParent::DeallocShmem(aShmem);
 }
 
 bool LayerTransactionParent::IsSameProcess() const
 {
   return OtherPid() == base::GetCurrentProcId();
--- a/gfx/layers/ipc/LayerTransactionParent.h
+++ b/gfx/layers/ipc/LayerTransactionParent.h
@@ -52,18 +52,16 @@ protected:
 public:
   void Destroy();
 
   void SetLayerManager(HostLayerManager* aLayerManager, CompositorAnimationStorage* aAnimStorage);
 
   LayersId GetId() const { return mId; }
   Layer* GetRoot() const { return mRoot; }
 
-  bool IPCOpen() const override { return mozilla::ipc::IProtocol::IPCOpen(); }
-
   LayersObserverEpoch GetChildEpoch() const { return mChildEpoch; }
   bool ShouldParentObserveEpoch();
 
   ShmemAllocator* AsShmemAllocator() override { return this; }
 
   bool AllocShmem(size_t aSize,
                   ipc::SharedMemory::SharedMemoryType aType,
                   ipc::Shmem* aShmem) override;
@@ -151,19 +149,23 @@ protected:
 
   bool BindLayerToHandle(RefPtr<Layer> aLayer, const LayerHandle& aHandle);
 
   Layer* AsLayer(const LayerHandle& aLayer);
 
   bool Attach(Layer* aLayer, CompositableHost* aCompositable, bool aIsAsyncVideo);
 
   void AddIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == false);
+    mIPCOpen = true;
     AddRef();
   }
   void ReleaseIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == true);
+    mIPCOpen = false;
     Release();
   }
   friend class CompositorBridgeParent;
   friend class CrossProcessCompositorBridgeParent;
 
 private:
   // This is a function so we can log or breakpoint on why hit
   // testing tree changes are made.
@@ -210,16 +212,17 @@ private:
   // because they refer to "zombie layers" on this side.  So, we track
   // that state with |mDestroyed|.  This is similar to, but separate
   // from, |mLayerManager->IsDestroyed()|; we might have had Destroy()
   // called on us but the mLayerManager might not be destroyed, or
   // vice versa.  In both cases though, we want to ignore shadow-layer
   // transactions posted by the child.
 
   bool mDestroyed;
+  bool mIPCOpen;
 
   // This is set during RecvUpdate to track whether we'll need to update
   // APZ's hit test regions.
   bool mUpdateHitTestingTree;
 };
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -24,16 +24,17 @@ using namespace mozilla::gfx;
 
 WebRenderBridgeChild::WebRenderBridgeChild(const wr::PipelineId& aPipelineId)
   : mIsInTransaction(false)
   , mIsInClearCachedResources(false)
   , mIdNamespace{0}
   , mResourceId(0)
   , mPipelineId(aPipelineId)
   , mManager(nullptr)
+  , mIPCOpen(false)
   , mDestroyed(false)
   , mFontKeysDeleted(0)
   , mFontInstanceKeysDeleted(0)
 {
 }
 
 WebRenderBridgeChild::~WebRenderBridgeChild()
 {
--- a/gfx/layers/wr/WebRenderBridgeChild.h
+++ b/gfx/layers/wr/WebRenderBridgeChild.h
@@ -108,19 +108,17 @@ public:
   /// It is used for recycling TextureClient.
   void ReleaseTextureOfImage(const wr::ImageKey& aKey);
 
   /**
    * Clean this up, finishing with SendShutDown() which will cause __delete__
    * to be sent from the parent side.
    */
   void Destroy(bool aIsSync);
-  bool IPCOpen() const {
-    return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed;
-  }
+  bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
   bool IsDestroyed() const { return mDestroyed; }
 
   uint32_t GetNextResourceId() { return ++mResourceId; }
   wr::IdNamespace GetNamespace() { return mIdNamespace; }
   void SetNamespace(wr::IdNamespace aIdNamespace)
   {
     mIdNamespace = aIdNamespace;
   }
@@ -210,34 +208,39 @@ private:
 
   void DoDestroy();
 
   mozilla::ipc::IPCResult RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace,
                                         const TextureFactoryIdentifier& textureFactoryIdentifier) override;
   mozilla::ipc::IPCResult RecvWrReleasedImages(nsTArray<wr::ExternalImageKeyPair>&& aPairs) override;
 
   void AddIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == false);
+    mIPCOpen = true;
     AddRef();
   }
   void ReleaseIPDLReference() {
+    MOZ_ASSERT(mIPCOpen == true);
+    mIPCOpen = false;
     Release();
   }
 
   bool AddOpDestroy(const OpDestroy& aOp);
 
   nsTArray<WebRenderParentCommand> mParentCommands;
   nsTArray<OpDestroy> mDestroyedActors;
   nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables;
   bool mIsInTransaction;
   bool mIsInClearCachedResources;
   wr::IdNamespace mIdNamespace;
   uint32_t mResourceId;
   wr::PipelineId mPipelineId;
   WebRenderLayerManager* mManager;
 
+  bool mIPCOpen;
   bool mDestroyed;
 
   uint32_t mFontKeysDeleted;
   nsDataHashtable<UnscaledFontHashKey, wr::FontKey> mFontKeys;
 
   uint32_t mFontInstanceKeysDeleted;
   nsDataHashtable<ScaledFontHashKey, wr::FontInstanceKey> mFontInstanceKeys;
 
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -256,17 +256,17 @@ gfxDWriteFont::ComputeMetrics(AntialiasO
         }
     }
 
     mMetrics->internalLeading = std::max(mMetrics->maxHeight - mMetrics->emHeight, 0.0);
     mMetrics->externalLeading = ceil(fontMetrics.lineGap * mFUnitsConvFactor);
 
     UINT32 ucs = L' ';
     UINT16 glyph;
-    HRESULT hr = mFontFace->GetGlyphIndices(&ucs, 1, &glyph);
+    HRESULT hr = mFontFace->GetGlyphIndicesW(&ucs, 1, &glyph);
     if (FAILED(hr)) {
         mMetrics->spaceWidth = 0;
     } else {
         mSpaceGlyph = glyph;
         mMetrics->spaceWidth = MeasureGlyphWidth(glyph);
     }
 
     // try to get aveCharWidth from the OS/2 table, fall back to measuring 'x'
@@ -286,27 +286,27 @@ gfxDWriteFont::ComputeMetrics(AntialiasO
                 mMetrics->aveCharWidth =
                     int16_t(os2->xAvgCharWidth) * mFUnitsConvFactor;
             }
         }
     }
 
     if (mMetrics->aveCharWidth < 1) {
         ucs = L'x';
-        if (SUCCEEDED(mFontFace->GetGlyphIndices(&ucs, 1, &glyph))) {
+        if (SUCCEEDED(mFontFace->GetGlyphIndicesW(&ucs, 1, &glyph))) {
             mMetrics->aveCharWidth = MeasureGlyphWidth(glyph);
         }
         if (mMetrics->aveCharWidth < 1) {
             // Let's just assume the X is square.
             mMetrics->aveCharWidth = fontMetrics.xHeight * mFUnitsConvFactor;
         }
     }
 
     ucs = L'0';
-    if (SUCCEEDED(mFontFace->GetGlyphIndices(&ucs, 1, &glyph))) {
+    if (SUCCEEDED(mFontFace->GetGlyphIndicesW(&ucs, 1, &glyph))) {
         mMetrics->zeroOrAveCharWidth = MeasureGlyphWidth(glyph);
     }
     if (mMetrics->zeroOrAveCharWidth < 1) {
         mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
     }
 
     mMetrics->underlineOffset =
         fontMetrics.underlinePosition * mFUnitsConvFactor;
--- a/gfx/vr/ipc/VRLayerChild.cpp
+++ b/gfx/vr/ipc/VRLayerChild.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "mozilla/layers/SyncObject.h" // for SyncObjectClient
 
 namespace mozilla {
 namespace gfx {
 
 VRLayerChild::VRLayerChild()
   : mCanvasElement(nullptr)
+  , mIPCOpen(false)
   , mLastSubmittedFrameId(0)
 {
   MOZ_COUNT_CTOR(VRLayerChild);
 }
 
 VRLayerChild::~VRLayerChild()
 {
   ClearSurfaces();
@@ -106,26 +107,32 @@ VRLayerChild::SubmitFrame(const VRDispla
   }
 
   SendSubmitFrame(desc, frameId, mLeftEyeRect, mRightEyeRect);
 }
 
 bool
 VRLayerChild::IsIPCOpen()
 {
-  return IPCOpen();
+  return mIPCOpen;
 }
 
 void
 VRLayerChild::ClearSurfaces()
 {
   mThisFrameTexture = nullptr;
   mLastFrameTexture = nullptr;
 }
 
+void
+VRLayerChild::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
+
 // static
 PVRLayerChild*
 VRLayerChild::CreateIPDLActor()
 {
   VRLayerChild* c = new VRLayerChild();
   c->AddIPDLReference();
   return c;
 }
@@ -135,17 +142,20 @@ bool
 VRLayerChild::DestroyIPDLActor(PVRLayerChild* actor)
 {
   static_cast<VRLayerChild*>(actor)->ReleaseIPDLReference();
   return true;
 }
 
 void
 VRLayerChild::AddIPDLReference() {
+  MOZ_ASSERT(mIPCOpen == false);
+  mIPCOpen = true;
   AddRef();
 }
 void
 VRLayerChild::ReleaseIPDLReference() {
+  MOZ_ASSERT(mIPCOpen == false);
   Release();
 }
 
 } // namespace gfx
 } // namespace mozilla
--- a/gfx/vr/ipc/VRLayerChild.h
+++ b/gfx/vr/ipc/VRLayerChild.h
@@ -39,18 +39,20 @@ public:
                   const gfx::Rect& aLeftEyeRect, const gfx::Rect& aRightEyeRect);
   void SubmitFrame(const VRDisplayInfo& aDisplayInfo);
   bool IsIPCOpen();
 
 private:
   VRLayerChild();
   virtual ~VRLayerChild();
   void ClearSurfaces();
+  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   RefPtr<dom::HTMLCanvasElement> mCanvasElement;
+  bool mIPCOpen;
 
   // AddIPDLReference and ReleaseIPDLReference are only to be called by CreateIPDLActor
   // and DestroyIPDLActor, respectively. We intentionally make them private to prevent misuse.
   // The purpose of these methods is to be aware of when the IPC system around this
   // actor goes down: mIPCOpen is then set to false.
   void AddIPDLReference();
   void ReleaseIPDLReference();
 
--- a/gfx/vr/ipc/VRLayerParent.cpp
+++ b/gfx/vr/ipc/VRLayerParent.cpp
@@ -10,17 +10,18 @@
 #include "VRDisplayHost.h"
 #include "mozilla/layers/CompositorThread.h"
 
 namespace mozilla {
 using namespace layers;
 namespace gfx {
 
 VRLayerParent::VRLayerParent(uint32_t aVRDisplayID, const uint32_t aGroup)
-  : mVRDisplayID(aVRDisplayID)
+  : mIPCOpen(true)
+  , mVRDisplayID(aVRDisplayID)
   , mGroup(aGroup)
 {
 }
 
 VRLayerParent::~VRLayerParent()
 {
   MOZ_COUNT_DTOR(VRLayerParent);
 }
@@ -28,30 +29,36 @@ VRLayerParent::~VRLayerParent()
 mozilla::ipc::IPCResult
 VRLayerParent::RecvDestroy()
 {
   Destroy();
   return IPC_OK();
 }
 
 void
+VRLayerParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
+
+void
 VRLayerParent::Destroy()
 {
   if (mVRDisplayID) {
     VRManager* vm = VRManager::Get();
     RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(mVRDisplayID);
     if (display) {
       display->RemoveLayer(this);
     }
     // 0 will never be a valid VRDisplayID; we can use it to indicate that
     // we are destroyed and no longer associated with a display.
     mVRDisplayID = 0;
   }
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << PVRLayerParent::Send__delete__(this);
   }
 }
 
 mozilla::ipc::IPCResult
 VRLayerParent::RecvSubmitFrame(const layers::SurfaceDescriptor &aTexture,
                                const uint64_t& aFrameId,
                                const gfx::Rect& aLeftEyeRect,
--- a/gfx/vr/ipc/VRLayerParent.h
+++ b/gfx/vr/ipc/VRLayerParent.h
@@ -24,19 +24,23 @@ public:
   virtual mozilla::ipc::IPCResult RecvSubmitFrame(const layers::SurfaceDescriptor &aTexture,
                                                   const uint64_t& aFrameId,
                                                   const gfx::Rect& aLeftEyeRect,
                                                   const gfx::Rect& aRightEyeRect) override;
   virtual mozilla::ipc::IPCResult RecvDestroy() override;
   uint32_t GetDisplayID() const { return mVRDisplayID; }
   uint32_t GetGroup() const { return mGroup; }
 protected:
+  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
+
   virtual ~VRLayerParent();
   void Destroy();
 
+  bool mIPCOpen;
+
   uint32_t mVRDisplayID;
   gfx::Rect mLeftEyeRect;
   gfx::Rect mRightEyeRect;
   uint32_t mGroup;
 };
 
 } // namespace gfx
 } // namespace mozilla
--- a/gfx/vr/service/openvr/moz.build
+++ b/gfx/vr/service/openvr/moz.build
@@ -3,19 +3,16 @@
 # 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/.
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['VR_API_PUBLIC'] = True
 
-# Windows.h wrappers conflict with internal methods in openvr
-DEFINES['MOZ_DISABLE_WINDOWS_WRAPPER'] = True
-
 if CONFIG['OS_ARCH'] == 'WINNT':
     if CONFIG['HAVE_64BIT_BUILD']:
         DEFINES['WIN64'] = True
     else:
         DEFINES['WIN32'] = True
 
 if CONFIG['OS_ARCH'] == 'Darwin':
     DEFINES['POSIX'] = True
deleted file mode 100644
--- a/ipc/glue/InProcessChild.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/InProcessChild.h"
-#include "mozilla/dom/WindowGlobalChild.h"
-
-using namespace mozilla::dom;
-
-namespace mozilla {
-namespace ipc {
-
-PWindowGlobalChild*
-InProcessChild::AllocPWindowGlobalChild(const WindowGlobalInit& aInit)
-{
-  MOZ_ASSERT_UNREACHABLE("PWindowGlobalChild should not be created manually");
-  return nullptr;
-}
-
-bool
-InProcessChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor)
-{
-  // Free IPC-held reference
-  static_cast<WindowGlobalChild*>(aActor)->Release();
-  return true;
-}
-
-} // namespace ipc
-} // namespace mozilla
deleted file mode 100644
--- a/ipc/glue/InProcessChild.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_ipc_InProcessChild_h
-#define mozilla_ipc_InProcessChild_h
-
-#include "mozilla/ipc/PInProcessChild.h"
-#include "mozilla/StaticPtr.h"
-
-namespace mozilla {
-namespace dom {
-class PWindowGlobalParent;
-class PWindowGlobalChild;
-} // namespace dom
-
-namespace ipc {
-
-class InProcessParent;
-
-/**
- * The `InProcessChild` class represents the child half of a main-thread to
- * main-thread actor.
- *
- * The `PInProcess` actor should be used as an alternate manager to `PContent`
- * for async actors which want to communicate uniformly between Content->Chrome
- * and Chrome->Chrome situations.
- */
-class InProcessChild : public PInProcessChild
-{
-public:
-  friend class InProcessParent;
-
-  NS_INLINE_DECL_REFCOUNTING(InProcessChild)
-
-  // Get the singleton instance of this actor.
-  static InProcessChild* Singleton();
-
-  // Get the parent side of the in-process child actor |aActor|. If |aActor| is
-  // not an in-process actor, or is not connected, this method will return
-  // |nullptr|.
-  static IProtocol* ParentActorFor(IProtocol* aActor);
-
-protected:
-  virtual mozilla::dom::PWindowGlobalChild*
-  AllocPWindowGlobalChild(const WindowGlobalInit& aInit) override;
-
-  virtual bool
-  DeallocPWindowGlobalChild(mozilla::dom::PWindowGlobalChild* aActor) override;
-
-private:
-  // NOTE: PInProcess lifecycle management is declared as staic methods and
-  // state on InProcessParent, and implemented in InProcessImpl.cpp.
-  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
-  virtual void DeallocPInProcessChild() override;
-  ~InProcessChild() = default;
-
-  static StaticRefPtr<InProcessChild> sSingleton;
-};
-
-} // namespace ipc
-} // namespace mozilla
-
-#endif // defined(mozilla_ipc_InProcessChild_h)
deleted file mode 100644
--- a/ipc/glue/InProcessImpl.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/InProcessParent.h"
-#include "mozilla/ipc/InProcessChild.h"
-#include "nsIObserverService.h"
-#include "mozilla/Services.h"
-
-// This file contains the implementation of core InProcess lifecycle management
-// facilities.
-
-namespace mozilla {
-namespace ipc {
-
-StaticRefPtr<InProcessParent> InProcessParent::sSingleton;
-StaticRefPtr<InProcessChild> InProcessChild::sSingleton;
-bool InProcessParent::sShutdown = false;
-
-
-//////////////////////////////////////////
-// InProcess actor lifecycle management //
-//////////////////////////////////////////
-
-/* static */ InProcessChild*
-InProcessChild::Singleton() {
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!sSingleton) {
-    InProcessParent::Startup();
-  }
-  return sSingleton;
-}
-
-/* static */ InProcessParent*
-InProcessParent::Singleton() {
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!sSingleton) {
-    InProcessParent::Startup();
-  }
-  return sSingleton;
-}
-
-/* static */ void
-InProcessParent::Startup()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (sShutdown) {
-    NS_WARNING("Could not get in-process actor while shutting down!");
-    return;
-  }
-
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (!obs) {
-    sShutdown = true;
-    NS_WARNING("Failed to get nsIObserverService for in-process actor");
-    return;
-  }
-
-  RefPtr<InProcessParent> parent = new InProcessParent();
-  RefPtr<InProcessChild> child = new InProcessChild();
-
-  // Observe the shutdown event to close & clean up after ourselves.
-  nsresult rv = obs->AddObserver(parent, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  // Link the two actors
-  if (!child->OpenOnSameThread(parent->GetIPCChannel(), ChildSide)) {
-    MOZ_CRASH("Failed to open InProcessChild!");
-  }
-
-  parent->SetOtherProcessId(base::GetCurrentProcId());
-
-  // Create references held by the IPC layer which will be freed in
-  // DeallocPInProcess{Parent,Child}.
-  parent.get()->AddRef();
-  child.get()->AddRef();
-
-  // Stash global references to fetch the other side of the reference.
-  InProcessParent::sSingleton = parent.forget();
-  InProcessChild::sSingleton = child.forget();
-}
-
-
-/* static */ void
-InProcessParent::Shutdown()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!sSingleton || sShutdown) {
-    return;
-  }
-
-  sShutdown = true;
-
-  RefPtr<InProcessParent> parent = sSingleton;
-  InProcessParent::sSingleton = nullptr;
-  InProcessChild::sSingleton = nullptr;
-
-  // Calling `Close` on the actor will cause the `Dealloc` methods to be called,
-  // freeing the remaining references.
-  parent->Close();
-}
-
-NS_IMETHODIMP
-InProcessParent::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
-{
-  MOZ_ASSERT(!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID));
-  InProcessParent::Shutdown();
-  return NS_OK;
-}
-
-void
-InProcessParent::ActorDestroy(ActorDestroyReason aWhy)
-{
-  InProcessParent::Shutdown();
-}
-
-void
-InProcessChild::ActorDestroy(ActorDestroyReason aWhy)
-{
-  InProcessParent::Shutdown();
-}
-
-void
-InProcessParent::DeallocPInProcessParent()
-{
-  MOZ_ASSERT(!InProcessParent::sSingleton);
-  Release(); // Release the reference taken in InProcessParent::Startup.
-}
-
-void
-InProcessChild::DeallocPInProcessChild()
-{
-  MOZ_ASSERT(!InProcessChild::sSingleton);
-  Release(); // Release the reference taken in InProcessParent::Startup.
-}
-
-////////////////////////////////
-// In-Process Actor Utilities //
-////////////////////////////////
-
-// Helper method for implementing ParentActorFor and ChildActorFor.
-static IProtocol*
-GetOtherInProcessActor(IProtocol* aActor)
-{
-  MOZ_ASSERT(aActor->GetSide() != UnknownSide, "bad unknown side");
-
-  // Discover the manager of aActor which is PInProcess.
-  IProtocol* current = aActor;
-  while (current) {
-    if (current->GetProtocolTypeId() == PInProcessMsgStart) {
-      break; // Found the correct actor.
-    }
-    current = current->Manager();
-  }
-  if (!current) {
-    return nullptr; // Not a PInProcess actor, return |nullptr|
-  }
-
-  MOZ_ASSERT(current->GetSide() == aActor->GetSide(), "side changed?");
-  MOZ_ASSERT_IF(aActor->GetSide() == ParentSide,
-                current == InProcessParent::Singleton());
-  MOZ_ASSERT_IF(aActor->GetSide() == ChildSide,
-                current == InProcessChild::Singleton());
-
-  // Check whether this is InProcessParent or InProcessChild, and get the other
-  // side's toplevel actor.
-  IProtocol* otherRoot = nullptr;
-  if (aActor->GetSide() == ParentSide) {
-    otherRoot = InProcessChild::Singleton();
-  } else {
-    otherRoot = InProcessParent::Singleton();
-  }
-  if (NS_WARN_IF(!otherRoot)) {
-    return nullptr;
-  }
-
-  // Look up the actor on the other side, and return it.
-  IProtocol* otherActor = otherRoot->Lookup(aActor->Id());
-  if (otherActor) {
-    MOZ_ASSERT(otherActor->GetSide() != UnknownSide, "bad unknown side");
-    MOZ_ASSERT(otherActor->GetSide() != aActor->GetSide(), "Wrong side!");
-    MOZ_ASSERT(otherActor->GetProtocolTypeId() == aActor->GetProtocolTypeId(),
-               "Wrong type of protocol!");
-  }
-
-  return otherActor;
-}
-
-/* static */ IProtocol*
-InProcessParent::ChildActorFor(IProtocol* aActor)
-{
-  MOZ_ASSERT(aActor && aActor->GetSide() == ParentSide);
-  return GetOtherInProcessActor(aActor);
-}
-
-/* static */ IProtocol*
-InProcessChild::ParentActorFor(IProtocol* aActor)
-{
-  MOZ_ASSERT(aActor && aActor->GetSide() == ChildSide);
-  return GetOtherInProcessActor(aActor);
-}
-
-} // namespace ipc
-} // namespace mozilla
deleted file mode 100644
--- a/ipc/glue/InProcessParent.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/InProcessParent.h"
-#include "mozilla/dom/WindowGlobalParent.h"
-
-using namespace mozilla::dom;
-
-namespace mozilla {
-namespace ipc {
-
-NS_IMPL_ISUPPORTS(InProcessParent, nsIObserver)
-
-IPCResult
-InProcessParent::RecvPWindowGlobalConstructor(PWindowGlobalParent* aActor,
-                                              const WindowGlobalInit& aInit)
-{
-  static_cast<WindowGlobalParent*>(aActor)->Init(aInit);
-  return IPC_OK();
-}
-
-PWindowGlobalParent*
-InProcessParent::AllocPWindowGlobalParent(const WindowGlobalInit& aInit)
-{
-  // Reference freed in DeallocPWindowGlobalParent.
-  return do_AddRef(new WindowGlobalParent(aInit, /* inproc */ true)).take();
-}
-
-bool
-InProcessParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor)
-{
-  // Free IPC-held reference.
-  static_cast<WindowGlobalParent*>(aActor)->Release();
-  return true;
-}
-
-} // namespace ipc
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/ipc/glue/InProcessParent.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_ipc_InProcessParent_h
-#define mozilla_ipc_InProcessParent_h
-
-#include "mozilla/ipc/PInProcessParent.h"
-#include "mozilla/StaticPtr.h"
-
-namespace mozilla {
-namespace dom {
-class PWindowGlobalParent;
-class PWindowGlobalChild;
-} // namespace dom
-
-namespace ipc {
-
-class InProcessChild;
-
-/**
- * The `InProcessParent` class represents the parent half of a main-thread to
- * main-thread actor.
- *
- * The `PInProcess` actor should be used as an alternate manager to `PContent`
- * for async actors which want to communicate uniformly between Content->Chrome
- * and Chrome->Chrome situations.
- */
-class InProcessParent : public nsIObserver
-                      , public PInProcessParent
-{
-public:
-  friend class InProcessChild;
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-
-  // Get the singleton instance of this actor.
-  static InProcessParent* Singleton();
-
-  // Get the child side of the in-process child actor |aActor|. If |aActor| is
-  // not an in-process actor, or is not connected, this method will return
-  // |nullptr|.
-  static IProtocol* ChildActorFor(IProtocol* aActor);
-
-protected:
-  virtual mozilla::dom::PWindowGlobalParent*
-  AllocPWindowGlobalParent(const WindowGlobalInit& aInit) override;
-
-  virtual bool
-  DeallocPWindowGlobalParent(mozilla::dom::PWindowGlobalParent* aActor) override;
-
-  virtual IPCResult
-  RecvPWindowGlobalConstructor(mozilla::dom::PWindowGlobalParent* aActor,
-                               const WindowGlobalInit& aInit) override;
-
-private:
-  // Lifecycle management is implemented in InProcessImpl.cpp
-  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
-  virtual void DeallocPInProcessParent() override;
-  ~InProcessParent() = default;
-
-  static void Startup();
-  static void Shutdown();
-
-  static StaticRefPtr<InProcessParent> sSingleton;
-  static bool sShutdown;
-};
-
-
-} // namespace ipc
-} // namespace mozilla
-
-#endif // defined(mozilla_ipc_InProcessParent_h)
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -629,18 +629,17 @@ MessageChannel::MessageChannel(const cha
     mSawInterruptOutMsg(false),
     mIsWaitingForIncoming(false),
     mAbortOnError(false),
     mNotifiedChannelDone(false),
     mFlags(REQUIRE_DEFAULT),
     mPeerPidSet(false),
     mPeerPid(-1),
     mIsPostponingSends(false),
-    mBuildIDsConfirmedMatch(false),
-    mIsSameThreadChannel(false)
+    mBuildIDsConfirmedMatch(false)
 {
     MOZ_COUNT_CTOR(ipc::MessageChannel);
 
 #ifdef OS_WIN
     mTopFrame = nullptr;
     mIsSyncWaitingOnNonMainThread = false;
 #endif
 
@@ -963,45 +962,16 @@ MessageChannel::CommonThreadOpenInit(Mes
     mWorkerLoop->AddDestructionObserver(this);
     mListener->SetIsMainThreadProtocol();
 
     mLink = new ThreadLink(this, aTargetChan);
     mSide = aSide;
 }
 
 bool
-MessageChannel::OpenOnSameThread(MessageChannel* aTargetChan,
-                                 mozilla::ipc::Side aSide)
-{
-    CommonThreadOpenInit(aTargetChan, aSide);
-
-    Side oppSide = UnknownSide;
-    switch (aSide) {
-      case ChildSide: oppSide = ParentSide; break;
-      case ParentSide: oppSide = ChildSide; break;
-      case UnknownSide: break;
-    }
-    mIsSameThreadChannel = true;
-
-    // XXX(nika): Avoid setting up a monitor for same thread channels? We
-    // shouldn't need it.
-    mMonitor = new RefCountedMonitor();
-
-    mChannelState = ChannelOpening;
-    aTargetChan->CommonThreadOpenInit(this, oppSide);
-
-    aTargetChan->mIsSameThreadChannel = true;
-    aTargetChan->mMonitor = mMonitor;
-
-    mChannelState = ChannelConnected;
-    aTargetChan->mChannelState = ChannelConnected;
-    return true;
-}
-
-bool
 MessageChannel::Echo(Message* aMsg)
 {
     UniquePtr<Message> msg(aMsg);
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
     if (MSG_ROUTING_NONE == msg->routing_id()) {
         ReportMessageRouteError("MessageChannel::Echo");
         return false;
@@ -1500,18 +1470,16 @@ MessageChannel::Send(Message* aMsg, Mess
         Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE2, aMsg->size());
     }
 
     UniquePtr<Message> msg(aMsg);
 
     // Sanity checks.
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
-    MOZ_RELEASE_ASSERT(!mIsSameThreadChannel,
-                       "sync send over same-thread channel will deadlock!");
 
 #ifdef OS_WIN
     SyncStackFrame frame(this, false);
     NeuteredWindowRegion neuteredRgn(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION);
 #endif
 #ifdef MOZ_TASK_TRACER
     AutoScopedLabel autolabel("sync message %s", aMsg->name());
 #endif
@@ -1707,18 +1675,16 @@ MessageChannel::Send(Message* aMsg, Mess
 }
 
 bool
 MessageChannel::Call(Message* aMsg, Message* aReply)
 {
     UniquePtr<Message> msg(aMsg);
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
-    MOZ_RELEASE_ASSERT(!mIsSameThreadChannel,
-                       "intr call send over same-thread channel will deadlock!");
 
 #ifdef OS_WIN
     SyncStackFrame frame(this, true);
 #endif
 #ifdef MOZ_TASK_TRACER
     AutoScopedLabel autolabel("sync message %s", aMsg->name());
 #endif
 
@@ -2485,19 +2451,16 @@ MessageChannel::WaitForSyncNotify(bool /
     // WARNING: We don't release the lock here. We can't because the link thread
     // could signal at this time and we would miss it. Instead we require
     // ArtificialTimeout() to be extremely simple.
     if (mListener->ArtificialTimeout()) {
         return false;
     }
 #endif
 
-    MOZ_RELEASE_ASSERT(!mIsSameThreadChannel,
-                       "Wait on same-thread channel will deadlock!");
-
     TimeDuration timeout = (kNoTimeout == mTimeoutMs) ?
                            TimeDuration::Forever() :
                            TimeDuration::FromMilliseconds(mTimeoutMs);
     CVStatus status = mMonitor->Wait(timeout);
 
     // If the timeout didn't expire, we know we received an event. The
     // converse is not true.
     return WaitResponse(status == CVStatus::Timeout);
@@ -2800,20 +2763,16 @@ public:
 };
 
 void
 MessageChannel::SynchronouslyClose()
 {
     AssertWorkerThread();
     mMonitor->AssertCurrentThreadOwns();
     mLink->SendClose();
-
-    MOZ_RELEASE_ASSERT(!mIsSameThreadChannel || ChannelClosed == mChannelState,
-                       "same-thread channel failed to synchronously close?");
-
     while (ChannelClosed != mChannelState)
         mMonitor->Wait();
 }
 
 void
 MessageChannel::CloseWithError()
 {
     AssertWorkerThread();
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -175,25 +175,16 @@ private:
     // Returns true if the transport layer was successfully connected,
     // i.e., mChannelState == ChannelConnected.
     //
     // For more details on the process of opening a channel between
     // threads, see the extended comment on this function
     // in MessageChannel.cpp.
     bool Open(MessageChannel *aTargetChan, nsIEventTarget *aEventTarget, Side aSide);
 
-    // "Open" a connection to an actor on the current thread.
-    //
-    // Returns true if the transport layer was successfully connected,
-    // i.e., mChannelState == ChannelConnected.
-    //
-    // Same-thread channels may not perform synchronous or blocking message
-    // sends, to avoid deadlocks.
-    bool OpenOnSameThread(MessageChannel* aTargetChan, Side aSide);
-
     // Close the underlying transport channel.
     void Close();
 
     // Force the channel to behave as if a channel error occurred. Valid
     // for process links only, not thread links.
     void CloseWithError();
 
     void CloseWithTimeout();
@@ -568,30 +559,21 @@ private:
     // Can be run on either thread
     void AssertWorkerThread() const
     {
         MOZ_ASSERT(mWorkerThread, "Channel hasn't been opened yet");
         MOZ_RELEASE_ASSERT(mWorkerThread == GetCurrentVirtualThread(),
                            "not on worker thread!");
     }
 
-    // The "link" thread is either the I/O thread (ProcessLink), the other
-    // actor's work thread (ThreadLink), or the worker thread (same-thread
-    // channels).
+    // The "link" thread is either the I/O thread (ProcessLink) or the
+    // other actor's work thread (ThreadLink).  In either case, it is
+    // NOT our worker thread.
     void AssertLinkThread() const
     {
-        if (mIsSameThreadChannel) {
-            // If we're a same-thread channel, we have to be on our worker
-            // thread.
-            AssertWorkerThread();
-            return;
-        }
-
-        // If we aren't a same-thread channel, our "link" thread is _not_ our
-        // worker thread!
         MOZ_ASSERT(mWorkerThread, "Channel hasn't been opened yet");
         MOZ_RELEASE_ASSERT(mWorkerThread != GetCurrentVirtualThread(),
                            "on worker thread but should not be!");
     }
 
   private:
     class MessageTask :
         public CancelableRunnable,
@@ -874,20 +856,16 @@ private:
     int32_t mPeerPid;
 
     // Channels can enter messages are not sent immediately; instead, they are
     // held in a queue until another thread deems it is safe to send them.
     bool mIsPostponingSends;
     std::vector<UniquePtr<Message>> mPostponedSends;
 
     bool mBuildIDsConfirmedMatch;
-
-    // If this is true, both ends of this message channel have event targets
-    // on the same thread.
-    bool mIsSameThreadChannel;
 };
 
 void
 CancelCPOWs();
 
 } // namespace ipc
 } // namespace mozilla
 
deleted file mode 100644
--- a/ipc/glue/PInProcess.ipdl
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PWindowGlobal;
-
-include DOMTypes;
-
-namespace mozilla {
-namespace ipc {
-
-/**
- * PInProcess is intended for use as an alternative actor manager to PContent
- * for async actors which want to be used uniformly in both Content->Chrome and
- * Chrome->Chrome circumstances.
- *
- * `mozilla::ipc::InProcess{Parent, Child}::Singleton()` should be used to get
- * an instance of this actor.
- */
-async protocol PInProcess
-{
-  manages PWindowGlobal;
-
-parent:
-  /**
-   * Construct a new WindowGlobal actor for a window global in the given
-   * BrowsingContext and with the given principal.
-   */
-  async PWindowGlobal(WindowGlobalInit init);
-};
-
-} // namespace ipc
-} // namespace mozilla
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -591,34 +591,28 @@ IProtocol::SetManagerAndRegister(IProtoc
 {
   // Set the manager prior to registering so registering properly inherits
   // the manager's event target.
   SetManager(aManager);
 
   aManager->Register(this);
 
   mState->SetIPCChannel(aManager->GetIPCChannel());
-
-  // Note that our actor has been opened.
-  ActorOpenedInternal();
 }
 
 void
 IProtocol::SetManagerAndRegister(IProtocol* aManager, int32_t aId)
 {
   // Set the manager prior to registering so registering properly inherits
   // the manager's event target.
   SetManager(aManager);
 
   aManager->RegisterID(this, aId);
 
   mState->SetIPCChannel(aManager->GetIPCChannel());
-
-  // Note that our actor has been opened.
-  ActorOpenedInternal();
 }
 
 void
 IProtocol::SetEventTargetForActor(IProtocol* aActor, nsIEventTarget* aEventTarget)
 {
   // Make sure we have a manager for the internal method to access.
   aActor->SetManager(this);
   mState->SetEventTargetForActor(aActor, aEventTarget);
@@ -752,57 +746,45 @@ IToplevelProtocol::TakeMinidump(nsIFile*
 
 bool
 IToplevelProtocol::Open(mozilla::ipc::Transport* aTransport,
                         base::ProcessId aOtherPid,
                         MessageLoop* aThread,
                         mozilla::ipc::Side aSide)
 {
   SetOtherProcessId(aOtherPid);
-  ActorOpenedInternal();
   return GetIPCChannel()->Open(aTransport, aThread, aSide);
 }
 
 bool
 IToplevelProtocol::Open(MessageChannel* aChannel,
                         MessageLoop* aMessageLoop,
                         mozilla::ipc::Side aSide)
 {
   SetOtherProcessId(base::GetCurrentProcId());
-  ActorOpenedInternal();
   return GetIPCChannel()->Open(aChannel, aMessageLoop->SerialEventTarget(), aSide);
 }
 
 bool
 IToplevelProtocol::Open(MessageChannel* aChannel,
                         nsIEventTarget* aEventTarget,
                         mozilla::ipc::Side aSide)
 {
   SetOtherProcessId(base::GetCurrentProcId());
-  ActorOpenedInternal();
   return GetIPCChannel()->Open(aChannel, aEventTarget, aSide);
 }
 
 bool
 IToplevelProtocol::OpenWithAsyncPid(mozilla::ipc::Transport* aTransport,
                                     MessageLoop* aThread,
                                     mozilla::ipc::Side aSide)
 {
-  ActorOpenedInternal();
   return GetIPCChannel()->Open(aTransport, aThread, aSide);
 }
 
-bool
-IToplevelProtocol::OpenOnSameThread(MessageChannel* aChannel, Side aSide)
-{
-  SetOtherProcessId(base::GetCurrentProcId());
-  ActorOpenedInternal();
-  return GetIPCChannel()->OpenOnSameThread(aChannel, aSide);
-}
-
 void
 IToplevelProtocol::Close()
 {
   GetIPCChannel()->Close();
 }
 
 void
 IToplevelProtocol::SetReplyTimeoutMs(int32_t aTimeoutMs)
@@ -822,19 +804,16 @@ IToplevelProtocol::ToplevelState::Regist
   if (aRouted->Id() != kNullActorId && aRouted->Id() != kFreedActorId) {
     // If there's already an ID, just return that.
     return aRouted->Id();
   }
   int32_t id = mProtocol->GetSide() == ParentSide ? ++mLastRouteId : --mLastRouteId;
   mActorMap.AddWithID(aRouted, id);
   aRouted->SetId(id);
 
-  // Inform our actor that it has been opened.
-  aRouted->ActorOpenedInternal();
-
   // Inherit our event target from our manager.
   if (IProtocol* manager = aRouted->Manager()) {
     MutexAutoLock lock(mEventTargetMutex);
     if (nsCOMPtr<nsIEventTarget> target = mEventTargetMap.Lookup(manager->Id())) {
       mEventTargetMap.AddWithID(target, id);
     }
   }
 
@@ -842,20 +821,16 @@ IToplevelProtocol::ToplevelState::Regist
 }
 
 int32_t
 IToplevelProtocol::ToplevelState::RegisterID(IProtocol* aRouted,
                                      int32_t aId)
 {
   mActorMap.AddWithID(aRouted, aId);
   aRouted->SetId(aId);
-
-  // Inform our actor that it has been opened.
-  aRouted->ActorOpenedInternal();
-
   return aId;
 }
 
 IProtocol*
 IToplevelProtocol::ToplevelState::Lookup(int32_t aId)
 {
   return mActorMap.Lookup(aId);
 }
@@ -1060,17 +1035,16 @@ IToplevelProtocol::ToplevelState::SetEve
   // We should only call this function on actors that haven't been used for IPC
   // code yet. Otherwise we'll be posting stuff to the wrong event target before
   // we're called.
   MOZ_RELEASE_ASSERT(aActor->Id() == kNullActorId || aActor->Id() == kFreedActorId);
 
   // Register the actor early. When it's registered again, it will keep the same
   // ID.
   int32_t id = Register(aActor);
-  // XXX(nika): Register already calls SetId?
   aActor->SetId(id);
 
   MutexAutoLock lock(mEventTargetMutex);
   // FIXME bug 1445121 - sometimes the id is already mapped.
   // (IDMap debug-asserts that the existing state is as expected.)
   bool replace = false;
 #ifdef DEBUG
   replace = mEventTargetMap.Lookup(id) != nullptr;
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -317,25 +317,16 @@ public:
                                 const char* aActorDescription, int32_t aProtocolTypeId);
 
     virtual Result OnMessageReceived(const Message& aMessage) = 0;
     virtual Result OnMessageReceived(const Message& aMessage, Message *& aReply) = 0;
     virtual Result OnCallReceived(const Message& aMessage, Message *& aReply) = 0;
 
     virtual int32_t GetProtocolTypeId() = 0;
 
-    // Returns |true| if the IPC channel is currently open, and |false|
-    // otherwise.
-    bool IPCOpen() const { return mIPCOpen; }
-
-    // This virtual method is called on actors as they are being destroyed from
-    // IPC's point of view. After ActorDestroy is called, IPC will free its
-    // reference to the actor.
-    virtual void ActorDestroy(ActorDestroyReason aWhy) {}
-
     int32_t Id() const { return mId; }
     IProtocol* Manager() const { return mManager; }
 
     bool AllocShmem(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aOutMem);
     bool AllocUnsafeShmem(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aOutMem);
     bool DeallocShmem(Shmem& aMem);
 
     // Sets an event target to which all messages for aActor will be
@@ -354,17 +345,16 @@ public:
 
     nsIEventTarget* GetActorEventTarget();
     already_AddRefed<nsIEventTarget> GetActorEventTarget(IProtocol* aActor);
 
 protected:
     IProtocol(Side aSide, UniquePtr<ProtocolState> aState)
         : mId(0)
         , mSide(aSide)
-        , mIPCOpen(false)
         , mManager(nullptr)
         , mState(std::move(aState))
     {}
 
     friend class IToplevelProtocol;
 
     void SetId(int32_t aId) { mId = aId; }
     void ResetManager() { mManager = nullptr; }
@@ -373,38 +363,22 @@ protected:
     void SetManager(IProtocol* aManager);
 
     // Sets the manager for the protocol and registers the protocol with
     // its manager, setting up channels for the protocol as well.  Not
     // for use outside of IPDL.
     void SetManagerAndRegister(IProtocol* aManager);
     void SetManagerAndRegister(IProtocol* aManager, int32_t aId);
 
-    // This method marks the channel as closed. Actors have this called when
-    // |DestroySubtree| is called due to the underlying channel being closed, or
-    // the actor's __delete__ method being called.
-    void ActorDestroyInternal(ActorDestroyReason aWhy) {
-        mIPCOpen = false;
-        ActorDestroy(aWhy);
-    }
-
-    // This method marks the channel as opened. Managed actors have this set
-    // when they are registered with their manager, and toplevel actors set this
-    // when opening the underlying MessageChannel.
-    void ActorOpenedInternal() {
-        mIPCOpen = true;
-    }
-
     static const int32_t kNullActorId = 0;
     static const int32_t kFreedActorId = 1;
 
 private:
     int32_t mId;
     Side mSide;
-    bool mIPCOpen;
     IProtocol* mManager;
     UniquePtr<ProtocolState> mState;
 };
 
 typedef IPCMessageStart ProtocolId;
 
 #define IPC_OK() mozilla::ipc::IPCResult::Ok()
 #define IPC_FAIL(actor, why) mozilla::ipc::IPCResult::Fail(WrapNotNull(actor), __func__, (why))
@@ -535,25 +509,16 @@ public:
     bool Open(MessageChannel* aChannel,
               nsIEventTarget* aEventTarget,
               mozilla::ipc::Side aSide = mozilla::ipc::UnknownSide);
 
     bool OpenWithAsyncPid(mozilla::ipc::Transport* aTransport,
                           MessageLoop* aThread = nullptr,
                           mozilla::ipc::Side aSide = mozilla::ipc::UnknownSide);
 
-    // Open a toplevel actor such that both ends of the actor's channel are on
-    // the same thread. This method should be called on the thread to perform
-    // the link.
-    //
-    // WARNING: Attempting to send a sync or intr message on the same thread
-    // will crash.
-    bool OpenOnSameThread(MessageChannel* aChannel,
-                          mozilla::ipc::Side aSide = mozilla::ipc::UnknownSide);
-
     void Close();
 
     void SetReplyTimeoutMs(int32_t aTimeoutMs);
 
     void DeallocShmems() { DowncastState()->DeallocShmems(); }
 
     bool ShmemCreated(const Message& aMsg) { return DowncastState()->ShmemCreated(aMsg); }
     bool ShmemDestroyed(const Message& aMsg) { return DowncastState()->ShmemDestroyed(aMsg); }
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -22,18 +22,16 @@ EXPORTS.mozilla.ipc += [
     'CrossProcessMutex.h',
     'CrossProcessSemaphore.h',
     'EnvironmentMap.h',
     'FileDescriptor.h',
     'FileDescriptorSetChild.h',
     'FileDescriptorSetParent.h',
     'FileDescriptorUtils.h',
     'GeckoChildProcessHost.h',
-    'InProcessChild.h',
-    'InProcessParent.h',
     'InputStreamUtils.h',
     'IOThreadChild.h',
     'IPCStreamAlloc.h',
     'IPCStreamDestination.h',
     'IPCStreamSource.h',
     'IPCStreamUtils.h',
     'IPDLParamTraits.h',
     'MessageChannel.h',
@@ -144,19 +142,16 @@ UNIFIED_SOURCES += [
     'BackgroundImpl.cpp',
     'BackgroundUtils.cpp',
     'BrowserProcessSubThread.cpp',
     'CrashReporterClient.cpp',
     'CrashReporterHost.cpp',
     'CrashReporterMetadataShmem.cpp',
     'FileDescriptor.cpp',
     'FileDescriptorUtils.cpp',
-    'InProcessChild.cpp',
-    'InProcessImpl.cpp',
-    'InProcessParent.cpp',
     'InputStreamUtils.cpp',
     'IPCMessageUtils.cpp',
     'IPCStreamChild.cpp',
     'IPCStreamDestination.cpp',
     'IPCStreamParent.cpp',
     'IPCStreamSource.cpp',
     'IPCStreamUtils.cpp',
     'MessageChannel.cpp',
@@ -208,17 +203,16 @@ LOCAL_INCLUDES += [
 IPDL_SOURCES = [
     'InputStreamParams.ipdlh',
     'IPCStream.ipdlh',
     'PBackground.ipdl',
     'PBackgroundSharedTypes.ipdlh',
     'PBackgroundTest.ipdl',
     'PChildToParentStream.ipdl',
     'PFileDescriptorSet.ipdl',
-    'PInProcess.ipdl',
     'PParentToChildStream.ipdl',
     'ProtocolTypes.ipdlh',
     'URIParams.ipdlh',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/ipc',
     '/toolkit/crashreporter',
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -482,18 +482,18 @@ def errfnRecv(msg, errcode=_Result.ValuE
 
 
 def errfnSentinel(rvalue=ExprLiteral.FALSE):
     def inner(msg):
         return [_sentinelReadError(msg), StmtReturn(rvalue)]
     return inner
 
 
-def _destroyInternalMethod():
-    return ExprVar('ActorDestroyInternal')
+def _destroyMethod():
+    return ExprVar('ActorDestroy')
 
 
 def errfnUnreachable(msg):
     return [
         _logicError(msg)
     ]
 
 
@@ -3264,16 +3264,31 @@ class _GenerateProtocolActorCode(ipdl.as
                 params=md.makeCxxParams(side=self.side, implicit=0),
                 ret=actortype, methodspec=MethodSpec.PURE)))
 
             self.cls.addstmt(StmtDecl(MethodDecl(
                 _deallocMethod(managed, self.side).name,
                 params=[Decl(actortype, 'aActor')],
                 ret=Type.BOOL, methodspec=MethodSpec.PURE)))
 
+        # ActorDestroy() method; default is no-op
+        if self.side == 'parent':
+            methodspec = MethodSpec.PURE
+        else:
+            methodspec = MethodSpec.VIRTUAL
+
+        self.cls.addstmts([
+            Whitespace.NL,
+            MethodDefn(MethodDecl(
+                _destroyMethod().name,
+                params=[Decl(_DestroyReason.Type(), 'aWhy')],
+                ret=Type.VOID, methodspec=methodspec)),
+            Whitespace.NL
+        ])
+
         if ptype.isToplevel():
             # void ProcessingError(code); default to no-op
             processingerror = MethodDefn(
                 MethodDecl(p.processingErrorVar().name,
                            params=[Param(_Result.Type(), 'aCode'),
                                    Param(Type('char', const=1, ptr=1), 'aReason')],
                            methodspec=MethodSpec.OVERRIDE))
 
@@ -3644,17 +3659,17 @@ class _GenerateProtocolActorCode(ipdl.as
                                             indent=1),
                                  StmtExpr(ExprCall(rejectPendingResponsesMethod,
                                                    args=[ExprVar('this')])),
                                  Whitespace.NL
                                  ])
 
         destroysubtree.addstmts([Whitespace('// Finally, destroy "us".\n',
                                             indent=1),
-                                 StmtExpr(ExprCall(_destroyInternalMethod(),
+                                 StmtExpr(ExprCall(_destroyMethod(),
                                                    args=[whyvar]))
                                  ])
 
         self.cls.addstmts([destroysubtree, Whitespace.NL])
 
         # DeallocSubtree()
         deallocsubtree = MethodDefn(MethodDecl(deallocsubtreevar.name))
         for managed in ptype.manages:
@@ -3890,45 +3905,23 @@ class _GenerateProtocolActorCode(ipdl.as
 
     def genAsyncCtor(self, md):
         actor = md.actorDecl()
         method = MethodDefn(self.makeSendMethodDecl(md))
         method.addstmts(self.ctorPrologue(md) + [Whitespace.NL])
 
         msgvar, stmts = self.makeMessage(md, errfnSendCtor)
         sendok, sendstmts = self.sendAsync(md, msgvar)
-
-        warnif = StmtIf(ExprNot(sendok))
-        warnif.addifstmt(_printWarningMessage('Error sending constructor'))
-
         method.addstmts(
-            # Build our constructor message & verify it.
             stmts
             + self.genVerifyMessage(md.decl.type.verify, md.params,
                                     errfnSendCtor, ExprVar('msg__'))
-
-            # Assert that we haven't been shut down yet.
-            + [_abortIfFalse(ExprCall(ExprVar('IPCOpen')),
-                             "Cannot send constructor after ActorDestroy")]
-
-            # Notify the other side about the newly created actor.
-            #
-            # If the MessageChannel is closing, and we haven't been told yet,
-            # this send may fail. This error is ignored to treat it like a
-            # message being lost due to the other side shutting down before
-            # processing it.
-            #
-            # NOTE: We don't free the actor here, as our caller may be
-            # depending on it being alive after calling SendConstructor.
             + sendstmts
-
-            # Warn if the message failed to send, and return our newly created
-            # actor.
-            + [warnif,
-               StmtReturn(actor.var())])
+            + self.failCtorIf(md, ExprNot(sendok))
+            + [StmtReturn(actor.var())])
 
         lbl = CaseLabel(md.pqReplyId())
         case = StmtBlock()
         case.addstmt(StmtReturn(_Result.Processed))
         # TODO not really sure what to do with async ctor "replies" yet.
         # destroy actor if there was an error?  tricky ...
 
         return method, (lbl, case)
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -63,16 +63,17 @@ NS_IMPL_ISUPPORTS(CookieServiceChild,
                   nsITimerCallback,
                   nsISupportsWeakReference)
 
 CookieServiceChild::CookieServiceChild()
   : mCookieBehavior(nsICookieService::BEHAVIOR_ACCEPT)
   , mThirdPartySession(false)
   , mThirdPartyNonsecureSession(false)
   , mLeaveSecureAlone(true)
+  , mIPCOpen(false)
 {
   NS_ASSERTION(IsNeckoChild(), "not a child process");
 
   mozilla::dom::ContentChild* cc =
     static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
   if (cc->IsShuttingDown()) {
     return;
   }
@@ -80,16 +81,18 @@ CookieServiceChild::CookieServiceChild()
   // This corresponds to Release() in DeallocPCookieService.
   NS_ADDREF_THIS();
 
   NeckoChild::InitNeckoChild();
 
   // Create a child PCookieService actor.
   gNeckoChild->SendPCookieServiceConstructor(this);
 
+  mIPCOpen = true;
+
   mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
   NS_ASSERTION(mTLDService, "couldn't get TLDService");
 
   // Init our prefs and observer.
   nsCOMPtr<nsIPrefBranch> prefBranch =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   NS_WARNING_ASSERTION(prefBranch, "no prefservice");
   if (prefBranch) {
@@ -149,19 +152,25 @@ CookieServiceChild::Notify(nsITimer *aTi
 }
 
 CookieServiceChild::~CookieServiceChild()
 {
   gCookieService = nullptr;
 }
 
 void
+CookieServiceChild::ActorDestroy(ActorDestroyReason why)
+{
+  mIPCOpen = false;
+}
+
+void
 CookieServiceChild::TrackCookieLoad(nsIChannel *aChannel)
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return;
   }
 
   bool isForeign = false;
   bool isTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   nsCOMPtr<nsIURI> uri;
   aChannel->GetURI(getter_AddRefs(uri));
@@ -638,17 +647,17 @@ CookieServiceChild::SetCookieStringInter
     if (loadInfo) {
       attrs = loadInfo->GetOriginAttributes();
     }
   } else {
     SerializeURI(nullptr, channelURIParams);
   }
 
   // Asynchronously call the parent.
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     SendSetCookieString(hostURIParams, channelURIParams,
                         isForeign, isTrackingResource,
                         firstPartyStorageAccessGranted, cookieString,
                         stringServerTime, attrs, aFromHttp);
   }
 
   bool requireHostMatch;
   nsCString baseDomain;
--- a/netwerk/cookie/CookieServiceChild.h
+++ b/netwerk/cookie/CookieServiceChild.h
@@ -111,23 +111,26 @@ protected:
   virtual
   mozilla::ipc::IPCResult RecvRemoveCookie(const CookieStruct &aCookie,
                                            const OriginAttributes &aAttrs) override;
 
   virtual
   mozilla::ipc::IPCResult RecvAddCookie(const CookieStruct &aCookie,
                                         const OriginAttributes &aAttrs) override;
 
+  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
+
   CookiesMap mCookiesMap;
   nsCOMPtr<nsITimer> mCookieTimer;
   nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
   nsCOMPtr<nsIEffectiveTLDService> mTLDService;
   uint8_t mCookieBehavior;
   bool mThirdPartySession;
   bool mThirdPartyNonsecureSession;
   bool mLeaveSecureAlone;
+  bool mIPCOpen;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_CookieServiceChild_h__
 
--- a/netwerk/dns/DNSRequestChild.cpp
+++ b/netwerk/dns/DNSRequestChild.cpp
@@ -210,17 +210,17 @@ public:
   CancelDNSRequestEvent(DNSRequestChild* aDnsReq, nsresult aReason)
     : Runnable("net::CancelDNSRequestEvent")
     , mDnsRequest(aDnsReq)
     , mReasonForCancel(aReason)
   {}
 
   NS_IMETHOD Run() override
   {
-    if (mDnsRequest->IPCOpen()) {
+    if (mDnsRequest->mIPCOpen) {
       // Send request to Parent process.
       mDnsRequest->SendCancelDNSRequest(mDnsRequest->mHost,
                                         mDnsRequest->mType,
                                         mDnsRequest->mOriginAttributes,
                                         mDnsRequest->mFlags,
                                         mReasonForCancel);
     }
     return NS_OK;
@@ -242,16 +242,17 @@ DNSRequestChild::DNSRequestChild(const n
                                  nsIEventTarget *target)
   : mListener(aListener)
   , mTarget(target)
   , mResultStatus(NS_OK)
   , mHost(aHost)
   , mType(aType)
   , mOriginAttributes(aOriginAttributes)
   , mFlags(aFlags)
+  , mIPCOpen(false)
 {
 }
 
 void
 DNSRequestChild::StartRequest()
 {
   // we can only do IPDL on the main thread
   if (!NS_IsMainThread()) {
@@ -272,16 +273,17 @@ DNSRequestChild::StartRequest()
     static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
   if (cc->IsShuttingDown()) {
     return;
   }
 
   // Send request to Parent process.
   gNeckoChild->SendPDNSRequestConstructor(this, mHost, mOriginAttributes,
                                           mFlags);
+  mIPCOpen = true;
 
   // IPDL holds a reference until IPDL channel gets destroyed
   AddIPDLReference();
 }
 
 void
 DNSRequestChild::CallOnLookupComplete()
 {
@@ -295,16 +297,17 @@ DNSRequestChild::CallOnLookupByTypeCompl
   MOZ_ASSERT(mListener);
   MOZ_ASSERT(mType != nsIDNSService::RESOLVE_TYPE_DEFAULT);
   mListener->OnLookupByTypeComplete(this, mResultByTypeRecords, mResultStatus);
 }
 
 mozilla::ipc::IPCResult
 DNSRequestChild::RecvLookupCompleted(const DNSRequestResponse& reply)
 {
+  mIPCOpen = false;
   MOZ_ASSERT(mListener);
 
   switch (reply.type()) {
   case DNSRequestResponse::TDNSRecord: {
     mResultRecord = new ChildDNSRecord(reply.get_DNSRecord(), mFlags);
     break;
   }
   case DNSRequestResponse::Tnsresult: {
@@ -363,31 +366,37 @@ DNSRequestChild::ReleaseIPDLReference()
   // Request is done or destroyed. Remove it from the hash table.
   RefPtr<ChildDNSService> dnsServiceChild =
     dont_AddRef(ChildDNSService::GetSingleton());
   dnsServiceChild->NotifyRequestDone(this);
 
   Release();
 }
 
+void
+DNSRequestChild::ActorDestroy(ActorDestroyReason why)
+{
+  mIPCOpen = false;
+}
+
 //-----------------------------------------------------------------------------
 // DNSRequestChild::nsISupports
 //-----------------------------------------------------------------------------
 
 NS_IMPL_ISUPPORTS(DNSRequestChild,
                   nsICancelable)
 
 //-----------------------------------------------------------------------------
 // DNSRequestChild::nsICancelable
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 DNSRequestChild::Cancel(nsresult reason)
 {
-  if(IPCOpen()) {
+  if(mIPCOpen) {
     // We can only do IPDL on the main thread
     nsCOMPtr<nsIRunnable> runnable = new CancelDNSRequestEvent(this, reason);
     SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
   }
   return NS_OK;
 }
 
 //------------------------------------------------------------------------------
--- a/netwerk/dns/DNSRequestChild.h
+++ b/netwerk/dns/DNSRequestChild.h
@@ -42,29 +42,31 @@ public:
   void CallOnLookupByTypeComplete();
 
 protected:
   friend class CancelDNSRequestEvent;
   friend class ChildDNSService;
   virtual ~DNSRequestChild() {}
 
   virtual mozilla::ipc::IPCResult RecvLookupCompleted(const DNSRequestResponse& reply) override;
+  virtual void ActorDestroy(ActorDestroyReason why) override;
 
   nsCOMPtr<nsIDNSListener>     mListener;
   nsCOMPtr<nsIEventTarget>     mTarget;
   nsCOMPtr<nsIDNSRecord>       mResultRecord;
   nsCOMPtr<nsIDNSByTypeRecord> mResultByTypeRecords; // the result of a by-type
                                                      // query (mType must not be
                                                      // equal to
                                                      // nsIDNSService::RESOLVE_TYPE_DEFAULT
                                                      // (this is reserved for
                                                      // the standard A/AAAA query)).
   nsresult                     mResultStatus;
   nsCString                    mHost;
   uint16_t                     mType;
   const OriginAttributes       mOriginAttributes;
   uint16_t                     mFlags;
+  bool                         mIPCOpen;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_DNSRequestChild_h
--- a/netwerk/protocol/data/DataChannelChild.cpp
+++ b/netwerk/protocol/data/DataChannelChild.cpp
@@ -12,16 +12,17 @@
 
 namespace mozilla {
 namespace net {
 
 NS_IMPL_ISUPPORTS_INHERITED(DataChannelChild, nsDataChannel, nsIChildChannel)
 
 DataChannelChild::DataChannelChild(nsIURI* aURI)
     : nsDataChannel(aURI)
+    , mIPCOpen(false)
 {
 }
 
 NS_IMETHODIMP
 DataChannelChild::ConnectParent(uint32_t aId)
 {
     mozilla::dom::ContentChild* cc =
         static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
@@ -49,28 +50,31 @@ DataChannelChild::CompleteRedirectSetup(
     }
     else {
         rv = AsyncOpen(aListener, aContext);
     }
     if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
     }
 
-    if (IPCOpen()) {
+    if (mIPCOpen) {
         Unused << Send__delete__(this);
     }
     return NS_OK;
 }
 
 void
 DataChannelChild::AddIPDLReference()
 {
     AddRef();
+    mIPCOpen = true;
 }
 
 void
 DataChannelChild::ActorDestroy(ActorDestroyReason why)
 {
+    MOZ_ASSERT(mIPCOpen);
+    mIPCOpen = false;
     Release();
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/data/DataChannelChild.h
+++ b/netwerk/protocol/data/DataChannelChild.h
@@ -28,14 +28,16 @@ public:
 
 protected:
     virtual void ActorDestroy(ActorDestroyReason why) override;
 
 private:
     ~DataChannelChild() = default;
 
     void AddIPDLReference();
+
+    bool mIPCOpen;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif /* NS_DATACHANNELCHILD_H */
--- a/netwerk/protocol/file/FileChannelChild.cpp
+++ b/netwerk/protocol/file/FileChannelChild.cpp
@@ -12,16 +12,17 @@
 
 namespace mozilla {
 namespace net {
 
 NS_IMPL_ISUPPORTS_INHERITED(FileChannelChild, nsFileChannel, nsIChildChannel)
 
 FileChannelChild::FileChannelChild(nsIURI *uri)
   : nsFileChannel(uri)
+  , mIPCOpen(false)
 {
 }
 
 NS_IMETHODIMP
 FileChannelChild::ConnectParent(uint32_t id)
 {
   mozilla::dom::ContentChild* cc =
     static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
@@ -49,29 +50,32 @@ FileChannelChild::CompleteRedirectSetup(
   } else {
     rv = AsyncOpen(listener, ctx);
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << Send__delete__(this);
   }
 
   return NS_OK;
 }
 
 void
 FileChannelChild::AddIPDLReference()
 {
   AddRef();
+  mIPCOpen = true;
 }
 
 void
 FileChannelChild::ActorDestroy(ActorDestroyReason why)
 {
+  MOZ_ASSERT(mIPCOpen);
+  mIPCOpen = false;
   Release();
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/file/FileChannelChild.h
+++ b/netwerk/protocol/file/FileChannelChild.h
@@ -28,14 +28,16 @@ public:
 
 protected:
   virtual void ActorDestroy(ActorDestroyReason why) override;
 
 private:
   ~FileChannelChild() = default;;
 
   void AddIPDLReference();
+
+  bool mIPCOpen;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif /* mozilla__net__FileChannelChild_h */
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp
+++ b/netwerk/protocol/ftp/FTPChannelChild.cpp
@@ -29,17 +29,18 @@ using namespace mozilla::ipc;
 
 #undef LOG
 #define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args)
 
 namespace mozilla {
 namespace net {
 
 FTPChannelChild::FTPChannelChild(nsIURI* uri)
-: mUnknownDecoderInvolved(false)
+: mIPCOpen(false)
+, mUnknownDecoderInvolved(false)
 , mCanceled(false)
 , mSuspendCount(0)
 , mIsPending(false)
 , mLastModifiedTime(0)
 , mStartPos(0)
 , mDivertingToParent(false)
 , mFlushedForDiversion(false)
 , mSuspendSent(false)
@@ -59,22 +60,26 @@ FTPChannelChild::~FTPChannelChild()
 {
   LOG(("Destroying FTPChannelChild @%p\n", this));
   gFtpHandler->Release();
 }
 
 void
 FTPChannelChild::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference");
+  mIPCOpen = true;
   AddRef();
 }
 
 void
 FTPChannelChild::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference");
+  mIPCOpen = false;
   Release();
 }
 
 //-----------------------------------------------------------------------------
 // FTPChannelChild::nsISupports
 //-----------------------------------------------------------------------------
 
 NS_IMPL_ISUPPORTS_INHERITED(FTPChannelChild,
@@ -677,19 +682,18 @@ FTPChannelChild::DoFailedAsyncOpen(const
     mListener->OnStopRequest(this, mListenerContext, statusCode);
   } else {
     mIsPending = false;
   }
 
   mListener = nullptr;
   mListenerContext = nullptr;
 
-  if (IPCOpen()) {
+  if (mIPCOpen)
     Send__delete__(this);
-  }
 }
 
 class FTPFlushedForDiversionEvent : public NeckoTargetChannelEvent<FTPChannelChild>
 {
  public:
   explicit FTPFlushedForDiversionEvent(FTPChannelChild* aChild)
   : NeckoTargetChannelEvent<FTPChannelChild>(aChild)
   {
@@ -754,40 +758,38 @@ FTPChannelChild::RecvDeleteSelf()
 {
   mEventQ->RunOrEnqueue(new FTPDeleteSelfEvent(this));
   return IPC_OK();
 }
 
 void
 FTPChannelChild::DoDeleteSelf()
 {
-  if (IPCOpen()) {
+  if (mIPCOpen)
     Send__delete__(this);
-  }
 }
 
 NS_IMETHODIMP
 FTPChannelChild::Cancel(nsresult status)
 {
   LOG(("FTPChannelChild::Cancel [this=%p]\n", this));
   if (mCanceled)
     return NS_OK;
 
   mCanceled = true;
   mStatus = status;
-  if (IPCOpen()) {
+  if (mIPCOpen)
     SendCancel(status);
-  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FTPChannelChild::Suspend()
 {
-  NS_ENSURE_TRUE(IPCOpen(), NS_ERROR_NOT_AVAILABLE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE);
 
   LOG(("FTPChannelChild::Suspend [this=%p]\n", this));
 
   // SendSuspend only once, when suspend goes from 0 to 1.
   // Don't SendSuspend at all if we're diverting callbacks to the parent;
   // suspend will be called at the correct time in the parent itself.
   if (!mSuspendCount++ && !mDivertingToParent) {
     SendSuspend();
@@ -796,17 +798,17 @@ FTPChannelChild::Suspend()
   mEventQ->Suspend();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FTPChannelChild::Resume()
 {
-  NS_ENSURE_TRUE(IPCOpen(), NS_ERROR_NOT_AVAILABLE);
+  NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE);
 
   LOG(("FTPChannelChild::Resume [this=%p]\n", this));
 
   // SendResume only once, when suspend count drops to 0.
   // Don't SendResume at all if we're diverting callbacks to the parent (unless
   // suspend was sent earlier); otherwise, resume will be called at the correct
   // time in the parent itself.
   if (!--mSuspendCount && (!mDivertingToParent || mSuspendSent)) {
@@ -898,17 +900,17 @@ FTPChannelChild::DivertToParent(ChannelD
 
   // This method should only be called during OnStartRequest.
   if (!mDuringOnStart) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   // We must fail DivertToParent() if there's no parent end of the channel (and
   // won't be!) due to early failure.
-  if (NS_FAILED(mStatus) && !IPCOpen()) {
+  if (NS_FAILED(mStatus) && !mIPCOpen) {
     return mStatus;
   }
 
   nsresult rv = Suspend();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
--- a/netwerk/protocol/ftp/FTPChannelChild.h
+++ b/netwerk/protocol/ftp/FTPChannelChild.h
@@ -128,16 +128,17 @@ protected:
   friend class FTPFailedAsyncOpenEvent;
   friend class FTPFlushedForDiversionEvent;
   friend class FTPDeleteSelfEvent;
   friend class NeckoTargetChannelEvent<FTPChannelChild>;
 
 private:
   nsCOMPtr<nsIInputStream> mUploadStream;
 
+  bool mIPCOpen;
   RefPtr<ChannelEventQueue> mEventQ;
 
   // If nsUnknownDecoder is involved we queue onDataAvailable (and possibly
   // OnStopRequest) so that we can divert them if needed when the listener's
   // OnStartRequest is finally called
   nsTArray<UniquePtr<ChannelEvent>> mUnknownDecoderEventQ;
   bool mUnknownDecoderInvolved;
 
--- a/netwerk/protocol/http/AltDataOutputStreamChild.cpp
+++ b/netwerk/protocol/http/AltDataOutputStreamChild.cpp
@@ -9,17 +9,17 @@ NS_IMPL_ADDREF(AltDataOutputStreamChild)
 
 NS_IMETHODIMP_(MozExternalRefCountType) AltDataOutputStreamChild::Release()
 {
   MOZ_ASSERT(0 != mRefCnt, "dup release");
   MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
   --mRefCnt;
   NS_LOG_RELEASE(this, mRefCnt, "AltDataOutputStreamChild");
 
-  if (mRefCnt == 1 && IPCOpen()) {
+  if (mRefCnt == 1 && mIPCOpen) {
     // The only reference left is the IPDL one. After the parent replies back
     // with a DeleteSelf message, the child will call Send__delete__(this),
     // decrementing the ref count and triggering the destructor.
     SendDeleteSelf();
     return 1;
   }
 
   if (mRefCnt == 0) {
@@ -31,79 +31,85 @@ NS_IMETHODIMP_(MozExternalRefCountType) 
 }
 
 NS_INTERFACE_MAP_BEGIN(AltDataOutputStreamChild)
   NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 AltDataOutputStreamChild::AltDataOutputStreamChild()
-  : mError(NS_OK)
+  : mIPCOpen(false)
+  , mError(NS_OK)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
 }
 
 void
 AltDataOutputStreamChild::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference");
+  mIPCOpen = true;
   AddRef();
 }
 
 void
 AltDataOutputStreamChild::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference");
+  mIPCOpen = false;
   Release();
 }
 
 bool
 AltDataOutputStreamChild::WriteDataInChunks(const nsDependentCSubstring& data)
 {
   const uint32_t kChunkSize = 128*1024;
   uint32_t next = std::min(data.Length(), kChunkSize);
   for (uint32_t i = 0; i < data.Length();
        i = next, next = std::min(data.Length(), next + kChunkSize)) {
     nsCString chunk(Substring(data, i, kChunkSize));
-    if (IPCOpen() && !SendWriteData(chunk)) {
+    if (mIPCOpen && !SendWriteData(chunk)) {
+      mIPCOpen = false;
       return false;
     }
   }
   return true;
 }
 
 NS_IMETHODIMP
 AltDataOutputStreamChild::Close()
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   if (NS_FAILED(mError)) {
     return mError;
   }
   Unused << SendClose();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AltDataOutputStreamChild::Flush()
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   if (NS_FAILED(mError)) {
     return mError;
   }
 
   // This is a no-op
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AltDataOutputStreamChild::Write(const char * aBuf, uint32_t aCount, uint32_t *_retval)
 {
-  if (!IPCOpen()) {
+  if (!mIPCOpen) {
     return NS_ERROR_NOT_AVAILABLE;
   }
   if (NS_FAILED(mError)) {
     return mError;
   }
   if (WriteDataInChunks(nsDependentCSubstring(aBuf, aCount))) {
     *_retval = aCount;
     return NS_OK;
--- a/netwerk/protocol/http/AltDataOutputStreamChild.h
+++ b/netwerk/protocol/http/AltDataOutputStreamChild.h
@@ -29,16 +29,17 @@ public:
   virtual mozilla::ipc::IPCResult RecvError(const nsresult& err) override;
   virtual mozilla::ipc::IPCResult RecvDeleteSelf() override;
 
 private:
   virtual ~AltDataOutputStreamChild() = default;
   // Sends data to the parent process in 256k chunks.
   bool WriteDataInChunks(const nsDependentCSubstring& data);
 
+  bool mIPCOpen;
   // If there was an error opening the output stream or writing to it on the
   // parent side, this will be set to the error code. We check it before we
   // write so we can report an error to the consumer.
   nsresult mError;
 };
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/http/AltDataOutputStreamParent.cpp
+++ b/netwerk/protocol/http/AltDataOutputStreamParent.cpp
@@ -11,67 +11,75 @@
 namespace mozilla {
 namespace net {
 
 NS_IMPL_ISUPPORTS0(AltDataOutputStreamParent)
 
 AltDataOutputStreamParent::AltDataOutputStreamParent(nsIOutputStream* aStream)
   : mOutputStream(aStream)
   , mStatus(NS_OK)
+  , mIPCOpen(true)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
 }
 
 AltDataOutputStreamParent::~AltDataOutputStreamParent()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
 }
 
 mozilla::ipc::IPCResult
 AltDataOutputStreamParent::RecvWriteData(const nsCString& data)
 {
   if (NS_FAILED(mStatus)) {
-    if (IPCOpen()) {
+    if (mIPCOpen) {
       Unused << SendError(mStatus);
     }
     return IPC_OK();
   }
   nsresult rv;
   uint32_t n;
   if (mOutputStream) {
     rv = mOutputStream->Write(data.BeginReading(), data.Length(), &n);
     MOZ_ASSERT(n == data.Length() || NS_FAILED(rv));
-    if (NS_FAILED(rv) && IPCOpen()) {
+    if (NS_FAILED(rv) && mIPCOpen) {
       Unused << SendError(rv);
     }
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 AltDataOutputStreamParent::RecvClose()
 {
   if (NS_FAILED(mStatus)) {
-    if (IPCOpen()) {
+    if (mIPCOpen) {
       Unused << SendError(mStatus);
     }
     return IPC_OK();
   }
   nsresult rv;
   if (mOutputStream) {
     rv = mOutputStream->Close();
-    if (NS_FAILED(rv) && IPCOpen()) {
+    if (NS_FAILED(rv) && mIPCOpen) {
       Unused << SendError(rv);
     }
     mOutputStream = nullptr;
   }
   return IPC_OK();
 }
 
+void
+AltDataOutputStreamParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
+
 mozilla::ipc::IPCResult
 AltDataOutputStreamParent::RecvDeleteSelf()
 {
+  mIPCOpen = false;
   Unused << SendDeleteSelf();
   return IPC_OK();
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/http/AltDataOutputStreamParent.h
+++ b/netwerk/protocol/http/AltDataOutputStreamParent.h
@@ -28,25 +28,27 @@ public:
   explicit AltDataOutputStreamParent(nsIOutputStream* aStream);
 
   // Called when data is received from the content process.
   // We proceed to write that data to the output stream.
   virtual mozilla::ipc::IPCResult RecvWriteData(const nsCString& data) override;
   // Called when AltDataOutputStreamChild::Close() is
   // Closes and nulls the output stream.
   virtual mozilla::ipc::IPCResult RecvClose() override;
+  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   // Sets an error that will be reported to the content process.
   void SetError(nsresult status) { mStatus = status; }
   virtual mozilla::ipc::IPCResult RecvDeleteSelf() override;
 
 private:
   virtual ~AltDataOutputStreamParent();
   nsCOMPtr<nsIOutputStream> mOutputStream;
   // In case any error occurs mStatus will be != NS_OK, and this status code will
   // be sent to the content process asynchronously.
   nsresult mStatus;
+  bool     mIPCOpen;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_AltDataOutputStreamParent_h
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -2436,21 +2436,20 @@ HttpChannelChild::OnRedirectVerifyCallba
   nsCOMPtr<nsIChannel> newChannel = do_QueryInterface(mRedirectChannelChild);
   if (newChannel) {
     Unused << newChannel->GetLoadInfo(getter_AddRefs(newChannelLoadInfo));
   }
 
   ChildLoadInfoForwarderArgs loadInfoForwarder;
   LoadInfoToChildLoadInfoForwarder(newChannelLoadInfo, &loadInfoForwarder);
 
-  if (mIPCOpen) {
+  if (mIPCOpen)
     SendRedirect2Verify(result, *headerTuples, loadInfoForwarder, loadFlags,
                         referrerPolicy, referrerURI, redirectURI,
                         corsPreflightArgs, chooseAppcache);
-  }
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIRequest
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -24,33 +24,34 @@ NS_IMPL_ISUPPORTS(WebSocketChannelParent
                   nsIInterfaceRequestor)
 
 WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
                                                nsILoadContext* aLoadContext,
                                                PBOverrideStatus aOverrideStatus,
                                                uint32_t aSerial)
   : mAuthProvider(aAuthProvider)
   , mLoadContext(aLoadContext)
+  , mIPCOpen(true)
   , mSerial(aSerial)
 {
   // Websocket channels can't have a private browsing override
   MOZ_ASSERT_IF(!aLoadContext, aOverrideStatus == kPBOverride_Unset);
 }
 //-----------------------------------------------------------------------------
 // WebSocketChannelParent::PWebSocketChannelParent
 //-----------------------------------------------------------------------------
 
 mozilla::ipc::IPCResult
 WebSocketChannelParent::RecvDeleteSelf()
 {
   LOG(("WebSocketChannelParent::RecvDeleteSelf() %p\n", this));
   mChannel = nullptr;
   mAuthProvider = nullptr;
   IProtocol* mgr = Manager();
-  if (IPCOpen() && !Send__delete__(this)) {
+  if (mIPCOpen && !Send__delete__(this)) {
     return IPC_FAIL_NO_REASON(mgr);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 WebSocketChannelParent::RecvAsyncOpen(const OptionalURIParams& aURI,
                                       const nsCString& aOrigin,
@@ -216,84 +217,86 @@ WebSocketChannelParent::OnStart(nsISuppo
 
     RefPtr<WebSocketChannel> channel;
     channel = static_cast<WebSocketChannel*>(mChannel.get());
     MOZ_ASSERT(channel);
 
     channel->GetEffectiveURL(effectiveURL);
     encrypted = channel->IsEncrypted();
   }
-  if (!IPCOpen() || !SendOnStart(protocol, extensions, effectiveURL, encrypted)) {
+  if (!mIPCOpen || !SendOnStart(protocol, extensions, effectiveURL, encrypted)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocketChannelParent::OnStop(nsISupports *aContext, nsresult aStatusCode)
 {
   LOG(("WebSocketChannelParent::OnStop() %p\n", this));
-  if (!IPCOpen() || !SendOnStop(aStatusCode)) {
+  if (!mIPCOpen || !SendOnStop(aStatusCode)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocketChannelParent::OnMessageAvailable(nsISupports *aContext, const nsACString& aMsg)
 {
   LOG(("WebSocketChannelParent::OnMessageAvailable() %p\n", this));
-  if (!IPCOpen() || !SendOnMessageAvailable(nsCString(aMsg))) {
+  if (!mIPCOpen || !SendOnMessageAvailable(nsCString(aMsg))) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocketChannelParent::OnBinaryMessageAvailable(nsISupports *aContext, const nsACString& aMsg)
 {
   LOG(("WebSocketChannelParent::OnBinaryMessageAvailable() %p\n", this));
-  if (!IPCOpen() || !SendOnBinaryMessageAvailable(nsCString(aMsg))) {
+  if (!mIPCOpen || !SendOnBinaryMessageAvailable(nsCString(aMsg))) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocketChannelParent::OnAcknowledge(nsISupports *aContext, uint32_t aSize)
 {
   LOG(("WebSocketChannelParent::OnAcknowledge() %p\n", this));
-  if (!IPCOpen() || !SendOnAcknowledge(aSize)) {
+  if (!mIPCOpen || !SendOnAcknowledge(aSize)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocketChannelParent::OnServerClose(nsISupports *aContext,
                                       uint16_t code, const nsACString & reason)
 {
   LOG(("WebSocketChannelParent::OnServerClose() %p\n", this));
-  if (!IPCOpen() || !SendOnServerClose(code, nsCString(reason))) {
+  if (!mIPCOpen || !SendOnServerClose(code, nsCString(reason))) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 void
 WebSocketChannelParent::ActorDestroy(ActorDestroyReason why)
 {
   LOG(("WebSocketChannelParent::ActorDestroy() %p\n", this));
 
   // Make sure we close the channel if the content process dies without going
   // through a clean shutdown.
   if (mChannel) {
     Unused << mChannel->Close(nsIWebSocketChannel::CLOSE_GOING_AWAY,
                               NS_LITERAL_CSTRING("Child was killed"));
   }
+
+  mIPCOpen = false;
 }
 
 //-----------------------------------------------------------------------------
 // WebSocketChannelParent::nsIInterfaceRequestor
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 WebSocketChannelParent::GetInterface(const nsIID & iid, void **result)
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -56,16 +56,17 @@ class WebSocketChannelParent : public PW
                                                const uint32_t& aLength) override;
   mozilla::ipc::IPCResult RecvDeleteSelf() override;
 
   void ActorDestroy(ActorDestroyReason why) override;
 
   nsCOMPtr<nsIAuthPromptProvider> mAuthProvider;
   nsCOMPtr<nsIWebSocketChannel> mChannel;
   nsCOMPtr<nsILoadContext> mLoadContext;
+  bool mIPCOpen;
 
   uint32_t mSerial;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_WebSocketChannelParent_h
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -42,16 +42,17 @@ WyciwygChannelChild::WyciwygChannelChild
   : NeckoTargetHolder(aNeckoTarget)
   , mStatus(NS_OK)
   , mIsPending(false)
   , mCanceled(false)
   , mLoadFlags(LOAD_NORMAL)
   , mContentLength(-1)
   , mCharsetSource(kCharsetUninitialized)
   , mState(WCC_NEW)
+  , mIPCOpen(false)
   , mSentAppData(false)
 {
   LOG(("Creating WyciwygChannelChild @%p\n", this));
   mEventQ = new ChannelEventQueue(NS_ISUPPORTS_CAST(nsIWyciwygChannel*, this));
 
   if (mNeckoTarget) {
     gNeckoChild->SetEventTargetForActor(this, mNeckoTarget);
   }
@@ -68,22 +69,26 @@ WyciwygChannelChild::~WyciwygChannelChil
     NS_ReleaseOnMainThreadSystemGroup(
       "WyciwygChannelChild::mLoadInfo", mLoadInfo.forget());
   }
 }
 
 void
 WyciwygChannelChild::AddIPDLReference()
 {
+  MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference");
+  mIPCOpen = true;
   AddRef();
 }
 
 void
 WyciwygChannelChild::ReleaseIPDLReference()
 {
+  MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference");
+  mIPCOpen = false;
   Release();
 }
 
 nsresult
 WyciwygChannelChild::Init(nsIURI* uri)
 {
   NS_ENSURE_ARG_POINTER(uri);
 
@@ -318,19 +323,18 @@ WyciwygChannelChild::OnStopRequest(const
 
     if (mLoadGroup)
       mLoadGroup->RemoveRequest(this, nullptr, mStatus);
 
     mCallbacks = nullptr;
     mProgressSink = nullptr;
   }
 
-  if (IPCOpen()) {
+  if (mIPCOpen)
     PWyciwygChannelChild::Send__delete__(this);
-  }
 }
 
 class WyciwygCancelEvent : public NeckoTargetChannelEvent<WyciwygChannelChild>
 {
  public:
   WyciwygCancelEvent(WyciwygChannelChild* child, const nsresult& status)
   : NeckoTargetChannelEvent<WyciwygChannelChild>(child)
   , mStatus(status) {}
@@ -364,19 +368,18 @@ void WyciwygChannelChild::CancelEarly(co
 
   if (mListener) {
     mListener->OnStartRequest(this, mListenerContext);
     mListener->OnStopRequest(this, mListenerContext, mStatus);
   }
   mListener = nullptr;
   mListenerContext = nullptr;
 
-  if (IPCOpen()) {
+  if (mIPCOpen)
     PWyciwygChannelChild::Send__delete__(this);
-  }
 }
 
 //-----------------------------------------------------------------------------
 // nsIRequest
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 WyciwygChannelChild::GetName(nsACString & aName)
@@ -401,19 +404,18 @@ WyciwygChannelChild::GetStatus(nsresult 
 NS_IMETHODIMP
 WyciwygChannelChild::Cancel(nsresult aStatus)
 {
   if (mCanceled)
     return NS_OK;
 
   mCanceled = true;
   mStatus = aStatus;
-  if (IPCOpen()) {
+  if (mIPCOpen)
     SendCancel(aStatus);
-  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WyciwygChannelChild::Suspend()
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
@@ -746,19 +748,18 @@ WyciwygChannelChild::WriteToCacheEntry(c
 NS_IMETHODIMP
 WyciwygChannelChild::CloseCacheEntry(nsresult reason)
 {
   NS_ENSURE_TRUE(mState == WCC_ONWRITE, NS_ERROR_UNEXPECTED);
 
   SendCloseCacheEntry(reason);
   mState = WCC_ONCLOSED;
 
-  if (IPCOpen()) {
+  if (mIPCOpen)
     PWyciwygChannelChild::Send__delete__(this);
-  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WyciwygChannelChild::SetSecurityInfo(nsISupports *aSecurityInfo)
 {
   mSecurityInfo = aSecurityInfo;
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.h
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.h
@@ -99,16 +99,17 @@ private:
   nsCOMPtr<nsILoadGroup>            mLoadGroup;
   nsCOMPtr<nsIStreamListener>       mListener;
   nsCOMPtr<nsISupports>             mListenerContext;
   nsCOMPtr<nsISupports>             mSecurityInfo;
 
   // FIXME: replace with IPDL states (bug 536319)
   enum WyciwygChannelChildState mState;
 
+  bool mIPCOpen;
   bool mSentAppData;
   RefPtr<ChannelEventQueue> mEventQ;
 
   friend class WyciwygStartRequestEvent;
   friend class WyciwygDataAvailableEvent;
   friend class WyciwygStopRequestEvent;
   friend class WyciwygCancelEvent;
   friend class NeckoTargetChannelEvent<WyciwygChannelChild>;
--- a/python/mozbuild/mozbuild/backend/common.py
+++ b/python/mozbuild/mozbuild/backend/common.py
@@ -362,19 +362,18 @@ class CommonBackend(BuildBackend):
     def _write_unified_file(self, unified_file, source_filenames,
                             output_directory, poison_windows_h=False):
         with self._write_file(mozpath.join(output_directory, unified_file)) as f:
             f.write('#define MOZ_UNIFIED_BUILD\n')
             includeTemplate = '#include "%(cppfile)s"'
             if poison_windows_h:
                 includeTemplate += (
                     '\n'
-                    '#if defined(_WINDOWS_) && !defined(MOZ_WRAPPED_WINDOWS_H)\n'
-                    '#pragma message("wrapper failure reason: " MOZ_WINDOWS_WRAPPER_DISABLED_REASON)\n'
-                    '#error "%(cppfile)s included unwrapped windows.h"\n'
+                    '#ifdef _WINDOWS_\n'
+                    '#error "%(cppfile)s included windows.h"\n'
                     "#endif")
             includeTemplate += (
                 '\n'
                 '#ifdef PL_ARENA_CONST_ALIGN_MASK\n'
                 '#error "%(cppfile)s uses PL_ARENA_CONST_ALIGN_MASK, '
                 'so it cannot be built in unified mode."\n'
                 '#undef PL_ARENA_CONST_ALIGN_MASK\n'
                 '#endif\n'
--- a/security/manager/ssl/PSMContentListener.cpp
+++ b/security/manager/ssl/PSMContentListener.cpp
@@ -208,16 +208,17 @@ PSMContentStreamListener::ImportCertific
 }
 
 /* ------------------------
  * PSMContentDownloaderParent
  * ------------------------ */
 
 PSMContentDownloaderParent::PSMContentDownloaderParent(uint32_t type)
   : PSMContentStreamListener(type)
+  , mIPCOpen(true)
 {
 }
 
 PSMContentDownloaderParent::~PSMContentDownloaderParent()
 {
 }
 
 mozilla::ipc::IPCResult
@@ -242,43 +243,49 @@ PSMContentDownloaderParent::RecvOnStopRe
   if (NS_SUCCEEDED(code)) {
     // See also PSMContentStreamListener::OnStopRequest. In this case, we don't
     // have to dispatch ImportCertificate off of an event because we don't have
     // to worry about Necko sending "clean up" events and destroying us if
     // ImportCertificate spins the event loop.
     ImportCertificate();
   }
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     mozilla::Unused << Send__delete__(this);
   }
   return IPC_OK();
 }
 
 NS_IMETHODIMP
 PSMContentDownloaderParent::OnStopRequest(nsIRequest* request, nsISupports* context, nsresult code)
 {
   nsresult rv = PSMContentStreamListener::OnStopRequest(request, context, code);
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     mozilla::Unused << Send__delete__(this);
   }
   return rv;
 }
 
 mozilla::ipc::IPCResult
 PSMContentDownloaderParent::RecvDivertToParentUsing(mozilla::net::PChannelDiverterParent* diverter)
 {
   MOZ_ASSERT(diverter);
   auto p = static_cast<mozilla::net::ChannelDiverterParent*>(diverter);
   p->DivertTo(this);
   mozilla::Unused << mozilla::net::ChannelDiverterParent::Send__delete__(p);
   return IPC_OK();
 }
 
+void
+PSMContentDownloaderParent::ActorDestroy(ActorDestroyReason why)
+{
+  mIPCOpen = false;
+}
+
 /* ------------------------
  * PSMContentDownloaderChild
  * ------------------------ */
 
 NS_IMPL_ISUPPORTS(PSMContentDownloaderChild, nsIStreamListener)
 
 PSMContentDownloaderChild::PSMContentDownloaderChild()
 {
--- a/security/manager/ssl/PSMContentListener.h
+++ b/security/manager/ssl/PSMContentListener.h
@@ -62,16 +62,19 @@ public:
   // we have to override OnStopRequest to know when we're done with our IPC
   // ref.
   NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *aContext, nsresult code) override;
 
   virtual mozilla::ipc::IPCResult RecvDivertToParentUsing(mozilla::net::PChannelDiverterParent *diverter) override;
 
 protected:
   virtual ~PSMContentDownloaderParent();
+
+  virtual void ActorDestroy(ActorDestroyReason why) override;
+  bool mIPCOpen;
 };
 
 // Child actor for importing a cert.
 class PSMContentDownloaderChild : public nsIStreamListener
                                 , public PPSMContentDownloaderChild
 {
 public:
   PSMContentDownloaderChild();
--- a/toolkit/components/reputationservice/LoginReputationIPC.cpp
+++ b/toolkit/components/reputationservice/LoginReputationIPC.cpp
@@ -41,13 +41,19 @@ LoginReputationParent::QueryReputation(n
 
 NS_IMETHODIMP
 LoginReputationParent::OnComplete(nsresult aResult,
                                   VerdictType aVerdict)
 {
   LR_LOG(("OnComplete() [verdict=%s]",
     LoginReputationService::VerdictTypeToString(aVerdict).get()));
 
-  if (IPCOpen()) {
+  if (mIPCOpen) {
     Unused << Send__delete__(this);
   }
   return NS_OK;
 }
+
+void
+LoginReputationParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+  mIPCOpen = false;
+}
--- a/toolkit/components/reputationservice/LoginReputationIPC.h
+++ b/toolkit/components/reputationservice/LoginReputationIPC.h
@@ -19,16 +19,19 @@ class LoginReputationParent : public nsI
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSILOGINREPUTATIONQUERYCALLBACK
 
   LoginReputationParent() = default;
 
   mozilla::ipc::IPCResult QueryReputation(nsIURI* aURI);
 
+  void ActorDestroy(ActorDestroyReason aWhy) override;
+
 private:
   ~LoginReputationParent() = default;
+  bool mIPCOpen = true;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_LoginReputationIPC_h