merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2017-07-27 10:57:25 +02:00
commit d360d49d2a
883 changed files with 8974 additions and 3437 deletions

View file

@ -24,7 +24,7 @@
^gfx/skia/.*
^gfx/vr/openvr/.*
^gfx/webrender.*
^gfx/webrender_traits.*
^gfx/webrender_api.*
^gfx/ycbcr/.*
^intl/hyphenation/hyphen/.*
^intl/icu/.*

View file

@ -48,24 +48,21 @@ SelectionManager::SelectionManager() :
void
SelectionManager::ClearControlSelectionListener()
{
if (!mCurrCtrlFrame)
return;
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
NS_ASSERTION(frameSel, "No frame selection for the element!");
mCurrCtrlFrame = nullptr;
if (!frameSel)
return;
// Remove 'this' registered as selection listener for the normal selection.
Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
normalSel->RemoveSelectionListener(this);
nsCOMPtr<nsISelection> normalSel = do_QueryReferent(mCurrCtrlNormalSel);
if (normalSel) {
normalSel->AsSelection()->RemoveSelectionListener(this);
mCurrCtrlNormalSel = nullptr;
}
// Remove 'this' registered as selection listener for the spellcheck
// selection.
Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
spellSel->RemoveSelectionListener(this);
nsCOMPtr<nsISelection> spellSel = do_QueryReferent(mCurrCtrlSpellSel);
if (spellSel) {
spellSel->AsSelection()->RemoveSelectionListener(this);
mCurrCtrlSpellSel = nullptr;
}
}
void
@ -76,22 +73,24 @@ SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm)
// the current focus.
ClearControlSelectionListener();
mCurrCtrlFrame = aFocusedElm->GetPrimaryFrame();
if (!mCurrCtrlFrame)
nsIFrame* controlFrame = aFocusedElm->GetPrimaryFrame();
if (!controlFrame)
return;
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
const nsFrameSelection* frameSel = controlFrame->GetConstFrameSelection();
NS_ASSERTION(frameSel, "No frame selection for focused element!");
if (!frameSel)
return;
// Register 'this' as selection listener for the normal selection.
Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
normalSel->AddSelectionListener(this);
nsCOMPtr<nsISelection> normalSel = frameSel->GetSelection(SelectionType::eNormal);
normalSel->AsSelection()->AddSelectionListener(this);
mCurrCtrlNormalSel = do_GetWeakReference(normalSel);
// Register 'this' as selection listener for the spell check selection.
Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
spellSel->AddSelectionListener(this);
nsCOMPtr<nsISelection> spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
spellSel->AsSelection()->AddSelectionListener(this);
mCurrCtrlSpellSel = do_GetWeakReference(spellSel);
}
void

View file

@ -121,9 +121,10 @@ protected:
private:
// Currently focused control.
WeakFrame mCurrCtrlFrame;
int32_t mCaretOffset;
HyperTextAccessible* mAccWithCaret;
nsWeakPtr mCurrCtrlNormalSel;
nsWeakPtr mCurrCtrlSpellSel;
};
} // namespace a11y

View file

@ -58,6 +58,7 @@
#endif
#include "nsImageFrame.h"
#include "nsINamed.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
#include "nsPluginFrame.h"
@ -412,6 +413,7 @@ static StaticAutoPtr<nsTArray<nsCOMPtr<nsIContent> > > sPendingPlugins;
static StaticAutoPtr<nsTArray<nsCOMPtr<nsITimer> > > sPluginTimers;
class PluginTimerCallBack final : public nsITimerCallback
, public nsINamed
{
~PluginTimerCallBack() {}
@ -444,11 +446,17 @@ public:
return NS_OK;
}
NS_IMETHOD GetName(nsACString& aName) final
{
aName.AssignLiteral("PluginTimerCallBack");
return NS_OK;
}
private:
nsCOMPtr<nsIContent> mContent;
};
NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback)
NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback, nsINamed)
#endif
already_AddRefed<Accessible>

View file

@ -3,7 +3,7 @@ support-files =
!/accessible/tests/mochitest/*.js
[test_focusedChild.html]
skip-if = (os == 'win' && (os_version == '6.2' || os_version == '6.3')) # bug 845134
skip-if = (os == 'win' && (os_version == '6.2' || os_version == '6.3' || os_version == '10.0.15063')) # bug 845134
[test_takeFocus.html]
skip-if = buildapp == 'mulet'
[test_takeFocus.xul]

View file

@ -1514,6 +1514,8 @@ pref("browser.translation.engine", "bing");
pref("toolkit.telemetry.archive.enabled", true);
// Enables sending the shutdown ping when Firefox shuts down.
pref("toolkit.telemetry.shutdownPingSender.enabled", true);
// Enables sending the shutdown ping using the pingsender from the first session.
pref("toolkit.telemetry.shutdownPingSender.enabledFirstSession", false);
// Enables sending the 'new-profile' ping on new profiles.
pref("toolkit.telemetry.newProfilePing.enabled", true);

View file

@ -36,7 +36,7 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure",
ReaderParent:false, RecentWindow:false, SafeBrowsing: false,
SessionStore:false,
ShortcutUtils:false, SimpleServiceDiscovery:false, SitePermissions:false,
Social:false, TabCrashHandler:false, Task:false, TelemetryStopwatch:false,
Social:false, TabCrashHandler:false, TelemetryStopwatch:false,
Translation:false, UITour:false, Utils:false, UpdateUtils:false,
Weave:false,
WebNavigationFrames: false, fxAccounts:false, gDevTools:false,
@ -85,7 +85,6 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure",
["SitePermissions", "resource:///modules/SitePermissions.jsm"],
["Social", "resource:///modules/Social.jsm"],
["TabCrashHandler", "resource:///modules/ContentCrashHandlers.jsm"],
["Task", "resource://gre/modules/Task.jsm"],
["TelemetryStopwatch", "resource://gre/modules/TelemetryStopwatch.jsm"],
["Translation", "resource:///modules/translation/Translation.jsm"],
["UITour", "resource:///modules/UITour.jsm"],

View file

@ -4,6 +4,9 @@ const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20pag
const COMMENTS = "Here's my test comment!";
const EMAIL = "foo@privacy.com";
// Avoid timeouts, as in bug 1325530
requestLongerTimeout(2);
add_task(async function setup() {
await setupLocalCrashReportServer();
});

View file

@ -47,6 +47,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppMenuNotifications",
"resource://gre/modules/AppMenuNotifications.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadHistory",
"resource://gre/modules/DownloadHistory.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadUIHelper",
@ -56,9 +58,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils",
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
@ -742,32 +742,8 @@ DownloadsDataCtor.prototype = {
download.endTime = Date.now();
// This state transition code should actually be located in a Downloads
// API module (bug 941009). Moreover, the fact that state is stored as
// annotations should be ideally hidden behind methods of
// nsIDownloadHistory (bug 830415).
if (!this._isPrivate) {
try {
let downloadMetaData = {
state: DownloadsCommon.stateOfDownload(download),
endTime: download.endTime,
};
if (download.succeeded) {
downloadMetaData.fileSize = download.target.size;
}
if (download.error && download.error.reputationCheckVerdict) {
downloadMetaData.reputationCheckVerdict =
download.error.reputationCheckVerdict;
}
PlacesUtils.annotations.setPageAnnotation(
NetUtil.newURI(download.source.url),
"downloads/metaData",
JSON.stringify(downloadMetaData), 0,
PlacesUtils.annotations.EXPIRE_WITH_HISTORY);
} catch (ex) {
Cu.reportError(ex);
}
}
// API module (bug 941009).
DownloadHistory.updateMetaData(download);
}
if (download.succeeded ||

View file

@ -39,7 +39,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
ProcessHangMonitor:false, ReaderParent:false, RecentWindow:false,
RemotePrompt:false, SessionStore:false,
ShellService:false, SimpleServiceDiscovery:false, TabCrashHandler:false,
Task:false, UITour:false, UIState:false, UpdateListener:false, WebChannel:false,
UITour:false, UIState:false, UpdateListener:false, WebChannel:false,
WindowsRegistry:false, webrtcUI:false */
@ -94,7 +94,6 @@ let initializedModules = {};
["ShellService", "resource:///modules/ShellService.jsm"],
["SimpleServiceDiscovery", "resource://gre/modules/SimpleServiceDiscovery.jsm"],
["TabCrashHandler", "resource:///modules/ContentCrashHandlers.jsm"],
["Task", "resource://gre/modules/Task.jsm"],
["UIState", "resource://services-sync/UIState.jsm"],
["UITour", "resource:///modules/UITour.jsm"],
["UpdateListener", "resource://gre/modules/UpdateListener.jsm", "init"],

View file

@ -11,6 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const TABLISTENER_JSM = "chrome://webcompat-reporter/content/TabListener.jsm";
const WIDGET_ID = "webcompat-reporter-button";
const PREF_STYLO_ENABLED = "layout.css.servo.enabled";
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
@ -120,9 +121,18 @@ let WebCompatReporter = {
const FRAMESCRIPT = "chrome://webcompat-reporter/content/wc-frame.js";
let win = Services.wm.getMostRecentWindow("navigator:browser");
const WEBCOMPAT_ORIGIN = new win.URL(WebCompatReporter.endpoint).origin;
let styloEnabled = Services.prefs.getBoolPref(PREF_STYLO_ENABLED, false);
let params = new URLSearchParams();
params.append("url", `${tabData.url}`);
params.append("src", "desktop-reporter");
if (styloEnabled) {
params.append("details", "layout.css.servo.enabled: true");
params.append("label", "type-stylo");
}
let tab = gBrowser.loadOneTab(
`${WebCompatReporter.endpoint}?url=${encodeURIComponent(tabData.url)}&src=desktop-reporter`,
`${WebCompatReporter.endpoint}?${params}`,
{inBackground: false, triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()});
// If we successfully got a screenshot blob, add a listener to know when

View file

@ -250,7 +250,6 @@ def old_configure_options(*options):
'--with-app-name',
'--with-arch',
'--with-branding',
'--with-crashreporter-enable-percent',
'--with-cross-lib',
'--with-debug-label',
'--with-default-mozilla-five-home',

View file

@ -33,3 +33,4 @@ support-files =
[browser_grids_grid-outline-updates-on-grid-change.js]
[browser_grids_highlighter-setting-rules-grid-toggle.js]
[browser_grids_number-of-css-grids-telemetry.js]
[browser_grids_restored-after-reload.js]

View file

@ -0,0 +1,87 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that the grid highlighter is re-displayed after reloading a page and the grid
// item is highlighted.
const TEST_URI = `
<style type='text/css'>
#grid {
display: grid;
}
</style>
<div id="grid">
<div id="cell1">cell1</div>
<div id="cell2">cell2</div>
</div>
`;
const OTHER_URI = `
<style type='text/css'>
#grid {
display: grid;
}
</style>
<div id="grid">
<div id="cell1">cell1</div>
<div id="cell2">cell2</div>
<div id="cell3">cell3</div>
</div>
`;
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let { gridInspector, inspector } = yield openLayoutView();
let { document: doc } = gridInspector;
let { highlighters, store } = inspector;
yield selectNode("#grid", inspector);
let gridList = doc.getElementById("grid-list");
let checkbox = gridList.children[0].querySelector("input");
info("Toggling ON the CSS grid highlighter from the layout panel.");
let onHighlighterShown = highlighters.once("grid-highlighter-shown");
let onCheckboxChange = waitUntilState(store, state =>
state.grids.length == 1 &&
state.grids[0].highlighted);
checkbox.click();
yield onHighlighterShown;
yield onCheckboxChange;
info("Checking the CSS grid highlighter is created.");
ok(highlighters.highlighters[HIGHLIGHTER_TYPE],
"CSS grid highlighter is created in the highlighters overlay.");
ok(highlighters.gridHighlighterShown, "CSS grid highlighter is shown.");
info("Reload the page, expect the highlighter to be displayed once again and " +
"grid is checked");
let onStateRestored = highlighters.once("grid-state-restored");
let onGridListRestored = waitUntilState(store, state =>
state.grids.length == 1 &&
state.grids[0].highlighted);
yield refreshTab(gBrowser.selectedTab);
let { restored } = yield onStateRestored;
yield onGridListRestored;
info("Check that the grid highlighter can be displayed after reloading the page");
ok(restored, "The highlighter state was restored");
ok(highlighters.gridHighlighterShown, "CSS grid highlighter is shown.");
info("Navigate to another URL, and check that the highlighter is hidden and " +
"grid is unchecked");
let otherUri = "data:text/html;charset=utf-8," + encodeURIComponent(OTHER_URI);
onStateRestored = highlighters.once("grid-state-restored");
onGridListRestored = waitUntilState(store, state =>
state.grids.length == 1 &&
!state.grids[0].highlighted);
yield navigateTo(inspector, otherUri);
({ restored } = yield onStateRestored);
yield onGridListRestored;
info("Check that the grid highlighter is hidden after navigating to a different page");
ok(!restored, "The highlighter state was not restored");
ok(!highlighters.gridHighlighterShown, "CSS grid highlighter is hidden.");
});

View file

