Merge mozilla-central to inbound r=merge

This commit is contained in:
Dorel Luca 2017-12-14 12:00:32 +02:00
Родитель 220fd9a72a 110706c3c0
Коммит 94eadeb6c0
125 изменённых файлов: 1340 добавлений и 1912 удалений

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

@ -32,7 +32,6 @@ module.exports = {
// Browser: Bug 1421379
"browser/extensions/shield-recipe-client/test/browser/head.js",
"browser/modules/offlineAppCache.jsm",
"chrome/**",
"devtools/**",
"dom/indexedDB/**",
"dom/media/**",

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

@ -31,7 +31,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
Deprecated: "resource://gre/modules/Deprecated.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
E10SUtils: "resource:///modules/E10SUtils.jsm",
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
ExtensionsUI: "resource:///modules/ExtensionsUI.jsm",
FormValidationHandler: "resource:///modules/FormValidationHandler.jsm",
LanguagePrompt: "resource://gre/modules/LanguagePrompt.jsm",

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

@ -13,7 +13,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
"resource:///modules/E10SUtils.jsm");
"resource://gre/modules/E10SUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Utils",

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

@ -3,7 +3,7 @@
"use strict";
Cu.import("resource:///modules/E10SUtils.jsm");
Cu.import("resource://gre/modules/E10SUtils.jsm");
const ORIGIN = "https://example.com";
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "permissions.html";

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

@ -13,7 +13,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
"resource:///modules/E10SUtils.jsm");
"resource://gre/modules/E10SUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionParent",
"resource://gre/modules/ExtensionParent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",

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

@ -9,7 +9,7 @@
Cu.import("resource://gre/modules/ExtensionParent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
"resource:///modules/E10SUtils.jsm");
"resource://gre/modules/E10SUtils.jsm");
var {
IconDetails,

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

@ -324,12 +324,38 @@ class FormAutofillSection {
}
}
_adaptFieldMaxLength(profile) {
for (let key in profile) {
let detail = this.getFieldDetailByName(key);
if (!detail) {
continue;
}
let element = detail.elementWeakRef.get();
if (!element) {
continue;
}
let maxLength = element.maxLength;
if (maxLength === undefined || maxLength < 0 || profile[key].length <= maxLength) {
continue;
}
if (maxLength) {
profile[key] = profile[key].substr(0, maxLength);
} else {
delete profile[key];
}
}
}
getAdaptedProfiles(originalProfiles) {
for (let profile of originalProfiles) {
this._addressTransformer(profile);
this._telTransformer(profile);
this._matchSelectOptions(profile);
this._creditCardExpDateTransformer(profile);
this._adaptFieldMaxLength(profile);
}
return originalProfiles;
}

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

