diff --git a/.taskcluster.yml b/.taskcluster.yml
index 1d2d0b5f0aae..f5ce9752aba1 100644
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -83,9 +83,6 @@ tasks:
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
else: # cron
- "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
- - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
- - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
- # These are the old index routes for the decision task.
- "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
scopes:
diff --git a/accessible/tests/browser/events/browser_test_textcaret.js b/accessible/tests/browser/events/browser_test_textcaret.js
index a468dc0227b0..8fb3f08925f7 100644
--- a/accessible/tests/browser/events/browser_test_textcaret.js
+++ b/accessible/tests/browser/events/browser_test_textcaret.js
@@ -14,28 +14,27 @@ function caretMoveChecker(target, caretOffset) {
}
async function checkURLBarCaretEvents() {
- let url = "about:mozilla";
+ const kURL = "about:mozilla";
+ let newWin = await BrowserTestUtils.openNewBrowserWindow();
+ newWin.gBrowser.selectedBrowser.loadURI(kURL);
- let onDocLoad = waitForEvent(
+ await waitForEvent(
EVENT_DOCUMENT_LOAD_COMPLETE,
event => {
try {
- return event.accessible.QueryInterface(nsIAccessibleDocument).URL == url;
+ return event.accessible.QueryInterface(nsIAccessibleDocument).URL == kURL;
} catch (e) {
return false;
}
}
);
- let [ newWin ] = await Promise.all([
- BrowserTestUtils.openNewBrowserWindow({ url }),
- onDocLoad
- ]);
+ info("Loaded " + kURL);
let urlbarInputEl = newWin.document.getElementById("urlbar").inputField;
let urlbarInput = getAccessible(urlbarInputEl, [ nsIAccessibleText ]);
let onCaretMove = waitForEvents([
- [ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, url.length) ],
+ [ EVENT_TEXT_CARET_MOVED, caretMoveChecker(urlbarInput, kURL.length) ],
[ EVENT_FOCUS, urlbarInput ]
]);
diff --git a/browser/base/content/browser-captivePortal.js b/browser/base/content/browser-captivePortal.js
index 6de93c7f127d..b8bfca9cc05b 100644
--- a/browser/base/content/browser-captivePortal.js
+++ b/browser/base/content/browser-captivePortal.js
@@ -113,6 +113,12 @@ var CaptivePortalWatcher = {
}
let win = BrowserWindowTracker.getTopWindow();
+ // Used by tests: ignore the main test window in order to enable testing of
+ // the case where we have no open windows.
+ if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) {
+ win = null;
+ }
+
// If no browser window has focus, open and show the tab when we regain focus.
// This is so that if a different application was focused, when the user
// (re-)focuses a browser window, we open the tab immediately in that window
@@ -136,6 +142,12 @@ var CaptivePortalWatcher = {
}
let win = BrowserWindowTracker.getTopWindow();
+ // Used by tests: ignore the main test window in order to enable testing of
+ // the case where we have no open windows.
+ if (win && win.document.documentElement.getAttribute("ignorecaptiveportal")) {
+ win = null;
+ }
+
if (win != Services.ww.activeWindow) {
// The window that got focused was not a browser window.
return;
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index eb157ac7ca19..10a463027746 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4281,6 +4281,19 @@ function toOpenWindowByType(inType, uri, features) {
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
}
+/**
+ * Open a new browser window.
+ *
+ * @param {Object} options
+ * {
+ * private: A boolean indicating if the window should be
+ * private
+ * remote: A boolean indicating if the window should run
+ * remote browser tabs or not. If omitted, the window
+ * will choose the profile default state.
+ * }
+ * @return a reference to the new window.
+ */
function OpenBrowserWindow(options) {
var telemetryObj = {};
TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj);
diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js
index ce869df35d1b..2c9ce9f91d79 100644
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -5268,6 +5268,10 @@ var TabContextMenu = {
let contextUnpinSelectedTabs = document.getElementById("context_unpinSelectedTabs");
contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !multiselectionContext;
+ // Hide the "Duplicate Tab" if there is a selection present
+ let contextDuplicateTab = document.getElementById("context_duplicateTab");
+ contextDuplicateTab.hidden = multiselectionContext;
+
// Disable "Close Tabs to the Right" if there are no tabs
// following it.
document.getElementById("context_closeTabsToTheEnd").disabled =
diff --git a/browser/base/content/test/captivePortal/head.js b/browser/base/content/test/captivePortal/head.js
index 58a23c9770b0..dab6cb1ce037 100644
--- a/browser/base/content/test/captivePortal/head.js
+++ b/browser/base/content/test/captivePortal/head.js
@@ -20,22 +20,13 @@ async function setupPrefsAndRecentWindowBehavior() {
// We need to test behavior when a portal is detected when there is no browser
// window, but we can't close the default window opened by the test harness.
// Instead, we deactivate CaptivePortalWatcher in the default window and
- // exclude it from BrowserWindowTracker.getTopWindow in an attempt to
- // mask its presence.
+ // exclude it using an attribute to mask its presence.
window.CaptivePortalWatcher.uninit();
- let getTopWindowCopy = BrowserWindowTracker.getTopWindow;
- let defaultWindow = window;
- BrowserWindowTracker.getTopWindow = () => {
- let win = getTopWindowCopy();
- if (win == defaultWindow) {
- return null;
- }
- return win;
- };
+ window.document.documentElement.setAttribute("ignorecaptiveportal", "true");
registerCleanupFunction(function cleanUp() {
- BrowserWindowTracker.getTopWindow = getTopWindowCopy;
window.CaptivePortalWatcher.init();
+ window.document.documentElement.removeAttribute("ignorecaptiveportal");
});
}
diff --git a/browser/base/content/test/forms/browser_selectpopup.js b/browser/base/content/test/forms/browser_selectpopup.js
index 2adeb54d3848..12c14502b1f4 100644
--- a/browser/base/content/test/forms/browser_selectpopup.js
+++ b/browser/base/content/test/forms/browser_selectpopup.js
@@ -590,18 +590,24 @@ add_task(async function test_large_popup() {
// This test checks the same as the previous test but in a new smaller window.
add_task(async function test_large_popup_in_small_window() {
- let newwin = await BrowserTestUtils.openNewBrowserWindow({ width: 400, height: 400 });
+ let newWin = await BrowserTestUtils.openNewBrowserWindow();
+
+ let resizePromise = BrowserTestUtils.waitForEvent(newWin, "resize", false, e => {
+ return newWin.innerHeight <= 400 && newWin.innerWidth <= 400;
+ });
+ newWin.resizeTo(400, 400);
+ await resizePromise;
const pageUrl = "data:text/html," + escape(PAGECONTENT_SMALL);
- let browserLoadedPromise = BrowserTestUtils.browserLoaded(newwin.gBrowser.selectedBrowser);
- await BrowserTestUtils.loadURI(newwin.gBrowser.selectedBrowser, pageUrl);
+ let browserLoadedPromise = BrowserTestUtils.browserLoaded(newWin.gBrowser.selectedBrowser);
+ await BrowserTestUtils.loadURI(newWin.gBrowser.selectedBrowser, pageUrl);
await browserLoadedPromise;
- newwin.gBrowser.selectedBrowser.focus();
+ newWin.gBrowser.selectedBrowser.focus();
- await performLargePopupTests(newwin);
+ await performLargePopupTests(newWin);
- await BrowserTestUtils.closeWindow(newwin);
+ await BrowserTestUtils.closeWindow(newWin);
});
async function performSelectSearchTests(win) {
diff --git a/browser/base/content/test/plugins/browser_private_clicktoplay.js b/browser/base/content/test/plugins/browser_private_clicktoplay.js
index b94d441bffaf..f7b9fcfcccc4 100644
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -26,7 +26,8 @@ let createPrivateWindow = async function createPrivateWindow(url) {
gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser;
BrowserTestUtils.loadURI(gPrivateBrowser, url);
- await BrowserTestUtils.browserLoaded(gPrivateBrowser);
+ await BrowserTestUtils.browserLoaded(gPrivateBrowser, false, url);
+ info("loaded " + url);
};
add_task(async function test() {
diff --git a/browser/base/content/test/sidebar/browser_sidebar_adopt.js b/browser/base/content/test/sidebar/browser_sidebar_adopt.js
index 93ffa5f7dcd1..c007c82b759a 100644
--- a/browser/base/content/test/sidebar/browser_sidebar_adopt.js
+++ b/browser/base/content/test/sidebar/browser_sidebar_adopt.js
@@ -19,11 +19,11 @@ add_task(async function testAdoptedTwoWindows() {
// being adopted from the main window which doesn't have a shown sidebar. See Bug 1407737.
info("Ensure that sidebar state is adopted only from the opener");
- let win1 = await BrowserTestUtils.openNewBrowserWindow({opener: window});
+ let win1 = await BrowserTestUtils.openNewBrowserWindow();
await win1.SidebarUI.show("viewBookmarksSidebar");
await BrowserTestUtils.closeWindow(win1);
- let win2 = await BrowserTestUtils.openNewBrowserWindow({opener: window});
+ let win2 = await BrowserTestUtils.openNewBrowserWindow();
ok(!win2.document.getElementById("sidebar-button").hasAttribute("checked"), "Sidebar button isn't checked");
ok(!win2.SidebarUI.isOpen, "Sidebar is closed");
await BrowserTestUtils.closeWindow(win2);
@@ -46,7 +46,7 @@ add_task(async function testEventReceivedInNewWindow() {
info("Opening a new window and expecting the SidebarFocused event to not fire");
let promiseNewWindow = BrowserTestUtils.waitForNewWindow();
- BrowserTestUtils.openNewBrowserWindow({opener: window});
+ BrowserTestUtils.openNewBrowserWindow();
let win = await promiseNewWindow;
let adoptedShown = BrowserTestUtils.waitForEvent(win, "SidebarShown");
diff --git a/browser/base/content/test/tabs/browser.ini b/browser/base/content/test/tabs/browser.ini
index 8f33a525b6d7..19e1bc37f333 100644
--- a/browser/base/content/test/tabs/browser.ini
+++ b/browser/base/content/test/tabs/browser.ini
@@ -27,6 +27,7 @@ support-files =
[browser_multiselect_tabs_close_using_shortcuts.js]
[browser_multiselect_tabs_close.js]
[browser_multiselect_tabs_copy_through_drag_and_drop.js]
+[browser_multiselect_tabs_duplicate.js]
[browser_multiselect_tabs_event.js]
[browser_multiselect_tabs_move_to_another_window_drag.js]
[browser_multiselect_tabs_move_to_new_window_contextmenu.js]
diff --git a/browser/base/content/test/tabs/browser_multiselect_tabs_duplicate.js b/browser/base/content/test/tabs/browser_multiselect_tabs_duplicate.js
new file mode 100644
index 000000000000..7e46152a6e2c
--- /dev/null
+++ b/browser/base/content/test/tabs/browser_multiselect_tabs_duplicate.js
@@ -0,0 +1,48 @@
+const PREF_MULTISELECT_TABS = "browser.tabs.multiselect";
+
+add_task(async function setPref() {
+ await SpecialPowers.pushPrefEnv({
+ set: [[PREF_MULTISELECT_TABS, true]]
+ });
+});
+
+add_task(async function test() {
+ let tab1 = await addTab();
+ let tab2 = await addTab();
+ let tab3 = await addTab();
+
+ let menuItemDuplicateTab = document.getElementById("context_duplicateTab");
+
+ is(gBrowser.multiSelectedTabsCount, 0, "Zero multiselected tabs");
+
+ await BrowserTestUtils.switchTab(gBrowser, tab1);
+ await triggerClickOn(tab2, { ctrlKey: true });
+
+ ok(tab1.multiselected, "Tab1 is multiselected");
+ ok(tab2.multiselected, "Tab2 is multiselected");
+ ok(!tab3.multiselected, "Tab3 is not multiselected");
+
+ // Check the context menu with a multiselected tabs
+ updateTabContextMenu(tab2);
+ is(menuItemDuplicateTab.hidden, true, "Duplicate Tab is hidden");
+
+ // Check the context menu with a non-multiselected tab
+ updateTabContextMenu(tab3);
+ is(menuItemDuplicateTab.hidden, false, "Duplicate Tab is visible");
+
+ let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, "http://mochi.test:8888/");
+ window.TabContextMenu.contextTab = tab3; // Set proper context for command handler
+ menuItemDuplicateTab.click();
+ let tab4 = await newTabOpened;
+
+ // Selection should be cleared after duplication
+ ok(!tab1.multiselected, "Tab1 is not multiselected");
+ ok(!tab2.multiselected, "Tab2 is not multiselected");
+ ok(!tab4.multiselected, "Tab3 is not multiselected");
+ ok(!tab3.multiselected, "Tab4 is not multiselected");
+
+ BrowserTestUtils.removeTab(tab1);
+ BrowserTestUtils.removeTab(tab2);
+ BrowserTestUtils.removeTab(tab3);
+ BrowserTestUtils.removeTab(tab4);
+});
diff --git a/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js b/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
index d44da84875de..1baa1eff6155 100644
--- a/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
@@ -1,4 +1,6 @@
-/* eslint-disable mozilla/no-arbitrary-setTimeout */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
"use strict";
// The purpose of this test is to test the urlbar popup's add-on iframe. It has
@@ -133,13 +135,14 @@ add_task(async function() {
// urlbar.setPanelHeight
let newHeight = height + 100;
await promiseUrlbarFunctionCall("setPanelHeight", newHeight);
- await new Promise(resolve => {
- // The height change is animated, so give it time to complete. Again, wait
- // a sec to be safe.
- setTimeout(resolve, 1000);
+ // The height change is animated, so give it time to complete.
+ await TestUtils.waitForCondition(
+ () => Math.round(iframe.getBoundingClientRect().height) == newHeight,
+ "Wait for panel height change after setPanelHeight"
+ ).catch(ex => {
+ info("Last detected height: " + Math.round(iframe.getBoundingClientRect().height));
+ throw ex;
});
- Assert.equal(iframe.getBoundingClientRect().height, newHeight,
- "setPanelHeight");
});
function promiseIframeLoad() {
diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml
index a742fba4699e..53e591800f9c 100644
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -93,6 +93,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
this.inputField.addEventListener("overflow", this);
this.inputField.addEventListener("underflow", this);
this.inputField.addEventListener("scrollend", this);
+ window.addEventListener("resize", this);
var textBox = document.getAnonymousElementByAttribute(this,
"anonid", "moz-input-box");
@@ -158,6 +159,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
this.inputField.removeEventListener("overflow", this);
this.inputField.removeEventListener("underflow", this);
this.inputField.removeEventListener("scrollend", this);
+ window.removeEventListener("resize", this);
if (this._deferredKeyEventTimeout) {
clearTimeout(this._deferredKeyEventTimeout);
@@ -511,7 +513,19 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
true
+
+
+
{
+ this._resizeThrottleTimeout = null;
+
+ // Close the popup since it would be wrongly sized, we'll
+ // recalculate a proper size on reopening. For example, this
+ // may happen when using special OS resize functions like
+ // Win+Arrow.
+ this.closePopup();
+
+ // Make the host visible via formatValue.
+ this.formatValue(true);
+ }, 100);
+ }
+ break;
}
]]>
diff --git a/browser/components/customizableui/test/browser_sidebar_toggle.js b/browser/components/customizableui/test/browser_sidebar_toggle.js
index 18136102eab3..163bfc38af49 100644
--- a/browser/components/customizableui/test/browser_sidebar_toggle.js
+++ b/browser/components/customizableui/test/browser_sidebar_toggle.js
@@ -42,7 +42,7 @@ add_task(async function() {
is(SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered");
await hideSidebar();
- let otherWin = await BrowserTestUtils.openNewBrowserWindow({opener: window});
+ let otherWin = await BrowserTestUtils.openNewBrowserWindow();
await showSidebar(otherWin);
is(otherWin.SidebarUI.currentID, "viewHistorySidebar", "Selected sidebar remembered across windows");
await hideSidebar(otherWin);
diff --git a/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js b/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js
index 4cc9a257f27b..5d6fe2629caf 100644
--- a/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js
+++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction_windows.js
@@ -48,7 +48,7 @@ add_task(async function sidebar_windows() {
// SidebarUI relies on window.opener being set, which is normal behavior when
// using menu or key commands to open a new browser window.
- let win = await BrowserTestUtils.openNewBrowserWindow({opener: window});
+ let win = await BrowserTestUtils.openNewBrowserWindow();
await secondSidebar;
ok(!win.document.getElementById("sidebar-box").hidden, "sidebar box is visible in second window");
diff --git a/browser/components/sessionstore/test/browser_394759_perwindowpb.js b/browser/components/sessionstore/test/browser_394759_perwindowpb.js
index d03357e969ee..c58f6477ed2c 100644
--- a/browser/components/sessionstore/test/browser_394759_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_394759_perwindowpb.js
@@ -17,8 +17,7 @@ function promiseTestOpenCloseWindow(aIsPrivate, aTest) {
return (async function() {
let win = await BrowserTestUtils.openNewBrowserWindow({ "private": aIsPrivate });
win.gBrowser.selectedBrowser.loadURI(aTest.url);
- await promiseBrowserLoaded(win.gBrowser.selectedBrowser);
- await Promise.resolve();
+ await promiseBrowserLoaded(win.gBrowser.selectedBrowser, true, aTest.url);
// Mark the window with some unique data to be restored later on.
ss.setWindowValue(win, aTest.key, aTest.value);
await TabStateFlusher.flushWindow(win);
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 78c1b6133508..128644e93baa 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -319,7 +319,7 @@ nsDocShell::nsDocShell()
, mChromeEventHandler(nullptr)
, mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto)
, mCharsetReloadState(eCharsetReloadInit)
- , mOrientationLock(eScreenOrientation_None)
+ , mOrientationLock(hal::eScreenOrientation_None)
, mParentCharsetSource(0)
, mMarginWidth(-1)
, mMarginHeight(-1)
@@ -2029,14 +2029,14 @@ nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
return NS_OK;
}
-ScreenOrientationInternal
+hal::ScreenOrientation
nsDocShell::OrientationLock()
{
return mOrientationLock;
}
void
-nsDocShell::SetOrientationLock(ScreenOrientationInternal aOrientationLock)
+nsDocShell::SetOrientationLock(hal::ScreenOrientation aOrientationLock)
{
mOrientationLock = aOrientationLock;
}
@@ -10161,15 +10161,16 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// lock the orientation of the document to the document's default
// orientation. We don't explicitly check for a top-level browsing context
// here because orientation is only set on top-level browsing contexts.
- if (OrientationLock() != eScreenOrientation_None) {
+ if (OrientationLock() != hal::eScreenOrientation_None) {
#ifdef DEBUG
nsCOMPtr parent;
GetSameTypeParent(getter_AddRefs(parent));
MOZ_ASSERT(!parent);
#endif
- SetOrientationLock(eScreenOrientation_None);
+ SetOrientationLock(hal::eScreenOrientation_None);
if (mIsActive) {
- ScreenOrientation::UpdateActiveOrientationLock(eScreenOrientation_None);
+ ScreenOrientation::UpdateActiveOrientationLock(
+ hal::eScreenOrientation_None);
}
}
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index b05c25bf9f1a..a08180be0cf7 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -8,6 +8,7 @@
#define nsDocShell_h__
#include "mozilla/BasePrincipal.h"
+#include "mozilla/HalScreenConfiguration.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/Move.h"
@@ -69,7 +70,6 @@ namespace dom {
class ClientInfo;
class ClientSource;
class EventTarget;
-typedef uint32_t ScreenOrientationInternal;
} // namespace dom
} // namespace mozilla
@@ -1019,9 +1019,7 @@ private: // data members
eCharsetReloadState mCharsetReloadState;
- // The orientation lock as described by
- // https://w3c.github.io/screen-orientation/
- mozilla::dom::ScreenOrientationInternal mOrientationLock;
+ mozilla::hal::ScreenOrientation mOrientationLock;
int32_t mParentCharsetSource;
int32_t mMarginWidth;
diff --git a/dom/base/DocumentOrShadowRoot.cpp b/dom/base/DocumentOrShadowRoot.cpp
index 925ec8ba3cc8..412c384cbb37 100644
--- a/dom/base/DocumentOrShadowRoot.cpp
+++ b/dom/base/DocumentOrShadowRoot.cpp
@@ -12,6 +12,7 @@
#include "nsFocusManager.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
+#include "nsWindowSizes.h"
namespace mozilla {
namespace dom {
@@ -26,6 +27,36 @@ DocumentOrShadowRoot::DocumentOrShadowRoot(nsIDocument& aDoc)
, mKind(Kind::Document)
{}
+void
+DocumentOrShadowRoot::AddSizeOfOwnedSheetArrayExcludingThis(
+ nsWindowSizes& aSizes,
+ const nsTArray>& aSheets) const
+{
+ size_t n = 0;
+ n += aSheets.ShallowSizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
+ for (StyleSheet* sheet : aSheets) {
+ if (!sheet->GetAssociatedDocumentOrShadowRoot()) {
+ // Avoid over-reporting shared sheets.
+ continue;
+ }
+ n += sheet->SizeOfIncludingThis(aSizes.mState.mMallocSizeOf);
+ }
+
+ if (mKind == Kind::ShadowRoot) {
+ aSizes.mLayoutShadowDomStyleSheetsSize += n;
+ } else {
+ aSizes.mLayoutStyleSheetsSize += n;
+ }
+}
+
+void
+DocumentOrShadowRoot::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const
+{
+ AddSizeOfOwnedSheetArrayExcludingThis(aSizes, mStyleSheets);
+ aSizes.mDOMOtherSize +=
+ mIdentifierMap.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
+}
+
DocumentOrShadowRoot::~DocumentOrShadowRoot()
{
for (StyleSheet* sheet : mStyleSheets) {
diff --git a/dom/base/DocumentOrShadowRoot.h b/dom/base/DocumentOrShadowRoot.h
index c817a6873cfe..6ced4ecb8f22 100644
--- a/dom/base/DocumentOrShadowRoot.h
+++ b/dom/base/DocumentOrShadowRoot.h
@@ -15,6 +15,7 @@
class nsContentList;
class nsIDocument;
class nsINode;
+class nsWindowSizes;
namespace mozilla {
class StyleSheet;
@@ -190,6 +191,11 @@ protected:
already_AddRefed RemoveSheet(StyleSheet& aSheet);
void InsertSheetAt(size_t aIndex, StyleSheet& aSheet);
+ void AddSizeOfExcludingThis(nsWindowSizes&) const;
+ void AddSizeOfOwnedSheetArrayExcludingThis(
+ nsWindowSizes&,
+ const nsTArray>&) const;
+
nsIContent* Retarget(nsIContent* aContent) const;
/**
diff --git a/dom/base/ScreenOrientation.cpp b/dom/base/ScreenOrientation.cpp
index 694d9cdd8d6d..3b219137a847 100644
--- a/dom/base/ScreenOrientation.cpp
+++ b/dom/base/ScreenOrientation.cpp
@@ -34,34 +34,34 @@ NS_IMPL_ADDREF_INHERITED(ScreenOrientation, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(ScreenOrientation, DOMEventTargetHelper)
static OrientationType
-InternalOrientationToType(ScreenOrientationInternal aOrientation)
+InternalOrientationToType(hal::ScreenOrientation aOrientation)
{
switch (aOrientation) {
- case eScreenOrientation_PortraitPrimary:
+ case hal::eScreenOrientation_PortraitPrimary:
return OrientationType::Portrait_primary;
- case eScreenOrientation_PortraitSecondary:
+ case hal::eScreenOrientation_PortraitSecondary:
return OrientationType::Portrait_secondary;
- case eScreenOrientation_LandscapePrimary:
+ case hal::eScreenOrientation_LandscapePrimary:
return OrientationType::Landscape_primary;
- case eScreenOrientation_LandscapeSecondary:
+ case hal::eScreenOrientation_LandscapeSecondary:
return OrientationType::Landscape_secondary;
default:
MOZ_CRASH("Bad aOrientation value");
}
}
-static ScreenOrientationInternal
+static hal::ScreenOrientation
OrientationTypeToInternal(OrientationType aOrientation)
{
switch (aOrientation) {
case OrientationType::Portrait_primary:
- return eScreenOrientation_PortraitPrimary;
+ return hal::eScreenOrientation_PortraitPrimary;
case OrientationType::Portrait_secondary:
- return eScreenOrientation_PortraitSecondary;
+ return hal::eScreenOrientation_PortraitSecondary;
case OrientationType::Landscape_primary:
- return eScreenOrientation_LandscapePrimary;
+ return hal::eScreenOrientation_LandscapePrimary;
case OrientationType::Landscape_secondary:
- return eScreenOrientation_LandscapeSecondary;
+ return hal::eScreenOrientation_LandscapeSecondary;
default:
MOZ_CRASH("Bad aOrientation value");
}
@@ -121,7 +121,7 @@ public:
LockOrientationTask(ScreenOrientation* aScreenOrientation,
Promise* aPromise,
- ScreenOrientationInternal aOrientationLock,
+ hal::ScreenOrientation aOrientationLock,
nsIDocument* aDocument,
bool aIsFullScreen);
protected:
@@ -129,7 +129,7 @@ protected:
RefPtr mScreenOrientation;
RefPtr mPromise;
- ScreenOrientationInternal mOrientationLock;
+ hal::ScreenOrientation mOrientationLock;
nsCOMPtr mDocument;
bool mIsFullScreen;
};
@@ -138,7 +138,7 @@ NS_IMPL_ISUPPORTS(ScreenOrientation::LockOrientationTask, nsIRunnable)
ScreenOrientation::LockOrientationTask::LockOrientationTask(
ScreenOrientation* aScreenOrientation, Promise* aPromise,
- ScreenOrientationInternal aOrientationLock,
+ hal::ScreenOrientation aOrientationLock,
nsIDocument* aDocument, bool aIsFullScreen)
: mScreenOrientation(aScreenOrientation), mPromise(aPromise),
mOrientationLock(aOrientationLock), mDocument(aDocument),
@@ -180,7 +180,7 @@ ScreenOrientation::LockOrientationTask::Run()
return NS_OK;
}
- if (mOrientationLock == eScreenOrientation_None) {
+ if (mOrientationLock == hal::eScreenOrientation_None) {
mScreenOrientation->UnlockDeviceOrientation();
mPromise->MaybeResolveWithUndefined();
mDocument->SetOrientationPendingPromise(nullptr);
@@ -201,7 +201,7 @@ ScreenOrientation::LockOrientationTask::Run()
}
if (OrientationLockContains(mDocument->CurrentOrientationType()) ||
- (mOrientationLock == eScreenOrientation_Default &&
+ (mOrientationLock == hal::eScreenOrientation_Default &&
mDocument->CurrentOrientationAngle() == 0)) {
// Orientation lock will not cause an orientation change.
mPromise->MaybeResolveWithUndefined();
@@ -214,37 +214,37 @@ ScreenOrientation::LockOrientationTask::Run()
already_AddRefed
ScreenOrientation::Lock(OrientationLockType aOrientation, ErrorResult& aRv)
{
- ScreenOrientationInternal orientation = eScreenOrientation_None;
+ hal::ScreenOrientation orientation = hal::eScreenOrientation_None;
switch (aOrientation) {
case OrientationLockType::Any:
- orientation = eScreenOrientation_PortraitPrimary |
- eScreenOrientation_PortraitSecondary |
- eScreenOrientation_LandscapePrimary |
- eScreenOrientation_LandscapeSecondary;
+ orientation = hal::eScreenOrientation_PortraitPrimary |
+ hal::eScreenOrientation_PortraitSecondary |
+ hal::eScreenOrientation_LandscapePrimary |
+ hal::eScreenOrientation_LandscapeSecondary;
break;
case OrientationLockType::Natural:
- orientation |= eScreenOrientation_Default;
+ orientation |= hal::eScreenOrientation_Default;
break;
case OrientationLockType::Landscape:
- orientation = eScreenOrientation_LandscapePrimary |
- eScreenOrientation_LandscapeSecondary;
+ orientation = hal::eScreenOrientation_LandscapePrimary |
+ hal::eScreenOrientation_LandscapeSecondary;
break;
case OrientationLockType::Portrait:
- orientation = eScreenOrientation_PortraitPrimary |
- eScreenOrientation_PortraitSecondary;
+ orientation = hal::eScreenOrientation_PortraitPrimary |
+ hal::eScreenOrientation_PortraitSecondary;
break;
case OrientationLockType::Portrait_primary:
- orientation = eScreenOrientation_PortraitPrimary;
+ orientation = hal::eScreenOrientation_PortraitPrimary;
break;
case OrientationLockType::Portrait_secondary:
- orientation = eScreenOrientation_PortraitSecondary;
+ orientation = hal::eScreenOrientation_PortraitSecondary;
break;
case OrientationLockType::Landscape_primary:
- orientation = eScreenOrientation_LandscapePrimary;
+ orientation = hal::eScreenOrientation_LandscapePrimary;
break;
case OrientationLockType::Landscape_secondary:
- orientation = eScreenOrientation_LandscapeSecondary;
+ orientation = hal::eScreenOrientation_LandscapeSecondary;
break;
default:
NS_WARNING("Unexpected orientation type");
@@ -283,7 +283,8 @@ AbortOrientationPromises(nsIDocShell* aDocShell)
}
already_AddRefed
-ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorResult& aRv)
+ScreenOrientation::LockInternal(hal::ScreenOrientation aOrientation,
+ ErrorResult& aRv)
{
// Steps to apply an orientation lock as defined in spec.
@@ -349,7 +350,7 @@ ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorRes
}
bool
-ScreenOrientation::LockDeviceOrientation(ScreenOrientationInternal aOrientation,
+ScreenOrientation::LockDeviceOrientation(hal::ScreenOrientation aOrientation,
bool aIsFullScreen, ErrorResult& aRv)
{
if (!GetOwner()) {
@@ -389,7 +390,7 @@ ScreenOrientation::LockDeviceOrientation(ScreenOrientationInternal aOrientation,
void
ScreenOrientation::Unlock(ErrorResult& aRv)
{
- RefPtr p = LockInternal(eScreenOrientation_None, aRv);
+ RefPtr p = LockInternal(hal::eScreenOrientation_None, aRv);
}
void
@@ -514,11 +515,11 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
return;
}
- ScreenOrientationInternal orientation = aConfiguration.orientation();
- if (orientation != eScreenOrientation_PortraitPrimary &&
- orientation != eScreenOrientation_PortraitSecondary &&
- orientation != eScreenOrientation_LandscapePrimary &&
- orientation != eScreenOrientation_LandscapeSecondary) {
+ hal::ScreenOrientation orientation = aConfiguration.orientation();
+ if (orientation != hal::eScreenOrientation_PortraitPrimary &&
+ orientation != hal::eScreenOrientation_PortraitSecondary &&
+ orientation != hal::eScreenOrientation_LandscapePrimary &&
+ orientation != hal::eScreenOrientation_LandscapeSecondary) {
// The platform may notify of some other values from
// an orientation lock, but we only care about real
// changes to screen orientation which result in one of
@@ -564,9 +565,10 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
}
void
-ScreenOrientation::UpdateActiveOrientationLock(ScreenOrientationInternal aOrientation)
+ScreenOrientation::UpdateActiveOrientationLock(
+ hal::ScreenOrientation aOrientation)
{
- if (aOrientation == eScreenOrientation_None) {
+ if (aOrientation == hal::eScreenOrientation_None) {
hal::UnlockScreenOrientation();
} else {
DebugOnly ok = hal::LockScreenOrientation(aOrientation);
diff --git a/dom/base/ScreenOrientation.h b/dom/base/ScreenOrientation.h
index 54c44ab30d06..61e0bb4149c1 100644
--- a/dom/base/ScreenOrientation.h
+++ b/dom/base/ScreenOrientation.h
@@ -18,18 +18,6 @@ namespace mozilla {
namespace dom {
class Promise;
-// Make sure that any change to ScreenOrientationInternal values are
-// also made in mobile/android/base/GeckoScreenOrientation.java
-typedef uint32_t ScreenOrientationInternal;
-
-static const ScreenOrientationInternal eScreenOrientation_None = 0;
-static const ScreenOrientationInternal eScreenOrientation_PortraitPrimary = 1u << 0;
-static const ScreenOrientationInternal eScreenOrientation_PortraitSecondary = 1u << 1;
-static const ScreenOrientationInternal eScreenOrientation_LandscapePrimary = 1u << 2;
-static const ScreenOrientationInternal eScreenOrientation_LandscapeSecondary = 1u << 3;
-//eScreenOrientation_Default will use the natural orientation for the deivce,
-//it could be PortraitPrimary or LandscapePrimary depends on display resolution
-static const ScreenOrientationInternal eScreenOrientation_Default = 1u << 4;
class ScreenOrientation final : public DOMEventTargetHelper,
public mozilla::hal::ScreenConfigurationObserver
@@ -63,7 +51,7 @@ public:
void Notify(const mozilla::hal::ScreenConfiguration& aConfiguration) override;
- static void UpdateActiveOrientationLock(ScreenOrientationInternal aOrientation);
+ static void UpdateActiveOrientationLock(hal::ScreenOrientation aOrientation);
private:
virtual ~ScreenOrientation();
@@ -86,7 +74,7 @@ private:
// This method calls into the HAL to lock the device and sets
// up listeners for full screen change.
- bool LockDeviceOrientation(ScreenOrientationInternal aOrientation,
+ bool LockDeviceOrientation(hal::ScreenOrientation aOrientation,
bool aIsFullscreen, ErrorResult& aRv);
// This method calls in to the HAL to unlock the device and removes
@@ -94,10 +82,10 @@ private:
void UnlockDeviceOrientation();
// This method performs the same function as |Lock| except it takes
- // a ScreenOrientationInternal argument instead of an OrientationType.
+ // a hal::ScreenOrientation argument instead of an OrientationType.
// This method exists in order to share implementation with nsScreen that
- // uses ScreenOrientationInternal.
- already_AddRefed LockInternal(ScreenOrientationInternal aOrientation,
+ // uses ScreenOrientation.
+ already_AddRefed LockInternal(hal::ScreenOrientation aOrientation,
ErrorResult& aRv);
void DispatchChangeEvent();
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp
index f6cf6ba1e5af..f91fa935a189 100644
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -10,10 +10,11 @@
#include "ChildIterator.h"
#include "nsContentUtils.h"
#include "nsIStyleSheetLinkingElement.h"
+#include "nsWindowSizes.h"
+#include "nsXBLPrototypeBinding.h"
#include "mozilla/dom/DirectionalityUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLSlotElement.h"
-#include "nsXBLPrototypeBinding.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
@@ -103,6 +104,21 @@ ShadowRoot::~ShadowRoot()
SetSubtreeRootPointer(this);
}
+MOZ_DEFINE_MALLOC_SIZE_OF(ShadowRootAuthorStylesMallocSizeOf)
+MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ShadowRootAuthorStylesMallocEnclosingSizeOf)
+
+void
+ShadowRoot::AddSizeOfExcludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
+{
+ DocumentFragment::AddSizeOfExcludingThis(aSizes, aNodeSize);
+ DocumentOrShadowRoot::AddSizeOfExcludingThis(aSizes);
+ aSizes.mLayoutShadowDomAuthorStyles +=
+ Servo_AuthorStyles_SizeOfIncludingThis(
+ ShadowRootAuthorStylesMallocSizeOf,
+ ShadowRootAuthorStylesMallocEnclosingSizeOf,
+ mServoStyles.get());
+}
+
JSObject*
ShadowRoot::WrapObject(JSContext* aCx, JS::Handle aGivenProto)
{
diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h
index 3208137cc387..8c759b45e6dc 100644
--- a/dom/base/ShadowRoot.h
+++ b/dom/base/ShadowRoot.h
@@ -55,6 +55,8 @@ public:
ShadowRoot(Element* aElement, ShadowRootMode aMode,
already_AddRefed&& aNodeInfo);
+ void AddSizeOfExcludingThis(nsWindowSizes&, size_t* aNodeSize) const final;
+
// Shadow DOM v1
Element* Host() const
{
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index 908977c04183..7da74bb1b09a 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11764,8 +11764,6 @@ nsIDocument::MaybeActiveMediaComponents()
/* virtual */ void
nsIDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aSizes) const
{
- nsINode::AddSizeOfExcludingThis(aSizes, &aSizes.mDOMOtherSize);
-
if (mPresShell) {
mPresShell->AddSizeOfIncludingThis(aSizes);
}
@@ -11801,21 +11799,6 @@ nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
DocAddSizeOfExcludingThis(aWindowSizes);
}
-static size_t
-SizeOfOwnedSheetArrayExcludingThis(const nsTArray>& aSheets,
- MallocSizeOf aMallocSizeOf)
-{
- size_t n = 0;
- n += aSheets.ShallowSizeOfExcludingThis(aMallocSizeOf);
- for (StyleSheet* sheet : aSheets) {
- if (!sheet->GetAssociatedDocumentOrShadowRoot()) {
- // Avoid over-reporting shared sheets.
- continue;
- }
- n += sheet->SizeOfIncludingThis(aMallocSizeOf);
- }
- return n;
-}
void
nsDocument::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
@@ -11828,15 +11811,15 @@ nsDocument::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
MOZ_CRASH();
}
-static void
-AddSizeOfNodeTree(nsIContent* aNode, nsWindowSizes& aWindowSizes)
+/* static */ void
+nsIDocument::AddSizeOfNodeTree(nsINode& aNode, nsWindowSizes& aWindowSizes)
{
size_t nodeSize = 0;
- aNode->AddSizeOfIncludingThis(aWindowSizes, &nodeSize);
+ aNode.AddSizeOfIncludingThis(aWindowSizes, &nodeSize);
// This is where we transfer the nodeSize obtained from
// nsINode::AddSizeOfIncludingThis() to a value in nsWindowSizes.
- switch (aNode->NodeType()) {
+ switch (aNode.NodeType()) {
case nsINode::ELEMENT_NODE:
aWindowSizes.mDOMElementNodesSize += nodeSize;
break;
@@ -11854,30 +11837,50 @@ AddSizeOfNodeTree(nsIContent* aNode, nsWindowSizes& aWindowSizes)
break;
}
- if (EventListenerManager* elm = aNode->GetExistingListenerManager()) {
+ if (EventListenerManager* elm = aNode.GetExistingListenerManager()) {
aWindowSizes.mDOMEventListenersCount += elm->ListenerCount();
}
- AllChildrenIterator iter(aNode, nsIContent::eAllChildren);
- for (nsIContent* n = iter.GetNextChild(); n; n = iter.GetNextChild()) {
- AddSizeOfNodeTree(n, aWindowSizes);
+ if (aNode.IsContent()) {
+ nsTArray anonKids;
+ nsContentUtils::AppendNativeAnonymousChildren(aNode.AsContent(),
+ anonKids,
+ nsIContent::eAllChildren);
+ for (nsIContent* anonKid : anonKids) {
+ AddSizeOfNodeTree(*anonKid, aWindowSizes);
+ }
+
+ if (auto* element = Element::FromNode(aNode)) {
+ if (ShadowRoot* shadow = element->GetShadowRoot()) {
+ AddSizeOfNodeTree(*shadow, aWindowSizes);
+ }
+
+ for (nsXBLBinding* binding = element->GetXBLBinding();
+ binding;
+ binding = binding->GetBaseBinding()) {
+ if (nsIContent* anonContent = binding->GetAnonymousContent()) {
+ AddSizeOfNodeTree(*anonContent, aWindowSizes);
+ }
+ }
+ }
+ }
+
+ // NOTE(emilio): If you feel smart and want to change this function to use
+ // GetNextNode(), think twice, since you'd need to handle in a
+ // sane way, and kids of won't point to the parent, so we'd never
+ // find the root node where we should stop at.
+ for (nsIContent* kid = aNode.GetFirstChild(); kid; kid = kid->GetNextSibling()) {
+ AddSizeOfNodeTree(*kid, aWindowSizes);
}
}
void
nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
{
- // We use AllChildrenIterator to iterate over DOM nodes in
- // AddSizeOfNodeTree(). The obvious place to start is at the document's root
- // element, using GetRootElement(). However, that will miss comment nodes
- // that are siblings of the root element. Instead we use
- // GetFirstChild()/GetNextSibling() to traverse the document's immediate
- // child nodes, calling AddSizeOfNodeTree() on each to measure them and then
- // all their descendants. (The comment nodes won't have any descendants).
- for (nsIContent* node = nsINode::GetFirstChild();
- node;
- node = node->GetNextSibling()) {
- AddSizeOfNodeTree(node, aWindowSizes);
+ nsINode::AddSizeOfExcludingThis(aWindowSizes, &aWindowSizes.mDOMOtherSize);
+
+ for (nsIContent* kid = GetFirstChild(); kid; kid = kid->GetNextSibling()) {
+ AddSizeOfNodeTree(*kid, aWindowSizes);
}
// IMPORTANT: for our ComputedValues measurements, we want to measure
@@ -11889,13 +11892,9 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
// PresShell, which contains the frame tree.
nsIDocument::DocAddSizeOfExcludingThis(aWindowSizes);
- aWindowSizes.mLayoutStyleSheetsSize +=
- SizeOfOwnedSheetArrayExcludingThis(mStyleSheets,
- aWindowSizes.mState.mMallocSizeOf);
+ DocumentOrShadowRoot::AddSizeOfExcludingThis(aWindowSizes);
for (auto& sheetArray : mAdditionalSheets) {
- aWindowSizes.mLayoutStyleSheetsSize +=
- SizeOfOwnedSheetArrayExcludingThis(sheetArray,
- aWindowSizes.mState.mMallocSizeOf);
+ AddSizeOfOwnedSheetArrayExcludingThis(aWindowSizes, sheetArray);
}
// Lumping in the loader with the style-sheets size is not ideal,
// but most of the things in there are in fact stylesheets, so it
@@ -11911,9 +11910,6 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
aWindowSizes.mDOMOtherSize +=
mStyledLinks.ShallowSizeOfExcludingThis(aWindowSizes.mState.mMallocSizeOf);
- aWindowSizes.mDOMOtherSize +=
- mIdentifierMap.SizeOfExcludingThis(aWindowSizes.mState.mMallocSizeOf);
-
// Measurement of the following members may be added later if DMD finds it
// is worthwhile:
// - many!
diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp
index 5bc2020b423a..b95e72a0af7b 100644
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -4425,6 +4425,7 @@ nsGlobalWindowInner::ResetVRTelemetry(bool aUpdate)
}
}
+#ifndef XP_WIN // This guard should match the guard at the callsite.
static bool ShouldShowFocusRingIfFocusedByMouse(nsIContent* aNode)
{
if (!aNode) {
@@ -4433,6 +4434,7 @@ static bool ShouldShowFocusRingIfFocusedByMouse(nsIContent* aNode)
return !nsContentUtils::ContentIsLink(aNode) &&
!aNode->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio);
}
+#endif
void
nsGlobalWindowInner::SetFocusedElement(Element* aElement,
diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h
index ea0d4d3db453..9af1eba292c7 100644
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -3017,6 +3017,10 @@ public:
bool IsSyntheticDocument() const { return mIsSyntheticDocument; }
+ // Adds the size of a given node, which must not be a document node, to the
+ // window sizes passed-in.
+ static void AddSizeOfNodeTree(nsINode&, nsWindowSizes&);
+
// Note: nsIDocument is a sub-class of nsINode, which has a
// SizeOfExcludingThis function. However, because nsIDocument objects can
// only appear at the top of the DOM tree, we have a specialized measurement
diff --git a/dom/base/nsScreen.cpp b/dom/base/nsScreen.cpp
index b5c36b516c91..bd93de1fee1e 100644
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -188,7 +188,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation,
static void
UpdateDocShellOrientationLock(nsPIDOMWindowInner* aWindow,
- ScreenOrientationInternal aOrientation)
+ hal::ScreenOrientation aOrientation)
{
if (!aWindow) {
return;
@@ -228,27 +228,27 @@ nsScreen::MozLockOrientation(const Sequence& aOrientations,
if (ShouldResistFingerprinting()) {
return false;
}
- ScreenOrientationInternal orientation = eScreenOrientation_None;
+ hal::ScreenOrientation orientation = hal::eScreenOrientation_None;
for (uint32_t i = 0; i < aOrientations.Length(); ++i) {
const nsString& item = aOrientations[i];
if (item.EqualsLiteral("portrait")) {
- orientation |= eScreenOrientation_PortraitPrimary |
- eScreenOrientation_PortraitSecondary;
+ orientation |= hal::eScreenOrientation_PortraitPrimary |
+ hal::eScreenOrientation_PortraitSecondary;
} else if (item.EqualsLiteral("portrait-primary")) {
- orientation |= eScreenOrientation_PortraitPrimary;
+ orientation |= hal::eScreenOrientation_PortraitPrimary;
} else if (item.EqualsLiteral("portrait-secondary")) {
- orientation |= eScreenOrientation_PortraitSecondary;
+ orientation |= hal::eScreenOrientation_PortraitSecondary;
} else if (item.EqualsLiteral("landscape")) {
- orientation |= eScreenOrientation_LandscapePrimary |
- eScreenOrientation_LandscapeSecondary;
+ orientation |= hal::eScreenOrientation_LandscapePrimary |
+ hal::eScreenOrientation_LandscapeSecondary;
} else if (item.EqualsLiteral("landscape-primary")) {
- orientation |= eScreenOrientation_LandscapePrimary;
+ orientation |= hal::eScreenOrientation_LandscapePrimary;
} else if (item.EqualsLiteral("landscape-secondary")) {
- orientation |= eScreenOrientation_LandscapeSecondary;
+ orientation |= hal::eScreenOrientation_LandscapeSecondary;
} else if (item.EqualsLiteral("default")) {
- orientation |= eScreenOrientation_Default;
+ orientation |= hal::eScreenOrientation_Default;
} else {
// If we don't recognize the token, we should just return 'false'
// without throwing.
@@ -278,7 +278,7 @@ nsScreen::MozUnlockOrientation()
if (ShouldResistFingerprinting()) {
return;
}
- UpdateDocShellOrientationLock(GetOwner(), eScreenOrientation_None);
+ UpdateDocShellOrientationLock(GetOwner(), hal::eScreenOrientation_None);
mScreenOrientation->UnlockDeviceOrientation();
}
diff --git a/dom/base/nsWindowMemoryReporter.cpp b/dom/base/nsWindowMemoryReporter.cpp
index 053176ba64ae..846ac4a5d6f7 100644
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -353,7 +353,15 @@ CollectWindowReports(nsGlobalWindowInner *aWindow,
"other 'dom/' numbers.");
REPORT_SIZE("/layout/style-sheets", mLayoutStyleSheetsSize,
- "Memory used by style sheets within a window.");
+ "Memory used by document style sheets within a window.");
+
+ REPORT_SIZE("/layout/shadow-dom/style-sheets", mLayoutShadowDomStyleSheetsSize,
+ "Memory used by Shadow DOM style sheets within a window.");
+
+ // TODO(emilio): We might want to split this up between invalidation map /
+ // element-and-pseudos / revalidation too just like the style set.
+ REPORT_SIZE("/layout/shadow-dom/author-styles", mLayoutShadowDomAuthorStyles,
+ "Memory used by Shadow DOM computed rule data within a window.");
REPORT_SIZE("/layout/pres-shell", mLayoutPresShellSize,
"Memory used by layout's PresShell, along with any structures "
@@ -415,10 +423,6 @@ CollectWindowReports(nsGlobalWindowInner *aWindow,
REPORT_SIZE("/layout/computed-values/visited", mLayoutComputedValuesVisited,
"Memory used by ComputedValues objects used for visited styles.");
- REPORT_SIZE("/layout/computed-values/stale", mLayoutComputedValuesStale,
- "Memory used by ComputedValues and style structs it holds that "
- "is no longer used but still alive.");
-
REPORT_SIZE("/property-tables", mPropertyTablesSize,
"Memory used for the property tables within a window.");
diff --git a/dom/base/nsWindowSizes.h b/dom/base/nsWindowSizes.h
index d07bec886c5a..dd3f182c4eb2 100644
--- a/dom/base/nsWindowSizes.h
+++ b/dom/base/nsWindowSizes.h
@@ -167,6 +167,8 @@ class nsWindowSizes
macro(DOM, mDOMPerformanceResourceEntries) \
macro(DOM, mDOMOtherSize) \
macro(Style, mLayoutStyleSheetsSize) \
+ macro(Style, mLayoutShadowDomStyleSheetsSize) \
+ macro(Style, mLayoutShadowDomAuthorStyles) \
macro(Other, mLayoutPresShellSize) \
macro(Style, mLayoutStyleSetsStylistRuleTree) \
macro(Style, mLayoutStyleSetsStylistElementAndPseudosMaps) \
@@ -181,7 +183,6 @@ class nsWindowSizes
macro(Style, mLayoutComputedValuesDom) \
macro(Style, mLayoutComputedValuesNonDom) \
macro(Style, mLayoutComputedValuesVisited) \
- macro(Style, mLayoutComputedValuesStale) \
macro(Other, mPropertyTablesSize) \
macro(Other, mBindingsSize) \
diff --git a/dom/clients/manager/ClientOpenWindowUtils.cpp b/dom/clients/manager/ClientOpenWindowUtils.cpp
index a01f96cc6fd5..350ecc5f2e45 100644
--- a/dom/clients/manager/ClientOpenWindowUtils.cpp
+++ b/dom/clients/manager/ClientOpenWindowUtils.cpp
@@ -17,6 +17,7 @@
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsIWindowWatcher.h"
+#include "nsIXPConnect.h"
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowWatcher.h"
diff --git a/dom/clients/manager/ClientPrefs.cpp b/dom/clients/manager/ClientPrefs.cpp
index 73c0d35ef1a5..a85c8b2a4cb8 100644
--- a/dom/clients/manager/ClientPrefs.cpp
+++ b/dom/clients/manager/ClientPrefs.cpp
@@ -6,6 +6,8 @@
#include "ClientPrefs.h"
+#include "mozilla/Preferences.h"
+
namespace mozilla {
namespace dom {
diff --git a/dom/gamepad/GamepadManager.cpp b/dom/gamepad/GamepadManager.cpp
index 1be244d9a699..6273c2779db5 100644
--- a/dom/gamepad/GamepadManager.cpp
+++ b/dom/gamepad/GamepadManager.cpp
@@ -211,8 +211,15 @@ GamepadManager::GetGamepad(uint32_t aIndex) const
return nullptr;
}
+already_AddRefed
+GamepadManager::GetGamepad(uint32_t aGamepadId, GamepadServiceType aServiceType) const
+{
+ return GetGamepad(GetGamepadIndexWithServiceType(aGamepadId, aServiceType));
+}
+
+
uint32_t GamepadManager::GetGamepadIndexWithServiceType(uint32_t aIndex,
- GamepadServiceType aServiceType)
+ GamepadServiceType aServiceType) const
{
uint32_t newIndex = 0;
diff --git a/dom/gamepad/GamepadManager.h b/dom/gamepad/GamepadManager.h
index 27827a5ad733..f7aaba6a4c1d 100644
--- a/dom/gamepad/GamepadManager.h
+++ b/dom/gamepad/GamepadManager.h
@@ -60,6 +60,9 @@ class GamepadManager final : public nsIObserver
// Returns gamepad object if index exists, null otherwise
already_AddRefed GetGamepad(uint32_t aIndex) const;
+ // Returns gamepad object if GamepadId exists, null otherwise
+ already_AddRefed GetGamepad(uint32_t aGamepadId, GamepadServiceType aServiceType) const;
+
// Receive GamepadChangeEvent messages from parent process to fire DOM events
void Update(const GamepadChangeEvent& aGamepadEvent);
@@ -132,7 +135,7 @@ class GamepadManager final : public nsIObserver
bool aHasSeen = true);
// Our gamepad index has VR_GAMEPAD_IDX_OFFSET while GamepadChannelType
// is from VRManager.
- uint32_t GetGamepadIndexWithServiceType(uint32_t aIndex, GamepadServiceType aServiceType);
+ uint32_t GetGamepadIndexWithServiceType(uint32_t aIndex, GamepadServiceType aServiceType) const;
// Gamepads connected to the system. Copies of these are handed out
// to each window.
diff --git a/dom/ipc/DOMTypes.ipdlh b/dom/ipc/DOMTypes.ipdlh
index d4bf3e12499d..80fd51d53923 100644
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -24,7 +24,7 @@ using CSSToLayoutDeviceScale from "Units.h";
using CSSRect from "Units.h";
using CSSSize from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
-using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
+using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
@@ -100,7 +100,7 @@ struct DimensionInfo
{
CSSRect rect;
CSSSize size;
- ScreenOrientationInternal orientation;
+ ScreenOrientation orientation;
LayoutDeviceIntPoint clientOffset;
LayoutDeviceIntPoint chromeOffset;
};
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index 0f07c36d5582..8e01d71792eb 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -408,7 +408,7 @@ TabChild::TabChild(nsIContentChild* aManager,
, mDidFakeShow(false)
, mNotified(false)
, mTriedBrowserInit(false)
- , mOrientation(eScreenOrientation_PortraitPrimary)
+ , mOrientation(hal::eScreenOrientation_PortraitPrimary)
, mIgnoreKeyPressEvent(false)
, mHasValidInnerSize(false)
, mDestroyed(false)
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index 5ac1a58bdbab..a33b77c15cfb 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -477,7 +477,7 @@ public:
mMaxTouchPoints = aMaxTouchPoints;
}
- ScreenOrientationInternal GetOrientation() const { return mOrientation; }
+ hal::ScreenOrientation GetOrientation() const { return mOrientation; }
void SetBackgroundColor(const nscolor& aColor);
@@ -828,7 +828,7 @@ private:
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
- ScreenOrientationInternal mOrientation;
+ hal::ScreenOrientation mOrientation;
bool mIgnoreKeyPressEvent;
RefPtr mAPZEventState;
diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp
index 4a4a945be1a4..394589fddbc1 100644
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -769,7 +769,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
- ScreenOrientationInternal orientation = config.orientation();
+ hal::ScreenOrientation orientation = config.orientation();
LayoutDeviceIntPoint clientOffset = GetClientOffset();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h
index 12a7ba4c8add..5dc8ef034c5c 100644
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -637,7 +637,7 @@ protected:
nsIntRect mRect;
ScreenIntSize mDimensions;
- ScreenOrientationInternal mOrientation;
+ hal::ScreenOrientation mOrientation;
float mDPI;
int32_t mRounding;
CSSToLayoutDeviceScale mDefaultScale;
diff --git a/dom/tests/browser/browser_bug1236512.js b/dom/tests/browser/browser_bug1236512.js
index ba46d9d81c52..939092a847bf 100644
--- a/dom/tests/browser/browser_bug1236512.js
+++ b/dom/tests/browser/browser_bug1236512.js
@@ -43,12 +43,16 @@ async function waitContentVisibilityChange(aIsHidden, aBrowser) {
*/
add_task(async function() {
info("creating test window");
+ let winTest = await BrowserTestUtils.openNewBrowserWindow();
// Specify the width, height, left and top, so that the new window can be
// fully covered by "window".
- let winTest = await BrowserTestUtils.openNewBrowserWindow({ width: 500,
- height: 500,
- left: 200,
- top: 200 });
+ let resizePromise = BrowserTestUtils.waitForEvent(winTest, "resize", false, e => {
+ return winTest.innerHeight <= 500 && winTest.innerWidth <= 500;
+ });
+ winTest.moveTo(200, 200);
+ winTest.resizeTo(500, 500);
+ await resizePromise;
+
let browserTest = winTest.gBrowser;
info(`loading test page: ${testPageURL}`);
diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp
index d7b9d8560db2..b0b49b7ad1e3 100644
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -10,7 +10,6 @@
#include "gfxPrefs.h" // for gfxPrefs::LayersTile...
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Hal.h"
-#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/dom/TabChild.h" // for TabChild
#include "mozilla/dom/TabGroup.h" // for TabGroup
#include "mozilla/hal_sandbox/PHal.h" // for ScreenConfiguration
@@ -213,7 +212,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// If the last transaction was incomplete (a failed DoEmptyTransaction),
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding
// to the previous transaction.
- dom::ScreenOrientationInternal orientation;
+ hal::ScreenOrientation orientation;
if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
orientation = window->GetOrientation();
} else {
diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp
index 513ceb358410..7e1eff23073c 100644
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -55,10 +55,10 @@ namespace layers {
using namespace mozilla::gfx;
static bool
-IsSameDimension(dom::ScreenOrientationInternal o1, dom::ScreenOrientationInternal o2)
+IsSameDimension(hal::ScreenOrientation o1, hal::ScreenOrientation o2)
{
- bool isO1portrait = (o1 == dom::eScreenOrientation_PortraitPrimary || o1 == dom::eScreenOrientation_PortraitSecondary);
- bool isO2portrait = (o2 == dom::eScreenOrientation_PortraitPrimary || o2 == dom::eScreenOrientation_PortraitSecondary);
+ bool isO1portrait = (o1 == hal::eScreenOrientation_PortraitPrimary || o1 == hal::eScreenOrientation_PortraitSecondary);
+ bool isO2portrait = (o2 == hal::eScreenOrientation_PortraitPrimary || o2 == hal::eScreenOrientation_PortraitSecondary);
return !(isO1portrait ^ isO2portrait);
}
@@ -132,9 +132,8 @@ AsyncCompositionManager::ResolveRefLayers(CompositorBridgeParent* aCompositor,
}
if (!refLayer->GetLocalVisibleRegion().IsEmpty()) {
- dom::ScreenOrientationInternal chromeOrientation =
- mTargetConfig.orientation();
- dom::ScreenOrientationInternal contentOrientation =
+ hal::ScreenOrientation chromeOrientation = mTargetConfig.orientation();
+ hal::ScreenOrientation contentOrientation =
state->mTargetConfig.orientation();
if (!IsSameDimension(chromeOrientation, contentOrientation) &&
ContentMightReflowOnOrientationChange(mTargetConfig.naturalBounds())) {
diff --git a/gfx/layers/composite/AsyncCompositionManager.h b/gfx/layers/composite/AsyncCompositionManager.h
index 079b5d3e0aaf..62d2e98d47af 100644
--- a/gfx/layers/composite/AsyncCompositionManager.h
+++ b/gfx/layers/composite/AsyncCompositionManager.h
@@ -12,9 +12,9 @@
#include "mozilla/Attributes.h" // for final, etc
#include "mozilla/RefPtr.h" // for RefCounted
#include "mozilla/TimeStamp.h" // for TimeStamp
-#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
+#include "mozilla/HalScreenConfiguration.h" // For ScreenOrientation
#include "mozilla/layers/FrameUniformityData.h" // For FrameUniformityData
#include "mozilla/layers/LayersMessages.h" // for TargetConfig
#include "mozilla/RefPtr.h" // for nsRefPtr
@@ -102,7 +102,7 @@ public:
mTargetConfig = aTargetConfig;
}
- bool RequiresReorientation(mozilla::dom::ScreenOrientationInternal aOrientation) const
+ bool RequiresReorientation(hal::ScreenOrientation aOrientation) const
{
return mTargetConfig.orientation() != aOrientation;
}
diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh
index 621172e75bdf..40ea954f9369 100644
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -27,7 +27,7 @@ using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
using nsCSSPropertyID from "nsCSSPropertyID.h";
-using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
+using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::LayerMargin from "Units.h";
using mozilla::LayerPoint from "Units.h";
@@ -60,7 +60,7 @@ namespace layers {
struct TargetConfig {
IntRect naturalBounds;
ScreenRotation rotation;
- ScreenOrientationInternal orientation;
+ ScreenOrientation orientation;
nsIntRegion clearRegion;
};
diff --git a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
index 46bea3f67f2e..4312c2873020 100644
--- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
@@ -91,6 +91,9 @@ already_AddRefed
SurfaceDescriptorX11::OpenForeign() const
{
Display* display = DefaultXDisplay();
+ if (!display) {
+ return nullptr;
+ }
Screen* screen = DefaultScreenOfDisplay(display);
RefPtr surf;
diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp
index f2d6acffa9f2..6df38537a682 100644
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -65,13 +65,13 @@ class Transaction
public:
Transaction()
: mTargetRotation(ROTATION_0)
- , mTargetOrientation(dom::eScreenOrientation_None)
+ , mTargetOrientation(hal::eScreenOrientation_None)
, mOpen(false)
, mRotationChanged(false)
{}
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
- dom::ScreenOrientationInternal aOrientation)
+ hal::ScreenOrientation aOrientation)
{
mOpen = true;
mTargetBounds = aTargetBounds;
@@ -142,7 +142,7 @@ public:
ShadowableLayerSet mSimpleMutants;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
- dom::ScreenOrientationInternal mTargetOrientation;
+ hal::ScreenOrientation mTargetOrientation;
private:
bool mOpen;
@@ -285,7 +285,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
void
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
- dom::ScreenOrientationInternal aOrientation)
+ hal::ScreenOrientation aOrientation)
{
MOZ_ASSERT(IPCOpen(), "no manager to forward to");
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");
diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h
index 845592c08b17..b47cc39a981c 100644
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -13,8 +13,8 @@
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/WidgetUtils.h" // for ScreenRotation
-#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
+#include "mozilla/HalScreenConfiguration.h" // for ScreenOrientation
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/FocusTarget.h"
#include "mozilla/layers/LayersTypes.h"
@@ -158,7 +158,7 @@ public:
*/
void BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
- mozilla::dom::ScreenOrientationInternal aOrientation);
+ hal::ScreenOrientation aOrientation);
/**
* The following methods may only be called after BeginTransaction()
diff --git a/gfx/vr/VRDisplayClient.cpp b/gfx/vr/VRDisplayClient.cpp
index be4794a6dc90..a50d9a9e45e1 100644
--- a/gfx/vr/VRDisplayClient.cpp
+++ b/gfx/vr/VRDisplayClient.cpp
@@ -13,6 +13,7 @@
#include "nsRefPtrHashtable.h"
#include "nsString.h"
#include "mozilla/dom/GamepadManager.h"
+#include "mozilla/dom/Gamepad.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "nsServiceManagerUtils.h"
@@ -169,7 +170,8 @@ VRDisplayClient::FireGamepadEvents()
}
// Send events to notify that new controllers are added
- if (lastState.controllerName[0] == '\0') {
+ RefPtr existing = gamepadManager->GetGamepad(gamepadId, dom::GamepadServiceType::VR);
+ if (lastState.controllerName[0] == '\0' || !existing) {
dom::GamepadAdded info(NS_ConvertUTF8toUTF16(state.controllerName),
dom::GamepadMappingType::_empty,
state.hand,
diff --git a/gfx/vr/ipc/VRManagerChild.h b/gfx/vr/ipc/VRManagerChild.h
index c6543c3f0b9b..2e9669da2d29 100644
--- a/gfx/vr/ipc/VRManagerChild.h
+++ b/gfx/vr/ipc/VRManagerChild.h
@@ -7,6 +7,7 @@
#ifndef MOZILLA_GFX_VR_VRMANAGERCHILD_H
#define MOZILLA_GFX_VR_VRMANAGERCHILD_H
+#include "mozilla/dom/WindowBinding.h" // For FrameRequestCallback
#include "mozilla/gfx/PVRManagerChild.h"
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
diff --git a/gfx/webrender_bindings/RenderD3D11TextureHostOGL.cpp b/gfx/webrender_bindings/RenderD3D11TextureHostOGL.cpp
index 502776cfe71f..607b09f022a1 100644
--- a/gfx/webrender_bindings/RenderD3D11TextureHostOGL.cpp
+++ b/gfx/webrender_bindings/RenderD3D11TextureHostOGL.cpp
@@ -17,26 +17,6 @@
namespace mozilla {
namespace wr {
-static EGLint
-GetEGLTextureFormat(gfx::SurfaceFormat aFormat)
-{
- switch (aFormat) {
- case gfx::SurfaceFormat::B8G8R8A8:
- case gfx::SurfaceFormat::B8G8R8X8:
- case gfx::SurfaceFormat::R8G8B8A8:
- case gfx::SurfaceFormat::R8G8B8X8:
- case gfx::SurfaceFormat::A8R8G8B8:
- case gfx::SurfaceFormat::X8R8G8B8:
- return LOCAL_EGL_TEXTURE_RGBA;
- case gfx::SurfaceFormat::R8G8B8:
- case gfx::SurfaceFormat::B8G8R8:
- return LOCAL_EGL_TEXTURE_RGB;
- default:
- gfxCriticalError() << "GetEGLTextureFormat(): unexpected texture format";
- return LOCAL_EGL_TEXTURE_RGBA;
- }
-}
-
RenderDXGITextureHostOGL::RenderDXGITextureHostOGL(WindowsHandle aHandle,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize)
diff --git a/hal/Hal.cpp b/hal/Hal.cpp
index c462c535d26a..696cf69a6609 100644
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -21,7 +21,6 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Observer.h"
#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "WindowIdentifier.h"
#ifdef XP_WIN
@@ -539,7 +538,7 @@ NotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration)
}
bool
-LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
+LockScreenOrientation(const ScreenOrientation& aOrientation)
{
AssertMainThread();
RETURN_PROXY_IF_SANDBOXED(LockScreenOrientation(aOrientation), false);
diff --git a/hal/Hal.h b/hal/Hal.h
index 34fcb3af8ce8..1dc8bf6bbf32 100644
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/platform_thread.h"
#include "nsTArray.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/hal_sandbox/PHal.h"
#include "mozilla/HalBatteryInformation.h"
#include "mozilla/HalNetworkInformation.h"
@@ -225,7 +224,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
* Lock the screen orientation to the specific orientation.
* @return Whether the lock has been accepted.
*/
-MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
+MOZ_MUST_USE bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation);
/**
* Unlock the screen orientation.
diff --git a/hal/HalScreenConfiguration.h b/hal/HalScreenConfiguration.h
index dce84fd31d50..a3abec5c62bb 100644
--- a/hal/HalScreenConfiguration.h
+++ b/hal/HalScreenConfiguration.h
@@ -11,8 +11,23 @@
namespace mozilla {
namespace hal {
+
+// Make sure that any change to ScreenOrientation values are also made in
+// mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
+typedef uint32_t ScreenOrientation;
+
+static const ScreenOrientation eScreenOrientation_None = 0;
+static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
+static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
+static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
+static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
+//eScreenOrientation_Default will use the natural orientation for the deivce,
+//it could be PortraitPrimary or LandscapePrimary depends on display resolution
+static const ScreenOrientation eScreenOrientation_Default = 1u << 4;
+
class ScreenConfiguration;
typedef Observer ScreenConfigurationObserver;
+
} // namespace hal
} // namespace mozilla
diff --git a/hal/android/AndroidHal.cpp b/hal/android/AndroidHal.cpp
index 6c927980dec6..c045b61fb93d 100644
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -8,8 +8,8 @@
#include "WindowIdentifier.h"
#include "AndroidBridge.h"
#include "mozilla/dom/network/Constants.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "nsIScreenManager.h"
+#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla::dom;
@@ -125,7 +125,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
int32_t colorDepth, pixelDepth;
int16_t angle;
- ScreenOrientationInternal orientation;
+ ScreenOrientation orientation;
nsCOMPtr screen;
int32_t rectX, rectY, rectWidth, rectHeight;
@@ -135,7 +135,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
- orientation = static_cast(bridge->GetScreenOrientation());
+ orientation = static_cast(bridge->GetScreenOrientation());
angle = bridge->GetScreenAngle();
*aScreenConfiguration =
@@ -144,10 +144,10 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
}
bool
-LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
+LockScreenOrientation(const ScreenOrientation& aOrientation)
{
// Force the default orientation to be portrait-primary.
- ScreenOrientationInternal orientation =
+ ScreenOrientation orientation =
aOrientation == eScreenOrientation_Default ? eScreenOrientation_PortraitPrimary
: aOrientation;
diff --git a/hal/fallback/FallbackScreenConfiguration.cpp b/hal/fallback/FallbackScreenConfiguration.cpp
index fe35eb9cde47..5cc8be5e2313 100644
--- a/hal/fallback/FallbackScreenConfiguration.cpp
+++ b/hal/fallback/FallbackScreenConfiguration.cpp
@@ -24,7 +24,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
bool
-LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
+LockScreenOrientation(const ScreenOrientation& aOrientation)
{
return false;
}
diff --git a/hal/fallback/FallbackScreenConfiguration.h b/hal/fallback/FallbackScreenConfiguration.h
index f017a503ed68..5eb094ef8326 100644
--- a/hal/fallback/FallbackScreenConfiguration.h
+++ b/hal/fallback/FallbackScreenConfiguration.h
@@ -6,7 +6,6 @@
#define mozilla_fallback_FallbackScreenConfiguration_h
#include "Hal.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "nsIScreenManager.h"
#include "nsServiceManagerUtils.h"
@@ -25,7 +24,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
int32_t colorDepth, pixelDepth, x, y, w, h;
- dom::ScreenOrientationInternal orientation;
+ ScreenOrientation orientation;
nsCOMPtr screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
@@ -33,8 +32,8 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = w >= h
- ? dom::eScreenOrientation_LandscapePrimary
- : dom::eScreenOrientation_PortraitPrimary;
+ ? hal::eScreenOrientation_LandscapePrimary
+ : hal::eScreenOrientation_PortraitPrimary;
*aScreenConfiguration = hal::ScreenConfiguration(nsIntRect(x, y, w, h),
orientation, 0,
diff --git a/hal/sandbox/PHal.ipdl b/hal/sandbox/PHal.ipdl
index b97d34c25b7d..708ce7e38e8d 100644
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -9,7 +9,7 @@ include protocol PBrowser;
include "mozilla/GfxMessageUtils.h";
-using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
+using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
@@ -46,7 +46,7 @@ struct WakeLockInformation {
struct ScreenConfiguration {
nsIntRect rect;
- ScreenOrientationInternal orientation;
+ ScreenOrientation orientation;
uint16_t angle;
uint32_t colorDepth;
uint32_t pixelDepth;
@@ -90,7 +90,7 @@ parent:
async EnableScreenConfigurationNotifications();
async DisableScreenConfigurationNotifications();
- sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
+ sync LockScreenOrientation(ScreenOrientation aOrientation)
returns (bool allowed);
async UnlockScreenOrientation();
diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp
index cac4fb9d293c..236246d869e1 100644
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -12,7 +12,6 @@
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/TabChild.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/fallback/FallbackScreenConfiguration.h"
#include "mozilla/EnumeratedRange.h"
#include "mozilla/Observer.h"
@@ -122,7 +121,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
}
bool
-LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
+LockScreenOrientation(const ScreenOrientation& aOrientation)
{
bool allowed;
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
@@ -332,7 +331,7 @@ public:
}
virtual mozilla::ipc::IPCResult
- RecvLockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation, bool* aAllowed) override
+ RecvLockScreenOrientation(const ScreenOrientation& aOrientation, bool* aAllowed) override
{
// FIXME/bug 777980: unprivileged content may only lock
// orientation while fullscreen. We should check whether the
diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp
index 0f2043bc55b5..6d2126efc694 100644
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -25,6 +25,7 @@
#include "nsIObserverService.h"
#include "nsIDebug2.h"
#include "nsIDocShell.h"
+#include "nsIDocument.h"
#include "nsIRunnable.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
@@ -2141,39 +2142,33 @@ class OrphanReporter : public JS::ObjectPrivateVisitor
virtual size_t sizeOfIncludingThis(nsISupports* aSupports) override
{
- size_t n = 0;
nsCOMPtr node = do_QueryInterface(aSupports);
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773533#c11 explains
- // that we have to skip XBL elements because they violate certain
- // assumptions. Yuk.
- if (node && !node->IsInComposedDoc() &&
- !(node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL)))
- {
- // This is an orphan node. If we haven't already handled the
- // sub-tree that this node belongs to, measure the sub-tree's size
- // and then record its root so we don't measure it again.
- nsCOMPtr orphanTree = node->SubtreeRoot();
- if (orphanTree && !mState.HaveSeenPtr(orphanTree.get())) {
- n += SizeOfTreeIncludingThis(orphanTree);
- }
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773533#c11 explains that we have to skip
+ // XBL elements because they violate certain assumptions. Yuk.
+ if (!node || node->IsInComposedDoc() ||
+ (node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL))) {
+ return 0;
+ }
+
+ // This is an orphan node. If we haven't already handled the sub-tree that this node
+ // belongs to, measure the sub-tree's size and then record its root so we don't measure it
+ // again.
+ nsCOMPtr orphanTree = node->SubtreeRoot();
+ if (!orphanTree || mState.HaveSeenPtr(orphanTree.get())) {
+ return 0;
}
- return n;
- }
- size_t SizeOfTreeIncludingThis(nsINode* tree)
- {
- size_t nodeSize = 0;
nsWindowSizes sizes(mState);
- tree->AddSizeOfIncludingThis(sizes, &nodeSize);
- for (nsIContent* child = tree->GetFirstChild(); child; child = child->GetNextNode(tree))
- child->AddSizeOfIncludingThis(sizes, &nodeSize);
+ nsIDocument::AddSizeOfNodeTree(*orphanTree, sizes);
- // We combine the node size with nsStyleSizes here. It's not ideal, but
- // it's hard to get the style structs measurements out to
- // nsWindowMemoryReporter. Also, we drop mServoData in
- // UnbindFromTree(), so in theory any non-in-tree element won't have
- // any style data to measure.
- return nodeSize + sizes.getTotalSize();
+ // We combine the node size with nsStyleSizes here. It's not ideal, but it's hard to get
+ // the style structs measurements out to nsWindowMemoryReporter. Also, we drop mServoData
+ // in UnbindFromTree(), so in theory any non-in-tree element won't have any style data to
+ // measure.
+ //
+ // FIXME(emilio): We should ideally not do this, since ShadowRoots keep their StyleSheets
+ // alive even when detached from a document, and those could be significant in theory.
+ return sizes.getTotalSize();
}
private:
diff --git a/layout/generic/nsCanvasFrame.h b/layout/generic/nsCanvasFrame.h
index 3020043a3226..0b0824c5442c 100644
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -226,7 +226,9 @@ public:
nsDisplayCanvasThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayThemedBackground(aBuilder, aFrame,
aFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(aFrame))
- {}
+ {
+ nsDisplayThemedBackground::Init(aBuilder);
+ }
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
index 08a1828543a4..85bf2658f669 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
@@ -28,7 +28,7 @@ import java.util.List;
public class GeckoScreenOrientation {
private static final String LOGTAG = "GeckoScreenOrientation";
- // Make sure that any change in dom/base/ScreenOrientation.h happens here too.
+ // Make sure that any change in hal/HalScreenConfiguration.h happens here too.
public enum ScreenOrientation {
NONE(0),
PORTRAIT_PRIMARY(1 << 0),
diff --git a/taskcluster/scripts/misc/build-clang-7-pre-mingw.sh b/taskcluster/scripts/misc/build-clang-7-pre-mingw.sh
index cffa0c68decc..68982704e126 100755
--- a/taskcluster/scripts/misc/build-clang-7-pre-mingw.sh
+++ b/taskcluster/scripts/misc/build-clang-7-pre-mingw.sh
@@ -15,7 +15,7 @@ SRC_DIR=$TOOLCHAIN_DIR/src
CLANG_VERSION=7.0.0
make_flags="-j$(nproc)"
-mingw_version=49ca7cfe7e09f924e939921b42a3452203c437b7
+mingw_version=30af18252d4e965e98612e215b8cf6b7ae42c01a
libunwind_version=86ab23972978242b6f9e27cebc239f3e8428b1af
binutils_version=2.27
diff --git a/taskcluster/taskgraph/cron/decision.py b/taskcluster/taskgraph/cron/decision.py
index 9009d12b419f..e61c5fd7c268 100644
--- a/taskcluster/taskgraph/cron/decision.py
+++ b/taskcluster/taskgraph/cron/decision.py
@@ -14,7 +14,6 @@ import os
import slugid
from taskgraph.util.time import current_json_time
-from .util import find_pushlog_info
def run_decision_task(job, params, root):
@@ -37,12 +36,6 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
if not head_rev:
head_rev = params['head_rev']
- try:
- pushlog = find_pushlog_info(
- params['repository_url'],
- params['head_rev'])
- except (IOError, RuntimeError):
- pushlog = {'pushid': -1, 'pushdate': 0}
slugids = {}
@@ -66,8 +59,8 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
'push': {
'revision': params['head_rev'],
# remainder are fake values, but the decision task expects them anyway
- 'pushlog_id': pushlog['pushid'],
- 'pushdate': pushlog['pushdate'],
+ 'pushlog_id': -1,
+ 'pushdate': 0,
'owner': 'cron',
'comment': '',
},
diff --git a/taskcluster/taskgraph/cron/util.py b/taskcluster/taskgraph/cron/util.py
index 4ee1046cd7ee..e52464e9968c 100644
--- a/taskcluster/taskgraph/cron/util.py
+++ b/taskcluster/taskgraph/cron/util.py
@@ -7,11 +7,8 @@
from __future__ import absolute_import, print_function, unicode_literals
-import requests
import subprocess
-PUSHLOG_TMPL = '{}/json-pushes?version=2&changeset={}&tipsonly=1&full=1'
-
def match_utc(params, sched):
"""Return True if params['time'] matches the given schedule.
@@ -48,20 +45,3 @@ def calculate_head_rev(root):
# GECKO_HEAD_REF, so all that remains is to see what the current revision is.
# Mercurial refers to that as `.`.
return subprocess.check_output(['hg', 'log', '-r', '.', '-T', '{node}'], cwd=root)
-
-
-def find_pushlog_info(repo, revision):
- """Given a repo url and a revision, find the pushlog_id of the revision."""
-
- pushlog_url = PUSHLOG_TMPL.format(repo, revision)
- r = requests.get(pushlog_url)
- r.raise_for_status()
- pushes = r.json()['pushes']
- if len(pushes) != 1:
- raise RuntimeError(
- "Unable to find a single pushlog_id for {} revision {}: {}".format(
- repo, revision, pushes
- )
- )
- pushid = pushes.keys()[0]
- return {'pushdate': pushes[pushid]['date'], 'pushid': pushid}
diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
index 94df22dceb2b..7a5b0cff8018 100644
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -25,6 +25,9 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
ChromeUtils.import("resource://testing-common/ContentTask.jsm");
+ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
+ "resource:///modules/BrowserWindowTracker.jsm");
+
Services
.mm
.loadFrameScript(
@@ -701,61 +704,19 @@ var BrowserTestUtils = {
},
/**
- * @param {Object} options
- * {
- * private: A boolean indicating if the window should be
- * private
- * remote: A boolean indicating if the window should run
- * remote browser tabs or not. If omitted, the window
- * will choose the profile default state.
- * width: Desired width of window
- * height: Desired height of window
- * }
+ * Open a new browser window from an existing one.
+ * This relies on OpenBrowserWindow in browser.js, and waits for the window
+ * to be completely loaded before resolving.
+ *
* @return {Promise}
* Resolves with the new window once it is loaded.
*/
async openNewBrowserWindow(options = {}) {
- let argString = Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- argString.data = "";
- let features = "chrome,dialog=no,all";
- let opener = null;
-
- if (options.opener) {
- opener = options.opener;
+ let currentWin = BrowserWindowTracker.getTopWindow({private: false});
+ if (!currentWin) {
+ throw new Error("Can't open a new browser window from this helper if no non-private window is open.");
}
-
- if (options.private) {
- features += ",private";
- }
-
- if (options.width) {
- features += ",width=" + options.width;
- }
- if (options.height) {
- features += ",height=" + options.height;
- }
-
- if (options.left) {
- features += ",left=" + options.left;
- }
-
- if (options.top) {
- features += ",top=" + options.top;
- }
-
- if (options.hasOwnProperty("remote")) {
- let remoteState = options.remote ? "remote" : "non-remote";
- features += `,${remoteState}`;
- }
-
- if (options.url) {
- argString.data = options.url;
- }
-
- let win = Services.ww.openWindow(
- opener, AppConstants.BROWSER_CHROME_URL, "_blank",
- features, argString);
+ let win = currentWin.OpenBrowserWindow(options);
// Wait for browser-delayed-startup-finished notification, it indicates
// that the window has loaded completely and is ready to be used for
diff --git a/testing/raptor/raptor/manifest.py b/testing/raptor/raptor/manifest.py
index 75caa89a7f7a..5ab7c6ddf576 100644
--- a/testing/raptor/raptor/manifest.py
+++ b/testing/raptor/raptor/manifest.py
@@ -89,6 +89,13 @@ def write_test_settings_json(test_details, oskey):
test_settings['raptor-options']['lower_is_better'] = False
else:
test_settings['raptor-options']['lower_is_better'] = True
+
+ # support optional subtest unit/lower_is_better fields, default to main test values if not set
+ val = test_details.get('subtest_unit', test_settings['raptor-options']['unit'])
+ test_settings['raptor-options']['subtest_unit'] = val
+ val = test_details.get('subtest_lower', test_settings['raptor-options']['lower_is_better'])
+ test_settings['raptor-options']['subtest_lower_is_better'] = val
+
if test_details.get("alert_threshold", None) is not None:
test_settings['raptor-options']['alert_threshold'] = float(test_details['alert_threshold'])
diff --git a/testing/raptor/raptor/output.py b/testing/raptor/raptor/output.py
index 06ab4cdc244e..9e3612f5c74e 100644
--- a/testing/raptor/raptor/output.py
+++ b/testing/raptor/raptor/output.py
@@ -51,6 +51,7 @@ class Output(object):
'extraOptions': test.extra_options,
'subtests': subtests,
'lowerIsBetter': test.lower_is_better,
+ 'unit': test.unit,
'alertThreshold': float(test.alert_threshold)
}
@@ -75,10 +76,10 @@ class Output(object):
new_subtest = {}
new_subtest['name'] = test.name + "-" + measurement_name
new_subtest['replicates'] = replicates
- new_subtest['lowerIsBetter'] = test.lower_is_better
+ new_subtest['lowerIsBetter'] = test.subtest_lower_is_better
new_subtest['alertThreshold'] = float(test.alert_threshold)
new_subtest['value'] = 0
- new_subtest['unit'] = test.unit
+ new_subtest['unit'] = test.subtest_unit
filtered_values = filter.ignore_first(new_subtest['replicates'], 1)
new_subtest['value'] = filter.median(filtered_values)
@@ -146,9 +147,9 @@ class Output(object):
# for each pagecycle, build a list of subtests and append all related replicates
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
@@ -183,9 +184,9 @@ class Output(object):
sub = item['name']
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].append(item['time'])
@@ -230,9 +231,9 @@ class Output(object):
replicates = [item['duration']]
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
@@ -285,9 +286,9 @@ class Output(object):
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([replicate])
@@ -311,17 +312,17 @@ class Output(object):
# for each pagecycle, build a list of subtests and append all related replicates
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].extend([round(x, 3) for x in replicates])
total_subtest = {
- 'unit': test.unit,
+ 'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'replicates': [],
'name': 'benchmark_score',
'value': 0
@@ -365,9 +366,9 @@ class Output(object):
sub = item['benchmark']
if sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[sub] = {'unit': test.unit,
+ _subtests[sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': sub,
'replicates': []}
_subtests[sub]['replicates'].append(item['result'])
@@ -404,9 +405,9 @@ class Output(object):
# build a list of subtests and append all related replicates
if _sub not in _subtests.keys():
# subtest not added yet, first pagecycle, so add new one
- _subtests[_sub] = {'unit': test.unit,
+ _subtests[_sub] = {'unit': test.subtest_unit,
'alertThreshold': float(test.alert_threshold),
- 'lowerIsBetter': test.lower_is_better,
+ 'lowerIsBetter': test.subtest_lower_is_better,
'name': _sub,
'replicates': []}
_subtests[_sub]['replicates'].extend([_value])
diff --git a/testing/raptor/raptor/tests/raptor-speedometer.ini b/testing/raptor/raptor/tests/raptor-speedometer.ini
index 0bebef0904da..49a38f0d7dbd 100644
--- a/testing/raptor/raptor/tests/raptor-speedometer.ini
+++ b/testing/raptor/raptor/tests/raptor-speedometer.ini
@@ -9,8 +9,10 @@ type = benchmark
test_url = http://localhost:/Speedometer/index.html?raptor
page_cycles = 5
page_timeout = 180000
-unit = score
-lower_is_better = false
+unit = score
+subtest_unit = ms
+lower_is_better = false
+subtest_lower_is_better = true
alert_threshold = 2.0
[raptor-speedometer-firefox]
diff --git a/testing/raptor/webext/raptor/runner.js b/testing/raptor/webext/raptor/runner.js
index 01fa9a2a19cb..af897b154aa0 100644
--- a/testing/raptor/webext/raptor/runner.js
+++ b/testing/raptor/webext/raptor/runner.js
@@ -78,7 +78,9 @@ function getTestSettings() {
results.type = testType;
results.name = testName;
results.unit = settings.unit;
- results.lower_is_better = settings.lower_is_better;
+ results.subtest_unit = settings.subtest_unit;
+ results.lower_is_better = settings.lower_is_better == "true";
+ results.subtest_lower_is_better = settings.subtest_lower_is_better == "true";
results.alert_threshold = settings.alert_threshold;
if (settings.page_timeout !== undefined) {
diff --git a/toolkit/mozapps/update/common/moz.build b/toolkit/mozapps/update/common/moz.build
index 9d3bf6aea243..0fa49619b181 100644
--- a/toolkit/mozapps/update/common/moz.build
+++ b/toolkit/mozapps/update/common/moz.build
@@ -36,6 +36,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'uachelper.cpp',
'updatehelper.cpp',
]
+ OS_LIBS += [
+ 'rpcrt4',
+ ]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
SOURCES += [
'certificatecheck.cpp',
@@ -43,7 +46,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
]
OS_LIBS += [
'crypt32',
- 'rpcrt4',
'wintrust',
]
diff --git a/toolkit/mozapps/update/common/updatecommon.cpp b/toolkit/mozapps/update/common/updatecommon.cpp
index d69f314151d9..f7875d033d84 100644
--- a/toolkit/mozapps/update/common/updatecommon.cpp
+++ b/toolkit/mozapps/update/common/updatecommon.cpp
@@ -199,7 +199,7 @@ PathContainsInvalidLinks(wchar_t * const fullPath)
wchar_t pathCopy[MAXPATHLEN + 1] = L"";
wcsncpy(pathCopy, fullPath, MAXPATHLEN);
wchar_t* remainingPath = nullptr;
- wchar_t* nextToken = wcstok(pathCopy, L"\\", &remainingPath);
+ wchar_t* nextToken = wcstok_s(pathCopy, L"\\", &remainingPath);
wchar_t* partialPath = nextToken;
while (nextToken) {
@@ -249,7 +249,7 @@ PathContainsInvalidLinks(wchar_t * const fullPath)
}
}
- nextToken = wcstok(nullptr, L"\\", &remainingPath);
+ nextToken = wcstok_s(nullptr, L"\\", &remainingPath);
PathAppendW(partialPath, nextToken);
}
diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp
index e3add1a5b66c..6a606482ddc7 100644
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -30,7 +30,6 @@
#include "nsPresContext.h"
#include "nsIDocShell.h"
#include "nsPIDOMWindow.h"
-#include "mozilla/dom/ScreenOrientation.h"
#include "nsIDOMWindowUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "nsPrintfCString.h"
@@ -734,9 +733,9 @@ AndroidBridge::GetScreenOrientation()
int16_t orientation = GeckoAppShell::GetScreenOrientation();
if (!orientation)
- return dom::eScreenOrientation_None;
+ return hal::eScreenOrientation_None;
- return static_cast(orientation);
+ return static_cast(orientation);
}
uint16_t
diff --git a/widget/android/GeckoScreenOrientation.h b/widget/android/GeckoScreenOrientation.h
index c6e5861bef8b..378f9a59b3f5 100644
--- a/widget/android/GeckoScreenOrientation.h
+++ b/widget/android/GeckoScreenOrientation.h
@@ -12,7 +12,6 @@
#include "nsIScreenManager.h"
#include "mozilla/Hal.h"
-#include "mozilla/dom/ScreenOrientation.h"
namespace mozilla {
@@ -45,7 +44,7 @@ public:
}
hal::NotifyScreenConfigurationChange(hal::ScreenConfiguration(
- rect, static_cast(aOrientation),
+ rect, static_cast(aOrientation),
aAngle, colorDepth, pixelDepth));
}
};