Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2016-09-14 12:11:09 +02:00
Родитель 794b92fe7b d2c3fe7fd3
Коммит 9a2448ee1c
263 изменённых файлов: 3084 добавлений и 2552 удалений

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

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1288460 requires another clobber due to bug 1298779.
Bug 1302429 to fix also bustage.

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

@ -1507,3 +1507,14 @@ pref("print.use_simplify_page", true);
// Space separated list of URLS that are allowed to send objects (instead of
// only strings) through webchannels. This list is duplicated in mobile/android/app/mobile.js
pref("webchannel.allowObject.urlWhitelist", "https://accounts.firefox.com https://content.cdn.mozilla.net https://input.mozilla.org https://support.mozilla.org https://install.mozilla.org");
// Whether or not the browser should scan for unsubmitted
// crash reports, and then show a notification for submitting
// those reports.
#ifdef RELEASE_BUILD
pref("browser.crashReports.unsubmittedCheck.enabled", false);
#else
pref("browser.crashReports.unsubmittedCheck.enabled", true);
#endif
pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);

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

@ -777,13 +777,6 @@ html|*#fullscreen-exit-button {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#click-to-play-plugins-notification");
}
#login-fill-notification {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#login-fill-notification");
}
.login-fill-item {
-moz-binding: url("chrome://passwordmgr/content/login.xml#login");
}
.plugin-popupnotification-centeritem {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#plugin-popupnotification-center-item");
@ -1185,10 +1178,6 @@ toolbarpaletteitem[place="palette"][hidden] {
display: none;
}
#login-fill-doorhanger:not([inDetailView]) > #login-fill-clickcapturer {
pointer-events: none;
}
.popup-notification-invalid-input {
box-shadow: 0 0 1.5px 1px red;
}

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

@ -718,8 +718,6 @@
tooltiptext="&urlbar.addonsNotificationAnchor.tooltip;"/>
<image id="indexedDB-notification-icon" class="notification-anchor-icon indexedDB-icon" role="button"
tooltiptext="&urlbar.indexedDBNotificationAnchor.tooltip;"/>
<image id="login-fill-notification-icon" class="notification-anchor-icon login-icon" role="button"
tooltiptext="&urlbar.loginFillNotificationAnchor.tooltip;"/>
<image id="password-notification-icon" class="notification-anchor-icon login-icon" role="button"
tooltiptext="&urlbar.passwordNotificationAnchor.tooltip;"/>
<image id="plugins-notification-icon" class="notification-anchor-icon plugin-icon" role="button"

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

@ -52,22 +52,6 @@
</popupnotificationcontent>
</popupnotification>
<stack id="login-fill-doorhanger" hidden="true">
<vbox id="login-fill-mainview">
<description id="login-fill-testing"
value="Thanks for testing the login fill doorhanger!"/>
<textbox id="login-fill-filter"/>
<richlistbox id="login-fill-list"/>
</vbox>
<vbox id="login-fill-clickcapturer"/>
<vbox id="login-fill-details">
<textbox id="login-fill-username" readonly="true"/>
<textbox id="login-fill-password" type="password" disabled="true"/>
<hbox>
<button id="login-fill-use" label="Use in form"/>
</hbox>
</vbox>
</stack>
<popupnotification id="addon-progress-notification" hidden="true">
<popupnotificationcontent orient="vertical">

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

@ -543,6 +543,7 @@ function test() {
yield expectNoObserverCalled();
}
}).then(finish, ex => {
Cu.reportError(ex);
ok(false, "Unexpected Exception: " + ex);
finish();
});

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

@ -93,6 +93,7 @@ function test() {
yield test.run();
}
}).then(finish, ex => {
Cu.reportError(ex);
ok(false, "Unexpected Exception: " + ex);
finish();
});

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

@ -262,6 +262,7 @@ function test() {
yield expectNoObserverCalled();
}
}).then(finish, ex => {
Cu.reportError(ex);
ok(false, "Unexpected Exception: " + ex);
finish();
});

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

@ -95,6 +95,7 @@ function test() {
yield expectNoObserverCalled();
}
}).then(finish, ex => {
Cu.reportError(ex);
ok(false, "Unexpected Exception: " + ex);
finish();
});

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

@ -2478,16 +2478,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
</handlers>
</binding>
<!-- This is the XBL notification definition for the login fill doorhanger,
which is empty because the actual panel is not implemented inside an XBL
binding, but made of elements added to the notification panel. This
allows accessing the full structure while the panel is hidden. -->
<binding id="login-fill-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
<content>
<children/>
</content>
</binding>
<binding id="splitmenu">
<content>
<xul:hbox anonid="menuitem" flex="1"

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