@ -18,6 +18,14 @@ const DEFAULT_ADDRESS_RECORD = {
"tel-national": "9876543210",
};
const ADDRESS_RECORD_2 = {
"guid": "address2",
"given-name": "John",
"additional-name": "Middle",
"family-name": "Doe",
"postal-code": "940012345",
};
const DEFAULT_CREDITCARD_RECORD = {
"guid": "123",
"cc-exp-month": 1,
@ -450,7 +458,7 @@ const TESTCASES = [
}],
},
{
description: "Checking maxlength first when a field is with maxlength.",
description: "Checking maxlength of tel field first when a field is with maxlength.",
document: `<form>
<input id="tel" autocomplete="tel" maxlength="10">
<input id="line1" autocomplete="address-line1">
@ -470,6 +478,38 @@ const TESTCASES = [
"tel-national": "9876543210",
}],
},
{
description: "Address form with maxlength restriction",
document: `<form>
<input autocomplete="given-name" maxlength="1">
<input autocomplete="additional-name" maxlength="1">
<input autocomplete="family-name" maxlength="1">
<input autocomplete="postal-code" maxlength="5">
</form>`,
profileData: [Object.assign({}, ADDRESS_RECORD_2)],
expectedResult: [{
"guid": "address2",
"given-name": "J",
"additional-name": "M",
"family-name": "D",
"postal-code": "94001",
}],
},
{
description: "Address form with the special cases of the maxlength restriction",
document: `<form>
<input autocomplete="given-name" maxlength="-1">
<input autocomplete="additional-name" maxlength="0">
<input autocomplete="family-name" maxlength="1">
</form>`,
profileData: [Object.assign({}, ADDRESS_RECORD_2)],
expectedResult: [{
"guid": "address2",
"given-name": "John",
"family-name": "D",
"postal-code": "940012345",
}],
},
{
description: "Credit Card form with matching options of cc-exp-year and cc-exp-month",
document: `<form>

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

@ -16,7 +16,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
E10SUtils: "resource:///modules/E10SUtils.jsm",
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
CastingApps: "resource:///modules/CastingApps.jsm",
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
PlacesUIUtils: "resource:///modules/PlacesUIUtils.jsm",

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

@ -64,9 +64,6 @@ with Files("ContentWebRTC.jsm"):
with Files("DirectoryLinksProvider.jsm"):
BUG_COMPONENT = ("Firefox", "New Tab Page")
with Files("E10SUtils.jsm"):
BUG_COMPONENT = ("Core", "Security: Process Sandboxing")
with Files("ExtensionsUI.jsm"):
BUG_COMPONENT = ("Toolkit", "WebExtensions: General")
@ -137,7 +134,6 @@ EXTRA_JS_MODULES += [
'ContentWebRTC.jsm',
'ContextMenu.jsm',
'DirectoryLinksProvider.jsm',
'E10SUtils.jsm',
'ExtensionsUI.jsm',
'Feeds.jsm',
'FormSubmitObserver.jsm',

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

@ -3,7 +3,7 @@
const {utils: Cu, interfaces: Ci} = Components;
Cu.import("resource:///modules/E10SUtils.jsm");
Cu.import("resource://gre/modules/E10SUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
var TEST_PREFERRED_REMOTE_TYPES = [

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

@ -9,7 +9,7 @@ this.EXPORTED_SYMBOLS = ["PermissionPrompts"];
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/E10SUtils.jsm");
Cu.import("resource://gre/modules/E10SUtils.jsm");
Cu.import("resource://testing-common/ContentTask.jsm");
Cu.import("resource://testing-common/BrowserTestUtils.jsm");

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

@ -1,10 +1,9 @@
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{4ba645d3-be6f-40d6-a42a-01b2f40091b8}");
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cr = Components.results;
let {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
function registerManifests(manifests) {
var reg = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);

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

@ -9,18 +9,15 @@ const MANIFESTS = [
registerManifests(MANIFESTS);
var gIOS;
var gCR;
function check_accessibility(spec, desired) {
var uri = gIOS.newURI(spec);
var uri = Services.io.newURI(spec);
var actual = gCR.allowContentToAccess(uri);
do_check_eq(desired, actual);
}
function run_test() {
gIOS = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry);
gCR.checkForNewChrome();

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

@ -18,17 +18,15 @@ updateAppInfo({
platformVersion: "1.9",
});
var gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
chromeReg.checkForNewChrome();
var target = gIOS.newFileURI(do_get_file("data"));
var target = Services.io.newFileURI(do_get_file("data"));
target = target.spec + "test/test.xul";
function test_succeeded_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
var result = chromeReg.convertChromeURL(uri);
do_check_eq(result.spec, target);
@ -38,7 +36,7 @@ function test_succeeded_mapping(namespace) {
}
function test_failed_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);

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

@ -18,17 +18,15 @@ updateAppInfo({
platformVersion: "1.9",
});
var gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
chromeReg.checkForNewChrome();
var target = gIOS.newFileURI(do_get_file("data"));
var target = Services.io.newFileURI(do_get_file("data"));
target = target.spec + "test/test.xul";
function test_succeeded_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
var result = chromeReg.convertChromeURL(uri);
do_check_eq(result.spec, target);
@ -38,7 +36,7 @@ function test_succeeded_mapping(namespace) {
}
function test_failed_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);

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

@ -17,17 +17,15 @@ updateAppInfo({
platformVersion: "1.9",
});
var gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
chromeReg.checkForNewChrome();
var target = gIOS.newFileURI(do_get_file("data"));
var target = Services.io.newFileURI(do_get_file("data"));
target = target.spec + "test/test.xul";
function test_succeeded_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
var result = chromeReg.convertChromeURL(uri);
do_check_eq(result.spec, target);
@ -37,7 +35,7 @@ function test_succeeded_mapping(namespace) {
}
function test_failed_mapping(namespace) {
var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul");
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
try {
chromeReg.convertChromeURL(uri);
do_throw(namespace);

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

@ -17,19 +17,17 @@ updateAppInfo({
platformVersion: "1.9",
});
var gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
chromeReg.checkForNewChrome();
var rph = gIOS.getProtocolHandler("resource")
var rph = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
function test_succeeded_mapping(namespace, target) {
try {
do_check_true(rph.hasSubstitution(namespace));
var uri = gIOS.newURI("resource://" + namespace);
var uri = Services.io.newURI("resource://" + namespace);
dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
do_check_eq(rph.resolveURI(uri), target);
} catch (ex) {
@ -43,7 +41,7 @@ function test_failed_mapping(namespace) {
}
function run_test() {
var data = gIOS.newFileURI(do_get_file("data")).spec;
var data = Services.io.newFileURI(do_get_file("data")).spec;
test_succeeded_mapping("test1", data + "test1/");
test_succeeded_mapping("test3", "jar:" + data + "test3.jar!/resources/");
test_failed_mapping("test4");

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

@ -3,15 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
function test_uri(obj) {
var uri = null;
var failed = false;
var message = "";
try {
uri = gIOS.newURI(obj.uri);
uri = Services.io.newURI(obj.uri);
if (!obj.result) {
failed = true;
message = obj.uri + " should not be accepted as a valid URI";

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

@ -6,9 +6,6 @@
const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");
var gIOS = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).
QueryInterface(Ci.nsIXULOverlayProvider);
@ -17,7 +14,7 @@ var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].
* Checks that a mapping was added
*/
function test_mapping(chromeURL, target) {
var uri = gIOS.newURI(chromeURL);
var uri = Services.io.newURI(chromeURL);
try {
var result = gCR.convertChromeURL(uri);
@ -31,7 +28,7 @@ function test_mapping(chromeURL, target) {
* Checks that a mapping was removed
*/
function test_removed_mapping(chromeURL, target) {
var uri = gIOS.newURI(chromeURL);
var uri = Services.io.newURI(chromeURL);
try {
gCR.convertChromeURL(uri);
do_throw(chromeURL + " not removed");
@ -47,7 +44,7 @@ function test_removed_mapping(chromeURL, target) {
* @param type The type of overlay: overlay|style
*/
function test_no_overlays(chromeURL, target, type = "overlay") {
var uri = gIOS.newURI(chromeURL);
var uri = Services.io.newURI(chromeURL);
var overlays = (type == "overlay") ?
gCR.getXULOverlays(uri) : gCR.getStyleOverlays(uri);
@ -109,8 +106,8 @@ function testManifest(manifestPath, baseURI) {
function run_test() {
// Test an unpackaged addon
testManifest(UNPACKAGED_ADDON, gIOS.newFileURI(UNPACKAGED_ADDON).spec);
testManifest(UNPACKAGED_ADDON, Services.io.newFileURI(UNPACKAGED_ADDON).spec);
// Test a packaged addon
testManifest(PACKAGED_ADDON, "jar:" + gIOS.newFileURI(PACKAGED_ADDON).spec + "!/");
testManifest(PACKAGED_ADDON, "jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/");
}

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

@ -18,10 +18,6 @@ var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.QueryInterface(Ci.nsIToolkitChromeRegistry);
chromeReg.checkForNewChrome();
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch);
function enum_to_array(strings) {
let rv = [];
while (strings.hasMore()) {
@ -41,7 +37,7 @@ function run_test() {
["en-US", "fr"]);
// with override
prefService.setCharPref("chrome.override_package.basepack", "overpack");
Services.prefs.setCharPref("chrome.override_package.basepack", "overpack");
do_check_eq(chromeReg.getSelectedLocale("basepack"), "de");
do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
["de", "en-US"]);

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

@ -4,9 +4,7 @@ function run_test() {
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
let sourceURI = ios.newURI("chrome://test_crlf/content/");
let sourceURI = Services.io.newURI("chrome://test_crlf/content/");
// this throws for packages that are not registered
let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;

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

@ -78,9 +78,7 @@ function run_test() {
let expectedURI = "data:application/vnd.mozilla.xul+xml,";
let sourceURI = "chrome://good-package/content/test.xul";
try {
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
sourceURI = ios.newURI(sourceURI);
sourceURI = Services.io.newURI(sourceURI);
// this throws for packages that are not registered
let uri = cr.convertChromeURL(sourceURI).spec;

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

@ -178,13 +178,11 @@ function run_test() {
break;
}
try {
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
sourceURI = ios.newURI(sourceURI);
sourceURI = Services.io.newURI(sourceURI);
let uri;
if (type == "resource") {
// resources go about a slightly different way than everything else
let rph = ios.getProtocolHandler("resource").
let rph = Services.io.getProtocolHandler("resource").
QueryInterface(Ci.nsIResProtocolHandler);
// this throws for packages that are not registered
uri = rph.resolveURI(sourceURI);

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

@ -13,9 +13,6 @@ var manifestFile = do_get_file("../unit/data/test_resolve_uris.manifest");
var manifests = [ manifestFile ];
registerManifests(manifests);
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
function do_run_test() {
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
@ -24,6 +21,7 @@ function do_run_test() {
// we don't need to worry about checking for new chrome.
var appInfo = Cc["@mozilla.org/xre/app-info;1"];
if (!appInfo ||
// eslint-disable-next-line mozilla/use-services
(appInfo.getService(Ci.nsIXULRuntime).processType ==
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT)) {
cr.checkForNewChrome();
@ -58,16 +56,16 @@ function do_run_test() {
expectedURI += "override-me.xul";
break;
case "resource":
expectedURI = ios.newFileURI(manifestFile.parent).spec;
expectedURI = Services.io.newFileURI(manifestFile.parent).spec;
sourceURI = "resource://foo/";
break;
}
try {
sourceURI = ios.newURI(sourceURI);
sourceURI = Services.io.newURI(sourceURI);
let uri;
if (type == "resource") {
// resources go about a slightly different way than everything else
let rph = ios.getProtocolHandler("resource").
let rph = Services.io.getProtocolHandler("resource").
QueryInterface(Ci.nsIResProtocolHandler);
uri = rph.resolveURI(sourceURI);
} else {

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

@ -212,6 +212,22 @@
fill: var(--theme-highlight-blue);
}
/******************************************************************************/
/* Jump to definition button */
.jump-definition svg {
stroke: var(--comment-node-color);
height: 16px;
width: 16px;
margin-left: .25em;
cursor: pointer;
vertical-align: middle;
}
.jump-definition svg:hover {
stroke: var(--theme-highlight-blue);
}
/******************************************************************************/
/* "more…" ellipsis */
.more-ellipsis {
@ -222,16 +238,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.tree {
--arrow-width: 10px;
--arrow-single-margin: 5px;
--arrow-total-width: calc(var(--arrow-width) + var(--arrow-single-margin));
--arrow-fill-color: var(--theme-splitter-color, #9B9B9B);
--tree-indent-width: 1em;
--tree-indent-border-color: #A2D1FF;
--tree-indent-border-width: 1px;
--tree-node-hover-background-color: #F0F9FE;
--tree-node-focus-color: white;
--tree-node-focus-background-color: var(--theme-selection-background, #0a84ff);
overflow: auto;
}
@ -255,25 +261,45 @@
display: block;
}
.tree .tree-node {
display: flex;
}
.tree-indent {
display: inline-block;
width: 12px;
margin-inline-start: 5px;
border-inline-start: 1px solid #A2D1FF;
flex-shrink: 0;
}
/* Align with expandables siblings (where we have the arrow) */
.tree-node[data-expandable="false"] .tree-indent:last-of-type {
margin-inline-end: 15px;
}
.tree .tree-node[data-expandable="true"] {
cursor: default;
}
.tree .tree-node:not(.focused):hover {
background-color: var(--tree-node-hover-background-color);
background-color: #F0F9FE;
}
.tree .tree-node.focused {
color: var(--tree-node-focus-color);
background-color: var(--tree-node-focus-background-color);
--arrow-fill-color: currentColor;
color: white;
background-color: var(--theme-selection-background, #0a84ff);
}
.tree-node.focused .arrow svg {
fill: currentColor;
}
.arrow svg {
fill: var(--arrow-fill-color);
fill: var(--theme-splitter-color, #9B9B9B);
transition: transform 0.125s ease;
width: var(--arrow-width);
margin-inline-end: var(--arrow-single-margin);
width: 10px;
margin-inline-end: 5px;
transform: rotate(-90deg);
}
@ -290,6 +316,10 @@ html[dir="rtl"] .arrow svg,
* 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/. */
.tree.object-inspector .node.object-node {
display: inline-block;
}
.tree.object-inspector .object-label,
.tree.object-inspector .object-label * {
color: var(--theme-highlight-blue);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -14,7 +14,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
"resource:///modules/E10SUtils.jsm");
"resource://gre/modules/E10SUtils.jsm");
/*
* The message manager has an upper limit on message sizes that it can

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

@ -492,6 +492,12 @@ nsISupports* CustomElementRegistry::GetParentObject() const
return mWindow;
}
DocGroup*
CustomElementRegistry::GetDocGroup() const
{
return mWindow ? mWindow->GetDocGroup() : nullptr;
}
static const char* kLifeCycleCallbackNames[] = {
"connectedCallback",
"disconnectedCallback",

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

@ -29,6 +29,7 @@ struct CustomElementData;
struct ElementDefinitionOptions;
class CallbackFunction;
class CustomElementReaction;
class DocGroup;
class Function;
class Promise;
@ -476,6 +477,8 @@ private:
public:
nsISupports* GetParentObject() const;
DocGroup* GetDocGroup() const;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void Define(const nsAString& aName, Function& aFunctionConstructor,

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

@ -778,6 +778,18 @@ Selection::GetParentObject() const
return nullptr;
}
DocGroup*
Selection::GetDocGroup() const
{
nsIPresShell* shell = GetPresShell();
if (!shell) {
return nullptr;
}
nsIDocument* doc = shell->GetDocument();
return doc ? doc->GetDocGroup() : nullptr;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(Selection)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Selection)

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

@ -37,6 +37,9 @@ namespace mozilla {
class ErrorResult;
class HTMLEditor;
struct AutoPrepareFocusRange;
namespace dom {
class DocGroup;
} // namespace dom
} // namespace mozilla
struct RangeData
@ -82,6 +85,7 @@ public:
void EndBatchChanges(int16_t aReason = nsISelectionListener::NO_REASON);
nsIDocument* GetParentObject() const;
DocGroup* GetDocGroup() const;
// utility methods for scrolling the selection into view
nsPresContext* GetPresContext() const;

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

@ -521,3 +521,9 @@ nsDOMAttributeMap::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return NamedNodeMapBinding::Wrap(aCx, this, aGivenProto);
}
DocGroup*
nsDOMAttributeMap::GetDocGroup() const
{
return mContent ? mContent->OwnerDoc()->GetDocGroup() : nullptr;
}

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

@ -22,6 +22,11 @@
class nsAtom;
class nsIDocument;
namespace mozilla {
namespace dom {
class DocGroup;
} // namespace dom
} // namespace mozilla
/**
* Structure used as a key for caching Attrs in nsDOMAttributeMap's mAttributeCache.
@ -87,6 +92,7 @@ class nsDOMAttributeMap final : public nsIDOMMozNamedAttrMap
{
public:
typedef mozilla::dom::Attr Attr;
typedef mozilla::dom::DocGroup DocGroup;
typedef mozilla::dom::Element Element;
typedef mozilla::ErrorResult ErrorResult;
@ -135,6 +141,7 @@ public:
return mContent;
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
DocGroup* GetDocGroup() const;
// WebIDL
Attr* GetNamedItem(const nsAString& aAttrName);

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

@ -412,6 +412,12 @@ nsDOMTokenList::Stringify(nsAString& aResult)
mElement->GetAttr(kNameSpaceID_None, mAttrAtom, aResult);
}
DocGroup*
nsDOMTokenList::GetDocGroup() const
{
return mElement ? mElement->OwnerDoc()->GetDocGroup() : nullptr;
}
JSObject*
nsDOMTokenList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
{

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

@ -22,7 +22,9 @@
namespace mozilla {
class ErrorResult;
namespace dom {
class DocGroup;
} // namespace dom
} // namespace mozilla
class nsAttrValue;
@ -35,6 +37,7 @@ class nsDOMTokenList : public nsISupports,
{
protected:
typedef mozilla::dom::Element Element;
typedef mozilla::dom::DocGroup DocGroup;
typedef nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
WhitespaceTokenizer;
@ -52,6 +55,8 @@ public:
return mElement;
}
DocGroup* GetDocGroup() const;
void RemoveDuplicates(const nsAttrValue* aAttr);
uint32_t Length();
void Item(uint32_t aIndex, nsAString& aResult)

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

@ -3126,3 +3126,9 @@ nsINode::IsStyledByServo() const
return OwnerDoc()->IsStyledByServo();
}
#endif
DocGroup*
nsINode::GetDocGroup() const
{
return OwnerDoc()->GetDocGroup();
}

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

@ -76,6 +76,7 @@ inline bool IsSpaceCharacter(char aChar) {
class AccessibleNode;
struct BoxQuadOptions;
struct ConvertCoordinateOptions;
class DocGroup;
class DOMPoint;
class DOMQuad;
class DOMRectReadOnly;
@ -292,6 +293,7 @@ class nsINode : public mozilla::dom::EventTarget
public:
typedef mozilla::dom::BoxQuadOptions BoxQuadOptions;
typedef mozilla::dom::ConvertCoordinateOptions ConvertCoordinateOptions;
typedef mozilla::dom::DocGroup DocGroup;
typedef mozilla::dom::DOMPoint DOMPoint;
typedef mozilla::dom::DOMPointInit DOMPointInit;
typedef mozilla::dom::DOMQuad DOMQuad;
@ -613,6 +615,11 @@ public:
return mNodeInfo->NamespaceID() == aNamespace;
}
/**
* Returns the DocGroup of the "node document" of this node.
*/
DocGroup* GetDocGroup() const;
/**
* Print a debugger friendly descriptor of this element. This will describe
* the position of this element in the document.

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

@ -49,6 +49,12 @@ nsRange::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return RangeBinding::Wrap(aCx, this, aGivenProto);
}
DocGroup*
nsRange::GetDocGroup() const
{
return mOwner ? mOwner->GetDocGroup() : nullptr;
}
/******************************************************
* stack based utilty class for managing monitor
******************************************************/

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

@ -29,6 +29,7 @@ namespace mozilla {
class ErrorResult;
namespace dom {
struct ClientRectsAndTexts;
class DocGroup;
class DocumentFragment;
class DOMRect;
class DOMRectList;
@ -43,6 +44,7 @@ class nsRange final : public nsIDOMRange,
public mozilla::LinkedListElement<nsRange>
{
typedef mozilla::ErrorResult ErrorResult;
typedef mozilla::dom::DocGroup DocGroup;
typedef mozilla::dom::DOMRect DOMRect;
typedef mozilla::dom::DOMRectList DOMRectList;
typedef mozilla::RangeBoundary RangeBoundary;
@ -368,6 +370,7 @@ public:
nsINode* GetParentObject() const { return mOwner; }
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override final;
DocGroup* GetDocGroup() const;
private:
// no copy's or assigns

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

@ -17,7 +17,7 @@
let Cu = Components.utils;
Cu.import("resource://gre/modules/Integration.jsm");
Cu.import("resource:///modules/E10SUtils.jsm");
Cu.import("resource://gre/modules/E10SUtils.jsm");
SimpleTest.waitForExplicitFinish();

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

@ -3527,28 +3527,6 @@ GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
return true;
}
CustomElementReactionsStack*
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj)
{
// This might not be the right object, if there are wrappers. Unwrap if we can.
JSObject* obj = js::CheckedUnwrap(aObj);
if (!obj) {
return nullptr;
}
nsGlobalWindowInner* window = xpc::WindowGlobalOrNull(obj);
if (!window) {
return nullptr;
}
DocGroup* docGroup = window->AsInner()->GetDocGroup();
if (!docGroup) {
return nullptr;
}
return docGroup->CustomElementReactionsStack();
}
// https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor
already_AddRefed<Element>
CreateXULOrHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,

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

@ -3384,12 +3384,6 @@ bool
GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
JS::MutableHandle<JSObject*> aDesiredProto);
// Get the CustomElementReactionsStack for the docgroup of the global
// of the underlying object of aObj. This can be null if aObj can't
// be CheckUnwrapped, or if the global of the result has no docgroup
// (e.g. because it's not a Window global).
CustomElementReactionsStack*
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj);
// This function is expected to be called from the constructor function for an
// HTML or XUL element interface; the global/callargs need to be whatever was
// passed to that constructor function.

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

@ -7856,16 +7856,16 @@ class CGPerSignatureCall(CGThing):
if (idlNode.getExtendedAttribute('CEReactions') is not None and
not getter):
cgThings.append(CGGeneric(fill(
cgThings.append(CGGeneric(dedent(
"""
Maybe<AutoCEReaction> ceReaction;
if (CustomElementRegistry::IsCustomElementEnabled()) {
CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(${obj});
if (reactionsStack) {
ceReaction.emplace(reactionsStack, cx);
DocGroup* docGroup = self->GetDocGroup();
if (docGroup) {
ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx);
}
}
""", obj=objectName)))
""")))
# If this is a method that was generated by a maplike/setlike
# interface, use the maplike/setlike generator to fill in the body.
@ -14164,6 +14164,8 @@ class CGForwardDeclarations(CGWrapper):
builder.add(d.nativeType + "Atoms", isStruct=True)
for t in getTypesFromDescriptor(d):
builder.forwardDeclareForType(t, config)
if d.hasCEReactions():
builder.addInMozillaDom("DocGroup")
for d in dictionaries:
if len(d.members) > 0:
@ -14235,18 +14237,15 @@ class CGBindingRoot(CGThing):
iface = desc.interface
return any(m.getExtendedAttribute("Deprecated") for m in iface.members + [iface])
def descriptorHasCEReactions(desc):
iface = desc.interface
return any(m.getExtendedAttribute("CEReactions") for m in iface.members + [iface])
bindingHeaders["nsIDocument.h"] = any(
descriptorDeprecated(d) for d in descriptors)
bindingHeaders["mozilla/Preferences.h"] = any(
descriptorRequiresPreferences(d) for d in descriptors)
bindingHeaders["mozilla/dom/DOMJSProxyHandler.h"] = any(
d.concrete and d.proxy for d in descriptors)
bindingHeaders["mozilla/dom/CustomElementRegistry.h"] = any(
descriptorHasCEReactions(d) for d in descriptors)
hasCEReactions = any(d.hasCEReactions() for d in descriptors)
bindingHeaders["mozilla/dom/CustomElementRegistry.h"] = hasCEReactions
bindingHeaders["mozilla/dom/DocGroup.h"] = hasCEReactions
def descriptorHasChromeOnly(desc):
ctor = desc.interface.ctor()
@ -15087,6 +15086,12 @@ class CGBindingImplClass(CGClass):
breakAfterReturnDecl=" ",
override=descriptor.wrapperCache,
body=self.getWrapObjectBody()))
if descriptor.hasCEReactions():
self.methodDecls.insert(0,
ClassMethod("GetDocGroup", "DocGroup*", [],
const=True,
breakAfterReturnDecl=" ",
body=self.getGetDocGroupBody()))
if wantGetParent:
self.methodDecls.insert(0,
ClassMethod("GetParentObject",
@ -15107,6 +15112,9 @@ class CGBindingImplClass(CGClass):
def getGetParentObjectBody(self):
return None
def getGetDocGroupBody(self):
return None
def deps(self):
return self._deps
@ -15246,6 +15254,8 @@ class CGExampleRoot(CGThing):
self.root = CGNamespace.build(["mozilla", "dom"], self.root)
builder = ForwardDeclarationBuilder()
if descriptor.hasCEReactions():
builder.addInMozillaDom("DocGroup")
for member in descriptor.interface.members:
if not member.isAttr() and not member.isMethod():
continue
@ -15563,7 +15573,7 @@ class CGJSImplClass(CGBindingImplClass):
private:
RefPtr<${jsImplName}> mImpl;
nsCOMPtr<nsISupports> mParent;
nsCOMPtr<nsIGlobalObject> mParent;
""",
isupportsDecl=isupportsDecl,
@ -15653,6 +15663,16 @@ class CGJSImplClass(CGBindingImplClass):
def getGetParentObjectBody(self):
return "return mParent;\n"
def getGetDocGroupBody(self):
return dedent(
"""
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mParent);
if (!window) {
return nullptr;
}
return window->GetDocGroup();
""")
def getCreateFromExistingBody(self):
# XXXbz we could try to get parts of this (e.g. the argument
# conversions) auto-generated by somehow creating an IDLMethod and

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

@ -708,6 +708,9 @@ class Descriptor(DescriptorProvider):
not self.interface.isExposedInWindow()) or
self.interface.isExposedInSomeButNotAllWorkers())
def hasCEReactions(self):
return any(m.getExtendedAttribute("CEReactions") for m in self.interface.members)
def isExposedConditionally(self):
return (self.interface.isExposedConditionally() or
self.interface.isExposedInSomeButNotAllWorkers())

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

@ -21,6 +21,7 @@
// this one for it, for ParentDict. Hopefully it won't begin to rely on it in more fundamental ways.
namespace mozilla {
namespace dom {
class DocGroup;
class TestExternalInterface;
class Promise;
} // namespace dom
@ -115,8 +116,9 @@ class TestInterface : public nsISupports,
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
// We need a GetParentObject and GetDocGroup to make binding codegen happy
virtual nsISupports* GetParentObject();
DocGroup* GetDocGroup() const;
// And now our actual WebIDL API
// Constructors
@ -1478,8 +1480,9 @@ class TestCEReactionsInterface : public nsISupports,
public:
NS_DECL_ISUPPORTS
// We need a GetParentObject to make binding codegen happy
// We need a GetParentObject and GetDocGroup to make binding codegen happy
virtual nsISupports* GetParentObject();
DocGroup* GetDocGroup() const;
int32_t Item(uint32_t);
uint32_t Length() const;

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

@ -230,6 +230,12 @@ HTMLOptionsCollection::GetParentObject()
return mSelect;
}
DocGroup*
HTMLOptionsCollection::GetDocGroup() const
{
return mSelect ? mSelect->GetDocGroup() : nullptr;
}
void
HTMLOptionsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
{

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

@ -20,6 +20,7 @@
namespace mozilla {
namespace dom {
class DocGroup;
class HTMLElementOrLong;
class HTMLOptionElementOrHTMLOptGroupElement;
class HTMLSelectElement;
@ -58,6 +59,7 @@ public:
virtual uint32_t Length() override;
virtual Element* GetElementAt(uint32_t aIndex) override;
virtual nsINode* GetParentObject() override;
DocGroup* GetDocGroup() const;
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(HTMLOptionsCollection,
nsIHTMLCollection)

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

@ -62,6 +62,12 @@ nsDOMStringMap::~nsDOMStringMap()
}
}
DocGroup*
nsDOMStringMap::GetDocGroup() const
{
return mElement ? mElement->GetDocGroup() : nullptr;
}
/* virtual */
JSObject*
nsDOMStringMap::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)

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

@ -16,6 +16,9 @@
namespace mozilla {
class ErrorResult;
namespace dom {
class DocGroup;
} // namespace dom
} // namespace mozilla
class nsDOMStringMap : public nsStubMutationObserver,
@ -32,6 +35,8 @@ public:
return mElement;
}
mozilla::dom::DocGroup* GetDocGroup() const;
explicit nsDOMStringMap(mozilla::dom::Element* aElement);
// WebIDL API

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

@ -97,7 +97,7 @@ public:
}
// Returns true if the resource is a live stream.
bool IsLiveStream() { return GetLength() == -1; }
virtual bool IsLiveStream() const { return false; }
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

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

@ -259,6 +259,7 @@ ChannelMediaDecoder::Load(nsIChannel* aChannel,
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mResource);
MOZ_ASSERT(aStreamListener);
AbstractThread::AutoEnter context(AbstractMainThread());
mResource =
BaseMediaResource::Create(mResourceCallback, aChannel, aIsPrivateBrowsing);
@ -278,6 +279,8 @@ ChannelMediaDecoder::Load(nsIChannel* aChannel,
SetStateMachine(CreateStateMachine());
NS_ENSURE_TRUE(GetStateMachine(), NS_ERROR_FAILURE);
GetStateMachine()->DispatchIsLiveStream(mResource->IsLiveStream());
return InitializeStateMachine();
}
@ -286,6 +289,7 @@ ChannelMediaDecoder::Load(BaseMediaResource* aOriginal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mResource);
AbstractThread::AutoEnter context(AbstractMainThread());
mResource = aOriginal->CloneData(mResourceCallback);
if (!mResource) {
@ -301,6 +305,8 @@ ChannelMediaDecoder::Load(BaseMediaResource* aOriginal)
SetStateMachine(CreateStateMachine());
NS_ENSURE_TRUE(GetStateMachine(), NS_ERROR_FAILURE);
GetStateMachine()->DispatchIsLiveStream(mResource->IsLiveStream());
return InitializeStateMachine();
}
@ -313,6 +319,11 @@ ChannelMediaDecoder::NotifyDownloadEnded(nsresult aStatus)
LOG("NotifyDownloadEnded, status=%" PRIx32, static_cast<uint32_t>(aStatus));
if (NS_SUCCEEDED(aStatus)) {
// Download ends successfully. This is a stream with a finite length.
GetStateMachine()->DispatchIsLiveStream(false);
}
MediaDecoderOwner* owner = GetOwner();
if (NS_SUCCEEDED(aStatus) || aStatus == NS_BASE_STREAM_CLOSED) {
nsCOMPtr<nsIRunnable> r =
@ -346,13 +357,6 @@ ChannelMediaDecoder::CanPlayThroughImpl()
return mCanPlayThrough;
}
bool
ChannelMediaDecoder::IsLiveStream()
{
MOZ_ASSERT(NS_IsMainThread());
return mResource->IsLiveStream();
}
void
ChannelMediaDecoder::OnPlaybackEvent(MediaPlaybackEvent&& aEvent)
{

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

@ -122,8 +122,6 @@ private:
bool CanPlayThroughImpl() override final;
bool IsLiveStream() override final;
struct PlaybackRateInfo
{
uint32_t mRate; // Estimate of the current playback rate (bytes/second).

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

@ -463,6 +463,7 @@ ChannelMediaResource::Open(nsIStreamListener** aStreamListener)
return rv;
}
mIsLiveStream = cl < 0;
MOZ_ASSERT(GetOffset() == 0, "Who set offset already?");
mListener = new Listener(this, 0, ++mLoadID);
*aStreamListener = mListener;
@ -565,6 +566,7 @@ ChannelMediaResource::CloneData(MediaResourceCallback* aCallback)
RefPtr<ChannelMediaResource> resource =
new ChannelMediaResource(aCallback, nullptr, mURI);
resource->mIsLiveStream = mIsLiveStream;
resource->mIsTransportSeekable = mIsTransportSeekable;
// Initially the clone is treated as suspended by the cache, because
@ -782,11 +784,14 @@ ChannelMediaResource::CacheClientNotifyDataReceived()
void
ChannelMediaResource::CacheClientNotifyDataEnded(nsresult aStatus)
{
mCallback->AbstractMainThread()->Dispatch(
NewRunnableMethod<nsresult>("MediaResourceCallback::NotifyDataEnded",
mCallback.get(),
&MediaResourceCallback::NotifyDataEnded,
aStatus));
mCallback->AbstractMainThread()->Dispatch(NS_NewRunnableFunction(
"ChannelMediaResource::CacheClientNotifyDataEnded",
[ self = RefPtr<ChannelMediaResource>(this), aStatus ]() {
if (NS_SUCCEEDED(aStatus)) {
self->mIsLiveStream = false;
}
self->mCallback->NotifyDataEnded(aStatus);
}));
}
void

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

@ -133,6 +133,7 @@ public:
int64_t GetCachedDataEnd(int64_t aOffset) override;
bool IsDataCachedToEndOfResource(int64_t aOffset) override;
bool IsTransportSeekable() override;
bool IsLiveStream() const override { return mIsLiveStream; }
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override {
// Might be useful to track in the future:
@ -246,6 +247,7 @@ protected:
// Used by the cache to store the offset to seek to when we are resumed.
// -1 means no seek initiated by the cache is waiting.
int64_t mPendingSeekOffset = -1;
bool mIsLiveStream = false;
// Any thread access
MediaCacheStream mCacheStream;

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

@ -2684,11 +2684,6 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
return NS_ERROR_ABORT;
}
if (mDidNotifyDataEnded && NS_FAILED(mNotifyDataEndedStatus)) {
// Abort reading since download ends abnormally.
return NS_ERROR_FAILURE;
}
if (!IsOffsetAllowed(streamOffset)) {
LOGE("Stream %p invalid offset=%" PRId64, this, streamOffset);
return NS_ERROR_ILLEGAL_VALUE;
@ -2734,6 +2729,16 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
break;
}
if (mDidNotifyDataEnded && NS_FAILED(mNotifyDataEndedStatus)) {
// Since download ends abnormally, there is no point in waiting for new
// data to come. We will check the partial block to read as many bytes as
// possible before exiting this function.
bytes = ReadPartialBlock(lock, streamOffset, buffer);
streamOffset += bytes;
buffer = buffer.From(bytes);
break;
}
if (mStreamOffset != streamOffset) {
// Update mStreamOffset before we drop the lock. We need to run
// Update() again since stream reading strategy might have changed.

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

@ -565,11 +565,6 @@ MediaDecoder::CallSeek(const SeekTarget& aTarget)
AbstractThread::AutoEnter context(AbstractMainThread());
DiscardOngoingSeekIfExists();
// Since we don't have a listener for changes in IsLiveStream, our best bet
// is to ensure IsLiveStream is uptodate when seek begins. This value will be
// checked when seek is completed.
mDecoderStateMachine->DispatchIsLiveStream(IsLiveStream());
mDecoderStateMachine->InvokeSeek(aTarget)
->Then(mAbstractMainThread, __func__, this,
&MediaDecoder::OnSeekResolved, &MediaDecoder::OnSeekRejected)

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

@ -503,7 +503,6 @@ private:
void DisconnectMirrors();
virtual bool CanPlayThroughImpl() = 0;
virtual bool IsLiveStream() = 0;
// The state machine object for handling the decoding. It is safe to
// call methods of this object from other threads. Its internal data

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

@ -141,6 +141,7 @@ nsresult
HLSDecoder::Load(nsIChannel* aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
AbstractThread::AutoEnter context(AbstractMainThread());
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(mURI));
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -166,6 +167,8 @@ HLSDecoder::Load(nsIChannel* aChannel)
SetStateMachine(CreateStateMachine());
NS_ENSURE_TRUE(GetStateMachine(), NS_ERROR_FAILURE);
GetStateMachine()->DispatchIsLiveStream(false);
return InitializeStateMachine();
}

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

@ -59,8 +59,6 @@ private:
return true;
}
bool IsLiveStream() override final { return false; }
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIURI> mURI;
java::GeckoHLSResourceWrapper::GlobalRef mHLSResourceWrapper;

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

@ -81,6 +81,7 @@ MediaSourceDecoder::Load(nsIPrincipal* aPrincipal)
rv = GetStateMachine()->Init(this);
NS_ENSURE_SUCCESS(rv, rv);
GetStateMachine()->DispatchIsLiveStream(!mEnded);
SetStateMachineParameters();
return NS_OK;
}
@ -216,6 +217,7 @@ MediaSourceDecoder::Ended(bool aEnded)
NotifyDataArrived();
}
mEnded = aEnded;
GetStateMachine()->DispatchIsLiveStream(!mEnded);
}
void

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

@ -79,7 +79,6 @@ private:
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
bool CanPlayThroughImpl() override;
bool IsLiveStream() override final { return !mEnded; }
RefPtr<nsIPrincipal> mPrincipal;

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

@ -1262,6 +1262,11 @@ txMozillaXSLTProcessor::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenP
return XSLTProcessorBinding::Wrap(aCx, this, aGivenProto);
}
DocGroup*
txMozillaXSLTProcessor::GetDocGroup() const
{
return mStylesheetDocument ? mStylesheetDocument->GetDocGroup() : nullptr;
}
/* static */ already_AddRefed<txMozillaXSLTProcessor>
txMozillaXSLTProcessor::Constructor(const GlobalObject& aGlobal,

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

@ -30,6 +30,7 @@ class txIGlobalParameter;
namespace mozilla {
namespace dom {
class DocGroup;
class Document;
class DocumentFragment;
class GlobalObject;
@ -104,6 +105,8 @@ public:
return mOwner;
}
mozilla::dom::DocGroup* GetDocGroup() const;
static already_AddRefed<txMozillaXSLTProcessor>
Constructor(const mozilla::dom::GlobalObject& aGlobal,
mozilla::ErrorResult& aRv);

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

@ -132,7 +132,8 @@ class WasmToken
UnsignedInteger,
ValueType,
Wait,
Wake
Wake,
Invalid
};
private:
Kind kind_;
@ -149,7 +150,7 @@ class WasmToken
} u;
public:
WasmToken()
: kind_(Kind(-1)),
: kind_(Kind::Invalid),
begin_(nullptr),
end_(nullptr),
u()
@ -160,6 +161,7 @@ class WasmToken
end_(end)
{
MOZ_ASSERT(kind_ != Error);
MOZ_ASSERT(kind_ != Invalid);
MOZ_ASSERT((kind == EndOfFile) == (begin == end));
}
explicit WasmToken(uint32_t index, const char16_t* begin, const char16_t* end)
@ -231,7 +233,7 @@ class WasmToken
end_(begin)
{}
Kind kind() const {
MOZ_ASSERT(kind_ != Kind(-1));
MOZ_ASSERT(kind_ != Kind::Invalid);
return kind_;
}
const char16_t* begin() const {
@ -353,6 +355,8 @@ class WasmToken
case UnsignedInteger:
case ValueType:
return false;
case Invalid:
break;
}
MOZ_CRASH("unexpected token kind");
}

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

@ -2684,11 +2684,15 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize,
// structure; likewise if any item is shrinking. Items in
// a line can't be both growing and shrinking.
if (deltaSize > 0) {
MOZ_ASSERT(item->IsFrozen() || isUsingFlexGrow,
"Unfrozen items shouldn't grow without isUsingFlexGrow.");
MOZ_ASSERT(aLineInfo->mGrowthState !=
ComputedFlexLineInfo::GrowthState::SHRINKING);
aLineInfo->mGrowthState =
ComputedFlexLineInfo::GrowthState::GROWING;
} else if (deltaSize < 0) {
MOZ_ASSERT(item->IsFrozen() || !isUsingFlexGrow,
"Unfrozen items shouldn't shrink with isUsingFlexGrow.");
MOZ_ASSERT(aLineInfo->mGrowthState !=
ComputedFlexLineInfo::GrowthState::GROWING);
aLineInfo->mGrowthState =

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

@ -78,6 +78,16 @@ public:
return mRule ? mRule->GetDocument() : nullptr;
}
DocGroup* GetDocGroup() const final
{
if (!mRule) {
return nullptr;
}
nsIDocument* document = mRule->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);

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

@ -59,6 +59,13 @@ ServoPageRuleDeclaration::GetParentObject()
return Rule()->GetDocument();
}
DocGroup*
ServoPageRuleDeclaration::GetDocGroup() const
{
nsIDocument* document = Rule()->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
DeclarationBlock*
ServoPageRuleDeclaration::GetCSSDeclaration(Operation aOperation)
{

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

@ -16,6 +16,10 @@
namespace mozilla {
namespace dom {
class DocGroup;
} // namespace dom
class ServoDeclarationBlock;
class ServoPageRule;
@ -26,6 +30,7 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParent) final;
nsINode* GetParentObject() final;
DocGroup* GetDocGroup() const final;
protected:
DeclarationBlock* GetCSSDeclaration(Operation aOperation) final;

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

@ -61,6 +61,13 @@ ServoStyleRuleDeclaration::GetParentObject()
return Rule()->GetDocument();
}
DocGroup*
ServoStyleRuleDeclaration::GetDocGroup() const
{
nsIDocument* document = Rule()->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
DeclarationBlock*
ServoStyleRuleDeclaration::GetCSSDeclaration(Operation aOperation)
{

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

@ -20,6 +20,10 @@
namespace mozilla {
namespace dom {
class DocGroup;
} // namespace dom
class ServoDeclarationBlock;
class ServoStyleRule;
@ -30,6 +34,7 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParent) final;
nsINode* GetParentObject() final;
mozilla::dom::DocGroup* GetDocGroup() const final;
protected:
DeclarationBlock* GetCSSDeclaration(Operation aOperation) final;

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

@ -1081,6 +1081,16 @@ public:
return mRule ? mRule->GetDocument() : nullptr;
}
virtual DocGroup* GetDocGroup() const override
{
if (!mRule) {
return nullptr;
}
nsIDocument* document = mRule->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
protected:
// This reference is not reference-counted. The rule object owns us and we go
// away when it does.

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

@ -302,6 +302,13 @@ nsCSSFontFaceStyleDecl::GetParentObject()
return ContainingRule()->GetDocument();
}
DocGroup*
nsCSSFontFaceStyleDecl::GetDocGroup() const
{
nsIDocument* document = ContainingRule()->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
JSObject*
nsCSSFontFaceStyleDecl::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
{

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

@ -14,6 +14,10 @@
namespace mozilla {
namespace dom {
class DocGroup;
} // namespace dom
struct CSSFontFaceDescriptors
{
#define CSS_FONT_DESC(name_, method_) nsCSSValue m##method_;
@ -43,6 +47,7 @@ public:
using nsICSSDeclaration::GetPropertyCSSValue;
virtual nsINode *GetParentObject() override;
virtual mozilla::dom::DocGroup* GetDocGroup() const override;
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) override;
nsresult GetPropertyValue(nsCSSFontDesc aFontDescID,

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

@ -909,6 +909,17 @@ nsCSSKeyframeStyleDeclaration::GetParentObject()
return mRule ? mRule->GetDocument() : nullptr;
}
DocGroup*
nsCSSKeyframeStyleDeclaration::GetDocGroup() const
{
if (!mRule) {
return nullptr;
}
nsIDocument* document = mRule->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
// -------------------------------------------
// nsCSSKeyframeRule
//
@ -1341,6 +1352,17 @@ nsCSSPageStyleDeclaration::GetParentObject()
return mRule ? mRule->GetDocument() : nullptr;
}
DocGroup*
nsCSSPageStyleDeclaration::GetDocGroup() const
{
if (!mRule) {
return nullptr;
}
nsIDocument* document = mRule->GetDocument();
return document ? document->GetDocGroup() : nullptr;
}
// -------------------------------------------
// nsCSSPageRule
//

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

@ -43,6 +43,7 @@ namespace mozilla {
class ErrorResult;
namespace dom {
class DocGroup;
class MediaList;
}
@ -229,6 +230,7 @@ public:
nsICSSDeclaration)
virtual nsINode* GetParentObject() override;
virtual mozilla::dom::DocGroup* GetDocGroup() const override;
protected:
virtual ~nsCSSKeyframeStyleDeclaration();
@ -354,6 +356,7 @@ public:
nsICSSDeclaration)
virtual nsINode *GetParentObject() override;
virtual mozilla::dom::DocGroup* GetDocGroup() const override;
protected:
virtual ~nsCSSPageStyleDeclaration();

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

@ -29,6 +29,7 @@
namespace mozilla {
namespace dom {
class DocGroup;
class Element;
} // namespace dom
struct ComputedGridTrackInfo;
@ -92,6 +93,11 @@ public:
return mContent;
}
virtual mozilla::dom::DocGroup* GetDocGroup() const override
{
return mContent ? mContent->GetDocGroup() : nullptr;
}
static already_AddRefed<nsStyleContext>
GetStyleContext(mozilla::dom::Element* aElement, nsAtom* aPseudo,
nsIPresShell* aPresShell,

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

@ -203,6 +203,12 @@ nsDOMCSSAttributeDeclaration::GetParentObject()
return mElement;
}
/* virtual */ DocGroup*
nsDOMCSSAttributeDeclaration::GetDocGroup() const
{
return mElement ? mElement->OwnerDoc()->GetDocGroup() : nullptr;
}
NS_IMETHODIMP
nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aValue,

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

@ -39,6 +39,7 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
virtual nsINode* GetParentObject() override;
virtual DocGroup* GetDocGroup() const override;
NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aValue,

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

@ -33,6 +33,11 @@
class nsINode;
class nsIPrincipal;
namespace mozilla {
namespace dom {
class DocGroup;
} // namespace dom
} // namespace mozilla
// dbeabbfa-6cb3-4f5c-aec2-dd558d9d681f
#define NS_ICSSDECLARATION_IID \
@ -62,6 +67,7 @@ public:
nsIPrincipal* aSubjectPrincipal = nullptr) = 0;
virtual nsINode *GetParentObject() = 0;
virtual mozilla::dom::DocGroup* GetDocGroup() const = 0;
// Also have to declare all the nsIDOMCSSStyleDeclaration methods,
// since we want to be able to call them from the WebIDL versions.

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

@ -15,6 +15,7 @@ nsHtml5SpeculativeLoad::nsHtml5SpeculativeLoad()
mIsDefer(false)
{
MOZ_COUNT_CTOR(nsHtml5SpeculativeLoad);
new(&mCharsetOrSrcset) nsString;
}
nsHtml5SpeculativeLoad::~nsHtml5SpeculativeLoad()
@ -22,6 +23,9 @@ nsHtml5SpeculativeLoad::~nsHtml5SpeculativeLoad()
MOZ_COUNT_DTOR(nsHtml5SpeculativeLoad);
NS_ASSERTION(mOpCode != eSpeculativeLoadUninitialized,
"Uninitialized speculative load.");
if (mOpCode != eSpeculativeLoadSetDocumentCharset) {
mCharsetOrSrcset.~nsString();
}
}
void
@ -73,12 +77,10 @@ nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor)
aExecutor->ProcessOfflineManifest(mUrlOrSizes);
break;
case eSpeculativeLoadSetDocumentCharset: {
nsAutoCString narrowName;
CopyUTF16toUTF8(mCharsetOrSrcset, narrowName);
NS_ASSERTION(mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity.Length() == 1,
"Unexpected charset source string");
int32_t intSource = (int32_t)mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity.First();
aExecutor->SetDocumentCharsetAndSource(Encoding::ForName(narrowName),
aExecutor->SetDocumentCharsetAndSource(WrapNotNull(mEncoding),
intSource);
}
break;

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

@ -31,6 +31,8 @@ enum eHtml5SpeculativeLoad {
};
class nsHtml5SpeculativeLoad {
using Encoding = mozilla::Encoding;
template <typename T> using NotNull = mozilla::NotNull<T>;
public:
nsHtml5SpeculativeLoad();
~nsHtml5SpeculativeLoad();
@ -190,13 +192,14 @@ class nsHtml5SpeculativeLoad {
* sheets. Thus, encoding decisions by the parser thread have to maintain
* the queue order relative to true speculative loads. See bug 675499.
*/
inline void InitSetDocumentCharset(nsACString& aCharset,
inline void InitSetDocumentCharset(NotNull<const Encoding*> aEncoding,
int32_t aCharsetSource)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadSetDocumentCharset;
CopyUTF8toUTF16(aCharset, mCharsetOrSrcset);
mCharsetOrSrcset.~nsString();
mEncoding = aEncoding;
mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity.Assign((char16_t)aCharsetSource);
}
@ -257,7 +260,10 @@ class nsHtml5SpeculativeLoad {
* or eSpeculativeLoadPictureSource, this is the value of the "srcset" attribute.
* If the attribute is not set, this will be a void string. Otherwise it's empty.
*/
nsString mCharsetOrSrcset;
union {
nsString mCharsetOrSrcset;
const Encoding* mEncoding;
};
/**
* If mOpCode is eSpeculativeLoadSetDocumentCharset, this is a
* one-character string whose single character's code point is to be

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

@ -1197,10 +1197,8 @@ nsHtml5TreeBuilder::SetDocumentCharset(NotNull<const Encoding*> aEncoding,
if (mBuilder) {
mBuilder->SetDocumentCharsetAndSource(aEncoding, aCharsetSource);
} else if (mSpeculativeLoadStage) {
nsAutoCString charset;
aEncoding->Name(charset);
mSpeculativeLoadQueue.AppendElement()->InitSetDocumentCharset(
charset, aCharsetSource);
aEncoding, aCharsetSource);
} else {
mOpQueue.AppendElement()->Init(
eTreeOpSetDocumentCharset, aEncoding, aCharsetSource);

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

@ -1700,7 +1700,7 @@ impl FragmentDisplayListBuilding for Fragment {
style: &ComputedValues,
bounds: &Rect<Au>,
clip: &Rect<Au>) {
use style::values::Either;
use style::values::specified::outline::OutlineStyle;
let width = Au::from(style.get_outline().outline_width);
if width == Au(0) {
@ -1708,9 +1708,9 @@ impl FragmentDisplayListBuilding for Fragment {
}
let outline_style = match style.get_outline().outline_style {
Either::First(_auto) => BorderStyle::Solid,
Either::Second(BorderStyle::None) => return,
Either::Second(border_style) => border_style
OutlineStyle::Auto => BorderStyle::Solid,
OutlineStyle::Other(BorderStyle::None) => return,
OutlineStyle::Other(border_style) => border_style
};
// Outlines are not accounted for in the dimensions of the border box, so adjust the

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

@ -61,6 +61,7 @@ use values::{self, Auto, CustomIdent, Either, KeyframesName, None_};
use values::computed::{NonNegativeLength, ToComputedValue, Percentage};
use values::computed::font::{FontSize, SingleFontFamily};
use values::computed::effects::{BoxShadow, Filter, SimpleShadow};
use values::computed::outline::OutlineStyle;
use computed_values::border_style;
pub mod style_structs {
@ -2348,10 +2349,10 @@ fn static_assert() {
// cast + static_asserts
let result = match v {
% for value in border_style_keyword.values_for('gecko'):
Either::Second(border_style::T::${to_camel_case(value)}) =>
OutlineStyle::Other(border_style::T::${to_camel_case(value)}) =>
structs::${border_style_keyword.gecko_constant(value)} ${border_style_keyword.maybe_cast("u8")},
% endfor
Either::First(Auto) =>
OutlineStyle::Auto =>
structs::${border_style_keyword.gecko_constant('auto')} ${border_style_keyword.maybe_cast("u8")},
};
${set_gecko_property("mOutlineStyle", "result")}
@ -2378,10 +2379,10 @@ fn static_assert() {
match ${get_gecko_property("mOutlineStyle")} ${border_style_keyword.maybe_cast("u32")} {
% for value in border_style_keyword.values_for('gecko'):
structs::${border_style_keyword.gecko_constant(value)} => {
Either::Second(border_style::T::${to_camel_case(value)})
OutlineStyle::Other(border_style::T::${to_camel_case(value)})
},
% endfor
structs::${border_style_keyword.gecko_constant('auto')} => Either::First(Auto),
structs::${border_style_keyword.gecko_constant('auto')} => OutlineStyle::Auto,
% if border_style_keyword.gecko_inexhaustive:
x => panic!("Found unexpected value in style struct for outline_style property: {:?}", x),
% endif

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

@ -20,51 +20,14 @@ ${helpers.predefined_type(
spec="https://drafts.csswg.org/css-ui/#propdef-outline-color",
)}
<%helpers:longhand name="outline-style" animation_value_type="discrete"
spec="https://drafts.csswg.org/css-ui/#propdef-outline-style">
use values::specified::BorderStyle;
pub type SpecifiedValue = Either<Auto, BorderStyle>;
impl SpecifiedValue {
#[inline]
pub fn none_or_hidden(&self) -> bool {
match *self {
Either::First(ref _auto) => false,
Either::Second(ref border_style) => border_style.none_or_hidden()
}
}
}
#[inline]
pub fn get_initial_value() -> computed_value::T {
Either::Second(BorderStyle::None)
}
#[inline]
pub fn get_initial_specified_value() -> SpecifiedValue {
Either::Second(BorderStyle::None)
}
pub mod computed_value {
pub type T = super::SpecifiedValue;
}
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
SpecifiedValue::parse(context, input)
.and_then(|result| {
if let Either::Second(BorderStyle::Hidden) = result {
// The outline-style property accepts the same values as
// border-style, except that 'hidden' is not a legal outline
// style.
Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("hidden".into())))
} else {
Ok(result)
}
})
}
</%helpers:longhand>
${helpers.predefined_type(
"outline-style",
"OutlineStyle",
"computed::OutlineStyle::none()",
initial_specified_value="specified::OutlineStyle::none()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-style",
)}
${helpers.predefined_type("outline-width",
"BorderSideWidth",

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

@ -54,6 +54,7 @@ pub use super::specified::{BorderStyle, TextDecorationLine};
pub use self::length::{CalcLengthOrPercentage, Length, LengthOrNone, LengthOrNumber, LengthOrPercentage};
pub use self::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, MaxLength, MozLength};
pub use self::length::{CSSPixelLength, NonNegativeLength, NonNegativeLengthOrPercentage};
pub use self::outline::OutlineStyle;
pub use self::percentage::Percentage;
pub use self::position::{Position, GridAutoFlow, GridTemplateAreas};
pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind, SVGStrokeDashArray, SVGWidth};
@ -79,6 +80,7 @@ pub mod image;
#[cfg(feature = "gecko")]
pub mod gecko;
pub mod length;
pub mod outline;
pub mod percentage;
pub mod position;
pub mod rect;

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

@ -0,0 +1,7 @@
/* 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/. */
//! Computed values for outline properties
pub use values::specified::OutlineStyle;

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

@ -49,6 +49,7 @@ pub use self::length::{LengthOrPercentage, LengthOrPercentageOrAuto};
pub use self::length::{LengthOrPercentageOrNone, MaxLength, MozLength};
pub use self::length::{NoCalcLength, ViewportPercentageLength};
pub use self::length::NonNegativeLengthOrPercentage;
pub use self::outline::OutlineStyle;
pub use self::rect::LengthOrNumberRect;
pub use self::percentage::Percentage;
pub use self::position::{Position, PositionComponent, GridAutoFlow, GridTemplateAreas};
@ -78,6 +79,7 @@ pub mod gecko;
pub mod grid;
pub mod image;
pub mod length;
pub mod outline;
pub mod percentage;
pub mod position;
pub mod rect;

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

@ -0,0 +1,56 @@
/* 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/. */
//! Specified values for outline properties
use cssparser::Parser;
use parser::{Parse, ParserContext};
use selectors::parser::SelectorParseErrorKind;
use style_traits::ParseError;
use values::specified::BorderStyle;
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord)]
#[derive(PartialEq, PartialOrd, ToComputedValue, ToCss)]
/// <https://drafts.csswg.org/css-ui/#propdef-outline-style>
pub enum OutlineStyle {
/// auto
Auto,
/// <border-style>
Other(BorderStyle),
}
impl OutlineStyle {
#[inline]
/// Get default value as None
pub fn none() -> OutlineStyle {
OutlineStyle::Other(BorderStyle::None)
}
#[inline]
/// Get value for None or Hidden
pub fn none_or_hidden(&self) -> bool {
match *self {
OutlineStyle::Auto => false,
OutlineStyle::Other(ref border_style) => border_style.none_or_hidden()
}
}
}
impl Parse for OutlineStyle {
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<OutlineStyle, ParseError<'i>> {
if let Ok(border_style) = input.try(|i| BorderStyle::parse(context, i)) {
if let BorderStyle::Hidden = border_style {
return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("hidden".into())));
}
return Ok(OutlineStyle::Other(border_style));
}
input.expect_ident_matching("auto")?;
Ok(OutlineStyle::Auto)
}
}

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

@ -8,7 +8,7 @@
# except according to those terms.
from __future__ import print_function, unicode_literals
from os import path, getcwd, listdir
from os import path, listdir
from time import time
import sys
@ -29,28 +29,30 @@ from servo.util import STATIC_RUST_LANG_ORG_DIST, URLOPEN_KWARGS
@CommandProvider
class MachCommands(CommandBase):
def run_cargo(self, params, geckolib=False, check=False):
if geckolib:
self.set_use_stable_rust()
crate_dir = path.join('ports', 'geckolib')
else:
crate_dir = path.join('ports', 'servo')
if not params:
params = []
self.ensure_bootstrapped()
self.ensure_clobbered()
env = self.build_env(geckolib=geckolib)
if not params:
params = []
if check:
params = ['check'] + params
if geckolib:
# for c in $(cargo --list | tail -$(($(cargo --list | wc -l) - 1))); do
# (cargo help $c 2>&1 | grep "\\--package" >/dev/null 2>&1) && echo $c
# done
if params[0] and params[0] in [
'bench', 'build', 'check', 'clean', 'doc', 'fmt', 'pkgid',
'run', 'rustc', 'rustdoc', 'test', 'update',
]:
params[1:1] = ['--package', 'geckoservo']
self.set_use_stable_rust()
build_start = time()
if self.context.topdir == getcwd():
with cd(crate_dir):
status = call(['cargo'] + params, env=env)
else:
status = call(['cargo'] + params, env=env)
status = call(['cargo'] + params, env=env)
elapsed = time() - build_start
notify_build_done(self.config, elapsed, status == 0)
@ -94,7 +96,7 @@ class MachCommands(CommandBase):
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to cargo check")
def check_geckolib(self, params):
return self.run_cargo(["-p", "geckoservo"] + (params or []), check=True, geckolib=True)
return self.run_cargo(params, check=True, geckolib=True)
@Command('cargo-update',
description='Same as update-cargo',

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

@ -511,7 +511,7 @@ mod shorthand_serialization {
}
mod outline {
use style::values::Either;
use style::values::specified::outline::OutlineStyle;
use super::*;
#[test]
@ -519,7 +519,7 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = Either::Second(BorderStyle::Solid);
let style = OutlineStyle::Other(BorderStyle::Solid);
let color = RGBA::new(255, 0, 0, 255).into();
properties.push(PropertyDeclaration::OutlineWidth(width));
@ -535,7 +535,7 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let width = BorderSideWidth::Length(Length::from_px(4f32));
let style = Either::First(Auto);
let style = OutlineStyle::Auto;
let color = RGBA::new(255, 0, 0, 255).into();
properties.push(PropertyDeclaration::OutlineWidth(width));
properties.push(PropertyDeclaration::OutlineStyle(style));

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

@ -1 +1 @@
quay.io/mozilla
taskcluster

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

@ -1 +0,0 @@
taskcluster

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

@ -1 +0,0 @@
taskcluster

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

@ -1 +0,0 @@
taskcluster

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

@ -1 +0,0 @@
taskcluster

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

@ -1 +0,0 @@
taskcluster

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

@ -1,32 +0,0 @@
FROM quay.io/rust/rust-buildbot
MAINTAINER Ralph Giles <giles@mozilla.com>
# Reset user/workdir from parent image so we can install software.
WORKDIR /
USER root
# Install tooltool directly from github.
ADD https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py /build/tooltool.py
RUN chmod +rx /build/tooltool.py
# Add build scripts.
ADD fetch_rust.sh build_rust.sh /build/
ADD fetch_cargo.sh build_cargo.sh /build/
ADD package_rust.sh upload_rust.sh /build/
ADD repack_rust.py splat_rust.py /build/
RUN chmod +x /build/*
# Create user for doing the build.
ENV USER worker
ENV HOME /home/${USER}
RUN useradd -d ${HOME} -m ${USER}
# Set up the user's tree
WORKDIR ${HOME}
# Invoke our build scripts by default, but allow other commands.
USER ${USER}
ENTRYPOINT /build/fetch_rust.sh && /build/build_rust.sh && \
/build/fetch_cargo.sh && /build/build_cargo.sh && \
/build/package_rust.sh && /build/upload_rust.sh

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

@ -1,2 +0,0 @@
This is a docker script for building rust toolchains for
use in Mozilla's build clusters.

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