@ -108,21 +108,23 @@ function Inspector(toolbox) {
this.nodeMenuTriggerInfo = null;
this._handleRejectionIfNotDestroyed = this._handleRejectionIfNotDestroyed.bind(this);
this._onBeforeNavigate = this._onBeforeNavigate.bind(this);
this.onNewRoot = this.onNewRoot.bind(this);
this._onContextMenu = this._onContextMenu.bind(this);
this.onTextBoxContextMenu = this.onTextBoxContextMenu.bind(this);
this._updateSearchResultsLabel = this._updateSearchResultsLabel.bind(this);
this.onNewSelection = this.onNewSelection.bind(this);
this.onDetached = this.onDetached.bind(this);
this.onPaneToggleButtonClicked = this.onPaneToggleButtonClicked.bind(this);
this._onBeforeNavigate = this._onBeforeNavigate.bind(this);
this._onMarkupFrameLoad = this._onMarkupFrameLoad.bind(this);
this._updateSearchResultsLabel = this._updateSearchResultsLabel.bind(this);
this.onDetached = this.onDetached.bind(this);
this.onMarkupLoaded = this.onMarkupLoaded.bind(this);
this.onNewSelection = this.onNewSelection.bind(this);
this.onNewRoot = this.onNewRoot.bind(this);
this.onPaneToggleButtonClicked = this.onPaneToggleButtonClicked.bind(this);
this.onPanelWindowResize = this.onPanelWindowResize.bind(this);
this.onSidebarShown = this.onSidebarShown.bind(this);
this.onSidebarHidden = this.onSidebarHidden.bind(this);
this.onSidebarSelect = this.onSidebarSelect.bind(this);
this.onShowBoxModelHighlighterForNode =
this.onShowBoxModelHighlighterForNode.bind(this);
this.onSidebarHidden = this.onSidebarHidden.bind(this);
this.onSidebarSelect = this.onSidebarSelect.bind(this);
this.onSidebarShown = this.onSidebarShown.bind(this);
this.onTextBoxContextMenu = this.onTextBoxContextMenu.bind(this);
this._target.on("will-navigate", this._onBeforeNavigate);
this._detectingActorFeatures = this._detectActorFeatures();
@ -779,13 +781,7 @@ Inspector.prototype = {
this.selection.setNodeFront(defaultNode, "navigateaway");
this._initMarkup();
this.once("markuploaded", () => {
if (!this.markup) {
return;
}
this.markup.expandNode(this.selection.nodeFront);
this.emit("new-root");
});
this.once("markuploaded", this.onMarkupLoaded);
// Setup the toolbar again, since its content may depend on the current document.
this.setupToolbar();
@ -795,6 +791,27 @@ Inspector.prototype = {
.then(onNodeSelected, this._handleRejectionIfNotDestroyed);
},
/**
* Handler for "markuploaded" event fired on a new root mutation and after the markup
* view is initialized. Expands the current selected node and restores the saved
* highlighter state.
*/
onMarkupLoaded: Task.async(function* () {
if (!this.markup) {
return;
}
this.markup.expandNode(this.selection.nodeFront);
// Restore the highlighter states prior to emitting "new-root".
yield Promise.all([
this.highlighters.restoreGridState(),
this.highlighters.restoreShapeState()
]);
this.emit("new-root");
}),
_selectionCssSelector: null,
/**

View file

@ -52,7 +52,6 @@ function HighlightersOverlay(inspector) {
this.onMouseMove = this.onMouseMove.bind(this);
this.onMouseOut = this.onMouseOut.bind(this);
this.onWillNavigate = this.onWillNavigate.bind(this);
this.onNavigate = this.onNavigate.bind(this);
this.showGridHighlighter = this.showGridHighlighter.bind(this);
this.showShapesHighlighter = this.showShapesHighlighter.bind(this);
this._handleRejection = this._handleRejection.bind(this);
@ -60,7 +59,6 @@ function HighlightersOverlay(inspector) {
// Add inspector events, not specific to a given view.
this.inspector.on("markupmutation", this.onMarkupMutation);
this.inspector.target.on("navigate", this.onNavigate);
this.inspector.target.on("will-navigate", this.onWillNavigate);
EventEmitter.decorate(this);
@ -387,7 +385,31 @@ HighlightersOverlay.prototype = {
},
/**
* Restore the saved highlighter states.
* Restores the saved grid highlighter state.
*/
restoreGridState: Task.async(function* () {
try {
yield this.restoreState("grid", this.state.grid, this.showGridHighlighter);
} catch (e) {
this._handleRejection(e);
}
}),
/**
* Restores the saved shape highlighter state.
*/
restoreShapeState: Task.async(function* () {
try {
yield this.restoreState("shapes", this.state.shapes, this.showShapesHighlighter);
} catch (e) {
this._handleRejection(e);
}
}),
/**
* Helper function called by restoreGridState and restoreShapeState.
* Restores the saved highlighter state for the given highlighter and their state.
*
* @param {String} name
* The name of the highlighter to be restored
* @param {Object} state
@ -399,15 +421,13 @@ HighlightersOverlay.prototype = {
*/
restoreState: Task.async(function* (name, state, showFunction) {
let { selector, options, url } = state;
if (!selector || url !== this.inspector.target.url) {
// Bail out if no selector was saved, or if we are on a different page.
this.emit(`${name}-state-restored`, { restored: false });
return;
}
// Wait for the new root to be ready in the inspector.
yield this.onInspectorNewRoot;
let walker = this.inspector.walker;
let rootNode = yield walker.getRootNode();
let nodeFront = yield walker.querySelector(rootNode, selector);
@ -713,18 +733,6 @@ HighlightersOverlay.prototype = {
}
}),
/**
* Restore saved highlighter state after navigate.
*/
onNavigate: Task.async(function* () {
try {
yield this.restoreState("grid", this.state.grid, this.showGridHighlighter);
yield this.restoreState("shapes", this.state.shapes, this.showShapesHighlighter);
} catch (e) {
this._handleRejection(e);
}
}),
/**
* Clear saved highlighter shown properties on will-navigate.
*/
@ -734,9 +742,6 @@ HighlightersOverlay.prototype = {
this.hoveredHighlighterShown = null;
this.selectorHighlighterShown = null;
this.shapesHighlighterShown = null;
// The inspector panel should emit the new-root event when it is ready after navigate.
this.onInspectorNewRoot = this.inspector.once("new-root");
},
/**
@ -756,7 +761,6 @@ HighlightersOverlay.prototype = {
// Remove inspector events.
this.inspector.off("markupmutation", this.onMarkupMutation);
this.inspector.target.off("navigate", this.onNavigate);
this.inspector.target.off("will-navigate", this.onWillNavigate);
this._lastHovered = null;

View file

@ -81,6 +81,7 @@ pref("devtools.gridinspector.gridOutlineMaxRows", 50);
pref("devtools.gridinspector.showGridAreas", false);
pref("devtools.gridinspector.showGridLineNumbers", false);
pref("devtools.gridinspector.showInfiniteLines", false);
pref("devtools.gridinspector.showNegativeLineNumbers", false);
// Whether or not the box model panel is opened in the computed view
pref("devtools.computed.boxmodel.opened", true);

View file

@ -34,6 +34,7 @@ const LAYOUT_STRINGS_URI = "devtools/client/locales/layout.properties";
const LAYOUT_L10N = new LocalizationHelper(LAYOUT_STRINGS_URI);
const CSS_GRID_ENABLED_PREF = "layout.css.grid.enabled";
const NEGATIVE_LINE_NUMBERS_PREF = "devtools.gridinspector.showNegativeLineNumbers";
const DEFAULT_GRID_COLOR = "#4B0082";
@ -352,11 +353,9 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
this.markup = new CanvasFrameAnonymousContentHelper(this.highlighterEnv,
this._buildMarkup.bind(this));
this.onNavigate = this.onNavigate.bind(this);
this.onPageHide = this.onPageHide.bind(this);
this.onWillNavigate = this.onWillNavigate.bind(this);
this.highlighterEnv.on("navigate", this.onNavigate);
this.highlighterEnv.on("will-navigate", this.onWillNavigate);
let { pageListenerTarget } = highlighterEnv;
@ -590,7 +589,6 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
destroy() {
let { highlighterEnv } = this;
highlighterEnv.off("navigate", this.onNavigate);
highlighterEnv.off("will-navigate", this.onWillNavigate);
let { pageListenerTarget } = highlighterEnv;
@ -677,14 +675,6 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
return pattern;
}
/**
* Called when the page navigates. Used to clear the cached gap patterns and avoid
* using DeadWrapper objects as gap patterns the next time.
*/
onNavigate() {
this._clearCache();
}
onPageHide({ target }) {
// If a page hide event is triggered for current window's highlighter, hide the
// highlighter.
@ -693,7 +683,14 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
}
}
/**
* Called when the page will-navigate. Used to hide the grid highlighter and clear
* the cached gap patterns and avoid using DeadWrapper obejcts as gap patterns the
* next time.
*/
onWillNavigate({ isTopLevel }) {
this._clearCache();
if (isTopLevel) {
this.hide();
}
@ -1145,6 +1142,35 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
this.getFirstRowLinePos(fragment));
this.renderLineNumbers(fragment.rows, ROWS, "top", "left",
this.getFirstColLinePos(fragment));
if (Services.prefs.getBoolPref(NEGATIVE_LINE_NUMBERS_PREF)) {
this.renderNegativeLineNumbers(fragment.cols, COLUMNS, "left", "top",
this.getLastRowLinePos(fragment));
this.renderNegativeLineNumbers(fragment.rows, ROWS, "top", "left",
this.getLastColLinePos(fragment));
}
}
}
/**
* Render the negative grid lines given the grid dimension information of the
* column or row lines.
*
* See @param for renderLines.
*/
renderNegativeLineNumbers(gridDimension, dimensionType, mainSide, crossSide,
startPos) {
let lineStartPos = startPos;
const { lines } = gridDimension;
for (let i = 0, line = lines[i]; i < lines.length; line = lines[++i]) {
let linePos = line.start;
const negativeLineNumber = i - lines.length;
this.renderGridLineNumber(negativeLineNumber, linePos, lineStartPos, line.breadth,
dimensionType);
}
}
@ -1331,6 +1357,9 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
startPos) {
let lineStartPos = startPos;
// Keep track of the number of collapsed lines per line position
let stackedLines = [];
for (let i = 0; i < gridDimension.lines.length; i++) {
let line = gridDimension.lines[i];
let linePos = line.start;
@ -1347,6 +1376,21 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
continue;
}
// Check for overlapping lines. We render a second box beneath the last overlapping
// line number to indicate there are lines beneath it.
const gridLine = gridDimension.tracks[line.number - 1];
if (gridLine) {
const { breadth } = gridLine;
if (breadth === 0) {
stackedLines.push(gridDimension.lines[i].number);
if (stackedLines.length > 0) {
this.renderGridLineNumber(line.number, linePos, lineStartPos, line.breadth,
dimensionType, 1);
}
continue;
}
}
this.renderGridLineNumber(line.number, linePos, lineStartPos, line.breadth,
dimensionType);
}
@ -1425,8 +1469,11 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
* The grid line breadth value.
* @param {String} dimensionType
* The grid dimension type which is either the constant COLUMNS or ROWS.
* @param {Number||undefined} stackedLineIndex
* The line index position of the stacked line.
*/
renderGridLineNumber(lineNumber, linePos, startPos, breadth, dimensionType) {
renderGridLineNumber(lineNumber, linePos, startPos, breadth, dimensionType,
stackedLineIndex) {
let displayPixelRatio = getDisplayPixelRatio(this.win);
let { devicePixelRatio } = this.win;
let offset = (displayPixelRatio / 2) % 1;
@ -1463,6 +1510,18 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
// centered on the line, and in the middle of the gap if there is any.
let x, y;
let startOffset = (boxHeight + 2) / devicePixelRatio;
if (Services.prefs.getBoolPref(NEGATIVE_LINE_NUMBERS_PREF)) {
// If the line number is negative, offset it from the grid container edge,
// (downwards if its a column, rightwards if its a row).
if (lineNumber < 0) {
startPos += startOffset;
} else {
startPos -= startOffset;
}
}
if (dimensionType === COLUMNS) {
x = linePos + breadth / 2;
y = startPos;
@ -1476,6 +1535,15 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
x -= boxWidth / 2;
y -= boxHeight / 2;
if (stackedLineIndex) {
// Offset the stacked line number by half of the box's width/height
const xOffset = boxWidth / 4;
const yOffset = boxHeight / 4;
x += xOffset;
y += yOffset;
}
if (!this.hasNodeTransformations) {
x = Math.max(x, padding);
y = Math.max(y, padding);
@ -1491,7 +1559,8 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
// Write the line number inside of the rectangle.
this.ctx.fillStyle = "black";
this.ctx.fillText(lineNumber, x + padding, y + textHeight + padding);
const numberText = stackedLineIndex ? "" : lineNumber;
this.ctx.fillText(numberText, x + padding, y + textHeight + padding);
this.ctx.restore();
}

View file

@ -1771,8 +1771,7 @@ nsDocShell::FirePageHideNotificationInternal(bool aIsUnload,
}
nsresult
nsDocShell::DispatchToTabGroup(const char* aName,
TaskCategory aCategory,
nsDocShell::DispatchToTabGroup(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
// Hold the ref so we won't forget to release it.
@ -1785,14 +1784,13 @@ nsDocShell::DispatchToTabGroup(const char* aName,
}
RefPtr<mozilla::dom::TabGroup> tabGroup = win->TabGroup();
return tabGroup->Dispatch(aName, aCategory, runnable.forget());
return tabGroup->Dispatch(aCategory, runnable.forget());
}
NS_IMETHODIMP
nsDocShell::DispatchLocationChangeEvent()
{
return DispatchToTabGroup(
"nsDocShell::FireDummyOnLocationChange",
TaskCategory::Other,
NewRunnableMethod("nsDocShell::FireDummyOnLocationChange",
this,
@ -6793,18 +6791,12 @@ nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
return NS_OK;
}
nsRefreshTimer* refreshTimer = new nsRefreshTimer();
nsCOMPtr<nsITimerCallback> refreshTimer =
new nsRefreshTimer(this, aURI, aDelay, aRepeat, aMetaRefresh);
uint32_t busyFlags = 0;
GetBusyFlags(&busyFlags);
nsCOMPtr<nsISupports> dataRef = refreshTimer; // Get the ref count to 1
refreshTimer->mDocShell = this;
refreshTimer->mURI = aURI;
refreshTimer->mDelay = aDelay;
refreshTimer->mRepeat = aRepeat;
refreshTimer->mMetaRefresh = aMetaRefresh;
if (!mRefreshURIList) {
mRefreshURIList = nsArray::Create();
}
@ -8592,8 +8584,7 @@ nsDocShell::RestorePresentation(nsISHEntry* aSHEntry, bool* aRestoring)
mRestorePresentationEvent.Revoke();
RefPtr<RestorePresentationEvent> evt = new RestorePresentationEvent(this);
nsresult rv = DispatchToTabGroup("nsDocShell::RestorePresentationEvent",
TaskCategory::Other,
nsresult rv = DispatchToTabGroup(TaskCategory::Other,
RefPtr<RestorePresentationEvent>(evt).forget());
if (NS_SUCCEEDED(rv)) {
mRestorePresentationEvent = evt.get();
@ -10264,8 +10255,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
aFlags, aTypeHint, aPostData, aHeadersData,
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
aSourceDocShell, aBaseURI, false);
return DispatchToTabGroup("nsDocShell::InternalLoadEvent",
TaskCategory::Other, ev.forget());
return DispatchToTabGroup(TaskCategory::Other, ev.forget());
}
// Just ignore this load attempt
@ -13634,8 +13624,10 @@ nsDocShell::SetLayoutHistoryState(nsILayoutHistoryState* aLayoutHistoryState)
return NS_OK;
}
nsRefreshTimer::nsRefreshTimer()
: mDelay(0), mRepeat(false), mMetaRefresh(false)
nsRefreshTimer::nsRefreshTimer(nsDocShell* aDocShell, nsIURI* aURI,
int32_t aDelay, bool aRepeat, bool aMetaRefresh)
: mDocShell(aDocShell), mURI(aURI), mDelay(aDelay), mRepeat(aRepeat),
mMetaRefresh(aMetaRefresh)
{
}
@ -13649,6 +13641,7 @@ NS_IMPL_RELEASE(nsRefreshTimer)
NS_INTERFACE_MAP_BEGIN(nsRefreshTimer)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsINamed)
NS_INTERFACE_MAP_END_THREADSAFE
NS_IMETHODIMP
@ -13665,6 +13658,13 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
return NS_OK;
}
NS_IMETHODIMP
nsRefreshTimer::GetName(nsACString& aName)
{
aName.AssignLiteral("nsRefreshTimer");
return NS_OK;
}
nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy(
nsIInterfaceRequestor* aRequestor)
{
@ -14166,8 +14166,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
new OnLinkClickEvent(this, aContent, aURI, target.get(), aFileName,
aPostDataStream, aHeadersDataStream, noOpenerImplied,
aIsTrusted, aTriggeringPrincipal);
return DispatchToTabGroup("nsDocShell::OnLinkClickEvent",
TaskCategory::UI, ev.forget());
return DispatchToTabGroup(TaskCategory::UI, ev.forget());
}
NS_IMETHODIMP

View file

@ -44,6 +44,7 @@
// Interfaces Needed
#include "nsIDocCharset.h"
#include "nsIInterfaceRequestor.h"
#include "nsINamed.h"
#include "nsIRefreshURI.h"
#include "nsIWebNavigation.h"
#include "nsIWebPageDescriptor.h"
@ -106,12 +107,15 @@ enum ViewMode
};
class nsRefreshTimer : public nsITimerCallback
, public nsINamed
{
public:
nsRefreshTimer();
nsRefreshTimer(nsDocShell* aDocShell, nsIURI* aURI, int32_t aDelay,
bool aRepeat, bool aMetaRefresh);
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSINAMED
int32_t GetDelay() { return mDelay ;}
@ -1090,8 +1094,7 @@ private:
bool aSkipCheckingDynEntries);
// Dispatch a runnable to the TabGroup associated to this docshell.
nsresult DispatchToTabGroup(const char* aName,
mozilla::TaskCategory aCategory,
nsresult DispatchToTabGroup(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable);
#ifdef DEBUG

View file

@ -215,8 +215,7 @@ nsSHEntryShared::RemoveFromBFCacheAsync()
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIRunnable> evt = new DestroyViewerEvent(mContentViewer, mDocument);
nsresult rv = mDocument->Dispatch("nsSHEntryShared::DestroyViewerEvent",
mozilla::TaskCategory::Other, evt.forget());
nsresult rv = mDocument->Dispatch(mozilla::TaskCategory::Other, evt.forget());
if (NS_FAILED(rv)) {
NS_WARNING("failed to dispatch DestroyViewerEvent");
} else {

View file

@ -433,15 +433,15 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
intersectionRatio = intersectionRect.isSome() ? 1.0 : 0.0;
}
size_t threshold = -1;
int32_t threshold = -1;
if (intersectionRatio > 0.0) {
if (intersectionRatio >= 1.0) {
intersectionRatio = 1.0;
threshold = mThresholds.Length();
threshold = (int32_t)mThresholds.Length();
} else {
for (size_t k = 0; k < mThresholds.Length(); ++k) {
if (mThresholds[k] <= intersectionRatio) {
threshold = k + 1;
threshold = (int32_t)k + 1;
} else {
break;
}

View file

@ -14,11 +14,10 @@ using namespace mozilla;
using namespace mozilla::dom;
nsresult
DispatcherTrait::Dispatch(const char* aName,
TaskCategory aCategory,
DispatcherTrait::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
return SchedulerGroup::UnlabeledDispatch(aName, aCategory, Move(aRunnable));
return SchedulerGroup::UnlabeledDispatch(aCategory, Move(aRunnable));
}
nsISerialEventTarget*

View file

@ -26,8 +26,7 @@ class DispatcherTrait {
public:
// This method may or may not be safe off of the main thread. For nsIDocument
// it is safe. For nsIGlobalWindow it is not safe.
virtual nsresult Dispatch(const char* aName,
TaskCategory aCategory,
virtual nsresult Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable);
// This method may or may not be safe off of the main thread. For nsIDocument

View file

@ -56,11 +56,10 @@ DocGroup::~DocGroup()
}
nsresult
DocGroup::Dispatch(const char* aName,
TaskCategory aCategory,
DocGroup::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
return mTabGroup->Dispatch(aName, aCategory, Move(aRunnable));
return mTabGroup->Dispatch(aCategory, Move(aRunnable));
}
nsISerialEventTarget*

View file

@ -80,8 +80,7 @@ public:
return mDocuments.end();
}
nsresult Dispatch(const char* aName,
TaskCategory aCategory,
nsresult Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable);
nsISerialEventTarget* EventTargetFor(TaskCategory aCategory) const;

View file

@ -52,6 +52,7 @@
#include "nsITimer.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsINamed.h"
#include "nsISelectionController.h"//for the enums
#include "nsAutoCopyListener.h"
@ -196,6 +197,7 @@ struct CachedOffsetForFrame {
};
class nsAutoScrollTimer final : public nsITimerCallback
, public nsINamed
{
public:
@ -280,6 +282,12 @@ public:
return NS_OK;
}
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("nsAutoScrollTimer");
return NS_OK;
}
protected:
virtual ~nsAutoScrollTimer()
{
@ -299,7 +307,7 @@ private:
uint32_t mDelay;
};
NS_IMPL_ISUPPORTS(nsAutoScrollTimer, nsITimerCallback)
NS_IMPL_ISUPPORTS(nsAutoScrollTimer, nsITimerCallback, nsINamed)
nsresult NS_NewDomSelection(nsISelection **aDomSelection)
{

View file

@ -244,11 +244,5 @@ TimeoutExecutor::GetName(nsACString& aNameOut)
return NS_OK;
}
NS_IMETHODIMP
TimeoutExecutor::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace dom
} // namespace mozilla

View file

@ -10,6 +10,8 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThrottledEventQueue.h"
#include "mozilla/TimeStamp.h"
#include "nsIDocShell.h"
#include "nsINamed.h"
#include "nsITimeoutHandler.h"
#include "mozilla/dom/TabGroup.h"
#include "OrderedTimeoutIterator.h"
@ -107,10 +109,6 @@ TimeoutManager::IsActive() const
// A window is considered active if:
// * It is a chrome window
// * It is playing audio
// * If it is using user media
// * If it is using WebRTC
// * If it has open WebSockets
// * If it has active IndexedDB databases
//
// Note that a window can be considered active if it is either in the
// foreground or in the background.
@ -124,45 +122,6 @@ TimeoutManager::IsActive() const
return true;
}
// Check if there are any active IndexedDB databases
if (mWindow.AsInner()->HasActiveIndexedDBDatabases()) {
return true;
}
// Check if we have active GetUserMedia
if (MediaManager::Exists() &&
MediaManager::Get()->IsWindowStillActive(mWindow.WindowID())) {
return true;
}
bool active = false;
#if 0
// Check if we have active PeerConnections This doesn't actually
// work, since we sometimes call IsActive from Resume, which in turn
// is sometimes called from nsGlobalWindow::LeaveModalState. The
// problem here is that LeaveModalState can be called with pending
// exeptions on the js context, and the following call to
// HasActivePeerConnection is a JS call, which will assert on that
// exception. Also, calling JS is expensive so we should try to fix
// this in some other way.
nsCOMPtr<IPeerConnectionManager> pcManager =
do_GetService(IPEERCONNECTION_MANAGER_CONTRACTID);
if (pcManager && NS_SUCCEEDED(pcManager->HasActivePeerConnection(
mWindow.WindowID(), &active)) &&
active) {
return true;
}
#endif // MOZ_WEBRTC
// Check if we have web sockets
RefPtr<WebSocketEventService> eventService = WebSocketEventService::Get();
if (eventService &&
NS_SUCCEEDED(eventService->HasListenerFor(mWindow.WindowID(), &active)) &&
active) {
return true;
}
return false;
}
@ -246,7 +205,7 @@ TimeoutManager::MinSchedulingDelay() const
TimeDuration unthrottled =
isBackground ? TimeDuration::FromMilliseconds(gMinBackgroundTimeoutValue)
: TimeDuration();
if (mBudgetThrottleTimeouts && mExecutionBudget < TimeDuration()) {
if (BudgetThrottlingEnabled() && mExecutionBudget < TimeDuration()) {
// Only throttle if execution budget is less than 0
double factor = 1.0 / GetRegenerationFactor(mWindow.IsBackgroundInternal());
return TimeDuration::Min(
@ -373,7 +332,7 @@ TimeoutManager::UpdateBudget(const TimeStamp& aNow, const TimeDuration& aDuratio
// window is active or not. If throttling is enabled and the window
// is active and then becomes inactive, an overdrawn budget will
// still be counted against the minimum delay.
if (mBudgetThrottleTimeouts) {
if (BudgetThrottlingEnabled()) {
bool isBackground = mWindow.IsBackgroundInternal();
double factor = GetRegenerationFactor(isBackground);
TimeDuration regenerated = (aNow - mLastBudgetUpdate).MultDouble(factor);
@ -1209,6 +1168,7 @@ TimeoutManager::IsTimeoutTracking(uint32_t aTimeoutId)
namespace {
class ThrottleTimeoutsCallback final : public nsITimerCallback
, public nsINamed
{
public:
explicit ThrottleTimeoutsCallback(nsGlobalWindow* aWindow)
@ -1220,6 +1180,12 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("ThrottleTimeoutsCallback");
return NS_OK;
}
private:
~ThrottleTimeoutsCallback() {}
@ -1229,7 +1195,7 @@ private:
RefPtr<nsGlobalWindow> mWindow;
};
NS_IMPL_ISUPPORTS(ThrottleTimeoutsCallback, nsITimerCallback)
NS_IMPL_ISUPPORTS(ThrottleTimeoutsCallback, nsITimerCallback, nsINamed)
NS_IMETHODIMP
ThrottleTimeoutsCallback::Notify(nsITimer* aTimer)
@ -1241,6 +1207,66 @@ ThrottleTimeoutsCallback::Notify(nsITimer* aTimer)
}
bool
TimeoutManager::BudgetThrottlingEnabled() const
{
// A window can be throttled using budget if
// * It isn't active
// * If it isn't using user media
// * If it isn't using WebRTC
// * If it hasn't got open WebSockets
// * If it hasn't got active IndexedDB databases
//
// Note that we allow both foreground and background to be
// considered for budget throttling. What determines if they are if
// budget throttling is enabled is the regeneration factor.
if (!mBudgetThrottleTimeouts || IsActive()) {
return false;
}
// Check if there are any active IndexedDB databases
if (mWindow.AsInner()->HasActiveIndexedDBDatabases()) {
return false;
}
// Check if we have active GetUserMedia
if (MediaManager::Exists() &&
MediaManager::Get()->IsWindowStillActive(mWindow.WindowID())) {
return false;
}
bool active = false;
#if 0
// Check if we have active PeerConnections This doesn't actually
// work, since we sometimes call IsActive from Resume, which in turn
// is sometimes called from nsGlobalWindow::LeaveModalState. The
// problem here is that LeaveModalState can be called with pending
// exeptions on the js context, and the following call to
// HasActivePeerConnection is a JS call, which will assert on that
// exception. Also, calling JS is expensive so we should try to fix
// this in some other way.
nsCOMPtr<IPeerConnectionManager> pcManager =
do_GetService(IPEERCONNECTION_MANAGER_CONTRACTID);
if (pcManager && NS_SUCCEEDED(pcManager->HasActivePeerConnection(
mWindow.WindowID(), &active)) &&
active) {
return false;
}
#endif // MOZ_WEBRTC
// Check if we have web sockets
RefPtr<WebSocketEventService> eventService = WebSocketEventService::Get();
if (eventService &&
NS_SUCCEEDED(eventService->HasListenerFor(mWindow.WindowID(), &active)) &&
active) {
return false;
}
return true;
}
void
TimeoutManager::StartThrottlingTimeouts()
{

View file

@ -148,6 +148,8 @@ private:
void UpdateBudget(const TimeStamp& aNow,
const TimeDuration& aDuration = TimeDuration());
bool BudgetThrottlingEnabled() const;
private:
struct Timeouts {
explicit Timeouts(const TimeoutManager& aManager)

View file

@ -249,7 +249,7 @@ NS_GetContentList(nsINode* aRootNode,
#ifdef DEBUG
const nsCacheableFuncStringContentList::ContentListType
nsCacheableFuncStringNodeList::sType = nsCacheableFuncStringContentList::eNodeList;
nsCachableElementsByNameNodeList::sType = nsCacheableFuncStringContentList::eNodeList;
const nsCacheableFuncStringContentList::ContentListType
nsCacheableFuncStringHTMLCollection::sType = nsCacheableFuncStringContentList::eHTMLCollection;
#endif
@ -338,33 +338,21 @@ GetFuncStringContentList(nsINode* aRootNode,
return list.forget();
}
// Explicit instantiations to avoid link errors
template
already_AddRefed<nsContentList>
NS_GetFuncStringNodeList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString)
{
return GetFuncStringContentList<nsCacheableFuncStringNodeList>(aRootNode,
aFunc,
aDestroyFunc,
aDataAllocator,
aString);
}
GetFuncStringContentList<nsCachableElementsByNameNodeList>(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
template
already_AddRefed<nsContentList>
NS_GetFuncStringHTMLCollection(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString)
{
return GetFuncStringContentList<nsCacheableFuncStringHTMLCollection>(aRootNode,
aFunc,
aDestroyFunc,
aDataAllocator,
aString);
}
GetFuncStringContentList<nsCacheableFuncStringHTMLCollection>(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
//-----------------------------------------------------
// nsContentList implementation
@ -1076,14 +1064,33 @@ nsContentList::AssertInSync()
#endif
//-----------------------------------------------------
// nsCacheableFuncStringNodeList
// nsCachableElementsByNameNodeList
JSObject*
nsCacheableFuncStringNodeList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
nsCachableElementsByNameNodeList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
{
return NodeListBinding::Wrap(cx, this, aGivenProto);
}
void
nsCachableElementsByNameNodeList::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue)
{
// No need to rebuild the list if the changed attribute is not the name
// attribute.
if (aAttribute != nsGkAtoms::name) {
return;
}
nsCacheableFuncStringContentList::AttributeChanged(aDocument, aElement,
aNameSpaceID, aAttribute,
aModType, aOldValue);
}
//-----------------------------------------------------
// nsCacheableFuncStringHTMLCollection

View file

@ -546,15 +546,15 @@ protected:
nsString mString;
};
class nsCacheableFuncStringNodeList
class nsCachableElementsByNameNodeList
: public nsCacheableFuncStringContentList
{
public:
nsCacheableFuncStringNodeList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString)
nsCachableElementsByNameNodeList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString)
: nsCacheableFuncStringContentList(aRootNode, aFunc, aDestroyFunc,
aDataAllocator, aString)
{
@ -563,6 +563,8 @@ public:
#endif
}
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
#ifdef DEBUG

View file

@ -57,17 +57,12 @@ NS_GetContentList(nsINode* aRootNode,
int32_t aMatchNameSpaceId,
const nsAString& aTagname);
template<class ListType>
already_AddRefed<nsContentList>
NS_GetFuncStringNodeList(nsINode* aRootNode,
GetFuncStringContentList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
already_AddRefed<nsContentList>
NS_GetFuncStringHTMLCollection(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
#endif // nsContentListDeclarations_h

View file

@ -1659,9 +1659,3 @@ nsContentSink::GetName(nsACString& aName)
aName.AssignASCII("nsContentSink_timer");
return NS_OK;
}
NS_IMETHODIMP
nsContentSink::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View file

@ -55,6 +55,7 @@ class imgIRequest;
class imgLoader;
class imgRequestProxy;
class nsAutoScriptBlockerSuppressNodeRemoved;
class nsCacheableFuncStringHTMLCollection;
class nsHtml5StringParser;
class nsIChannel;
class nsIConsoleService;
@ -2083,10 +2084,11 @@ public:
{
NS_PRECONDITION(aRootNode, "Must have root node");
return NS_GetFuncStringHTMLCollection(aRootNode, MatchClassNames,
DestroyClassNameArray,
AllocClassMatchingInfo,
aClasses);
return GetFuncStringContentList<nsCacheableFuncStringHTMLCollection>(aRootNode,
MatchClassNames,
DestroyClassNameArray,
AllocClassMatchingInfo,
aClasses);
}
/**

View file

@ -1582,7 +1582,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
!nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)))
{
if (aWin->GetDoc()) {
aWin->GetDoc()->WarnOnceAbout(nsIDocument::eWindow_Controllers);
aWin->GetDoc()->WarnOnceAbout(nsIDocument::eWindow_Cc_ontrollers);
}
const JSClass* clazz;
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS)) {

View file

@ -37,7 +37,7 @@ DEPRECATED_OPERATION(ChromeUseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ShowModalDialog)
DEPRECATED_OPERATION(Window_Content)
DEPRECATED_OPERATION(SyncXMLHttpRequest)
DEPRECATED_OPERATION(Window_Controllers)
DEPRECATED_OPERATION(Window_Cc_ontrollers)
DEPRECATED_OPERATION(ImportXULIntoContent)
DEPRECATED_OPERATION(PannerNodeDoppler)
DEPRECATED_OPERATION(NavigatorGetUserMedia)

View file

@ -3050,15 +3050,14 @@ nsIDocument::GetDocGroup() const
}
nsresult
nsIDocument::Dispatch(const char* aName,
TaskCategory aCategory,
nsIDocument::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
// Note that this method may be called off the main thread.
if (mDocGroup) {
return mDocGroup->Dispatch(aName, aCategory, Move(aRunnable));
return mDocGroup->Dispatch(aCategory, Move(aRunnable));
}
return DispatcherTrait::Dispatch(aName, aCategory, Move(aRunnable));
return DispatcherTrait::Dispatch(aCategory, Move(aRunnable));
}
nsISerialEventTarget*
@ -4459,8 +4458,7 @@ nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
mSSApplicableStateNotificationPending =
NS_SUCCEEDED(
Dispatch("nsDocument::NotifyStyleSheetApplicableStateChanged",
TaskCategory::Other, notification.forget()));
Dispatch(TaskCategory::Other, notification.forget()));
}
}
@ -5407,7 +5405,7 @@ nsDocument::UnblockDOMContentLoaded()
NewRunnableMethod("nsDocument::DispatchContentLoadedEvents",
this,
&nsDocument::DispatchContentLoadedEvents);
Dispatch("nsDocument::DispatchContentLoadedEvents", TaskCategory::Other, ev.forget());
Dispatch(TaskCategory::Other, ev.forget());
} else {
DispatchContentLoadedEvents();
}
@ -7047,8 +7045,7 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
NewNonOwningRunnableMethod("nsDocument::DoNotifyPossibleTitleChange",
this,
&nsDocument::DoNotifyPossibleTitleChange);
nsresult rv = Dispatch("nsDocument::DoNotifyPossibleTitleChange",
TaskCategory::Other, do_AddRef(event));
nsresult rv = Dispatch(TaskCategory::Other, do_AddRef(event));
if (NS_SUCCEEDED(rv)) {
mPendingTitleChangeEvent = Move(event);
}
@ -8894,7 +8891,7 @@ nsDocument::PostUnblockOnloadEvent()
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> evt = new nsUnblockOnloadEvent(this);
nsresult rv =
Dispatch("nsUnblockOnloadEvent", TaskCategory::Other, evt.forget());
Dispatch(TaskCategory::Other, evt.forget());
if (NS_SUCCEEDED(rv)) {
// Stabilize block count so we don't post more events while this one is up
++mOnloadBlockCount;
@ -9805,7 +9802,7 @@ nsDocument::UnsuppressEventHandlingAndFireEvents(bool aFireEvents)
if (aFireEvents) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> ded = new nsDelayedEventDispatcher(documents);
Dispatch("nsDelayedEventDispatcher", TaskCategory::Other, ded.forget());
Dispatch(TaskCategory::Other, ded.forget());
} else {
FireOrClearDelayedEvents(documents, false);
}
@ -10958,7 +10955,7 @@ nsIDocument::AsyncExitFullscreen(nsIDocument* aDoc)
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> exit = new nsCallExitFullscreen(aDoc);
if (aDoc) {
aDoc->Dispatch("nsCallExitFullscreen", TaskCategory::Other, exit.forget());
aDoc->Dispatch(TaskCategory::Other, exit.forget());
} else {
NS_DispatchToCurrentThread(exit.forget());
}
@ -11239,7 +11236,7 @@ nsDocument::AsyncRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
// Request full-screen asynchronously.
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> event = new nsCallRequestFullScreen(Move(aRequest));
Dispatch("nsCallRequestFullScreen", TaskCategory::Other, event.forget());
Dispatch(TaskCategory::Other, event.forget());
}
void
@ -12116,7 +12113,7 @@ nsDocument::RequestPointerLock(Element* aElement, CallerType aCallerType)
aCallerType == CallerType::System;
nsCOMPtr<nsIRunnable> request =
new PointerLockRequest(aElement, userInputOrSystemCaller);
Dispatch("PointerLockRequest", TaskCategory::Other, request.forget());
Dispatch(TaskCategory::Other, request.forget());
}
bool
@ -12301,7 +12298,7 @@ nsDocument::PostVisibilityUpdateEvent()
NewRunnableMethod("nsDocument::UpdateVisibilityState",
this,
&nsDocument::UpdateVisibilityState);
Dispatch("nsDocument::UpdateVisibilityState", TaskCategory::Other, event.forget());
Dispatch(TaskCategory::Other, event.forget());
}
void
@ -12848,8 +12845,7 @@ nsDocument::ScheduleIntersectionObserverNotification()
NewRunnableMethod("nsDocument::NotifyIntersectionObservers",
this,
&nsDocument::NotifyIntersectionObservers);
Dispatch("nsDocument::IntersectionObserverNotification", TaskCategory::Other,
notification.forget());
Dispatch(TaskCategory::Other, notification.forget());
}
void
@ -13140,8 +13136,7 @@ nsIDocument::RebuildUserFontSet()
NewRunnableMethod("nsIDocument::HandleRebuildUserFontSet",
this,
&nsIDocument::HandleRebuildUserFontSet);
if (NS_SUCCEEDED(Dispatch("nsIDocument::HandleRebuildUserFontSet",
TaskCategory::Other, ev.forget()))) {
if (NS_SUCCEEDED(Dispatch(TaskCategory::Other, ev.forget()))) {
mPostedFlushUserFontSet = true;
}
}

View file

@ -1034,6 +1034,7 @@ GK_ATOM(onupdateready, "onupdateready")
GK_ATOM(onupgradeneeded, "onupgradeneeded")
GK_ATOM(onussdreceived, "onussdreceived")
GK_ATOM(onversionchange, "onversionchange")
GK_ATOM(onvisibilitychange, "onvisibilitychange")
GK_ATOM(onvoicechange, "onvoicechange")
GK_ATOM(onvoiceschanged, "onvoiceschanged")
GK_ATOM(onvrdisplayactivate, "onvrdisplayactivate")

View file

@ -24,6 +24,7 @@
#include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/dom/StorageNotifierService.h"
#include "mozilla/dom/StorageUtils.h"
#include "mozilla/dom/Timeout.h"
#include "mozilla/dom/TimeoutHandler.h"
#include "mozilla/dom/TimeoutManager.h"
@ -498,7 +499,19 @@ public:
}
}
virtual nsIEventTarget*
nsIPrincipal*
GetPrincipal() const override
{
return mWindow ? mWindow->GetPrincipal() : nullptr;
}
bool
IsPrivateBrowsing() const override
{
return mWindow ? mWindow->IsPrivateBrowsing() : false;
}
nsIEventTarget*
GetEventTarget() const override
{
return mWindow ? mWindow->EventTargetFor(TaskCategory::Other) : nullptr;
@ -680,12 +693,6 @@ IdleRequestExecutor::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
IdleRequestExecutor::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IdleRequestExecutor::Run()
{
@ -9242,7 +9249,7 @@ nsGlobalWindow::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessa
return;
}
aError = Dispatch("PostMessageEvent", TaskCategory::Other, event.forget());
aError = Dispatch(TaskCategory::Other, event.forget());
}
void
@ -9294,7 +9301,7 @@ public:
PostCloseEvent(nsGlobalWindow* aWindow, bool aIndirect) {
nsCOMPtr<nsIRunnable> ev = new nsCloseEvent(aWindow, aIndirect);
nsresult rv =
aWindow->Dispatch("nsCloseEvent", TaskCategory::Other, ev.forget());
aWindow->Dispatch(TaskCategory::Other, ev.forget());
if (NS_SUCCEEDED(rv))
aWindow->MaybeForgiveSpamCount();
return rv;
@ -9825,8 +9832,7 @@ void
nsGlobalWindow::NotifyWindowIDDestroyed(const char* aTopic)
{
nsCOMPtr<nsIRunnable> runnable = new WindowDestroyedEvent(this, mWindowID, aTopic);
nsresult rv =
Dispatch("WindowDestroyedEvent", TaskCategory::Other, runnable.forget());
nsresult rv = Dispatch(TaskCategory::Other, runnable.forget());
if (NS_SUCCEEDED(rv)) {
mNotifiedIDDestroyed = true;
}
@ -11094,7 +11100,7 @@ nsGlobalWindow::DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI)
nsCOMPtr<nsIRunnable> callback =
new HashchangeCallback(oldWideSpec, newWideSpec, this);
return Dispatch("HashchangeCallback", TaskCategory::Other, callback.forget());
return Dispatch(TaskCategory::Other, callback.forget());
}
nsresult
@ -11694,8 +11700,7 @@ nsGlobalWindow::NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
new NotifyIdleObserverRunnable(aIdleObserverHolder->mIdleObserver,
aIdleObserverHolder->mTimeInS,
aCallOnidle, this);
if (NS_FAILED(Dispatch("NotifyIdleObserverRunnable", TaskCategory::Other,
caller.forget()))) {
if (NS_FAILED(Dispatch(TaskCategory::Other, caller.forget()))) {
NS_WARNING("Failed to dispatch thread for idle observer notification.");
}
}
@ -12372,16 +12377,7 @@ nsGlobalWindow::ObserveStorageNotification(StorageEvent* aEvent,
{
MOZ_ASSERT(aEvent);
// Enforce that the source storage area's private browsing state matches
// this window's state. These flag checks and their maintenance independent
// from the principal's OriginAttributes matter because chrome docshells
// that are part of private browsing windows can be private browsing without
// having their OriginAttributes set (because they have the system
// principal).
bool isPrivateBrowsing = IsPrivateBrowsing();
if (isPrivateBrowsing != aPrivateBrowsing) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(IsPrivateBrowsing() == aPrivateBrowsing);
// LocalStorage can only exist on an inner window, and we don't want to
// generate events on frozen or otherwise-navigated-away from windows.
@ -12433,18 +12429,9 @@ nsGlobalWindow::ObserveStorageNotification(StorageEvent* aEvent,
else {
MOZ_ASSERT(!NS_strcmp(aStorageType, u"localStorage"));
nsIPrincipal* storagePrincipal = aEvent->GetPrincipal();
if (!storagePrincipal) {
return;
}
bool equals = false;
nsresult rv = storagePrincipal->Equals(principal, &equals);
NS_ENSURE_SUCCESS_VOID(rv);
if (!equals) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(),
principal));
fireMozStorageChanged = mLocalStorage == aEvent->GetStorageArea();
@ -12896,8 +12883,7 @@ public:
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
nsCOMPtr<nsIRunnable> caller = NewRunnableMethod(
"AutoUnblockScriptClosing::~AutoUnblockScriptClosing", mWin, run);
mWin->Dispatch("nsGlobalWindow::UnblockScriptedClosing",
TaskCategory::Other, caller.forget());
mWin->Dispatch(TaskCategory::Other, caller.forget());
}
};
@ -15400,15 +15386,14 @@ nsPIDOMWindow<T>::GetDocGroup() const
}
nsresult
nsGlobalWindow::Dispatch(const char* aName,
TaskCategory aCategory,
nsGlobalWindow::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (GetDocGroup()) {
return GetDocGroup()->Dispatch(aName, aCategory, Move(aRunnable));
return GetDocGroup()->Dispatch(aCategory, Move(aRunnable));
}
return DispatcherTrait::Dispatch(aName, aCategory, Move(aRunnable));
return DispatcherTrait::Dispatch(aCategory, Move(aRunnable));
}
nsISerialEventTarget*

View file

@ -1829,8 +1829,7 @@ private:
public:
// Dispatch a runnable related to the global.
virtual nsresult Dispatch(const char* aName,
mozilla::TaskCategory aCategory,
virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual nsISerialEventTarget*

View file

@ -2937,8 +2937,7 @@ public:
virtual void NotifyIntersectionObservers() = 0;
// Dispatch a runnable related to the document.
virtual nsresult Dispatch(const char* aName,
mozilla::TaskCategory aCategory,
virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual nsISerialEventTarget*

View file

@ -198,7 +198,7 @@ private:
template<typename T,
JSObject* UnwrapArray(JSObject*),
T* GetData(JSObject*, bool* isShared, const JS::AutoCheckCannotGC&),
T* GetData(JSObject*, bool* isShared, const JS::AutoRequireNoGC&),
void GetLengthAndDataAndSharedness(JSObject*, uint32_t*, bool*, T**),
JSObject* CreateNew(JSContext*, uint32_t)>
struct TypedArray

View file

@ -6,6 +6,7 @@
#include "WebGLContextLossHandler.h"
#include "mozilla/DebugOnly.h"
#include "nsINamed.h"
#include "nsISupportsImpl.h"
#include "nsITimer.h"
#include "nsThreadUtils.h"
@ -14,6 +15,7 @@
namespace mozilla {
class WatchdogTimerEvent final : public nsITimerCallback
, public nsINamed
{
const WeakPtr<WebGLContextLossHandler> mHandler;
@ -24,6 +26,12 @@ public:
: mHandler(handler)
{ }
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("WatchdogTimerEvent");
return NS_OK;
}
private:
virtual ~WatchdogTimerEvent() { }
@ -35,7 +43,7 @@ private:
}
};
NS_IMPL_ISUPPORTS(WatchdogTimerEvent, nsITimerCallback, nsISupports)
NS_IMPL_ISUPPORTS(WatchdogTimerEvent, nsITimerCallback, nsINamed)
////////////////////////////////////////

View file

@ -41,7 +41,6 @@ function prepareSources() {
// Prepare image.
gImage = document.createElement("img");
gImage.crossOrigin = "anonymous";
gImage.src = gCanvas.toDataURL();
var resolverImage;
var promiseImage = new Promise(function(resolve, reject) {
@ -92,4 +91,4 @@ function prepareSources() {
}
return promise;
}
}

View file

@ -40,7 +40,6 @@ var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var img = document.getElementById("img");
img.crossOrigin = "anonymous";
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
img.onload = function () {

View file

@ -20887,7 +20887,6 @@ img.onload = wrapFunction(function ()
isPixel(ctx667, 62,40, 6,10,250,127, 4);
isPixel(ctx667, 87,40, 12,16,244,63, 8);
});
img.crossOrigin = "anonymous";
img.src = canvas667.toDataURL();
@ -21014,7 +21013,6 @@ img.onload = wrapFunction(function ()
isPixel(ctx672, 87,20, 0,0,255,255, 0);
isPixel(ctx672, 50,45, 255,255,255,255, 0);
});
img.crossOrigin = "anonymous";
img.src = data;

View file

@ -162,7 +162,6 @@ function prepareSources() {
// Prepare image.
gImage = document.createElement("img");
gImage.src = gCanvas.toDataURL();
gImage.crossOrigin = "anonymous";
var resolverImage;
var promiseImage = new Promise(function(resolve, reject) {
resolverImage = resolve;

View file

@ -170,7 +170,6 @@ function do_canvas(row, col, type, options)
isPixel(ctx, 50,25, r,g,b,255, 8);
finishedTests[row + '_' + col] = true;
};
img.crossOrigin = "anonymous";
img.src = data;
}

View file

@ -84,14 +84,14 @@ AsyncEventDispatcher::PostDOMEvent()
RefPtr<AsyncEventDispatcher> ensureDeletionWhenFailing = this;
if (NS_IsMainThread()) {
if (nsCOMPtr<nsIGlobalObject> global = mTarget->GetOwnerGlobal()) {
return global->Dispatch("AsyncEventDispatcher", TaskCategory::Other, ensureDeletionWhenFailing.forget());
return global->Dispatch(TaskCategory::Other, ensureDeletionWhenFailing.forget());
}
// Sometimes GetOwnerGlobal returns null because it uses
// GetScriptHandlingObject rather than GetScopeObject.
if (nsCOMPtr<nsINode> node = do_QueryInterface(mTarget)) {
nsCOMPtr<nsIDocument> doc = node->OwnerDoc();
return doc->Dispatch("AsyncEventDispatcher", TaskCategory::Other, ensureDeletionWhenFailing.forget());
return doc->Dispatch(TaskCategory::Other, ensureDeletionWhenFailing.forget());
}
}
return NS_DispatchToCurrentThread(this);

View file

@ -478,7 +478,7 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback,
}
}
if (global) {
rv = global->Dispatch("GASRunnable", TaskCategory::Other, runnable.forget());
rv = global->Dispatch(TaskCategory::Other, runnable.forget());
} else {
rv = NS_DispatchToMainThread(runnable);
}

View file

@ -371,10 +371,9 @@ EventListenerService::NotifyAboutMainThreadListenerChangeInternal(dom::EventTarg
NewRunnableMethod("EventListenerService::NotifyPendingChanges",
this, &EventListenerService::NotifyPendingChanges);
if (nsCOMPtr<nsIGlobalObject> global = aTarget->GetOwnerGlobal()) {
global->Dispatch(nullptr, TaskCategory::Other, runnable.forget());
global->Dispatch(TaskCategory::Other, runnable.forget());
} else if (nsCOMPtr<nsINode> node = do_QueryInterface(aTarget)) {
node->OwnerDoc()->Dispatch(nullptr, TaskCategory::Other,
runnable.forget());
node->OwnerDoc()->Dispatch(TaskCategory::Other, runnable.forget());
} else {
NS_DispatchToCurrentThread(runnable);
}

View file

@ -682,6 +682,11 @@ DOCUMENT_ONLY_EVENT(selectionchange,
eSelectionChange,
EventNameType_HTMLXUL,
eBasicEventClass)
DOCUMENT_ONLY_EVENT(visibilitychange,
eVisibilityChange,
EventNameType_HTMLXUL,
eBasicEventClass)
NON_IDL_EVENT(MozMouseHittest,
eMouseHitTest,

View file

@ -237,12 +237,6 @@ UITimerCallback::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
UITimerCallback::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/******************************************************************/
/* mozilla::OverOutElementsWrapper */
/******************************************************************/

View file

@ -1848,7 +1848,7 @@ IMEContentObserver::IMENotificationSender::Dispatch(nsIDocShell* aDocShell)
aDocShell ? aDocShell->GetScriptGlobalObject() : nullptr;
if (globalObject) {
RefPtr<IMENotificationSender> queuedSender = this;
globalObject->Dispatch(nullptr, TaskCategory::Other,
globalObject->Dispatch(TaskCategory::Other,
queuedSender.forget());
} else {
NS_DispatchToCurrentThread(this);

View file

@ -71,6 +71,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileReader)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsINamed)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(FileReader, DOMEventTargetHelper)
@ -684,6 +685,14 @@ FileReader::OnInputStreamReady(nsIAsyncInputStream* aStream)
return NS_OK;
}
// nsINamed
NS_IMETHODIMP
FileReader::GetName(nsACString& aName)
{
aName.AssignLiteral("FileReader");
return NS_OK;
}
nsresult
FileReader::OnLoadEnd(nsresult aStatus)
{

View file

@ -12,6 +12,7 @@
#include "nsIAsyncInputStream.h"
#include "nsIInterfaceRequestor.h"
#include "nsINamed.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsWeakReference.h"
@ -41,6 +42,7 @@ class FileReader final : public DOMEventTargetHelper,
public nsSupportsWeakReference,
public nsIInputStreamCallback,
public nsITimerCallback,
public nsINamed,
public workers::WorkerHolder
{
friend class FileReaderDecreaseBusyCounter;
@ -54,6 +56,7 @@ public:
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSIINPUTSTREAMCALLBACK
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSINAMED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(FileReader,
DOMEventTargetHelper)

View file

@ -126,9 +126,7 @@ IPCBlobInputStreamThread::Initialize()
{
if (!NS_IsMainThread()) {
RefPtr<Runnable> runnable = new ThreadInitializeRunnable();
SystemGroup::Dispatch("IPCBlobInputStreamThread::Initialize",
TaskCategory::Other,
runnable.forget());
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
return;
}

View file

@ -469,13 +469,6 @@ public:
return NS_OK;
}
NS_IMETHOD
SetName(const char* aName) override
{
MOZ_CRASH("The name shall never be set!");
return NS_OK;
}
private:
explicit ReleasingTimerHolder(nsTArray<nsWeakPtr>&& aArray)
: mURIs(aArray)

View file

@ -25,6 +25,7 @@
#include "nsSocketTransport2.h"
#include "nsHashPropertyBag.h"
#include "nsNetUtil.h"
#include "nsINamed.h"
#include "nsISimpleEnumerator.h"
#include "nsIProperty.h"
#include "nsICertOverrideService.h"
@ -159,6 +160,7 @@ class FlyWebMDNSService final
, public nsIDNSServiceResolveListener
, public nsIDNSRegistrationListener
, public nsITimerCallback
, public nsINamed
{
friend class FlyWebService;
@ -180,6 +182,12 @@ public:
explicit FlyWebMDNSService(FlyWebService* aService,
const nsACString& aServiceType);
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("FlyWebMDNSService");
return NS_OK;
}
private:
virtual ~FlyWebMDNSService() = default;
@ -296,7 +304,8 @@ NS_IMPL_ISUPPORTS(FlyWebMDNSService,
nsIDNSServiceDiscoveryListener,
nsIDNSServiceResolveListener,
nsIDNSRegistrationListener,
nsITimerCallback)
nsITimerCallback,
nsINamed)
FlyWebMDNSService::FlyWebMDNSService(
FlyWebService* aService,

View file

@ -9,7 +9,7 @@
#include "nsIGeolocationProvider.h"
#include "nsServiceManagerUtils.h"
NS_IMPL_ISUPPORTS(MLSFallback, nsITimerCallback)
NS_IMPL_ISUPPORTS(MLSFallback, nsITimerCallback, nsINamed)
MLSFallback::MLSFallback(uint32_t delay)
: mDelayMs(delay)
@ -59,6 +59,13 @@ MLSFallback::Notify(nsITimer* aTimer)
return CreateMLSFallbackProvider();
}
NS_IMETHODIMP
MLSFallback::GetName(nsACString& aName)
{
aName.AssignLiteral("MLSFallback");
return NS_OK;
}
nsresult
MLSFallback::CreateMLSFallbackProvider()
{

View file

@ -6,6 +6,7 @@
#include "nsCOMPtr.h"
#include "nsITimer.h"
#include "nsINamed.h"
class nsIGeolocationUpdate;
class nsIGeolocationProvider;
@ -28,10 +29,12 @@ class nsIGeolocationProvider;
first when expected to do so.
*/
class MLSFallback : public nsITimerCallback
, public nsINamed
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSINAMED
explicit MLSFallback(uint32_t delayMs = 2000);
nsresult Startup(nsIGeolocationUpdate* aWatcher);

View file

@ -21,6 +21,7 @@
#include "nsDOMClassInfoID.h"
#include "nsGlobalWindow.h"
#include "nsIDocument.h"
#include "nsINamed.h"
#include "nsIObserverService.h"
#include "nsIScriptError.h"
#include "nsPIDOMWindow.h"
@ -96,6 +97,7 @@ class nsGeolocationRequest final
virtual ~nsGeolocationRequest();
class TimerCallbackHolder final : public nsITimerCallback
, public nsINamed
{
public:
NS_DECL_ISUPPORTS
@ -105,6 +107,12 @@ class nsGeolocationRequest final
: mRequest(aRequest)
{}
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("nsGeolocationRequest::TimerCallbackHolder");
return NS_OK;
}
private:
~TimerCallbackHolder() = default;
WeakPtr<nsGeolocationRequest> mRequest;
@ -637,7 +645,9 @@ nsGeolocationRequest::Shutdown()
// nsGeolocationRequest::TimerCallbackHolder
////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS(nsGeolocationRequest::TimerCallbackHolder, nsISupports, nsITimerCallback)
NS_IMPL_ISUPPORTS(nsGeolocationRequest::TimerCallbackHolder,
nsITimerCallback,
nsINamed)
NS_IMETHODIMP
nsGeolocationRequest::TimerCallbackHolder::Notify(nsITimer*)

View file

@ -530,9 +530,7 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
NewRunnableMethod("dom::HTMLCanvasElement::CallPrintCallback",
this,
&HTMLCanvasElement::CallPrintCallback);
return OwnerDoc()->Dispatch("HTMLCanvasElement::CallPrintCallback",
TaskCategory::Other,
renderEvent.forget());
return OwnerDoc()->Dispatch(TaskCategory::Other, renderEvent.forget());
}
void
@ -852,7 +850,6 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
// dimension or its vertical dimension is zero. See link below.
// https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-toblob
OwnerDoc()->Dispatch(
"FireNullBlobEvent",
TaskCategory::Other,
NewRunnableMethod<Blob*, const char*>(
"dom::HTMLCanvasElement::ToBlob",

View file

@ -445,8 +445,7 @@ HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName)
this,
&HTMLTrackElement::DispatchTrustedEvent,
aEventName);
doc->Dispatch("HTMLTrackElement::DispatchTrackRunnable",
TaskCategory::Other, runnable.forget());
doc->Dispatch(TaskCategory::Other, runnable.forget());
}
void

View file

@ -630,7 +630,6 @@ TextTrackManager::DispatchUpdateCueDisplay()
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::UpdateCueDisplay",
TaskCategory::Other,
NewRunnableMethod("dom::TextTrackManager::UpdateCueDisplay",
this,
@ -653,7 +652,6 @@ TextTrackManager::DispatchTimeMarchesOn()
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::TimeMarchesOn",
TaskCategory::Other,
NewRunnableMethod("dom::TextTrackManager::TimeMarchesOn",
this,

View file

@ -487,7 +487,7 @@ nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aDocument) {
RegAccessKey();
if (HasName()) {
if (CanHaveName(NodeInfo()->NameAtom()) && HasName()) {
aDocument->
AddToNameTable(this, GetParsedAttr(nsGkAtoms::name)->GetAtomValue());
}
@ -776,15 +776,16 @@ nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
RegAccessKey();
}
} else if (aName == nsGkAtoms::name) {
if (aValue && !aValue->Equals(EmptyString(), eIgnoreCase) &&
CanHaveName(NodeInfo()->NameAtom())) {
if (aValue && !aValue->Equals(EmptyString(), eIgnoreCase)) {
// This may not be quite right because we can have subclass code run
// before here. But in practice subclasses don't care about this flag,
// and in particular selector matching does not care. Otherwise we'd
// want to handle it like we handle id attributes (in PreIdMaybeChange
// and PostIdMaybeChange).
SetHasName();
AddToNameTable(aValue->GetAtomValue());
if (CanHaveName(NodeInfo()->NameAtom())) {
AddToNameTable(aValue->GetAtomValue());
}
}
}
}

View file

@ -733,7 +733,7 @@ protected:
}
}
void RemoveFromNameTable() {
if (HasName()) {
if (CanHaveName(NodeInfo()->NameAtom()) && HasName()) {
nsIDocument* doc = GetUncomposedDoc();
if (doc) {
doc->RemoveFromNameTable(this, GetParsedAttr(nsGkAtoms::name)->

View file

@ -2038,6 +2038,11 @@ nsHTMLDocument::MatchNameAttribute(Element* aElement, int32_t aNamespaceID,
nsIAtom* aAtom, void* aData)
{
NS_PRECONDITION(aElement, "Must have element to work with!");
if (!aElement->HasName()) {
return false;
}
nsString* elementName = static_cast<nsString*>(aData);
return
aElement->GetNameSpaceID() == kNameSpaceID_XHTML &&

View file

@ -193,8 +193,11 @@ public:
nsIHTMLCollection* Scripts();
already_AddRefed<nsContentList> GetElementsByName(const nsAString & aName)
{
return NS_GetFuncStringNodeList(this, MatchNameAttribute, nullptr,
UseExistingNameString, aName);
return GetFuncStringContentList<nsCachableElementsByNameNodeList>(this,
MatchNameAttribute,
nullptr,
UseExistingNameString,
aName);
}
already_AddRefed<nsIDocument> Open(JSContext* cx,
const nsAString& aType,

View file

@ -611,3 +611,4 @@ skip-if = os == "android" # up/down arrow keys not supported on android
support-files =
file_script_module.html
file_script_nomodule.html
[test_getElementsByName_after_mutation.html]

View file

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1376695
-->
<head>
<title>Test for Bug 1376695</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1376695">Mozilla Bug 1376695</a>
<p id="display"></p>
<div id="originalFoo" name="foo">
<pre id="test">
<script type="application/javascript">
/** Test to ensure that the list returned by getElementsByName is updated after
* mutations.
**/
var fooList = document.getElementsByName("foo");
var originalDiv = document.getElementById("originalFoo");
is(fooList.length, 1, "Should find one element with name 'foo' initially");
is(fooList[0], originalDiv, "Element should be the original div");
var newTree = document.createElement("p");
var child1 = document.createElement("div");
var child2 = document.createElement("div");
child2.setAttribute("name", "foo");
newTree.appendChild(child1);
newTree.appendChild(child2);
document.body.appendChild(newTree);
is(fooList.length, 2,
"Should find two elements with name 'foo' after appending the new tree");
is(fooList[1], child2, "Element should be the new appended div with name 'foo'");
document.body.removeChild(newTree);
is(fooList.length, 1,
"Should find one element with name 'foo' after removing the new tree");
is(fooList[0], originalDiv,
"Element should be the original div after removing the new tree");
</script>
</pre>
</body>
</html>

View file

@ -9883,15 +9883,13 @@ CheckWasmModule(FileHelper* aFileHelper,
return NS_ERROR_FAILURE;
}
size_t compiledSize;
module->serializedSize(nullptr, &compiledSize);
size_t compiledSize = module->compiledSerializedSize();
UniquePtr<uint8_t[]> compiled(new (fallible) uint8_t[compiledSize]);
if (NS_WARN_IF(!compiled)) {
return NS_ERROR_OUT_OF_MEMORY;
}
module->serialize(nullptr, 0, compiled.get(), compiledSize);
module->compiledSerialize(compiled.get(), compiledSize);
nsCOMPtr<nsIInputStream> inputStream;
rv = NS_NewByteInputStream(getter_AddRefs(inputStream),

View file

@ -349,25 +349,20 @@ StructuredCloneWriteCallback(JSContext* aCx,
RefPtr<JS::WasmModule> module = JS::GetWasmModule(aObj);
MOZ_ASSERT(module);
size_t bytecodeSize;
size_t compiledSize;
module->serializedSize(&bytecodeSize, &compiledSize);
size_t bytecodeSize = module->bytecodeSerializedSize();
UniquePtr<uint8_t[]> bytecode(new uint8_t[bytecodeSize]);
MOZ_ASSERT(bytecode);
UniquePtr<uint8_t[]> compiled(new uint8_t[compiledSize]);
MOZ_ASSERT(compiled);
module->serialize(bytecode.get(),
bytecodeSize,
compiled.get(),
compiledSize);
module->bytecodeSerialize(bytecode.get(), bytecodeSize);
RefPtr<BlobImpl> blobImpl =
new MemoryBlobImpl(bytecode.release(), bytecodeSize, EmptyString());
RefPtr<Blob> bytecodeBlob = Blob::Create(nullptr, blobImpl);
size_t compiledSize = module->compiledSerializedSize();
UniquePtr<uint8_t[]> compiled(new uint8_t[compiledSize]);
MOZ_ASSERT(compiled);
module->compiledSerialize(compiled.get(), compiledSize);
blobImpl =
new MemoryBlobImpl(compiled.release(), compiledSize, EmptyString());
RefPtr<Blob> compiledBlob = Blob::Create(nullptr, blobImpl);

View file

@ -1107,7 +1107,8 @@ IndexedDatabaseManager::GetLocale()
NS_IMPL_ADDREF(IndexedDatabaseManager)
NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy())
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver, nsITimerCallback)
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver, nsITimerCallback,
nsINamed)
NS_IMETHODIMP
IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic,
@ -1163,6 +1164,13 @@ IndexedDatabaseManager::Notify(nsITimer* aTimer)
return NS_OK;
}
NS_IMETHODIMP
IndexedDatabaseManager::GetName(nsACString& aName)
{
aName.AssignLiteral("IndexedDatabaseManager");
return NS_OK;
}
already_AddRefed<FileManager>
FileManagerInfo::GetFileManager(PersistenceType aPersistenceType,
const nsAString& aName) const

View file

@ -16,6 +16,7 @@
#include "nsClassHashtable.h"
#include "nsCOMPtr.h"
#include "nsHashKeys.h"
#include "nsINamed.h"
#include "nsITimer.h"
class nsIEventTarget;
@ -45,6 +46,7 @@ class FileManagerInfo;
class IndexedDatabaseManager final
: public nsIObserver
, public nsITimerCallback
, public nsINamed
{
typedef mozilla::dom::quota::PersistenceType PersistenceType;
typedef mozilla::dom::quota::QuotaManager QuotaManager;
@ -64,6 +66,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSINAMED
// Returns a non-owning reference.
static IndexedDatabaseManager*

View file

@ -8,11 +8,13 @@
#include "Key.h"
#include <algorithm>
#include <stdint.h> // for UINT32_MAX, uintptr_t
#include "IndexedDatabaseManager.h"
#include "js/Date.h"
#include "js/Value.h"
#include "jsfriendapi.h"
#include "mozilla/Casting.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/EndianUtils.h"
#include "mozilla/FloatingPoint.h"
#include "mozIStorageStatement.h"
@ -196,7 +198,10 @@ Key::ToLocaleBasedKey(Key& aTarget, const nsCString& aLocale) const
nsDependentString str;
DecodeString(it, end, str);
aTarget.EncodeLocaleString(str, typeOffset, aLocale);
nsresult rv = aTarget.EncodeLocaleString(str, typeOffset, aLocale);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
}
aTarget.TrimBuffer();
@ -221,8 +226,7 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
EncodeString(str, aTypeOffset);
return NS_OK;
return EncodeString(str, aTypeOffset);
}
if (aVal.isNumber()) {
@ -299,13 +303,11 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
}
if (JS_IsArrayBufferObject(obj)) {
EncodeBinary(obj, /* aIsViewObject */ false, aTypeOffset);
return NS_OK;
return EncodeBinary(obj, /* aIsViewObject */ false, aTypeOffset);
}
if (JS_IsArrayBufferViewObject(obj)) {
EncodeBinary(obj, /* aIsViewObject */ true, aTypeOffset);
return NS_OK;
return EncodeBinary(obj, /* aIsViewObject */ true, aTypeOffset);
}
}
@ -415,44 +417,64 @@ Key::EncodeJSVal(JSContext* aCx,
return EncodeJSValInternal(aCx, aVal, aTypeOffset, 0);
}
void
nsresult
Key::EncodeString(const nsAString& aString, uint8_t aTypeOffset)
{
const char16_t* start = aString.BeginReading();
const char16_t* end = aString.EndReading();
EncodeString(start, end, aTypeOffset);
return EncodeString(start, end, aTypeOffset);
}
template <typename T>
void
nsresult
Key::EncodeString(const T* aStart, const T* aEnd, uint8_t aTypeOffset)
{
EncodeAsString(aStart, aEnd, eString + aTypeOffset);
return EncodeAsString(aStart, aEnd, eString + aTypeOffset);
}
template <typename T>
void
nsresult
Key::EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType)
{
// First measure how long the encoded string will be.
if (NS_WARN_IF(aStart > aEnd || UINT32_MAX - 2 < uintptr_t(aEnd - aStart))) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
// The +2 is for initial 3 and trailing 0. We'll compensate for multi-byte
// chars below.
uint32_t size = (aEnd - aStart) + 2;
uint32_t checkedSize = aEnd - aStart;
CheckedUint32 size = checkedSize;
size += 2;
MOZ_ASSERT(size.isValid());
const T* start = aStart;
const T* end = aEnd;
for (const T* iter = start; iter < end; ++iter) {
if (*iter > ONE_BYTE_LIMIT) {
size += char16_t(*iter) > TWO_BYTE_LIMIT ? 2 : 1;
if (!size.isValid()) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
}
}
// Allocate memory for the new size
uint32_t oldLen = mBuffer.Length();
size += oldLen;
if (!size.isValid()) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
char* buffer;
if (!mBuffer.GetMutableData(&buffer, oldLen + size)) {
return;
if (!mBuffer.GetMutableData(&buffer, size.value())) {
IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
buffer += oldLen;
@ -481,6 +503,8 @@ Key::EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType)
*(buffer++) = eTerminator;
NS_ASSERTION(buffer == mBuffer.EndReading(), "Wrote wrong number of bytes");
return NS_OK;
}
#ifdef ENABLE_INTL_API
@ -517,10 +541,9 @@ Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset,
return NS_ERROR_FAILURE;
}
EncodeString(keyBuffer.Elements(),
keyBuffer.Elements()+sortKeyLength,
aTypeOffset);
return NS_OK;
return EncodeString(keyBuffer.Elements(),
keyBuffer.Elements()+sortKeyLength,
aTypeOffset);
}
#endif
@ -640,7 +663,7 @@ Key::DecodeNumber(const unsigned char*& aPos, const unsigned char* aEnd)
return BitwiseCast<double>(bits);
}
void
nsresult
Key::EncodeBinary(JSObject* aObject, bool aIsViewObject, uint8_t aTypeOffset)
{
uint8_t* bufferData;
@ -653,7 +676,7 @@ Key::EncodeBinary(JSObject* aObject, bool aIsViewObject, uint8_t aTypeOffset)
js::GetArrayBufferLengthAndData(aObject, &bufferLength, &unused, &bufferData);
}
EncodeAsString(bufferData, bufferData + bufferLength, eBinary + aTypeOffset);
return EncodeAsString(bufferData, bufferData + bufferLength, eBinary + aTypeOffset);
}
// static

View file

@ -287,15 +287,15 @@ private:
nsresult
EncodeJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal, uint8_t aTypeOffset);
void
nsresult
EncodeString(const nsAString& aString, uint8_t aTypeOffset);
template <typename T>
void
nsresult
EncodeString(const T* aStart, const T* aEnd, uint8_t aTypeOffset);
template <typename T>
void
nsresult
EncodeAsString(const T* aStart, const T* aEnd, uint8_t aType);
#ifdef ENABLE_INTL_API
@ -307,7 +307,7 @@ private:
void
EncodeNumber(double aFloat, uint8_t aType);
void
nsresult
EncodeBinary(JSObject* aObject, bool aIsViewObject, uint8_t aTypeOffset);
// Decoding functions. aPos points into mBuffer and is adjusted to point

View file

@ -214,9 +214,7 @@ ScriptErrorHelper::Dump(const nsAString& aMessage,
aIsChrome,
aInnerWindowID);
MOZ_ALWAYS_SUCCEEDS(
SystemGroup::Dispatch("indexedDB::ScriptErrorHelper::Dump",
TaskCategory::Other,
runnable.forget()));
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget()));
}
}
@ -247,9 +245,7 @@ ScriptErrorHelper::DumpLocalizedMessage(const nsACString& aMessageName,
aIsChrome,
aInnerWindowID);
MOZ_ALWAYS_SUCCEEDS(
SystemGroup::Dispatch("indexedDB::ScriptErrorHelper::DumpLocalizedMessage",
TaskCategory::Other,
runnable.forget()));
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget()));
}
}