@ -71,6 +71,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UnsubmittedCrashHandler",
"resource:///modules/ContentCrashHandlers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
"resource://gre/modules/CrashSubmit.jsm");
}
@ -714,6 +716,7 @@ BrowserGlue.prototype = {
TabCrashHandler.init();
if (AppConstants.MOZ_CRASHREPORTER) {
PluginCrashReporter.init();
UnsubmittedCrashHandler.init();
}
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
@ -744,64 +747,6 @@ BrowserGlue.prototype = {
}
},
checkForPendingCrashReports: function() {
// We don't process crash reports older than 28 days, so don't bother submitting them
const PENDING_CRASH_REPORT_DAYS = 28;
if (AppConstants.MOZ_CRASHREPORTER) {
let dateLimit = new Date();
dateLimit.setDate(dateLimit.getDate() - PENDING_CRASH_REPORT_DAYS);
CrashSubmit.pendingIDsAsync(dateLimit).then(
function onSuccess(ids) {
let count = ids.length;
if (count) {
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win) {
return;
}
let nb = win.document.getElementById("global-notificationbox");
let notification = nb.getNotificationWithValue("pending-crash-reports");
if (notification) {
return;
}
let buttons = [
{
label: win.gNavigatorBundle.getString("pendingCrashReports.submitAll"),
callback: function() {
ids.forEach(function(id) {
CrashSubmit.submit(id, {extraExtraKeyVals: {"SubmittedFromInfobar": true}});
});
}
},
{
label: win.gNavigatorBundle.getString("pendingCrashReports.ignoreAll"),
callback: function() {
ids.forEach(function(id) {
CrashSubmit.ignore(id);
});
}
},
{
label: win.gNavigatorBundle.getString("pendingCrashReports.viewAll"),
callback: function() {
win.openUILinkIn("about:crashes", "tab");
return true;
}
}
];
nb.appendNotification(PluralForm.get(count,
win.gNavigatorBundle.getString("pendingCrashReports.label")).replace("#1", count),
"pending-crash-reports",
"chrome://browser/skin/tab-crashed.svg",
nb.PRIORITY_INFO_HIGH, buttons);
}
},
function onError(err) {
Cu.reportError(err);
}
);
}
},
_onSafeModeRestart: function BG_onSafeModeRestart() {
// prompt the user to confirm
let strings = gBrowserBundle;
@ -1070,10 +1015,6 @@ BrowserGlue.prototype = {
this._checkForOldBuildUpdates();
if (!AppConstants.RELEASE_BUILD) {
this.checkForPendingCrashReports();
}
CaptivePortalWatcher.init();
AutoCompletePopup.init();

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

@ -60,10 +60,7 @@ var gAdvancedPane = {
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
}
if (AppConstants.MOZ_CRASHREPORTER) {
setEventListener("submitCrashesBox", "command",
gAdvancedPane.updateSubmitCrashes);
}
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
setEventListener("clearCacheButton", "command",
@ -243,28 +240,6 @@ var gAdvancedPane = {
{
this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
"crashReporterLearnMore");
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
checkbox.checked = cr.submitReports;
} catch (e) {
checkbox.style.display = "none";
}
},
/**
*
*/
updateSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
getService(Components.interfaces.nsICrashReporter);
cr.submitReports = checkbox.checked;
} catch (e) { }
},
/**
@ -762,9 +737,7 @@ var gAdvancedPane = {
*/
showCertificates: function ()
{
openDialog("chrome://pippki/content/certManager.xul",
"mozilla:certmanager",
"modal=yes", null);
gSubDialog.open("chrome://pippki/content/certManager.xul");
},
/**

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

@ -54,6 +54,13 @@
type="bool"/>
#endif
<!-- Data Choices tab -->
#ifdef MOZ_CRASHREPORTER
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit"
name="browser.crashReports.unsubmittedCheck.autoSubmit"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
@ -229,11 +236,13 @@
#ifdef MOZ_CRASHREPORTER
<groupbox>
<caption>
<checkbox id="submitCrashesBox" label="&enableCrashReporter.label;"
accesskey="&enableCrashReporter.accesskey;"/>
<checkbox id="automaticallySubmitCrashesBox"
preference="browser.crashReports.unsubmittedCheck.autoSubmit"
label="&alwaysSubmitCrashReports.label;"
accesskey="&alwaysSubmitCrashReports.accesskey;"/>
</caption>
<hbox class="indent">
<label flex="1">&crashReporterDesc.label;</label>
<label flex="1">&crashReporterDesc2.label;</label>
<spacer flex="10"/>
<label id="crashReporterLearnMore"
class="text-link">&crashReporterLearnMore.label;</label>

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

@ -29,11 +29,11 @@
"unpack": true
},
{
"version": "Visual Studio 2015 Update 2 / SDK 10.0.10586.0/212",
"size": 332442800,
"digest": "995394a4a515c7cb0f8595f26f5395361a638870dd0bbfcc22193fe1d98a0c47126057d5999cc494f3f3eac5cb49160e79757c468f83ee5797298e286ef6252c",
"version": "Visual Studio 2015 Update 3 14.0.25425.01 / SDK 10.0.14393.0",
"size": 326656969,
"digest": "babc414ffc0457d27f5a1ed24a8e4873afbe2f1c1a4075469a27c005e1babc3b2a788f643f825efedff95b79686664c67ec4340ed535487168a3482e68559bc7",
"algorithm": "sha512",
"filename": "vs2015u2.zip",
"filename": "vs2015u3.zip",
"unpack": true
}
]

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

@ -30,11 +30,11 @@
"unpack": true
},
{
"version": "Visual Studio 2015 Update 2 / SDK 10.0.10586.0/212",
"size": 332442800,
"digest": "995394a4a515c7cb0f8595f26f5395361a638870dd0bbfcc22193fe1d98a0c47126057d5999cc494f3f3eac5cb49160e79757c468f83ee5797298e286ef6252c",
"version": "Visual Studio 2015 Update 3 14.0.25425.01 / SDK 10.0.14393.0",
"size": 326656969,
"digest": "babc414ffc0457d27f5a1ed24a8e4873afbe2f1c1a4075469a27c005e1babc3b2a788f643f825efedff95b79686664c67ec4340ed535487168a3482e68559bc7",
"algorithm": "sha512",
"filename": "vs2015u2.zip",
"filename": "vs2015u3.zip",
"unpack": true
}
]

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

@ -211,7 +211,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY urlbar.geolocationNotificationAnchor.tooltip "Open location request panel">
<!ENTITY urlbar.addonsNotificationAnchor.tooltip "Open add-on installation message panel">
<!ENTITY urlbar.indexedDBNotificationAnchor.tooltip "Open offline storage message panel">
<!ENTITY urlbar.loginFillNotificationAnchor.tooltip "Manage your login information">
<!ENTITY urlbar.passwordNotificationAnchor.tooltip "Open save password message panel">
<!ENTITY urlbar.pluginsNotificationAnchor.tooltip "Manage plug-in use">
<!ENTITY urlbar.webNotificationAnchor.tooltip "Change whether you can receive notifications from the site">

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

@ -730,10 +730,10 @@ tabgroups.migration.tabGroupBookmarkFolderName = Bookmarked Tab Groups
# LOCALIZATION NOTE (pendingCrashReports.label): Semi-colon list of plural forms
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of pending crash reports
pendingCrashReports.label = You have an unsubmitted crash report;You have #1 unsubmitted crash reports
pendingCrashReports2.label = You have an unsent crash report;You have #1 unsent crash reports
pendingCrashReports.viewAll = View
pendingCrashReports.submitAll = Submit
pendingCrashReports.ignoreAll = Ignore
pendingCrashReports.send = Send
pendingCrashReports.alwaysSend = Always Send
decoder.noCodecs.button = Learn how
decoder.noCodecs.accesskey = L

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

@ -40,10 +40,10 @@
<!ENTITY enableTelemetryData.accesskey "T">
<!ENTITY telemetryLearnMore.label "Learn More">
<!ENTITY crashReporterDesc.label "&brandShortName; submits crash reports to help &vendorShortName; make your browser more stable and secure">
<!ENTITY enableCrashReporter.label "Enable Crash Reporter">
<!ENTITY enableCrashReporter.accesskey "C">
<!ENTITY crashReporterLearnMore.label "Learn More">
<!ENTITY crashReporterDesc2.label "Crash reports help &vendorShortName; fix problems and make your browser more stable and secure">
<!ENTITY alwaysSubmitCrashReports.label "Allow &brandShortName; to send backlogged crash reports on your behalf">
<!ENTITY alwaysSubmitCrashReports.accesskey "c">
<!ENTITY crashReporterLearnMore.label "Learn More">
<!ENTITY networkTab.label "Network">

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

@ -8,7 +8,9 @@ var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "TabCrashHandler", "PluginCrashReporter" ];
this.EXPORTED_SYMBOLS = [ "TabCrashHandler",
"PluginCrashReporter",
"UnsubmittedCrashHandler" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -21,6 +23,21 @@ XPCOMUtils.defineLazyModuleGetter(this, "RemotePages",
"resource://gre/modules/RemotePageManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
"resource:///modules/sessionstore/SessionStore.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
"resource:///modules/RecentWindow.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
const url = "chrome://browser/locale/browser.properties";
return Services.strings.createBundle(url);
});
// We don't process crash reports older than 28 days, so don't bother
// submitting them
const PENDING_CRASH_REPORT_DAYS = 28;
this.TabCrashHandler = {
_crashedTabCount: 0,
@ -319,6 +336,204 @@ this.TabCrashHandler = {
},
}
/**
* This component is responsible for scanning the pending
* crash report directory for reports, and (if enabled), to
* prompt the user to submit those reports. It might also
* submit those reports automatically without prompting if
* the user has opted in.
*/
this.UnsubmittedCrashHandler = {
init() {
if (this.initialized) {
return;
}
this.initialized = true;
let pref = "browser.crashReports.unsubmittedCheck.enabled";
let shouldCheck = Services.prefs.getBoolPref(pref);
if (shouldCheck) {
Services.obs.addObserver(this, "browser-delayed-startup-finished",
false);
}
},
observe(subject, topic, data) {
if (topic != "browser-delayed-startup-finished") {
return;
}
Services.obs.removeObserver(this, topic);
this.checkForUnsubmittedCrashReports();
},
/**
* Scans the profile directory for unsubmitted crash reports
* within the past PENDING_CRASH_REPORT_DAYS days. If it
* finds any, it will, if necessary, attempt to open a notification
* bar to prompt the user to submit them.
*
* @returns Promise
* Resolves after it tries to append a notification on
* the most recent browser window. If a notification
* cannot be shown, will resolve anyways.
*/
checkForUnsubmittedCrashReports: Task.async(function*() {
let dateLimit = new Date();
dateLimit.setDate(dateLimit.getDate() - PENDING_CRASH_REPORT_DAYS);
let reportIDs = [];
try {
reportIDs = yield CrashSubmit.pendingIDsAsync(dateLimit);
} catch (e) {
Cu.reportError(e);
return;
}
if (reportIDs.length) {
if (CrashNotificationBar.autoSubmit) {
CrashNotificationBar.submitReports(reportIDs);
} else {
this.showPendingSubmissionsNotification(reportIDs);
}
}
}),
/**
* Given an array of unsubmitted crash report IDs, try to open
* up a notification asking the user to submit them.
*
* @param reportIDs (Array<string>)
* The Array of report IDs to offer the user to send.
*/
showPendingSubmissionsNotification(reportIDs) {
let count = reportIDs.length;
if (!count) {
return;
}
let messageTemplate =
gNavigatorBundle.GetStringFromName("pendingCrashReports2.label");
let message = PluralForm.get(count, messageTemplate).replace("#1", count);
CrashNotificationBar.show({
notificationID: "pending-crash-reports",
message,
reportIDs,
});
},
};
this.CrashNotificationBar = {
/**
* Attempts to show a notification bar to the user in the most
* recent browser window asking them to submit some crash report
* IDs. If a notification cannot be shown (for example, there
* is no browser window), this method exits silently.
*
* The notification will allow the user to submit their crash
* reports. If the user dismissed the notification, the crash
* reports will be marked to be ignored (though they can
* still be manually submitted via about:crashes).
*
* @param JS Object
* An Object with the following properties:
*
* notificationID (string)
* The ID for the notification to be opened.
*
* message (string)
* The message to be displayed in the notification.
*
* reportIDs (Array<string>)
* The array of report IDs to offer to the user.
*/
show({ notificationID, message, reportIDs }) {
let chromeWin = RecentWindow.getMostRecentBrowserWindow();
if (!chromeWin) {
// Can't show a notification in this case. We'll hopefully
// get another opportunity to have the user submit their
// crash reports later.
return;
}
let nb = chromeWin.document.getElementById("global-notificationbox");
let notification = nb.getNotificationWithValue(notificationID);
if (notification) {
return;
}
let buttons = [{
label: gNavigatorBundle.GetStringFromName("pendingCrashReports.send"),
callback: () => {
this.submitReports(reportIDs);
},
},
{
label: gNavigatorBundle.GetStringFromName("pendingCrashReports.alwaysSend"),
callback: () => {
this.autoSubmit = true;
this.submitReports(reportIDs);
},
},
{
label: gNavigatorBundle.GetStringFromName("pendingCrashReports.viewAll"),
callback: function() {
chromeWin.openUILinkIn("about:crashes", "tab");
return true;
},
}];
let eventCallback = (eventType) => {
if (eventType == "dismissed") {
// The user intentionally dismissed the notification,
// which we interpret as meaning that they don't care
// to submit the reports. We'll ignore these particular
// reports going forward.
reportIDs.forEach(function(reportID) {
CrashSubmit.ignore(reportID);
});
}
};
nb.appendNotification(message, notificationID,
"chrome://browser/skin/tab-crashed.svg",
nb.PRIORITY_INFO_HIGH, buttons,
eventCallback);
},
get autoSubmit() {
return Services.prefs
.getBoolPref("browser.crashReports.unsubmittedCheck.autoSubmit");
},
set autoSubmit(val) {
Services.prefs.setBoolPref("browser.crashReports.unsubmittedCheck.autoSubmit",
val);
},
/**
* Attempt to submit reports to the crash report server. Each
* report will have the "SubmittedFromInfobar" extra key set
* to true.
*
* @param reportIDs (Array<string>)
* The array of reportIDs to submit.
*/
submitReports(reportIDs) {
for (let reportID of reportIDs) {
CrashSubmit.submit(reportID, {
extraExtraKeyVals: {
"SubmittedFromInfobar": true,
},
});
}
},
};
this.PluginCrashReporter = {
/**
* Makes the PluginCrashReporter ready to hear about and

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

@ -1745,7 +1745,6 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton:not(:h
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
}
%include ../shared/login-doorhanger.inc.css
%include downloads/indicator.css

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

@ -3155,7 +3155,6 @@ menulist.translate-infobar-element > .menulist-dropmarker {
%include ../../../devtools/client/themes/responsivedesign.inc.css
%include ../../../devtools/client/themes/commandline.inc.css
%include ../shared/plugin-doorhanger.inc.css
%include ../shared/login-doorhanger.inc.css
%include downloads/indicator.css

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

@ -1,79 +0,0 @@
#notification-popup[popupid="login-fill"] > .panel-arrowcontainer > .panel-arrowcontent {
/* Since we display a sliding subview that extends to the border, we cannot
* keep the default padding of arrow panels. We use the same padding in the
* individual content views instead. Since we removed the padding, we also
* have to ensure the contents are clipped to the border box. */
padding: 0;
overflow: hidden;
}
#login-fill-mainview,
#login-fill-details {
padding: var(--panel-arrowcontent-padding);
}
#login-fill-doorhanger[inDetailView] > #login-fill-mainview {
transform: translateX(-14px);
}
#login-fill-mainview,
#login-fill-details {
transition: transform 150ms;
}
#login-fill-doorhanger:not([inDetailView]) > #login-fill-details {
transform: translateX(105%);
}
#login-fill-doorhanger:not([inDetailView]) > #login-fill-details:-moz-locale-dir(rtl) {
transform: translateX(-105%);
}
#login-fill-doorhanger[inDetailView] > #login-fill-clickcapturer {
background-color: hsla(210,4%,10%,.1);
}
#login-fill-testing {
color: #b33;
font-weight: bold;
}
#login-fill-list {
border: 1px solid black;
max-height: 20em;
}
.login-fill-item[disabled] {
color: #888;
background-color: #fff;
}
.login-fill-item[disabled][selected] {
background-color: #eef;
}
.login-hostname {
margin: 4px;
font-weight: bold;
}
.login-fill-item.different-hostname > .login-hostname {
color: #888;
font-style: italic;
}
.login-username {
margin: 4px;
color: #888;
}
#login-fill-details {
padding: 4px;
background: var(--panel-arrowcontent-background);
color: var(--panel-arrowcontent-color);
background-clip: padding-box;
border-left: 1px solid hsla(210,4%,10%,.3);
box-shadow: 0 3px 5px hsla(210,4%,10%,.1),
0 0 7px hsla(210,4%,10%,.1);
margin-inline-start: 38px;
}

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

