Merge mozilla-central to autoland

This commit is contained in:
Dorel Luca 2018-05-23 13:03:24 +03:00
commit dbe91ea7b6
807 changed files with 43617 additions and 18181 deletions

View File

@ -98,9 +98,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContent, mDoc)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Accessible)
if (aIID.Equals(NS_GET_IID(Accessible)))
foundInterface = this;
else
NS_INTERFACE_MAP_ENTRY_CONCRETE(Accessible)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, Accessible)
NS_INTERFACE_MAP_END

View File

@ -1248,8 +1248,12 @@ toolbarpaletteitem[dragover] {
display: -moz-box;
}
toolbarpaletteitem {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbarpaletteitem");
}
toolbarpaletteitem[place="palette"] {
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem-palette-wrapping-label");
-moz-box-orient: vertical;
width: 7em;
/* icon (16) + margin (9 + 12) + 3 lines of text: */
height: calc(39px + 3em);
@ -1260,16 +1264,21 @@ toolbarpaletteitem[place="palette"] {
vertical-align: top;
}
toolbarpaletteitem:not([place="palette"]) > .toolbarpaletteitem-label,
toolbarpaletteitem[place="palette"][hidden] {
display: none;
}
#customization-palette .toolbarpaletteitem-box {
toolbarpaletteitem[place="palette"] > .toolbarpaletteitem-box {
-moz-box-pack: center;
width: 7em;
max-width: 7em;
}
toolbarpaletteitem:not([place="palette"]) > .toolbarpaletteitem-box {
-moz-box-flex: 1;
}
#main-window[customizing=true] .addon-banner-item,
#main-window[customizing=true] .panel-banner-item {
display: none;

View File

@ -153,9 +153,11 @@ var whitelist = [
{file: "resource://gre/modules/PerformanceWatcher.jsm"},
// Bug 1378173 (warning: still used by devtools)
{file: "resource://gre/modules/Promise.jsm"},
// Still used by WebIDE, which is going away but not entirely gone.
{file: "resource://gre/modules/ZipUtils.jsm"},
// Bug 1463225 (on Mac this is only used by a test)
{file: "chrome://global/content/bindings/toolbar.xml",
platforms: ["macosx"]},
];
whitelist = new Set(whitelist.filter(item =>

View File

@ -819,9 +819,7 @@ CustomizeMode.prototype = {
aPlace = wrapper.getAttribute("place");
} else {
wrapper = this.document.createElement("toolbarpaletteitem");
// "place" is used by toolkit to add the toolbarpaletteitem-palette
// binding to a toolbarpaletteitem, which gives it a label node for when
// it's sitting in the palette.
// "place" is used to show the label when it's sitting in the palette.
wrapper.setAttribute("place", aPlace);
}

View File

@ -322,4 +322,13 @@
]]></constructor>
</implementation>
</binding>
<binding id="toolbarpaletteitem">
<content>
<xul:hbox class="toolbarpaletteitem-box">
<children/>
</xul:hbox>
<xul:label class="toolbarpaletteitem-label" xbl:inherits="xbl:text=title"/>
</content>
</binding>
</bindings>

View File

@ -248,7 +248,7 @@ FirefoxProfileMigrator.prototype._getResourcesInternal = function(sourceProfileD
let dest = createSubDir("datareporting");
let enumerator = dataReportingDir.directoryEntries;
while (enumerator.hasMoreElements()) {
let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
let file = enumerator.nextFile;
if (file.isDirectory() || !toCopy.includes(file.leafName)) {
continue;
}

View File

@ -291,8 +291,7 @@ function getEdgeLocalDataFolder() {
// Let's try the long way:
let dirEntries = packages.directoryEntries;
while (dirEntries.hasMoreElements()) {
let subDir = dirEntries.getNext();
subDir.QueryInterface(Ci.nsIFile);
let subDir = dirEntries.nextFile;
if (subDir.leafName.startsWith("Microsoft.MicrosoftEdge") && subDir.isReadable() &&
subDir.isDirectory()) {
gEdgeDir = subDir;
@ -388,7 +387,7 @@ Bookmarks.prototype = {
let entries = aSourceFolder.directoryEntries;
let rv = [];
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
let entry = entries.nextFile;
try {
// Make sure that entry.path == entry.target to not follow .lnk folder
// shortcuts which could lead to infinite cycles.
@ -509,7 +508,7 @@ Cookies.prototype = {
for (let folder of folders) {
let entries = folder.directoryEntries;
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
let entry = entries.nextFile;
// Skip eventual bogus entries.
if (!entry.isFile() || !/\.(cookie|txt)$/.test(entry.leafName))
continue;

View File

@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#handlersView > richlistitem {
-moz-binding: url("chrome://browser/content/preferences/handlers.xml#handler");
}
#containersView > richlistitem {
-moz-binding: none;
}

View File

@ -1,59 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- import-globals-from in-content/main.js -->
<bindings id="handlerBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="handler" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation>
<property name="type" readonly="true">
<getter>
return this.getAttribute("type");
</getter>
</property>
<!-- Overriding listitem -->
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
<setter><![CDATA[
if (val) {
this.setAttribute("selected", "true");
gMainPane.rebuildActionsMenu();
} else {
this.removeAttribute("selected");
}
document.getAnonymousElementByAttribute(this, "anonid", "selected").setAttribute("hidden", !val);
document.getAnonymousElementByAttribute(this, "anonid", "not-selected").setAttribute("hidden", !!val);
return val;
]]></setter>
</property>
</implementation>
<content>
<xul:hbox flex="1" equalsize="always">
<xul:hbox flex="1" align="center" xbl:inherits="tooltiptext=typeDescription">
<xul:image src="moz-icon://goat?size=16" class="typeIcon"
xbl:inherits="src=typeIcon" height="16" width="16"/>
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
</xul:hbox>
<xul:hbox anonid="not-selected" flex="1" align="center" xbl:inherits="tooltiptext=actionDescription">
<xul:image xbl:inherits="src=actionIcon" height="16" width="16" class="actionIcon"/>
<xul:label flex="1" crop="end" xbl:inherits="value=actionDescription"/>
</xul:hbox>
<xul:hbox hidden="true" anonid="selected" flex="1">
<xul:menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1"
xbl:inherits="tooltiptext=actionDescription"
oncommand="gMainPane.onSelectAction(event.originalTarget)">
<xul:menupopup/>
</xul:menulist>
</xul:hbox>
</xul:hbox>
</content>
</binding>
</bindings>

View File

@ -583,6 +583,7 @@ var gMainPane = {
// of the preferences page.
window.addEventListener("pageshow", async () => {
try {
this._initListEventHandlers();
this._loadData();
await this._rebuildVisibleTypes();
this._sortVisibleTypes();
@ -1448,6 +1449,31 @@ var gMainPane = {
// View Construction
selectedHandlerListItem: null,
_initListEventHandlers() {
this._list.addEventListener("select", event => {
if (event.target != this._list) {
return;
}
let handlerListItem = this._list.selectedItem &&
HandlerListItem.forNode(this._list.selectedItem);
if (this.selectedHandlerListItem == handlerListItem) {
return;
}
if (this.selectedHandlerListItem) {
this.selectedHandlerListItem.showActionsMenu = false;
}
this.selectedHandlerListItem = handlerListItem;
if (handlerListItem) {
this.rebuildActionsMenu();
handlerListItem.showActionsMenu = true;
}
});
},
async _rebuildVisibleTypes() {
this._visibleTypes = [];
@ -1506,8 +1532,9 @@ var gMainPane = {
},
_rebuildView() {
let lastSelectedType = this._list.selectedItem &&
HandlerListItem.forNode(this._list.selectedItem).handlerInfoWrapper.type;
let lastSelectedType = this.selectedHandlerListItem &&
this.selectedHandlerListItem.handlerInfoWrapper.type;
this.selectedHandlerListItem = null;
// Clear the list of entries.
while (this._list.childNodes.length > 1)
@ -1521,7 +1548,7 @@ var gMainPane = {
for (let visibleType of visibleTypes) {
let item = new HandlerListItem(visibleType);
this._list.appendChild(item.node);
item.connectAndAppendToList(this._list);
if (visibleType.type === lastSelectedType) {
this._list.selectedItem = item.node;
@ -1585,9 +1612,8 @@ var gMainPane = {
*/
rebuildActionsMenu() {
var typeItem = this._list.selectedItem;
var handlerInfo = this._handledTypes[typeItem.type];
var menu =
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
var handlerInfo = this.selectedHandlerListItem.handlerInfoWrapper;
var menu = typeItem.querySelector(".actionsMenu");
var menuPopup = menu.menupopup;
// Clear out existing items.
@ -1699,7 +1725,7 @@ var gMainPane = {
if (Cc["@mozilla.org/gio-service;1"]) {
let gIOSvc = Cc["@mozilla.org/gio-service;1"].
getService(Ci.nsIGIOService);
var gioApps = gIOSvc.getAppsForURIScheme(typeItem.type);
var gioApps = gIOSvc.getAppsForURIScheme(handlerInfo.type);
let enumerator = gioApps.enumerate();
let possibleHandlers = handlerInfo.possibleApplicationHandlers;
while (enumerator.hasMoreElements()) {
@ -1906,8 +1932,7 @@ var gMainPane = {
},
_storeAction(aActionItem) {
var typeItem = this._list.selectedItem;
var handlerInfo = this._handledTypes[typeItem.type];
var handlerInfo = this.selectedHandlerListItem.handlerInfoWrapper;
let action = parseInt(aActionItem.getAttribute("action"));
@ -1942,7 +1967,7 @@ var gMainPane = {
handlerInfo.handledOnlyByPlugin = false;
// Update the action label and image to reflect the new preferred action.
HandlerListItem.forNode(typeItem).refreshAction();
this.selectedHandlerListItem.refreshAction();
},
manageApp(aEvent) {
@ -1950,8 +1975,7 @@ var gMainPane = {
// as we handle it specially ourselves.
aEvent.stopPropagation();
var typeItem = this._list.selectedItem;
var handlerInfo = this._handledTypes[typeItem.type];
var handlerInfo = this.selectedHandlerListItem.handlerInfoWrapper;
let onComplete = () => {
// Rebuild the actions menu so that we revert to the previous selection,
@ -1959,7 +1983,7 @@ var gMainPane = {
this.rebuildActionsMenu();
// update the richlistitem too. Will be visible when selecting another row
HandlerListItem.forNode(typeItem).refreshAction();
this.selectedHandlerListItem.refreshAction();
};
gSubDialog.open("chrome://browser/content/preferences/applicationManager.xul",
@ -1982,8 +2006,7 @@ var gMainPane = {
// If the user picked a new app from the menu, select it.
if (aHandlerApp) {
let typeItem = this._list.selectedItem;
let actionsMenu =
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
let actionsMenu = typeItem.querySelector(".actionsMenu");
let menuItems = actionsMenu.menupopup.childNodes;
for (let i = 0; i < menuItems.length; i++) {
let menuItem = menuItems[i];
@ -1998,7 +2021,7 @@ var gMainPane = {
if (AppConstants.platform == "win") {
var params = {};
var handlerInfo = this._handledTypes[this._list.selectedItem.type];
var handlerInfo = this.selectedHandlerListItem.handlerInfoWrapper;
if (isFeedType(handlerInfo.type)) {
// MIME info will be null, create a temp object.
@ -2038,7 +2061,7 @@ var gMainPane = {
handlerApp.executable = fp.file;
// Add the app to the type's list of possible handlers.
let handler = this._handledTypes[this._list.selectedItem.type];
let handler = this.selectedHandlerListItem.handlerInfoWrapper;
handler.addPossibleApplicationHandler(handlerApp);
chooseAppCallback(handlerApp);
@ -2427,6 +2450,28 @@ function isFeedType(t) {
return t == TYPE_MAYBE_FEED || t == TYPE_MAYBE_VIDEO_FEED || t == TYPE_MAYBE_AUDIO_FEED;
}
// eslint-disable-next-line no-undef
let gHandlerListItemFragment = MozXULElement.parseXULToFragment(`
<richlistitem>
<hbox flex="1" equalsize="always">
<hbox class="typeContainer" flex="1" align="center">
<image class="typeIcon" width="16" height="16"
src="moz-icon://goat?size=16"/>
<label class="typeDescription" flex="1" crop="end"/>
</hbox>
<hbox class="actionContainer" flex="1" align="center">
<image class="actionIcon" width="16" height="16"/>
<label class="actionDescription" flex="1" crop="end"/>
</hbox>
<hbox class="actionsMenuContainer" flex="1">
<menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1">
<menupopup/>
</menulist>
</hbox>
</hbox>
</richlistitem>
`);
/**
* This is associated to <richlistitem> elements in the handlers view.
*/
@ -2437,32 +2482,54 @@ class HandlerListItem {
constructor(handlerInfoWrapper) {
this.handlerInfoWrapper = handlerInfoWrapper;
this.node = document.createElement("richlistitem");
}
setOrRemoveAttributes(iterable) {
for (let [selector, name, value] of iterable) {
let node = selector ? this.node.querySelector(selector) : this.node;
if (value) {
node.setAttribute(name, value);
} else {
node.removeAttribute(name);
}
}
}
connectAndAppendToList(list) {
list.appendChild(document.importNode(gHandlerListItemFragment, true));
this.node = list.lastChild;
gNodeToObjectMap.set(this.node, this);
this.node.setAttribute("type", this.handlerInfoWrapper.type);
this.node.setAttribute("typeDescription",
this.handlerInfoWrapper.typeDescription);
if (this.handlerInfoWrapper.smallIcon) {
this.node.setAttribute("typeIcon", this.handlerInfoWrapper.smallIcon);
} else {
this.node.removeAttribute("typeIcon");
}
this.node.querySelector(".actionsMenu").addEventListener("command",
event => gMainPane.onSelectAction(event.originalTarget));
let typeDescription = this.handlerInfoWrapper.typeDescription;
this.setOrRemoveAttributes([
[null, "type", this.handlerInfoWrapper.type],
[".typeContainer", "tooltiptext", typeDescription],
[".typeDescription", "value", typeDescription],
[".typeIcon", "src", this.handlerInfoWrapper.smallIcon],
]);
this.refreshAction();
this.showActionsMenu = false;
}
refreshAction() {
this.node.setAttribute("actionDescription",
this.handlerInfoWrapper.actionDescription);
if (this.handlerInfoWrapper.actionIconClass) {
this.node.setAttribute(APP_ICON_ATTR_NAME,
this.handlerInfoWrapper.actionIconClass);
this.node.removeAttribute("actionIcon");
} else {
this.node.removeAttribute(APP_ICON_ATTR_NAME);
this.node.setAttribute("actionIcon", this.handlerInfoWrapper.actionIcon);
}
let { actionIconClass, actionDescription } = this.handlerInfoWrapper;
this.setOrRemoveAttributes([
[null, APP_ICON_ATTR_NAME, actionIconClass],
[".actionContainer", "tooltiptext", actionDescription],
[".actionDescription", "value", actionDescription],
[".actionIcon", "src", actionIconClass ? null :
this.handlerInfoWrapper.actionIcon],
]);
}
set showActionsMenu(value) {
this.setOrRemoveAttributes([
[".actionContainer", "hidden", value],
[".actionsMenuContainer", "hidden", !value],
]);
}
}

View File

@ -16,7 +16,6 @@ browser.jar:
content/browser/preferences/connection.js
content/browser/preferences/fonts.xul
content/browser/preferences/fonts.js
content/browser/preferences/handlers.xml
content/browser/preferences/handlers.css
content/browser/preferences/languages.xul
content/browser/preferences/languages.js

View File

@ -2848,7 +2848,7 @@ dump(`callFromJSON: < ${JSON.stringify(call)}\n`);
let entries = [];
let enumerator = directory.directoryEntries;
while (enumerator.hasMoreElements()) {
let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
let file = enumerator.nextFile;
entries.push({ name: file.leafName, is_dir: file.isDirectory() });
}
return [PP_OK, { contents: { count: entries.length, entries } }];

View File

@ -42,7 +42,7 @@ function clearPendingCrashReports() {
let entries = dir.directoryEntries;
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
let entry = entries.nextFile;
if (entry.isFile()) {
entry.remove(false);
}

View File

@ -461,6 +461,23 @@ BasePrincipal::CloneStrippingUserContextIdAndFirstPartyDomain()
return BasePrincipal::CreateCodebasePrincipal(uri, attrs);
}
extensions::WebExtensionPolicy*
BasePrincipal::ContentScriptAddonPolicy()
{
if (!Is<ExpandedPrincipal>()) {
return nullptr;
}
auto expanded = As<ExpandedPrincipal>();
for (auto& prin : expanded->WhiteList()) {
if (auto policy = BasePrincipal::Cast(prin)->AddonPolicy()) {
return policy;
}
}
return nullptr;
}
bool
BasePrincipal::AddonAllowsLoad(nsIURI* aURI, bool aExplicit /* = false */)
{

View File

@ -113,6 +113,10 @@ public:
already_AddRefed<BasePrincipal> CloneStrippingUserContextIdAndFirstPartyDomain();
// If this is an add-on content script principal, returns its AddonPolicy.
// Otherwise returns null.
extensions::WebExtensionPolicy* ContentScriptAddonPolicy();
// Helper to check whether this principal is associated with an addon that
// allows unprivileged code to load aURI. aExplicit == true will prevent
// use of all_urls permission, requiring the domain in its permissions.

View File

@ -1270,11 +1270,6 @@ if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
'libsn/sn-util.h',
]
if CONFIG['MOZ_SYSTEM_HUNSPELL']:
system_headers += [
'hunspell.hxx',
]
if CONFIG['MOZ_SYSTEM_LIBEVENT']:
system_headers += [
'event2/event_compat.h',

View File

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 56
Version 57
Comparison: https://github.com/devtools-html/debugger.html/compare/release-55...release-56
Comparison: https://github.com/devtools-html/debugger.html/compare/release-56...release-57
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

View File

@ -7975,11 +7975,12 @@ class Tree extends Component {
return;
}
const { explicitOriginalTarget } = nativeEvent;
const { relatedTarget } = nativeEvent;
// Only set default focus to the first tree node if the focus came
// from outside the tree (e.g. by tabbing to the tree from other
// external elements).
if (explicitOriginalTarget !== this.treeRef && !this.treeRef.contains(explicitOriginalTarget)) {
if (relatedTarget !== this.treeRef && !this.treeRef.contains(relatedTarget)) {
this._focus(traversal[0].item);
}
},
@ -8044,13 +8045,6 @@ module.exports = "<!-- This Source Code Form is subject to the terms of the Mozi
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isDevelopment = isDevelopment;
exports.isTesting = isTesting;
exports.isFirefoxPanel = isFirefoxPanel;
exports.isFirefox = isFirefox;
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
@ -8066,7 +8060,7 @@ function isNode() {
}
function isDevelopment() {
if (!isNode && isBrowser()) {
if (!isNode() && isBrowser()) {
const href = window.location ? window.location.href : "";
return href.match(/^file:/) || href.match(/localhost:/);
}
@ -8086,6 +8080,13 @@ function isFirefox() {
return (/firefox/i.test(navigator.userAgent)
);
}
module.exports = {
isDevelopment,
isTesting,
isFirefoxPanel,
isFirefox
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(120)))
/***/ }),

View File

@ -149,8 +149,7 @@ class SourceFooter extends _react.PureComponent {
} = this.props;
if (mappedSource) {
const bundleSource = mappedSource.toJS();
const filename = (0, _source.getFilename)(bundleSource);
const filename = (0, _source.getFilename)(mappedSource);
const tooltip = L10N.getFormatStr("sourceFooter.mappedSourceTooltip", filename);
const title = L10N.getFormatStr("sourceFooter.mappedSource", filename);
const mappedSourceLocation = {

View File

@ -137,8 +137,7 @@ class Tab extends _react.PureComponent {
closeTab,
source
} = this.props;
const src = source.toJS();
const filename = (0, _source.getFilename)(src);
const filename = (0, _source.getFilename)(source);
const sourceId = source.id;
const active = selectedSource && sourceId == selectedSource.get("id") && !this.isProjectSearchEnabled() && !this.isSourceSearchEnabled();
const isPrettyCode = (0, _source.isPretty)(source);
@ -168,7 +167,7 @@ class Tab extends _react.PureComponent {
key: sourceId,
onMouseUp: handleTabClick,
onContextMenu: e => this.onTabContextMenu(e, sourceId),
title: (0, _source.getFileURL)(src)
title: (0, _source.getFileURL)(source)
}, _react2.default.createElement(_SourceIcon2.default, {
source: source,
shouldHide: icon => ["file", "javascript"].includes(icon)

View File

@ -71,19 +71,19 @@ class Tabs extends _react.PureComponent {
});
};
this.renderDropdownSource = source => {
this.renderDropdownSource = sourceRecord => {
const {
selectSpecificSource
} = this.props;
const filename = (0, _source.getFilename)(source.toJS());
const filename = (0, _source.getFilename)(sourceRecord);
const onClick = () => selectSpecificSource(source.id);
const onClick = () => selectSpecificSource(sourceRecord.id);
return _react2.default.createElement("li", {
key: source.id,
key: sourceRecord.id,
onClick: onClick
}, _react2.default.createElement("img", {
className: `dropdown-icon ${this.getIconClass(source)}`
className: `dropdown-icon ${this.getIconClass(sourceRecord)}`
}), filename);
};
@ -122,12 +122,12 @@ class Tabs extends _react.PureComponent {
}));
}
getIconClass(source) {
if ((0, _source.isPretty)(source)) {
getIconClass(sourceRecord) {
if ((0, _source.isPretty)(sourceRecord)) {
return "prettyPrint";
}
if (source.isBlackBoxed) {
if (sourceRecord.isBlackBoxed) {
return "blackBox";
}

View File

@ -631,7 +631,7 @@ const mapStateToProps = state => {
hitCount: (0, _selectors.getHitCountForSource)(state, sourceId),
coverageOn: (0, _selectors.getCoverageEnabled)(state),
conditionalPanelLine: (0, _selectors.getConditionalPanelLine)(state),
symbols: (0, _selectors.getSymbols)(state, selectedSource && selectedSource.toJS())
symbols: (0, _selectors.getSymbols)(state, selectedSource)
};
};

View File

@ -140,7 +140,7 @@ class Breakpoints extends _react.Component {
pauseOnExceptions
} = this.props;
const isEmpty = breakpoints.size == 0;
const exceptionsBox = createExceptionOption(L10N.getStr("pauseOnExceptionsItem"), shouldPauseOnExceptions, () => pauseOnExceptions(!shouldPauseOnExceptions, false), "breakpoints-exceptions");
const exceptionsBox = createExceptionOption(L10N.getStr("pauseOnExceptionsItem2"), shouldPauseOnExceptions, () => pauseOnExceptions(!shouldPauseOnExceptions, false), "breakpoints-exceptions");
const ignoreCaughtBox = createExceptionOption(L10N.getStr("pauseOnCaughtExceptionsItem"), shouldPauseOnCaughtExceptions, () => pauseOnExceptions(true, !shouldPauseOnCaughtExceptions), "breakpoints-exceptions-caught");
return _react2.default.createElement("div", {
className: (0, _classnames2.default)("breakpoints-exceptions-options", {

View File

@ -180,8 +180,10 @@ class CommandBar extends _react.Component {
const isDisabled = !isPaused;
return [(0, _CommandBarButton.debugBtn)(this.props.rewind, "rewind", "active", "Rewind Execution"), (0, _CommandBarButton.debugBtn)(() => this.props.resume, "resume", "active", L10N.getFormatStr("resumeButtonTooltip", formatKey("resume"))), _react2.default.createElement("div", {
key: "divider-1",
className: "divider"
}), (0, _CommandBarButton.debugBtn)(this.props.reverseStepOver, "reverseStepOver", "active", "Reverse step over"), (0, _CommandBarButton.debugBtn)(this.props.stepOver, "stepOver", "active", L10N.getFormatStr("stepOverTooltip", formatKey("stepOver")), isDisabled), _react2.default.createElement("div", {
key: "divider-2",
className: "divider"
}), (0, _CommandBarButton.debugBtn)(this.props.stepOut, "stepOut", "active", L10N.getFormatStr("stepOutTooltip", formatKey("stepOut")), isDisabled), (0, _CommandBarButton.debugBtn)(this.props.stepIn, "stepIn", "active", L10N.getFormatStr("stepInTooltip", formatKey("stepIn")), isDisabled)];
}

View File

@ -423,6 +423,11 @@ function getTextAtPosition(source, location) {
const line = location.line;
const column = location.column || 0;
if (source.isWasm) {
return "";
}
const lineText = source.text.split("\n")[line - 1];
if (!lineText) {

View File

@ -534,7 +534,7 @@ uses-unsafe-cpows = true
skip-if = e10s && debug
[browser_dbg_variables-view-popup-09.js]
uses-unsafe-cpows = true
skip-if = e10s && debug
skip-if = (e10s && debug) || (os == "mac" || (os == "linux" && bits == 64)) # bug 1373127 for frequent timeouts
[browser_dbg_variables-view-popup-10.js]
uses-unsafe-cpows = true
skip-if = e10s && debug

View File

@ -821,7 +821,7 @@ CssRuleView.prototype = {
return promise.resolve(undefined);
}
if (this.popup.isOpen) {
if (this._popup && this.popup.isOpen) {
this.popup.hidePopup();
}

View File

@ -97,9 +97,9 @@ ignoreExceptionsItem=Ignore exceptions
# item shown when a user is adding a new breakpoint.
pauseOnUncaughtExceptionsItem=Pause on uncaught exceptions
# LOCALIZATION NOTE (pauseOnExceptionsItem): The pause on exceptions checkbox description
# LOCALIZATION NOTE (pauseOnExceptionsItem2): The pause on exceptions checkbox description
# when the debugger will pause on all exceptions.
pauseOnExceptionsItem=Pause on exceptions
pauseOnExceptionsItem2=Pause on exceptions
# LOCALIZATION NOTE (ignoreCaughtExceptionsItem): The pause on exceptions checkbox description
# when the debugger will not pause on any caught exception

View File

@ -4442,11 +4442,12 @@ class Tree extends Component {
return;
}
const { explicitOriginalTarget } = nativeEvent;
const { relatedTarget } = nativeEvent;
// Only set default focus to the first tree node if the focus came
// from outside the tree (e.g. by tabbing to the tree from other
// external elements).
if (explicitOriginalTarget !== this.treeRef && !this.treeRef.contains(explicitOriginalTarget)) {
if (relatedTarget !== this.treeRef && !this.treeRef.contains(relatedTarget)) {
this._focus(traversal[0].item);
}
},

View File

@ -606,12 +606,6 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
case EVENT_STATE_CHANGE:
let { state, isEnabled } = event.QueryInterface(nsIAccessibleStateChangeEvent);
let isBusy = state & Ci.nsIAccessibleStates.STATE_BUSY;
// Accessible document is recreated.
if (isBusy && !isEnabled && rawAccessible instanceof Ci.nsIAccessibleDocument) {
// Remove its existing cache from tree.
this.purgeSubtree(rawAccessible, event.DOMNode);
}
if (accessible) {
// Only propagate state change events for active accessibles.
if (isBusy && isEnabled) {

View File

@ -1150,7 +1150,7 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
let displayPixelRatio = getDisplayPixelRatio(this.win);
let { devicePixelRatio } = this.win;
let offset = (displayPixelRatio / 2) % 1;
let fontSize = GRID_FONT_SIZE * displayPixelRatio;
let fontSize = GRID_FONT_SIZE * devicePixelRatio;
let canvasX = Math.round(this._canvasPosition.x * devicePixelRatio);
let canvasY = Math.round(this._canvasPosition.y * devicePixelRatio);
@ -1174,8 +1174,8 @@ class CssGridHighlighter extends AutoRefreshHighlighter {
let textWidth = Math.max(textHeight, this.ctx.measureText(lineNumber).width);
// Padding in pixels for the line number text inside of the line number container.
let padding = 3 * displayPixelRatio;
let offsetFromEdge = 2 * displayPixelRatio;
let padding = 3 * devicePixelRatio;
let offsetFromEdge = 2 * devicePixelRatio;
let boxWidth = textWidth + 2 * padding;
let boxHeight = textHeight + 2 * padding;

View File

@ -1874,26 +1874,15 @@ Client::GetUsageForOrigin(PersistenceType aPersistenceType,
DebugOnly<bool> exists;
MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
hasMore && !aCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
if (NS_WARN_IF(!file)) {
return NS_NOINTERFACE;
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) &&
file && !aCanceled) {
int64_t fileSize;
rv = file->GetFileSize(&fileSize);
if (NS_WARN_IF(NS_FAILED(rv))) {

View File

@ -95,6 +95,7 @@ custom JS_wasm uses WebAssembly
method console.assert
method console.clear
method console.count
method console.countReset
method console.debug
method console.error
method console.info

View File

@ -154,11 +154,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
if (aIID.Equals(NS_GET_IID(nsFrameLoader))) {
// We want to end up with a pointer that can then be reinterpret_cast
// from nsISupports* to nsFrameLoader* and end up with |this|.
foundInterface = reinterpret_cast<nsISupports*>(this);
} else
NS_INTERFACE_MAP_ENTRY_CONCRETE(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END

View File

@ -1334,15 +1334,9 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindowInner)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowInner))) {
foundInterface = static_cast<nsPIDOMWindowInner*>(this);
} else
if (aIID.Equals(NS_GET_IID(mozIDOMWindow))) {
foundInterface = static_cast<mozIDOMWindow*>(this);
} else
if (aIID.Equals(NS_GET_IID(nsIDOMChromeWindow)) && IsChromeWindow()) {
foundInterface = static_cast<nsIDOMChromeWindow*>(this);
} else
NS_INTERFACE_MAP_ENTRY(nsPIDOMWindowInner)
NS_INTERFACE_MAP_ENTRY(mozIDOMWindow)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMChromeWindow, IsChromeWindow())
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_END

View File

@ -1088,15 +1088,9 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindowOuter)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
foundInterface = static_cast<nsPIDOMWindowOuter*>(this);
} else
if (aIID.Equals(NS_GET_IID(mozIDOMWindowProxy))) {
foundInterface = static_cast<mozIDOMWindowProxy*>(this);
} else
if (aIID.Equals(NS_GET_IID(nsIDOMChromeWindow)) && IsChromeWindow()) {
foundInterface = static_cast<nsIDOMChromeWindow*>(this);
} else
NS_INTERFACE_MAP_ENTRY(nsPIDOMWindowOuter)
NS_INTERFACE_MAP_ENTRY(mozIDOMWindowProxy)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMChromeWindow, IsChromeWindow())
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_END

View File

@ -144,7 +144,7 @@ DOMInterfaces = {
},
'ConsoleInstance': {
'implicitJSContext': ['clear', 'count', 'groupEnd', 'time', 'timeEnd'],
'implicitJSContext': ['clear', 'count', 'countReset', 'groupEnd', 'time', 'timeEnd'],
},
'ContentProcessMessageManager': {

View File

@ -450,19 +450,13 @@ BodyDeleteOrphanedFiles(const QuotaInfo& aQuotaInfo, nsIFile* aBaseDir,
rv = dir->Append(NS_LITERAL_STRING("morgue"));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = dir->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
// Iterate over all the intermediate morgue subdirs
bool hasMore = false;
while (NS_SUCCEEDED(rv = entries->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsIFile> subdir = do_QueryInterface(entry);
nsCOMPtr<nsIFile> subdir;
while (NS_SUCCEEDED(rv = entries->GetNextFile(getter_AddRefs(subdir))) && subdir) {
bool isDir = false;
rv = subdir->IsDirectory(&isDir);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
@ -474,20 +468,14 @@ BodyDeleteOrphanedFiles(const QuotaInfo& aQuotaInfo, nsIFile* aBaseDir,
continue;
}
nsCOMPtr<nsISimpleEnumerator> subEntries;
nsCOMPtr<nsIDirectoryEnumerator> subEntries;
rv = subdir->GetDirectoryEntries(getter_AddRefs(subEntries));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
// Now iterate over all the files in the subdir
bool subHasMore = false;
while(NS_SUCCEEDED(rv = subEntries->HasMoreElements(&subHasMore)) &&
subHasMore) {
nsCOMPtr<nsISupports> subEntry;
rv = subEntries->GetNext(getter_AddRefs(subEntry));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsIFile> file = do_QueryInterface(subEntry);
nsCOMPtr<nsIFile> file;
while(NS_SUCCEEDED(rv = subEntries->GetNextFile(getter_AddRefs(file))) &&
file) {
nsAutoCString leafName;
rv = file->GetNativeLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
@ -625,19 +613,12 @@ RemoveNsIFileRecursively(const QuotaInfo& aQuotaInfo, nsIFile* aFile)
// Unfortunately, we need to traverse all the entries and delete files one by
// one to update their usages to the QuotaManager.
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
bool hasMore = false;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
rv = RemoveNsIFileRecursively(aQuotaInfo, file);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
}

View File

@ -39,19 +39,13 @@ GetBodyUsage(nsIFile* aDir, const Atomic<bool>& aCanceled,
{
AssertIsOnIOThread();
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv = aDir->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
bool hasMore;
while (NS_SUCCEEDED(rv = entries->HasMoreElements(&hasMore)) && hasMore &&
!aCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED(rv = entries->GetNextFile(getter_AddRefs(file))) &&
file && !aCanceled) {
bool isDir;
rv = file->IsDirectory(&isDir);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
@ -187,19 +181,13 @@ public:
aUsageInfo->AppendToFileUsage(paddingSize);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = dir->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
bool hasMore;
while (NS_SUCCEEDED(rv = entries->HasMoreElements(&hasMore)) && hasMore &&
!aCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED(rv = entries->GetNextFile(getter_AddRefs(file))) &&
file && !aCanceled) {
nsAutoString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }

View File

@ -19,7 +19,7 @@ function enumerate_tree(entryList) {
if (file.isDirectory()) {
var dirList = file.directoryEntries;
while (dirList.hasMoreElements()) {
var dirFile = dirList.getNext().QueryInterface(Ci.nsIFile);
var dirFile = dirList.nextFile;
entryList.push({ path: path + '/' + dirFile.leafName, file: dirFile });
}
}

View File

@ -4665,7 +4665,9 @@ CanvasRenderingContext2D::LineDashOffset() const {
}
bool
CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, double aX, double aY, const CanvasWindingRule& aWinding)
CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, double aX, double aY,
const CanvasWindingRule& aWinding,
nsIPrincipal& aSubjectPrincipal)
{
if (!FloatValidate(aX, aY)) {
return false;
@ -4674,7 +4676,7 @@ CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, double aX, double aY, co
// Check for site-specific permission and return false if no permission.
if (mCanvasElement) {
nsCOMPtr<nsIDocument> ownerDoc = mCanvasElement->OwnerDoc();
if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) {
if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx, aSubjectPrincipal)) {
return false;
}
}
@ -4691,7 +4693,11 @@ CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, double aX, double aY, co
return mPath->ContainsPoint(Point(aX, aY), mTarget->GetTransform());
}
bool CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, const CanvasPath& aPath, double aX, double aY, const CanvasWindingRule& aWinding)
bool
CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, const CanvasPath& aPath,
double aX, double aY,
const CanvasWindingRule& aWinding,
nsIPrincipal&)
{
if (!FloatValidate(aX, aY)) {
return false;
@ -4708,7 +4714,8 @@ bool CanvasRenderingContext2D::IsPointInPath(JSContext* aCx, const CanvasPath& a
}
bool
CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, double aX, double aY)
CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, double aX, double aY,
nsIPrincipal& aSubjectPrincipal)
{
if (!FloatValidate(aX, aY)) {
return false;
@ -4717,7 +4724,7 @@ CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, double aX, double aY)
// Check for site-specific permission and return false if no permission.
if (mCanvasElement) {
nsCOMPtr<nsIDocument> ownerDoc = mCanvasElement->OwnerDoc();
if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx)) {
if (!CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx, aSubjectPrincipal)) {
return false;
}
}
@ -4743,7 +4750,9 @@ CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, double aX, double aY)
return mPath->StrokeContainsPoint(strokeOptions, Point(aX, aY), mTarget->GetTransform());
}
bool CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, const CanvasPath& aPath, double aX, double aY)
bool
CanvasRenderingContext2D::IsPointInStroke(JSContext* aCx, const CanvasPath& aPath,
double aX, double aY, nsIPrincipal&)
{
if (!FloatValidate(aX, aY)) {
return false;
@ -5435,8 +5444,9 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
already_AddRefed<ImageData>
CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
double aSy, double aSw,
double aSh, ErrorResult& aError)
double aSy, double aSw, double aSh,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
if (mDrawObserver) {
mDrawObserver->DidDrawCall(CanvasDrawObserver::DrawCallType::GetImageData);
@ -5502,7 +5512,7 @@ CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
}
JS::Rooted<JSObject*> array(aCx);
aError = GetImageDataArray(aCx, x, y, w, h, array.address());
aError = GetImageDataArray(aCx, x, y, w, h, aSubjectPrincipal, array.address());
if (aError.Failed()) {
return nullptr;
}
@ -5518,6 +5528,7 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
int32_t aY,
uint32_t aWidth,
uint32_t aHeight,
nsIPrincipal& aSubjectPrincipal,
JSObject** aRetval)
{
if (mDrawObserver) {
@ -5590,7 +5601,7 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
bool usePlaceholder = false;
if (mCanvasElement) {
nsCOMPtr<nsIDocument> ownerDoc = mCanvasElement->OwnerDoc();
usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx);
usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(ownerDoc, aCx, aSubjectPrincipal);
}
do {

View File

@ -203,10 +203,16 @@ public:
bool DrawCustomFocusRing(mozilla::dom::Element& aElement);
void Clip(const CanvasWindingRule& aWinding);
void Clip(const CanvasPath& aPath, const CanvasWindingRule& aWinding);
bool IsPointInPath(JSContext* aCx, double aX, double aY, const CanvasWindingRule& aWinding);
bool IsPointInPath(JSContext* aCx, const CanvasPath& aPath, double aX, double aY, const CanvasWindingRule& aWinding);
bool IsPointInStroke(JSContext* aCx, double aX, double aY);
bool IsPointInStroke(JSContext* aCx, const CanvasPath& aPath, double aX, double aY);
bool IsPointInPath(JSContext* aCx, double aX, double aY,
const CanvasWindingRule& aWinding,
nsIPrincipal& aSubjectPrincipal);
bool IsPointInPath(JSContext* aCx, const CanvasPath& aPath,
double aX, double aY,
const CanvasWindingRule& aWinding, nsIPrincipal&);
bool IsPointInStroke(JSContext* aCx, double aX, double aY,
nsIPrincipal& aSubjectPrincipal);
bool IsPointInStroke(JSContext* aCx, const CanvasPath& aPath,
double aX, double aY, nsIPrincipal&);
void FillText(const nsAString& aText, double aX, double aY,
const Optional<double>& aMaxWidth,
mozilla::ErrorResult& aError);
@ -248,7 +254,7 @@ public:
mozilla::ErrorResult& aError);
already_AddRefed<ImageData>
GetImageData(JSContext* aCx, double aSx, double aSy, double aSw, double aSh,
mozilla::ErrorResult& aError);
nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
void PutImageData(ImageData& aImageData,
double aDx, double aDy, mozilla::ErrorResult& aError);
void PutImageData(ImageData& aImageData,
@ -559,6 +565,7 @@ public:
protected:
nsresult GetImageDataArray(JSContext* aCx, int32_t aX, int32_t aY,
uint32_t aWidth, uint32_t aHeight,
nsIPrincipal& aSubjectPrincipal,
JSObject** aRetval);
nsresult PutImageData_explicit(int32_t aX, int32_t aY, uint32_t aW, uint32_t aH,

View File

@ -43,7 +43,7 @@ using namespace mozilla::gfx;
namespace mozilla {
namespace CanvasUtils {
bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx)
bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx, nsIPrincipal& aPrincipal)
{
// Do the rest of the checks only if privacy.resistFingerprinting is on.
if (!nsContentUtils::ShouldResistFingerprinting()) {
@ -55,28 +55,14 @@ bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx)
return false;
}
nsPIDOMWindowOuter *win = aDocument->GetWindow();
nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(win));
if (sop) {
// Documents with system principal can always extract canvas data.
nsIPrincipal *principal = sop->GetPrincipal();
if (nsContentUtils::IsSystemPrincipal(principal)) {
return true;
}
if (principal) {
// Allow extension principals
nsAutoString addonId;
Unused << NS_WARN_IF(NS_FAILED(principal->GetAddonId(addonId)));
if (!addonId.IsEmpty()) {
return true;
}
}
// The system principal can always extract canvas data.
if (nsContentUtils::IsSystemPrincipal(&aPrincipal)) {
return true;
}
// Always give permission to chrome scripts (e.g. Page Inspector).
if (nsContentUtils::ThreadsafeIsCallerChrome()) {
// Allow extension principals.
auto principal = BasePrincipal::Cast(&aPrincipal);
if (principal->AddonPolicy() || principal->ContentScriptAddonPolicy()) {
return true;
}
@ -178,6 +164,7 @@ bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx)
nsContentUtils::LogMessageToConsole(message.get());
// Prompt the user (asynchronous).
nsPIDOMWindowOuter *win = aDocument->GetWindow();
if (XRE_IsContentProcess()) {
TabChild* tabChild = TabChild::GetFrom(win);
if (tabChild) {

View File

@ -50,7 +50,7 @@ void DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
bool HasDrawWindowPrivilege(JSContext* aCx, JSObject* aObj);
// Check site-specific permission and display prompt if appropriate.
bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx);
bool IsImageExtractionAllowed(nsIDocument *aDocument, JSContext *aCx, nsIPrincipal& aPrincipal);
// Make a double out of |v|, treating undefined values as 0.0 (for
// the sake of sparse arrays). Return true iff coercion

View File

@ -4957,7 +4957,7 @@ support-files = always-fail.html
[generated/test_..__always-fail.html]
fail-if = 1
[generated/test_2_conformance2__attribs__gl-bindAttribLocation-aliasing-inactive.html]
fail-if = 1
fail-if = (os != 'win')
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__attribs__gl-vertex-attrib-i-render.html]
skip-if = (os == 'win') || (os == 'android' || os == 'linux')
@ -5095,10 +5095,8 @@ skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__glsl3__short-circuiting-in-loop-condition.html]
skip-if = (os == 'win' && os_version == '6.1') || (os == 'android' || os == 'linux')
[generated/test_2_conformance2__glsl3__switch-case.html]
fail-if = (os == 'win')
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__glsl3__texture-offset-non-constant-offset.html]
fail-if = (os == 'win')
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__glsl3__texture-offset-out-of-range.html]
skip-if = (os == 'android' || os == 'linux')
@ -7279,8 +7277,7 @@ skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__transform_feedback__switching-objects.html]
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__transform_feedback__too-small-buffers.html]
fail-if = 1
skip-if = (os == 'android' || os == 'linux')
skip-if = 1 || (os == 'android' || os == 'linux')
[generated/test_2_conformance2__transform_feedback__transform_feedback.html]
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__transform_feedback__two-unreferenced-varyings.html]

View File

@ -89,11 +89,12 @@ fail-if = 1
[generated/test_2_conformance2__rendering__read-draw-when-missing-image.html]
fail-if = 1
[generated/test_2_conformance2__transform_feedback__too-small-buffers.html]
fail-if = 1
# ABORT_ON_ERROR
skip-if = 1
[generated/test_2_conformance2__uniforms__incompatible-texture-type-for-sampler.html]
fail-if = 1
[generated/test_2_conformance2__attribs__gl-bindAttribLocation-aliasing-inactive.html]
fail-if = 1
fail-if = (os != 'win')
[generated/test_conformance__rendering__texture-switch-performance.html]
# Frequent orange on linux+asan, but likely intermittant:
@ -1197,10 +1198,6 @@ skip-if = (os == 'win')
skip-if = (os == 'win')
[generated/test_2_conformance2__glsl3__array-initialize-with-same-name-array.html]
fail-if = (os == 'win')
[generated/test_2_conformance2__glsl3__switch-case.html]
fail-if = (os == 'win')
[generated/test_2_conformance2__glsl3__texture-offset-non-constant-offset.html]
fail-if = (os == 'win')
[generated/test_2_conformance__misc__webgl-specific-stencil-settings.html]
# [gl:0D6DE000] mozilla::gl::GLContext::raw_fDrawArrays: Generated unexpected GL_INVALID_OPERATION error. (0x0502)
# ERR: gl::ValidateDrawBase(2519): This ANGLE implementation does not support separate front/back stencil writemasks, reference values, or stencil mask values.

View File

@ -13,7 +13,7 @@ support-files =
red-green.webmvp9.webm
[ensure-exts/test_ANGLE_instanced_arrays.html]
fail-if = (os == 'android') || (os == 'mac' && os_version == '10.6')
fail-if = (os == 'android')
[ensure-exts/test_EXT_blend_minmax.html]
fail-if = (os == 'android')
[ensure-exts/test_EXT_color_buffer_half_float.html]
@ -23,7 +23,7 @@ fail-if = 1
[ensure-exts/test_EXT_frag_depth.html]
fail-if = (os == 'android')
[ensure-exts/test_EXT_sRGB.html]
fail-if = (os == 'android') || (os == 'mac' && os_version == '10.6')
fail-if = (os == 'android')
[ensure-exts/test_EXT_shader_texture_lod.html]
fail-if = (os == 'android')
[ensure-exts/test_EXT_texture_filter_anisotropic.html]
@ -43,7 +43,6 @@ fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win')
[ensure-exts/test_WEBGL_compressed_texture_s3tc.html]
fail-if = (os == 'android')
[ensure-exts/test_WEBGL_depth_texture.html]
fail-if = (os == 'mac' && os_version == '10.6')
[ensure-exts/test_WEBGL_draw_buffers.html]
fail-if = (os == 'android') || (os == 'win' && os_version == '5.1')

View File

@ -125,4 +125,10 @@ dictionary MatchPatternOptions {
* wildcard. The `pattern` property is updated to reflect this.
*/
boolean ignorePath = false;
/**
* If true, the set of schemes this pattern can match is restricted to
* those accessible by WebExtensions.
*/
boolean restrictSchemes = true;
};

View File

@ -230,8 +230,9 @@ public:
nsString mLogTimerLabel;
Console::TimerStatus mLogTimerStatus;
// These 2 values are set by IncreaseCounter on the owning thread and they are
// used CreateCounterValue. These members are set when console.count() is
// These 2 values are set by IncreaseCounter or ResetCounter on the owning
// thread and they are used by CreateCounterOrResetCounterValue.
// These members are set when console.count() or console.countReset() are
// called.
nsString mCountLabel;
uint32_t mCountValue;
@ -1444,6 +1445,13 @@ Console::Count(const GlobalObject& aGlobal, const nsAString& aLabel)
NS_LITERAL_STRING("count"));
}
/* static */ void
Console::CountReset(const GlobalObject& aGlobal, const nsAString& aLabel)
{
StringMethod(aGlobal, aLabel, Sequence<JS::Value>(), MethodCountReset,
NS_LITERAL_STRING("countReset"));
}
namespace {
void
@ -1631,6 +1639,13 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
}
}
else if (aMethodName == MethodCountReset) {
callData->mCountValue = ResetCounter(aCx, aData, callData->mCountLabel);
if (callData->mCountLabel.IsEmpty()) {
return;
}
}
// Before processing this CallData differently, it's time to call the dump
// function.
if (aMethodName == MethodTrace || aMethodName == MethodAssert) {
@ -1899,9 +1914,10 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
aData->mLogTimerStatus);
}
else if (aData->mMethodName == MethodCount) {
event.mCounter = CreateCounterValue(aCx, aData->mCountLabel,
aData->mCountValue);
else if (aData->mMethodName == MethodCount ||
aData->mMethodName == MethodCountReset) {
event.mCounter = CreateCounterOrResetCounterValue(aCx, aData->mCountLabel,
aData->mCountValue);
}
JSAutoRealm ar2(aCx, targetScope);
@ -2504,14 +2520,48 @@ Console::IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aArguments,
return entry.Data();
}
uint32_t
Console::ResetCounter(JSContext* aCx, const Sequence<JS::Value>& aArguments,
nsAString& aCountLabel)
{
AssertIsOnOwningThread();
ConsoleCommon::ClearException ce(aCx);
MOZ_ASSERT(!aArguments.IsEmpty());
JS::Rooted<JS::Value> labelValue(aCx, aArguments[0]);
JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, labelValue));
if (!jsString) {
return 0; // We cannot continue.
}
nsAutoJSString string;
if (!string.init(aCx, jsString)) {
return 0; // We cannot continue.
}
aCountLabel = string;
if (mCounterRegistry.Remove(aCountLabel)) {
return 0;
}
// Let's return something different than 0 if the key doesn't exist.
return MAX_PAGE_COUNTERS;
}
JS::Value
Console::CreateCounterValue(JSContext* aCx, const nsAString& aCountLabel,
uint32_t aCountValue) const
Console::CreateCounterOrResetCounterValue(JSContext* aCx,
const nsAString& aCountLabel,
uint32_t aCountValue) const
{
ConsoleCommon::ClearException ce(aCx);
if (aCountValue == MAX_PAGE_COUNTERS) {
RootedDictionary<ConsoleCounterError> error(aCx);
error.mLabel = aCountLabel;
error.mError.AssignLiteral("counterDoesntExist");
JS::Rooted<JS::Value> value(aCx);
if (!ToJSValue(aCx, error, &value)) {
@ -3078,6 +3128,7 @@ Console::InternalLogLevelToInteger(MethodName aName) const
case MethodTimeStamp: return 3;
case MethodAssert: return 3;
case MethodCount: return 3;
case MethodCountReset: return 3;
case MethodClear: return 3;
case MethodProfile: return 3;
case MethodProfileEnd: return 3;

View File

@ -119,6 +119,9 @@ public:
static void
Count(const GlobalObject& aGlobal, const nsAString& aLabel);
static void
CountReset(const GlobalObject& aGlobal, const nsAString& aLabel);
static void
Clear(const GlobalObject& aGlobal);
@ -168,6 +171,7 @@ private:
MethodTimeStamp,
MethodAssert,
MethodCount,
MethodCountReset,
MethodClear,
MethodProfile,
MethodProfileEnd,
@ -360,8 +364,8 @@ private:
Sequence<JS::Value>& aSequence) const;
// This method follows the same pattern as StartTimer: its runs on the owning
// thread and populate aCountLabel, used by CreateCounterValue. Returns
// 3 possible values:
// thread and populate aCountLabel, used by CreateCounterOrResetCounterValue.
// Returns 3 possible values:
// * MAX_PAGE_COUNTERS in case of error that has to be reported;
// * 0 in case of a CX exception. The operation cannot continue;
// * the incremented counter value.
@ -373,6 +377,20 @@ private:
IncreaseCounter(JSContext* aCx, const Sequence<JS::Value>& aData,
nsAString& aCountLabel);
// This method follows the same pattern as StartTimer: its runs on the owning
// thread and populate aCountLabel, used by CreateCounterResetValue. Returns
// 3 possible values:
// * MAX_PAGE_COUNTERS in case of error that has to be reported;
// * 0 elsewhere. In case of a CX exception, aCountLabel will be an empty
// string.
// Params:
// * aCx - the JSContext rooting aData.
// * aData - the arguments received by the console.count() method.
// * aCountLabel - the label that will be populated by this method.
uint32_t
ResetCounter(JSContext* aCx, const Sequence<JS::Value>& aData,
nsAString& aCountLabel);
// This method generates a ConsoleCounter dictionary as JS::Value. If
// aCountValue is == MAX_PAGE_COUNTERS it generates a ConsoleCounterError
// instead. See IncreaseCounter.
@ -381,8 +399,8 @@ private:
// aTimerLabel.
// * aCountValue - the return value of IncreaseCounter.
JS::Value
CreateCounterValue(JSContext* aCx, const nsAString& aCountLabel,
uint32_t aCountValue) const;
CreateCounterOrResetCounterValue(JSContext* aCx, const nsAString& aCountLabel,
uint32_t aCountValue) const;
bool
ShouldIncludeStackTrace(MethodName aMethodName) const;

View File

@ -216,6 +216,14 @@ ConsoleInstance::Count(JSContext* aCx, const nsAString& aLabel)
NS_LITERAL_STRING("count"));
}
void
ConsoleInstance::CountReset(JSContext* aCx, const nsAString& aLabel)
{
mConsole->StringMethodInternal(aCx, aLabel, Sequence<JS::Value>(),
Console::MethodCountReset,
NS_LITERAL_STRING("countReset"));
}
void
ConsoleInstance::Clear(JSContext* aCx)
{

View File

@ -96,6 +96,9 @@ public:
void
Count(JSContext* aCx, const nsAString& aLabel);
void
CountReset(JSContext* aCx, const nsAString& aLabel);
void
Clear(JSContext* aCx);

View File

@ -11,3 +11,4 @@ support-files =
[test_console_proto.html]
[test_devtools_pref.html]
[test_timer.html]
[test_count.html]

View File

@ -0,0 +1,113 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for count/countReset in console</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function ConsoleListener() {
SpecialPowers.addObserver(this, "console-api-log-event");
}
ConsoleListener.prototype = {
observe(aSubject, aTopic, aData) {
let obj = aSubject.wrappedJSObject;
if (obj.arguments[0] != 'test') {
return;
}
if (!this._cb) {
ok(false, "Callback not set!");
return;
}
if (!this._cb(obj)) {
return;
}
this._cb = null;
this._resolve();
},
shutdown() {
SpecialPowers.removeObserver(this, "console-api-log-event");
},
waitFor(cb) {
return new Promise(resolve => {
this._cb = cb;
this._resolve = resolve;
});
},
};
let listener = new ConsoleListener();
async function runTest() {
// First count.
let cl = listener.waitFor(obj => {
return ("counter" in obj) &&
("label" in obj.counter) &&
obj.counter.label == "test" &&
obj.counter.count == 1;
});
console.count("test");
await cl;
ok(true, "Console.count == 1 received!");
// Second count.
cl = listener.waitFor(obj => {
return ("counter" in obj) &&
("label" in obj.counter) &&
obj.counter.label == "test" &&
obj.counter.count == 2;
});
console.count("test");
await cl;
ok(true, "Console.count == 2 received!");
// Counter reset.
cl = listener.waitFor(obj => {
return ("counter" in obj) &&
("label" in obj.counter) &&
obj.counter.label == "test" &&
obj.counter.count == 0;
});
console.countReset("test");
await cl;
ok(true, "Console.countReset == 0 received!");
// Counter reset with error.
cl = listener.waitFor(obj => {
return ("counter" in obj) &&
("label" in obj.counter) &&
obj.counter.label == "test" &&
obj.counter.error == "counterDoesntExist";
});
console.countReset("test");
await cl;
ok(true, "Console.countReset with error received!");
// First again!
cl = listener.waitFor(obj => {
return ("counter" in obj) &&
("label" in obj.counter) &&
obj.counter.label == "test" &&
obj.counter.count == 1;
});
console.count("test");
await cl;
ok(true, "Console.count == 1 received!");
}
runTest().then(SimpleTest.finish);
</script>
</body>
</html>

View File

@ -109,7 +109,7 @@ DataTransferItem::KindFromData(nsIVariant* aData)
nsresult rv = aData->GetAsISupports(getter_AddRefs(supports));
if (NS_SUCCEEDED(rv) && supports) {
// Check if we have one of the supported file data formats
if (nsCOMPtr<nsIDOMBlob>(do_QueryInterface(supports)) ||
if (RefPtr<Blob>(do_QueryObject(supports)) ||
nsCOMPtr<BlobImpl>(do_QueryInterface(supports)) ||
nsCOMPtr<nsIFile>(do_QueryInterface(supports))) {
return KIND_FILE;
@ -292,8 +292,7 @@ DataTransferItem::GetAsFile(nsIPrincipal& aSubjectPrincipal,
return nullptr;
}
if (nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(supports)) {
Blob* blob = static_cast<Blob*>(domBlob.get());
if (RefPtr<Blob> blob = do_QueryObject(supports)) {
mCachedFile = blob->ToFile();
} else if (nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports)) {
MOZ_ASSERT(blobImpl->IsFile());

View File

@ -34,8 +34,8 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Blob)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMBlob)
NS_INTERFACE_MAP_ENTRY(nsIDOMBlob)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMutable)
NS_INTERFACE_MAP_ENTRY_CONCRETE(Blob)
NS_INTERFACE_MAP_ENTRY(nsIMutable)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END

View File

@ -13,7 +13,6 @@
#include "mozilla/dom/BlobImpl.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "nsIDOMBlob.h"
#include "nsIMutable.h"
#include "nsWrapperCache.h"
#include "nsWeakReference.h"
@ -27,17 +26,21 @@ struct BlobPropertyBag;
class File;
class OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString;
class Blob : public nsIDOMBlob
, public nsIMutable
#define NS_DOM_BLOB_IID \
{ 0x648c2a83, 0xbdb1, 0x4a7d, \
{ 0xb5, 0x0a, 0xca, 0xcd, 0x92, 0x87, 0x45, 0xc2 } }
class Blob : public nsIMutable
, public nsSupportsWeakReference
, public nsWrapperCache
{
public:
NS_DECL_NSIDOMBLOB
NS_DECL_NSIMUTABLE
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Blob, nsIDOMBlob)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Blob, nsIMutable)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_BLOB_IID)
typedef OwningArrayBufferViewOrArrayBufferOrBlobOrUSVString BlobPart;
@ -147,6 +150,8 @@ private:
nsCOMPtr<nsISupports> mParent;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Blob, NS_DOM_BLOB_IID)
// Override BindingJSObjectMallocBytes for blobs to tell the JS GC how much
// memory is held live by the binding object.
size_t BindingJSObjectMallocBytes(Blob* aBlob);
@ -154,4 +159,10 @@ size_t BindingJSObjectMallocBytes(Blob* aBlob);
} // namespace dom
} // namespace mozilla
inline nsISupports*
ToSupports(mozilla::dom::Blob* aBlob)
{
return static_cast<nsIMutable*>(aBlob);
}
#endif // mozilla_dom_Blob_h

View File

@ -9,12 +9,6 @@ with Files("**"):
DIRS += ['ipc']
XPIDL_SOURCES += [
'nsIDOMBlob.idl',
]
XPIDL_MODULE = 'dom_file'
EXPORTS += [
'nsHostObjectProtocolHandler.h',
'nsHostObjectURI.h',

View File

@ -419,12 +419,12 @@ class BlobURLsReporter final : public nsIMemoryReporter
NS_IMPL_ISUPPORTS(BlobURLsReporter, nsIMemoryReporter)
class ReleasingTimerHolder final : public nsITimerCallback
, public nsINamed
class ReleasingTimerHolder final : public Runnable
, public nsITimerCallback
, public nsIAsyncShutdownBlocker
{
public:
NS_DECL_ISUPPORTS
NS_DECL_ISUPPORTS_INHERITED
static void
Create(const nsACString& aURI, bool aBroadcastToOtherProcesses)
@ -438,20 +438,38 @@ public:
holder->CancelTimerAndRevokeURI();
});
nsresult rv = NS_NewTimerWithCallback(getter_AddRefs(holder->mTimer),
holder, RELEASING_TIMER,
nsresult rv =
SystemGroup::EventTargetFor(TaskCategory::Other)->Dispatch(holder.forget());
NS_ENSURE_SUCCESS_VOID(rv);
raii.release();
}
// Runnable interface
NS_IMETHOD
Run() override
{
RefPtr<ReleasingTimerHolder> self = this;
auto raii = mozilla::MakeScopeExit([self] {
self->CancelTimerAndRevokeURI();
});
nsresult rv = NS_NewTimerWithCallback(getter_AddRefs(mTimer),
this, RELEASING_TIMER,
nsITimer::TYPE_ONE_SHOT,
SystemGroup::EventTargetFor(TaskCategory::Other));
NS_ENSURE_SUCCESS_VOID(rv);
NS_ENSURE_SUCCESS(rv, NS_OK);
nsCOMPtr<nsIAsyncShutdownClient> phase = GetShutdownPhase();
NS_ENSURE_TRUE_VOID(!!phase);
NS_ENSURE_TRUE(!!phase, NS_OK);
rv = phase->AddBlocker(holder, NS_LITERAL_STRING(__FILE__), __LINE__,
rv = phase->AddBlocker(this, NS_LITERAL_STRING(__FILE__), __LINE__,
NS_LITERAL_STRING("ReleasingTimerHolder shutdown"));
NS_ENSURE_SUCCESS_VOID(rv);
NS_ENSURE_SUCCESS(rv, NS_OK);
raii.release();
return NS_OK;
}
// nsITimerCallback interface
@ -463,14 +481,7 @@ public:
return NS_OK;
}
// nsINamed interface
NS_IMETHOD
GetName(nsACString& aName) override
{
aName.AssignLiteral("ReleasingTimerHolder");
return NS_OK;
}
using nsINamed::GetName;
// nsIAsyncShutdownBlocker interface
@ -497,7 +508,8 @@ public:
private:
ReleasingTimerHolder(const nsACString& aURI, bool aBroadcastToOtherProcesses)
: mURI(aURI)
: Runnable("ReleasingTimerHolder")
, mURI(aURI)
, mBroadcastToOtherProcesses(aBroadcastToOtherProcesses)
{}
@ -563,8 +575,8 @@ private:
nsCOMPtr<nsITimer> mTimer;
};
NS_IMPL_ISUPPORTS(ReleasingTimerHolder, nsITimerCallback, nsINamed,
nsIAsyncShutdownBlocker)
NS_IMPL_ISUPPORTS_INHERITED(ReleasingTimerHolder, Runnable, nsITimerCallback,
nsIAsyncShutdownBlocker)
} // namespace mozilla

View File

@ -1,12 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
[scriptable, builtinclass, uuid(f344146a-ee1f-417e-8a68-6984ca56f0ae)]
interface nsIDOMBlob : nsISupports
{
// Just an empty interface.
};

View File

@ -19,8 +19,10 @@
function childFrameScript() {
"use strict";
Cu.importGlobalProperties(["Blob"]);
addMessageListener("test:ipcClonedMessage", function(message) {
if (!(message.json instanceof Ci.nsIDOMBlob)) {
if (!Blob.isInstance(message.json)) {
sendAsyncMessage(message.name, message.json);
return;
}

View File

@ -308,7 +308,7 @@ GetDirectoryListingTaskParent::IOWork()
return NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = mTargetPath->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -329,18 +329,10 @@ GetDirectoryListingTaskParent::IOWork()
}
for (;;) {
bool hasMore = false;
if (NS_WARN_IF(NS_FAILED(entries->HasMoreElements(&hasMore))) || !hasMore) {
nsCOMPtr<nsIFile> currFile;
if (NS_WARN_IF(NS_FAILED(entries->GetNextFile(getter_AddRefs(currFile)))) || !currFile) {
break;
}
nsCOMPtr<nsISupports> supp;
if (NS_WARN_IF(NS_FAILED(entries->GetNext(getter_AddRefs(supp))))) {
break;
}
nsCOMPtr<nsIFile> currFile = do_QueryInterface(supp);
MOZ_ASSERT(currFile);
bool isSpecial, isFile;
if (NS_WARN_IF(NS_FAILED(currFile->IsSpecial(&isSpecial))) ||
isSpecial) {

View File

@ -338,26 +338,17 @@ GetFilesHelperBase::ExploreDirectory(const nsAString& aDOMPath, nsIFile* aFile)
return rv;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
for (;;) {
bool hasMore = false;
if (NS_WARN_IF(NS_FAILED(entries->HasMoreElements(&hasMore))) || !hasMore) {
nsCOMPtr<nsIFile> currFile;
if (NS_WARN_IF(NS_FAILED(entries->GetNextFile(getter_AddRefs(currFile)))) || !currFile) {
break;
}
nsCOMPtr<nsISupports> supp;
if (NS_WARN_IF(NS_FAILED(entries->GetNext(getter_AddRefs(supp))))) {
break;
}
nsCOMPtr<nsIFile> currFile = do_QueryInterface(supp);
MOZ_ASSERT(currFile);
bool isLink, isSpecial, isFile, isDir;
if (NS_WARN_IF(NS_FAILED(currFile->IsSymlink(&isLink)) ||
NS_FAILED(currFile->IsSpecial(&isSpecial))) ||

View File

@ -670,6 +670,7 @@ void
HTMLCanvasElement::ToDataURL(JSContext* aCx, const nsAString& aType,
JS::Handle<JS::Value> aParams,
nsAString& aDataURL,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
// do a trust check if this is a write-only canvas
@ -679,7 +680,7 @@ HTMLCanvasElement::ToDataURL(JSContext* aCx, const nsAString& aType,
return;
}
aRv = ToDataURLImpl(aCx, aType, aParams, aDataURL);
aRv = ToDataURLImpl(aCx, aSubjectPrincipal, aType, aParams, aDataURL);
}
void
@ -750,6 +751,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(CanvasCaptureTrackSource,
already_AddRefed<CanvasCaptureMediaStream>
HTMLCanvasElement::CaptureStream(const Optional<double>& aFrameRate,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
if (IsWriteOnly()) {
@ -794,7 +796,8 @@ HTMLCanvasElement::CaptureStream(const Optional<double>& aFrameRate,
// all-white, opaque image data.
bool usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(
OwnerDoc(),
nsContentUtils::GetCurrentJSContext());
nsContentUtils::GetCurrentJSContext(),
aSubjectPrincipal);
rv = RegisterFrameCaptureListener(stream->FrameCaptureListener(), usePlaceholder);
if (NS_FAILED(rv)) {
@ -807,13 +810,15 @@ HTMLCanvasElement::CaptureStream(const Optional<double>& aFrameRate,
nsresult
HTMLCanvasElement::ExtractData(JSContext* aCx,
nsIPrincipal& aSubjectPrincipal,
nsAString& aType,
const nsAString& aOptions,
nsIInputStream** aStream)
{
// Check site-specific permission and display prompt if appropriate.
// If no permission, return all-white, opaque image data.
bool usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(OwnerDoc(), aCx);
bool usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(
OwnerDoc(), aCx, aSubjectPrincipal);
return ImageEncoder::ExtractData(aType,
aOptions,
GetSize(),
@ -825,6 +830,7 @@ HTMLCanvasElement::ExtractData(JSContext* aCx,
nsresult
HTMLCanvasElement::ToDataURLImpl(JSContext* aCx,
nsIPrincipal& aSubjectPrincipal,
const nsAString& aMimeType,
const JS::Value& aEncoderOptions,
nsAString& aDataURL)
@ -847,12 +853,14 @@ HTMLCanvasElement::ToDataURLImpl(JSContext* aCx,
}
nsCOMPtr<nsIInputStream> stream;
rv = ExtractData(aCx, type, params, getter_AddRefs(stream));
rv = ExtractData(aCx, aSubjectPrincipal, type, params,
getter_AddRefs(stream));
// If there are unrecognized custom parse options, we should fall back to
// the default values for the encoder without any options at all.
if (rv == NS_ERROR_INVALID_ARG && usingCustomParseOptions) {
rv = ExtractData(aCx, type, EmptyString(), getter_AddRefs(stream));
rv = ExtractData(aCx, aSubjectPrincipal, type, EmptyString(),
getter_AddRefs(stream));
}
NS_ENSURE_SUCCESS(rv, rv);
@ -873,6 +881,7 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
BlobCallback& aCallback,
const nsAString& aType,
JS::Handle<JS::Value> aParams,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
// do a trust check if this is a write-only canvas
@ -904,7 +913,8 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
// Check site-specific permission and display prompt if appropriate.
// If no permission, return all-white, opaque image data.
bool usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(OwnerDoc(), aCx);
bool usePlaceholder = !CanvasUtils::IsImageExtractionAllowed(
OwnerDoc(), aCx, aSubjectPrincipal);
CanvasRenderingContextHelper::ToBlob(aCx, global, aCallback, aType,
aParams, usePlaceholder, aRv);
@ -952,20 +962,20 @@ HTMLCanvasElement::TransferControlToOffscreen(ErrorResult& aRv)
already_AddRefed<File>
HTMLCanvasElement::MozGetAsFile(const nsAString& aName,
const nsAString& aType,
CallerType aCallerType,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eMozGetAsFile);
// do a trust check if this is a write-only canvas
if (mWriteOnly && aCallerType != CallerType::System) {
if (mWriteOnly && !nsContentUtils::IsSystemPrincipal(&aSubjectPrincipal)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
RefPtr<File> file;
aRv = MozGetAsFileImpl(aName, aType, getter_AddRefs(file));
aRv = MozGetAsFileImpl(aName, aType, aSubjectPrincipal, getter_AddRefs(file));
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -975,12 +985,14 @@ HTMLCanvasElement::MozGetAsFile(const nsAString& aName,
nsresult
HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
const nsAString& aType,
nsIPrincipal& aSubjectPrincipal,
File** aResult)
{
nsCOMPtr<nsIInputStream> stream;
nsAutoString type(aType);
nsresult rv = ExtractData(nsContentUtils::GetCurrentJSContext(),
type, EmptyString(), getter_AddRefs(stream));
aSubjectPrincipal, type, EmptyString(),
getter_AddRefs(stream));
NS_ENSURE_SUCCESS(rv, rv);
uint64_t imgSize;

View File

@ -178,12 +178,14 @@ public:
void ToDataURL(JSContext* aCx, const nsAString& aType,
JS::Handle<JS::Value> aParams,
nsAString& aDataURL,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);
void ToBlob(JSContext* aCx,
BlobCallback& aCallback,
const nsAString& aType,
JS::Handle<JS::Value> aParams,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);
OffscreenCanvas* TransferControlToOffscreen(ErrorResult& aRv);
@ -203,7 +205,7 @@ public:
}
already_AddRefed<File> MozGetAsFile(const nsAString& aName,
const nsAString& aType,
CallerType aCallerType,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);
already_AddRefed<nsISupports> MozGetIPCContext(const nsAString& aContextId,
ErrorResult& aRv);
@ -211,7 +213,7 @@ public:
void SetMozPrintCallback(PrintCallback* aCallback);
already_AddRefed<CanvasCaptureMediaStream>
CaptureStream(const Optional<double>& aFrameRate, ErrorResult& aRv);
CaptureStream(const Optional<double>& aFrameRate, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
/**
* Get the size in pixels of this canvas element
@ -354,15 +356,18 @@ protected:
CreateContext(CanvasContextType aContextType) override;
nsresult ExtractData(JSContext* aCx,
nsIPrincipal& aSubjectPrincipal,
nsAString& aType,
const nsAString& aOptions,
nsIInputStream** aStream);
nsresult ToDataURLImpl(JSContext* aCx,
nsIPrincipal& aSubjectPrincipal,
const nsAString& aMimeType,
const JS::Value& aEncoderOptions,
nsAString& aDataURL);
nsresult MozGetAsFileImpl(const nsAString& aName,
const nsAString& aType,
nsIPrincipal& aSubjectPrincipal,
File** aResult);
void CallPrintCallback();

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/WheelEventBinding.h"
#include "nsAttrValueInlines.h"
#include "nsCRTGlue.h"
#include "nsQueryObject.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
@ -508,7 +509,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
iter->GetNext(getter_AddRefs(tmp));
nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(tmp);
RefPtr<Blob> domBlob = do_QueryObject(tmp);
MOZ_ASSERT(domBlob,
"Null file object from FilePicker's file enumerator?");
if (!domBlob) {
@ -516,7 +517,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
}
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();
element->SetAsFile() = static_cast<File*>(domBlob.get());
element->SetAsFile() = domBlob->ToFile();
}
} else {
MOZ_ASSERT(mode == static_cast<int16_t>(nsIFilePicker::modeOpen) ||
@ -525,9 +526,9 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
nsresult rv = mFilePicker->GetDomFileOrDirectory(getter_AddRefs(tmp));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(tmp);
RefPtr<Blob> blob = do_QueryObject(tmp);
if (blob) {
RefPtr<File> file = static_cast<Blob*>(blob.get())->ToFile();
RefPtr<File> file = blob->ToFile();
MOZ_ASSERT(file);
OwningFileOrDirectory* element = newFilesOrDirectories.AppendElement();

View File

@ -17404,7 +17404,7 @@ FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
return NS_OK;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -17412,17 +17412,8 @@ FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
uint64_t usage = 0;
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -17984,7 +17975,7 @@ QuotaClient::GetDatabaseFilenames(
AssertIsOnIOThread();
MOZ_ASSERT(aDirectory);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -18000,19 +17991,10 @@ QuotaClient::GetDatabaseFilenames(
const NS_ConvertASCIItoUTF16 walSuffix(kSQLiteWALSuffix,
LiteralStringLength(kSQLiteWALSuffix));
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
hasMore &&
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) &&
file &&
!aCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -18087,7 +18069,7 @@ QuotaClient::GetUsageForDirectoryInternal(nsIFile* aDirectory,
MOZ_ASSERT(aDirectory);
MOZ_ASSERT(aUsageInfo);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -18103,19 +18085,10 @@ QuotaClient::GetUsageForDirectoryInternal(nsIFile* aDirectory,
const NS_ConvertASCIItoUTF16 shmSuffix(kSQLiteSHMSuffix,
LiteralStringLength(kSQLiteSHMSuffix));
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
hasMore &&
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) &&
file &&
!aCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -18438,7 +18411,7 @@ Maintenance::DirectoryWork()
continue;
}
nsCOMPtr<nsISimpleEnumerator> persistenceDirEntries;
nsCOMPtr<nsIDirectoryEnumerator> persistenceDirEntries;
rv = persistenceDir->GetDirectoryEntries(
getter_AddRefs(persistenceDirEntries));
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -18455,26 +18428,16 @@ Maintenance::DirectoryWork()
return NS_ERROR_ABORT;
}
bool persistenceDirHasMoreEntries;
rv = persistenceDirEntries->HasMoreElements(
&persistenceDirHasMoreEntries);
nsCOMPtr<nsIFile> originDir;
rv = persistenceDirEntries->GetNextFile(getter_AddRefs(originDir));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (!persistenceDirHasMoreEntries) {
if (!originDir) {
break;
}
nsCOMPtr<nsISupports> persistenceDirEntry;
rv = persistenceDirEntries->GetNext(getter_AddRefs(persistenceDirEntry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(persistenceDirEntry);
MOZ_ASSERT(originDir);
rv = originDir->Exists(&exists);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -18520,7 +18483,7 @@ Maintenance::DirectoryWork()
continue;
}
nsCOMPtr<nsISimpleEnumerator> idbDirEntries;
nsCOMPtr<nsIDirectoryEnumerator> idbDirEntries;
rv = idbDir->GetDirectoryEntries(getter_AddRefs(idbDirEntries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -18541,25 +18504,16 @@ Maintenance::DirectoryWork()
return NS_ERROR_ABORT;
}
bool idbDirHasMoreEntries;
rv = idbDirEntries->HasMoreElements(&idbDirHasMoreEntries);
nsCOMPtr<nsIFile> idbDirFile;
rv = idbDirEntries->GetNextFile(getter_AddRefs(idbDirFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (!idbDirHasMoreEntries) {
if (!idbDirFile) {
break;
}
nsCOMPtr<nsISupports> idbDirEntry;
rv = idbDirEntries->GetNext(getter_AddRefs(idbDirEntry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> idbDirFile = do_QueryInterface(idbDirEntry);
MOZ_ASSERT(idbDirFile);
nsString idbFilePath;
rv = idbDirFile->GetPath(idbFilePath);
if (NS_WARN_IF(NS_FAILED(rv))) {

View File

@ -915,8 +915,7 @@ IDBDatabase::GetOrCreateFileActorForBlob(Blob* aBlob)
// a) it is unique per blob, b) it is reference-counted so that we can
// guarantee that it stays alive, and c) it doesn't hold the actual File
// alive.
nsCOMPtr<nsIDOMBlob> blob = aBlob;
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(blob);
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(aBlob);
MOZ_ASSERT(weakRef);
PBackgroundIDBDatabaseFileChild* actor = nullptr;

View File

@ -110,8 +110,8 @@ function verifyBuffers(buffer1, buffer2)
function verifyBlob(blob1, blob2, fileId, blobReadHandler)
{
// eslint-disable-next-line mozilla/use-cc-etc
is(blob1 instanceof Components.interfaces.nsIDOMBlob, true,
"Instance of nsIDOMBlob");
is(SpecialPowers.wrap(Blob).isInstance(blob1), true,
"Instance of Blob");
is(blob1 instanceof File, blob2 instanceof File,
"Instance of DOM File");
is(blob1.size, blob2.size, "Correct size");

View File

@ -25,7 +25,7 @@ function childFrameScript() {
const blobText = blobData.join("");
const blobType = "text/plain";
Cu.importGlobalProperties(["indexedDB"]);
Cu.importGlobalProperties(["indexedDB", "Blob"]);
function info(msg) {
sendAsyncMessage(mmName, { op: "info", msg });
@ -66,7 +66,7 @@ function childFrameScript() {
let blob = message.data;
ok(blob instanceof Ci.nsIDOMBlob, "Message manager sent a blob");
ok(Blob.isInstance(blob), "Message manager sent a blob");
is(blob.size, blobText.length, "Blob has correct length");
is(blob.type, blobType, "Blob has correct type");
@ -82,7 +82,7 @@ function childFrameScript() {
let slice = blob.slice(0, blobData[0].length, blobType);
ok(slice instanceof Ci.nsIDOMBlob, "Slice returned a blob");
ok(Blob.isInstance(slice), "Slice returned a blob");
is(slice.size, blobData[0].length, "Slice has correct length");
is(slice.type, blobType, "Slice has correct type");
@ -143,7 +143,7 @@ function childFrameScript() {
blob = event.target.result;
ok(blob instanceof Ci.nsIDOMBlob, "Database gave us a blob");
ok(Blob.isInstance(blob), "Database gave us a blob");
is(blob.size, blobText.length, "Blob has correct length");
is(blob.type, blobType, "Blob has correct type");
@ -178,7 +178,7 @@ function childFrameScript() {
slice = event.target.result;
ok(slice instanceof Ci.nsIDOMBlob, "Database gave us a blob");
ok(Blob.isInstance(slice), "Database gave us a blob");
is(slice.size, blobData[0].length, "Slice has correct length");
is(slice.type, blobType, "Slice has correct type");

View File

@ -10,6 +10,8 @@ var { "classes": Cc, "interfaces": Ci, "utils": Cu } = Components;
ChromeUtils.import("resource://gre/modules/Services.jsm");
Cu.importGlobalProperties(["Blob"]);
if (!("self" in this)) {
this.self = this;
}
@ -340,8 +342,7 @@ function getChromeFilesDir()
let idbEntries = idbDir.directoryEntries;
while (idbEntries.hasMoreElements()) {
let entry = idbEntries.getNext();
let file = entry.QueryInterface(Ci.nsIFile);
let file = idbEntries.nextFile;
if (file.isDirectory()) {
return file;
}
@ -427,7 +428,7 @@ function verifyBuffers(buffer1, buffer2)
function verifyBlob(blob1, blob2)
{
is(blob1 instanceof Ci.nsIDOMBlob, true,
is(Blob.isInstance(blob1), true,
"Instance of nsIDOMBlob");
is(blob1 instanceof File, blob2 instanceof File,
"Instance of DOM File");

View File

@ -6,7 +6,6 @@
#include "domstubs.idl"
interface nsIControllers;
interface nsIDOMBlob;
interface nsIDOMOfflineResourceList;
interface nsIPrompt;
interface nsIVariant;

View File

@ -52,7 +52,7 @@ function childFrameScript() {
let blob = message.data;
ok(blob instanceof Ci.nsIDOMBlob, "Received a Blob");
ok(Blob.isInstance(blob), "Received a Blob");
is(blob.size, blobText.length, "Blob has correct length");
is(blob.type, blobType, "Blob has correct type");
@ -71,7 +71,7 @@ function childFrameScript() {
let slice = blob.slice(firstSliceStart, firstSliceEnd, blobType);
ok(slice instanceof Ci.nsIDOMBlob, "Slice returned a Blob");
ok(Blob.isInstance(slice), "Slice returned a Blob");
is(slice.size, blobData[2].length, "Slice has correct length");
is(slice.type, blobType, "Slice has correct type");
@ -90,7 +90,7 @@ function childFrameScript() {
slice = slice.slice(secondSliceStart, secondSliceEnd, blobType);
ok(slice instanceof Ci.nsIDOMBlob, "Second slice returned a Blob");
ok(Blob.isInstance(slice), "Second slice returned a Blob");
is(slice.size, sliceText.length, "Second slice has correct length");
is(slice.type, blobType, "Second slice has correct type");

View File

@ -44,25 +44,14 @@ template<typename T>
static nsresult
EnumerateDir(nsIFile* aPath, T&& aDirIter)
{
nsCOMPtr<nsISimpleEnumerator> iter;
nsCOMPtr<nsIDirectoryEnumerator> iter;
nsresult rv = aPath->GetDirectoryEntries(getter_AddRefs(iter));
if (NS_FAILED(rv)) {
return rv;
}
bool hasMore = false;
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> supports;
rv = iter->GetNext(getter_AddRefs(supports));
if (NS_FAILED(rv)) {
continue;
}
nsCOMPtr<nsIFile> entry(do_QueryInterface(supports, &rv));
if (NS_FAILED(rv)) {
continue;
}
nsCOMPtr<nsIFile> entry;
while (NS_SUCCEEDED(iter->GetNextFile(getter_AddRefs(entry))) && entry) {
aDirIter(entry);
}
return NS_OK;

View File

@ -26,7 +26,7 @@ interface nsIGetUserMediaDevicesSuccessCallback : nsISupports
interface nsIDOMGetUserMediaSuccessCallback : nsISupports
{
/*
* value must be a nsIDOMBlob if picture is true and a
* value must be a Blob if picture is true and a
* DOMLocalMediaStream if either audio or video are true.
*/
void onSuccess(in nsISupports value);

View File

@ -2094,23 +2094,15 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
bool flashOnly = Preferences::GetBool("plugin.load_flash_only", true);
nsCOMPtr<nsISimpleEnumerator> iter;
nsCOMPtr<nsIDirectoryEnumerator> iter;
rv = pluginsDir->GetDirectoryEntries(getter_AddRefs(iter));
if (NS_FAILED(rv))
return rv;
AutoTArray<nsCOMPtr<nsIFile>, 6> pluginFiles;
bool hasMore;
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> supports;
rv = iter->GetNext(getter_AddRefs(supports));
if (NS_FAILED(rv))
continue;
nsCOMPtr<nsIFile> dirEntry(do_QueryInterface(supports, &rv));
if (NS_FAILED(rv))
continue;
nsCOMPtr<nsIFile> dirEntry;
while (NS_SUCCEEDED(iter->GetNextFile(getter_AddRefs(dirEntry))) && dirEntry) {
// Sun's JRE 1.3.1 plugin must have symbolic links resolved or else it'll crash.
// See bug 197855.
dirEntry->Normalize();

View File

@ -808,7 +808,7 @@ PresentationService::SendSessionBinaryMsg(const nsAString& aSessionId,
NS_IMETHODIMP
PresentationService::SendSessionBlob(const nsAString& aSessionId,
uint8_t aRole,
nsIDOMBlob* aBlob)
Blob* aBlob)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!aSessionId.IsEmpty());

View File

@ -291,7 +291,7 @@ PresentationSessionInfo::SendBinaryMsg(const nsACString& aData)
}
nsresult
PresentationSessionInfo::SendBlob(nsIDOMBlob* aBlob)
PresentationSessionInfo::SendBlob(Blob* aBlob)
{
if (NS_WARN_IF(!IsSessionReady())) {
return NS_ERROR_DOM_INVALID_STATE_ERR;

View File

@ -102,7 +102,7 @@ public:
nsresult SendBinaryMsg(const nsACString& aData);
nsresult SendBlob(nsIDOMBlob* aBlob);
nsresult SendBlob(Blob* aBlob);
nsresult Close(nsresult aReason,
uint32_t aState);

View File

@ -424,7 +424,7 @@ PresentationTCPSessionTransport::SendBinaryMsg(const nsACString& aData)
}
NS_IMETHODIMP
PresentationTCPSessionTransport::SendBlob(nsIDOMBlob* aBlob)
PresentationTCPSessionTransport::SendBlob(Blob* aBlob)
{
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}

View File

@ -4,7 +4,6 @@
#include "nsISupports.idl"
interface nsIDOMBlob;
interface nsIInputStream;
interface nsIPresentationAvailabilityListener;
interface nsIPresentationRespondingListener;
@ -12,6 +11,7 @@ interface nsIPresentationSessionListener;
interface nsIPresentationTransportBuilderConstructor;
interface nsIPrincipal;
webidl Blob;
webidl EventTarget;
%{C++
@ -120,7 +120,7 @@ interface nsIPresentationService : nsISupports
*/
void sendSessionBlob(in DOMString sessionId,
in uint8_t role,
in nsIDOMBlob blob);
in Blob blob);
/*
* Close the session.

View File

@ -4,10 +4,11 @@
#include "nsISupports.idl"
interface nsIDOMBlob;
interface nsIInputStream;
interface nsINetAddr;
webidl Blob;
%{C++
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
"@mozilla.org/presentation/presentationtcpsessiontransport;1"
@ -59,7 +60,7 @@ interface nsIPresentationSessionTransport : nsISupports
* Send the blob to the remote endpoint.
* @param blob: The input blob to be sent.
*/
void sendBlob(in nsIDOMBlob blob);
void sendBlob(in Blob blob);
/*
* Close this session transport.

View File

@ -84,7 +84,7 @@ PresentationSessionTransportIPC::SendBinaryMsg(const nsACString& aData)
}
NS_IMETHODIMP
PresentationSessionTransportIPC::SendBlob(nsIDOMBlob* aBlob)
PresentationSessionTransportIPC::SendBlob(Blob* aBlob)
{
return NS_OK;
}

View File

@ -46,7 +46,7 @@ PresentationContentSessionInfo::SendBinaryMsg(const nsACString& aData)
}
nsresult
PresentationContentSessionInfo::SendBlob(nsIDOMBlob* aBlob)
PresentationContentSessionInfo::SendBlob(Blob* aBlob)
{
if (NS_WARN_IF(!mTransport)) {
return NS_ERROR_NOT_AVAILABLE;

View File

@ -44,7 +44,7 @@ public:
nsresult SendBinaryMsg(const nsACString& aData);
nsresult SendBlob(nsIDOMBlob* aBlob);
nsresult SendBlob(Blob* aBlob);
nsresult Close(nsresult aReason);

View File

@ -129,7 +129,7 @@ PresentationIPCService::SendSessionBinaryMsg(const nsAString& aSessionId,
NS_IMETHODIMP
PresentationIPCService::SendSessionBlob(const nsAString& aSessionId,
uint8_t aRole,
nsIDOMBlob* aBlob)
Blob* aBlob)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!aSessionId.IsEmpty());

View File

@ -1971,23 +1971,14 @@ GetLastModifiedTime(nsIFile* aFile, bool aPersistent)
return NS_OK;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
rv = GetLastModifiedTime(file, aTimestamp);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -4228,23 +4219,14 @@ QuotaManager::InitializeRepository(PersistenceType aPersistenceType)
return rv;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> childDirectory = do_QueryInterface(entry);
MOZ_ASSERT(childDirectory);
nsCOMPtr<nsIFile> childDirectory;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(childDirectory)))) && childDirectory) {
bool isDirectory;
rv = childDirectory->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -4316,19 +4298,12 @@ QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
usageInfo = new UsageInfo();
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
NS_ENSURE_SUCCESS(rv, rv);
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
NS_ENSURE_TRUE(file, NS_NOINTERFACE);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -6738,20 +6713,13 @@ QuotaUsageRequestBase::GetUsageForOrigin(QuotaManager* aQuotaManager,
initialized = aQuotaManager->IsTemporaryStorageInitialized();
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
NS_ENSURE_SUCCESS(rv, rv);
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
hasMore && !mCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
NS_ENSURE_TRUE(file, NS_NOINTERFACE);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) &&
file && !mCanceled) {
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -6904,7 +6872,7 @@ GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
return NS_OK;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -6912,18 +6880,9 @@ GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
bool persistent = aPersistenceType == PERSISTENCE_TYPE_PERSISTENT;
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
hasMore && !mCanceled) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
MOZ_ASSERT(originDir);
nsCOMPtr<nsIFile> originDir;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(originDir)))) &&
originDir && !mCanceled) {
bool isDirectory;
rv = originDir->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -7406,7 +7365,7 @@ ClearRequestBase::DeleteFiles(QuotaManager* aQuotaManager,
return;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
if (NS_WARN_IF(NS_FAILED(
directory->GetDirectoryEntries(getter_AddRefs(entries)))) || !entries) {
return;
@ -7423,17 +7382,8 @@ ClearRequestBase::DeleteFiles(QuotaManager* aQuotaManager,
originScope.SetPrefix(prefixSanitized);
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
MOZ_ASSERT(file);
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -8576,23 +8526,15 @@ CreateOrUpgradeDirectoryMetadataHelper::CreateOrUpgradeMetadataFiles()
return NS_OK;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
MOZ_ASSERT(originDir);
nsCOMPtr<nsIFile> originDir;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(originDir)))) &&
originDir) {
nsString leafName;
rv = originDir->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -8742,25 +8684,15 @@ CreateOrUpgradeDirectoryMetadataHelper::MaybeUpgradeOriginDirectory(
}
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
if (NS_WARN_IF(!file)) {
return rv;
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) &&
file) {
nsString leafName;
rv = file->GetLeafName(leafName);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -8908,23 +8840,15 @@ UpgradeStorageFrom0_0To1_0Helper::DoUpgrade()
return NS_OK;
}
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
rv = mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
MOZ_ASSERT(originDir);
nsCOMPtr<nsIFile> originDir;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(originDir)))) &&
originDir) {
bool isDirectory;
rv = originDir->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9041,23 +8965,14 @@ UpgradeStorageFrom1_0To2_0Helper::DoUpgrade()
MOZ_ASSERT(NS_SUCCEEDED(mDirectory->Exists(&exists)));
MOZ_ASSERT(exists);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv = mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
MOZ_ASSERT(originDir);
nsCOMPtr<nsIFile> originDir;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(originDir)))) && originDir) {
bool isDirectory;
rv = originDir->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9153,26 +9068,15 @@ UpgradeStorageFrom1_0To2_0Helper::MaybeUpgradeClients(
QuotaManager* quotaManager = QuotaManager::Get();
MOZ_ASSERT(quotaManager);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv =
aOriginProps.mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
if (NS_WARN_IF(!file)) {
return rv;
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9379,23 +9283,14 @@ UpgradeStorageFrom2_0To2_1Helper::DoUpgrade()
MOZ_ASSERT(NS_SUCCEEDED(mDirectory->Exists(&exists)));
MOZ_ASSERT(exists);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv = mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> originDir = do_QueryInterface(entry);
MOZ_ASSERT(originDir);
nsCOMPtr<nsIFile> originDir;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(originDir)))) && originDir) {
bool isDirectory;
rv = originDir->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9483,26 +9378,15 @@ UpgradeStorageFrom2_0To2_1Helper::MaybeUpgradeClients(
QuotaManager* quotaManager = QuotaManager::Get();
MOZ_ASSERT(quotaManager);
nsCOMPtr<nsISimpleEnumerator> entries;
nsCOMPtr<nsIDirectoryEnumerator> entries;
nsresult rv =
aOriginProps.mDirectory->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
bool hasMore;
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
nsCOMPtr<nsISupports> entry;
rv = entries->GetNext(getter_AddRefs(entry));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
if (NS_WARN_IF(!file)) {
return rv;
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED((rv = entries->GetNextFile(getter_AddRefs(file)))) && file) {
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_WARN_IF(NS_FAILED(rv))) {

View File

@ -66,11 +66,7 @@ NS_IMPL_ADDREF_INHERITED(nsSVGFE,nsSVGFEBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFE,nsSVGFEBase)
NS_INTERFACE_MAP_BEGIN(nsSVGFE)
// nsISupports is an ambiguous base of nsSVGFE so we have to work
// around that
if ( aIID.Equals(NS_GET_IID(nsSVGFE)) )
foundInterface = static_cast<nsISupports*>(static_cast<void*>(this));
else
NS_INTERFACE_MAP_ENTRY_CONCRETE(nsSVGFE)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEBase)
//----------------------------------------------------------------------
@ -245,11 +241,7 @@ NS_IMPL_ADDREF_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransfe
NS_IMPL_RELEASE_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransferFunctionElementBase)
NS_INTERFACE_MAP_BEGIN(SVGComponentTransferFunctionElement)
// nsISupports is an ambiguous base of nsSVGFE so we have to work
// around that
if ( aIID.Equals(NS_GET_IID(SVGComponentTransferFunctionElement)) )
foundInterface = static_cast<nsISupports*>(static_cast<void*>(this));
else
NS_INTERFACE_MAP_ENTRY_CONCRETE(SVGComponentTransferFunctionElement)
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElementBase)

View File

@ -38,6 +38,7 @@ function doTest() {
"profileEnd": "function",
"assert": "function",
"count": "function",
"countReset": "function",
"table": "function",
"clear": "function",
"dirxml": "function",

View File

@ -1886,43 +1886,31 @@ void nsWebBrowserPersist::CleanupLocalFiles()
// recursed through to ensure they are actually empty.
bool isEmptyDirectory = true;
nsCOMArray<nsISimpleEnumerator> dirStack;
nsCOMArray<nsIDirectoryEnumerator> dirStack;
int32_t stackSize = 0;
// Push the top level enum onto the stack
nsCOMPtr<nsISimpleEnumerator> pos;
nsCOMPtr<nsIDirectoryEnumerator> pos;
if (NS_SUCCEEDED(file->GetDirectoryEntries(getter_AddRefs(pos))))
dirStack.AppendObject(pos);
while (isEmptyDirectory && (stackSize = dirStack.Count()))
{
// Pop the last element
nsCOMPtr<nsISimpleEnumerator> curPos;
nsCOMPtr<nsIDirectoryEnumerator> curPos;
curPos = dirStack[stackSize-1];
dirStack.RemoveObjectAt(stackSize - 1);
// Test if the enumerator has any more files in it
bool hasMoreElements = false;
curPos->HasMoreElements(&hasMoreElements);
if (!hasMoreElements)
nsCOMPtr<nsIFile> child;
if (NS_FAILED(curPos->GetNextFile(getter_AddRefs(child))) || !child)
{
continue;
}
// Child files automatically make this code drop out,
// while child dirs keep the loop going.
nsCOMPtr<nsISupports> child;
curPos->GetNext(getter_AddRefs(child));
NS_ASSERTION(child, "No child element, but hasMoreElements says otherwise");
if (!child)
continue;
nsCOMPtr<nsIFile> childAsFile = do_QueryInterface(child);
NS_ASSERTION(childAsFile, "This should be a file but isn't");
bool childIsSymlink = false;
childAsFile->IsSymlink(&childIsSymlink);
child->IsSymlink(&childIsSymlink);
bool childIsDir = false;
childAsFile->IsDirectory(&childIsDir);
child->IsDirectory(&childIsDir);
if (!childIsDir || childIsSymlink)
{
// Some kind of file or symlink which means dir
@ -1931,8 +1919,8 @@ void nsWebBrowserPersist::CleanupLocalFiles()
break;
}
// Push parent enumerator followed by child enumerator
nsCOMPtr<nsISimpleEnumerator> childPos;
childAsFile->GetDirectoryEntries(getter_AddRefs(childPos));
nsCOMPtr<nsIDirectoryEnumerator> childPos;
child->GetDirectoryEntries(getter_AddRefs(childPos));
dirStack.AppendObject(curPos);
if (childPos)
dirStack.AppendObject(childPos);

View File

@ -230,9 +230,13 @@ interface CanvasDrawPath {
void clip(optional CanvasWindingRule winding = "nonzero");
void clip(Path2D path, optional CanvasWindingRule winding = "nonzero");
// NOT IMPLEMENTED void resetClip();
[NeedsSubjectPrincipal]
boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero");
[NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes.
boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero");
[NeedsSubjectPrincipal]
boolean isPointInStroke(double x, double y);
[NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes.
boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
};
@ -274,7 +278,7 @@ interface CanvasImageData {
ImageData createImageData(double sw, double sh);
[NewObject, Throws]
ImageData createImageData(ImageData imagedata);
[NewObject, Throws]
[NewObject, Throws, NeedsSubjectPrincipal]
ImageData getImageData(double sx, double sy, double sw, double sh);
[Throws]
void putImageData(ImageData imagedata, double dx, double dy);

View File

@ -24,6 +24,8 @@ namespace console {
[UseCounter]
void count(optional DOMString label = "default");
[UseCounter]
void countReset(optional DOMString label = "default");
[UseCounter]
void debug(any... data);
[UseCounter]
void error(any... data);
@ -139,7 +141,8 @@ dictionary ConsoleCounter {
};
dictionary ConsoleCounterError {
DOMString error = "maxCountersExceeded";
DOMString label = "";
DOMString error = "";
};
[ChromeOnly,
@ -150,6 +153,7 @@ interface ConsoleInstance {
void assert(optional boolean condition = false, any... data);
void clear();
void count(optional DOMString label = "default");
void countReset(optional DOMString label = "default");
void debug(any... data);
void error(any... data);
void info(any... data);

View File

@ -23,10 +23,10 @@ interface HTMLCanvasElement : HTMLElement {
[Throws]
nsISupports? getContext(DOMString contextId, optional any contextOptions = null);
[Throws]
[Throws, NeedsSubjectPrincipal]
DOMString toDataURL(optional DOMString type = "",
optional any encoderOptions);
[Throws]
[Throws, NeedsSubjectPrincipal]
void toBlob(BlobCallback _callback,
optional DOMString type = "",
optional any encoderOptions);
@ -36,7 +36,7 @@ interface HTMLCanvasElement : HTMLElement {
partial interface HTMLCanvasElement {
[Pure, SetterThrows]
attribute boolean mozOpaque;
[Throws, NeedsCallerType]
[Throws, NeedsSubjectPrincipal]
File mozGetAsFile(DOMString name, optional DOMString? type = null);
// A Mozilla-only extension to get a canvas context backed by double-buffered
// shared memory. Only privileged callers can call this.
@ -45,7 +45,7 @@ partial interface HTMLCanvasElement {
attribute PrintCallback? mozPrintCallback;
[Throws, Pref="canvas.capturestream.enabled"]
[Throws, Pref="canvas.capturestream.enabled", NeedsSubjectPrincipal]
CanvasCaptureMediaStream captureStream(optional double frameRate);
};

View File

@ -82,9 +82,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(CompositionTransaction, EditTransactionBase,
// mRangeList can't lead to cycles
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CompositionTransaction)
if (aIID.Equals(NS_GET_IID(CompositionTransaction))) {
foundInterface = static_cast<nsITransaction*>(this);
} else
NS_INTERFACE_MAP_ENTRY_CONCRETE(CompositionTransaction)
NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMPL_ADDREF_INHERITED(CompositionTransaction, EditTransactionBase)

View File

@ -1045,7 +1045,7 @@ HTMLEditor::InsertObject(const nsACString& aType,
nsCOMPtr<nsINode> node = do_QueryInterface(aDestinationNode);
MOZ_ASSERT(node);
nsCOMPtr<nsIDOMBlob> domBlob = Blob::Create(node->GetOwnerGlobal(), blob);
RefPtr<Blob> domBlob = Blob::Create(node->GetOwnerGlobal(), blob);
NS_ENSURE_TRUE(domBlob, NS_ERROR_FAILURE);
return utils->SlurpBlob(domBlob, node->OwnerDoc()->GetWindow(), br);

View File

@ -52,9 +52,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertTextTransaction, EditTransactionBase,
NS_IMPL_ADDREF_INHERITED(InsertTextTransaction, EditTransactionBase)
NS_IMPL_RELEASE_INHERITED(InsertTextTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(InsertTextTransaction)
if (aIID.Equals(NS_GET_IID(InsertTextTransaction))) {
foundInterface = static_cast<nsITransaction*>(this);
} else
NS_INTERFACE_MAP_ENTRY_CONCRETE(InsertTextTransaction)
NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)

View File

@ -7,9 +7,10 @@
#include "nsISupports.idl"
#include "domstubs.idl"
interface nsIDOMBlob;
interface mozIDOMWindowProxy;
webidl Blob;
[scriptable, builtinclass, uuid(eb8b8ad9-5d8f-43bd-8ce5-5b943c180d56)]
interface nsIEditorBlobListener : nsISupports
{
@ -27,6 +28,6 @@ interface nsIEditorUtils : nsISupports
/**
* Given a blob, returns the data from that blob, asynchronously.
*/
void slurpBlob(in nsIDOMBlob aBlob, in mozIDOMWindowProxy aScope,
void slurpBlob(in Blob aBlob, in mozIDOMWindowProxy aScope,
in nsIEditorBlobListener aListener);
};

View File

@ -13,12 +13,8 @@ UNIFIED_SOURCES += [
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_SYSTEM_HUNSPELL']:
CXXFLAGS += CONFIG['MOZ_HUNSPELL_CFLAGS']
else:
LOCAL_INCLUDES += ['../src']
LOCAL_INCLUDES += [
'../src',
'/dom/base',
'/extensions/spellcheck/src',
]
@ -34,6 +30,6 @@ EXPORTS.mozilla += [
'RemoteSpellCheckEngineParent.h',
]
# This variable is referenced in configure.in. Make sure to change that file
# too if you need to change this variable.
# This variable is referenced in mozilla-config.h.in. Make sure to change
# that file too if you need to change this variable.
DEFINES['HUNSPELL_STATIC'] = True

View File

@ -421,15 +421,11 @@ mozHunspell::LoadDictionariesFromDir(nsIFile* aDir)
if (NS_FAILED(rv) || !check)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsISimpleEnumerator> e;
rv = aDir->GetDirectoryEntries(getter_AddRefs(e));
nsCOMPtr<nsIDirectoryEnumerator> files;
rv = aDir->GetDirectoryEntries(getter_AddRefs(files));
if (NS_FAILED(rv))
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDirectoryEnumerator> files(do_QueryInterface(e));
if (!files)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(file))) && file) {
nsAutoString leafName;

View File

@ -4,9 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['glue']
if not CONFIG['MOZ_SYSTEM_HUNSPELL']:
DIRS += ['src']
DIRS += ['glue', 'src']
if CONFIG['ENABLE_TESTS']:
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']

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