Merge mozilla-central to mozilla-autoland. r=merge a=merge CLOSED TREE

This commit is contained in:
Noemi Erli 2017-11-10 12:43:53 +02:00
Родитель 884cee1c99 7e070192d7
Коммит 8d8df3ddfe
306 изменённых файлов: 3783 добавлений и 2289 удалений

Просмотреть файл

@ -165,17 +165,16 @@ ApplicationAccessible::Init()
// that all root accessibles are stored in application accessible children
// array.
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowOuter::OuterWindowByIdTable* windowsById =
nsGlobalWindowOuter::GetWindowsTable();
if (!windowsById) {
return;
}
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindow* window = iter.Data();
if (window->GetDocShell() && window->IsOuterWindow() &&
window->IsRootOuterWindow()) {
nsGlobalWindowOuter* window = iter.Data();
if (window->GetDocShell() && window->IsRootOuterWindow()) {
nsCOMPtr<nsIDocument> docNode = window->GetExtantDoc();
if (docNode) {

Просмотреть файл

@ -485,7 +485,8 @@ RootAccessible::RelationByType(RelationType aType)
return DocAccessibleWrap::RelationByType(aType);
if (nsPIDOMWindowOuter* rootWindow = mDocumentNode->GetWindow()) {
nsCOMPtr<nsPIDOMWindowOuter> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent();
nsCOMPtr<nsPIDOMWindowOuter> contentWindow =
nsGlobalWindowOuter::Cast(rootWindow)->GetContent();
if (contentWindow) {
nsCOMPtr<nsIDocument> contentDocumentNode = contentWindow->GetDoc();
if (contentDocumentNode) {

Просмотреть файл

@ -429,6 +429,7 @@ pref("permissions.default.camera", 0);
pref("permissions.default.microphone", 0);
pref("permissions.default.geo", 0);
pref("permissions.default.desktop-notification", 0);
pref("permissions.default.shortcuts", 0);
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window

Просмотреть файл

@ -5,6 +5,7 @@ support-files=
[browser_canvas_fingerprinting_resistance.js]
[browser_permissions.js]
[browser_reservedkey.js]
[browser_temporary_permissions.js]
support-files =
temporary_permissions_subframe.html

Просмотреть файл

@ -176,3 +176,43 @@ add_task(async function testPermissionIcons() {
SitePermissions.remove(gBrowser.currentURI, "camera");
});
});
add_task(async function testPermissionShortcuts() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
browser.focus();
await new Promise(r => {
SpecialPowers.pushPrefEnv({"set": [["permissions.default.shortcuts", 0]]}, r);
});
async function tryKey(desc, expectedValue) {
await EventUtils.synthesizeAndWaitKey("c", { accelKey: true });
let result = await ContentTask.spawn(browser, null, function() {
return content.wrappedJSObject.gKeyPresses;
});
is(result, expectedValue, desc);
}
await tryKey("pressed with default permissions", 1);
SitePermissions.set(gBrowser.currentURI, "shortcuts", SitePermissions.BLOCK);
await tryKey("pressed when site blocked", 1);
SitePermissions.set(gBrowser.currentURI, "shortcuts", SitePermissions.ALLOW);
await tryKey("pressed when site allowed", 2);
SitePermissions.remove(gBrowser.currentURI, "shortcuts");
await new Promise(r => {
SpecialPowers.pushPrefEnv({"set": [["permissions.default.shortcuts", 2]]}, r);
});
await tryKey("pressed when globally blocked", 2);
SitePermissions.set(gBrowser.currentURI, "shortcuts", SitePermissions.ALLOW);
await tryKey("pressed when globally blocked but site allowed", 3);
SitePermissions.set(gBrowser.currentURI, "shortcuts", SitePermissions.BLOCK);
await tryKey("pressed when globally blocked and site blocked", 3);
SitePermissions.remove(gBrowser.currentURI, "shortcuts");
});
});

Просмотреть файл

@ -0,0 +1,92 @@
add_task(async function test_reserved_shortcuts() {
/* eslint-disable no-unsanitized/property */
let keyset = `<keyset>
<key id='kt_reserved' modifiers='shift' key='O' reserved='true' count='0'
oncommand='this.setAttribute("count", Number(this.getAttribute("count")) + 1)'/>
<key id='kt_notreserved' modifiers='shift' key='P' reserved='false' count='0'
oncommand='this.setAttribute("count", Number(this.getAttribute("count")) + 1)'/>
<key id='kt_reserveddefault' modifiers='shift' key='Q' count='0'
oncommand='this.setAttribute("count", Number(this.getAttribute("count")) + 1)'/>
</keyset>`;
let container = document.createElement("box");
container.innerHTML = keyset;
document.documentElement.appendChild(container);
/* eslint-enable no-unsanitized/property */
const pageUrl = "data:text/html,<body onload='document.body.firstChild.focus();'><div onkeydown='event.preventDefault();' tabindex=0>Test</div></body>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
EventUtils.synthesizeKey("O", { shiftKey: true });
EventUtils.synthesizeKey("P", { shiftKey: true });
EventUtils.synthesizeKey("Q", { shiftKey: true });
is(document.getElementById("kt_reserved").getAttribute("count"), "1", "reserved='true' with preference off");
is(document.getElementById("kt_notreserved").getAttribute("count"), "0", "reserved='false' with preference off");
is(document.getElementById("kt_reserveddefault").getAttribute("count"), "0", "default reserved with preference off");
// Now try with reserved shortcut key handling enabled.
await new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [["permissions.default.shortcuts", 2]]}, resolve);
});
EventUtils.synthesizeKey("O", { shiftKey: true });
EventUtils.synthesizeKey("P", { shiftKey: true });
EventUtils.synthesizeKey("Q", { shiftKey: true });
is(document.getElementById("kt_reserved").getAttribute("count"), "2", "reserved='true' with preference on");
is(document.getElementById("kt_notreserved").getAttribute("count"), "0", "reserved='false' with preference on");
is(document.getElementById("kt_reserveddefault").getAttribute("count"), "1", "default reserved with preference on");
document.documentElement.removeChild(container);
await BrowserTestUtils.removeTab(tab);
});
// This test checks that Alt+<key> and F10 cannot be blocked when the preference is set.
if (navigator.platform.indexOf("Mac") == -1) {
add_task(async function test_accesskeys_menus() {
await new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [["permissions.default.shortcuts", 2]]}, resolve);
});
const uri = "data:text/html,<body onkeydown='if (event.key == \"H\" || event.key == \"F10\") event.preventDefault();'>";
let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri);
// Pressing Alt+H should open the Help menu.
let helpPopup = document.getElementById("menu_HelpPopup");
let popupShown = BrowserTestUtils.waitForEvent(helpPopup, "popupshown");
EventUtils.synthesizeKey("VK_ALT", { type: "keydown" });
EventUtils.synthesizeKey("H", { altKey: true });
EventUtils.synthesizeKey("VK_ALT", { type: "keyup" });
await popupShown;
ok(true, "Help menu opened");
let popupHidden = BrowserTestUtils.waitForEvent(helpPopup, "popuphidden");
helpPopup.hidePopup();
await popupHidden;
// Pressing F10 should focus the menubar. On Linux, the file menu should open, but on Windows,
// pressing Down will open the file menu.
let menubar = document.getElementById("main-menubar");
let menubarActive = BrowserTestUtils.waitForEvent(menubar, "DOMMenuBarActive");
EventUtils.sendKey("F10");
await menubarActive;
let filePopup = document.getElementById("menu_FilePopup");
popupShown = BrowserTestUtils.waitForEvent(filePopup, "popupshown");
if (navigator.platform.indexOf("Win") >= 0) {
EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
}
await popupShown;
ok(true, "File menu opened");
popupHidden = BrowserTestUtils.waitForEvent(filePopup, "popuphidden");
filePopup.hidePopup();
await popupHidden;
await BrowserTestUtils.removeTab(tab1);
});
}

Просмотреть файл

@ -6,7 +6,10 @@
<head>
<meta charset="utf8">
</head>
<body>
<script>
var gKeyPresses = 0;
</script>
<body onkeypress="gKeyPresses++;">
<!-- This page could eventually request permissions from content
and make sure that chrome responds appropriately -->
<button id="geo" onclick="navigator.geolocation.getCurrentPosition(() => {})">Geolocation</button>

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.104
Current extension version is: 2.0.106
Taken from upstream commit: 012d0756
Taken from upstream commit: 0052dc2b

Просмотреть файл