View file

@ -5,6 +5,48 @@
#include "nsISupports.idl"
#include "nsIVariant.idl"
#include "nsIPaymentAddress.idl"
[builtinclass, scriptable, uuid(2a338575-c688-40ee-a157-7488ab292ef2)]
interface nsIPaymentResponseData: nsISupports
{
const uint32_t GENERAL_RESPONSE = 0;
const uint32_t BASICCARD_RESPONSE = 1;
readonly attribute uint32_t type;
void init(in uint32_t aType);
};
[builtinclass, scriptable, uuid(b986773e-2b30-4ed2-b8fe-6a96631c8000)]
interface nsIGeneralResponseData : nsIPaymentResponseData
{
readonly attribute AString data;
[implicit_jscontext]
void initData(in jsval aData);
};
/*
Since PaymentAddress is an no constructor interface type, UI code can not
easy create PaymentAddress by calling new PaymentAddress().
Unfortunately, BasicCardResponse has a PaymentAddress attribute, billingAddress
, it means UI can not create BsaicCardResponse by calling the init() with a
given JSObject directly, because PaymentAddress creation in JS code is hard.
To let UI code can create BasicCardResponse easier, nsIBasicCardResponse is
provided for UI by passing the raw data of BasicCardResponse,
*/
[builtinclass, scriptable, uuid(0d55a5e6-d185-44f0-b992-a8e1321e4bce)]
interface nsIBasicCardResponseData : nsIPaymentResponseData
{
readonly attribute AString data;
void initData(in AString aCardholderName,
in AString aCardNumber,
in AString aExpiryMonth,
in AString aExpiryYear,
in AString aCardSecurityCode,
in nsIPaymentAddress billingAddress);
};
[builtinclass, scriptable, uuid(a607c095-ef60-4a9b-a3d0-0506c60728b3)]
interface nsIPaymentActionResponse : nsISupports
@ -94,7 +136,7 @@ interface nsIPaymentShowActionResponse : nsIPaymentActionResponse
void init(in AString aRequestId,
in uint32_t aAcceptStatus,
in AString aMethodName,
in AString aData,
in nsIPaymentResponseData aData,
in AString aPayerName,
in AString aPayerEmail,
in AString aPayerPhone);
@ -142,6 +184,16 @@ interface nsIPaymentCompleteActionResponse : nsIPaymentActionResponse
};
%{C++
#define NS_GENERAL_RESPONSE_DATA_CID \
{ 0xb986773e, 0x2b30, 0x4ed2, { 0xb8, 0xfe, 0x6a, 0x96, 0x63, 0x1c, 0x80, 0x00 } }
#define NS_GENERAL_RESPONSE_DATA_CONTRACT_ID \
"@mozilla.org/dom/payments/general-response-data;1"
#define NS_BASICCARD_RESPONSE_DATA_CID \
{ 0x0d55a5e6, 0xd185, 0x44f0, { 0xb9, 0x92, 0xa8, 0xe1, 0x32, 0x1e, 0x4b, 0xce } }
#define NS_BASICCARD_RESPONSE_DATA_CONTRACT_ID \
"@mozilla.org/dom/payments/basiccard-response-data;1"
#define NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID \
{ 0x52fc3f9f, 0xc0cb, 0x4874, { 0xb3, 0xd4, 0xee, 0x4b, 0x6e, 0x9c, 0xbe, 0x9c } }
#define NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID \

View file

@ -12,7 +12,8 @@ interface nsIArray;
interface nsIPaymentMethodData : nsISupports
{
readonly attribute AString supportedMethods;
readonly attribute AString data;
[implicit_jscontext]
readonly attribute jsval data;
};
[scriptable, builtinclass, uuid(d22a6f5f-767b-4fea-bf92-68b0b8003eba)]
@ -36,7 +37,8 @@ interface nsIPaymentDetailsModifier : nsISupports
readonly attribute AString supportedMethods;
readonly attribute nsIPaymentItem total;
readonly attribute nsIArray additionalDisplayItems;
readonly attribute AString data;
[implicit_jscontext]
readonly attribute jsval data;
};
[scriptable, builtinclass, uuid(68341551-3605-4381-b936-41e830aa88fb)]

View file

@ -18,6 +18,7 @@
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
#include "nsIFrameLoader.h"
#include "nsINamed.h"
#include "nsIObserverService.h"
#include "StaticPtr.h"
#include "nsIMozBrowserFrame.h"
@ -226,6 +227,7 @@ class ParticularProcessPriorityManager final
: public WakeLockObserver
, public nsIObserver
, public nsITimerCallback
, public nsINamed
, public nsSupportsWeakReference
{
~ParticularProcessPriorityManager();
@ -274,6 +276,12 @@ public:
void ShutDown();
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("ParticularProcessPriorityManager");
return NS_OK;
}
private:
static uint32_t sBackgroundPerceivableGracePeriodMS;
static uint32_t sBackgroundGracePeriodMS;
@ -561,7 +569,8 @@ ProcessPriorityManagerImpl::TabActivityChanged(TabParent* aTabParent,
NS_IMPL_ISUPPORTS(ParticularProcessPriorityManager,
nsIObserver,
nsITimerCallback,
nsISupportsWeakReference);
nsISupportsWeakReference,
nsINamed);
ParticularProcessPriorityManager::ParticularProcessPriorityManager(
ContentParent* aContentParent)

View file

@ -3544,14 +3544,13 @@ TabChildGlobal::GetGlobalJSObject()
}
nsresult
TabChildGlobal::Dispatch(const char* aName,
TaskCategory aCategory,
TabChildGlobal::Dispatch(TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
if (mTabChild && mTabChild->TabGroup()) {
return mTabChild->TabGroup()->Dispatch(aName, aCategory, Move(aRunnable));
return mTabChild->TabGroup()->Dispatch(aCategory, Move(aRunnable));
}
return DispatcherTrait::Dispatch(aName, aCategory, Move(aRunnable));
return DispatcherTrait::Dispatch(aCategory, Move(aRunnable));
}
nsISerialEventTarget*

View file

@ -152,8 +152,7 @@ public:
}
// Dispatch a runnable related to the global.
virtual nsresult Dispatch(const char* aName,
mozilla::TaskCategory aCategory,
virtual nsresult Dispatch(mozilla::TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual nsISerialEventTarget*

View file

@ -173,6 +173,7 @@ TabParent::TabParent(nsIContentParent* aManager,
, mHasPresented(false)
, mHasBeforeUnload(false)
, mIsReadyToHandleInputEvents(false)
, mIsMouseEnterIntoWidgetEventSuppressed(false)
{
MOZ_ASSERT(aManager);
}
@ -1092,7 +1093,7 @@ TabParent::SendKeyEvent(const nsAString& aType,
void
TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
{
if (mIsDestroyed || !mIsReadyToHandleInputEvents) {
if (mIsDestroyed) {
return;
}
aEvent.mRefPoint += GetChildProcessOffset();
@ -1113,11 +1114,33 @@ TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
mTabSetsCursor = false;
}
}
if (!mIsReadyToHandleInputEvents) {
if (eMouseEnterIntoWidget == aEvent.mMessage) {
MOZ_ASSERT(!mIsMouseEnterIntoWidgetEventSuppressed);
mIsMouseEnterIntoWidgetEventSuppressed = true;
} else if (eMouseExitFromWidget == aEvent.mMessage) {
MOZ_ASSERT(mIsMouseEnterIntoWidgetEventSuppressed);
mIsMouseEnterIntoWidgetEventSuppressed = false;
}
return;
}
ScrollableLayerGuid guid;
uint64_t blockId;
ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
if (mIsMouseEnterIntoWidgetEventSuppressed) {
// In the case that the TabParent suppressed the eMouseEnterWidget event due
// to its corresponding TabChild wasn't ready to handle it, we have to
// resend it when the TabChild is ready.
mIsMouseEnterIntoWidgetEventSuppressed = false;
WidgetMouseEvent localEvent(aEvent);
localEvent.mMessage = eMouseEnterIntoWidget;
DebugOnly<bool> ret = SendRealMouseButtonEvent(localEvent, guid, blockId);
NS_WARNING_ASSERTION(ret, "SendRealMouseButtonEvent(eMouseEnterIntoWidget) failed");
MOZ_ASSERT(!ret || localEvent.HasBeenPostedToRemoteProcess());
}
if (eMouseMove == aEvent.mMessage) {
if (aEvent.mReason == WidgetMouseEvent::eSynthesized) {
DebugOnly<bool> ret = SendSynthMouseMoveEvent(aEvent, guid, blockId);

View file

@ -786,6 +786,11 @@ private:
// True when the remote browser is created and ready to handle input events.
bool mIsReadyToHandleInputEvents;
// True if we suppress the eMouseEnterIntoWidget event due to the TabChild was
// not ready to handle it. We will resend it when the next time we fire a
// mouse event and the TabChild is ready.
bool mIsMouseEnterIntoWidgetEventSuppressed;
public:
static TabParent* GetTabParentFromLayersId(uint64_t aLayersId);
};

View file

@ -187,7 +187,7 @@ Window_ContentWarning=window._content is deprecated. Please use window.content
SyncXMLHttpRequestWarning=Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end users experience. For more help http://xhr.spec.whatwg.org/
ImplicitMetaViewportTagFallback=No meta-viewport tag found. Please explicitly specify one to prevent unexpected behavioural changes in future versions. For more help https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag
# LOCALIZATION NOTE: Do not translate "window.controllers/Controllers"
Window_ControllersWarning=window.controllers/Controllers is deprecated. Do not use it for UA detection.
Window_Cc_ontrollersWarning=window.controllers/Controllers is deprecated. Do not use it for UA detection.
ImportXULIntoContentWarning=Importing XUL nodes into a content document is deprecated. This functionality may be removed soon.
XMLDocumentLoadPrincipalMismatch=Use of document.load forbidden on Documents that come from other Windows. Only the Window in which a Document was created is allowed to call .load on that Document. Preferably, use XMLHttpRequest instead.
# LOCALIZATION NOTE: Do not translate "IndexedDB".

View file

@ -826,12 +826,6 @@ DecoderDoctorDocumentWatcher::GetName(nsACString& aName)
return NS_OK;
}
NS_IMETHODIMP
DecoderDoctorDocumentWatcher::SetName(const char* aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
DecoderDoctorDiagnostics::StoreFormatDiagnostics(nsIDocument* aDocument,
const nsAString& aFormat,

View file

@ -206,8 +206,7 @@ FileBlockCache::Close()
// releasing memory etc!
nsCOMPtr<nsIRunnable> event =
new ShutdownThreadEvent(thread);
SystemGroup::Dispatch("ShutdownThreadEvent",
TaskCategory::Other,
SystemGroup::Dispatch(TaskCategory::Other,
event.forget());
}),
NS_DISPATCH_NORMAL);

View file

@ -1509,9 +1509,7 @@ MediaCache::QueueUpdate()
// shutdown and get freed in the final cycle-collector cleanup. So
// don't leak a runnable in that case.
nsCOMPtr<nsIRunnable> event = new UpdateEvent(this);
SystemGroup::Dispatch("MediaCache::UpdateEvent",
TaskCategory::Other,
event.forget());
SystemGroup::Dispatch(TaskCategory::Other, event.forget());
}
void

View file

@ -10,6 +10,7 @@
#include "mozilla/MediaManager.h"
#include "MediaTrackConstraints.h"
#include "nsIEventTarget.h"
#include "nsINamed.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPermissionManager.h"
#include "nsPIDOMWindow.h"
@ -20,7 +21,7 @@
namespace mozilla {
namespace dom {
class FuzzTimerCallBack final : public nsITimerCallback
class FuzzTimerCallBack final : public nsITimerCallback, public nsINamed
{
~FuzzTimerCallBack() {}
@ -35,11 +36,17 @@ public:
return NS_OK;
}
NS_IMETHOD GetName(nsACString& aName) override
{
aName.AssignLiteral("FuzzTimerCallBack");
return NS_OK;
}
private:
nsCOMPtr<MediaDevices> mMediaDevices;
};
NS_IMPL_ISUPPORTS(FuzzTimerCallBack, nsITimerCallback)
NS_IMPL_ISUPPORTS(FuzzTimerCallBack, nsITimerCallback, nsINamed)
class MediaDevices::GumResolver : public nsIDOMGetUserMediaSuccessCallback
{

View file

@ -117,7 +117,6 @@ GlobalAllocPolicy::GlobalAllocPolicy()
, mDecoderLimit(MediaPrefs::MediaDecoderLimit())
{
SystemGroup::Dispatch(
"GlobalAllocPolicy::ClearOnShutdown",
TaskCategory::Other,
NS_NewRunnableFunction("GlobalAllocPolicy::GlobalAllocPolicy", [this]() {
ClearOnShutdown(this, ShutdownPhase::ShutdownThreads);

View file

@ -6,7 +6,7 @@
#if !defined(MediaQueue_h_)
#define MediaQueue_h_
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/RecursiveMutex.h"
#include "mozilla/TaskQueue.h"
#include "nsDeque.h"
@ -29,7 +29,7 @@ class MediaQueue : private nsDeque {
public:
MediaQueue()
: nsDeque(new MediaQueueDeallocator<T>()),
mReentrantMonitor("mediaqueue"),
mRecursiveMutex("mediaqueue"),
mEndOfStream(false)
{}
@ -38,12 +38,12 @@ public:
}
inline size_t GetSize() const {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
return nsDeque::GetSize();
}
inline void Push(T* aItem) {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
MOZ_ASSERT(!mEndOfStream);
MOZ_ASSERT(aItem);
NS_ADDREF(aItem);
@ -53,7 +53,7 @@ public:
}
inline already_AddRefed<T> PopFront() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
RefPtr<T> rv = dont_AddRef(static_cast<T*>(nsDeque::PopFront()));
if (rv) {
mPopEvent.Notify(rv);
@ -62,12 +62,12 @@ public:
}
inline RefPtr<T> PeekFront() const {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
return static_cast<T*>(nsDeque::PeekFront());
}
void Reset() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
while (GetSize() > 0) {
RefPtr<T> x = dont_AddRef(static_cast<T*>(nsDeque::PopFront()));
}
@ -75,7 +75,7 @@ public:
}
bool AtEndOfStream() const {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
return GetSize() == 0 && mEndOfStream;
}
@ -83,13 +83,13 @@ public:
// This happens when the media stream has been completely decoded. Note this
// does not mean that the corresponding stream has finished playback.
bool IsFinished() const {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
return mEndOfStream;
}
// Informs the media queue that it won't be receiving any more items.
void Finish() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
if (!mEndOfStream) {
mEndOfStream = true;
mFinishEvent.Notify();
@ -98,7 +98,7 @@ public:
// Returns the approximate number of microseconds of items in the queue.
int64_t Duration() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
if (GetSize() == 0) {
return 0;
}
@ -108,14 +108,14 @@ public:
}
void LockedForEach(nsDequeFunctor& aFunctor) const {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
ForEach(aFunctor);
}
// Extracts elements from the queue into aResult, in order.
// Elements whose start time is before aTime are ignored.
void GetElementsAfter(int64_t aTime, nsTArray<RefPtr<T>>* aResult) {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
if (GetSize() == 0)
return;
size_t i;
@ -138,14 +138,14 @@ public:
}
void GetFirstElements(uint32_t aMaxElements, nsTArray<RefPtr<T>>* aResult) {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
for (size_t i = 0; i < aMaxElements && i < GetSize(); ++i) {
*aResult->AppendElement() = static_cast<T*>(ObjectAt(i));
}
}
uint32_t FrameCount() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
RecursiveMutexAutoLock lock(mRecursiveMutex);
uint32_t frames = 0;
for (size_t i = 0; i < GetSize(); ++i) {
T* v = static_cast<T*>(ObjectAt(i));
@ -167,7 +167,7 @@ public:
}
private:
mutable ReentrantMonitor mReentrantMonitor;
mutable RecursiveMutex mRecursiveMutex;
MediaEventProducer<RefPtr<T>> mPopEvent;
MediaEventProducer<RefPtr<T>> mPushEvent;
MediaEventProducer<void> mFinishEvent;

View file

@ -64,7 +64,6 @@ MediaResource::Destroy()
return;
}
nsresult rv = SystemGroup::Dispatch(
"MediaResource::Destroy",
TaskCategory::Other,
NewNonOwningRunnableMethod(
"MediaResource::Destroy", this, &MediaResource::Destroy));

View file

@ -1531,6 +1531,12 @@ MediaStreamGraphImpl::Notify(nsITimer* aTimer)
return NS_OK;
}
NS_IMETHODIMP
MediaStreamGraphImpl::GetName(nsACString& aName)
{
aName.AssignLiteral("MediaStreamGraphImpl");
return NS_OK;
}
/* static */ StaticRefPtr<nsIAsyncShutdownBlocker> gMediaStreamGraphShutdownBlocker;
@ -3623,7 +3629,8 @@ MediaStreamGraph::DestroyNonRealtimeInstance(MediaStreamGraph* aGraph)
graph->ForceShutDown(nullptr);
}
NS_IMPL_ISUPPORTS(MediaStreamGraphImpl, nsIMemoryReporter, nsITimerCallback)
NS_IMPL_ISUPPORTS(MediaStreamGraphImpl, nsIMemoryReporter, nsITimerCallback,
nsINamed)
NS_IMETHODIMP
MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,

View file

@ -14,6 +14,7 @@
#include "mozilla/Monitor.h"
#include "mozilla/TimeStamp.h"
#include "nsIMemoryReporter.h"
#include "nsINamed.h"
#include "nsIThread.h"
#include "nsIRunnable.h"
#include "nsIAsyncShutdown.h"
@ -99,12 +100,14 @@ public:
*/
class MediaStreamGraphImpl : public MediaStreamGraph,
public nsIMemoryReporter,
public nsITimerCallback
public nsITimerCallback,
public nsINamed
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSINAMED
/**
* Use aGraphDriverRequested with SYSTEM_THREAD_DRIVER or AUDIO_THREAD_DRIVER

View file

@ -337,7 +337,6 @@ TextTrack::DispatchAsyncTrustedEvent(const nsString& aEventName)
}
RefPtr<TextTrack> self = this;
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrack::DispatchAsyncTrustedEvent",
TaskCategory::Other,
NS_NewRunnableFunction(
"dom::TextTrack::DispatchAsyncTrustedEvent",

View file

@ -193,9 +193,7 @@ TextTrackList::CreateAndDispatchChangeEvent()
event->SetTrusted(true);
nsCOMPtr<nsIRunnable> eventRunner = new ChangeEventRunner(this, event);
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackList::CreateAndDispatchChangeEvent", TaskCategory::Other,
eventRunner.forget());
nsGlobalWindow::Cast(win)->Dispatch(TaskCategory::Other, eventRunner.forget());
}
}

View file

@ -341,6 +341,13 @@ SimpleTimer::Notify(nsITimer *timer) {
return NS_OK;
}
NS_IMETHODIMP
SimpleTimer::GetName(nsACString& aName)
{
aName.AssignLiteral("SimpleTimer");
return NS_OK;
}
nsresult
SimpleTimer::Init(nsIRunnable* aTask, uint32_t aTimeoutMs, nsIEventTarget* aTarget)
{
@ -378,7 +385,7 @@ SimpleTimer::Init(nsIRunnable* aTask, uint32_t aTimeoutMs, nsIEventTarget* aTarg
return NS_OK;
}
NS_IMPL_ISUPPORTS(SimpleTimer, nsITimerCallback)
NS_IMPL_ISUPPORTS(SimpleTimer, nsITimerCallback, nsINamed)
already_AddRefed<SimpleTimer>
SimpleTimer::Create(nsIRunnable* aTask, uint32_t aTimeoutMs, nsIEventTarget* aTarget)
@ -397,7 +404,7 @@ LogToBrowserConsole(const nsAString& aMsg)
nsString msg(aMsg);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction(
"LogToBrowserConsole", [msg]() { LogToBrowserConsole(msg); });
SystemGroup::Dispatch("LogToBrowserConsole", TaskCategory::Other, task.forget());
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
return;
}
nsCOMPtr<nsIConsoleService> console(

View file

@ -20,6 +20,7 @@
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsINamed.h"
#include "nsIThread.h"
#include "nsITimer.h"
#include "nsRect.h"
@ -284,10 +285,11 @@ RefPtr<GenericPromise> InvokeUntil(Work aWork, Condition aCondition) {
}
// Simple timer to run a runnable after a timeout.
class SimpleTimer : public nsITimerCallback
class SimpleTimer : public nsITimerCallback, public nsINamed
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSINAMED
// Create a new timer to run aTask after aTimeoutMs milliseconds
// on thread aTarget. If aTarget is null, task is run on the main thread.

Some files were not shown because too many files have changed in this diff Show more