@ -129,11 +129,6 @@
list-style-image: url(chrome://browser/skin/notification-icons.svg#login-detailed);
}
#login-fill-notification-icon {
/* Temporary solution until the capture and fill doorhangers are unified. */
transform: scaleX(-1);
}
.camera-icon,
.popup-notification-icon[popupid="webRTC-shareDevices"] {
list-style-image: url(chrome://browser/skin/notification-icons.svg#camera);

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

@ -2434,7 +2434,6 @@ notification.pluginVulnerable > .notification-inner > .messageCloseButton {
}
}
%include ../shared/login-doorhanger.inc.css
%include downloads/indicator.css

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

@ -10,21 +10,19 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
Cu.import("resource://testing-common/TestUtils.jsm");
Cu.import("resource://testing-common/ContentTask.jsm");
this.Preferences = {
init(libDir) {
Services.prefs.setBoolPref("browser.preferences.inContent", true);
let panes = [
["paneGeneral", null],
["paneSearch", null],
["paneContent", null],
["paneApplications", null],
["panePrivacy", null],
["panePrivacy", null, DNTDialog],
["paneSecurity", null],
["paneSync", null],
["paneAdvanced", "generalTab"],
@ -32,40 +30,41 @@ this.Preferences = {
["paneAdvanced", "networkTab"],
["paneAdvanced", "updateTab"],
["paneAdvanced", "encryptionTab"],
["paneAdvanced", "encryptionTab", certManager],
];
for (let [primary, advanced] of panes) {
for (let [primary, advanced, customFn] of panes) {
let configName = primary.replace(/^pane/, "prefs") + (advanced ? "-" + advanced : "");
if (customFn) {
configName += "-" + customFn.name;
}
this.configurations[configName] = {};
this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced);
this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced, customFn);
}
},
configurations: {
"panePrivacy-DNTDialog": {
applyConfig: Task.async(function*() {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
yield prefHelper("panePrivacy", null);
yield ContentTask.spawn(browserWindow.gBrowser.selectedBrowser, null, function* () {
content.document.getElementById("doNotTrackSettings").click();
});
}),
},
},
configurations: {},
};
let prefHelper = Task.async(function*(primary, advanced) {
let prefHelper = Task.async(function*(primary, advanced = null, customFn = null) {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let selectedBrowser = browserWindow.gBrowser;
let selectedBrowser = browserWindow.gBrowser.selectedBrowser;
// close any dialog that might still be open
yield ContentTask.spawn(selectedBrowser, null, function*() {
if (!content.window.gSubDialog) {
return;
}
content.window.gSubDialog.close();
});
let readyPromise = null;
if (selectedBrowser.currentURI.specIgnoringRef == "about:preferences") {
readyPromise = new Promise((resolve) => {
browserWindow.addEventListener("MozAfterPaint", function paneSwitch() {
browserWindow.removeEventListener("MozAfterPaint", paneSwitch);
resolve();
});
});
if (selectedBrowser.currentURI.spec == "about:preferences#" + primary.replace(/^pane/, "")) {
// We're already on the correct pane.
readyPromise = Promise.resolve();
} else {
readyPromise = paintPromise(browserWindow);
}
} else {
readyPromise = TestUtils.topicObserved("advanced-pane-loaded");
}
@ -78,8 +77,30 @@ let prefHelper = Task.async(function*(primary, advanced) {
yield readyPromise;
// close any dialog that might still be open
yield ContentTask.spawn(selectedBrowser.selectedBrowser, null, function*() {
content.window.gSubDialog.close();
});
if (customFn) {
let customPaintPromise = paintPromise(browserWindow);
yield* customFn(selectedBrowser);
yield customPaintPromise;
}
});
function paintPromise(browserWindow) {
return new Promise((resolve) => {
browserWindow.addEventListener("MozAfterPaint", function onPaint() {
browserWindow.removeEventListener("MozAfterPaint", onPaint);
resolve();
});
});
}
function* DNTDialog(aBrowser) {
yield ContentTask.spawn(aBrowser, null, function* () {
content.document.getElementById("doNotTrackSettings").click();
});
}
function* certManager(aBrowser) {
yield ContentTask.spawn(aBrowser, null, function* () {
content.document.getElementById("viewCertificatesButton").click();
});
}

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

@ -51,7 +51,7 @@ Once Visual Studio 2015 Community has been installed, from a checkout
of mozilla-central, run something like the following to produce a ZIP
archive::
$ ./mach python build/windows_toolchain.py create-zip vs2015u2
$ ./mach python build/windows_toolchain.py create-zip vs2015u3
The produced archive will be the argument to ``create-zip`` + ``.zip``.

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

@ -274,9 +274,11 @@ def get_compiler_info(compiler, language):
raise FatalCheckError(
'Unknown compiler or compiler not supported.')
# Metadata emitted by preprocessors such as GCC with LANG=ja_JP.utf-8 may
# have non-ASCII characters. Treat the output as bytearray.
data = {}
for line in result.splitlines():
if line.startswith('%'):
if line.startswith(b'%'):
k, _, v = line.partition(' ')
k = k.lstrip('%')
data[k] = v.replace(' ', '').lstrip('"').rstrip('"')

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

@ -1,6 +1,6 @@
if [ -z "${VSPATH}" ]; then
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2015u2"
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2015u3"
fi
VSWINPATH="$(cd ${VSPATH} && pwd -W)"
@ -12,8 +12,8 @@ export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
export PATH="${VSPATH}/VC/bin/amd64_x86:${VSPATH}/VC/bin/amd64:${VSPATH}/VC/bin:${VSPATH}/SDK/bin/x86:${VSPATH}/SDK/bin/x64:${VSPATH}/DIA SDK/bin:${PATH}"
export PATH="${VSPATH}/VC/redist/x86/Microsoft.VC140.CRT:${VSPATH}/VC/redist/x64/Microsoft.VC140.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${PATH}"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.10586.0/ucrt:${VSPATH}/SDK/Include/10.0.10586.0/shared:${VSPATH}/SDK/Include/10.0.10586.0/um:${VSPATH}/SDK/Include/10.0.10586.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib:${VSPATH}/VC/atlmfc/lib:${VSPATH}/SDK/lib/10.0.10586.0/ucrt/x86:${VSPATH}/SDK/lib/10.0.10586.0/um/x86:${VSPATH}/DIA SDK/lib"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.14393.0/ucrt:${VSPATH}/SDK/Include/10.0.14393.0/shared:${VSPATH}/SDK/Include/10.0.14393.0/um:${VSPATH}/SDK/Include/10.0.14393.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib:${VSPATH}/VC/atlmfc/lib:${VSPATH}/SDK/lib/10.0.14393.0/ucrt/x86:${VSPATH}/SDK/lib/10.0.14393.0/um/x86:${VSPATH}/DIA SDK/lib"
. $topsrcdir/build/mozconfig.vs-common

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

@ -1,6 +1,6 @@
if [ -z "${VSPATH}" ]; then
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2015u2"
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2015u3"
fi
VSWINPATH="$(cd ${VSPATH} && pwd -W)"
@ -11,8 +11,8 @@ export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
export PATH="${VSPATH}/VC/bin/amd64:${VSPATH}/VC/bin:${VSPATH}/SDK/bin/x64:${VSPATH}/VC/redist/x64/Microsoft.VC140.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${VSPATH}/DIA SDK/bin/amd64:${PATH}"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.10586.0/ucrt:${VSPATH}/SDK/Include/10.0.10586.0/shared:${VSPATH}/SDK/Include/10.0.10586.0/um:${VSPATH}/SDK/Include/10.0.10586.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib/amd64:${VSPATH}/VC/atlmfc/lib/amd64:${VSPATH}/SDK/lib/10.0.10586.0/ucrt/x64:${VSPATH}/SDK/lib/10.0.10586.0/um/x64:${VSPATH}/DIA SDK/lib/amd64"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.14393.0/ucrt:${VSPATH}/SDK/Include/10.0.14393.0/shared:${VSPATH}/SDK/Include/10.0.14393.0/um:${VSPATH}/SDK/Include/10.0.14393.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib/amd64:${VSPATH}/VC/atlmfc/lib/amd64:${VSPATH}/SDK/lib/10.0.14393.0/ucrt/x64:${VSPATH}/SDK/lib/10.0.14393.0/um/x64:${VSPATH}/DIA SDK/lib/amd64"
. $topsrcdir/build/mozconfig.vs-common

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

@ -84,7 +84,7 @@ VS_PATTERNS = [
},
]
SDK_RELEASE = '10.0.10586.0'
SDK_RELEASE = '10.0.14393.0'
# Files from the Windows 10 SDK to install.
SDK_PATTERNS = [

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

@ -59,7 +59,11 @@
#pragma warning( push )
#pragma warning( disable : 4275 4530 )
#ifdef __clang__
#include_next <${HEADER}>
#else
#include <${HEADER_PATH}>
#endif
#pragma warning( pop )

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

@ -82,11 +82,11 @@ function addTab(url, win, backgroundTab = false) {
}
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
info("Tab added and finished loading: " + url);
done(tab);
}, true);
BrowserTestUtils.browserLoaded(linkedBrowser)
.then(function () {
info("Tab added and finished loading: " + url);
done(tab);
});
});
}

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

@ -81,11 +81,11 @@ function addTab(aUrl, aWindow) {
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
}, true);
BrowserTestUtils.browserLoaded(linkedBrowser)
.then(function () {
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
});
return deferred.promise;
}

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

@ -91,11 +91,11 @@ this.addTab = function addTab(aUrl, aWindow) {
info("Loading frame script with url " + FRAME_SCRIPT_URL + ".");
linkedBrowser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
}, true);
BrowserTestUtils.browserLoaded(linkedBrowser)
.then(function () {
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
});
return deferred.promise;
};

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

@ -5,7 +5,9 @@
// Tests that the keybindings for opening and closing the inspector work as expected
// Can probably make this a shared test that tests all of the tools global keybindings
const TEST_URL = "data:text/html,<html><head><title>Test for the " +
"highlighter keybindings</title></head><body>" +
"<h1>Keybindings!</h1></body></html>"
function test()
{
waitForExplicitFinish();
@ -15,17 +17,11 @@ function test()
let inspector;
let keysetMap = { };
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
addTab(TEST_URL).then(function () {
doc = content.document;
node = doc.querySelector("h1");
waitForFocus(setupKeyBindingsTest);
}, true);
content.location = "data:text/html,<html><head><title>Test for the " +
"highlighter keybindings</title></head><body>" +
"<h1>Keybindings!</h1></body></html>";
});
function buildDevtoolsKeysetMap(keyset) {
[].forEach.call(keyset.querySelectorAll("key"), function (key) {

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

@ -3,28 +3,25 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URL = "data:text/html,test custom host";
function test() {
let {Toolbox} = require("devtools/client/framework/toolbox");
let toolbox, iframe, target, tab;
gBrowser.selectedTab = gBrowser.addTab();
target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox, iframe, target;
window.addEventListener("message", onMessage);
iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
addTab(TEST_URL).then(function (tab) {
target = TargetFactory.forTab(tab);
let options = {customIframe: iframe};
gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options)
.then(testCustomHost, console.error)
.then(null, console.error);
}, true);
content.location = "data:text/html,test custom host";
});
function onMessage(event) {
info("onMessage: " + event.data);
@ -50,7 +47,7 @@ function test() {
// toolbox.destroy() returns a singleton promise that ensures
// everything is cleaned up before proceeding.
toolbox.destroy().then(() => {
toolbox = iframe = target = tab = null;
toolbox = iframe = target = null;
finish();
});
}

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

@ -3,19 +3,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URL = "data:text/html,test for dynamically registering and unregistering tools";
var toolbox;
function test()
{
gBrowser.selectedTab = gBrowser.addTab();
let target = TargetFactory.forTab(gBrowser.selectedTab);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
addTab(TEST_URL).then(tab => {
let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target).then(testRegister);
}, true);
content.location = "data:text/html,test for dynamically registering and unregistering tools";
});
}
function testRegister(aToolbox)

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

@ -6,23 +6,19 @@
/* import-globals-from shared-head.js */
"use strict";
const TEST_URL = "data:text/html;charset=utf8,test for dynamically " +
"registering and unregistering tools";
var doc = null, toolbox = null, panelWin = null, modifiedPrefs = [];
function test() {
gBrowser.selectedTab = gBrowser.addTab();
let target = TargetFactory.forTab(gBrowser.selectedTab);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
addTab(TEST_URL).then(tab => {
let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target)
.then(testSelectTool)
.then(testToggleToolboxButtons)
.then(testPrefsAreRespectedWhenReopeningToolbox)
.then(cleanup, errorHandler);
}, true);
content.location = "data:text/html;charset=utf8,test for dynamically " +
"registering and unregistering tools";
});
}
function testPrefsAreRespectedWhenReopeningToolbox() {

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

@ -8,15 +8,10 @@
const TEST_URI = URL_ROOT + "browser_toolbox_options_disable_js.html";
function test() {
gBrowser.selectedTab = gBrowser.addTab();
let target = TargetFactory.forTab(gBrowser.selectedTab);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
addTab(TEST_URI).then(tab => {
let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target).then(testSelectTool);
}, true);
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI);
});
}
function testSelectTool(toolbox) {

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

@ -31,19 +31,15 @@ function test() {
}
function init() {
let tab = gBrowser.selectedTab = gBrowser.addTab();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let linkedBrowser = tab.linkedBrowser;
addTab(TEST_URI).then(tab => {
let target = TargetFactory.forTab(tab);
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.messageManager.loadFrameScript(COMMON_FRAME_SCRIPT_URL, false);
linkedBrowser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);
linkedBrowser.messageManager.loadFrameScript(COMMON_FRAME_SCRIPT_URL, false);
linkedBrowser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
gDevTools.showToolbox(target).then(testSelectTool);
}, true);
content.location = TEST_URI;
});
}
function testSelectTool(aToolbox) {

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

@ -3,23 +3,20 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URL = "data:text/html,test for opening toolbox in different hosts";
var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox, target, tab1, tab2;
var toolbox, tab1, tab2;
function test() {
gBrowser.selectedTab = tab1 = gBrowser.addTab();
tab2 = gBrowser.addTab();
target = TargetFactory.forTab(gBrowser.selectedTab);
gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
addTab(TEST_URL).then(tab => {
tab2 = gBrowser.addTab();
let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target)
.then(testBottomHost, console.error)
.then(null, console.error);
}, true);
content.location = "data:text/html,test for opening toolbox in different hosts";
});
}
function testBottomHost(aToolbox) {
@ -73,7 +70,7 @@ function cleanup() {
Services.prefs.setCharPref("devtools.toolbox.host", Toolbox.HostType.BOTTOM);
toolbox.destroy().then(function () {
toolbox = target = null;
toolbox = null;
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
finish();

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

@ -3,25 +3,19 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
gBrowser.selectedTab = gBrowser.addTab();
let target = TargetFactory.forTab(gBrowser.selectedTab);
const TEST_URL = "data:text/html,test for toolbox being ready";
const onLoad = Task.async(function* (evt) {
gBrowser.selectedBrowser.removeEventListener("load", onLoad);
add_task(function* () {
let tab = yield addTab(TEST_URL);
let target = TargetFactory.forTab(tab);
const toolbox = yield gDevTools.showToolbox(target, "webconsole");
ok(toolbox.isReady, "toolbox isReady is set");
ok(toolbox.threadClient, "toolbox has a thread client");
const toolbox = yield gDevTools.showToolbox(target, "webconsole");
ok(toolbox.isReady, "toolbox isReady is set");
ok(toolbox.threadClient, "toolbox has a thread client");
const toolbox2 = yield gDevTools.showToolbox(toolbox.target, toolbox.toolId);
is(toolbox2, toolbox, "same toolbox");
const toolbox2 = yield gDevTools.showToolbox(toolbox.target, toolbox.toolId);
is(toolbox2, toolbox, "same toolbox");
yield toolbox.destroy();
gBrowser.removeCurrentTab();
finish();
});
gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
content.location = "data:text/html,test for toolbox being ready";
}
yield toolbox.destroy();
gBrowser.removeCurrentTab();
});

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

@ -30,17 +30,14 @@ function test() {
function openTabs() {
// Open two tabs, select the second
gTab1 = gBrowser.addTab(TAB_URL_1);
gTab1.linkedBrowser.addEventListener("load", function onLoad1(evt) {
gTab1.linkedBrowser.removeEventListener("load", onLoad1);
gTab2 = gBrowser.selectedTab = gBrowser.addTab(TAB_URL_2);
gTab2.linkedBrowser.addEventListener("load", function onLoad2(evt) {
gTab2.linkedBrowser.removeEventListener("load", onLoad2);
addTab(TAB_URL_1).then(tab1 => {
gTab1 = tab1;
addTab(TAB_URL_2).then(tab2 => {
gTab2 = tab2;
connect();
}, true);
}, true);
});
});
}
function connect() {

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

@ -91,12 +91,10 @@ function reloadTab(tabX) {
let def = defer();
let browser = gBrowser.selectedBrowser;
// once() doesn't work here so we use a standard handler instead.
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
BrowserTestUtils.browserLoaded(browser).then(function () {
info("Reloaded tab " + tabX.title);
def.resolve();
}, true);
});
info("Reloading tab " + tabX.title);
let mm = getFrameScript();

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

@ -113,7 +113,7 @@ var addTab = Task.async(function* (url) {
info("Adding a new tab with URL: " + url);
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
yield once(gBrowser.selectedBrowser, "load", true);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
info("Tab added and finished loading");
@ -142,7 +142,7 @@ var removeTab = Task.async(function* (tab) {
*/
var refreshTab = Task.async(function*(tab) {
info("Refreshing tab.");
const finished = once(gBrowser.selectedBrowser, "load", true);
const finished = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
gBrowser.reloadTab(gBrowser.selectedTab);
yield finished;
info("Tab finished refreshing.");
@ -291,9 +291,7 @@ function waitForTick() {
* @return A promise that resolves when the time is passed
*/
function wait(ms) {
let def = defer();
content.setTimeout(def.resolve, ms);
return def.promise;
return new promise(resolve => setTimeout(resolve, ms));
}
/**

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

@ -551,8 +551,7 @@ Toolbox.prototype = {
this.toggleSplitConsole();
// If the debugger is paused, don't let the ESC key stop any pending
// navigation.
let jsdebugger = this.getPanel("jsdebugger");
if (jsdebugger && jsdebugger.panelWin.gThreadClient.state == "paused") {
if (this._threadClient.state == "paused") {
e.preventDefault();
}
}

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

@ -52,7 +52,7 @@ add_task(function* () {
EventUtils.synthesizeMouse(searchField, 2, 2,
{type: "contextmenu", button: 2}, win);
yield onContextMenuPopup;
yield waitForClipboard(() => cmdCopy.click(), TEST_INPUT);
yield waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
searchContextMenu.hidePopup();
yield onContextMenuHidden;

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

@ -62,7 +62,7 @@ function* checkCopySelection(view) {
"font-variant-caps: small-caps;[\\r\\n]*";
try {
yield waitForClipboard(() => fireCopyEvent(props[0]),
yield waitForClipboardPromise(() => fireCopyEvent(props[0]),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);
@ -84,7 +84,7 @@ function* checkSelectAll(view) {
"font-variant-caps: small-caps;[\\r\\n]*";
try {
yield waitForClipboard(() => fireCopyEvent(prop),
yield waitForClipboardPromise(() => fireCopyEvent(prop),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);

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

@ -25,7 +25,7 @@ add_task(function* () {
let onTabOpened = once(gBrowser.tabContainer, "TabOpen");
inspector.onFollowLink();
let {target: tab} = yield onTabOpened;
yield waitForTabLoad(tab);
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
ok(true, "A new tab opened");
is(tab.linkedBrowser.currentURI.spec, URL_ROOT + "doc_markup_tooltip.png",
@ -67,16 +67,3 @@ add_task(function* () {
is(inspector.selection.nodeFront.tagName.toLowerCase(), "output",
"The <output> node is still selected");
});
function waitForTabLoad(tab) {
let def = defer();
tab.addEventListener("load", function onLoad(e) {
// Skip load event for about:blank
if (tab.linkedBrowser.currentURI.spec === "about:blank") {
return;
}
tab.removeEventListener("load", onLoad);
def.resolve();
});
return def.promise;
}

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

@ -58,19 +58,6 @@ add_task(function* () {
yield followLinkNoNewNode(linkEl, true, inspector);
});
function waitForTabLoad(tab) {
let def = defer();
tab.addEventListener("load", function onLoad() {
// Skip load event for about:blank
if (tab.linkedBrowser.currentURI.spec === "about:blank") {
return;
}
tab.removeEventListener("load", onLoad);
def.resolve();
});
return def.promise;
}
function performMouseDown(linkEl, metactrl) {
let evt = linkEl.ownerDocument.createEvent("MouseEvents");
@ -95,7 +82,7 @@ function* followLinkWaitForTab(linkEl, isMetaClick, expectedTabURI) {
let onTabOpened = once(gBrowser.tabContainer, "TabOpen");
performMouseDown(linkEl, isMetaClick);
let {target} = yield onTabOpened;
yield waitForTabLoad(target);
yield BrowserTestUtils.browserLoaded(target.linkedBrowser);
ok(true, "A new tab opened");
is(target.linkedBrowser.currentURI.spec, expectedTabURI,
"The URL for the new tab is correct");

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

@ -271,18 +271,6 @@ function searchUsingSelectorSearch(selector, inspector) {
EventUtils.sendKey("return", inspector.panelWin);
}
/**
* This shouldn't be used in the tests, but is useful when writing new tests or
* debugging existing tests in order to introduce delays in the test steps
* @param {Number} ms The time to wait
* @return A promise that resolves when the time is passed
*/
function wait(ms) {
let def = defer();
setTimeout(def.resolve, ms);
return def.promise;
}
/**
* Check to see if the inspector menu items for editing are disabled.
* Things like Edit As HTML, Delete Node, etc.

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

@ -267,7 +267,7 @@ function* checkCopyStyle(view, node, menuItemLabel, expectedPattern, visible) {
visible.copyRule);
try {
yield waitForClipboard(() => menuItem.click(),
yield waitForClipboardPromise(() => menuItem.click(),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);

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

@ -51,7 +51,7 @@ add_task(function* () {
EventUtils.synthesizeMouse(searchField, 2, 2,
{type: "contextmenu", button: 2}, win);
yield onContextMenuPopup;
yield waitForClipboard(() => cmdCopy.click(), TEST_INPUT);
yield waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
searchContextMenu.hidePopup();
yield onContextMenuHidden;

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

@ -75,7 +75,7 @@ function* checkCopySelection(view) {
"Copy menu item is displayed as expected");
try {
yield waitForClipboard(() => menuitemCopy.click(),
yield waitForClipboardPromise(() => menuitemCopy.click(),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);
@ -109,7 +109,7 @@ function* checkSelectAll(view) {
"Copy menu item is displayed as expected");
try {
yield waitForClipboard(() => menuitemCopy.click(),
yield waitForClipboardPromise(() => menuitemCopy.click(),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);
@ -137,7 +137,7 @@ function* checkCopyEditorValue(view) {
"Copy menu item is displayed as expected");
try {
yield waitForClipboard(() => menuitemCopy.click(),
yield waitForClipboardPromise(() => menuitemCopy.click(),
() => checkClipboardData(expectedPattern));
} catch (e) {
failedClipboard(expectedPattern);

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

@ -39,7 +39,7 @@ function* testCopyToClipboard(inspector, view) {
ok(menuitemCopyColor.visible, "Copy color is visible");
yield waitForClipboard(() => menuitemCopyColor.click(),
yield waitForClipboardPromise(() => menuitemCopyColor.click(),
"#123ABC");
EventUtils.synthesizeKey("VK_ESCAPE", { });

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

@ -87,12 +87,12 @@ function* testCopyUrlToClipboard({view, inspector}, type, selector, expected) {
if (type == "data-uri") {
info("Click Copy Data URI and wait for clipboard");
yield waitForClipboard(() => {
yield waitForClipboardPromise(() => {
return menuitemCopyImageDataUrl.click();
}, expected);
} else {
info("Click Copy URL and wait for clipboard");
yield waitForClipboard(() => {
yield waitForClipboardPromise(() => {
return menuitemCopyUrl.click();
}, expected);
}

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

@ -23,7 +23,7 @@ add_task(function* () {
info("Make sure to wait until the eyedropper is done taking a screenshot of the page");
yield waitForElementAttributeSet("root", "drawn", helper);
yield waitForClipboard(() => {
yield waitForClipboardPromise(() => {
info("Activate the eyedropper so the background color is copied");
EventUtils.synthesizeKey("VK_RETURN", {});
}, "#FF0000");

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

@ -34,7 +34,7 @@ function* setSelectionNodeFront(node, inspector) {
function* checkClipboard(expectedText, node) {
try {
yield waitForClipboard(() => fireCopyEvent(node), expectedText);
yield waitForClipboardPromise(() => fireCopyEvent(node), expectedText);
ok(true, "Clipboard successfully filled with : " + expectedText);
} catch (e) {
ok(false, "Clipboard could not be filled with the expected text : " +

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

@ -44,6 +44,6 @@ add_task(function* () {
let item = allMenuItems.find(i => i.id === id);
ok(item, "The popup has a " + desc + " menu item.");
yield waitForClipboard(() => item.click(), text);
yield waitForClipboardPromise(() => item.click(), text);
}
});

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

@ -50,7 +50,7 @@ add_task(function* () {
EventUtils.synthesizeMouse(searchBox, 2, 2,
{type: "contextmenu", button: 2}, win);
yield onContextMenuPopup;
yield waitForClipboard(() => cmdCopy.click(), TEST_INPUT);
yield waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
searchContextMenu.hidePopup();
yield onContextMenuHidden;

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

@ -618,23 +618,6 @@ function waitForStyleEditor(toolbox, href) {
return def.promise;
}
/**
* @see SimpleTest.waitForClipboard
*
* @param {Function} setup
* Function to execute before checking for the
* clipboard content
* @param {String|Function} expected
* An expected string or validator function
* @return a promise that resolves when the expected string has been found or
* the validator function has returned true, rejects otherwise.
*/
function waitForClipboard(setup, expected) {
let def = defer();
SimpleTest.waitForClipboard(expected, setup, def.resolve, def.reject);
return def.promise;
}
/**
* Checks if document's active element is within the given element.
* @param {HTMLDocument} doc document with active element in question
@ -662,8 +645,7 @@ var waitForTab = Task.async(function* () {
info("Waiting for a tab to open");
yield once(gBrowser.tabContainer, "TabOpen");
let tab = gBrowser.selectedTab;
let browser = tab.linkedBrowser;
yield once(browser, "load", true);
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
info("The tab load completed");
return tab;
});

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

@ -57,15 +57,13 @@ function addTab(url) {
info("Adding a new tab with URL: '" + url + "'");
let def = promise.defer();
let tab = gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(function () {
info("URL '" + url + "' loading complete");
waitForFocus(() => {
def.resolve(tab);
}, content);
}, true);
content.location = url;
});
return def.promise;
}

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

@ -12,7 +12,7 @@ const {
module.exports = {
updateTouchSimulationEnabled(enabled) {
updateTouchSimulationEnabled(enabled = false) {
return {
type: UPDATE_TOUCH_SIMULATION_ENABLED,
enabled,

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

@ -48,6 +48,7 @@ let App = createClass({
device,
}, "*");
this.props.dispatch(changeDevice(id, device.name));
this.props.dispatch(updateTouchSimulationEnabled(device.touch));
},
onContentResize({ width, height }) {

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

@ -424,9 +424,10 @@ ResponsiveUI.prototype = {
switch (event.data.type) {
case "change-viewport-device":
let { userAgent, pixelRatio } = event.data.device;
let { userAgent, pixelRatio, touch } = event.data.device;
this.updateUserAgent(userAgent);
this.updateDPPX(pixelRatio);
this.updateTouchSimulation(touch);
break;
case "content-resize":
let { width, height } = event.data;

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

@ -40,31 +40,31 @@ addRDMTask(TEST_URL, function* ({ ui, manager }) {
// Test defaults
testViewportDimensions(ui, 320, 480);
yield testUserAgent(ui, DEFAULT_UA);
testDevicePixelRatio(yield getViewportDevicePixelRatio(ui), DEFAULT_DPPX);
yield testDevicePixelRatio(ui, DEFAULT_DPPX);
yield testTouchEventsOverride(ui, false);
testViewportSelectLabel(ui, "no device selected");
let waitingPixelRatio = onceDevicePixelRatioChange(ui);
// Test device with custom UA
// Test device with custom properties
yield switchDevice(ui, "Fake Phone RDM Test");
yield waitForViewportResizeTo(ui, testDevice.width, testDevice.height);
yield testUserAgent(ui, testDevice.userAgent);
// Test device with custom pixelRatio
testDevicePixelRatio(yield waitingPixelRatio, testDevice.pixelRatio);
waitingPixelRatio = onceDevicePixelRatioChange(ui);
yield testDevicePixelRatio(ui, testDevice.pixelRatio);
yield testTouchEventsOverride(ui, true);
// Test resetting device when resizing viewport
yield testViewportResize(ui, ".viewport-vertical-resize-handle",
[-10, -10], [testDevice.width, testDevice.height - 10], [0, -10], ui);
yield testUserAgent(ui, DEFAULT_UA);
yield testDevicePixelRatio(ui, DEFAULT_DPPX);
yield testTouchEventsOverride(ui, false);
testViewportSelectLabel(ui, "no device selected");
testDevicePixelRatio(yield waitingPixelRatio, DEFAULT_DPPX);
// Test device where UA field is blank
// Test device with generic properties
yield switchDevice(ui, "Laptop (1366 x 768)");
yield waitForViewportResizeTo(ui, 1366, 768);
yield testUserAgent(ui, DEFAULT_UA);
yield testDevicePixelRatio(ui, 1);
yield testTouchEventsOverride(ui, false);
ok(removeDevice(testDevice),
"Test Device properly removed.");
@ -79,39 +79,37 @@ function testViewportDimensions(ui, w, h) {
`${h}px`, `Viewport should have height of ${h}px`);
}
function testViewportSelectLabel(ui, label) {
function testViewportSelectLabel(ui, expected) {
let select = ui.toolWindow.document.querySelector(".viewport-device-selector");
is(select.selectedOptions[0].textContent, label,
`Select label should be changed to ${label}`);
is(select.selectedOptions[0].textContent, expected,
`Select label should be changed to ${expected}`);
}
function* testUserAgent(ui, value) {
function* testUserAgent(ui, expected) {
let ua = yield ContentTask.spawn(ui.getViewportBrowser(), {}, function* () {
return content.navigator.userAgent;
});
is(ua, value, `UA should be set to ${value}`);
is(ua, expected, `UA should be set to ${expected}`);
}
function testDevicePixelRatio(dppx, expected) {
function* testDevicePixelRatio(ui, expected) {
let dppx = yield getViewportDevicePixelRatio(ui);
is(dppx, expected, `devicePixelRatio should be set to ${expected}`);
}
function* testTouchEventsOverride(ui, expected) {
let { document } = ui.toolWindow;
let touchButton = document.querySelector("#global-touch-simulation-button");
let flag = yield ui.emulationFront.getTouchEventsOverride();
is(flag === Ci.nsIDocShell.TOUCHEVENTS_OVERRIDE_ENABLED, expected,
`Touch events override should be ${expected ? "enabled" : "disabled"}`);
is(touchButton.classList.contains("active"), expected,
`Touch simulation button should be ${expected ? "" : "not"} active.`);
}
function* getViewportDevicePixelRatio(ui) {
return yield ContentTask.spawn(ui.getViewportBrowser(), {}, function* () {
return content.devicePixelRatio;
});
}
function onceDevicePixelRatioChange(ui) {
return ContentTask.spawn(ui.getViewportBrowser(), {}, function* () {
let pixelRatio = content.devicePixelRatio;
let mql = content.matchMedia(`(resolution: ${pixelRatio}dppx)`);
return new Promise(resolve => {
mql.addListener(function listener() {
mql.removeListener(listener);
resolve(content.devicePixelRatio);
});
});
});
}

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

@ -195,18 +195,12 @@ var addTab = Task.async(function* (url) {
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
let browser = tab.linkedBrowser;
yield once(browser, "load", true);
yield BrowserTestUtils.browserLoaded(browser);
info("URL '" + url + "' loading complete");
return tab;
});
function wait(ms) {
let def = promise.defer();
setTimeout(def.resolve, ms);
return def.promise;
}
/**
* Waits for the next load to complete in the current browser.
*

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

@ -76,11 +76,10 @@ function addTab(aUrl, aWindow) {
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
BrowserTestUtils.browserLoaded(linkedBrowser).then(function () {
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
}, true);
});
return deferred.promise;
}

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

@ -12,14 +12,7 @@ function test() {
requestLongerTimeout(3);
waitForExplicitFinish();
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
runCodeMirrorTest(browser);
}, true);
browser.loadURI(URI);
addTab(URI).then(function (tab) {
runCodeMirrorTest(tab.linkedBrowser);
});
}

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

@ -79,13 +79,10 @@ let inspector;
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
addTab(TEST_URI).then(function () {
doc = content.document;
runTests();
}, true);
content.location = TEST_URI;
});
}
function runTests() {

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

@ -11,14 +11,7 @@ function test() {
requestLongerTimeout(4);
waitForExplicitFinish();
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
runCodeMirrorTest(browser);
}, true);
browser.loadURI(URI);
addTab(URI).then(function (tab) {
runCodeMirrorTest(tab.linkedBrowser);
});
}

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

@ -22,18 +22,16 @@ SimpleTest.registerCleanupFunction(() => {
function addTab(url, callback) {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
content.location = url;
gBrowser.selectedTab = gBrowser.addTab(url);
let tab = gBrowser.selectedTab;
let browser = gBrowser.getBrowserForTab(tab);
function onTabLoad() {
browser.removeEventListener("load", onTabLoad, true);
callback(browser, tab, browser.contentDocument);
}
browser.addEventListener("load", onTabLoad, true);
return BrowserTestUtils.browserLoaded(browser).then(function () {
if (typeof(callback) == "function") {
callback(browser, tab, browser.contentDocument);
}
return tab;
});
}
function promiseTab(url) {

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

@ -29,11 +29,11 @@ var addTab = function (url, win) {
let targetBrowser = targetWindow.gBrowser;
let tab = targetBrowser.selectedTab = targetBrowser.addTab(url);
targetBrowser.selectedBrowser.addEventListener("load", function onload() {
targetBrowser.selectedBrowser.removeEventListener("load", onload, true);
info("URL '" + url + "' loading complete");
def.resolve(tab);
}, true);
BrowserTestUtils.browserLoaded(targetBrowser.selectedBrowser)
.then(function () {
info("URL '" + url + "' loading complete");
def.resolve(tab);
});
return def.promise;
};

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

@ -73,11 +73,10 @@ function addTab(aUrl, aWindow) {
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
BrowserTestUtils.browserLoaded(linkedBrowser).then(function () {
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
}, true);
});
return deferred.promise;
}

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

@ -198,7 +198,7 @@ var inputTests = [
// 21
{
input: '({0: "a", 1: "b", length: 1})',
output: 'Object { 1: "b", length: 1, 1 more\u2026 }',
output: 'Object { 0: "a", 1: "b", length: 1 }',
printOutput: "[object Object]",
inspectable: true,
variablesViewLabel: "Object",
@ -225,7 +225,7 @@ var inputTests = [
// 24
{
input: '({0: "a", 2: "b", length: 2})',
output: 'Object { 2: "b", length: 2, 1 more\u2026 }',
output: 'Object { 0: "a", 2: "b", length: 2 }',
printOutput: "[object Object]",
inspectable: true,
variablesViewLabel: "Object",
@ -243,7 +243,7 @@ var inputTests = [
// 26
{
input: '({0: "a", b: "b", length: 1})',
output: 'Object { b: "b", length: 1, 1 more\u2026 }',
output: 'Object { 0: "a", b: "b", length: 1 }',
printOutput: "[object Object]",
inspectable: true,
variablesViewLabel: "Object",
@ -252,7 +252,7 @@ var inputTests = [
// 27
{
input: '({0: "a", b: "b", length: 2})',
output: 'Object { b: "b", length: 2, 1 more\u2026 }',
output: 'Object { 0: "a", b: "b", length: 2 }',
printOutput: "[object Object]",
inspectable: true,
variablesViewLabel: "Object",

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

@ -167,11 +167,10 @@ function addTab(aUrl, aWindow) {
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let linkedBrowser = tab.linkedBrowser;
linkedBrowser.addEventListener("load", function onLoad() {
linkedBrowser.removeEventListener("load", onLoad, true);
BrowserTestUtils.browserLoaded(linkedBrowser).then(function () {
info("Tab added and finished loading: " + aUrl);
deferred.resolve(tab);
}, true);
});
return deferred.promise;
}

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

@ -1090,7 +1090,7 @@ function enumWeakSetEntries(objectActor) {
* having customized output. This object holds arrays mapped by
* Debugger.Object.prototype.class.
*
* In each array you can add functions that take two
* In each array you can add functions that take three
* arguments:
* - the ObjectActor instance and its hooks to make a preview for,
* - the grip object being prepared for the client,
@ -1102,16 +1102,16 @@ function enumWeakSetEntries(objectActor) {
* information for the debugger object, or true otherwise.
*/
DebuggerServer.ObjectActorPreviewers = {
String: [function (objectActor, grip) {
return wrappedPrimitivePreviewer("String", String, objectActor, grip);
String: [function (objectActor, grip, rawObj) {
return wrappedPrimitivePreviewer("String", String, objectActor, grip, rawObj);
}],
Boolean: [function (objectActor, grip) {
return wrappedPrimitivePreviewer("Boolean", Boolean, objectActor, grip);
Boolean: [function (objectActor, grip, rawObj) {
return wrappedPrimitivePreviewer("Boolean", Boolean, objectActor, grip, rawObj);
}],
Number: [function (objectActor, grip) {
return wrappedPrimitivePreviewer("Number", Number, objectActor, grip);
Number: [function (objectActor, grip, rawObj) {
return wrappedPrimitivePreviewer("Number", Number, objectActor, grip, rawObj);
}],
Function: [function ({obj, hooks}, grip) {
@ -1379,17 +1379,16 @@ DebuggerServer.ObjectActorPreviewers = {
* The result grip to fill in
* @return Booolean true if the object was handled, false otherwise
*/
function wrappedPrimitivePreviewer(className, classObj, objectActor, grip) {
function wrappedPrimitivePreviewer(className, classObj, objectActor, grip, rawObj) {
let {obj, hooks} = objectActor;
if (!obj.proto || obj.proto.class != className) {
return false;
}
let raw = obj.unsafeDereference();
let v = null;
try {
v = classObj.prototype.valueOf.call(raw);
v = classObj.prototype.valueOf.call(rawObj);
} catch (ex) {
// valueOf() can throw if the raw JS object is "misbehaved".
return false;
@ -1399,7 +1398,7 @@ function wrappedPrimitivePreviewer(className, classObj, objectActor, grip) {
return false;
}
let canHandle = GenericObject(objectActor, grip, className === "String");
let canHandle = GenericObject(objectActor, grip, rawObj, className === "String");
if (!canHandle) {
return false;
}
@ -1409,7 +1408,7 @@ function wrappedPrimitivePreviewer(className, classObj, objectActor, grip) {
return true;
}
function GenericObject(objectActor, grip, specialStringBehavior = false) {
function GenericObject(objectActor, grip, rawObj, specialStringBehavior = false) {
let {obj, hooks} = objectActor;
if (grip.preview || grip.displayString || hooks.getGripDepth() > 1) {
return false;
@ -1859,7 +1858,9 @@ DebuggerServer.ObjectActorPreviewers.Object = [
return true;
},
GenericObject,
function Object(objectActor, grip, rawObj) {
return GenericObject(objectActor, grip, rawObj, /* specialStringBehavior = */ false);
},
];
/**

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

@ -65,7 +65,7 @@ add_task(function* () {
is(mouseDownHandled, 1, "The mousedown event was handled once before navigation");
info("Navigating to a new page");
let loaded = once(gBrowser.selectedBrowser, "load", true);
let loaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
content.location = TEST_URL_2;
yield loaded;
doc = gBrowser.selectedBrowser.contentWindow.document;

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

@ -33,7 +33,7 @@ waitForExplicitFinish();
var addTab = Task.async(function* (url) {
info(`Adding a new tab with URL: ${url}`);
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
yield once(gBrowser.selectedBrowser, "load", true);
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
info(`Tab added and URL ${url} loaded`);

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

@ -18,14 +18,6 @@ test(function(t) {
assert_equals(animation.id, 'anim', 'animation.id reflects the value set');
}, 'Animation.id for CSS Animations');
test(function(t) {
var div = addDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
assert_equals(animation.id, '', 'id for CSS Animation is initially empty');
animation.id = 'anim'
assert_equals(animation.id, 'anim', 'animation.id reflects the value set');
}, 'Animation.id for CSS Animations');
done();
</script>
</body>

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

@ -5,7 +5,7 @@
<script>
'use strict';
async_test(function(t) {
promise_test(function(t) {
var div = addDiv(t, { style: 'margin-left: 0px' });
flushComputedStyle(div);
@ -14,17 +14,16 @@ async_test(function(t) {
flushComputedStyle(div);
var animation = div.getAnimations()[0];
animation.ready.then(waitForFrame).then(t.step_func(function() {
return animation.ready.then(waitForFrame).then(function() {
assert_not_equals(getComputedStyle(div).marginLeft, '1000px',
'transform style is animated before cancelling');
animation.cancel();
assert_equals(getComputedStyle(div).marginLeft, div.style.marginLeft,
'transform style is no longer animated after cancelling');
t.done();
}));
});
}, 'Animated style is cleared after cancelling a running CSS transition');
async_test(function(t) {
promise_test(function(t) {
var div = addDiv(t, { style: 'margin-left: 0px' });
flushComputedStyle(div);
@ -32,24 +31,22 @@ async_test(function(t) {
div.style.marginLeft = '1000px';
flushComputedStyle(div);
div.addEventListener('transitionend', t.step_func(function() {
div.addEventListener('transitionend', function() {
assert_unreached('Got unexpected end event on cancelled transition');
}));
});
var animation = div.getAnimations()[0];
animation.ready.then(t.step_func(function() {
return animation.ready.then(function() {
// Seek to just before the end then cancel
animation.currentTime = 99.9 * 1000;
animation.cancel();
// Then wait a couple of frames and check that no event was dispatched
return waitForAnimationFrames(2);
})).then(t.step_func(function() {
t.done();
}));
});
}, 'Cancelled CSS transitions do not dispatch events');
async_test(function(t) {
promise_test(function(t) {
var div = addDiv(t, { style: 'margin-left: 0px' });
flushComputedStyle(div);
@ -58,7 +55,7 @@ async_test(function(t) {
flushComputedStyle(div);
var animation = div.getAnimations()[0];
animation.ready.then(t.step_func(function() {
return animation.ready.then(function() {
animation.cancel();
assert_equals(getComputedStyle(div).marginLeft, '1000px',
'margin-left style is not animated after cancelling');
@ -66,14 +63,13 @@ async_test(function(t) {
assert_equals(getComputedStyle(div).marginLeft, '0px',
'margin-left style is animated after re-starting transition');
return animation.ready;
})).then(t.step_func(function() {
}).then(function() {
assert_equals(animation.playState, 'running',
'Transition succeeds in running after being re-started');
t.done();
}));
});
}, 'After cancelling a transition, it can still be re-used');
async_test(function(t) {
promise_test(function(t) {
var div = addDiv(t, { style: 'margin-left: 0px' });
flushComputedStyle(div);
@ -82,7 +78,7 @@ async_test(function(t) {
flushComputedStyle(div);
var animation = div.getAnimations()[0];
animation.ready.then(t.step_func(function() {
return animation.ready.then(function() {
animation.finish();
animation.cancel();
assert_equals(getComputedStyle(div).marginLeft, '1000px',
@ -91,11 +87,10 @@ async_test(function(t) {
assert_equals(getComputedStyle(div).marginLeft, '0px',
'margin-left style is animated after re-starting transition');
return animation.ready;
})).then(t.step_func(function() {
}).then(function() {
assert_equals(animation.playState, 'running',
'Transition succeeds in running after being re-started');
t.done();
}));
});
}, 'After cancelling a finished transition, it can still be re-used');
test(function(t) {
@ -123,6 +118,20 @@ test(function(t) {
}, 'After cancelling a transition, updating transition properties doesn\'t make'
+ ' it live again');
test(function(t) {
var div = addDiv(t, { style: 'margin-left: 0px' });
flushComputedStyle(div);
div.style.transition = 'margin-left 100s';
div.style.marginLeft = '1000px';
flushComputedStyle(div);
var animation = div.getAnimations()[0];
div.style.display = 'none';
assert_equals(animation.playState, 'idle');
assert_equals(getComputedStyle(div).marginLeft, '1000px');
}, 'Setting display:none on an element cancels its transitions');
done();
</script>
</body>

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

@ -84,7 +84,7 @@ skip-if = android_version == '18' #Android 4.3 aws only; bug 1030942
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
[test_webgl_compressed_texture_es3.html]
[test_webgl_disjoint_timer_query.html]
fail-if = (os == 'win' && (os_version == '6.1' || os_version == '6.2'))
fail-if = (os == 'win' && (os_version == '6.1' || os_version == '6.2' || os_version == '10.0'))
[test_webgl_force_enable.html]
[test_webgl_request_context.html]
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests

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

@ -4344,7 +4344,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
}
if (mIsEncrypted) {
if (!mMediaSource && Preferences::GetBool("media.eme.mse-only", true)) {
DecodeError();
DecodeError(NS_ERROR_DOM_MEDIA_FATAL_ERR);
return;
}
@ -4419,7 +4419,7 @@ void HTMLMediaElement::NetworkError()
Error(nsIDOMMediaError::MEDIA_ERR_NETWORK);
}
void HTMLMediaElement::DecodeError()
void HTMLMediaElement::DecodeError(const MediaResult& aError)
{
nsAutoString src;
GetCurrentSrc(src);
@ -4443,7 +4443,7 @@ void HTMLMediaElement::DecodeError()
NS_WARNING("Should know the source we were loading from!");
}
} else {
Error(nsIDOMMediaError::MEDIA_ERR_DECODE);
Error(nsIDOMMediaError::MEDIA_ERR_DECODE, aError);
}
}
@ -4457,7 +4457,8 @@ void HTMLMediaElement::LoadAborted()
Error(nsIDOMMediaError::MEDIA_ERR_ABORTED);
}
void HTMLMediaElement::Error(uint16_t aErrorCode)
void HTMLMediaElement::Error(uint16_t aErrorCode,
const MediaResult& aErrorDetails)
{
NS_ASSERTION(aErrorCode == nsIDOMMediaError::MEDIA_ERR_DECODE ||
aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK ||
@ -4470,8 +4471,12 @@ void HTMLMediaElement::Error(uint16_t aErrorCode)
if (mError) {
return;
}
nsCString message;
if (NS_FAILED(aErrorDetails)) {
message = aErrorDetails.Description();
}
mError = new MediaError(this, aErrorCode, message);
mError = new MediaError(this, aErrorCode);
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY);

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

@ -179,7 +179,7 @@ public:
// Called by the video decoder object, on the main thread, when the
// resource has a decode error during metadata loading or decoding.
virtual void DecodeError() final override;
virtual void DecodeError(const MediaResult& aError) final override;
// Return true if error attribute is not null.
virtual bool HasError() const final override;
@ -1127,7 +1127,7 @@ protected:
* Resets the media element for an error condition as per aErrorCode.
* aErrorCode must be one of nsIDOMHTMLMediaError codes.
*/
void Error(uint16_t aErrorCode);
void Error(uint16_t aErrorCode, const MediaResult& aErrorDetails = NS_OK);
/**
* Returns the URL spec of the currentSrc.

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

@ -21,9 +21,11 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaError)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaError)
NS_INTERFACE_MAP_END
MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode)
MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode,
const nsACString& aMessage)
: mParent(aParent)
, mCode(aCode)
, mMessage(aMessage)
{
}
@ -35,6 +37,12 @@ NS_IMETHODIMP MediaError::GetCode(uint16_t* aCode)
return NS_OK;
}
NS_IMETHODIMP MediaError::GetMessage(nsAString& aResult)
{
CopyUTF8toUTF16(mMessage, aResult);
return NS_OK;
}
JSObject*
MediaError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{

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

@ -22,7 +22,8 @@ class MediaError final : public nsIDOMMediaError,
~MediaError() {}
public:
MediaError(HTMLMediaElement* aParent, uint16_t aCode);
MediaError(HTMLMediaElement* aParent, uint16_t aCode,
const nsACString& aMessage = nsCString());
// nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -48,6 +49,8 @@ private:
// Error code
const uint16_t mCode;
// Error details;
const nsCString mMessage;
};
} // namespace dom

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

@ -12,11 +12,11 @@ interface nsIDOMMediaError : nsISupports
the user agent at the user's requet */
const unsigned short MEDIA_ERR_ABORTED = 1;
/* A network error of some description caused the
/* A network error of some description caused the
user agent to stop downloading the media resource */
const unsigned short MEDIA_ERR_NETWORK = 2;
/* An error of some description occurred while decoding
/* An error of some description occurred while decoding
the media resource */
const unsigned short MEDIA_ERR_DECODE = 3;
@ -24,4 +24,6 @@ interface nsIDOMMediaError : nsISupports
const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
readonly attribute unsigned short code;
readonly attribute DOMString message;
};

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

@ -1312,6 +1312,16 @@ StartMacOSContentSandbox()
MOZ_CRASH("Failed to get NS_OS_TEMP_DIR path");
}
nsCOMPtr<nsIFile> profileDir;
ContentChild::GetSingleton()->GetProfileDir(getter_AddRefs(profileDir));
nsCString profileDirPath;
if (profileDir) {
rv = profileDir->GetNativePath(profileDirPath);
if (NS_FAILED(rv) || profileDirPath.IsEmpty()) {
MOZ_CRASH("Failed to get profile path");
}
}
MacSandboxInfo info;
info.type = MacSandboxType_Content;
info.level = info.level = sandboxLevel;
@ -1320,6 +1330,13 @@ StartMacOSContentSandbox()
info.appDir.assign(appDir.get());
info.appTempDir.assign(tempDirPath.get());
if (profileDir) {
info.hasSandboxedProfile = true;
info.profileDir.assign(profileDirPath.get());
} else {
info.hasSandboxedProfile = false;
}
std::string err;
if (!mozilla::StartMacSandbox(info, err)) {
NS_WARNING(err.c_str());

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

@ -21,6 +21,9 @@
#include "nsWeakPtr.h"
#include "nsIWindowProvider.h"
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
#include "nsIFile.h"
#endif
struct ChromePackage;
class nsIObserver;
@ -114,6 +117,19 @@ public:
void GetProcessName(nsACString& aName) const;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
void GetProfileDir(nsIFile** aProfileDir) const
{
*aProfileDir = mProfileDir;
NS_IF_ADDREF(*aProfileDir);
}
void SetProfileDir(nsIFile* aProfileDir)
{
mProfileDir = aProfileDir;
}
#endif
bool IsAlive() const;
bool IsShuttingDown() const;
@ -681,6 +697,10 @@ private:
nsCOMPtr<nsIDomainPolicy> mPolicy;
nsCOMPtr<nsITimer> mForceKillTimer;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
nsCOMPtr<nsIFile> mProfileDir;
#endif
// Hashtable to keep track of the pending GetFilesHelper objects.
// This GetFilesHelperChild objects are removed when RecvGetFilesResponse is
// received.

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

@ -114,6 +114,21 @@ ContentProcess::SetAppDir(const nsACString& aPath)
mXREEmbed.SetAppDir(aPath);
}
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
void
ContentProcess::SetProfile(const nsACString& aProfile)
{
bool flag;
nsresult rv =
XRE_GetFileFromPath(aProfile.BeginReading(), getter_AddRefs(mProfileDir));
if (NS_FAILED(rv) ||
NS_FAILED(mProfileDir->Exists(&flag)) || !flag) {
NS_WARNING("Invalid profile directory passed to content process.");
mProfileDir = nullptr;
}
}
#endif
bool
ContentProcess::Init()
{
@ -124,6 +139,10 @@ ContentProcess::Init()
mContent.InitXPCOM();
mContent.InitGraphicsDeviceData();
#if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
mContent.SetProfileDir(mProfileDir);
#endif
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
SetUpSandboxEnvironment();
#endif

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

@ -39,9 +39,18 @@ public:
void SetAppDir(const nsACString& aPath);
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
void SetProfile(const nsACString& aProfile);
#endif
private:
ContentChild mContent;
mozilla::ipc::ScopedXREEmbed mXREEmbed;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
nsCOMPtr<nsIFile> mProfileDir;
#endif
#if defined(XP_WIN)
// This object initializes and configures COM.
mozilla::mscom::MainThreadRuntime mCOMRuntime;

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

@ -318,7 +318,7 @@ ADTSDemuxer::Init()
ADTSLOG("Init() failure: waiting for data");
return InitPromise::CreateAndReject(
DemuxerFailureReason::DEMUXER_ERROR, __func__);
NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__);
}
ADTSLOG("Init() successful");
@ -515,10 +515,7 @@ ADTSTrackDemuxer::GetSamples(int32_t aNumSamples)
aNumSamples, mOffset, mNumParsedFrames, mFrameIndex, mTotalFrameLen,
mSamplesPerFrame, mSamplesPerSecond, mChannels);
if (!aNumSamples) {
return SamplesPromise::CreateAndReject(
DemuxerFailureReason::DEMUXER_ERROR, __func__);
}
MOZ_ASSERT(aNumSamples);
RefPtr<SamplesHolder> frames = new SamplesHolder();
@ -540,7 +537,7 @@ ADTSTrackDemuxer::GetSamples(int32_t aNumSamples)
if (frames->mSamples.IsEmpty()) {
return SamplesPromise::CreateAndReject(
DemuxerFailureReason::END_OF_STREAM, __func__);
NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
}
return SamplesPromise::CreateAndResolve(frames, __func__);
@ -562,7 +559,7 @@ ADTSTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
{
// Will not be called for audio-only resources.
return SkipAccessPointPromise::CreateAndReject(
SkipFailureHolder(DemuxerFailureReason::DEMUXER_ERROR, 0), __func__);
SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
}
int64_t

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

@ -61,7 +61,7 @@ AccurateSeekTask::Discard()
AssertOwnerThread();
// Disconnect MDSM.
RejectIfExist(__func__);
RejectIfExist(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
// Disconnect MediaDecoderReaderWrapper.
mSeekRequest.DisconnectIfExists();
@ -120,7 +120,7 @@ AccurateSeekTask::DropAudioUpToSeekTarget(MediaData* aSample)
CheckedInt64 sampleDuration = FramesToUsecs(audio->mFrames, mAudioRate);
if (!sampleDuration.isValid()) {
return NS_ERROR_FAILURE;
return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR;
}
if (audio->mTime + sampleDuration.value() <= mTarget.GetTime().ToMicroseconds()) {
@ -154,7 +154,7 @@ AccurateSeekTask::DropAudioUpToSeekTarget(MediaData* aSample)
CheckedInt64 framesToPrune =
UsecsToFrames(mTarget.GetTime().ToMicroseconds() - audio->mTime, mAudioRate);
if (!framesToPrune.isValid()) {
return NS_ERROR_FAILURE;
return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR;
}
if (framesToPrune.value() > audio->mFrames) {
// We've messed up somehow. Don't try to trim frames, the |frames|
@ -174,7 +174,7 @@ AccurateSeekTask::DropAudioUpToSeekTarget(MediaData* aSample)
frames * channels * sizeof(AudioDataValue));
CheckedInt64 duration = FramesToUsecs(frames, mAudioRate);
if (!duration.isValid()) {
return NS_ERROR_FAILURE;
return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR;
}
RefPtr<AudioData> data(new AudioData(audio->mOffset,
mTarget.GetTime().ToMicroseconds(),
@ -260,7 +260,7 @@ AccurateSeekTask::OnSeekRejected(nsresult aResult)
mSeekRequest.Complete();
MOZ_ASSERT(NS_FAILED(aResult), "Cancels should also disconnect mSeekRequest");
RejectIfExist(__func__);
RejectIfExist(aResult, __func__);
}
void
@ -308,10 +308,13 @@ AccurateSeekTask::OnAudioDecoded(MediaData* aAudioSample)
// Non-precise seek; we can stop the seek at the first sample.
mSeekedAudioData = audio;
mDoneAudioSeeking = true;
} else if (NS_FAILED(DropAudioUpToSeekTarget(audio))) {
CancelCallbacks();
RejectIfExist(__func__);
return;
} else {
nsresult rv = DropAudioUpToSeekTarget(audio);
if (NS_FAILED(rv)) {
CancelCallbacks();
RejectIfExist(rv, __func__);
return;
}
}
if (!mDoneAudioSeeking) {
@ -323,33 +326,26 @@ AccurateSeekTask::OnAudioDecoded(MediaData* aAudioSample)
void
AccurateSeekTask::OnNotDecoded(MediaData::Type aType,
MediaDecoderReader::NotDecodedReason aReason)
const MediaResult& aError)
{
AssertOwnerThread();
MOZ_ASSERT(!mSeekTaskPromise.IsEmpty(), "Seek shouldn't be finished");
SAMPLE_LOG("OnNotDecoded type=%d reason=%u", aType, aReason);
SAMPLE_LOG("OnNotDecoded type=%d reason=%u", aType, aError.Code());
// Ignore pending requests from video-only seek.
if (aType == MediaData::AUDIO_DATA && mTarget.IsVideoOnly()) {
return;
}
if (aReason == MediaDecoderReader::DECODE_ERROR) {
// If this is a decode error, delegate to the generic error path.
CancelCallbacks();
RejectIfExist(__func__);
return;
}
// If the decoder is waiting for data, we tell it to call us back when the
// data arrives.
if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
if (aError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) {
mReader->WaitForData(aType);
return;
}
if (aReason == MediaDecoderReader::CANCELED) {
if (aError == NS_ERROR_DOM_MEDIA_CANCELED) {
if (aType == MediaData::AUDIO_DATA) {
RequestAudioData();
} else {
@ -358,7 +354,7 @@ AccurateSeekTask::OnNotDecoded(MediaData::Type aType,
return;
}
if (aReason == MediaDecoderReader::END_OF_STREAM) {
if (aError == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
if (aType == MediaData::AUDIO_DATA) {
mIsAudioQueueFinished = true;
mDoneAudioSeeking = true;
@ -372,7 +368,12 @@ AccurateSeekTask::OnNotDecoded(MediaData::Type aType,
}
}
MaybeFinishSeek();
return;
}
// This is a decode error, delegate to the generic error path.
CancelCallbacks();
RejectIfExist(aError, __func__);
}
void
@ -395,10 +396,13 @@ AccurateSeekTask::OnVideoDecoded(MediaData* aVideoSample)
// Non-precise seek. We can stop the seek at the first sample.
mSeekedVideoData = video;
mDoneVideoSeeking = true;
} else if (NS_FAILED(DropVideoUpToSeekTarget(video.get()))) {
CancelCallbacks();
RejectIfExist(__func__);
return;
} else {
nsresult rv = DropVideoUpToSeekTarget(video.get());
if (NS_FAILED(rv)) {
CancelCallbacks();
RejectIfExist(rv, __func__);
return;
}
}
if (!mDoneVideoSeeking) {
@ -419,7 +423,7 @@ AccurateSeekTask::SetCallbacks()
OnAudioDecoded(aData.as<MediaData*>());
} else {
OnNotDecoded(MediaData::AUDIO_DATA,
aData.as<MediaDecoderReader::NotDecodedReason>());
aData.as<MediaResult>());
}
});
@ -430,7 +434,7 @@ AccurateSeekTask::SetCallbacks()
OnVideoDecoded(Get<0>(aData.as<Type>()));
} else {
OnNotDecoded(MediaData::VIDEO_DATA,
aData.as<MediaDecoderReader::NotDecodedReason>());
aData.as<MediaResult>());
}
});

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

@ -50,7 +50,7 @@ private:
void OnVideoDecoded(MediaData* aVideoSample);
void OnNotDecoded(MediaData::Type, MediaDecoderReader::NotDecodedReason);
void OnNotDecoded(MediaData::Type, const MediaResult&);
void SetCallbacks();

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

@ -169,7 +169,7 @@ BenchmarkPlayback::DemuxSamples()
}
DemuxNextSample();
},
[this, ref](DemuxerFailureReason aReason) { MainThreadShutdown(); });
[this, ref](const MediaResult& aError) { MainThreadShutdown(); });
}
void
@ -190,9 +190,9 @@ BenchmarkPlayback::DemuxNextSample()
Dispatch(NS_NewRunnableFunction([this, ref]() { DemuxNextSample(); }));
}
},
[this, ref](DemuxerFailureReason aReason) {
switch (aReason) {
case DemuxerFailureReason::END_OF_STREAM:
[this, ref](const MediaResult& aError) {
switch (aError.Code()) {
case NS_ERROR_DOM_MEDIA_END_OF_STREAM:
InitDecoder(Move(*mTrackDemuxer->GetInfo()));
break;
default:
@ -218,7 +218,7 @@ BenchmarkPlayback::InitDecoder(TrackInfo&& aInfo)
[this, ref](TrackInfo::TrackType aTrackType) {
InputExhausted();
},
[this, ref](MediaDataDecoder::DecoderFailureReason aReason) {
[this, ref](MediaResult aError) {
MainThreadShutdown();
});
}
@ -281,7 +281,7 @@ BenchmarkPlayback::Output(MediaData* aData)
}
void
BenchmarkPlayback::Error(MediaDataDecoderError aError)
BenchmarkPlayback::Error(const MediaResult& aError)
{
RefPtr<Benchmark> ref(mMainThreadState);
Dispatch(NS_NewRunnableFunction([this, ref]() { MainThreadShutdown(); }));

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

@ -32,7 +32,7 @@ class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback
// MediaDataDecoderCallback
// Those methods are called on the MediaDataDecoder's task queue.
void Output(MediaData* aData) override;
void Error(MediaDataDecoderError aError) override;
void Error(const MediaResult& aError) override;
void InputExhausted() override;
void DrainComplete() override;
bool OnReaderTaskQueue() override;

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

@ -55,7 +55,7 @@ MP3Demuxer::Init() {
MP3LOG("MP3Demuxer::Init() failure: waiting for data");
return InitPromise::CreateAndReject(
DemuxerFailureReason::DEMUXER_ERROR, __func__);
NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__);
}
MP3LOG("MP3Demuxer::Init() successful");
@ -276,7 +276,7 @@ MP3TrackDemuxer::GetSamples(int32_t aNumSamples) {
if (!aNumSamples) {
return SamplesPromise::CreateAndReject(
DemuxerFailureReason::DEMUXER_ERROR, __func__);
NS_ERROR_DOM_MEDIA_DEMUXER_ERR, __func__);
}
RefPtr<SamplesHolder> frames = new SamplesHolder();
@ -300,7 +300,7 @@ MP3TrackDemuxer::GetSamples(int32_t aNumSamples) {
if (frames->mSamples.IsEmpty()) {
return SamplesPromise::CreateAndReject(
DemuxerFailureReason::END_OF_STREAM, __func__);
NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
}
return SamplesPromise::CreateAndResolve(frames, __func__);
}
@ -317,7 +317,7 @@ RefPtr<MP3TrackDemuxer::SkipAccessPointPromise>
MP3TrackDemuxer::SkipToNextRandomAccessPoint(TimeUnit aTimeThreshold) {
// Will not be called for audio-only resources.
return SkipAccessPointPromise::CreateAndReject(
SkipFailureHolder(DemuxerFailureReason::DEMUXER_ERROR, 0), __func__);
SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
}
int64_t

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

@ -12,6 +12,7 @@
#include "MediaData.h"
#include "MediaInfo.h"
#include "MediaResult.h"
#include "TimeUnits.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
@ -22,16 +23,6 @@ namespace mozilla {
class MediaTrackDemuxer;
class TrackMetadataHolder;
enum class DemuxerFailureReason : int8_t
{
WAITING_FOR_DATA,
END_OF_STREAM,
DEMUXER_ERROR,
CANCELED,
SHUTDOWN,
};
// Allows reading the media data: to retrieve the metadata and demux samples.
// MediaDataDemuxer isn't designed to be thread safe.
// When used by the MediaFormatDecoder, care is taken to ensure that the demuxer
@ -41,7 +32,7 @@ class MediaDataDemuxer
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDemuxer)
typedef MozPromise<nsresult, DemuxerFailureReason, /* IsExclusive = */ true> InitPromise;
typedef MozPromise<nsresult, MediaResult, /* IsExclusive = */ true> InitPromise;
// Initializes the demuxer. Other methods cannot be called unless
// initialization has completed and succeeded.
@ -120,16 +111,16 @@ public:
class SkipFailureHolder {
public:
SkipFailureHolder(DemuxerFailureReason aFailure, uint32_t aSkipped)
SkipFailureHolder(const MediaResult& aFailure, uint32_t aSkipped)
: mFailure(aFailure)
, mSkipped(aSkipped)
{}
DemuxerFailureReason mFailure;
MediaResult mFailure;
uint32_t mSkipped;
};
typedef MozPromise<media::TimeUnit, DemuxerFailureReason, /* IsExclusive = */ true> SeekPromise;
typedef MozPromise<RefPtr<SamplesHolder>, DemuxerFailureReason, /* IsExclusive = */ true> SamplesPromise;
typedef MozPromise<media::TimeUnit, MediaResult, /* IsExclusive = */ true> SeekPromise;
typedef MozPromise<RefPtr<SamplesHolder>, MediaResult, /* IsExclusive = */ true> SamplesPromise;
typedef MozPromise<uint32_t, SkipFailureHolder, /* IsExclusive = */ true> SkipAccessPointPromise;
// Returns the TrackInfo (a.k.a Track Description) for this track.

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

@ -198,7 +198,7 @@ MediaDecoder::ResourceCallback::NotifyDecodeError()
RefPtr<ResourceCallback> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
if (self->mDecoder) {
self->mDecoder->DecodeError();
self->mDecoder->DecodeError(NS_ERROR_DOM_MEDIA_FATAL_ERR);
}
});
AbstractThread::MainThread()->Dispatch(r.forget());
@ -607,6 +607,7 @@ MediaDecoder::Shutdown()
mMetadataLoadedListener.Disconnect();
mFirstFrameLoadedListener.Disconnect();
mOnPlaybackEvent.Disconnect();
mOnPlaybackErrorEvent.Disconnect();
mOnMediaNotSeekable.Disconnect();
mDecoderStateMachine->BeginShutdown()
@ -661,9 +662,6 @@ MediaDecoder::OnPlaybackEvent(MediaEventType aEvent)
case MediaEventType::SeekStarted:
SeekingStarted();
break;
case MediaEventType::DecodeError:
DecodeError();
break;
case MediaEventType::Invalidate:
Invalidate();
break;
@ -676,6 +674,12 @@ MediaDecoder::OnPlaybackEvent(MediaEventType aEvent)
}
}
void
MediaDecoder::OnPlaybackErrorEvent(const MediaResult& aError)
{
DecodeError(aError);
}
void
MediaDecoder::FinishShutdown()
{
@ -749,6 +753,8 @@ MediaDecoder::SetStateMachineParameters()
mOnPlaybackEvent = mDecoderStateMachine->OnPlaybackEvent().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackEvent);
mOnPlaybackErrorEvent = mDecoderStateMachine->OnPlaybackErrorEvent().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackErrorEvent);
mOnMediaNotSeekable = mDecoderStateMachine->OnMediaNotSeekable().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnMediaNotSeekable);
}
@ -1006,11 +1012,11 @@ MediaDecoder::NetworkError()
}
void
MediaDecoder::DecodeError()
MediaDecoder::DecodeError(const MediaResult& aError)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());
mOwner->DecodeError();
mOwner->DecodeError(aError);
MOZ_ASSERT(IsShutdown());
}

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

@ -436,7 +436,7 @@ private:
int64_t GetDownloadPosition();
// Notifies the element that decoding has failed.
void DecodeError();
void DecodeError(const MediaResult& aError);
// Indicate whether the media is same-origin with the element.
void UpdateSameOriginStatus(bool aSameOrigin);
@ -592,6 +592,7 @@ private:
DataArrivedEvent() override { return &mDataArrivedEvent; }
void OnPlaybackEvent(MediaEventType aEvent);
void OnPlaybackErrorEvent(const MediaResult& aError);
void OnMediaNotSeekable()
{
@ -731,6 +732,7 @@ protected:
MediaEventListener mFirstFrameLoadedListener;
MediaEventListener mOnPlaybackEvent;
MediaEventListener mOnPlaybackErrorEvent;
MediaEventListener mOnMediaNotSeekable;
protected:

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