@ -149,7 +149,7 @@ function getLocalizedString(strings, id, property) {
// PDF data storage
function PdfDataListener(length) {
this.length = length; // less than 0, if length is unknown
this.buffer = null;
this.buffers = [];
this.loaded = 0;
}
@ -157,15 +157,7 @@ PdfDataListener.prototype = {
append: function PdfDataListener_append(chunk) {
// In most of the cases we will pass data as we receive it, but at the
// beginning of the loading we may accumulate some data.
if (!this.buffer) {
this.buffer = new Uint8Array(chunk);
} else {
var buffer = this.buffer;
var newBuffer = new Uint8Array(buffer.length + chunk.length);
newBuffer.set(buffer);
newBuffer.set(chunk, buffer.length);
this.buffer = newBuffer;
}
this.buffers.push(chunk);
this.loaded += chunk.length;
if (this.length >= 0 && this.length < this.loaded) {
this.length = -1; // reset the length, server is giving incorrect one
@ -173,9 +165,26 @@ PdfDataListener.prototype = {
this.onprogress(this.loaded, this.length >= 0 ? this.length : void 0);
},
readData: function PdfDataListener_readData() {
var result = this.buffer;
this.buffer = null;
return result;
if (this.buffers.length === 0) {
return null;
}
if (this.buffers.length === 1) {
return this.buffers.pop();
}
// There are multiple buffers that need to be combined into a single
// buffer.
let combinedLength = 0;
for (let buffer of this.buffers) {
combinedLength += buffer.length;
}
let combinedArray = new Uint8Array(combinedLength);
let writeOffset = 0;
while (this.buffers.length) {
let buffer = this.buffers.shift();
combinedArray.set(buffer, writeOffset);
writeOffset += buffer.length;
}
return combinedArray;
},
finish: function PdfDataListener_finish() {
this.isDataReady = true;
@ -878,8 +887,9 @@ PdfStreamConverter.prototype = {
var binaryStream = this.binaryStream;
binaryStream.setInputStream(aInputStream);
var chunk = binaryStream.readByteArray(aCount);
this.dataListener.append(chunk);
let chunk = new ArrayBuffer(aCount);
binaryStream.readArrayBuffer(aCount, chunk);
this.dataListener.append(new Uint8Array(chunk));
},
// nsIRequestObserver::onStartRequest

Просмотреть файл

@ -1961,7 +1961,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
let apiVersion = '2.0.104';
let apiVersion = '2.0.106';
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
source.chunkedViewerLoading = !!pdfDataRangeTransport;
@ -3258,8 +3258,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.104';
exports.build = build = '012d0756';
exports.version = version = '2.0.106';
exports.build = build = '0052dc2b';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4993,8 +4993,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.104';
var pdfjsBuild = '012d0756';
var pdfjsVersion = '2.0.106';
var pdfjsBuild = '0052dc2b';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(13);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -8118,8 +8118,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.104';
PDFJS.build = '012d0756';
PDFJS.version = '2.0.106';
PDFJS.build = '0052dc2b';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

Просмотреть файл

@ -23284,8 +23284,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.104';
var pdfjsBuild = '012d0756';
var pdfjsVersion = '2.0.106';
var pdfjsBuild = '0052dc2b';
var pdfjsCoreWorker = __w_pdfjs_require__(18);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -23480,7 +23480,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.104';
let workerVersion = '2.0.106';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {utils: Cu} = Components;
const {results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -82,26 +82,36 @@ this.Bootstrap = {
}
// record the value of the default branch before setting it
switch (realPrefType) {
case Services.prefs.PREF_STRING:
studyPrefsChanged[prefName] = defaultBranch.getCharPref(prefName);
break;
try {
switch (realPrefType) {
case Services.prefs.PREF_STRING:
studyPrefsChanged[prefName] = defaultBranch.getCharPref(prefName);
break;
case Services.prefs.PREF_INT:
studyPrefsChanged[prefName] = defaultBranch.getIntPref(prefName);
break;
case Services.prefs.PREF_INT:
studyPrefsChanged[prefName] = defaultBranch.getIntPref(prefName);
break;
case Services.prefs.PREF_BOOL:
studyPrefsChanged[prefName] = defaultBranch.getBoolPref(prefName);
break;
case Services.prefs.PREF_BOOL:
studyPrefsChanged[prefName] = defaultBranch.getBoolPref(prefName);
break;
case Services.prefs.PREF_INVALID:
case Services.prefs.PREF_INVALID:
studyPrefsChanged[prefName] = null;
break;
default:
// This should never happen
log.error(`Error getting startup pref ${prefName}; unknown value type ${experimentPrefType}.`);
}
} catch (e) {
if (e.result == Cr.NS_ERROR_UNEXPECTED) {
// There is a value for the pref on the user branch but not on the default branch. This is ok.
studyPrefsChanged[prefName] = null;
break;
default:
// This should never happen
log.error(`Error getting startup pref ${prefName}; unknown value type ${experimentPrefType}.`);
} else {
// rethrow
throw e;
}
}
// now set the new default value

Просмотреть файл

@ -252,3 +252,19 @@ decorate_task(
);
},
);
// Test that startup prefs are handled correctly when there is a value on the user branch but not the default branch.
decorate_task(
withPrefEnv({
set: [
["extensions.shield-recipe-client.startupExperimentPrefs.testing.does-not-exist", "foo"],
["testing.does-not-exist", "foo"],
],
}),
withBootstrap,
withStub(PreferenceExperiments, "recordOriginalValues"),
async function testInitExperimentPrefsNoDefaultValue(Bootstrap) {
Bootstrap.initExperimentPrefs();
ok(true, "initExperimentPrefs should not throw for non-existant prefs");
},
);

Просмотреть файл

@ -206,7 +206,6 @@
@RESPATH@/components/dom_notification.xpt
@RESPATH@/components/dom_html.xpt
@RESPATH@/components/dom_offline.xpt
@RESPATH@/components/dom_json.xpt
@RESPATH@/components/dom_payments.xpt
@RESPATH@/components/dom_power.xpt
@RESPATH@/components/dom_push.xpt

Просмотреть файл

@ -35,5 +35,6 @@ permission.screen.label = Share the Screen
permission.install.label = Install Add-ons
permission.popup.label = Open Pop-up Windows
permission.geo.label = Access Your Location
permission.shortcuts.label = Override Keyboard Shortcuts
permission.focus-tab-by-prompt.label = Switch to this Tab
permission.persistent-storage.label = Store Data in Persistent Storage

Просмотреть файл

@ -626,7 +626,11 @@ var gPermissionObject = {
},
"persistent-storage": {
exactHostMatch: true
}
},
"shortcuts": {
states: [ SitePermissions.ALLOW, SitePermissions.BLOCK ],
},
};
// Delete this entry while being pre-off

Просмотреть файл

@ -25,10 +25,13 @@ add_task(async function testGetAllPermissionDetailsForBrowser() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
Services.prefs.setIntPref("permissions.default.shortcuts", 2);
SitePermissions.set(uri, "camera", SitePermissions.ALLOW);
SitePermissions.set(uri, "cookie", SitePermissions.ALLOW_COOKIES_FOR_SESSION);
SitePermissions.set(uri, "popup", SitePermissions.BLOCK);
SitePermissions.set(uri, "geo", SitePermissions.ALLOW, SitePermissions.SCOPE_SESSION);
SitePermissions.set(uri, "shortcuts", SitePermissions.ALLOW);
let permissions = SitePermissions.getAllPermissionDetailsForBrowser(tab.linkedBrowser);
@ -71,9 +74,20 @@ add_task(async function testGetAllPermissionDetailsForBrowser() {
scope: SitePermissions.SCOPE_SESSION,
});
let shortcuts = permissions.find(({id}) => id === "shortcuts");
Assert.deepEqual(shortcuts, {
id: "shortcuts",
label: "Override Keyboard Shortcuts",
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_PERSISTENT,
});
SitePermissions.remove(uri, "cookie");
SitePermissions.remove(uri, "popup");
SitePermissions.remove(uri, "geo");
SitePermissions.remove(uri, "shortcuts");
Services.prefs.clearUserPref("permissions.default.shortcuts");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

Просмотреть файл

@ -10,7 +10,7 @@ const STORAGE_MANAGER_ENABLED = Services.prefs.getBoolPref("browser.storageManag
add_task(async function testPermissionsListing() {
let expectedPermissions = ["camera", "cookie", "desktop-notification", "focus-tab-by-prompt",
"geo", "image", "install", "microphone", "popup", "screen"];
"geo", "image", "install", "microphone", "popup", "screen", "shortcuts"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
@ -58,6 +58,18 @@ add_task(async function testGetAllByURI() {
SitePermissions.set(uri, "addon", SitePermissions.BLOCK);
Assert.deepEqual(SitePermissions.getAllByURI(uri), []);
SitePermissions.remove(uri, "addon");
Assert.equal(Services.prefs.getIntPref("permissions.default.shortcuts"), 0);
SitePermissions.set(uri, "shortcuts", SitePermissions.BLOCK);
// Customized preference should have been enabled, but the default should not.
Assert.equal(Services.prefs.getIntPref("permissions.default.shortcuts"), 0);
Assert.deepEqual(SitePermissions.getAllByURI(uri), [
{ id: "shortcuts", state: SitePermissions.BLOCK, scope: SitePermissions.SCOPE_PERSISTENT },
]);
SitePermissions.remove(uri, "shortcuts");
Services.prefs.clearUserPref("permissions.default.shortcuts");
});
add_task(async function testGetAvailableStates() {
@ -96,7 +108,7 @@ add_task(async function testExactHostMatch() {
// Should remove this checking and add it as default after it is fully pref-on.
exactHostMatched.push("persistent-storage");
}
let nonExactHostMatched = ["image", "cookie", "popup", "install"];
let nonExactHostMatched = ["image", "cookie", "popup", "install", "shortcuts"];
let permissions = SitePermissions.listPermissions();
for (let permission of permissions) {

Просмотреть файл

@ -13,6 +13,11 @@
"cxx": "cl.exe",
"patches": [
"msvc-host-x64.patch",
"loosen-msvc-detection.patch"
"loosen-msvc-detection.patch",
"r314201.patch",
"r315677.patch",
"r316048.patch",
"r317705.patch",
"r317709.patch"
]
}

Просмотреть файл

@ -13,6 +13,11 @@
"cxx": "cl.exe",
"ml": "ml64.exe",
"patches": [
"loosen-msvc-detection.patch"
"loosen-msvc-detection.patch",
"r314201.patch",
"r315677.patch",
"r316048.patch",
"r317705.patch",
"r317709.patch"
]
}

Просмотреть файл

@ -0,0 +1,54 @@
From 71e7a8ba8994e5b1f9cc0a0986b2ef5d37ed8ad2 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylvestre@debian.org>
Date: Tue, 26 Sep 2017 11:56:43 +0000
Subject: [PATCH] Don't move llvm.localescape outside the entry block in the
GCOV profiling pass
Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=34714.
Patch by Marco Castelluccio
Reviewers: rnk
Reviewed By: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38224
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314201 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Transforms/Instrumentation/GCOVProfiling.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index b2033536ac8..3154c1939ea 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -502,6 +502,16 @@ static bool functionHasLines(Function &F) {
return false;
}
+static bool shouldKeepInEntry(BasicBlock::iterator It) {
+ if (isa<AllocaInst>(*It)) return true;
+ if (isa<DbgInfoIntrinsic>(*It)) return true;
+ if (auto *II = dyn_cast<IntrinsicInst>(It)) {
+ if (II->getIntrinsicID() == llvm::Intrinsic::localescape) return true;
+ }
+
+ return false;
+}
+
void GCOVProfiler::emitProfileNotes() {
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes) return;
@@ -537,7 +547,7 @@ void GCOVProfiler::emitProfileNotes() {
// single successor, so split the entry block to make sure of that.
BasicBlock &EntryBlock = F.getEntryBlock();
BasicBlock::iterator It = EntryBlock.begin();
- while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It))
+ while (shouldKeepInEntry(It))
++It;
EntryBlock.splitBasicBlock(It);

Просмотреть файл

@ -0,0 +1,67 @@
From 44847b2e9838888e1536c90ad442a3958362139a Mon Sep 17 00:00:00 2001
From: Marco Castelluccio <mcastelluccio@mozilla.com>
Date: Fri, 13 Oct 2017 13:49:15 +0000
Subject: [PATCH] Disable gcov instrumentation of functions using funclet-based
exception handling
Summary: This patch fixes the crash from https://bugs.llvm.org/show_bug.cgi?id=34659 and https://bugs.llvm.org/show_bug.cgi?id=34833.
Reviewers: rnk, majnemer
Reviewed By: rnk, majnemer
Subscribers: majnemer, llvm-commits
Differential Revision: https://reviews.llvm.org/D38223
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315677 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Transforms/Instrumentation/GCOVProfiling.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 3154c1939ea..67ca8172b0d 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/UniqueVector.h"
+#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/IRBuilder.h"
@@ -502,6 +503,13 @@ static bool functionHasLines(Function &F) {
return false;
}
+static bool isUsingFuncletBasedEH(Function &F) {
+ if (!F.hasPersonalityFn()) return false;
+
+ EHPersonality Personality = classifyEHPersonality(F.getPersonalityFn());
+ return isFuncletEHPersonality(Personality);
+}
+
static bool shouldKeepInEntry(BasicBlock::iterator It) {
if (isa<AllocaInst>(*It)) return true;
if (isa<DbgInfoIntrinsic>(*It)) return true;
@@ -542,6 +550,8 @@ void GCOVProfiler::emitProfileNotes() {
DISubprogram *SP = F.getSubprogram();
if (!SP) continue;
if (!functionHasLines(F)) continue;
+ // TODO: Functions using funclet-based EH are currently not supported.
+ if (isUsingFuncletBasedEH(F)) continue;
// gcov expects every function to start with an entry block that has a
// single successor, so split the entry block to make sure of that.
@@ -619,7 +629,10 @@ bool GCOVProfiler::emitProfileArcs() {
DISubprogram *SP = F.getSubprogram();
if (!SP) continue;
if (!functionHasLines(F)) continue;
+ // TODO: Functions using funclet-based EH are currently not supported.
+ if (isUsingFuncletBasedEH(F)) continue;
if (!Result) Result = true;
+
unsigned Edges = 0;
for (auto &BB : F) {
TerminatorInst *TI = BB.getTerminator();

Просмотреть файл

@ -0,0 +1,60 @@
From 98adaa2097783c0fe3a4c948397e3f2182dcc5d2 Mon Sep 17 00:00:00 2001
From: Marco Castelluccio <mcastelluccio@mozilla.com>
Date: Wed, 18 Oct 2017 00:22:01 +0000
Subject: [PATCH] Use O_BINARY when opening GCDA file on Windows
Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=34922.
Apparently, the mode in **fdopen** gets simply ignored and Windows only cares about the mode of the original **open**.
I have verified this both with the simple case from bug 34922 and with a full Firefox build.
Reviewers: zturner
Reviewed By: zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38984
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316048 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/profile/GCDAProfiling.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index 138af6ec4..8c92546bd 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -37,6 +37,9 @@
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
#endif
#if defined(__FreeBSD__) && defined(__i386__)
@@ -238,17 +241,17 @@ void llvm_gcda_start_file(const char *orig_filename, const char version[4],
/* Try just opening the file. */
new_file = 0;
- fd = open(filename, O_RDWR);
+ fd = open(filename, O_RDWR | O_BINARY);
if (fd == -1) {
/* Try opening the file, creating it if necessary. */
new_file = 1;
mode = "w+b";
- fd = open(filename, O_RDWR | O_CREAT, 0644);
+ fd = open(filename, O_RDWR | O_CREAT | O_BINARY, 0644);
if (fd == -1) {
/* Try creating the directories first then opening the file. */
__llvm_profile_recursive_mkdir(filename);
- fd = open(filename, O_RDWR | O_CREAT, 0644);
+ fd = open(filename, O_RDWR | O_CREAT | O_BINARY, 0644);
if (fd == -1) {
/* Bah! It's hopeless. */
int errnum = errno;

Просмотреть файл

@ -0,0 +1,92 @@
From 07e2a968c83c489c5b46efe4973114e78e1804c1 Mon Sep 17 00:00:00 2001
From: Marco Castelluccio <mcastelluccio@mozilla.com>
Date: Wed, 8 Nov 2017 19:11:54 +0000
Subject: [PATCH] Implement flock for Windows in compiler-rt
Summary:
This patch implements flock for Windows, needed to make gcda writing work in a multiprocessing scenario.
Fixes https://bugs.llvm.org/show_bug.cgi?id=34923.
Reviewers: zturner
Reviewed By: zturner
Subscribers: rnk, zturner, llvm-commits
Differential Revision: https://reviews.llvm.org/D38891
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317705 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/profile/WindowsMMap.c | 58 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 55 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/lib/profile/WindowsMMap.c b/lib/profile/WindowsMMap.c
index f81d7da53..0c534710b 100644
--- a/compiler-rt/lib/profile/WindowsMMap.c
+++ b/compiler-rt/lib/profile/WindowsMMap.c
@@ -120,9 +120,61 @@ int msync(void *addr, size_t length, int flags)
}
COMPILER_RT_VISIBILITY
-int flock(int fd, int operation)
-{
- return -1; /* Not supported. */
+int lock(HANDLE handle, DWORD lockType, BOOL blocking) {
+ DWORD flags = lockType;
+ if (!blocking)
+ flags |= LOCKFILE_FAIL_IMMEDIATELY;
+
+ OVERLAPPED overlapped;
+ ZeroMemory(&overlapped, sizeof(OVERLAPPED));
+ overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ BOOL result = LockFileEx(handle, flags, 0, MAXDWORD, MAXDWORD, &overlapped);
+ if (!result) {
+ DWORD dw = GetLastError();
+
+ // In non-blocking mode, return an error if the file is locked.
+ if (!blocking && dw == ERROR_LOCK_VIOLATION)
+ return -1; // EWOULDBLOCK
+
+ // If the error is ERROR_IO_PENDING, we need to wait until the operation
+ // finishes. Otherwise, we return an error.
+ if (dw != ERROR_IO_PENDING)
+ return -1;
+
+ DWORD dwNumBytes;
+ if (!GetOverlappedResult(handle, &overlapped, &dwNumBytes, TRUE))
+ return -1;
+ }
+
+ return 0;
+}
+
+COMPILER_RT_VISIBILITY
+int flock(int fd, int operation) {
+ HANDLE handle = (HANDLE)_get_osfhandle(fd);
+ if (handle == INVALID_HANDLE_VALUE)
+ return -1;
+
+ BOOL blocking = (operation & LOCK_NB) == 0;
+ int op = operation & ~LOCK_NB;
+
+ switch (op) {
+ case LOCK_EX:
+ return lock(handle, LOCKFILE_EXCLUSIVE_LOCK, blocking);
+
+ case LOCK_SH:
+ return lock(handle, 0, blocking);
+
+ case LOCK_UN:
+ if (!UnlockFile(handle, 0, 0, MAXDWORD, MAXDWORD))
+ return -1;
+ break;
+
+ default:
+ return -1;
+ }
+
+ return 0;
}
#undef DWORD_HI

Просмотреть файл

@ -0,0 +1,51 @@
From 8f15f3c70065372ce412075f5f369847b55351d2 Mon Sep 17 00:00:00 2001
From: Marco Castelluccio <mcastelluccio@mozilla.com>
Date: Wed, 8 Nov 2017 19:21:54 +0000
Subject: [PATCH] Add CoreOption flag to "-coverage" option to make it
available for clang-cl
Summary:
The -coverage option is not a CoreOption, so it is not available to clang-cl.
This patch adds the CoreOption flag to "-coverage" to allow it to be used with clang-cl.
Reviewers: rnk
Reviewed By: rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D38221
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317709 91177308-0d34-0410-b5e6-96231b3b80d8
---
include/clang/Driver/Options.td | 2 +-
test/Driver/coverage.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 test/Driver/coverage.c
diff --git a/clang/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 597e03b563d..01605619e02 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -519,7 +519,7 @@ def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-round
def client__name : JoinedOrSeparate<["-"], "client_name">;
def combine : Flag<["-", "--"], "combine">, Flags<[DriverOption, Unsupported]>;
def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">;
-def coverage : Flag<["-", "--"], "coverage">;
+def coverage : Flag<["-", "--"], "coverage">, Flags<[CoreOption]>;
def cpp_precomp : Flag<["-"], "cpp-precomp">, Group<clang_ignored_f_Group>;
def current__version : JoinedOrSeparate<["-"], "current_version">;
def cxx_isystem : JoinedOrSeparate<["-"], "cxx-isystem">, Group<clang_i_Group>,
diff --git a/clang/test/Driver/coverage.c b/clang/test/Driver/coverage.c
new file mode 100644
index 00000000000..339c4a3f366
--- /dev/null
+++ b/clang/test/Driver/coverage.c
@@ -0,0 +1,7 @@
+// Test coverage flag.
+//
+// RUN: %clang_cl -### -coverage %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CLANG-CL-COVERAGE %s
+// CLANG-CL-COVERAGE-NOT: error:
+// CLANG-CL-COVERAGE-NOT: warning:
+// CLANG-CL-COVERAGE-NOT: argument unused
+// CLANG-CL-COVERAGE-NOT: unknown argument

Просмотреть файл

@ -7,9 +7,6 @@ var prefBranch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService).getBranch(null)
.QueryInterface(Ci.nsIPrefBranch);
var supportsString = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
const TEST_URI = "data:text/html;charset=utf-8,gcli-pref3";
function test() {
@ -101,9 +98,7 @@ function* spawnTest() {
},
]);
supportsString.data = remoteHostOrig;
prefBranch.setComplexValue("devtools.debugger.remote-host",
Ci.nsISupportsString, supportsString);
prefBranch.setStringPref("devtools.debugger.remote-host", remoteHostOrig);
yield helpers.closeToolbar(options);
yield helpers.closeTab(options);

Просмотреть файл

@ -7,9 +7,6 @@ var prefBranch = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService).getBranch(null)
.QueryInterface(Ci.nsIPrefBranch);
var supportsString = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
const TEST_URI = "data:text/html;charset=utf-8,gcli-settings";
function test() {
@ -114,10 +111,7 @@ function* spawnTest() {
// Cleanup
prefBranch.setBoolPref("devtools.gcli.hideIntro", hideIntroOrig);
prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig);
supportsString.data = remoteHostOrig;
prefBranch.setComplexValue("devtools.debugger.remote-host",
Components.interfaces.nsISupportsString,
supportsString);
prefBranch.setStringPref("devtools.debugger.remote-host", remoteHostOrig);
yield helpers.closeTab(options);
}

Просмотреть файл

@ -93,6 +93,7 @@ subsuite = clipboard
skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
[browser_inspector_highlighter-eyedropper-csp.js]
[browser_inspector_highlighter-eyedropper-events.js]
skip-if = os == 'win' # bug 1413442
[browser_inspector_highlighter-eyedropper-image.js]
[browser_inspector_highlighter-eyedropper-label.js]
[browser_inspector_highlighter-eyedropper-show-hide.js]

Просмотреть файл

@ -31,11 +31,6 @@ XPCOMUtils.defineLazyGetter(imports, 'prefBranch', function() {
return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
});
XPCOMUtils.defineLazyGetter(imports, 'supportsString', function() {
return Cc['@mozilla.org/supports-string;1']
.createInstance(Ci.nsISupportsString);
});
var util = require('./util/util');
/**
@ -266,10 +261,7 @@ Object.defineProperty(Setting.prototype, 'value', {
break;
case imports.prefBranch.PREF_STRING:
imports.supportsString.data = value;
imports.prefBranch.setComplexValue(this.name,
Ci.nsISupportsString,
imports.supportsString);
imports.prefBranch.setStringPref(this.name, value);
break;
default:

Просмотреть файл

@ -3274,7 +3274,7 @@ NS_IMETHODIMP
nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent)
{
mCustomUserAgent = aCustomUserAgent;
RefPtr<nsGlobalWindow> win = mScriptGlobal ?
RefPtr<nsGlobalWindowInner> win = mScriptGlobal ?
mScriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
if (win) {
Navigator* navigator = win->Navigator();
@ -3779,7 +3779,7 @@ static bool
ItemIsActive(nsIDocShellTreeItem* aItem)
{
if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) {
auto* win = nsGlobalWindow::Cast(window);
auto* win = nsGlobalWindowOuter::Cast(window);
MOZ_ASSERT(win->IsOuterWindow());
if (!win->GetClosedOuter()) {
return true;
@ -10619,8 +10619,8 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// applies to aURI.
CopyFavicon(currentURI, aURI, doc->NodePrincipal(), UsePrivateBrowsing());
RefPtr<nsGlobalWindow> scriptGlobal = mScriptGlobal;
RefPtr<nsGlobalWindow> win = scriptGlobal ?
RefPtr<nsGlobalWindowOuter> scriptGlobal = mScriptGlobal;
RefPtr<nsGlobalWindowInner> win = scriptGlobal ?
scriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
// ScrollToAnchor doesn't necessarily cause us to scroll the window;

Просмотреть файл

@ -77,7 +77,8 @@ typedef uint32_t ScreenOrientationInternal;
class nsDocShell;
class nsDOMNavigationTiming;
class nsGlobalWindow;
class nsGlobalWindowOuter;
class nsGlobalWindowInner;
class nsIController;
class nsIScrollableFrame;
class OnLinkClickEvent;
@ -918,7 +919,7 @@ protected:
nsCOMPtr<nsIURI> mCurrentURI;
nsCOMPtr<nsIURI> mReferrerURI;
uint32_t mReferrerPolicy;
RefPtr<nsGlobalWindow> mScriptGlobal;
RefPtr<nsGlobalWindowOuter> mScriptGlobal;
nsCOMPtr<nsISHistory> mSessionHistory;
nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
nsCOMPtr<nsIWebBrowserFind> mFind;

Просмотреть файл

@ -53,6 +53,7 @@ support-files =
[test_bug113934.xul]
[test_bug215405.xul]
[test_bug293235.xul]
skip-if = true # bug 1393441
[test_bug294258.xul]
[test_bug298622.xul]
[test_bug301397.xul]

Просмотреть файл

@ -42,7 +42,7 @@ AnimationUtils::LogAsyncAnimationFailure(nsCString& aMessage,
/* static */ nsIDocument*
AnimationUtils::GetCurrentRealmDocument(JSContext* aCx)
{
nsGlobalWindow* win = xpc::CurrentWindowOrNull(aCx);
nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aCx);
if (!win) {
return nullptr;
}

Просмотреть файл

@ -18,7 +18,7 @@ namespace dom {
//
// Basic (virtual) BarProp class implementation
//
BarProp::BarProp(nsGlobalWindow* aWindow)
BarProp::BarProp(nsGlobalWindowInner* aWindow)
: mDOMWindow(aWindow)
{
MOZ_ASSERT(aWindow->IsInnerWindow());
@ -106,7 +106,7 @@ BarProp::GetBrowserChrome()
// MenubarProp class implementation
//
MenubarProp::MenubarProp(nsGlobalWindow *aWindow)
MenubarProp::MenubarProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}
@ -132,7 +132,7 @@ MenubarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
// ToolbarProp class implementation
//
ToolbarProp::ToolbarProp(nsGlobalWindow *aWindow)
ToolbarProp::ToolbarProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}
@ -158,7 +158,7 @@ ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType, ErrorResult& aRv)
// LocationbarProp class implementation
//
LocationbarProp::LocationbarProp(nsGlobalWindow *aWindow)
LocationbarProp::LocationbarProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}
@ -186,7 +186,7 @@ LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
// PersonalbarProp class implementation
//
PersonalbarProp::PersonalbarProp(nsGlobalWindow *aWindow)
PersonalbarProp::PersonalbarProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}
@ -215,7 +215,7 @@ PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
// StatusbarProp class implementation
//
StatusbarProp::StatusbarProp(nsGlobalWindow *aWindow)
StatusbarProp::StatusbarProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}
@ -243,7 +243,7 @@ StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
// ScrollbarsProp class implementation
//
ScrollbarsProp::ScrollbarsProp(nsGlobalWindow *aWindow)
ScrollbarsProp::ScrollbarsProp(nsGlobalWindowInner *aWindow)
: BarProp(aWindow)
{
}

Просмотреть файл

@ -19,7 +19,7 @@
#include "nsPIDOMWindow.h"
#include "mozilla/dom/BindingDeclarations.h"
class nsGlobalWindow;
class nsGlobalWindowInner;
class nsIWebBrowserChrome;
namespace mozilla {
@ -33,7 +33,7 @@ class BarProp : public nsISupports,
public nsWrapperCache
{
public:
explicit BarProp(nsGlobalWindow *aWindow);
explicit BarProp(nsGlobalWindowInner *aWindow);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BarProp)
@ -56,14 +56,14 @@ protected:
already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
RefPtr<nsGlobalWindow> mDOMWindow;
RefPtr<nsGlobalWindowInner> mDOMWindow;
};
// Script "menubar" object
class MenubarProp final : public BarProp
{
public:
explicit MenubarProp(nsGlobalWindow *aWindow);
explicit MenubarProp(nsGlobalWindowInner *aWindow);
virtual ~MenubarProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
@ -75,7 +75,7 @@ public:
class ToolbarProp final : public BarProp
{
public:
explicit ToolbarProp(nsGlobalWindow *aWindow);
explicit ToolbarProp(nsGlobalWindowInner *aWindow);
virtual ~ToolbarProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
@ -87,7 +87,7 @@ public:
class LocationbarProp final : public BarProp
{
public:
explicit LocationbarProp(nsGlobalWindow *aWindow);
explicit LocationbarProp(nsGlobalWindowInner *aWindow);
virtual ~LocationbarProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
@ -99,7 +99,7 @@ public:
class PersonalbarProp final : public BarProp
{
public:
explicit PersonalbarProp(nsGlobalWindow *aWindow);
explicit PersonalbarProp(nsGlobalWindowInner *aWindow);
virtual ~PersonalbarProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
@ -111,7 +111,7 @@ public:
class StatusbarProp final : public BarProp
{
public:
explicit StatusbarProp(nsGlobalWindow *aWindow);
explicit StatusbarProp(nsGlobalWindowInner *aWindow);
virtual ~StatusbarProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;
@ -123,7 +123,7 @@ public:
class ScrollbarsProp final : public BarProp
{
public:
explicit ScrollbarsProp(nsGlobalWindow *aWindow);
explicit ScrollbarsProp(nsGlobalWindowInner *aWindow);
virtual ~ScrollbarsProp();
virtual bool GetVisible(CallerType aCallerType, ErrorResult& aRv) override;

Просмотреть файл

@ -515,7 +515,7 @@ Location::SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
nsIScriptContext* scriptContext = nullptr;
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(GetEntryGlobal());
if (win) {
scriptContext = nsGlobalWindow::Cast(win)->GetContextInternal();
scriptContext = nsGlobalWindowInner::Cast(win)->GetContextInternal();
}
if (scriptContext) {
@ -530,8 +530,7 @@ Location::SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
}
return SetURI(newUri, aReplace || inScriptTag);
}
}
return result;
}

Просмотреть файл

@ -1446,7 +1446,7 @@ Navigator::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads,
return;
}
NS_ENSURE_TRUE_VOID(mWindow->GetDocShell());
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
win->SetHasGamepadEventListener(true);
win->GetGamepads(aGamepads);
}
@ -1468,7 +1468,7 @@ Navigator::GetVRDisplays(ErrorResult& aRv)
return nullptr;
}
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
win->NotifyVREventListenerAdded();
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
@ -1505,7 +1505,7 @@ Navigator::GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const
if (!mWindow || !mWindow->GetDocShell()) {
return;
}
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
nsTArray<RefPtr<VRDisplay>> displays;
if (win->UpdateVRDisplays(displays)) {
for (auto display : displays) {
@ -1521,7 +1521,7 @@ Navigator::NotifyVRDisplaysUpdated()
{
// Synchronize the VR devices and resolve the promises in
// mVRGetDisplaysPromises
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
nsTArray<RefPtr<VRDisplay>> vrDisplays;
if (win->UpdateVRDisplays(vrDisplays)) {
@ -1546,7 +1546,7 @@ VRServiceTest*
Navigator::RequestVRServiceTest()
{
// Ensure that the Mock VR devices are not released prematurely
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
win->NotifyVREventListenerAdded();
if (!mVRServiceTest) {
@ -1558,21 +1558,21 @@ Navigator::RequestVRServiceTest()
bool
Navigator::IsWebVRContentDetected() const
{
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
return win->IsVRContentDetected();
}
bool
Navigator::IsWebVRContentPresenting() const
{
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
return win->IsVRContentPresenting();
}
void
Navigator::RequestVRPresentation(VRDisplay& aDisplay)
{
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
win->DispatchVRDisplayActivate(aDisplay.DisplayId(), VRDisplayEventReason::Requested);
}

Просмотреть файл

@ -29,9 +29,9 @@
namespace mozilla {
namespace dom {
PostMessageEvent::PostMessageEvent(nsGlobalWindow* aSource,
PostMessageEvent::PostMessageEvent(nsGlobalWindowOuter* aSource,
const nsAString& aCallerOrigin,
nsGlobalWindow* aTargetWindow,
nsGlobalWindowOuter* aTargetWindow,
nsIPrincipal* aProvidedPrincipal,
nsIDocument* aSourceDocument,
bool aTrustedCaller)
@ -76,7 +76,7 @@ PostMessageEvent::Run()
// If we bailed before this point we're going to leak mMessage, but
// that's probably better than crashing.
RefPtr<nsGlobalWindow> targetWindow;
RefPtr<nsGlobalWindowInner> targetWindow;
if (mTargetWindow->IsClosedOrClosing() ||
!(targetWindow = mTargetWindow->GetCurrentInnerWindowInternal()) ||
targetWindow->IsClosedOrClosing())
@ -176,7 +176,7 @@ PostMessageEvent::Run()
}
void
PostMessageEvent::DispatchError(JSContext* aCx, nsGlobalWindow* aTargetWindow,
PostMessageEvent::DispatchError(JSContext* aCx, nsGlobalWindowInner* aTargetWindow,
mozilla::dom::EventTarget* aEventTarget)
{
RootedDictionary<MessageEventInit> init(aCx);
@ -195,7 +195,7 @@ PostMessageEvent::DispatchError(JSContext* aCx, nsGlobalWindow* aTargetWindow,
}
void
PostMessageEvent::Dispatch(nsGlobalWindow* aTargetWindow, Event* aEvent)
PostMessageEvent::Dispatch(nsGlobalWindowInner* aTargetWindow, Event* aEvent)
{
// We can't simply call dispatchEvent on the window because doing so ends
// up flipping the trusted bit on the event, and we don't want that to

Просмотреть файл

@ -13,7 +13,8 @@
#include "nsTArray.h"
#include "nsThreadUtils.h"
class nsGlobalWindow;
class nsGlobalWindowOuter;
class nsGlobalWindowInner;
class nsIDocument;
class nsIPrincipal;
@ -30,9 +31,9 @@ class PostMessageEvent final : public Runnable
public:
NS_DECL_NSIRUNNABLE
PostMessageEvent(nsGlobalWindow* aSource,
PostMessageEvent(nsGlobalWindowOuter* aSource,
const nsAString& aCallerOrigin,
nsGlobalWindow* aTargetWindow,
nsGlobalWindowOuter* aTargetWindow,
nsIPrincipal* aProvidedPrincipal,
nsIDocument* aSourceDocument,
bool aTrustedCaller);
@ -41,15 +42,15 @@ private:
~PostMessageEvent();
void
Dispatch(nsGlobalWindow* aTargetWindow, Event* aEvent);
Dispatch(nsGlobalWindowInner* aTargetWindow, Event* aEvent);
void
DispatchError(JSContext* aCx, nsGlobalWindow* aTargetWindow,
DispatchError(JSContext* aCx, nsGlobalWindowInner* aTargetWindow,
mozilla::dom::EventTarget* aEventTarget);
RefPtr<nsGlobalWindow> mSource;
RefPtr<nsGlobalWindowOuter> mSource;
nsString mCallerOrigin;
RefPtr<nsGlobalWindow> mTargetWindow;
RefPtr<nsGlobalWindowOuter> mTargetWindow;
nsCOMPtr<nsIPrincipal> mProvidedPrincipal;
nsCOMPtr<nsIDocument> mSourceDocument;
bool mTrustedCaller;

Просмотреть файл

@ -613,7 +613,7 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
auto* win = nsGlobalWindow::Cast(doc->GetInnerWindow());
auto* win = nsGlobalWindowInner::Cast(doc->GetInnerWindow());
if (!win) {
return NS_OK;
}

Просмотреть файл

@ -69,7 +69,7 @@ public:
// keep decent binary packing.
// Window for which this timeout fires
RefPtr<nsGlobalWindow> mWindow;
RefPtr<nsGlobalWindowInner> mWindow;
// The language-specific information about the callback.
nsCOMPtr<nsITimeoutHandler> mScriptHandler;

Просмотреть файл

@ -395,7 +395,7 @@ int32_t gDisableOpenClickDelay;
} // anonymous namespace
TimeoutManager::TimeoutManager(nsGlobalWindow& aWindow)
TimeoutManager::TimeoutManager(nsGlobalWindowInner& aWindow)
: mWindow(aWindow),
mExecutor(new TimeoutExecutor(this)),
mNormalTimeouts(*this),
@ -1194,7 +1194,7 @@ class ThrottleTimeoutsCallback final : public nsITimerCallback
, public nsINamed
{
public:
explicit ThrottleTimeoutsCallback(nsGlobalWindow* aWindow)
explicit ThrottleTimeoutsCallback(nsGlobalWindowInner* aWindow)
: mWindow(aWindow)
{
MOZ_DIAGNOSTIC_ASSERT(aWindow->IsInnerWindow());
@ -1215,7 +1215,7 @@ private:
private:
// The strong reference here keeps the Window and hence the TimeoutManager
// object itself alive.
RefPtr<nsGlobalWindow> mWindow;
RefPtr<nsGlobalWindowInner> mWindow;
};
NS_IMPL_ISUPPORTS(ThrottleTimeoutsCallback, nsITimerCallback, nsINamed)

Просмотреть файл

@ -12,7 +12,7 @@
class nsIEventTarget;
class nsITimeoutHandler;
class nsGlobalWindow;
class nsGlobalWindowInner;
namespace mozilla {
namespace dom {
@ -24,7 +24,7 @@ class TimeoutExecutor;
class TimeoutManager final
{
public:
explicit TimeoutManager(nsGlobalWindow& aWindow);
explicit TimeoutManager(nsGlobalWindowInner& aWindow);
~TimeoutManager();
TimeoutManager(const TimeoutManager& rhs) = delete;
void operator=(const TimeoutManager& rhs) = delete;
@ -215,9 +215,9 @@ private:
friend class OrderedTimeoutIterator;
// Each nsGlobalWindow object has a TimeoutManager member. This reference
// Each nsGlobalWindowInner object has a TimeoutManager member. This reference
// points to that holder object.
nsGlobalWindow& mWindow;
nsGlobalWindowInner& mWindow;
// The executor is specific to the nsGlobalWindow/TimeoutManager, but it
// can live past the destruction of the window if its scheduled. Therefore
// it must be a separate ref-counted object.

Просмотреть файл

@ -1697,7 +1697,7 @@ WebSocketImpl::Init(JSContext* aCx,
if (innerWindow == currentInnerWindow) {
ErrorResult error;
parentWindow =
nsGlobalWindow::Cast(innerWindow)->GetOpenerWindow(error);
nsGlobalWindowInner::Cast(innerWindow)->GetOpenerWindow(error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return NS_ERROR_DOM_SECURITY_ERR;

Просмотреть файл

@ -106,7 +106,7 @@ WindowNamedPropertiesHandler::getOwnPropDescriptor(JSContext* aCx,
// Grab the DOM window.
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, aProxy));
nsGlobalWindow* win = xpc::WindowOrNull(global);
nsGlobalWindowInner* win = xpc::WindowOrNull(global);
if (win->Length() > 0) {
nsCOMPtr<nsPIDOMWindowOuter> childWin = win->GetChildWindow(str);
if (childWin && ShouldExposeChildWindow(str, childWin)) {
@ -178,10 +178,10 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx,
}
// Grab the DOM window.
nsGlobalWindow* win = xpc::WindowOrNull(JS_GetGlobalForObject(aCx, aProxy));
nsGlobalWindowInner* win = xpc::WindowOrNull(JS_GetGlobalForObject(aCx, aProxy));
nsTArray<nsString> names;
// The names live on the outer window, which might be null
nsGlobalWindow* outer = win->GetOuterWindowInternal();
nsGlobalWindowOuter* outer = win->GetOuterWindowInternal();
if (outer) {
nsDOMWindowList* childWindows = outer->GetWindowList();
if (childWindows) {

Просмотреть файл

@ -12,13 +12,13 @@
using namespace mozilla::dom;
/**
* This class is used by nsGlobalWindow to implement window.orientation
* This class is used by nsGlobalWindowInner to implement window.orientation
* and window.onorientationchange. This class is defined in its own file
* because Hal.h pulls in windows.h and can't be included from
* nsGlobalWindow.cpp
*/
WindowOrientationObserver::WindowOrientationObserver(
nsGlobalWindow* aGlobalWindow)
nsGlobalWindowInner* aGlobalWindow)
: mWindow(aGlobalWindow)
{
MOZ_ASSERT(aGlobalWindow && aGlobalWindow->IsInnerWindow());

Просмотреть файл

@ -9,7 +9,7 @@
#include "mozilla/HalScreenConfiguration.h"
class nsGlobalWindow;
class nsGlobalWindowInner;
namespace mozilla {
namespace dom {
@ -18,14 +18,14 @@ class WindowOrientationObserver final :
public mozilla::hal::ScreenConfigurationObserver
{
public:
explicit WindowOrientationObserver(nsGlobalWindow* aGlobalWindow);
explicit WindowOrientationObserver(nsGlobalWindowInner* aGlobalWindow);
~WindowOrientationObserver();
void Notify(const mozilla::hal::ScreenConfiguration& aConfiguration) override;
static int16_t OrientationAngle();
private:
// Weak pointer, instance is owned by mWindow.
nsGlobalWindow* MOZ_NON_OWNING_REF mWindow;
nsGlobalWindowInner* MOZ_NON_OWNING_REF mWindow;
uint16_t mAngle;
};

Просмотреть файл

@ -212,7 +212,7 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
if (elm) {
elm->MarkForCC();
}
static_cast<nsGlobalWindow*>(win.get())->AsInner()->
static_cast<nsGlobalWindowInner*>(win.get())->AsInner()->
TimeoutManager().UnmarkGrayTimers();
}
} else if (aPrepareForCC) {
@ -503,12 +503,12 @@ mozilla::dom::TraceBlackJS(JSTracer* aTrc, uint32_t aGCNumber, bool aIsShutdownG
}
// Mark globals of active windows black.
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowOuter::OuterWindowByIdTable* windowsById =
nsGlobalWindowOuter::GetWindowsTable();
if (windowsById) {
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
nsGlobalWindow* window = iter.Data();
if (!window->IsCleanedUp() && window->IsOuterWindow()) {
nsGlobalWindowOuter* window = iter.Data();
if (!window->IsCleanedUp()) {
window->TraceGlobalJSObject(aTrc);
EventListenerManager* elm = window->GetExistingListenerManager();
if (elm) {

Просмотреть файл

@ -71,6 +71,7 @@
#include "mozilla/ManualNAC.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/TextEvents.h"
#include "nsArrayUtils.h"
@ -164,6 +165,7 @@
#include "nsIParser.h"
#include "nsIPermissionManager.h"
#include "nsIPluginHost.h"
#include "nsIRemoteBrowser.h"
#include "nsIRequest.h"
#include "nsIRunnable.h"
#include "nsIScriptContext.h"
@ -4739,7 +4741,8 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument,
return nullptr;
}
RefPtr<nsGlobalWindow> window = nsGlobalWindow::GetOuterWindowWithId(aOuterWindowId);
RefPtr<nsGlobalWindowOuter> window =
nsGlobalWindowOuter::GetOuterWindowWithId(aOuterWindowId);
if (!window) {
return nullptr;
}
@ -9891,7 +9894,7 @@ nsContentUtils::IsSpecificAboutPage(JSObject* aGlobal, const char* aUri)
MOZ_ASSERT(strncmp(aUri, "about:", 6) == 0);
// Make sure the global is a window
nsGlobalWindow* win = xpc::WindowGlobalOrNull(aGlobal);
nsGlobalWindowInner* win = xpc::WindowGlobalOrNull(aGlobal);
if (!win) {
return false;
}
@ -10588,6 +10591,40 @@ nsContentUtils::CreateJSValueFromSequenceOfObject(JSContext* aCx,
return NS_OK;
}
/* static */
bool
nsContentUtils::ShouldBlockReservedKeys(WidgetKeyboardEvent* aKeyEvent)
{
nsCOMPtr<nsIPrincipal> principal;
nsCOMPtr<nsIRemoteBrowser> targetBrowser = do_QueryInterface(aKeyEvent->mOriginalTarget);
if (targetBrowser) {
targetBrowser->GetContentPrincipal(getter_AddRefs(principal));
}
else {
// Get the top-level document.
nsCOMPtr<nsIContent> content = do_QueryInterface(aKeyEvent->mOriginalTarget);
if (content) {
nsIDocument* doc = content->GetUncomposedDoc();
if (doc) {
nsCOMPtr<nsIDocShellTreeItem> docShell = doc->GetDocShell();
if (docShell && docShell->ItemType() == nsIDocShellTreeItem::typeContent) {
nsCOMPtr<nsIDocShellTreeItem> rootItem;
docShell->GetSameTypeRootTreeItem(getter_AddRefs(rootItem));
if (rootItem && rootItem->GetDocument()) {
principal = rootItem->GetDocument()->NodePrincipal();
}
}
}
}
}
if (principal) {
return nsContentUtils::IsSitePermDeny(principal, "shortcuts");
}
return false;
}
/* static */ Element*
nsContentUtils::GetClosestNonNativeAnonymousAncestor(Element* aElement)
{
@ -10733,7 +10770,8 @@ nsContentUtils::GetEventTargetByLoadInfo(nsILoadInfo* aLoadInfo, TaskCategory aC
// something else.
return nullptr;
}
RefPtr<nsGlobalWindow> window = nsGlobalWindow::GetOuterWindowWithId(outerWindowId);
RefPtr<nsGlobalWindowOuter> window =
nsGlobalWindowOuter::GetOuterWindowWithId(outerWindowId);
if (!window) {
return nullptr;
}
@ -10910,6 +10948,42 @@ nsContentUtils::IsOverridingWindowName(const nsAString& aName)
!aName.LowerCaseEqualsLiteral("_self");
}
// Unfortunately, we can't unwrap an IDL object using only a concrete type.
// We need to calculate type data based on the IDL typename. Which means
// wrapping our templated function in a macro.
#define EXTRACT_EXN_VALUES(T, ...) \
ExtractExceptionValues<mozilla::dom::prototypes::id::T, \
T##Binding::NativeType, T>(__VA_ARGS__).isOk()
template <prototypes::ID PrototypeID, class NativeType, typename T>
static Result<Ok, nsresult>
ExtractExceptionValues(JSContext* aCx,
JS::HandleObject aObj,
nsACString& aSourceSpecOut,
uint32_t* aLineOut,
uint32_t* aColumnOut,
nsString& aMessageOut)
{
RefPtr<T> exn;
MOZ_TRY((UnwrapObject<PrototypeID, NativeType>(aObj, exn)));
nsAutoString filename;
exn->GetFilename(aCx, filename);
if (!filename.IsEmpty()) {
CopyUTF16toUTF8(filename, aSourceSpecOut);
*aLineOut = exn->LineNumber(aCx);
*aColumnOut = exn->ColumnNumber();
}
exn->GetName(aMessageOut);
aMessageOut.AppendLiteral(": ");
nsAutoString message;
exn->GetMessageMoz(message);
aMessageOut.Append(message);
return Ok();
}
/* static */ void
nsContentUtils::ExtractErrorValues(JSContext* aCx,
JS::Handle<JS::Value> aValue,
@ -10923,7 +10997,6 @@ nsContentUtils::ExtractErrorValues(JSContext* aCx,
if (aValue.isObject()) {
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
RefPtr<dom::DOMException> domException;
// Try to process as an Error object. Use the file/line/column values
// from the Error as they will be more specific to the root cause of
@ -10947,22 +11020,15 @@ nsContentUtils::ExtractErrorValues(JSContext* aCx,
}
// Next, try to unwrap the rejection value as a DOMException.
else if(NS_SUCCEEDED(UNWRAP_OBJECT(DOMException, obj, domException))) {
else if (EXTRACT_EXN_VALUES(DOMException, aCx, obj, aSourceSpecOut,
aLineOut, aColumnOut, aMessageOut)) {
return;
}
nsAutoString filename;
domException->GetFilename(aCx, filename);
if (!filename.IsEmpty()) {
CopyUTF16toUTF8(filename, aSourceSpecOut);
*aLineOut = domException->LineNumber(aCx);
*aColumnOut = domException->ColumnNumber();
}
domException->GetName(aMessageOut);
aMessageOut.AppendLiteral(": ");
nsAutoString message;
domException->GetMessageMoz(message);
aMessageOut.Append(message);
// Next, try to unwrap the rejection value as an XPC Exception.
else if (EXTRACT_EXN_VALUES(Exception, aCx, obj, aSourceSpecOut,
aLineOut, aColumnOut, aMessageOut)) {
return;
}
}
@ -10979,6 +11045,8 @@ nsContentUtils::ExtractErrorValues(JSContext* aCx,
}
}
#undef EXTRACT_EXN_VALUES
/* static */ bool
nsContentUtils::DevToolsEnabled(JSContext* aCx)
{

Просмотреть файл

@ -3128,6 +3128,12 @@ public:
static bool
IsWebComponentsEnabled() { return sIsWebComponentsEnabled; }
/**
* Returns true if reserved key events should be prevented from being sent
* to their target. Instead, the key event should be handled by chrome only.
*/
static bool ShouldBlockReservedKeys(mozilla::WidgetKeyboardEvent* aKeyEvent);
/**
* Walks up the tree from aElement until it finds an element that is
* not native anonymous content. aElement must be NAC itself.
@ -3411,6 +3417,7 @@ private:
static int32_t sBytecodeCacheStrategy;
static uint32_t sCookiesLifetimePolicy;
static uint32_t sCookiesBehavior;
static bool sShortcutsCustomized;
static int32_t sPrivacyMaxInnerWidth;
static int32_t sPrivacyMaxInnerHeight;

Просмотреть файл

@ -226,7 +226,7 @@ FindObjectClass(JSContext* cx, JSObject* aGlobalObject)
// Helper to handle torn-down inner windows.
static inline nsresult
SetParentToWindow(nsGlobalWindow *win, JSObject **parent)
SetParentToWindow(nsGlobalWindowInner *win, JSObject **parent)
{
MOZ_ASSERT(win);
MOZ_ASSERT(win->IsInnerWindow());
@ -724,7 +724,7 @@ nsDOMClassInfo::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
static nsresult
ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindowInner *aWin, JSContext *cx,
JS::Handle<JSObject*> obj, const char16_t *name,
const nsDOMClassInfoData *ci_data,
const nsGlobalNameStruct *name_struct,
@ -781,7 +781,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, proto));
// Only do this if the global object is a window.
nsGlobalWindow* win;
nsGlobalWindowInner* win;
if (NS_FAILED(UNWRAP_OBJECT(Window, &global, win))) {
// Not a window.
return NS_OK;
@ -803,9 +803,9 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
NS_ENSURE_TRUE(nameSpaceManager, NS_OK);
JS::Rooted<JS::PropertyDescriptor> desc(cx);
nsresult rv = ResolvePrototype(sXPConnect, win, cx, global, mData->mNameUTF16,
mData, nullptr, nameSpaceManager, proto,
&desc);
nsresult rv = ResolvePrototype(sXPConnect, win->AssertInner(), cx, global,
mData->mNameUTF16, mData, nullptr,
nameSpaceManager, proto, &desc);
NS_ENSURE_SUCCESS(rv, rv);
if (!contentDefinedProperty && desc.object() && !desc.value().isUndefined()) {
desc.attributesRef() |= JSPROP_RESOLVING;
@ -1077,7 +1077,7 @@ nsDOMConstructor::PreCreate(JSContext *cx, JSObject *globalObj, JSObject **paren
return NS_OK;
}
nsGlobalWindow *win = nsGlobalWindow::Cast(owner);
nsGlobalWindowInner *win = nsGlobalWindowInner::Cast(owner);
return SetParentToWindow(win, parentObj);
}
@ -1273,7 +1273,7 @@ nsDOMConstructor::ToString(nsAString &aResult)
static nsresult
GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindowInner *aWin,
const nsGlobalNameStruct *aNameStruct,
JS::MutableHandle<JSObject*> aProto)
{
@ -1298,7 +1298,7 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
// Either ci_data must be non-null or name_struct must be non-null and of type
// eTypeClassProto.
static nsresult
ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindowInner *aWin, JSContext *cx,
JS::Handle<JSObject*> obj, const char16_t *name,
const nsDOMClassInfoData *ci_data,
const nsGlobalNameStruct *name_struct,
@ -1462,7 +1462,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
static bool
OldBindingConstructorEnabled(const nsGlobalNameStruct *aStruct,
nsGlobalWindow *aWin, JSContext *cx)
nsGlobalWindowInner *aWin, JSContext *cx)
{
MOZ_ASSERT(aStruct->mType == nsGlobalNameStruct::eTypeProperty ||
aStruct->mType == nsGlobalNameStruct::eTypeClassConstructor);
@ -1491,7 +1491,7 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
// static
bool
nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
const nsAString& aName,
const nsGlobalNameStruct& aNameStruct)
{
@ -1521,7 +1521,7 @@ static const JSClass XULControllersShimClass = {
// static
nsresult
nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
nsWindowSH::GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::PropertyDescriptor> desc)
{

Просмотреть файл

@ -21,6 +21,7 @@
struct nsGlobalNameStruct;
class nsGlobalWindow;
class nsGlobalWindowInner;
struct nsDOMClassInfoData;
@ -140,13 +141,13 @@ public:
class nsWindowSH
{
protected:
static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
static nsresult GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::PropertyDescriptor> desc);
friend class nsGlobalWindow;
public:
static bool NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
static bool NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
const nsAString& aName,
const nsGlobalNameStruct& aNameStruct);
};

Просмотреть файл

@ -626,7 +626,7 @@ protected:
bool Suppressed()
{
return mOwner && nsGlobalWindow::Cast(mOwner)->IsInSyncOperation();
return mOwner && nsGlobalWindowInner::Cast(mOwner)->IsInSyncOperation();
}
static void HandleMutationsInternal(mozilla::AutoSlowOperation& aAso);

Просмотреть файл

@ -208,7 +208,7 @@ NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsDOMWindowUtils)
NS_IMPL_RELEASE(nsDOMWindowUtils)
nsDOMWindowUtils::nsDOMWindowUtils(nsGlobalWindow *aWindow)
nsDOMWindowUtils::nsDOMWindowUtils(nsGlobalWindowOuter *aWindow)
{
nsCOMPtr<nsISupports> supports = do_QueryObject(aWindow);
mWindow = do_GetWeakReference(supports);
@ -2357,7 +2357,7 @@ nsDOMWindowUtils::IsInModalState(bool *retval)
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*retval = nsGlobalWindow::Cast(window)->IsInModalState();
*retval = nsGlobalWindowOuter::Cast(window)->IsInModalState();
return NS_OK;
}
@ -2389,8 +2389,8 @@ nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
NS_ASSERTION(window->IsOuterWindow(), "How did that happen?");
nsGlobalWindow* inner =
nsGlobalWindow::Cast(window)->GetCurrentInnerWindowInternal();
nsGlobalWindowInner* inner =
nsGlobalWindowOuter::Cast(window)->GetCurrentInnerWindowInternal();
if (!inner) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -3268,7 +3268,7 @@ nsDOMWindowUtils::EnableDialogs()
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsGlobalWindow::Cast(window)->EnableDialogs();
nsGlobalWindowOuter::Cast(window)->EnableDialogs();
return NS_OK;
}
@ -3278,7 +3278,7 @@ nsDOMWindowUtils::DisableDialogs()
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsGlobalWindow::Cast(window)->DisableDialogs();
nsGlobalWindowOuter::Cast(window)->DisableDialogs();
return NS_OK;
}
@ -3288,7 +3288,7 @@ nsDOMWindowUtils::AreDialogsEnabled(bool* aResult)
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
*aResult = nsGlobalWindow::Cast(window)->AreDialogsEnabled();
*aResult = nsGlobalWindowOuter::Cast(window)->AreDialogsEnabled();
return NS_OK;
}
@ -3796,7 +3796,7 @@ nsDOMWindowUtils::AllowScriptsToClose()
{
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsGlobalWindow::Cast(window)->AllowScriptsToClose();
nsGlobalWindowOuter::Cast(window)->AllowScriptsToClose();
return NS_OK;
}

Просмотреть файл

@ -13,7 +13,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/BasicEvents.h"
class nsGlobalWindow;
class nsGlobalWindowOuter;
class nsIPresShell;
class nsIWidget;
class nsPresContext;
@ -62,7 +62,7 @@ class nsDOMWindowUtils final : public nsIDOMWindowUtils,
typedef mozilla::widget::TextEventDispatcher
TextEventDispatcher;
public:
explicit nsDOMWindowUtils(nsGlobalWindow *aWindow);
explicit nsDOMWindowUtils(nsGlobalWindowOuter *aWindow);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMWINDOWUTILS

Просмотреть файл

@ -91,7 +91,6 @@
#include "nsContentCID.h"
#include "nsError.h"
#include "nsPresContext.h"
#include "nsIJSON.h"
#include "nsThreadUtils.h"
#include "nsNodeInfoManager.h"
#include "nsIFileChannel.h"
@ -2490,7 +2489,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
// Refresh the principal on the compartment.
if (nsPIDOMWindowInner* win = GetInnerWindow()) {
nsGlobalWindow::Cast(win)->RefreshCompartmentPrincipal();
nsGlobalWindowInner::Cast(win)->RefreshCompartmentPrincipal();
}
}
@ -6378,7 +6377,7 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
JS::Rooted<JSObject*> global(aCx,
JS_GetGlobalForObject(aCx, &args.callee()));
RefPtr<nsGlobalWindow> window;
RefPtr<nsGlobalWindowInner> window;
UNWRAP_OBJECT(Window, global, window);
MOZ_ASSERT(window, "Should have a non-null window");
@ -7201,7 +7200,7 @@ nsIDocument::GetLocation() const
return nullptr;
}
nsGlobalWindow* window = nsGlobalWindow::Cast(w);
nsGlobalWindowInner* window = nsGlobalWindowInner::Cast(w);
RefPtr<Location> loc = window->GetLocation();
return loc.forget();
}
@ -8470,7 +8469,7 @@ nsDocument::GetEventTargetParent(EventChainPreVisitor& aVisitor)
// Load events must not propagate to |window| object, see bug 335251.
if (aVisitor.mEvent->mMessage != eLoad) {
nsGlobalWindow* window = nsGlobalWindow::Cast(GetWindow());
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(GetWindow());
aVisitor.mParentTarget =
window ? window->GetTargetForEventTargetChain() : nullptr;
}
@ -9158,7 +9157,7 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
if (win) {
auto* globalWindow = nsGlobalWindow::Cast(win);
auto* globalWindow = nsGlobalWindowInner::Cast(win);
#ifdef MOZ_WEBSPEECH
if (globalWindow->HasActiveSpeechSynthesis()) {
return false;
@ -10886,7 +10885,7 @@ nsDocument::NotifyMediaFeatureValuesChanged()
}
already_AddRefed<Touch>
nsIDocument::CreateTouch(nsGlobalWindow* aView,
nsIDocument::CreateTouch(nsGlobalWindowInner* aView,
EventTarget* aTarget,
int32_t aIdentifier,
int32_t aPageX, int32_t aPageY,
@ -14322,7 +14321,7 @@ nsIDocument::GetSelection(ErrorResult& aRv)
return nullptr;
}
return nsGlobalWindow::Cast(window)->GetSelection(aRv);
return nsGlobalWindowInner::Cast(window)->GetSelection(aRv);
}
void

Просмотреть файл

@ -1602,7 +1602,7 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
#ifdef XP_WIN
// Native plugin windows used by this remote content need to be reparented.
if (nsPIDOMWindowOuter* newWin = ourDoc->GetWindow()) {
RefPtr<nsIWidget> newParent = nsGlobalWindow::Cast(newWin)->GetMainWidget();
RefPtr<nsIWidget> newParent = nsGlobalWindowOuter::Cast(newWin)->GetMainWidget();
const ManagedContainer<mozilla::plugins::PPluginWidgetParent>& plugins =
aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
for (auto iter = plugins.ConstIter(); !iter.Done(); iter.Next()) {
@ -3840,8 +3840,8 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
return success ? NS_OK : NS_ERROR_FAILURE;
}
nsGlobalWindow* outerWindow =
nsGlobalWindow::GetOuterWindowWithId(aOuterWindowID);
nsGlobalWindowOuter* outerWindow =
nsGlobalWindowOuter::GetOuterWindowWithId(aOuterWindowID);
if (NS_WARN_IF(!outerWindow)) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -288,7 +288,8 @@ using mozilla::dom::cache::CacheStorage;
static LazyLogModule gDOMLeakPRLog("DOMLeak");
nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sWindowsById = nullptr;
nsGlobalWindowInner::InnerWindowByIdTable *nsGlobalWindowInner::sInnerWindowsById = nullptr;
nsGlobalWindowOuter::OuterWindowByIdTable *nsGlobalWindowOuter::sOuterWindowsById = nullptr;
bool nsGlobalWindow::sIdleObserversAPIFuzzTimeDisabled = false;
static int32_t gRefCnt = 0;
@ -891,7 +892,7 @@ public:
nsresult Call() override
{
return nsGlobalWindow::Cast(mWindow)->RunIdleRequest(mIdleRequest, 0.0, true);
return nsGlobalWindowInner::Cast(mWindow)->RunIdleRequest(mIdleRequest, 0.0, true);
}
private:
@ -1016,7 +1017,7 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
{
if (aOuterWindow) {
mTimeoutManager =
MakeUnique<mozilla::dom::TimeoutManager>(*nsGlobalWindow::Cast(AsInner()));
MakeUnique<mozilla::dom::TimeoutManager>(*nsGlobalWindowInner::Cast(AsInner()));
}
}
@ -1426,7 +1427,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx,
found = true;
// Just return the window's global
nsGlobalWindow* global = nsGlobalWindow::Cast(frame);
nsGlobalWindowOuter* global = nsGlobalWindowOuter::Cast(frame);
frame->EnsureInnerWindow();
JSObject* obj = global->FastGetGlobalJSObject();
// This null check fixes a hard-to-reproduce crash that occurs when we
@ -1672,14 +1673,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
("DOMWINDOW %p created outer=%p", this, aOuterWindow));
NS_ASSERTION(sWindowsById, "Windows hash table must be created!");
NS_ASSERTION(!sWindowsById->Get(mWindowID),
"This window shouldn't be in the hash table yet!");
// We seem to see crashes in release builds because of null |sWindowsById|.
if (sWindowsById) {
sWindowsById->Put(mWindowID, this);
}
}
#ifdef DEBUG
@ -1701,7 +1694,10 @@ nsGlobalWindow::Init()
NS_ASSERTION(gDOMLeakPRLog, "gDOMLeakPRLog should have been initialized!");
sWindowsById = new WindowByIdTable();
nsGlobalWindowOuter::sOuterWindowsById =
new nsGlobalWindowOuter::OuterWindowByIdTable();
nsGlobalWindowInner::sInnerWindowsById =
new nsGlobalWindowInner::InnerWindowByIdTable();
}
nsGlobalWindow::~nsGlobalWindow()
@ -1724,12 +1720,18 @@ nsGlobalWindow::~nsGlobalWindow()
DisconnectEventTargetObjects();
// We have to check if sWindowsById isn't null because ::Shutdown might have
// been called.
if (sWindowsById) {
NS_ASSERTION(sWindowsById->Get(mWindowID),
if (IsOuterWindow()) {
if (nsGlobalWindowOuter::sOuterWindowsById) {
MOZ_ASSERT(nsGlobalWindowOuter::sOuterWindowsById->Get(mWindowID),
"This window should be in the hash table");
sWindowsById->Remove(mWindowID);
nsGlobalWindowOuter::sOuterWindowsById->Remove(mWindowID);
}
} else {
if (nsGlobalWindowInner::sInnerWindowsById) {
MOZ_ASSERT(nsGlobalWindowInner::sInnerWindowsById->Get(mWindowID),
"This window should be in the hash table");
nsGlobalWindowInner::sInnerWindowsById->Remove(mWindowID);
}
}
--gRefCnt;
@ -1747,7 +1749,7 @@ nsGlobalWindow::~nsGlobalWindow()
}
}
nsGlobalWindow* outer = nsGlobalWindow::Cast(mOuterWindow);
nsGlobalWindowOuter* outer = nsGlobalWindowOuter::Cast(mOuterWindow);
printf_stderr("--DOMWINDOW == %d (%p) [pid = %d] [serial = %d] [outer = %p] [url = %s]\n",
gRefCnt,
static_cast<void*>(ToCanonicalSupports(this)),
@ -1858,8 +1860,10 @@ nsGlobalWindow::ShutDown()
}
gDumpFile = nullptr;
delete sWindowsById;
sWindowsById = nullptr;
delete nsGlobalWindowInner::sInnerWindowsById;
nsGlobalWindowInner::sInnerWindowsById = nullptr;
delete nsGlobalWindowOuter::sOuterWindowsById;
nsGlobalWindowOuter::sOuterWindowsById = nullptr;
}
// static
@ -2064,7 +2068,7 @@ nsGlobalWindow::FreeInnerObjects()
// re-create.
NotifyDOMWindowDestroyed(this);
if (auto* reporter = nsWindowMemoryReporter::Get()) {
reporter->ObserveDOMWindowDetached(this);
reporter->ObserveDOMWindowDetached(AssertInner());
}
mInnerObjectsFreed = true;
@ -2354,7 +2358,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
#endif
if (tmp->mOuterWindow) {
nsGlobalWindow::Cast(tmp->mOuterWindow)->MaybeClearInnerWindow(tmp);
nsGlobalWindowOuter::Cast(tmp->mOuterWindow)->MaybeClearInnerWindow(tmp);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOuterWindow)
}
@ -2791,7 +2795,7 @@ nsGlobalWindow::ComputeIsSecureContext(nsIDocument* aDocument, SecureContextFlag
nsPIDOMWindowOuter* parentOuterWin = GetScriptableParent();
MOZ_ASSERT(parentOuterWin, "How can we get here? No docShell somehow?");
if (nsGlobalWindow::Cast(parentOuterWin) != this) {
if (nsGlobalWindowOuter::Cast(parentOuterWin) != this) {
// There may be a small chance that parentOuterWin has navigated in
// the time that it took us to start loading this sub-document. If that
// were the case then parentOuterWin->GetCurrentInnerWindow() wouldn't
@ -2803,13 +2807,13 @@ nsGlobalWindow::ComputeIsSecureContext(nsIDocument* aDocument, SecureContextFlag
if (!creatorDoc) {
return false; // we must be tearing down
}
nsGlobalWindow* parentWin =
nsGlobalWindow::Cast(creatorDoc->GetInnerWindow());
nsGlobalWindowInner* parentWin =
nsGlobalWindowInner::Cast(creatorDoc->GetInnerWindow());
if (!parentWin) {
return false; // we must be tearing down
}
MOZ_ASSERT(parentWin ==
nsGlobalWindow::Cast(parentOuterWin->GetCurrentInnerWindow()),
nsGlobalWindowInner::Cast(parentOuterWin->GetCurrentInnerWindow()),
"Creator window mismatch while setting Secure Context state");
if (aFlags != SecureContextFlags::eIgnoreOpener) {
hadNonSecureContextCreator = !parentWin->IsSecureContext();
@ -2882,7 +2886,7 @@ SelectZoneGroup(nsGlobalWindow* aNewInner,
// go through one iteration of this loop.
RefPtr<TabGroup> tabGroup = aNewInner->TabGroup();
for (nsPIDOMWindowOuter* outer : tabGroup->GetWindows()) {
nsGlobalWindow* window = nsGlobalWindow::Cast(outer);
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(outer);
if (JSObject* global = window->GetGlobalJSObject()) {
return aOptions.setNewZoneInExistingZoneGroup(global);
}
@ -2898,7 +2902,7 @@ SelectZoneGroup(nsGlobalWindow* aNewInner,
*/
static nsresult
CreateNativeGlobalForInner(JSContext* aCx,
nsGlobalWindow* aNewInner,
nsGlobalWindowInner* aNewInner,
nsIURI* aURI,
nsIPrincipal* aPrincipal,
JS::MutableHandle<JSObject*> aGlobal,
@ -3138,7 +3142,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
mCreatingInnerWindow = true;
// Every script context we are initialized with must create a
// new global.
rv = CreateNativeGlobalForInner(cx, newInnerWindow,
rv = CreateNativeGlobalForInner(cx, newInnerWindow->AssertInner(),
aDocument->GetDocumentURI(),
aDocument->NodePrincipal(),
&newInnerGlobal,
@ -3489,7 +3493,8 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
mDocShell = aDocShell; // Weak Reference
nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup || mTabGroup == Cast(parentWindow)->mTabGroup);
MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup ||
mTabGroup == nsGlobalWindowOuter::Cast(parentWindow)->mTabGroup);
mTopLevelOuterContentWindow =
!mIsChrome && GetScriptableTopInternal() == this;
@ -3547,9 +3552,8 @@ nsGlobalWindow::DetachFromDocShell()
inner->FreeInnerObjects();
}
if (auto* reporter = nsWindowMemoryReporter::Get()) {
reporter->ObserveDOMWindowDetached(this);
}
// Don't report that we were detached to the nsWindowMemoryReporter, as it
// only tracks inner windows.
NotifyWindowIDDestroyed("outer-window-destroyed");
@ -3622,7 +3626,7 @@ nsGlobalWindow::SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
// contentOpener is not used when the DIAGNOSTIC_ASSERT is compiled out.
mozilla::Unused << contentOpener;
MOZ_DIAGNOSTIC_ASSERT(!contentOpener || !mTabGroup ||
mTabGroup == Cast(contentOpener)->mTabGroup);
mTabGroup == nsGlobalWindowOuter::Cast(contentOpener)->mTabGroup);
if (aOriginalOpener) {
MOZ_ASSERT(!mHadOriginalOpener,
@ -4203,16 +4207,16 @@ nsPIDOMWindowInner::UnmuteAudioContexts()
}
}
nsGlobalWindow*
nsGlobalWindowInner*
nsGlobalWindow::Window()
{
return this;
return AssertInner();
}
nsGlobalWindow*
nsGlobalWindowInner*
nsGlobalWindow::Self()
{
return this;
return AssertInner();
}
Navigator*
@ -4324,43 +4328,43 @@ nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded()
bool
nsPIDOMWindowInner::IsSecureContext() const
{
return nsGlobalWindow::Cast(this)->IsSecureContext();
return nsGlobalWindowInner::Cast(this)->IsSecureContext();
}
bool
nsPIDOMWindowInner::IsSecureContextIfOpenerIgnored() const
{
return nsGlobalWindow::Cast(this)->IsSecureContextIfOpenerIgnored();
return nsGlobalWindowInner::Cast(this)->IsSecureContextIfOpenerIgnored();
}
void
nsPIDOMWindowInner::Suspend()
{
nsGlobalWindow::Cast(this)->Suspend();
nsGlobalWindowInner::Cast(this)->Suspend();
}
void
nsPIDOMWindowInner::Resume()
{
nsGlobalWindow::Cast(this)->Resume();
nsGlobalWindowInner::Cast(this)->Resume();
}
void
nsPIDOMWindowInner::Freeze()
{
nsGlobalWindow::Cast(this)->Freeze();
nsGlobalWindowInner::Cast(this)->Freeze();
}
void
nsPIDOMWindowInner::Thaw()
{
nsGlobalWindow::Cast(this)->Thaw();
nsGlobalWindowInner::Cast(this)->Thaw();
}
void
nsPIDOMWindowInner::SyncStateFromParentWindow()
{
nsGlobalWindow::Cast(this)->SyncStateFromParentWindow();
nsGlobalWindowInner::Cast(this)->SyncStateFromParentWindow();
}
void
@ -4453,7 +4457,7 @@ nsPIDOMWindowInner::TryToCacheTopInnerWindow()
mHasTriedToCacheTopInnerWindow = true;
nsGlobalWindow* window = nsGlobalWindow::Cast(AsInner());
nsGlobalWindow* window = nsGlobalWindowInner::Cast(AsInner());
MOZ_ASSERT(window);
@ -4795,7 +4799,7 @@ nsGlobalWindow::GetScriptableParentOrNull()
FORWARD_TO_OUTER(GetScriptableParentOrNull, (), nullptr);
nsPIDOMWindowOuter* parent = GetScriptableParent();
return (Cast(parent) == this) ? nullptr : parent;
return (nsGlobalWindowOuter::Cast(parent) == this) ? nullptr : parent;
}
/**
@ -5023,7 +5027,7 @@ nsGlobalWindow::GetMenubar(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mMenubar) {
mMenubar = new MenubarProp(this);
mMenubar = new MenubarProp(AssertInner());
}
return mMenubar;
@ -5035,7 +5039,7 @@ nsGlobalWindow::GetToolbar(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mToolbar) {
mToolbar = new ToolbarProp(this);
mToolbar = new ToolbarProp(AssertInner());
}
return mToolbar;
@ -5047,7 +5051,7 @@ nsGlobalWindow::GetLocationbar(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mLocationbar) {
mLocationbar = new LocationbarProp(this);
mLocationbar = new LocationbarProp(AssertInner());
}
return mLocationbar;
}
@ -5058,7 +5062,7 @@ nsGlobalWindow::GetPersonalbar(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mPersonalbar) {
mPersonalbar = new PersonalbarProp(this);
mPersonalbar = new PersonalbarProp(AssertInner());
}
return mPersonalbar;
}
@ -5069,7 +5073,7 @@ nsGlobalWindow::GetStatusbar(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mStatusbar) {
mStatusbar = new StatusbarProp(this);
mStatusbar = new StatusbarProp(AssertInner());
}
return mStatusbar;
}
@ -5080,7 +5084,7 @@ nsGlobalWindow::GetScrollbars(ErrorResult& aError)
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mScrollbars) {
mScrollbars = new ScrollbarsProp(this);
mScrollbars = new ScrollbarsProp(AssertInner());
}
return mScrollbars;
@ -5171,7 +5175,7 @@ nsGlobalWindow::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
return true;
}
nsresult rv = nsWindowSH::GlobalResolve(this, aCx, aObj, aId, aDesc);
nsresult rv = nsWindowSH::GlobalResolve(AssertInner(), aCx, aObj, aId, aDesc);
if (NS_FAILED(rv)) {
return Throw(aCx, rv);
}
@ -5262,7 +5266,7 @@ nsGlobalWindow::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
for (auto i = nameSpaceManager->GlobalNameIter(); !i.Done(); i.Next()) {
const GlobalNameMapEntry* entry = i.Get();
if (nsWindowSH::NameStructEnabled(aCx, this, entry->mKey,
if (nsWindowSH::NameStructEnabled(aCx, AssertInner(), entry->mKey,
entry->mGlobalName)) {
// Just append all of these; even if they get deleted our resolve hook
// just goes ahead and recreates them.
@ -5427,7 +5431,7 @@ nsGlobalWindow::GetSanitizedOpener(nsPIDOMWindowOuter* aOpener)
return nullptr;
}
nsGlobalWindow* win = nsGlobalWindow::Cast(aOpener);
nsGlobalWindow* win = nsGlobalWindowOuter::Cast(aOpener);
// First, ensure that we're not handing back a chrome window to content:
if (win->IsChromeWindow()) {
@ -5470,7 +5474,7 @@ nsGlobalWindow::GetOpenerWindowOuter()
if (nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
// Catch the case where we're chrome but the opener is not...
if (GetPrincipal() == nsContentUtils::GetSystemPrincipal() &&
nsGlobalWindow::Cast(opener)->GetPrincipal() != nsContentUtils::GetSystemPrincipal()) {
nsGlobalWindowOuter::Cast(opener)->GetPrincipal() != nsContentUtils::GetSystemPrincipal()) {
return nullptr;
}
return opener;
@ -6269,7 +6273,7 @@ nsGlobalWindow::GetDevicePixelRatio(CallerType aCallerType, ErrorResult& aError)
float
nsPIDOMWindowOuter::GetDevicePixelRatio(CallerType aCallerType)
{
return nsGlobalWindow::Cast(this)->GetDevicePixelRatioOuter(aCallerType);
return nsGlobalWindowOuter::Cast(this)->GetDevicePixelRatioOuter(aCallerType);
}
uint64_t
@ -6542,7 +6546,7 @@ nsGlobalWindow::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop,
nsContentUtils::HidePopupsInDocument(mDoc);
#endif
if (nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot())) {
if (nsGlobalWindowOuter* rootWindow = nsGlobalWindowOuter::Cast(GetPrivateRoot())) {
rootWindow->FlushPendingNotifications(FlushType::Layout);
}
@ -7112,7 +7116,7 @@ FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
if (strcmp(aTopic, FullscreenTransitionTask::kPaintedTopic) == 0) {
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(aSubject));
nsCOMPtr<nsIWidget> widget = win ?
nsGlobalWindow::Cast(win)->GetMainWidget() : nullptr;
nsGlobalWindowInner::Cast(win)->GetMainWidget() : nullptr;
if (widget == mTask->mWidget) {
// The paint notification arrives first. Cancel the timer.
mTask->mTimer->Cancel();
@ -7395,7 +7399,7 @@ nsGlobalWindow::FullScreen() const
nsCOMPtr<nsPIDOMWindowOuter> window = rootItem->GetWindow();
NS_ENSURE_TRUE(window, mFullScreen);
return nsGlobalWindow::Cast(window)->FullScreen();
return nsGlobalWindowOuter::Cast(window)->FullScreen();
}
bool
@ -8786,6 +8790,7 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
const nsAString& aPopupWindowName,
const nsAString& aPopupWindowFeatures)
{
MOZ_ASSERT(IsOuterWindow(), "All callers seem to assume we're an outer window?");
MOZ_ASSERT(aDoc);
// Fire a "DOMPopupBlocked" event so that the UI can hear about
@ -8793,7 +8798,9 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
PopupBlockedEventInit init;
init.mBubbles = true;
init.mCancelable = true;
init.mRequestingWindow = this;
// XXX: This is a different object, but webidl requires an inner window here
// now.
init.mRequestingWindow = GetCurrentInnerWindowInternal();
init.mPopupWindowURI = aPopupURI;
init.mPopupWindowName = aPopupWindowName;
init.mPopupWindowFeatures = aPopupWindowFeatures;
@ -8835,7 +8842,7 @@ nsGlobalWindow::PopupWhitelisted()
return false;
}
return nsGlobalWindow::Cast(parent)->PopupWhitelisted();
return nsGlobalWindowOuter::Cast(parent)->PopupWhitelisted();
}
/*
@ -8891,6 +8898,7 @@ nsGlobalWindow::FireAbuseEvents(const nsAString &aPopupURL,
const nsAString &aPopupWindowName,
const nsAString &aPopupWindowFeatures)
{
MOZ_ASSERT(IsOuterWindow());
// fetch the URI of the window requesting the opened window
nsCOMPtr<nsPIDOMWindowOuter> window = GetTop();
@ -9076,7 +9084,7 @@ nsGlobalWindow::GetFrames(ErrorResult& aError)
FORWARD_TO_OUTER_OR_THROW(GetFramesOuter, (), aError, nullptr);
}
nsGlobalWindow*
nsGlobalWindowInner*
nsGlobalWindow::CallerInnerWindow()
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();
@ -9108,7 +9116,7 @@ nsGlobalWindow::CallerInnerWindow()
// The calling window must be holding a reference, so we can return a weak
// pointer.
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(global);
return nsGlobalWindow::Cast(win);
return nsGlobalWindowInner::Cast(win);
}
void
@ -9245,7 +9253,7 @@ nsGlobalWindow::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessa
? nullptr
: callerInnerWin->GetOuterWindowInternal(),
origin,
this,
AssertOuter(),
providedPrincipal,
callerInnerWin
? callerInnerWin->GetDoc()
@ -10693,7 +10701,7 @@ nsGlobalWindow::EnableGamepadUpdates()
if (mHasGamepad) {
RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
if (gamepadManager) {
gamepadManager->AddListener(this);
gamepadManager->AddListener(AssertInner());
}
}
}
@ -10706,7 +10714,7 @@ nsGlobalWindow::DisableGamepadUpdates()
if (mHasGamepad) {
RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
if (gamepadManager) {
gamepadManager->RemoveListener(this);
gamepadManager->RemoveListener(AssertInner());
}
}
}
@ -10717,7 +10725,7 @@ nsGlobalWindow::EnableVRUpdates()
MOZ_ASSERT(IsInnerWindow());
if (mHasVREvents && !mVREventObserver) {
mVREventObserver = new VREventObserver(this);
mVREventObserver = new VREventObserver(AssertInner());
}
}
@ -11215,7 +11223,7 @@ nsGlobalWindow::GetComputedStyleHelperOuter(Element& aElt,
if (!presShell) {
// Try flushing frames on our parent in case there's a pending
// style change that will create the presshell.
auto* parent = nsGlobalWindow::Cast(GetPrivateParent());
auto* parent = nsGlobalWindowOuter::Cast(GetPrivateParent());
if (!parent) {
return nullptr;
}
@ -11444,7 +11452,7 @@ nsGlobalWindow::GetInterface(const nsIID & aIID, void **aSink)
}
#endif
else if (aIID.Equals(NS_GET_IID(nsIDOMWindowUtils))) {
nsGlobalWindow* outer = GetOuterWindowInternal();
nsGlobalWindowOuter* outer = GetOuterWindowInternal();
NS_ENSURE_TRUE(outer, NS_ERROR_NOT_INITIALIZED);
if (!mWindowUtils) {
@ -12621,8 +12629,8 @@ nsGlobalWindow::SyncStateFromParentWindow()
nsCOMPtr<Element> frame = outer->GetFrameElementInternal();
nsPIDOMWindowOuter* parentOuter = frame ? frame->OwnerDoc()->GetWindow()
: nullptr;
nsGlobalWindow* parentInner =
parentOuter ? nsGlobalWindow::Cast(parentOuter->GetCurrentInnerWindow())
nsGlobalWindowInner* parentInner =
parentOuter ? nsGlobalWindowInner::Cast(parentOuter->GetCurrentInnerWindow())
: nullptr;
// If our outer is in a modal state, but our parent is not in a modal
@ -12678,8 +12686,8 @@ nsGlobalWindow::CallOnChildren(Method aMethod)
continue;
}
auto* win = nsGlobalWindow::Cast(pWin);
nsGlobalWindow* inner = win->GetCurrentInnerWindowInternal();
auto* win = nsGlobalWindowOuter::Cast(pWin);
nsGlobalWindowInner* inner = win->GetCurrentInnerWindowInternal();
// This is a bit hackish. Only freeze/suspend windows which are truly our
// subwindows.
@ -12725,7 +12733,7 @@ nsGlobalWindow::FireDelayedDOMEvents()
NS_ASSERTION(childShell, "null child shell");
if (nsCOMPtr<nsPIDOMWindowOuter> pWin = childShell->GetWindow()) {
auto* win = nsGlobalWindow::Cast(pWin);
auto* win = nsGlobalWindowOuter::Cast(pWin);
win->FireDelayedDOMEvents();
}
}
@ -12995,7 +13003,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
// nsGlobalWindow: Timeout Functions
//*****************************************************************************
nsGlobalWindow*
nsGlobalWindowInner*
nsGlobalWindow::InnerForSetTimeoutOrInterval(ErrorResult& aError)
{
nsGlobalWindow* currentInner;
@ -13035,14 +13043,16 @@ nsGlobalWindow::InnerForSetTimeoutOrInterval(ErrorResult& aError)
return nullptr;
}
return currentInner;
return static_cast<nsGlobalWindowInner*>(currentInner);
}
}
// If forwardTo is not the window with an active document then we want the
// call to setTimeout/Interval to be a noop, so return null but don't set an
// error.
return forwardTo->AsInner()->HasActiveDocument() ? currentInner : nullptr;
return forwardTo->AsInner()->HasActiveDocument()
? static_cast<nsGlobalWindowInner*>(currentInner)
: nullptr;
}
int32_t
@ -13118,7 +13128,7 @@ nsGlobalWindow::SetTimeoutOrInterval(JSContext *aCx, Function& aFunction,
}
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, this, aFunction, aArguments, aError);
NS_CreateJSTimeoutHandler(aCx, AssertInner(), aFunction, aArguments, aError);
if (!handler) {
return 0;
}
@ -13146,7 +13156,7 @@ nsGlobalWindow::SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
}
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, this, aHandler, aError);
NS_CreateJSTimeoutHandler(aCx, AssertInner(), aHandler, aError);
if (!handler) {
return 0;
}
@ -13350,7 +13360,7 @@ nsGlobalWindow::SecurityCheckURL(const char *aURL)
sourceWindow = AsOuter()->GetCurrentInnerWindow();
}
AutoJSContext cx;
nsGlobalWindow* sourceWin = nsGlobalWindow::Cast(sourceWindow);
nsGlobalWindowInner* sourceWin = nsGlobalWindowInner::Cast(sourceWindow);
JSAutoCompartment ac(cx, sourceWin->GetGlobalJSObject());
// Resolve the baseURI, which could be relative to the calling window.
@ -13402,7 +13412,7 @@ nsGlobalWindow::EnsureSizeAndPositionUpToDate()
// If we're a subframe, make sure our size is up to date. It's OK that this
// crosses the content/chrome boundary, since chrome can have pending reflows
// too.
nsGlobalWindow *parent = nsGlobalWindow::Cast(GetPrivateParent());
nsGlobalWindow *parent = nsGlobalWindowOuter::Cast(GetPrivateParent());
if (parent) {
parent->FlushPendingNotifications(FlushType::Layout);
}
@ -13539,7 +13549,7 @@ nsGlobalWindow::EnableOrientationChangeListener()
if (!nsContentUtils::ShouldResistFingerprinting(mDocShell) &&
!mOrientationChangeObserver) {
mOrientationChangeObserver =
MakeUnique<WindowOrientationObserver>(this);
MakeUnique<WindowOrientationObserver>(AssertInner());
}
}
@ -14008,7 +14018,13 @@ nsGlobalWindow::DispatchVRDisplayPresentChange(uint32_t aDisplayID)
/* static */ already_AddRefed<nsGlobalWindow>
nsGlobalWindow::CreateChrome(nsGlobalWindow *aOuterWindow)
{
RefPtr<nsGlobalWindow> window = new nsGlobalWindow(aOuterWindow);
RefPtr<nsGlobalWindow> window;
if (aOuterWindow) {
window = new nsGlobalWindowInner(
static_cast<nsGlobalWindowOuter*>(aOuterWindow));
} else {
window = new nsGlobalWindowOuter();
}
window->mIsChrome = true;
window->mCleanMessageManager = true;
@ -14399,7 +14415,13 @@ nsGlobalWindow::TakeOpenerForInitialContentBrowser(mozIDOMWindowProxy** aOpenerW
/* static */ already_AddRefed<nsGlobalWindow>
nsGlobalWindow::Create(nsGlobalWindow *aOuterWindow)
{
RefPtr<nsGlobalWindow> window = new nsGlobalWindow(aOuterWindow);
RefPtr<nsGlobalWindow> window;
if (aOuterWindow) {
window = new nsGlobalWindowInner(
static_cast<nsGlobalWindowOuter*>(aOuterWindow));
} else {
window = new nsGlobalWindowOuter();
}
window->InitWasOffline();
return window.forget();
}
@ -14503,8 +14525,8 @@ nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx)
MOZ_ASSERT(IsInnerWindow());
// If JSAPI OOMs here, there is basically nothing we can do to recover safely.
if (!WindowBinding::ClearCachedDocumentValue(aCx, this) ||
!WindowBinding::ClearCachedPerformanceValue(aCx, this)) {
if (!WindowBinding::ClearCachedDocumentValue(aCx, AssertInner()) ||
!WindowBinding::ClearCachedPerformanceValue(aCx, AssertInner())) {
MOZ_CRASH("Unhandlable OOM while clearing document dependent slots.");
}
}
@ -14534,13 +14556,13 @@ nsPIDOMWindowOuter::SetLargeAllocStatus(LargeAllocStatus aStatus)
bool
nsPIDOMWindowOuter::IsTopLevelWindow()
{
return nsGlobalWindow::Cast(this)->IsTopLevelWindow();
return nsGlobalWindowOuter::Cast(this)->IsTopLevelWindow();
}
bool
nsPIDOMWindowOuter::HadOriginalOpener() const
{
return nsGlobalWindow::Cast(this)->HadOriginalOpener();
return nsGlobalWindowOuter::Cast(this)->HadOriginalOpener();
}
void
@ -14873,7 +14895,8 @@ nsGlobalWindow::TabGroupOuter()
MOZ_ASSERT_IF(parent, parent->TabGroup() == mTabGroup);
nsCOMPtr<nsPIDOMWindowOuter> piOpener = do_QueryReferent(mOpener);
nsPIDOMWindowOuter* opener = GetSanitizedOpener(piOpener);
MOZ_ASSERT_IF(opener && Cast(opener) != this, opener->TabGroup() == mTabGroup);
MOZ_ASSERT_IF(opener && nsGlobalWindowOuter::Cast(opener) != this,
opener->TabGroup() == mTabGroup);
}
mIsValidatingTabGroup = false;
}
@ -15056,6 +15079,51 @@ nsGlobalWindow::GetIntlUtils(ErrorResult& aError)
return mIntlUtils;
}
nsGlobalWindowOuter::nsGlobalWindowOuter()
: nsGlobalWindow(nullptr)
{
// Add ourselves to the outer windows list.
MOZ_ASSERT(sOuterWindowsById, "Outer Windows hash table must be created!");
// |this| is an outer window, add to the outer windows list.
MOZ_ASSERT(!sOuterWindowsById->Get(mWindowID),
"This window shouldn't be in the hash table yet!");
// We seem to see crashes in release builds because of null |sOuterWindowsById|.
if (sOuterWindowsById) {
sOuterWindowsById->Put(mWindowID, AssertOuter());
}
}
nsGlobalWindowOuter::~nsGlobalWindowOuter()
{
// NOTE: We remove ourselves from the sOuterWindowsById table in
// nsGlobalWindow::~nsGlobalWindow. We can't do it here because we have to
// remove ourselves before running some cleanup in that function.
}
nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter* aOuterWindow)
: nsGlobalWindow(aOuterWindow)
{
// Add ourselves to the inner windows list.
MOZ_ASSERT(sInnerWindowsById, "Inner Windows hash table must be created!");
MOZ_ASSERT(!sInnerWindowsById->Get(mWindowID),
"This window shouldn't be in the hash table yet!");
// We seem to see crashes in release builds because of null |sInnerWindowsById|.
if (sInnerWindowsById) {
sInnerWindowsById->Put(mWindowID, AssertInner());
// NOTE: We remove ourselves from this table in
// nsGlobalWindow::~nsGlobalWindow. We can't do it here because we have to
// remove ourselves before running some cleanup in that function.
}
}
nsGlobalWindowInner::~nsGlobalWindowInner()
{
// NOTE: We remove ourselves from the sInnerWindowsById table in
// nsGlobalWindow::~nsGlobalWindow. We can't do it here because we have to
// remove ourselves before running some cleanup in that function.
}
template class nsPIDOMWindow<mozIDOMWindowProxy>;
template class nsPIDOMWindow<mozIDOMWindow>;
template class nsPIDOMWindow<nsISupports>;

Просмотреть файл

@ -154,13 +154,13 @@ class IDBFactory;
} // namespace mozilla
extern already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
mozilla::dom::Function& aFunction,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
extern already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
const nsAString& aExpression,
mozilla::ErrorResult& aError);
@ -228,6 +228,9 @@ private:
nsCOMPtr<nsIVariant> mValue;
};
class nsGlobalWindowInner;
class nsGlobalWindowOuter;
//*****************************************************************************
// nsGlobalWindow: Global Object for Scripting
//*****************************************************************************
@ -272,7 +275,6 @@ class nsGlobalWindow : public mozilla::dom::EventTarget,
public:
typedef mozilla::TimeStamp TimeStamp;
typedef mozilla::TimeDuration TimeDuration;
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindow*> WindowByIdTable;
static void
AssertIsOnMainThread()
@ -282,28 +284,8 @@ public:
{ }
#endif
static nsGlobalWindow* Cast(nsPIDOMWindowInner* aPIWin) {
return static_cast<nsGlobalWindow*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static const nsGlobalWindow* Cast(const nsPIDOMWindowInner* aPIWin) {
return static_cast<const nsGlobalWindow*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static nsGlobalWindow* Cast(mozIDOMWindow* aWin) {
return Cast(nsPIDOMWindowInner::From(aWin));
}
static nsGlobalWindow* Cast(nsPIDOMWindowOuter* aPIWin) {
return static_cast<nsGlobalWindow*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static const nsGlobalWindow* Cast(const nsPIDOMWindowOuter* aPIWin) {
return static_cast<const nsGlobalWindow*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static nsGlobalWindow* Cast(mozIDOMWindowProxy* aWin) {
return Cast(nsPIDOMWindowOuter::From(aWin));
}
nsGlobalWindowInner* AssertInner();
nsGlobalWindowOuter* AssertOuter();
// public methods
nsPIDOMWindowOuter* GetPrivateParent();
@ -373,14 +355,7 @@ public:
mozilla::ErrorResult& aRv) override;
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
virtual nsIGlobalObject* GetOwnerGlobal() const override
{
if (IsOuterWindow()) {
return GetCurrentInnerWindowInternal();
}
return const_cast<nsGlobalWindow*>(this);
}
virtual nsIGlobalObject* GetOwnerGlobal() const override;
// nsPIDOMWindow
virtual nsPIDOMWindowOuter* GetPrivateRoot() override;
@ -506,21 +481,9 @@ public:
}
already_AddRefed<nsPIDOMWindowOuter> GetTop() override;
nsPIDOMWindowOuter* GetScriptableTop() override;
inline nsGlobalWindow *GetTopInternal()
{
nsGlobalWindow* outer = IsOuterWindow() ? this : GetOuterWindowInternal();
nsCOMPtr<nsPIDOMWindowOuter> top = outer ? outer->GetTop() : nullptr;
if (top) {
return nsGlobalWindow::Cast(top);
}
return nullptr;
}
inline nsGlobalWindowOuter *GetTopInternal();
inline nsGlobalWindow* GetScriptableTopInternal()
{
nsPIDOMWindowOuter* top = GetScriptableTop();
return nsGlobalWindow::Cast(top);
}
inline nsGlobalWindowOuter* GetScriptableTopInternal();
nsPIDOMWindowOuter* GetChildWindow(const nsAString& aName);
@ -569,30 +532,13 @@ public:
};
friend class TemporarilyDisableDialogs;
nsIScriptContext *GetContextInternal()
{
if (mOuterWindow) {
return GetOuterWindowInternal()->mContext;
}
nsIScriptContext *GetContextInternal();
return mContext;
}
nsGlobalWindowOuter *GetOuterWindowInternal();
nsGlobalWindow *GetOuterWindowInternal()
{
return nsGlobalWindow::Cast(GetOuterWindow());
}
nsGlobalWindowInner* GetCurrentInnerWindowInternal() const;
nsGlobalWindow* GetCurrentInnerWindowInternal() const
{
MOZ_ASSERT(IsOuterWindow());
return nsGlobalWindow::Cast(mInnerWindow);
}
nsGlobalWindow* EnsureInnerWindowInternal()
{
return nsGlobalWindow::Cast(AsOuter()->EnsureInnerWindow());
}
nsGlobalWindowInner* EnsureInnerWindowInternal();
bool IsCreatingInnerWindow() const
{
@ -682,13 +628,7 @@ public:
return mHadOriginalOpener;
}
bool
IsTopLevelWindow()
{
MOZ_ASSERT(IsOuterWindow());
nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
return parentWindow == this->AsOuter();
}
bool IsTopLevelWindow();
virtual void
FirePopupBlockedEvent(nsIDocument* aDoc,
@ -700,34 +640,6 @@ public:
return mSerial;
}
static nsGlobalWindow* GetOuterWindowWithId(uint64_t aWindowID) {
AssertIsOnMainThread();
if (!sWindowsById) {
return nullptr;
}
nsGlobalWindow* outerWindow = sWindowsById->Get(aWindowID);
return outerWindow && !outerWindow->IsInnerWindow() ? outerWindow : nullptr;
}
static nsGlobalWindow* GetInnerWindowWithId(uint64_t aInnerWindowID) {
AssertIsOnMainThread();
if (!sWindowsById) {
return nullptr;
}
nsGlobalWindow* innerWindow = sWindowsById->Get(aInnerWindowID);
return innerWindow && innerWindow->IsInnerWindow() ? innerWindow : nullptr;
}
static WindowByIdTable* GetWindowsTable() {
AssertIsOnMainThread();
return sWindowsById;
}
void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const;
// Inner windows only.
@ -855,8 +767,8 @@ public:
static JSObject*
CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto);
nsGlobalWindow* Window();
nsGlobalWindow* Self();
nsGlobalWindowInner* Window();
nsGlobalWindowInner* Self();
nsIDocument* GetDocument()
{
return GetDoc();
@ -1473,7 +1385,7 @@ protected:
}
void FreeInnerObjects();
nsGlobalWindow *CallerInnerWindow();
nsGlobalWindowInner *CallerInnerWindow();
// Only to be called on an inner window.
// aDocument must not be null.
@ -1487,14 +1399,7 @@ protected:
public:
// popup tracking
bool IsPopupSpamWindow()
{
if (IsInnerWindow() && !mOuterWindow) {
return false;
}
return GetOuterWindowInternal()->mIsPopupSpam;
}
bool IsPopupSpamWindow();
// Outer windows only.
void SetIsPopupSpamWindow(bool aIsPopupSpam);
@ -1669,10 +1574,7 @@ public:
void ScrollTo(const mozilla::CSSIntPoint& aScroll,
const mozilla::dom::ScrollOptions& aOptions);
bool IsFrame()
{
return GetParentInternal() != nullptr;
}
bool IsFrame();
// Outer windows only.
// If aLookForCallerOnJSStack is true, this method will look at the JS stack
@ -1759,7 +1661,7 @@ protected:
mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
nsGlobalWindowInner* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
void PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const nsAString& aTargetOrigin,
@ -2088,8 +1990,6 @@ protected:
friend class DesktopNotification;
friend class mozilla::dom::TimeoutManager;
friend class IdleRequestExecutor;
static WindowByIdTable* sWindowsById;
};
inline nsISupports*
@ -2104,8 +2004,198 @@ ToCanonicalSupports(nsGlobalWindow *p)
return static_cast<nsIDOMEventTarget*>(p);
}
class nsGlobalWindowOuter : public nsGlobalWindow
{
public:
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowOuter*> OuterWindowByIdTable;
friend class nsGlobalWindow;
static nsGlobalWindowOuter* Cast(nsPIDOMWindowOuter* aPIWin) {
return static_cast<nsGlobalWindowOuter*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static const nsGlobalWindowOuter* Cast(const nsPIDOMWindowOuter* aPIWin) {
return static_cast<const nsGlobalWindowOuter*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static nsGlobalWindowOuter* Cast(mozIDOMWindowProxy* aWin) {
return Cast(nsPIDOMWindowOuter::From(aWin));
}
static nsGlobalWindowOuter*
GetOuterWindowWithId(uint64_t aWindowID)
{
AssertIsOnMainThread();
if (!sOuterWindowsById) {
return nullptr;
}
nsGlobalWindowOuter* outerWindow = sOuterWindowsById->Get(aWindowID);
MOZ_ASSERT(!outerWindow || outerWindow->IsOuterWindow(),
"Inner window in sOuterWindowsById?");
return outerWindow;
}
static OuterWindowByIdTable* GetWindowsTable() {
AssertIsOnMainThread();
return sOuterWindowsById;
}
private:
nsGlobalWindowOuter();
~nsGlobalWindowOuter();
static OuterWindowByIdTable* sOuterWindowsById;
};
class nsGlobalWindowInner : public nsGlobalWindow
{
public:
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowInner*> InnerWindowByIdTable;
friend class nsGlobalWindow;
static nsGlobalWindowInner* Cast(nsPIDOMWindowInner* aPIWin) {
return static_cast<nsGlobalWindowInner*>(
reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static const nsGlobalWindowInner* Cast(const nsPIDOMWindowInner* aPIWin) {
return static_cast<const nsGlobalWindowInner*>(
reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
}
static nsGlobalWindowInner* Cast(mozIDOMWindow* aWin) {
return Cast(nsPIDOMWindowInner::From(aWin));
}
static nsGlobalWindowInner*
GetInnerWindowWithId(uint64_t aInnerWindowID)
{
AssertIsOnMainThread();
if (!sInnerWindowsById) {
return nullptr;
}
nsGlobalWindowInner* innerWindow =
sInnerWindowsById->Get(aInnerWindowID);
MOZ_ASSERT(!innerWindow || innerWindow->IsInnerWindow(),
"Outer window in sInnerWindowsById?");
return innerWindow;
}
static InnerWindowByIdTable* GetWindowsTable() {
AssertIsOnMainThread();
return sInnerWindowsById;
}
private:
explicit nsGlobalWindowInner(nsGlobalWindowOuter* aOuter);
~nsGlobalWindowInner();
static InnerWindowByIdTable* sInnerWindowsById;
};
inline nsIGlobalObject*
nsGlobalWindow::GetOwnerGlobal() const
{
if (IsOuterWindow()) {
return GetCurrentInnerWindowInternal();
}
return const_cast<nsGlobalWindow*>(this);
}
inline nsGlobalWindowOuter*
nsGlobalWindow::GetTopInternal()
{
nsGlobalWindow* outer = IsOuterWindow() ? this : GetOuterWindowInternal();
nsCOMPtr<nsPIDOMWindowOuter> top = outer ? outer->GetTop() : nullptr;
if (top) {
return nsGlobalWindowOuter::Cast(top);
}
return nullptr;
}
inline nsGlobalWindowOuter*
nsGlobalWindow::GetScriptableTopInternal()
{
nsPIDOMWindowOuter* top = GetScriptableTop();
return nsGlobalWindowOuter::Cast(top);
}
inline nsIScriptContext*
nsGlobalWindow::GetContextInternal()
{
if (mOuterWindow) {
return GetOuterWindowInternal()->mContext;
}
return mContext;
}
inline nsGlobalWindowOuter*
nsGlobalWindow::GetOuterWindowInternal()
{
return nsGlobalWindowOuter::Cast(GetOuterWindow());
}
inline nsGlobalWindowInner*
nsGlobalWindow::GetCurrentInnerWindowInternal() const
{
MOZ_ASSERT(IsOuterWindow());
return nsGlobalWindowInner::Cast(mInnerWindow);
}
inline nsGlobalWindowInner*
nsGlobalWindow::EnsureInnerWindowInternal()
{
return nsGlobalWindowInner::Cast(AsOuter()->EnsureInnerWindow());
}
inline bool
nsGlobalWindow::IsTopLevelWindow()
{
MOZ_ASSERT(IsOuterWindow());
nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
return parentWindow == this->AsOuter();
}
inline bool
nsGlobalWindow::IsPopupSpamWindow()
{
if (IsInnerWindow() && !mOuterWindow) {
return false;
}
return GetOuterWindowInternal()->mIsPopupSpam;
}
inline bool
nsGlobalWindow::IsFrame()
{
return GetParentInternal() != nullptr;
}
inline nsGlobalWindowInner*
nsGlobalWindow::AssertInner()
{
MOZ_RELEASE_ASSERT(IsInnerWindow());
return static_cast<nsGlobalWindowInner*>(this);
}
inline nsGlobalWindowOuter*
nsGlobalWindow::AssertOuter()
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
return static_cast<nsGlobalWindowOuter*>(this);
}
/* factory function */
inline already_AddRefed<nsGlobalWindow>
inline already_AddRefed<nsGlobalWindowOuter>
NS_NewScriptGlobalObject(bool aIsChrome)
{
RefPtr<nsGlobalWindow> global;
@ -2116,7 +2206,7 @@ NS_NewScriptGlobalObject(bool aIsChrome)
global = nsGlobalWindow::Create(nullptr);
}
return global.forget();
return global.forget().downcast<nsGlobalWindowOuter>();
}
#endif /* nsGlobalWindow_h___ */

Просмотреть файл

@ -62,6 +62,7 @@ class nsIDocShell;
class nsDocShell;
class nsDOMNavigationTiming;
class nsFrameLoader;
class nsGlobalWindowInner;
class nsHTMLCSSStyleSheet;
class nsHTMLDocument;
class nsHTMLStyleSheet;
@ -3045,7 +3046,7 @@ public:
JS::Handle<JSObject*> aResult, mozilla::ErrorResult& rv);
// Touch event handlers already on nsINode
already_AddRefed<mozilla::dom::Touch>
CreateTouch(nsGlobalWindow* aView, mozilla::dom::EventTarget* aTarget,
CreateTouch(nsGlobalWindowInner* aView, mozilla::dom::EventTarget* aTarget,
int32_t aIdentifier, int32_t aPageX, int32_t aPageY,
int32_t aScreenX, int32_t aScreenY, int32_t aClientX,
int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY,

Просмотреть файл

@ -1386,7 +1386,7 @@ nsPIDOMWindowOuter*
nsINode::GetOwnerGlobalForBindings()
{
bool dummy;
auto* window = static_cast<nsGlobalWindow*>(OwnerDoc()->GetScriptHandlingObject(dummy));
auto* window = static_cast<nsGlobalWindowInner*>(OwnerDoc()->GetScriptHandlingObject(dummy));
return window ? nsPIDOMWindowOuter::GetFromCurrentInner(window->AsInner()) : nullptr;
}

Просмотреть файл

@ -411,7 +411,7 @@ NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
// Dispatch() must be synchronous for the recursion block
// (errorDepth) to work.
RefPtr<ErrorEvent> event =
ErrorEvent::Constructor(nsGlobalWindow::Cast(win),
ErrorEvent::Constructor(nsGlobalWindowInner::Cast(win),
NS_LITERAL_STRING("error"),
aErrorEventInit);
event->SetTrusted(true);
@ -472,7 +472,7 @@ public:
}
RefPtr<ErrorEvent> event =
ErrorEvent::Constructor(nsGlobalWindow::Cast(win),
ErrorEvent::Constructor(nsGlobalWindowInner::Cast(win),
NS_LITERAL_STRING("error"), init);
event->SetTrusted(true);
@ -514,14 +514,15 @@ DispatchScriptErrorEvent(nsPIDOMWindowInner *win, JS::RootingContext* rootingCx,
#ifdef DEBUG
// A couple of useful functions to call when you're debugging.
nsGlobalWindow *
nsGlobalWindowInner *
JSObject2Win(JSObject *obj)
{
return xpc::WindowOrNull(obj);
}
template<typename T>
void
PrintWinURI(nsGlobalWindow *win)
PrintWinURI(T *win)
{
if (!win) {
printf("No window passed in.\n");
@ -544,7 +545,20 @@ PrintWinURI(nsGlobalWindow *win)
}
void
PrintWinCodebase(nsGlobalWindow *win)
PrintWinURIInner(nsGlobalWindowInner* aWin)
{
return PrintWinURI(aWin);
}
void
PrintWinURIOuter(nsGlobalWindowOuter* aWin)
{
return PrintWinURI(aWin);
}
template<typename T>
void
PrintWinCodebase(T *win)
{
if (!win) {
printf("No window passed in.\n");
@ -567,6 +581,18 @@ PrintWinCodebase(nsGlobalWindow *win)
printf("%s\n", uri->GetSpecOrDefault().get());
}
void
PrintWinCodebaseInner(nsGlobalWindowInner* aWin)
{
return PrintWinCodebase(aWin);
}
void
PrintWinCodebaseOuter(nsGlobalWindowOuter* aWin)
{
return PrintWinCodebase(aWin);
}
void
DumpString(const nsAString &str)
{

Просмотреть файл

@ -35,11 +35,11 @@ public:
nsJSScriptTimeoutHandler();
// This will call SwapElements on aArguments with an empty array.
nsJSScriptTimeoutHandler(JSContext* aCx, nsGlobalWindow* aWindow,
nsJSScriptTimeoutHandler(JSContext* aCx, nsGlobalWindowInner* aWindow,
Function& aFunction,
nsTArray<JS::Heap<JS::Value>>&& aArguments,
ErrorResult& aError);
nsJSScriptTimeoutHandler(JSContext* aCx, nsGlobalWindow* aWindow,
nsJSScriptTimeoutHandler(JSContext* aCx, nsGlobalWindowInner* aWindow,
const nsAString& aExpression, bool* aAllowEval,
ErrorResult& aError);
nsJSScriptTimeoutHandler(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
@ -165,7 +165,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsJSScriptTimeoutHandler)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsJSScriptTimeoutHandler)
static bool
CheckCSPForEval(JSContext* aCx, nsGlobalWindow* aWindow, ErrorResult& aError)
CheckCSPForEval(JSContext* aCx, nsGlobalWindowInner* aWindow, ErrorResult& aError)
{
// if CSP is enabled, and setTimeout/setInterval was called with a string,
// disable the registration and log an error
@ -219,7 +219,7 @@ nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler()
}
nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(JSContext* aCx,
nsGlobalWindow *aWindow,
nsGlobalWindowInner *aWindow,
Function& aFunction,
nsTArray<JS::Heap<JS::Value>>&& aArguments,
ErrorResult& aError)
@ -238,7 +238,7 @@ nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(JSContext* aCx,
}
nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(JSContext* aCx,
nsGlobalWindow *aWindow,
nsGlobalWindowInner *aWindow,
const nsAString& aExpression,
bool* aAllowEval,
ErrorResult& aError)
@ -328,7 +328,7 @@ nsJSScriptTimeoutHandler::GetHandlerText()
}
already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext *aCx, nsGlobalWindow *aWindow,
NS_CreateJSTimeoutHandler(JSContext *aCx, nsGlobalWindowInner *aWindow,
Function& aFunction,
const Sequence<JS::Value>& aArguments,
ErrorResult& aError)
@ -345,7 +345,7 @@ NS_CreateJSTimeoutHandler(JSContext *aCx, nsGlobalWindow *aWindow,
}
already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow,
const nsAString& aExpression, ErrorResult& aError)
{
bool allowEval = false;

Просмотреть файл

@ -83,7 +83,7 @@ nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(JSContext *aContext)
if (!aContext)
return 0;
nsGlobalWindow* win = xpc::CurrentWindowOrNull(aContext);
nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aContext);
return win ? win->WindowID() : 0;
}

Просмотреть файл

@ -49,7 +49,7 @@ NS_IMPL_ISUPPORTS(nsWindowMemoryReporter, nsIMemoryReporter, nsIObserver,
nsISupportsWeakReference)
static nsresult
AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindow* aWindow,
AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindowOuter* aWindow,
nsTabSizes* aSizes)
{
// Measure the window.
@ -58,8 +58,7 @@ AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindow* aWindow,
aWindow->AddSizeOfIncludingThis(windowSizes);
// Measure the inner window, if there is one.
nsGlobalWindow* inner = aWindow->IsOuterWindow() ? aWindow->GetCurrentInnerWindowInternal()
: nullptr;
nsGlobalWindowInner* inner = aWindow->GetCurrentInnerWindowInternal();
if (inner) {
inner->AddSizeOfIncludingThis(windowSizes);
}
@ -79,7 +78,7 @@ AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindow* aWindow,
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(child);
nsGlobalWindow* childWin = nsGlobalWindow::Cast(child);
nsGlobalWindowOuter* childWin = nsGlobalWindowOuter::Cast(child);
rv = AddNonJSSizeOfWindowAndItsDescendents(childWin, aSizes);
NS_ENSURE_SUCCESS(rv, rv);
@ -90,7 +89,7 @@ AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindow* aWindow,
static nsresult
NonJSSizeOfTab(nsPIDOMWindowOuter* aWindow, size_t* aDomSize, size_t* aStyleSize, size_t* aOtherSize)
{
nsGlobalWindow* window = nsGlobalWindow::Cast(aWindow);
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(aWindow);
nsTabSizes sizes;
nsresult rv = AddNonJSSizeOfWindowAndItsDescendents(window, &sizes);
@ -131,7 +130,7 @@ nsWindowMemoryReporter::Get()
}
static already_AddRefed<nsIURI>
GetWindowURI(nsGlobalWindow* aWindow)
GetWindowURI(nsGlobalWindowInner* aWindow)
{
NS_ENSURE_TRUE(aWindow, nullptr);
@ -162,8 +161,16 @@ GetWindowURI(nsGlobalWindow* aWindow)
return uri.forget();
}
// Forward to the inner window if we need to when getting the window's URI.
static already_AddRefed<nsIURI>
GetWindowURI(nsGlobalWindowOuter* aWindow)
{
NS_ENSURE_TRUE(aWindow, nullptr);
return GetWindowURI(aWindow->GetCurrentInnerWindowInternal());
}
static void
AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr, bool aAnonymize)
AppendWindowURI(nsGlobalWindowInner *aWindow, nsACString& aStr, bool aAnonymize)
{
nsCOMPtr<nsIURI> uri = GetWindowURI(aWindow);
@ -233,7 +240,7 @@ ReportCount(const nsCString& aBasePath, const char* aPathTail,
}
static void
CollectWindowReports(nsGlobalWindow *aWindow,
CollectWindowReports(nsGlobalWindowInner *aWindow,
amIAddonManager *addonManager,
nsWindowSizes *aWindowTotalSizes,
nsTHashtable<nsUint64HashKey> *aGhostWindowIDs,
@ -247,7 +254,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
// Avoid calling aWindow->GetTop() if there's no outer window. It will work
// just fine, but will spew a lot of warnings.
nsGlobalWindow *top = nullptr;
nsGlobalWindowOuter *top = nullptr;
nsCOMPtr<nsIURI> location;
if (aWindow->GetOuterWindow()) {
// Our window should have a null top iff it has a null docshell.
@ -276,7 +283,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
if (top) {
windowPath += NS_LITERAL_CSTRING("top(");
AppendWindowURI(top, windowPath, aAnonymize);
AppendWindowURI(top->GetCurrentInnerWindowInternal(), windowPath, aAnonymize);
windowPath.AppendPrintf(", id=%" PRIu64 ")", top->WindowID());
aTopWindowPaths->Put(aWindow->WindowID(), windowPath);
@ -538,14 +545,14 @@ CollectWindowReports(nsGlobalWindow *aWindow,
#undef REPORT_COUNT
}
typedef nsTArray< RefPtr<nsGlobalWindow> > WindowArray;
typedef nsTArray< RefPtr<nsGlobalWindowInner> > WindowArray;
NS_IMETHODIMP
nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)
{
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowInner::InnerWindowByIdTable* windowsById =
nsGlobalWindowInner::GetWindowsTable();
NS_ENSURE_TRUE(windowsById, NS_OK);
// Hold on to every window in memory so that window objects can't be
@ -560,14 +567,14 @@ nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
nsTHashtable<nsUint64HashKey> ghostWindows;
CheckForGhostWindows(&ghostWindows);
for (auto iter = ghostWindows.ConstIter(); !iter.Done(); iter.Next()) {
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowInner::InnerWindowByIdTable* windowsById =
nsGlobalWindowInner::GetWindowsTable();
if (!windowsById) {
NS_WARNING("Couldn't get window-by-id hashtable?");
continue;
}
nsGlobalWindow* window = windowsById->Get(iter.Get()->GetKey());
nsGlobalWindowInner* window = windowsById->Get(iter.Get()->GetKey());
if (!window) {
NS_WARNING("Could not look up window?");
continue;
@ -784,7 +791,7 @@ nsWindowMemoryReporter::Observe(nsISupports *aSubject, const char *aTopic,
}
void
nsWindowMemoryReporter::ObserveDOMWindowDetached(nsGlobalWindow* aWindow)
nsWindowMemoryReporter::ObserveDOMWindowDetached(nsGlobalWindowInner* aWindow)
{
nsWeakPtr weakWindow = do_GetWeakReference(static_cast<nsIDOMEventTarget*>(aWindow));
if (!weakWindow) {
@ -881,8 +888,8 @@ nsWindowMemoryReporter::CheckForGhostWindows(
return;
}
nsGlobalWindow::WindowByIdTable *windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowInner::InnerWindowByIdTable *windowsById =
nsGlobalWindowInner::GetWindowsTable();
if (!windowsById) {
NS_WARNING("GetWindowsTable returned null");
return;
@ -898,7 +905,7 @@ nsWindowMemoryReporter::CheckForGhostWindows(
for (auto iter = windowsById->Iter(); !iter.Done(); iter.Next()) {
// Null outer window implies null top, but calling GetTop() when there's no
// outer window causes us to spew debug warnings.
nsGlobalWindow* window = iter.UserData();
nsGlobalWindowInner* window = iter.UserData();
if (!window->GetOuterWindow() || !window->GetTopInternal()) {
// This window is detached, so we don't care about its domain.
continue;
@ -948,7 +955,7 @@ nsWindowMemoryReporter::CheckForGhostWindows(
continue;
}
nsCOMPtr<nsIURI> uri = GetWindowURI(nsGlobalWindow::Cast(window));
nsCOMPtr<nsIURI> uri = GetWindowURI(nsGlobalWindowInner::Cast(window));
nsAutoCString domain;
if (uri) {
@ -1004,8 +1011,8 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
return;
}
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowInner::InnerWindowByIdTable* windowsById =
nsGlobalWindowInner::GetWindowsTable();
if (!windowsById) {
return;
}
@ -1021,13 +1028,13 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
nsTHashtable<nsUint64HashKey> ghostWindows;
sWindowReporter->CheckForGhostWindows(&ghostWindows);
for (auto iter = ghostWindows.ConstIter(); !iter.Done(); iter.Next()) {
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
nsGlobalWindowInner::InnerWindowByIdTable* windowsById =
nsGlobalWindowInner::GetWindowsTable();
if (!windowsById) {
continue;
}
RefPtr<nsGlobalWindow> window = windowsById->Get(iter.Get()->GetKey());
RefPtr<nsGlobalWindowInner> window = windowsById->Get(iter.Get()->GetKey());
if (window) {
window->RiskyUnlink();
}

Просмотреть файл

@ -101,7 +101,7 @@ public:
#endif
static nsWindowMemoryReporter* Get();
void ObserveDOMWindowDetached(nsGlobalWindow* aWindow);
void ObserveDOMWindowDetached(nsGlobalWindowInner* aWindow);
static int64_t GhostWindowsDistinguishedAmount();

Просмотреть файл

@ -295,7 +295,7 @@ nsWindowRoot::GetControllerForCommand(const char* aCommand,
}
// XXXndeakin P3 is this casting safe?
nsGlobalWindow *win = nsGlobalWindow::Cast(focusedWindow);
nsGlobalWindowOuter *win = nsGlobalWindowOuter::Cast(focusedWindow);
focusedWindow = win->GetPrivateParent();
}
@ -367,7 +367,7 @@ nsWindowRoot::GetEnabledDisabledCommands(nsTArray<nsCString>& aEnabledCommands,
aEnabledCommands, aDisabledCommands);
}
nsGlobalWindow* win = nsGlobalWindow::Cast(focusedWindow);
nsGlobalWindowOuter* win = nsGlobalWindowOuter::Cast(focusedWindow);
focusedWindow = win->GetPrivateParent();
}
}

Просмотреть файл

@ -2860,7 +2860,7 @@ EnforceNotInPrerendering(JSContext* aCx, JSObject* aObj)
// Without a this object, we cannot check the safety.
return true;
}
nsGlobalWindow* window = xpc::WindowGlobalOrNull(thisObj);
nsGlobalWindowInner* window = xpc::WindowGlobalOrNull(thisObj);
if (!window) {
// Without a window, we cannot check the safety.
return true;
@ -3151,7 +3151,7 @@ ConvertExceptionToPromise(JSContext* cx,
/* static */
void
CreateGlobalOptions<nsGlobalWindow>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
CreateGlobalOptions<nsGlobalWindowInner>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
{
xpc::TraceXPCGlobal(aTrc, aObj);
}
@ -3181,8 +3181,8 @@ RegisterDOMNames()
/* static */
bool
CreateGlobalOptions<nsGlobalWindow>::PostCreateGlobal(JSContext* aCx,
JS::Handle<JSObject*> aGlobal)
CreateGlobalOptions<nsGlobalWindowInner>::PostCreateGlobal(JSContext* aCx,
JS::Handle<JSObject*> aGlobal)
{
nsresult rv = RegisterDOMNames();
if (NS_FAILED(rv)) {
@ -3534,7 +3534,7 @@ GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj)
return nullptr;
}
nsGlobalWindow* window = xpc::WindowGlobalOrNull(obj);
nsGlobalWindowInner* window = xpc::WindowGlobalOrNull(obj);
if (!window) {
return nullptr;
}
@ -3732,7 +3732,7 @@ AssertReflectorHasGivenProto(JSContext* aCx, JSObject* aReflector,
void
SetDocumentAndPageUseCounter(JSObject* aObject, UseCounter aUseCounter)
{
nsGlobalWindow* win = xpc::WindowGlobalOrNull(js::UncheckedUnwrap(aObject));
nsGlobalWindowInner* win = xpc::WindowGlobalOrNull(js::UncheckedUnwrap(aObject));
if (win && win->GetDocument()) {
win->GetDocument()->SetDocumentAndPageUseCounter(aUseCounter);
}

Просмотреть файл

@ -3097,7 +3097,7 @@ struct CreateGlobalOptions
};
template <>
struct CreateGlobalOptions<nsGlobalWindow>
struct CreateGlobalOptions<nsGlobalWindowInner>
{
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::WindowLike;

Просмотреть файл

@ -1361,7 +1361,8 @@ DOMInterfaces = {
},
'Window': {
'nativeType': 'nsGlobalWindow',
'nativeType': 'nsGlobalWindowInner',
'headerFile': 'nsGlobalWindow.h',
'binaryNames': {
'postMessage': 'postMessageMoz',
},

Просмотреть файл

@ -182,7 +182,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
// Now get the global for this callback. Note that for the case of
// JS-implemented WebIDL we never have a window here.
nsGlobalWindow* win = mIsMainThread && !aIsJSImplementedWebIDL
nsGlobalWindowInner* win = mIsMainThread && !aIsJSImplementedWebIDL
? xpc::WindowGlobalOrNull(realCallback)
: nullptr;
if (win) {

Просмотреть файл

@ -228,7 +228,7 @@ WebIDLGlobalNameHash::DefineIfEnabled(JSContext* aCx,
// appearance of mutating things that opt code uses.
#ifdef DEBUG
JS::Rooted<JSObject*> temp(aCx, global);
DebugOnly<nsGlobalWindow*> win;
DebugOnly<nsGlobalWindowInner*> win;
MOZ_ASSERT(NS_SUCCEEDED(UNWRAP_OBJECT(Window, &temp, win)));
#endif
}

Просмотреть файл

@ -61,8 +61,8 @@ nsScriptErrorBase::InitializeOnMainThread()
MOZ_ASSERT(!mInitializedOnMainThread);
if (mInnerWindowID) {
nsGlobalWindow* window =
nsGlobalWindow::GetInnerWindowWithId(mInnerWindowID);
nsGlobalWindowInner* window =
nsGlobalWindowInner::GetInnerWindowWithId(mInnerWindowID);
if (window) {
nsPIDOMWindowOuter* outer = window->GetOuterWindow();
if (outer)

Просмотреть файл

@ -5501,7 +5501,7 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& aOp,
}
void
CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& aWindow, double aX,
CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
double aY, double aW, double aH,
const nsAString& aBgColor,
uint32_t aFlags, ErrorResult& aError)
@ -6015,6 +6015,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
return NS_ERROR_FAILURE;
}
DataSourceSurface::MappedSurface map;
RefPtr<DataSourceSurface> sourceSurface;
uint8_t* lockedBits = nullptr;
uint8_t* dstData;
@ -6036,11 +6037,15 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
if (!sourceSurface) {
return NS_ERROR_FAILURE;
}
dstData = sourceSurface->GetData();
if (!sourceSurface->Map(DataSourceSurface::READ_WRITE, &map)) {
return NS_ERROR_FAILURE;
}
dstData = map.mData;
if (!dstData) {
return NS_ERROR_OUT_OF_MEMORY;
}
dstStride = sourceSurface->Stride();
dstStride = map.mStride;
dstFormat = sourceSurface->GetFormat();
}
@ -6055,6 +6060,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
if (lockedBits) {
mTarget->ReleaseBits(lockedBits);
} else if (sourceSurface) {
sourceSurface->Unmap();
mTarget->CopySurface(sourceSurface, dirtyRect - dirtyRect.TopLeft(), dirtyRect.TopLeft());
}

Просмотреть файл

@ -31,7 +31,7 @@
#include "Layers.h"
#include "nsBidi.h"
class nsGlobalWindow;
class nsGlobalWindowInner;
class nsXULElement;
namespace mozilla {
@ -408,7 +408,7 @@ public:
}
}
void DrawWindow(nsGlobalWindow& aWindow, double aX, double aY,
void DrawWindow(nsGlobalWindowInner& aWindow, double aX, double aY,
double aW, double aH,
const nsAString& aBgColor, uint32_t aFlags,
mozilla::ErrorResult& aError);

Просмотреть файл

@ -223,17 +223,19 @@ CreateImageFromRawData(const gfx::IntSize& aSize,
}
// Convert RGBA to BGRA
DataSourceSurface::MappedSurface rgbaMap;
RefPtr<DataSourceSurface> rgbaDataSurface = rgbaSurface->GetDataSurface();
if (NS_WARN_IF(!rgbaDataSurface->Map(DataSourceSurface::MapType::READ, &rgbaMap))) {
return nullptr;
}
RefPtr<DataSourceSurface> bgraDataSurface =
Factory::CreateDataSourceSurfaceWithStride(rgbaDataSurface->GetSize(),
SurfaceFormat::B8G8R8A8,
rgbaDataSurface->Stride());
rgbaMap.mStride);
DataSourceSurface::MappedSurface rgbaMap;
DataSourceSurface::MappedSurface bgraMap;
if (NS_WARN_IF(!rgbaDataSurface->Map(DataSourceSurface::MapType::READ, &rgbaMap)) ||
NS_WARN_IF(!bgraDataSurface->Map(DataSourceSurface::MapType::WRITE, &bgraMap))) {
if (NS_WARN_IF(!bgraDataSurface->Map(DataSourceSurface::MapType::WRITE, &bgraMap))) {
return nullptr;
}

Просмотреть файл

@ -117,7 +117,8 @@ public:
virtual uint32_t
GetBufferLength() const
{
const uint32_t stride = Surface()->Stride();
DataSourceSurface::ScopedMap map(Surface(), DataSourceSurface::READ);
const uint32_t stride = map.GetStride();
const IntSize size = Surface()->GetSize();
return (uint32_t)(size.height * stride);
}

Просмотреть файл

@ -375,7 +375,7 @@ protected:
AutoJSAPI jsapi;
MOZ_ASSERT(aWindow);
RefPtr<nsGlobalWindow> win = nsGlobalWindow::Cast(aWindow);
RefPtr<nsGlobalWindowInner> win = nsGlobalWindowInner::Cast(aWindow);
if (NS_WARN_IF(!jsapi.Init(win))) {
return;
}
@ -1296,7 +1296,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
aMethodName == MethodTimeEnd ||
aMethodName == MethodTimeStamp) {
if (mWindow) {
nsGlobalWindow *win = nsGlobalWindow::Cast(mWindow);
nsGlobalWindowInner *win = nsGlobalWindowInner::Cast(mWindow);
MOZ_ASSERT(win);
RefPtr<Performance> performance = win->GetPerformance();
@ -2458,7 +2458,7 @@ Console::GetConsoleInternal(const GlobalObject& aGlobal, ErrorResult& aRv)
return nullptr;
}
nsGlobalWindow* window = nsGlobalWindow::Cast(innerWindow);
nsGlobalWindowInner* window = nsGlobalWindowInner::Cast(innerWindow);
return window->GetConsole(aRv);
}

Просмотреть файл

@ -81,7 +81,7 @@ void
CompositionEvent::InitCompositionEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
const nsAString& aData,
const nsAString& aLocale)
{

Просмотреть файл

@ -42,7 +42,7 @@ public:
void InitCompositionEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
const nsAString& aData,
const nsAString& aLocale);
void GetData(nsAString&) const;

Просмотреть файл

@ -90,7 +90,7 @@ NS_IMPL_DOMTARGET_DEFAULTS(DOMEventTargetHelper)
DOMEventTargetHelper::~DOMEventTargetHelper()
{
if (nsPIDOMWindowInner* owner = GetOwner()) {
nsGlobalWindow::Cast(owner)->RemoveEventTargetObject(this);
nsGlobalWindowInner::Cast(owner)->RemoveEventTargetObject(this);
}
if (mListenerManager) {
mListenerManager->Disconnect();
@ -111,7 +111,7 @@ DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
if (parentObject) {
if (mOwnerWindow) {
nsGlobalWindow::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
nsGlobalWindowInner::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
mOwnerWindow = nullptr;
}
mParentObject = nullptr;
@ -124,7 +124,7 @@ DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
mOwnerWindow = nsCOMPtr<nsPIDOMWindowInner>(do_QueryInterface(aOwner)).get();
if (mOwnerWindow) {
mHasOrHasHadOwnerWindow = true;
nsGlobalWindow::Cast(mOwnerWindow)->AddEventTargetObject(this);
nsGlobalWindowInner::Cast(mOwnerWindow)->AddEventTargetObject(this);
}
}
}
@ -133,7 +133,7 @@ void
DOMEventTargetHelper::BindToOwner(DOMEventTargetHelper* aOther)
{
if (mOwnerWindow) {
nsGlobalWindow::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
nsGlobalWindowInner::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
mOwnerWindow = nullptr;
mParentObject = nullptr;
mHasOrHasHadOwnerWindow = false;
@ -147,7 +147,7 @@ DOMEventTargetHelper::BindToOwner(DOMEventTargetHelper* aOther)
mOwnerWindow = nsCOMPtr<nsPIDOMWindowInner>(do_QueryInterface(aOther->GetParentObject())).get();
if (mOwnerWindow) {
mHasOrHasHadOwnerWindow = true;
nsGlobalWindow::Cast(mOwnerWindow)->AddEventTargetObject(this);
nsGlobalWindowInner::Cast(mOwnerWindow)->AddEventTargetObject(this);
}
}
}
@ -341,7 +341,7 @@ DOMEventTargetHelper::GetContextForEventHandlers(nsresult* aRv)
return nullptr;
}
nsPIDOMWindowInner* owner = GetOwner();
return owner ? nsGlobalWindow::Cast(owner)->GetContextInternal()
return owner ? nsGlobalWindowInner::Cast(owner)->GetContextInternal()
: nullptr;
}

Просмотреть файл

@ -41,7 +41,7 @@ void
DragEvent::InitDragEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -40,7 +40,7 @@ public:
void InitDragEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
nsGlobalWindow* aView, int32_t aDetail,
nsGlobalWindowInner* aView, int32_t aDetail,
int32_t aScreenX, int32_t aScreenY,
int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,

Просмотреть файл

@ -52,7 +52,7 @@ Event::Event(EventTarget* aOwner,
Event::Event(nsPIDOMWindowInner* aParent)
{
ConstructorInit(nsGlobalWindow::Cast(aParent), nullptr, nullptr);
ConstructorInit(nsGlobalWindowInner::Cast(aParent), nullptr, nullptr);
}
void

Просмотреть файл

@ -2084,7 +2084,8 @@ EventStateManager::GetContentViewer(nsIContentViewer** aCv)
if (!tabChild->ParentIsActive()) return NS_OK;
}
nsCOMPtr<nsPIDOMWindowOuter> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent();
nsCOMPtr<nsPIDOMWindowOuter> contentWindow =
nsGlobalWindowOuter::Cast(rootWindow)->GetContent();
if (!contentWindow) return NS_ERROR_FAILURE;
nsIDocument *doc = contentWindow->GetDoc();

Просмотреть файл

@ -46,7 +46,7 @@ void
FocusEvent::InitFocusEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
EventTarget* aRelatedTarget)
{

Просмотреть файл

@ -45,7 +45,7 @@ protected:
void InitFocusEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
EventTarget* aRelatedTarget);
};

Просмотреть файл

@ -345,7 +345,7 @@ void
KeyboardEvent::InitKeyboardEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
const nsAString& aKey,
uint32_t aLocation,
bool aCtrlKey,

Просмотреть файл

@ -63,7 +63,7 @@ public:
void GetInitDict(KeyboardEventInit& aParam);
void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
nsGlobalWindow* aView, bool aCtrlKey, bool aAltKey,
nsGlobalWindowInner* aView, bool aCtrlKey, bool aAltKey,
bool aShiftKey, bool aMetaKey,
uint32_t aKeyCode, uint32_t aCharCode)
{
@ -74,7 +74,7 @@ public:
void InitKeyboardEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
nsGlobalWindow* aView, const nsAString& aKey,
nsGlobalWindowInner* aView, const nsAString& aKey,
uint32_t aLocation, bool aCtrlKey, bool aAltKey,
bool aShiftKey, bool aMetaKey, ErrorResult& aRv);

Просмотреть файл

@ -54,7 +54,7 @@ void
MouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
@ -116,7 +116,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
nsIDOMEventTarget* aRelatedTarget)
{
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
nsGlobalWindow::Cast(aView), aDetail,
nsGlobalWindowInner::Cast(aView), aDetail,
aScreenX, aScreenY,
aClientX, aClientY,
aCtrlKey, aAltKey, aShiftKey,
@ -130,7 +130,7 @@ void
MouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
@ -199,7 +199,7 @@ void
MouseEvent::InitNSMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -58,7 +58,7 @@ public:
already_AddRefed<EventTarget> GetRelatedTarget();
void GetRegion(nsAString& aRegion);
void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
nsGlobalWindow* aView, int32_t aDetail, int32_t aScreenX,
nsGlobalWindowInner* aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
@ -87,7 +87,7 @@ public:
uint16_t MozInputSource() const;
void InitNSMouseEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
nsGlobalWindow* aView, int32_t aDetail,
nsGlobalWindowInner* aView, int32_t aDetail,
int32_t aScreenX, int32_t aScreenY,
int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
@ -101,7 +101,7 @@ protected:
void InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -42,7 +42,7 @@ void
MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -33,7 +33,7 @@ public:
int32_t Axis();
void InitMouseScrollEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable, nsGlobalWindow* aView,
bool aCancelable, nsGlobalWindowInner* aView,
int32_t aDetail, int32_t aScreenX, int32_t aScreenY,
int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,

Просмотреть файл

@ -35,7 +35,7 @@ void
ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
float aX,
float aY,

Просмотреть файл

@ -63,7 +63,7 @@ public:
void InitScrollAreaEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
float aX, float aY,
float aWidth, float aHeight);

Просмотреть файл

@ -107,7 +107,7 @@ void
SimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
bool aCanBubbleArg,
bool aCancelableArg,
nsGlobalWindow* aViewArg,
nsGlobalWindowInner* aViewArg,
int32_t aDetailArg,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -45,7 +45,7 @@ public:
void InitSimpleGestureEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,

Просмотреть файл

@ -84,7 +84,7 @@ void
TouchEvent::InitTouchEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
@ -171,7 +171,7 @@ TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{
nsIDocShell* docShell = nullptr;
if (aGlobal) {
nsGlobalWindow* win = xpc::WindowOrNull(aGlobal);
nsGlobalWindowInner* win = xpc::WindowOrNull(aGlobal);
if (win) {
docShell = win->GetDocShell();
}

Просмотреть файл

@ -107,7 +107,7 @@ public:
void InitTouchEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsGlobalWindow* aView,
nsGlobalWindowInner* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,

Просмотреть файл

@ -155,7 +155,7 @@ void
UIEvent::InitUIEvent(const nsAString& typeArg,
bool canBubbleArg,
bool cancelableArg,
nsGlobalWindow* viewArg,
nsGlobalWindowInner* viewArg,
int32_t detailArg)
{
auto* view = viewArg ? viewArg->AsInner() : nullptr;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше