diff --git a/devtools/client/aboutdebugging/aboutdebugging.css b/devtools/client/aboutdebugging/aboutdebugging.css index f6840594775e..4c81627e94cd 100644 --- a/devtools/client/aboutdebugging/aboutdebugging.css +++ b/devtools/client/aboutdebugging/aboutdebugging.css @@ -249,6 +249,25 @@ button { font-weight: 600; } +.addon-target-info { + display: grid; + font-size: 14px; + grid-template-columns: 128px 1fr; +} + +.addon-target-info-label { + padding-inline-end: 8px; + padding-bottom: 8px; +} + +.addon-target-info-label:last-of-type { + padding-bottom: 16px; +} + +.addon-target-info-content { + margin: 0; +} + .addon-target-button { background: none; border: none; @@ -289,3 +308,18 @@ button { * lines up with the icon. */ margin-inline-start: -4px; } + +/* We want the ellipsis on the left-hand-side, so make the parent RTL + * with an ellipsis and the child can be LTR. */ +.file-path { + direction: rtl; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.file-path-inner { + direction: ltr; + unicode-bidi: plaintext; +} diff --git a/devtools/client/aboutdebugging/components/addons/panel.js b/devtools/client/aboutdebugging/components/addons/panel.js index 451335151c89..e7ffc097248e 100644 --- a/devtools/client/aboutdebugging/components/addons/panel.js +++ b/devtools/client/aboutdebugging/components/addons/panel.js @@ -76,7 +76,8 @@ module.exports = createClass({ icon: addon.iconURL || ExtensionIcon, addonID: addon.id, addonActor: addon.actor, - temporarilyInstalled: addon.temporarilyInstalled + temporarilyInstalled: addon.temporarilyInstalled, + url: addon.url, }; }); diff --git a/devtools/client/aboutdebugging/components/addons/target.js b/devtools/client/aboutdebugging/components/addons/target.js index bd7a888f7b4b..caa44f1961fc 100644 --- a/devtools/client/aboutdebugging/components/addons/target.js +++ b/devtools/client/aboutdebugging/components/addons/target.js @@ -20,6 +20,25 @@ loader.lazyRequireGetter(this, "DebuggerClient", const Strings = Services.strings.createBundle( "chrome://devtools/locale/aboutdebugging.properties"); +function filePathForTarget(target) { + // Only show file system paths, and only for temporarily installed add-ons. + if (!target.temporarilyInstalled || !target.url || !target.url.startsWith("file://")) { + return []; + } + let path = target.url.slice("file://".length); + return [ + dom.dt( + { className: "addon-target-info-label" }, + Strings.GetStringFromName("location")), + // Wrap the file path in a span so we can do some RTL/LTR swapping to get + // the ellipsis on the left. + dom.dd( + { className: "addon-target-info-content file-path" }, + dom.span({ className: "file-path-inner", title: path }, path), + ), + ]; +} + module.exports = createClass({ displayName: "AddonTarget", @@ -31,7 +50,8 @@ module.exports = createClass({ addonID: PropTypes.string.isRequired, icon: PropTypes.string, name: PropTypes.string.isRequired, - temporarilyInstalled: PropTypes.bool + temporarilyInstalled: PropTypes.bool, + url: PropTypes.string, }).isRequired }, @@ -68,6 +88,10 @@ module.exports = createClass({ }), dom.span({ className: "target-name", title: target.name }, target.name) ), + dom.dl( + { className: "addon-target-info" }, + ...filePathForTarget(target), + ), dom.div({className: "addon-target-actions"}, dom.button({ className: "debug-button addon-target-button", diff --git a/devtools/client/aboutdebugging/test/browser.ini b/devtools/client/aboutdebugging/test/browser.ini index 5e9a949c2116..a10c34986d74 100644 --- a/devtools/client/aboutdebugging/test/browser.ini +++ b/devtools/client/aboutdebugging/test/browser.ini @@ -20,6 +20,7 @@ support-files = !/devtools/client/framework/test/shared-head.js [browser_addons_debug_bootstrapped.js] +[browser_addons_debug_info.js] [browser_addons_debug_webextension.js] tags = webextensions [browser_addons_debug_webextension_inspector.js] diff --git a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js new file mode 100644 index 000000000000..77d7e7b1ed3e --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js @@ -0,0 +1,28 @@ +"use strict"; + +const ADDON_ID = "test-devtools@mozilla.org"; +const ADDON_NAME = "test-devtools"; + +add_task(function* () { + let { tab, document } = yield openAboutDebugging("addons"); + yield waitForInitialAddonList(document); + + yield installAddon({ + document, + path: "addons/unpacked/install.rdf", + name: ADDON_NAME, + }); + + let container = document.querySelector(`[data-addon-id="${ADDON_ID}"]`); + let filePath = container.querySelector(".file-path"); + let expectedFilePath = "browser/devtools/client/aboutdebugging/test/addons/unpacked/"; + + // Verify that the path to the install location is shown next to its label. + ok(filePath, "file path is in DOM"); + ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly"); + is(filePath.previousElementSibling.textContent, "Location", "file path has label"); + + yield uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME}); + + yield closeAboutDebugging(tab); +}); diff --git a/devtools/client/commandline/test/browser_cmd_qsa.js b/devtools/client/commandline/test/browser_cmd_qsa.js index 551d47739a4e..32bcd11f4bca 100644 --- a/devtools/client/commandline/test/browser_cmd_qsa.js +++ b/devtools/client/commandline/test/browser_cmd_qsa.js @@ -1,33 +1,33 @@ -/* Any copyright is dedicated to the Public Domain. -* http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// Tests that the qsa commands work as they should. - -const TEST_URI = "data:text/html;charset=utf-8,"; - -function test() { - helpers.addTabWithToolbar(TEST_URI, function (options) { - return helpers.audit(options, [ - { - setup: "qsa", - check: { - input: "qsa", - hints: " [query]", - markup: "VVV", - status: "VALID" - } - }, - { - setup: "qsa body", - check: { - input: "qsa body", - hints: "", - markup: "VVVVVVVV", - status: "VALID" - } - } - ]); - }).then(finish, helpers.handleError); -} +/* Any copyright is dedicated to the Public Domain. +* http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that the qsa commands work as they should. + +const TEST_URI = "data:text/html;charset=utf-8,"; + +function test() { + helpers.addTabWithToolbar(TEST_URI, function (options) { + return helpers.audit(options, [ + { + setup: "qsa", + check: { + input: "qsa", + hints: " [query]", + markup: "VVV", + status: "VALID" + } + }, + { + setup: "qsa body", + check: { + input: "qsa body", + hints: "", + markup: "VVVVVVVV", + status: "VALID" + } + } + ]); + }).then(finish, helpers.handleError); +} diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js index dd49547179e5..8a31105d7d39 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js @@ -2,57 +2,57 @@ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Make sure that canceling a name change correctly unhides the separator and - * value elements. - */ - -const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; - -function test() { - Task.spawn(function* () { + +/** + * Make sure that canceling a name change correctly unhides the separator and + * value elements. + */ + +const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; + +function test() { + Task.spawn(function* () { let options = { source: TAB_URL, line: 1 }; - let [tab,, panel] = yield initDebugger(TAB_URL, options); - let win = panel.panelWin; - let vars = win.DebuggerView.Variables; - - win.DebuggerView.WatchExpressions.addExpression("this"); - - callInTab(tab, "ermahgerd"); - yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS); - - let exprScope = vars.getScopeAtIndex(0); - let {target} = exprScope.get("this"); - - let name = target.querySelector(".title > .name"); - let separator = target.querySelector(".separator"); - let value = target.querySelector(".value"); - - is(separator.hidden, false, - "The separator element should not be hidden."); - is(value.hidden, false, - "The value element should not be hidden."); - - for (let key of ["ESCAPE", "RETURN"]) { - EventUtils.sendMouseEvent({ type: "dblclick" }, name, win); - - is(separator.hidden, true, - "The separator element should be hidden."); - is(value.hidden, true, - "The value element should be hidden."); - - EventUtils.sendKey(key, win); - - is(separator.hidden, false, - "The separator element should not be hidden."); - is(value.hidden, false, - "The value element should not be hidden."); - } - - yield resumeDebuggerThenCloseAndFinish(panel); - }); -} + let [tab,, panel] = yield initDebugger(TAB_URL, options); + let win = panel.panelWin; + let vars = win.DebuggerView.Variables; + + win.DebuggerView.WatchExpressions.addExpression("this"); + + callInTab(tab, "ermahgerd"); + yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS); + + let exprScope = vars.getScopeAtIndex(0); + let {target} = exprScope.get("this"); + + let name = target.querySelector(".title > .name"); + let separator = target.querySelector(".separator"); + let value = target.querySelector(".value"); + + is(separator.hidden, false, + "The separator element should not be hidden."); + is(value.hidden, false, + "The value element should not be hidden."); + + for (let key of ["ESCAPE", "RETURN"]) { + EventUtils.sendMouseEvent({ type: "dblclick" }, name, win); + + is(separator.hidden, true, + "The separator element should be hidden."); + is(value.hidden, true, + "The value element should be hidden."); + + EventUtils.sendKey(key, win); + + is(separator.hidden, false, + "The separator element should not be hidden."); + is(value.hidden, false, + "The value element should not be hidden."); + } + + yield resumeDebuggerThenCloseAndFinish(panel); + }); +} diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js index bdfe1a42b5b4..f11517b665d3 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js @@ -1,80 +1,80 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests opening the variable inspection popup while stopped at a debugger statement, - * clicking "step in" and verifying that the popup is gone. - */ - -const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; - -let gTab, gPanel, gDebugger; -let actions, gSources, gVariables; - -function test() { - let options = { - source: TAB_URL, - line: 1 - }; - initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { - gTab = aTab; - gPanel = aPanel; - gDebugger = gPanel.panelWin; - actions = bindActionCreators(gPanel); - gSources = gDebugger.DebuggerView.Sources; - gVariables = gDebugger.DebuggerView.Variables; - let bubble = gDebugger.DebuggerView.VariableBubble; - let tooltip = bubble._tooltip.panel; - let testPopupHiding = Task.async(function* () { - yield addBreakpoint(); - yield ensureThreadClientState(gPanel, "resumed"); - yield pauseDebuggee(); - yield openVarPopup(gPanel, { line: 20, ch: 17 }); - is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1, - "The popup should be open with a simple text entry"); - // Now we're stopped at a breakpoint with an open popup - // we'll send a keypress and check if the popup closes - executeSoon(() => EventUtils.synthesizeKey("VK_F11", {})); - // The keypress should cause one resumed event and one paused event - yield waitForThreadEvents(gPanel, "resumed"); - yield waitForThreadEvents(gPanel, "paused"); - // Here's the state we're actually interested in checking.. - checkVariablePopupClosed(bubble); - yield resumeDebuggerThenCloseAndFinish(gPanel); - }); - testPopupHiding(); - }); -} - -function addBreakpoint() { - return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); -} - -function pauseDebuggee() { - generateMouseClickInTab(gTab, "content.document.querySelector('button')"); - - // The first 'with' scope should be expanded by default, but the - // variables haven't been fetched yet. This is how 'with' scopes work. - return promise.all([ - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) - ]); -} - -function checkVariablePopupClosed(bubble) { - ok(!bubble.contentsShown(), - "When stepping, popup should close and be hidden."); - ok(bubble._tooltip.isEmpty(), - "The variable inspection popup should now be empty."); - ok(!bubble._markedText, - "The marked text in the editor was removed."); -} - -registerCleanupFunction(function () { - gTab = null; - gPanel = null; - gDebugger = null; - actions = null; - gSources = null; - gVariables = null; -}); +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests opening the variable inspection popup while stopped at a debugger statement, + * clicking "step in" and verifying that the popup is gone. + */ + +const TAB_URL = EXAMPLE_URL + "doc_with-frame.html"; + +let gTab, gPanel, gDebugger; +let actions, gSources, gVariables; + +function test() { + let options = { + source: TAB_URL, + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { + gTab = aTab; + gPanel = aPanel; + gDebugger = gPanel.panelWin; + actions = bindActionCreators(gPanel); + gSources = gDebugger.DebuggerView.Sources; + gVariables = gDebugger.DebuggerView.Variables; + let bubble = gDebugger.DebuggerView.VariableBubble; + let tooltip = bubble._tooltip.panel; + let testPopupHiding = Task.async(function* () { + yield addBreakpoint(); + yield ensureThreadClientState(gPanel, "resumed"); + yield pauseDebuggee(); + yield openVarPopup(gPanel, { line: 20, ch: 17 }); + is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1, + "The popup should be open with a simple text entry"); + // Now we're stopped at a breakpoint with an open popup + // we'll send a keypress and check if the popup closes + executeSoon(() => EventUtils.synthesizeKey("VK_F11", {})); + // The keypress should cause one resumed event and one paused event + yield waitForThreadEvents(gPanel, "resumed"); + yield waitForThreadEvents(gPanel, "paused"); + // Here's the state we're actually interested in checking.. + checkVariablePopupClosed(bubble); + yield resumeDebuggerThenCloseAndFinish(gPanel); + }); + testPopupHiding(); + }); +} + +function addBreakpoint() { + return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); +} + +function pauseDebuggee() { + generateMouseClickInTab(gTab, "content.document.querySelector('button')"); + + // The first 'with' scope should be expanded by default, but the + // variables haven't been fetched yet. This is how 'with' scopes work. + return promise.all([ + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES) + ]); +} + +function checkVariablePopupClosed(bubble) { + ok(!bubble.contentsShown(), + "When stepping, popup should close and be hidden."); + ok(bubble._tooltip.isEmpty(), + "The variable inspection popup should now be empty."); + ok(!bubble._markedText, + "The marked text in the editor was removed."); +} + +registerCleanupFunction(function () { + gTab = null; + gPanel = null; + gDebugger = null; + actions = null; + gSources = null; + gVariables = null; +}); diff --git a/devtools/client/locales/en-US/aboutdebugging.properties b/devtools/client/locales/en-US/aboutdebugging.properties index f5449b3ec8b6..e84d32484f64 100644 --- a/devtools/client/locales/en-US/aboutdebugging.properties +++ b/devtools/client/locales/en-US/aboutdebugging.properties @@ -79,6 +79,10 @@ reload = Reload # disabled 'reload' button. reloadDisabledTooltip = Only temporarily installed add-ons can be reloaded +# LOCALIZATION NOTE (location): +# This string is displayed as a label for the filesystem location of an extension. +location = Location + # LOCALIZATION NOTE (workers): # This string is displayed as a header of the about:debugging#workers page. workers = Workers diff --git a/devtools/client/netmonitor/src/components/request-list-column-file.js b/devtools/client/netmonitor/src/components/request-list-column-file.js index 5040ab918cc5..21034bbdc575 100644 --- a/devtools/client/netmonitor/src/components/request-list-column-file.js +++ b/devtools/client/netmonitor/src/components/request-list-column-file.js @@ -40,7 +40,6 @@ const RequestListColumnFile = createClass({ img({ className: "requests-list-icon", src: responseContentDataUri, - "data-type": responseContentDataUri ? "thumbnail" : undefined, }), urlDetails.baseNameWithQuery ) diff --git a/devtools/client/netmonitor/src/constants.js b/devtools/client/netmonitor/src/constants.js index a61f2dc73298..d9d706cb4047 100644 --- a/devtools/client/netmonitor/src/constants.js +++ b/devtools/client/netmonitor/src/constants.js @@ -93,18 +93,6 @@ const EVENTS = { UPDATING_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdating:ResponseContent", RECEIVED_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdated:ResponseContent", - // When the request post params are displayed in the UI. - REQUEST_POST_PARAMS_DISPLAYED: "NetMonitor:RequestPostParamsAvailable", - - // When the image response thumbnail is displayed in the UI. - RESPONSE_IMAGE_THUMBNAIL_DISPLAYED: - "NetMonitor:ResponseImageThumbnailAvailable", - - // Fired when charts have been displayed in the PerformanceStatisticsView. - PLACEHOLDER_CHARTS_DISPLAYED: "NetMonitor:PlaceholderChartsDisplayed", - PRIMED_CACHE_CHART_DISPLAYED: "NetMonitor:PrimedChartsDisplayed", - EMPTY_CACHE_CHART_DISPLAYED: "NetMonitor:EmptyChartsDisplayed", - // Fired once the NetMonitorController establishes a connection to the debug // target. CONNECTED: "connected", diff --git a/devtools/client/netmonitor/src/netmonitor-controller.js b/devtools/client/netmonitor/src/netmonitor-controller.js index 1cb3f522d03b..727981be55a1 100644 --- a/devtools/client/netmonitor/src/netmonitor-controller.js +++ b/devtools/client/netmonitor/src/netmonitor-controller.js @@ -7,10 +7,7 @@ const { TimelineFront } = require("devtools/shared/fronts/timeline"); const { CurlUtils } = require("devtools/client/shared/curl"); const { ACTIVITY_TYPE, EVENTS } = require("./constants"); -const { - getRequestById, - getDisplayedRequestById, -} = require("./selectors/index"); +const { getDisplayedRequestById } = require("./selectors/index"); const { fetchHeaders, formDataURI, @@ -307,7 +304,6 @@ function NetworkEventsHandler() { this._onRequestPostData = this._onRequestPostData.bind(this); this._onResponseHeaders = this._onResponseHeaders.bind(this); this._onResponseCookies = this._onResponseCookies.bind(this); - this._onResponseContent = this._onResponseContent.bind(this); this._onSecurityInfo = this._onSecurityInfo.bind(this); this._onEventTimings = this._onEventTimings.bind(this); } @@ -428,45 +424,11 @@ NetworkEventsHandler.prototype = { .then(() => window.emit(EVENTS.REQUEST_ADDED, id)); }, - async updateRequest(id, data) { - await this.actions.updateRequest(id, data, true); - let { - responseContent, - responseCookies, - responseHeaders, - requestCookies, - requestHeaders, - requestPostData, - } = data; - let request = getRequestById(window.gStore.getState(), id); - - if (requestHeaders && requestHeaders.headers && requestHeaders.headers.length) { - let headers = await fetchHeaders(requestHeaders, getLongString); - if (headers) { - await this.actions.updateRequest( - id, - { requestHeaders: headers }, - true, - ); - } - } - - if (responseHeaders && responseHeaders.headers && responseHeaders.headers.length) { - let headers = await fetchHeaders(responseHeaders, getLongString); - if (headers) { - await this.actions.updateRequest( - id, - { responseHeaders: headers }, - true, - ); - } - } - - if (request && responseContent && responseContent.content) { - let { mimeType } = request; - let { text, encoding } = responseContent.content; + async fetchImage(mimeType, responseContent) { + let payload = {}; + if (mimeType && responseContent && responseContent.content) { + let { encoding, text } = responseContent.content; let response = await getLongString(text); - let payload = {}; if (mimeType.includes("image/")) { payload.responseContentDataUri = formDataURI(mimeType, encoding, response); @@ -474,16 +436,36 @@ NetworkEventsHandler.prototype = { responseContent.content.text = response; payload.responseContent = responseContent; + } + return payload; + }, - await this.actions.updateRequest(id, payload, true); - - if (mimeType.includes("image/")) { - window.emit(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED); + async fetchRequestHeaders(requestHeaders) { + let payload = {}; + if (requestHeaders && requestHeaders.headers && requestHeaders.headers.length) { + let headers = await fetchHeaders(requestHeaders, getLongString); + if (headers) { + payload.requestHeaders = headers; } } + return payload; + }, - // Search the POST data upload stream for request headers and add - // them as a separate property, different from the classic headers. + async fetchResponseHeaders(responseHeaders) { + let payload = {}; + if (responseHeaders && responseHeaders.headers && responseHeaders.headers.length) { + let headers = await fetchHeaders(responseHeaders, getLongString); + if (headers) { + payload.responseHeaders = headers; + } + } + return payload; + }, + + // Search the POST data upload stream for request headers and add + // them as a separate property, different from the classic headers. + async fetchPostData(requestPostData) { + let payload = {}; if (requestPostData && requestPostData.postData) { let { text } = requestPostData.postData; let postData = await getLongString(text); @@ -491,35 +473,15 @@ NetworkEventsHandler.prototype = { const headersSize = headers.reduce((acc, { name, value }) => { return acc + name.length + value.length + 2; }, 0); - let payload = {}; requestPostData.postData.text = postData; payload.requestPostData = Object.assign({}, requestPostData); payload.requestHeadersFromUploadStream = { headers, headersSize }; - - await this.actions.updateRequest(id, payload, true); - } - - // Fetch request and response cookies long value. - // Actor does not provide full sized cookie value when the value is too long - // To display values correctly, we need fetch them in each request. - if (requestCookies) { - let reqCookies = []; - // request store cookies in requestCookies or requestCookies.cookies - let cookies = requestCookies.cookies ? - requestCookies.cookies : requestCookies; - // make sure cookies is iterable - if (typeof cookies[Symbol.iterator] === "function") { - for (let cookie of cookies) { - reqCookies.push(Object.assign({}, cookie, { - value: await getLongString(cookie.value), - })); - } - if (reqCookies.length) { - await this.actions.updateRequest(id, { requestCookies: reqCookies }, true); - } - } } + return payload; + }, + async fetchResponseCookies(responseCookies) { + let payload = {}; if (responseCookies) { let resCookies = []; // response store cookies in responseCookies or responseCookies.cookies @@ -533,10 +495,70 @@ NetworkEventsHandler.prototype = { })); } if (resCookies.length) { - await this.actions.updateRequest(id, { responseCookies: resCookies }, true); + payload.responseCookies = resCookies; } } } + return payload; + }, + + // Fetch request and response cookies long value. + // Actor does not provide full sized cookie value when the value is too long + // To display values correctly, we need fetch them in each request. + async fetchRequestCookies(requestCookies) { + let payload = {}; + if (requestCookies) { + let reqCookies = []; + // request store cookies in requestCookies or requestCookies.cookies + let cookies = requestCookies.cookies ? + requestCookies.cookies : requestCookies; + // make sure cookies is iterable + if (typeof cookies[Symbol.iterator] === "function") { + for (let cookie of cookies) { + reqCookies.push(Object.assign({}, cookie, { + value: await getLongString(cookie.value), + })); + } + if (reqCookies.length) { + payload.requestCookies = reqCookies; + } + } + } + return payload; + }, + + async updateRequest(id, data) { + let { + mimeType, + responseContent, + responseCookies, + responseHeaders, + requestCookies, + requestHeaders, + requestPostData, + } = data; + + // fetch request detail contents in parallel + let [ + imageObj, + requestHeadersObj, + responseHeadersObj, + postDataObj, + requestCookiesObj, + responseCookiesObj, + ] = await Promise.all([ + this.fetchImage(mimeType, responseContent), + this.fetchRequestHeaders(requestHeaders), + this.fetchResponseHeaders(responseHeaders), + this.fetchPostData(requestPostData), + this.fetchRequestCookies(requestCookies), + this.fetchResponseCookies(responseCookies), + ]); + + let payload = Object.assign({}, data, + imageObj, requestHeadersObj, responseHeadersObj, + postDataObj, requestCookiesObj, responseCookiesObj); + await this.actions.updateRequest(id, payload, true); }, /** @@ -568,9 +590,10 @@ NetworkEventsHandler.prototype = { case "securityInfo": this.updateRequest(actor, { securityState: networkInfo.securityInfo, + }).then(() => { + this.webConsoleClient.getSecurityInfo(actor, this._onSecurityInfo); + window.emit(EVENTS.UPDATING_SECURITY_INFO, actor); }); - this.webConsoleClient.getSecurityInfo(actor, this._onSecurityInfo); - window.emit(EVENTS.UPDATING_SECURITY_INFO, actor); break; case "responseHeaders": this.webConsoleClient.getResponseHeaders(actor, @@ -590,25 +613,26 @@ NetworkEventsHandler.prototype = { status: networkInfo.response.status, statusText: networkInfo.response.statusText, headersSize: networkInfo.response.headersSize + }).then(() => { + window.emit(EVENTS.STARTED_RECEIVING_RESPONSE, actor); }); - window.emit(EVENTS.STARTED_RECEIVING_RESPONSE, actor); break; case "responseContent": - this.updateRequest(actor, { - contentSize: networkInfo.response.bodySize, - transferredSize: networkInfo.response.transferredSize, - mimeType: networkInfo.response.content.mimeType - }); this.webConsoleClient.getResponseContent(actor, - this._onResponseContent); + this._onResponseContent.bind(this, { + contentSize: networkInfo.response.bodySize, + transferredSize: networkInfo.response.transferredSize, + mimeType: networkInfo.response.content.mimeType + })); window.emit(EVENTS.UPDATING_RESPONSE_CONTENT, actor); break; case "eventTimings": this.updateRequest(actor, { totalTime: networkInfo.totalTime + }).then(() => { + this.webConsoleClient.getEventTimings(actor, this._onEventTimings); + window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor); }); - this.webConsoleClient.getEventTimings(actor, this._onEventTimings); - window.emit(EVENTS.UPDATING_EVENT_TIMINGS, actor); break; } }, @@ -700,13 +724,14 @@ NetworkEventsHandler.prototype = { /** * Handles additional information received for a "responseContent" packet. * + * @param object data + * The message received from the server event. * @param object response * The message received from the server. */ - _onResponseContent: function (response) { - this.updateRequest(response.from, { - responseContent: response - }).then(() => { + _onResponseContent: function (data, response) { + let payload = Object.assign({ responseContent: response }, data); + this.updateRequest(response.from, payload).then(() => { window.emit(EVENTS.RECEIVED_RESPONSE_CONTENT, response.from); }); }, diff --git a/devtools/client/netmonitor/test/browser_net_icon-preview.js b/devtools/client/netmonitor/test/browser_net_icon-preview.js index a1d14d7e155a..3de8d6a7c139 100644 --- a/devtools/client/netmonitor/test/browser_net_icon-preview.js +++ b/devtools/client/netmonitor/test/browser_net_icon-preview.js @@ -9,22 +9,21 @@ add_task(function* () { let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL); + const SELECTOR = ".requests-list-icon[src]"; info("Starting test... "); let { document, gStore, windowRequire } = monitor.panelWin; let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); let { NetMonitorController } = windowRequire("devtools/client/netmonitor/src/netmonitor-controller"); - let { - ACTIVITY_TYPE, - EVENTS, - } = windowRequire("devtools/client/netmonitor/src/constants"); + let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants"); gStore.dispatch(Actions.batchEnable(false)); - let wait = waitForEvents(); + let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); yield performRequests(); yield wait; + yield waitUntil(() => !!document.querySelector(SELECTOR)); info("Checking the image thumbnail when all items are shown."); checkImageThumbnail(); @@ -38,22 +37,16 @@ add_task(function* () { checkImageThumbnail(); info("Reloading the debuggee and performing all requests again..."); - wait = waitForEvents(); + wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); yield reloadAndPerformRequests(); yield wait; + yield waitUntil(() => !!document.querySelector(SELECTOR)); info("Checking the image thumbnail after a reload."); checkImageThumbnail(); yield teardown(monitor); - function waitForEvents() { - return promise.all([ - waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS), - monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED) - ]); - } - function performRequests() { return ContentTask.spawn(tab.linkedBrowser, {}, function* () { content.wrappedJSObject.performRequests(); @@ -66,12 +59,11 @@ add_task(function* () { } function checkImageThumbnail() { - is(document.querySelectorAll(".requests-list-icon[data-type=thumbnail]").length, 1, + is(document.querySelectorAll(SELECTOR).length, 1, "There should be only one image request with a thumbnail displayed."); - is(document.querySelector(".requests-list-icon[data-type=thumbnail]").src, - TEST_IMAGE_DATA_URI, + is(document.querySelector(SELECTOR).src, TEST_IMAGE_DATA_URI, "The image requests-list-icon thumbnail is displayed correctly."); - is(document.querySelector(".requests-list-icon[data-type=thumbnail]").hidden, false, + is(document.querySelector(SELECTOR).hidden, false, "The image requests-list-icon thumbnail should not be hidden."); } }); diff --git a/devtools/client/netmonitor/test/browser_net_image-tooltip.js b/devtools/client/netmonitor/test/browser_net_image-tooltip.js index c8fa4c62b07e..4dbbd4127030 100644 --- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js +++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js @@ -11,25 +11,22 @@ const IMAGE_TOOLTIP_REQUESTS = 1; */ add_task(function* test() { let { tab, monitor } = yield initNetMonitor(IMAGE_TOOLTIP_URL); + const SELECTOR = ".requests-list-icon[src]"; info("Starting test... "); let { document, gStore, windowRequire } = monitor.panelWin; let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); let { NetMonitorController } = windowRequire("devtools/client/netmonitor/src/netmonitor-controller"); - let { - ACTIVITY_TYPE, - EVENTS, - } = windowRequire("devtools/client/netmonitor/src/constants"); + let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants"); let toolboxDoc = monitor.panelWin.parent.document; gStore.dispatch(Actions.batchEnable(false)); let onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS); - let onThumbnail = monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED); yield performRequests(); yield onEvents; - yield onThumbnail; + yield waitUntil(() => !!document.querySelector(SELECTOR)); info("Checking the image thumbnail after a few requests were made..."); yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]); @@ -41,13 +38,12 @@ add_task(function* test() { // +1 extra document reload onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1); - onThumbnail = monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED); info("Reloading the debuggee and performing all requests again..."); yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED); yield performRequests(); yield onEvents; - yield onThumbnail; + yield waitUntil(() => !!document.querySelector(SELECTOR)); info("Checking the image thumbnail after a reload."); yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]); diff --git a/devtools/client/netmonitor/test/browser_net_simple-request-data.js b/devtools/client/netmonitor/test/browser_net_simple-request-data.js index 2f71b45458e1..cbd5908f283f 100644 --- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js +++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js @@ -193,7 +193,7 @@ function test() { ); }); - monitor.panelWin.once(EVENTS.UPDATING_RESPONSE_CONTENT, () => { + monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, () => { let requestItem = getSortedRequests(gStore.getState()).get(0); is(requestItem.transferredSize, "12", @@ -203,24 +203,6 @@ function test() { is(requestItem.mimeType, "text/plain; charset=utf-8", "The mimeType data has an incorrect value."); - verifyRequestItemTarget( - document, - getDisplayedRequests(gStore.getState()), - requestItem, - "GET", - SIMPLE_SJS, - { - type: "plain", - fullMimeType: "text/plain; charset=utf-8", - transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12), - size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12), - } - ); - }); - - monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, () => { - let requestItem = getSortedRequests(gStore.getState()).get(0); - ok(requestItem.responseContent, "There should be a responseContent data available."); // eslint-disable-next-line mozilla/no-cpows-in-tests diff --git a/devtools/client/shared/components/notification-box.js b/devtools/client/shared/components/notification-box.js index 87fc76cd6591..838d2ac297bf 100644 --- a/devtools/client/shared/components/notification-box.js +++ b/devtools/client/shared/components/notification-box.js @@ -29,7 +29,7 @@ const PriorityLevels = { /** * This component represents Notification Box - HTML alternative for - * binding. + * binding. * * See also MDN for more info about : * https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/notificationbox diff --git a/devtools/shared/acorn/tests/unit/test_import_acorn.js b/devtools/shared/acorn/tests/unit/test_import_acorn.js index 49b2b50cb903..42a0edcea4bb 100644 --- a/devtools/shared/acorn/tests/unit/test_import_acorn.js +++ b/devtools/shared/acorn/tests/unit/test_import_acorn.js @@ -1,18 +1,18 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test that we can require acorn. - */ - -function run_test() { - const acorn = require("acorn/acorn"); - const acorn_loose = require("acorn/acorn_loose"); - const walk = require("acorn/util/walk"); - do_check_true(isObject(acorn)); - do_check_true(isObject(acorn_loose)); - do_check_true(isObject(walk)); - do_check_eq(typeof acorn.parse, "function"); - do_check_eq(typeof acorn_loose.parse_dammit, "function"); - do_check_eq(typeof walk.simple, "function"); -} +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that we can require acorn. + */ + +function run_test() { + const acorn = require("acorn/acorn"); + const acorn_loose = require("acorn/acorn_loose"); + const walk = require("acorn/util/walk"); + do_check_true(isObject(acorn)); + do_check_true(isObject(acorn_loose)); + do_check_true(isObject(walk)); + do_check_eq(typeof acorn.parse, "function"); + do_check_eq(typeof acorn_loose.parse_dammit, "function"); + do_check_eq(typeof walk.simple, "function"); +} diff --git a/devtools/shared/acorn/tests/unit/test_lenient_parser.js b/devtools/shared/acorn/tests/unit/test_lenient_parser.js index 7586eb8a3342..bc7a3d7c8c7c 100644 --- a/devtools/shared/acorn/tests/unit/test_lenient_parser.js +++ b/devtools/shared/acorn/tests/unit/test_lenient_parser.js @@ -1,62 +1,62 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test that acorn's lenient parser gives something usable. - */ - -const acorn_loose = require("acorn/acorn_loose"); - -function run_test() { - let actualAST = acorn_loose.parse_dammit("let x = 10", {}); - - do_print("Actual AST:"); - do_print(JSON.stringify(actualAST, null, 2)); - do_print("Expected AST:"); - do_print(JSON.stringify(expectedAST, null, 2)); - - checkEquivalentASTs(expectedAST, actualAST); -} - -const expectedAST = { - "type": "Program", - "start": 0, - "end": 10, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 3, - "expression": { - "type": "Identifier", - "start": 0, - "end": 3, - "name": "let" - } - }, - { - "type": "ExpressionStatement", - "start": 4, - "end": 10, - "expression": { - "type": "AssignmentExpression", - "start": 4, - "end": 10, - "operator": "=", - "left": { - "type": "Identifier", - "start": 4, - "end": 5, - "name": "x" - }, - "right": { - "type": "Literal", - "start": 8, - "end": 10, - "value": 10, - "raw": "10" - } - } - } - ] -}; +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that acorn's lenient parser gives something usable. + */ + +const acorn_loose = require("acorn/acorn_loose"); + +function run_test() { + let actualAST = acorn_loose.parse_dammit("let x = 10", {}); + + do_print("Actual AST:"); + do_print(JSON.stringify(actualAST, null, 2)); + do_print("Expected AST:"); + do_print(JSON.stringify(expectedAST, null, 2)); + + checkEquivalentASTs(expectedAST, actualAST); +} + +const expectedAST = { + "type": "Program", + "start": 0, + "end": 10, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "name": "let" + } + }, + { + "type": "ExpressionStatement", + "start": 4, + "end": 10, + "expression": { + "type": "AssignmentExpression", + "start": 4, + "end": 10, + "operator": "=", + "left": { + "type": "Identifier", + "start": 4, + "end": 5, + "name": "x" + }, + "right": { + "type": "Literal", + "start": 8, + "end": 10, + "value": 10, + "raw": "10" + } + } + } + ] +}; diff --git a/devtools/shared/acorn/tests/unit/test_same_ast.js b/devtools/shared/acorn/tests/unit/test_same_ast.js index d1d76bc500ff..ff4420d91d09 100644 --- a/devtools/shared/acorn/tests/unit/test_same_ast.js +++ b/devtools/shared/acorn/tests/unit/test_same_ast.js @@ -1,37 +1,37 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Test that Reflect and acorn create the same AST for ES5. - */ - -const acorn = require("acorn/acorn"); -const { Reflect } = require("resource://gre/modules/reflect.jsm"); - -const testCode = "" + function main () { - function makeAcc(n) { - return function () { - return ++n; - }; - } - - var acc = makeAcc(10); - - for (var i = 0; i < 10; i++) { - acc(); - } - - console.log(acc()); -}; - -function run_test() { - const reflectAST = Reflect.parse(testCode); - const acornAST = acorn.parse(testCode); - - do_print("Reflect AST:"); - do_print(JSON.stringify(reflectAST, null, 2)); - do_print("acorn AST:"); - do_print(JSON.stringify(acornAST, null, 2)); - - checkEquivalentASTs(reflectAST, acornAST); -} +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that Reflect and acorn create the same AST for ES5. + */ + +const acorn = require("acorn/acorn"); +const { Reflect } = require("resource://gre/modules/reflect.jsm"); + +const testCode = "" + function main () { + function makeAcc(n) { + return function () { + return ++n; + }; + } + + var acc = makeAcc(10); + + for (var i = 0; i < 10; i++) { + acc(); + } + + console.log(acc()); +}; + +function run_test() { + const reflectAST = Reflect.parse(testCode); + const acornAST = acorn.parse(testCode); + + do_print("Reflect AST:"); + do_print(JSON.stringify(reflectAST, null, 2)); + do_print("acorn AST:"); + do_print(JSON.stringify(acornAST, null, 2)); + + checkEquivalentASTs(reflectAST, acornAST); +} diff --git a/dom/base/domerr.msg b/dom/base/domerr.msg index 5bc7b450143c..42ac0fb62117 100644 --- a/dom/base/domerr.msg +++ b/dom/base/domerr.msg @@ -145,6 +145,7 @@ DOM4_MSG_DEF(AbortError, "Error retrieving push subscription.", NS_ERROR_DOM_PUS DOM4_MSG_DEF(NetworkError, "Push service unreachable.", NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE) DOM4_MSG_DEF(InvalidAccessError, "Invalid raw ECDSA P-256 public key.", NS_ERROR_DOM_PUSH_INVALID_KEY_ERR) DOM4_MSG_DEF(InvalidStateError, "A subscription with a different application server key already exists.", NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR) +DOM4_MSG_DEF(InvalidStateError, "GCM service disabled.", NS_ERROR_DOM_PUSH_GCM_DISABLED) /* Media errors */ DOM4_MSG_DEF(AbortError, "The fetching process for the media resource was aborted by the user agent at the user's request.", NS_ERROR_DOM_MEDIA_ABORT_ERR) diff --git a/dom/media/tests/mochitest/mochitest.ini b/dom/media/tests/mochitest/mochitest.ini index 9bf1e7968943..abcf3dad9d8f 100644 --- a/dom/media/tests/mochitest/mochitest.ini +++ b/dom/media/tests/mochitest/mochitest.ini @@ -120,6 +120,8 @@ skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulato skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulator) [test_peerConnection_basicVideo.html] skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator) +[test_peerConnection_basicVideoRemoteHwEncoder.html] +skip-if = os == 'linux' || os == 'mac' || os == 'win' || (android_version == '18' && debug) # android-specific feature. android(Bug 1189784, timeouts on 4.3 emulator) [test_peerConnection_basicScreenshare.html] # frequent timeouts/crashes on e10s (bug 1048455) skip-if = toolkit == 'android' # no screenshare on android diff --git a/dom/media/tests/mochitest/test_peerConnection_basicVideoRemoteHwEncoder.html b/dom/media/tests/mochitest/test_peerConnection_basicVideoRemoteHwEncoder.html new file mode 100644 index 000000000000..22a37f51cd8d --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_basicVideoRemoteHwEncoder.html @@ -0,0 +1,31 @@ + + + + + + +
+
+
+ + diff --git a/editor/libeditor/TextEditRules.cpp b/editor/libeditor/TextEditRules.cpp index afff387109f9..014ec7e217d7 100644 --- a/editor/libeditor/TextEditRules.cpp +++ b/editor/libeditor/TextEditRules.cpp @@ -26,10 +26,8 @@ #include "nsGkAtoms.h" #include "nsIContent.h" #include "nsIDOMDocument.h" -#include "nsIDOMElement.h" #include "nsIDOMNode.h" #include "nsIDOMNodeFilter.h" -#include "nsIDOMNodeIterator.h" #include "nsIDOMText.h" #include "nsNameSpaceManager.h" #include "nsINode.h" @@ -191,7 +189,7 @@ TextEditRules::BeforeEdit(EditAction action, RefPtr selection = mTextEditor->GetSelection(); NS_ENSURE_STATE(selection); - selection->GetAnchorNode(getter_AddRefs(mCachedSelectionNode)); + mCachedSelectionNode = selection->GetAnchorNode(); selection->GetAnchorOffset(&mCachedSelectionOffset); return NS_OK; @@ -216,7 +214,7 @@ TextEditRules::AfterEdit(EditAction action, NS_ENSURE_STATE(mTextEditor); nsresult rv = mTextEditor->HandleInlineSpellCheck(action, selection, - mCachedSelectionNode, + GetAsDOMNode(mCachedSelectionNode), mCachedSelectionOffset, nullptr, 0, nullptr, 0); NS_ENSURE_SUCCESS(rv, rv); @@ -995,7 +993,7 @@ TextEditRules::DidUndo(Selection* aSelection, NS_ENSURE_TRUE(theRoot, NS_ERROR_FAILURE); nsIContent* node = mTextEditor->GetLeftmostChild(theRoot); if (node && mTextEditor->IsMozEditorBogusNode(node)) { - mBogusNode = do_QueryInterface(node); + mBogusNode = node; } else { mBogusNode = nullptr; } @@ -1045,7 +1043,7 @@ TextEditRules::DidRedo(Selection* aSelection, RefPtr node = nodeList->Item(0); if (mTextEditor->IsMozEditorBogusNode(node)) { - mBogusNode = do_QueryInterface(node); + mBogusNode = node; } else { mBogusNode = nullptr; } @@ -1131,7 +1129,7 @@ TextEditRules::RemoveRedundantTrailingBR() elem->UnsetAttr(kNameSpaceID_None, nsGkAtoms::type, true); // set mBogusNode to be this
- mBogusNode = do_QueryInterface(elem); + mBogusNode = elem; // give it the bogus node attribute elem->SetAttr(kNameSpaceID_None, kMOZEditorBogusNodeAttrAtom, @@ -1220,16 +1218,14 @@ TextEditRules::CreateBogusNodeIfNeeded(Selection* aSelection) NS_ENSURE_STATE(newContent); // set mBogusNode to be the newly created
- mBogusNode = do_QueryInterface(newContent); - NS_ENSURE_TRUE(mBogusNode, NS_ERROR_NULL_POINTER); + mBogusNode = newContent; // Give it a special attribute. newContent->SetAttr(kNameSpaceID_None, kMOZEditorBogusNodeAttrAtom, kMOZEditorBogusNodeValue, false); // Put the node in the document. - nsCOMPtr bodyNode = do_QueryInterface(body); - nsresult rv = mTextEditor->InsertNode(mBogusNode, bodyNode, 0); + nsresult rv = mTextEditor->InsertNode(*mBogusNode, *body, 0); NS_ENSURE_SUCCESS(rv, rv); // Set selection. diff --git a/editor/libeditor/TextEditRules.h b/editor/libeditor/TextEditRules.h index 602e703bd313..d1bb0bee160a 100644 --- a/editor/libeditor/TextEditRules.h +++ b/editor/libeditor/TextEditRules.h @@ -16,7 +16,6 @@ #include "nsString.h" #include "nscore.h" -class nsIDOMElement; class nsIDOMNode; namespace mozilla { @@ -124,7 +123,6 @@ protected: nsAString* outString, int32_t aMaxLength); nsresult DidInsertText(Selection* aSelection, nsresult aResult); - nsresult GetTopEnclosingPre(nsIDOMNode* aNode, nsIDOMNode** aOutPreNode); nsresult WillInsertBreak(Selection* aSelection, bool* aCancel, bool* aHandled, int32_t aMaxLength); @@ -235,9 +233,9 @@ protected: nsString mPasswordIMEText; uint32_t mPasswordIMEIndex; // Magic node acts as placeholder in empty doc. - nsCOMPtr mBogusNode; + nsCOMPtr mBogusNode; // Cached selected node. - nsCOMPtr mCachedSelectionNode; + nsCOMPtr mCachedSelectionNode; // Cached selected offset. int32_t mCachedSelectionOffset; uint32_t mActionNesting; diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index 63d5cf32017d..7545f6bf49f3 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -1298,6 +1298,7 @@ struct ParamTraits WriteParam(aMsg, aParam.mDragStartSequenceNumber); WriteParam(aMsg, aParam.mScrollbarDragOffset); WriteParam(aMsg, aParam.mScrollTrack); + WriteParam(aMsg, aParam.mScrollThumbLength); WriteParam(aMsg, aParam.mDirection); } @@ -1308,6 +1309,7 @@ struct ParamTraits ReadParam(aMsg, aIter, &aResult->mDragStartSequenceNumber) && ReadParam(aMsg, aIter, &aResult->mScrollbarDragOffset) && ReadParam(aMsg, aIter, &aResult->mScrollTrack) && + ReadParam(aMsg, aIter, &aResult->mScrollThumbLength) && ReadParam(aMsg, aIter, &aResult->mDirection)); } }; diff --git a/gfx/layers/LayerMetricsWrapper.h b/gfx/layers/LayerMetricsWrapper.h index 4fc9ed274c4f..10887c229b78 100644 --- a/gfx/layers/LayerMetricsWrapper.h +++ b/gfx/layers/LayerMetricsWrapper.h @@ -411,15 +411,6 @@ public: return mLayer->GetScrollbarTargetContainerId(); } - int32_t GetScrollThumbLength() const - { - if (GetScrollbarDirection() == ScrollDirection::VERTICAL) { - return mLayer->GetVisibleRegion().GetBounds().height; - } else { - return mLayer->GetVisibleRegion().GetBounds().width; - } - } - bool IsScrollbarContainer() const { MOZ_ASSERT(IsValid()); diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 48add7a94cd0..006c517aaf6f 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -495,7 +495,6 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer, GetEventRegionsOverride(aParent, aLayer)); node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(), aLayer.GetScrollbarDirection(), - aLayer.GetScrollThumbLength(), aLayer.IsScrollbarContainer()); node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId()); return node; @@ -685,7 +684,6 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer, // when those properties change. node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(), aLayer.GetScrollbarDirection(), - aLayer.GetScrollThumbLength(), aLayer.IsScrollbarContainer()); node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId()); return node; diff --git a/gfx/layers/apz/src/AsyncDragMetrics.h b/gfx/layers/apz/src/AsyncDragMetrics.h index cd763a243e55..1ebfb5947742 100644 --- a/gfx/layers/apz/src/AsyncDragMetrics.h +++ b/gfx/layers/apz/src/AsyncDragMetrics.h @@ -34,6 +34,7 @@ public: , mPresShellId(0) , mDragStartSequenceNumber(0) , mScrollbarDragOffset(0) + , mScrollThumbLength(0) , mDirection(NONE) {} @@ -42,12 +43,14 @@ public: uint64_t aDragStartSequenceNumber, CSSCoord aScrollbarDragOffset, const CSSRect& aScrollTrack, + CSSCoord aScrollThumbLength, DragDirection aDirection) : mViewId(aViewId) , mPresShellId(aPresShellId) , mDragStartSequenceNumber(aDragStartSequenceNumber) , mScrollbarDragOffset(aScrollbarDragOffset) , mScrollTrack(aScrollTrack) + , mScrollThumbLength(aScrollThumbLength) , mDirection(aDirection) {} @@ -56,6 +59,7 @@ public: uint64_t mDragStartSequenceNumber; CSSCoord mScrollbarDragOffset; CSSRect mScrollTrack; + CSSCoord mScrollThumbLength; DragDirection mDirection; }; diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 6290bf51dab7..da35760ef1cf 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -927,9 +927,7 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent, GetAxisStart(aDragMetrics.mDirection, aDragMetrics.mScrollTrack); CSSCoord scrollMax = GetAxisLength(aDragMetrics.mDirection, aDragMetrics.mScrollTrack); - scrollMax -= node->GetScrollThumbLength() / - GetAxisScale(aDragMetrics.mDirection, mFrameMetrics.GetZoom()) * - mFrameMetrics.GetPresShellResolution(); + scrollMax -= aDragMetrics.mScrollThumbLength; float scrollPercent = mousePosition / scrollMax; diff --git a/gfx/layers/apz/src/HitTestingTreeNode.cpp b/gfx/layers/apz/src/HitTestingTreeNode.cpp index 0fe7ffa1d334..77be356af5c0 100644 --- a/gfx/layers/apz/src/HitTestingTreeNode.cpp +++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp @@ -28,7 +28,6 @@ HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc, , mLayersId(aLayersId) , mScrollViewId(FrameMetrics::NULL_SCROLL_ID) , mScrollDir(ScrollDirection::NONE) - , mScrollThumbLength(0) , mIsScrollbarContainer(false) , mFixedPosTarget(FrameMetrics::NULL_SCROLL_ID) , mOverride(EventRegionsOverride::NoOverride) @@ -97,12 +96,10 @@ HitTestingTreeNode::SetLastChild(HitTestingTreeNode* aChild) void HitTestingTreeNode::SetScrollbarData(FrameMetrics::ViewID aScrollViewId, ScrollDirection aDir, - int32_t aScrollThumbLength, bool aIsScrollContainer) { mScrollViewId = aScrollViewId; mScrollDir = aDir; - mScrollThumbLength = aScrollThumbLength; mIsScrollbarContainer = aIsScrollContainer; } @@ -116,12 +113,6 @@ HitTestingTreeNode::MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetric mScrollViewId == aDragMetrics.mViewId; } -LayerIntCoord -HitTestingTreeNode::GetScrollThumbLength() const -{ - return mScrollThumbLength; -} - bool HitTestingTreeNode::IsScrollbarNode() const { diff --git a/gfx/layers/apz/src/HitTestingTreeNode.h b/gfx/layers/apz/src/HitTestingTreeNode.h index 628259524620..606b758ff631 100644 --- a/gfx/layers/apz/src/HitTestingTreeNode.h +++ b/gfx/layers/apz/src/HitTestingTreeNode.h @@ -93,7 +93,6 @@ public: void SetScrollbarData(FrameMetrics::ViewID aScrollViewId, ScrollDirection aDir, - int32_t aScrollThumbLength, bool aIsScrollContainer); bool MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const; LayerIntCoord GetScrollThumbLength() const; @@ -135,7 +134,6 @@ private: // This is set for scroll thumb Container layers only. ScrollDirection mScrollDir; - int32_t mScrollThumbLength; // This is set for scroll track Container layers only. bool mIsScrollbarContainer; diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index bd7fb8181230..f4f6ba4be3f3 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -717,7 +717,7 @@ MessageChannel::Clear() gUnresolvedPromises -= mPendingPromises.size(); for (auto& pair : mPendingPromises) { - pair.second.mRejectFunction(__func__); + pair.second.mRejectFunction(pair.second.mPromise, __func__); } mPendingPromises.clear(); diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index 69d3225efebc..fd74ec7a3370 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -98,7 +98,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver struct PromiseHolder { RefPtr mPromise; - std::function mRejectFunction; + std::function mRejectFunction; }; static Atomic gUnresolvedPromises; friend class PromiseReporter; @@ -186,8 +186,10 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver } PromiseHolder holder; holder.mPromise = aPromise; - holder.mRejectFunction = [aPromise](const char* aRejectSite) { - aPromise->Reject(PromiseRejectReason::ChannelClosed, aRejectSite); + holder.mRejectFunction = [](MozPromiseRefcountable* aRejectPromise, + const char* aRejectSite) { + static_cast(aRejectPromise)->Reject( + PromiseRejectReason::ChannelClosed, aRejectSite); }; mPendingPromises.insert(std::make_pair(seqno, Move(holder))); gUnresolvedPromises++; diff --git a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp index 12c6c4a7a37e..f34b46a9b269 100644 --- a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp +++ b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp @@ -2,6 +2,8 @@ #include "IPDLUnitTests.h" // fail etc. +#include "mozilla/Unused.h" + namespace mozilla { namespace _ipdltest { @@ -79,7 +81,7 @@ mozilla::ipc::IPCResult TestAsyncReturnsChild::RecvNoReturn(RefPtr&& aPromise) { // Leak the promise intentionally - aPromise->AddRef(); + Unused << do_AddRef(aPromise); return IPC_OK(); } diff --git a/layout/reftests/forms/progress/reftest-stylo.list b/layout/reftests/forms/progress/reftest-stylo.list index 2c9fd8f1367e..c8619c5219b1 100644 --- a/layout/reftests/forms/progress/reftest-stylo.list +++ b/layout/reftests/forms/progress/reftest-stylo.list @@ -1,29 +1,29 @@ # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing -fails == values.html values.html -fails == values-rtl.html values-rtl.html -fails == margin-padding.html margin-padding.html -fails == margin-padding-rtl.html margin-padding-rtl.html +== values.html values.html +== values-rtl.html values-rtl.html +== margin-padding.html margin-padding.html +== margin-padding-rtl.html margin-padding-rtl.html fails == bar-pseudo-element.html bar-pseudo-element.html -fails == bar-pseudo-element-rtl.html bar-pseudo-element-rtl.html -fails == indeterminate-style-width.html indeterminate-style-width.html +== bar-pseudo-element-rtl.html bar-pseudo-element-rtl.html +== indeterminate-style-width.html indeterminate-style-width.html # vertical tests -fails == values-vertical.html values-vertical.html -fails == values-vertical-rtl.html values-vertical-rtl.html -fails == margin-padding-vertical.html margin-padding-vertical.html -fails == margin-padding-vertical-rtl.html margin-padding-vertical-rtl.html -fails == bar-pseudo-element-vertical.html bar-pseudo-element-vertical.html -fails == bar-pseudo-element-vertical-rtl.html bar-pseudo-element-vertical-rtl.html -fails == indeterminate-style-height.html indeterminate-style-height.html +== values-vertical.html values-vertical.html +== values-vertical-rtl.html values-vertical-rtl.html +== margin-padding-vertical.html margin-padding-vertical.html +== margin-padding-vertical-rtl.html margin-padding-vertical-rtl.html +== bar-pseudo-element-vertical.html bar-pseudo-element-vertical.html +== bar-pseudo-element-vertical-rtl.html bar-pseudo-element-vertical-rtl.html +== indeterminate-style-height.html indeterminate-style-height.html # The following test is disabled but kept in the repository because the # transformations will not behave exactly the same for and two divs. # However, it would be possible to manually check those. -fails == transformations.html transformations.html +== transformations.html transformations.html # Tests for bugs: -fails == block-invalidate.html block-invalidate.html -fails == in-cells.html in-cells.html +== block-invalidate.html block-invalidate.html +== in-cells.html in-cells.html == max-height.html max-height.html # Tests for block and inline orientation in combination with writing-mode diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 7b4629abeee0..aef6eff20883 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -457,7 +457,7 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, ServoComputedValuesBorrowedOrNull aOldComputedValues, ServoComputedValuesBorrowedOrNull aComputedValues, ServoComputedValuesBorrowedOrNull aParentComputedValues, - UpdateAnimationsTasks aTaskBits) + UpdateAnimationsTasks aTasks) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aElement); @@ -470,7 +470,6 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, return; } - UpdateAnimationsTasks tasks = static_cast(aTaskBits); if (presContext->IsDynamic() && aElement->IsInComposedDoc()) { const ServoComputedValuesWithParent servoValues = { aComputedValues, aParentComputedValues }; @@ -478,12 +477,23 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull, CSSEnabledState::eForAllContent); - if (tasks & UpdateAnimationsTasks::CSSAnimations) { + if (aTasks & UpdateAnimationsTasks::CSSAnimations) { presContext->AnimationManager()-> UpdateAnimations(const_cast(aElement), pseudoType, servoValues); } - if (tasks & UpdateAnimationsTasks::CSSTransitions) { + + // aComputedValues might be nullptr if the target element is now in a + // display:none subtree. We still call Gecko_UpdateAnimations in this case + // because we need to stop CSS animations in the display:none subtree. + // However, we don't need to update transitions since they are stopped by + // RestyleManager::AnimationsWithDestroyedFrame so we just return early + // here. + if (!aComputedValues) { + return; + } + + if (aTasks & UpdateAnimationsTasks::CSSTransitions) { MOZ_ASSERT(aOldComputedValues); const ServoComputedValuesWithParent oldServoValues = { aOldComputedValues, nullptr }; @@ -491,7 +501,7 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, UpdateTransitions(const_cast(aElement), pseudoType, oldServoValues, servoValues); } - if (tasks & UpdateAnimationsTasks::EffectProperties) { + if (aTasks & UpdateAnimationsTasks::EffectProperties) { presContext->EffectCompositor()->UpdateEffectProperties( servoValues, const_cast(aElement), pseudoType); } @@ -958,6 +968,33 @@ Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLe return nsContentUtils::EqualsIgnoreASCIICase(atomStr, inStr); } +void +Gecko_EnsureMozBorderColors(nsStyleBorder* aBorder) +{ + aBorder->EnsureBorderColors(); +} + +void Gecko_ClearMozBorderColors(nsStyleBorder* aBorder, mozilla::Side aSide) +{ + aBorder->ClearBorderColors(aSide); +} + +void +Gecko_AppendMozBorderColors(nsStyleBorder* aBorder, mozilla::Side aSide, + nscolor aColor) +{ + aBorder->AppendBorderColor(aSide, aColor); +} + +void +Gecko_CopyMozBorderColors(nsStyleBorder* aDest, const nsStyleBorder* aSrc, + mozilla::Side aSide) +{ + if (aSrc->mBorderColors) { + aDest->CopyBorderColorsFrom(aSrc->mBorderColors[aSide], aSide); + } +} + void Gecko_FontFamilyList_Clear(FontFamilyList* aList) { aList->Clear(); diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 0d8883da67f8..18117c14fb95 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -36,6 +36,7 @@ namespace mozilla { class FontFamilyList; enum FontFamilyType : uint32_t; struct Keyframe; + enum Side; namespace css { struct URLValue; }; @@ -200,7 +201,7 @@ void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement, ServoComputedValuesBorrowedOrNull aOldComputedValues, ServoComputedValuesBorrowedOrNull aComputedValues, ServoComputedValuesBorrowedOrNull aParentComputedValues, - mozilla::UpdateAnimationsTasks aTaskBits); + mozilla::UpdateAnimationsTasks aTasks); bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElement, nsIAtom* aPseudoTagOrNull); bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElement, @@ -239,6 +240,14 @@ const uint16_t* Gecko_GetAtomAsUTF16(nsIAtom* aAtom, uint32_t* aLength); bool Gecko_AtomEqualsUTF8(nsIAtom* aAtom, const char* aString, uint32_t aLength); bool Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLength); +// Border style +void Gecko_EnsureMozBorderColors(nsStyleBorder* aBorder); +void Gecko_ClearMozBorderColors(nsStyleBorder* aBorder, mozilla::Side aSide); +void Gecko_AppendMozBorderColors(nsStyleBorder* aBorder, mozilla::Side aSide, + nscolor aColor); +void Gecko_CopyMozBorderColors(nsStyleBorder* aDest, const nsStyleBorder* aSrc, + mozilla::Side aSide); + // Font style void Gecko_FontFamilyList_Clear(FontFamilyList* aList); void Gecko_FontFamilyList_AppendNamed(FontFamilyList* aList, nsIAtom* aName, bool aQuoted); diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index a7bb3413fe4b..3e310236dd16 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -366,13 +366,8 @@ nsStyleBorder::nsStyleBorder(const nsStyleBorder& aSrc) { MOZ_COUNT_CTOR(nsStyleBorder); if (aSrc.mBorderColors) { - EnsureBorderColors(); - for (int32_t i = 0; i < 4; i++) { - if (aSrc.mBorderColors[i]) { - mBorderColors[i] = aSrc.mBorderColors[i]->Clone(); - } else { - mBorderColors[i] = nullptr; - } + NS_FOR_CSS_SIDES(side) { + CopyBorderColorsFrom(aSrc.mBorderColors[side], side); } } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 7bf901639203..e2631f11dc6e 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1162,6 +1162,14 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder } } + void CopyBorderColorsFrom(const nsBorderColors* aSrcBorderColors, mozilla::Side aSide) { + if (aSrcBorderColors) { + EnsureBorderColors(); + ClearBorderColors(aSide); + mBorderColors[aSide] = aSrcBorderColors->Clone(); + } + } + // Return whether aStyle is a visible style. Invisible styles cause // the relevant computed border width to be 0. // Note that this does *not* consider the effects of 'border-image': diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index 59debf5f6da4..bf1ec7e64519 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -105,9 +105,6 @@ to mochitest command. * test_font_face_parser.html `font-language-override`: bug 1355364 [8] * ... `font-feature-settings`: bug 1355366 [10] * test_font_face_parser.html `font-weight`: keyword values should be preserved in \@font-face [4] -* unicode-range parsing bugs - * servo/rust-cssparser#133 - * test_font_face_parser.html `4E00`: servo/rust-cssparser#135 [2] * @font-face support bug 1290237 * test_descriptor_storage.html [1] * test_font_face_parser.html `@font-face` [8] @@ -134,14 +131,6 @@ to mochitest command. * test_inherit_computation.html `border-image` [2] * test_initial_computation.html `border-image` [4] * Unimplemented prefixed properties: - * -moz-border-*-colors bug 1348173 - * test_compute_data_with_start_struct.html `-colors` [8] - * test_inherit_computation.html `-colors` [8] - * test_inherit_storage.html `-colors` [12] - * test_initial_computation.html `-colors` [16] - * test_initial_storage.html `-colors` [24] - * test_value_storage.html `-colors` [96] - * test_shorthand_property_getters.html `-colors` [1] * -moz-force-broken-image-icon servo/servo#16001 * test_compute_data_with_start_struct.html `-moz-force-broken-image-icon` [2] * test_inherit_computation.html `-moz-force-broken-image-icon` [2] diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index ff52cb59983a..04bd63c6007b 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -1040,6 +1040,14 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent) } } + nsIFrame* thumbFrame = mFrames.FirstChild(); + if (!thumbFrame) { + return; + } + bool isHorizontal = IsXULHorizontal(); + nsSize thumbSize = thumbFrame->GetSize(); + nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height; + mozilla::layers::FrameMetrics::ViewID scrollTargetId; bool hasID = nsLayoutUtils::FindIDFor(scrollableContent, &scrollTargetId); bool hasAPZView = hasID && (scrollTargetId != layers::FrameMetrics::NULL_SCROLL_ID); @@ -1065,8 +1073,10 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent) NSAppUnitsToFloatPixels(mDragStart, float(AppUnitsPerCSSPixel())), sliderTrackCSS, - IsXULHorizontal() ? AsyncDragMetrics::HORIZONTAL : - AsyncDragMetrics::VERTICAL); + NSAppUnitsToFloatPixels(thumbLength, + float(AppUnitsPerCSSPixel())), + isHorizontal ? AsyncDragMetrics::HORIZONTAL : + AsyncDragMetrics::VERTICAL); if (!nsLayoutUtils::HasDisplayPort(scrollableContent)) { return; diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java index 72be6ee976f9..2d4bdfa78f50 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java @@ -179,7 +179,12 @@ public class ActionBarPresenter { private void initIndicator() { mActionBar.setDisplayHomeAsUpEnabled(true); - final Drawable icon = mActionBar.getThemedContext().getDrawable(R.drawable.ic_close_light); + + @SuppressWarnings("deprecation") + final Drawable icon = mActionBar.getThemedContext() + .getResources() + .getDrawable(R.drawable.ic_close_light); + DrawableCompat.setTint(icon, mTextPrimaryColor); mActionBar.setHomeAsUpIndicator(icon); } diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java index 08f9a46c3799..8aa82f7ddf89 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java @@ -241,7 +241,10 @@ public class CustomTabsActivity extends GeckoApp implements Tabs.OnTabsChangedLi // insert an action button for menu. click it to show popup menu popupMenu = createCustomPopupMenu(); - actionBarPresenter.addActionButton(menu, getDrawable(R.drawable.ab_menu), true) + + @SuppressWarnings("deprecation") + Drawable icon = getResources().getDrawable(R.drawable.ab_menu); + actionBarPresenter.addActionButton(menu, icon, true) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View anchor) { diff --git a/mobile/android/base/java/org/mozilla/gecko/push/PushService.java b/mobile/android/base/java/org/mozilla/gecko/push/PushService.java index 3b8ea2e522f5..03db25dfda06 100644 --- a/mobile/android/base/java/org/mozilla/gecko/push/PushService.java +++ b/mobile/android/base/java/org/mozilla/gecko/push/PushService.java @@ -61,6 +61,12 @@ public class PushService implements BundleEventListener { public static final String SERVICE_WEBPUSH = "webpush"; public static final String SERVICE_FXA = "fxa"; + public static final double ERROR_GCM_DISABLED = 2154627078L; // = NS_ERROR_DOM_PUSH_GCM_DISABLED + + public static final String REPLY_BUNDLE_KEY_ERROR = "error"; + public static final String ERROR_BUNDLE_KEY_MESSAGE = "message"; + public static final String ERROR_BUNDLE_KEY_RESULT = "result"; + private static PushService sInstance; private static final String[] GECKO_EVENTS = new String[] { @@ -170,7 +176,7 @@ public class PushService implements BundleEventListener { } // We'll obtain a new subscription as part of device registration. - if (FxAccountDeviceRegistrator.needToRenewRegistration(fxAccount.getDeviceRegistrationTimestamp())) { + if (FxAccountDeviceRegistrator.shouldRenewRegistration(fxAccount)) { Log.i(LOG_TAG, "FxA device needs registration renewal"); FxAccountDeviceRegistrator.renewRegistration(context); } @@ -467,7 +473,13 @@ public class PushService implements BundleEventListener { // with the WebPush? Perhaps we can show a dialog when interacting with the Push // permissions, and then be more aggressive showing this notification when we have // registrations and subscriptions that can't be advanced. - callback.sendError("To handle event [" + event + "], user interaction is needed to enable Google Play Services."); + String msg = "To handle event [" + event + "], user interaction is needed to enable Google Play Services."; + GeckoBundle reply = new GeckoBundle(); + GeckoBundle error = new GeckoBundle(); + error.putString(ERROR_BUNDLE_KEY_MESSAGE, msg); + error.putDouble(ERROR_BUNDLE_KEY_RESULT, ERROR_GCM_DISABLED); + reply.putBundle(REPLY_BUNDLE_KEY_ERROR, error); + callback.sendError(reply); } } diff --git a/mobile/android/components/FxAccountsPush.js b/mobile/android/components/FxAccountsPush.js index f83c3235b153..2bf0e3394a0f 100644 --- a/mobile/android/components/FxAccountsPush.js +++ b/mobile/android/components/FxAccountsPush.js @@ -3,9 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -60,7 +58,9 @@ FxAccountsPush.prototype = { resolve(subscription); } else { Log.w("FxAccountsPush failed to subscribe", result); - reject(new Error("FxAccountsPush failed to subscribe")); + const err = new Error("FxAccountsPush failed to subscribe"); + err.result = result; + reject(err); } }); }) @@ -76,6 +76,10 @@ FxAccountsPush.prototype = { }) .catch(err => { Log.i("Error when registering FxA push endpoint " + err); + EventDispatcher.instance.sendRequest({ + type: "FxAccountsPush:Subscribe:Response", + error: err.result.toString() // Convert to string because the GeckoBundle can't getLong(); + }); }); }, diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDevice.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDevice.java index cd46ae2bd583..e8a1fa57b12d 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDevice.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDevice.java @@ -35,16 +35,6 @@ public class FxAccountDevice { this.pushAuthKey = pushAuthKey; } - public static FxAccountDevice forRegister(String name, String type, String pushCallback, - String pushPublicKey, String pushAuthKey) { - return new FxAccountDevice(name, null, type, null, pushCallback, pushPublicKey, pushAuthKey); - } - - public static FxAccountDevice forUpdate(String id, String name, String pushCallback, - String pushPublicKey, String pushAuthKey) { - return new FxAccountDevice(name, id, null, null, pushCallback, pushPublicKey, pushAuthKey); - } - public static FxAccountDevice fromJson(ExtendedJSONObject json) { String name = json.getString(JSON_KEY_NAME); String id = json.getString(JSON_KEY_ID); @@ -78,4 +68,47 @@ public class FxAccountDevice { } return body; } + + public static class Builder { + private String id; + private String name; + private String type; + private Boolean isCurrentDevice; + private String pushCallback; + private String pushPublicKey; + private String pushAuthKey; + + public void id(String id) { + this.id = id; + } + + public void name(String name) { + this.name = name; + } + + public void type(String type) { + this.type = type; + } + + public void isCurrentDevice() { + this.isCurrentDevice = Boolean.TRUE; + } + + public void pushCallback(String pushCallback) { + this.pushCallback = pushCallback; + } + + public void pushPublicKey(String pushPublicKey) { + this.pushPublicKey = pushPublicKey; + } + + public void pushAuthKey(String pushAuthKey) { + this.pushAuthKey = pushAuthKey; + } + + public FxAccountDevice build() { + return new FxAccountDevice(this.name, this.id, this.type, this.isCurrentDevice, + this.pushCallback, this.pushPublicKey, this.pushAuthKey); + } + } } diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDeviceRegistrator.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDeviceRegistrator.java index 8dfc765bd264..75b4b8d59eb3 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDeviceRegistrator.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FxAccountDeviceRegistrator.java @@ -6,7 +6,9 @@ package org.mozilla.gecko.fxa; import android.content.Context; import android.content.Intent; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import android.util.Log; @@ -34,7 +36,7 @@ import java.util.concurrent.Executors; /* This class provides a way to register the current device against FxA * and also stores the registration details in the Android FxAccount. - * This should be used in a state where we possess a sessionToken, most likely the Married state. + * This should be used in a state where we possess a sessionToken, most likely the Engaged/Married states. */ public class FxAccountDeviceRegistrator implements BundleEventListener { private static final String LOG_TAG = "FxADeviceRegistrator"; @@ -44,38 +46,60 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { // expiring from underneath us, we unsubscribe and resubscribe every 21 days. // Note that this simple schedule means that we might unsubscribe perfectly valid (but old) // subscriptions. This will be improved as part of Bug 1345651. - private static final long TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS = 21 * 24 * 60 * 60 * 1000L; + @VisibleForTesting + static final long TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS = 21 * 24 * 60 * 60 * 1000L; + + @VisibleForTesting + static final long RETRY_TIME_AFTER_GCM_DISABLED_ERROR = 15 * 24 * 60 * 60 * 1000L; + + + public static final String PUSH_SUBSCRIPTION_REPLY_BUNDLE_KEY_ERROR = "error"; + @VisibleForTesting + static final long ERROR_GCM_DISABLED = 2154627078L; // = NS_ERROR_DOM_PUSH_GCM_DISABLED // The current version of the device registration, we use this to re-register // devices after we update what we send on device registration. - public static final Integer DEVICE_REGISTRATION_VERSION = 2; + @VisibleForTesting + static final Integer DEVICE_REGISTRATION_VERSION = 2; private static FxAccountDeviceRegistrator instance; private final WeakReference context; private FxAccountDeviceRegistrator(Context appContext) { - this.context = new WeakReference(appContext); + this.context = new WeakReference<>(appContext); } private static FxAccountDeviceRegistrator getInstance(Context appContext) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { if (instance == null) { - FxAccountDeviceRegistrator tempInstance = new FxAccountDeviceRegistrator(appContext); + final FxAccountDeviceRegistrator tempInstance = new FxAccountDeviceRegistrator(appContext); tempInstance.setupListeners(); // Set up listener for FxAccountPush:Subscribe:Response instance = tempInstance; } return instance; } - public static boolean needToRenewRegistration(final long timestamp) { + public static boolean shouldRegister(final AndroidFxAccount fxAccount) { + if (fxAccount.getDeviceRegistrationVersion() != FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION || + TextUtils.isEmpty(fxAccount.getDeviceId())) { + return true; + } + // At this point, we have a working up-to-date registration, but it might be a partial one + // (no push registration). + return fxAccount.getDevicePushRegistrationError() == ERROR_GCM_DISABLED && + (System.currentTimeMillis() - fxAccount.getDevicePushRegistrationErrorTime()) > RETRY_TIME_AFTER_GCM_DISABLED_ERROR; + } + + public static boolean shouldRenewRegistration(final AndroidFxAccount fxAccount) { + final long deviceRegistrationTimestamp = fxAccount.getDeviceRegistrationTimestamp(); // NB: we're comparing wall clock to wall clock, at different points in time. // It's possible that wall clocks have changed, and our comparison will be meaningless. // However, this happens in the context of a sync, and we won't be able to sync anyways if our // wall clock deviates too much from time on the server. - return (System.currentTimeMillis() - timestamp) > TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS; + return (System.currentTimeMillis() - deviceRegistrationTimestamp) > TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS; } public static void register(Context context) { - Context appContext = context.getApplicationContext(); + final Context appContext = context.getApplicationContext(); try { getInstance(appContext).beginRegistration(appContext); } catch (Exception e) { @@ -84,7 +108,7 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { } public static void renewRegistration(Context context) { - Context appContext = context.getApplicationContext(); + final Context appContext = context.getApplicationContext(); try { getInstance(appContext).beginRegistrationRenewal(appContext); } catch (Exception e) { @@ -122,30 +146,51 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { @Override public void handleMessage(String event, GeckoBundle message, EventCallback callback) { if ("FxAccountsPush:Subscribe:Response".equals(event)) { - doFxaRegistration(message.getBundle("subscription")); + handlePushSubscriptionResponse(message); } else { Log.e(LOG_TAG, "No action defined for " + event); } } - private void doFxaRegistration(GeckoBundle subscription) { + private void handlePushSubscriptionResponse(final GeckoBundle message) { + // Make sure the context has not been gc'd during the push registration + // and the FxAccount still exists. final Context context = this.context.get(); - if (this.context == null) { + if (context == null) { throw new IllegalStateException("Application context has been gc'ed"); } - doFxaRegistration(context, subscription, true); - } - - private static void doFxaRegistration(final Context context, final GeckoBundle subscription, final boolean allowRecursion) { - String pushCallback = subscription.getString("pushCallback"); - String pushPublicKey = subscription.getString("pushPublicKey"); - String pushAuthKey = subscription.getString("pushAuthKey"); - final AndroidFxAccount fxAccount = AndroidFxAccount.fromContext(context); if (fxAccount == null) { Log.e(LOG_TAG, "AndroidFxAccount is null"); return; } + + fxAccount.resetDevicePushRegistrationError(); + final long error = getSubscriptionReplyError(message); + + final FxAccountDevice device; + if (error == 0L) { + Log.i(LOG_TAG, "Push registration succeeded. Beginning normal FxA Registration."); + device = buildFxAccountDevice(context, fxAccount, message.getBundle("subscription")); + } else { + fxAccount.setDevicePushRegistrationError(error, System.currentTimeMillis()); + Log.i(LOG_TAG, "Push registration failed. Beginning degraded FxA Registration."); + device = buildFxAccountDevice(context, fxAccount); + } + + doFxaRegistration(context, fxAccount, device, true); + } + + private long getSubscriptionReplyError(final GeckoBundle message) { + String errorStr = message.getString(PUSH_SUBSCRIPTION_REPLY_BUNDLE_KEY_ERROR); + if (TextUtils.isEmpty(errorStr)) { + return 0L; + } + return Long.parseLong(errorStr); + } + + private static void doFxaRegistration(final Context context, final AndroidFxAccount fxAccount, + final FxAccountDevice device, final boolean allowRecursion) { final byte[] sessionToken; try { sessionToken = fxAccount.getState().getSessionToken(); @@ -153,19 +198,14 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { Log.e(LOG_TAG, "Could not get a session token", e); return; } - final FxAccountDevice device; - String deviceId = fxAccount.getDeviceId(); - String clientName = getClientName(fxAccount, context); - if (TextUtils.isEmpty(deviceId)) { + + if (device.id == null) { Log.i(LOG_TAG, "Attempting registration for a new device"); - device = FxAccountDevice.forRegister(clientName, "mobile", pushCallback, pushPublicKey, pushAuthKey); } else { Log.i(LOG_TAG, "Attempting registration for an existing device"); - Logger.pii(LOG_TAG, "Device ID: " + deviceId); - device = FxAccountDevice.forUpdate(deviceId, clientName, pushCallback, pushPublicKey, pushAuthKey); } - ExecutorService executor = Executors.newSingleThreadExecutor(); // Not called often, it's okay to spawn another thread + final ExecutorService executor = Executors.newSingleThreadExecutor(); // Not called often, it's okay to spawn another thread final FxAccountClient20 fxAccountClient = new FxAccountClient20(fxAccount.getAccountServerURI(), executor); fxAccountClient.registerOrUpdateDevice(sessionToken, device, new RequestDelegate() { @@ -185,8 +225,10 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { if (error.apiErrorNumber == FxAccountRemoteError.UNKNOWN_DEVICE) { recoverFromUnknownDevice(fxAccount); } else if (error.apiErrorNumber == FxAccountRemoteError.DEVICE_SESSION_CONFLICT) { - recoverFromDeviceSessionConflict(error, fxAccountClient, sessionToken, fxAccount, context, - subscription, allowRecursion); + // This can happen if a device was already registered using our session token, and we + // tried to create a new one (no id field). + recoverFromDeviceSessionConflict(error, fxAccountClient, sessionToken, fxAccount, device, + context, allowRecursion); } } else if (error.httpStatusCode == 401 @@ -201,11 +243,44 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { public void handleSuccess(FxAccountDevice result) { Log.i(LOG_TAG, "Device registration complete"); Logger.pii(LOG_TAG, "Registered device ID: " + result.id); + Log.i(LOG_TAG, "Setting DEVICE_REGISTRATION_VERSION to " + DEVICE_REGISTRATION_VERSION); fxAccount.setFxAUserData(result.id, DEVICE_REGISTRATION_VERSION, System.currentTimeMillis()); } }); } + private static FxAccountDevice buildFxAccountDevice(Context context, AndroidFxAccount fxAccount) { + return makeFxADeviceCommonBuilder(context, fxAccount).build(); + } + + private static FxAccountDevice buildFxAccountDevice(Context context, AndroidFxAccount fxAccount, @NonNull GeckoBundle subscription) { + final FxAccountDevice.Builder builder = makeFxADeviceCommonBuilder(context, fxAccount); + final String pushCallback = subscription.getString("pushCallback"); + final String pushPublicKey = subscription.getString("pushPublicKey"); + final String pushAuthKey = subscription.getString("pushAuthKey"); + if (!TextUtils.isEmpty(pushCallback) && !TextUtils.isEmpty(pushPublicKey) && + !TextUtils.isEmpty(pushAuthKey)) { + builder.pushCallback(pushCallback); + builder.pushPublicKey(pushPublicKey); + builder.pushAuthKey(pushAuthKey); + } + return builder.build(); + } + + // Do not call this directly, use buildFxAccountDevice instead. + private static FxAccountDevice.Builder makeFxADeviceCommonBuilder(Context context, AndroidFxAccount fxAccount) { + final String deviceId = fxAccount.getDeviceId(); + final String clientName = getClientName(fxAccount, context); + + final FxAccountDevice.Builder builder = new FxAccountDevice.Builder(); + builder.name(clientName); + builder.type("mobile"); + if (!TextUtils.isEmpty(deviceId)) { + builder.id(deviceId); + } + return builder; + } + private static void logErrorAndResetDeviceRegistrationVersionAndTimestamp( final FxAccountClientRemoteException error, final AndroidFxAccount fxAccount) { Log.e(LOG_TAG, "Device registration failed", error); @@ -216,7 +291,7 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { @Nullable private static String getClientName(final AndroidFxAccount fxAccount, final Context context) { try { - SharedPreferencesClientsDataDelegate clientsDataDelegate = + final SharedPreferencesClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs(), context); return clientsDataDelegate.getClientName(); } catch (UnsupportedEncodingException | GeneralSecurityException e) { @@ -242,7 +317,7 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { @Override public void handleSuccess(AccountStatusResponse result) { - State doghouseState = fxAccount.getState().makeDoghouseState(); + final State doghouseState = fxAccount.getState().makeDoghouseState(); if (!result.exists) { Log.i(LOG_TAG, "token invalidated because the account no longer exists"); // TODO: Should be in a "I have an Android account, but the FxA is gone." State. @@ -268,9 +343,12 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { final FxAccountClient fxAccountClient, final byte[] sessionToken, final AndroidFxAccount fxAccount, + final FxAccountDevice device, final Context context, - final GeckoBundle subscription, final boolean allowRecursion) { + // Recovery strategy: re-try a registration, UPDATING (instead of creating) the device. + // We do that by finding the device ID who conflicted with us and try a registration update + // using that id. Log.w(LOG_TAG, "device session conflict, attempting to ascertain the correct device id"); fxAccountClient.deviceList(sessionToken, new RequestDelegate() { private void onError() { @@ -290,16 +368,20 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { @Override public void handleSuccess(FxAccountDevice[] devices) { - for (FxAccountDevice device : devices) { - if (device.isCurrentDevice) { - fxAccount.setFxAUserData(device.id, 0, 0L); // Reset device registration version/timestamp - if (!allowRecursion) { - Log.d(LOG_TAG, "Failure to register a device on the second try"); - break; - } - doFxaRegistration(context, subscription, false); - return; + for (final FxAccountDevice fxaDevice : devices) { + if (!fxaDevice.isCurrentDevice) { + continue; } + fxAccount.setFxAUserData(fxaDevice.id, 0, 0L); // Reset device registration version/timestamp + if (!allowRecursion) { + Log.d(LOG_TAG, "Failure to register a device on the second try"); + break; + } + final FxAccountDevice updatedDevice = new FxAccountDevice(device.name, fxaDevice.id, device.type, + device.isCurrentDevice, device.pushCallback, + device.pushPublicKey, device.pushAuthKey); + doFxaRegistration(context, fxAccount, updatedDevice, false); + return; } onError(); } @@ -309,10 +391,10 @@ public class FxAccountDeviceRegistrator implements BundleEventListener { private void setupListeners() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { // We have no choice but to use reflection here, sorry :( - Class eventDispatcher = Class.forName("org.mozilla.gecko.EventDispatcher"); - Method getInstance = eventDispatcher.getMethod("getInstance"); - Object instance = getInstance.invoke(null); - Method registerBackgroundThreadListener = eventDispatcher.getMethod("registerBackgroundThreadListener", + final Class eventDispatcher = Class.forName("org.mozilla.gecko.EventDispatcher"); + final Method getInstance = eventDispatcher.getMethod("getInstance"); + final Object instance = getInstance.invoke(null); + final Method registerBackgroundThreadListener = eventDispatcher.getMethod("registerBackgroundThreadListener", BundleEventListener.class, String[].class); registerBackgroundThreadListener.invoke(instance, this, new String[] { "FxAccountsPush:Subscribe:Response" }); } diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java index 7070c209c4b1..9eb4b8538e4d 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java @@ -15,7 +15,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.os.ResultReceiver; -import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.LocalBroadcastManager; import android.text.TextUtils; @@ -39,6 +38,8 @@ import org.mozilla.gecko.util.ThreadUtils; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.security.GeneralSecurityException; +import java.text.NumberFormat; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -80,6 +81,8 @@ public class AndroidFxAccount { public static final String ACCOUNT_KEY_DEVICE_ID = "deviceId"; public static final String ACCOUNT_KEY_DEVICE_REGISTRATION_VERSION = "deviceRegistrationVersion"; private static final String ACCOUNT_KEY_DEVICE_REGISTRATION_TIMESTAMP = "deviceRegistrationTimestamp"; + private static final String ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR = "devicePushRegistrationError"; + private static final String ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR_TIME = "devicePushRegistrationErrorTime"; // Account authentication token type for fetching account profile. public static final String PROFILE_OAUTH_TOKEN_TYPE = "oauth::profile"; @@ -802,40 +805,39 @@ public class AndroidFxAccount { }); } + @SuppressWarnings("unchecked") + private T getUserDataNumber(String key, T defaultValue) { + final String numStr = accountManager.getUserData(account, key); + if (TextUtils.isEmpty(numStr)) { + return defaultValue; + } + try { + return (T) NumberFormat.getInstance().parse(numStr); + } catch (ParseException e) { + Logger.warn(LOG_TAG, "Couldn't parse " + key + "; defaulting to 0L.", e); + return defaultValue; + } + } + @Nullable public synchronized String getDeviceId() { return accountManager.getUserData(account, ACCOUNT_KEY_DEVICE_ID); } - @NonNull public synchronized int getDeviceRegistrationVersion() { - String versionStr = accountManager.getUserData(account, ACCOUNT_KEY_DEVICE_REGISTRATION_VERSION); - if (TextUtils.isEmpty(versionStr)) { - return 0; - } else { - try { - return Integer.parseInt(versionStr); - } catch (NumberFormatException ex) { - return 0; - } - } + return getUserDataNumber(ACCOUNT_KEY_DEVICE_REGISTRATION_VERSION, 0); } public synchronized long getDeviceRegistrationTimestamp() { - final String timestampStr = accountManager.getUserData(account, ACCOUNT_KEY_DEVICE_REGISTRATION_TIMESTAMP); + return getUserDataNumber(ACCOUNT_KEY_DEVICE_REGISTRATION_TIMESTAMP, 0L); + } - if (TextUtils.isEmpty(timestampStr)) { - return 0L; - } + public synchronized long getDevicePushRegistrationError() { + return getUserDataNumber(ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR, 0L); + } - // Long.parseLong might throw; while it's not expected that this might happen, let's not risk - // crashing here as this method will be called on startup. - try { - return Long.parseLong(timestampStr); - } catch (NumberFormatException e) { - Logger.warn(LOG_TAG, "Couldn't parse deviceRegistrationTimestamp; defaulting to 0L.", e); - return 0L; - } + public synchronized long getDevicePushRegistrationErrorTime() { + return getUserDataNumber(ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR_TIME, 0L); } public synchronized void setDeviceId(String id) { @@ -864,6 +866,15 @@ public class AndroidFxAccount { Long.toString(timestamp)); } + public synchronized void setDevicePushRegistrationError(long error, long errorTimeMs) { + accountManager.setUserData(account, ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR, Long.toString(error)); + accountManager.setUserData(account, ACCOUNT_KEY_DEVICE_PUSH_REGISTRATION_ERROR_TIME, Long.toString(errorTimeMs)); + } + + public synchronized void resetDevicePushRegistrationError() { + setDevicePushRegistrationError(0L, 0l); + } + @SuppressLint("ParcelCreator") // The CREATOR field is defined in the super class. private class ProfileResultReceiver extends ResultReceiver { public ProfileResultReceiver(Handler handler) { diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncAdapter.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncAdapter.java index eb2f6452ff89..83d629eb1e44 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncAdapter.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncAdapter.java @@ -409,13 +409,12 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter { // As part of device registration, we obtain a PushSubscription, register our push endpoint // with FxA, and update account data with fxaDeviceId, which is part of our synced // clients record. - if (fxAccount.getDeviceRegistrationVersion() != FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION - || TextUtils.isEmpty(fxAccount.getDeviceId())) { + if (FxAccountDeviceRegistrator.shouldRegister(fxAccount)) { FxAccountDeviceRegistrator.register(context); // We might need to re-register periodically to ensure our FxA push subscription is valid. // This involves unsubscribing, subscribing and updating remote FxA device record with // new push subscription information. - } else if (FxAccountDeviceRegistrator.needToRenewRegistration(fxAccount.getDeviceRegistrationTimestamp())) { + } else if (FxAccountDeviceRegistrator.shouldRenewRegistration(fxAccount)) { FxAccountDeviceRegistrator.renewRegistration(context); } } diff --git a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/fxa/TestFxAccountDeviceRegistrator.java b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/fxa/TestFxAccountDeviceRegistrator.java new file mode 100644 index 000000000000..296ab6a78103 --- /dev/null +++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/fxa/TestFxAccountDeviceRegistrator.java @@ -0,0 +1,91 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +package org.mozilla.gecko.fxa; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mozilla.gecko.background.testhelpers.TestRunner; +import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +@RunWith(TestRunner.class) +public class TestFxAccountDeviceRegistrator { + + @Mock + AndroidFxAccount fxAccount; + + @Before + public void init() { + // Process Mockito annotations + MockitoAnnotations.initMocks(this); + } + + @Test + public void shouldRegister() { + // Assuming there is no previous push registration errors recorded: + when(fxAccount.getDevicePushRegistrationError()).thenReturn(0L); + when(fxAccount.getDevicePushRegistrationErrorTime()).thenReturn(0L); + + // Should return false if the device registration version is up-to-date and a device ID is stored. + // (general case after a successful device registration) + when(fxAccount.getDeviceRegistrationVersion()).thenReturn(FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION); + when(fxAccount.getDeviceId()).thenReturn("bogusdeviceid"); + assertFalse(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return true if the device registration version is up-to-date but no device ID is stored. + // (data mangling) + when(fxAccount.getDeviceRegistrationVersion()).thenReturn(FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION); + when(fxAccount.getDeviceId()).thenReturn(null); + assertTrue(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return true if the device ID is stored but no device registration version can be found. + // (data mangling) + when(fxAccount.getDeviceRegistrationVersion()).thenReturn(0); + when(fxAccount.getDeviceId()).thenReturn("bogusid"); + assertTrue(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return true if the device registration version is too old. + // (code update pushed) + when(fxAccount.getDeviceRegistrationVersion()).thenReturn(FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION - 1); + assertTrue(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return true if the device registration is OK, but we didn't get a push subscription because + // Google Play Services were unavailable at the time and the retry delay is passed. + when(fxAccount.getDeviceRegistrationVersion()).thenReturn(FxAccountDeviceRegistrator.DEVICE_REGISTRATION_VERSION); + when(fxAccount.getDevicePushRegistrationError()).thenReturn(FxAccountDeviceRegistrator.ERROR_GCM_DISABLED); + when(fxAccount.getDevicePushRegistrationErrorTime()).thenReturn(System.currentTimeMillis() - + FxAccountDeviceRegistrator.RETRY_TIME_AFTER_GCM_DISABLED_ERROR - 1); + assertTrue(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return false if the device registration is OK, but we didn't get a push subscription because + // Google Play Services were unavailable at the time and the retry delay has not passed. + // We assume that RETRY_TIME_AFTER_GCM_DISABLED_ERROR is longer than the time it takes to execute this test :) + when(fxAccount.getDevicePushRegistrationErrorTime()).thenReturn(System.currentTimeMillis()); + assertFalse(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + + // Should return false if the device registration is OK, but we didn't get a push subscription because + // an unknown error happened at the time. + when(fxAccount.getDevicePushRegistrationError()).thenReturn(12345L); + assertFalse(FxAccountDeviceRegistrator.shouldRegister(fxAccount)); + } + + @Test + public void shouldRenewRegistration() { + // Should return true if our last push registration was done a day before our expiration threshold. + when(fxAccount.getDeviceRegistrationTimestamp()).thenReturn(System.currentTimeMillis() - + FxAccountDeviceRegistrator.TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS - + 1 * 24 * 60 * 60 * 1000L); + + // Should return false if our last push registration is recent enough. + // We assume that TIME_BETWEEN_CHANNEL_REGISTRATION_IN_MILLIS is longer than a day + the time it takes to run this test. + when(fxAccount.getDeviceRegistrationTimestamp()).thenReturn(System.currentTimeMillis() - + 1 * 24 * 60 * 60 * 1000L); + } +} diff --git a/services/cloudsync/tests/xpcshell/test_bookmarks.js b/services/cloudsync/tests/xpcshell/test_bookmarks.js index c2918a59da11..adfbdaa8551e 100644 --- a/services/cloudsync/tests/xpcshell/test_bookmarks.js +++ b/services/cloudsync/tests/xpcshell/test_bookmarks.js @@ -14,10 +14,19 @@ add_task(function* test_merge_bookmarks_flat() { let rootFolder = yield CloudSync().bookmarks.getRootFolder("TEST"); ok(rootFolder.id, "root folder id is ok"); - let items = [ - {"id":"G_UL4ZhOyX8m", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 1", "uri":"http://www.reddit.com", index:2}, - {"id":"G_UL4ZhOyX8n", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 2", "uri":"http://www.reddit.com?1", index:1}, - ]; + let items = [{ + "id": "G_UL4ZhOyX8m", + "type": rootFolder.BOOKMARK, + "title": "reddit: the front page of the internet 1", + "uri": "http://www.reddit.com", + index: 2 + }, { + "id": "G_UL4ZhOyX8n", + "type": rootFolder.BOOKMARK, + "title": "reddit: the front page of the internet 2", + "uri": "http://www.reddit.com?1", + index: 1 + }]; yield rootFolder.mergeRemoteItems(items); let localItems = yield rootFolder.getLocalItems(); @@ -32,11 +41,23 @@ add_task(function* test_merge_bookmarks_in_folders() { let rootFolder = yield CloudSync().bookmarks.getRootFolder("TEST"); ok(rootFolder.id, "root folder id is ok"); - let items = [ - {"id":"G_UL4ZhOyX8m", "type":rootFolder.BOOKMARK, "title":"reddit: the front page of the internet 1", "uri":"http://www.reddit.com", index:2}, - {"id":"G_UL4ZhOyX8n", "type":rootFolder.BOOKMARK, parent:"G_UL4ZhOyX8x", "title":"reddit: the front page of the internet 2", "uri":"http://www.reddit.com/?a=å%20ä%20ö", index:1}, - {"id":"G_UL4ZhOyX8x", "type":rootFolder.FOLDER}, - ]; + let items = [{ + "id": "G_UL4ZhOyX8m", + "type": rootFolder.BOOKMARK, + "title": "reddit: the front page of the internet 1", + "uri": "http://www.reddit.com", + index: 2 + }, { + "id": "G_UL4ZhOyX8n", + "type": rootFolder.BOOKMARK, + parent: "G_UL4ZhOyX8x", + "title": "reddit: the front page of the internet 2", + "uri": "http://www.reddit.com/?a=å%20ä%20ö", + index: 1 + }, { + "id": "G_UL4ZhOyX8x", + "type": rootFolder.FOLDER + }]; yield rootFolder.mergeRemoteItems(items); let localItems = yield rootFolder.getLocalItems(); diff --git a/services/cloudsync/tests/xpcshell/test_tabs.js b/services/cloudsync/tests/xpcshell/test_tabs.js index aa78d3cf3da7..dbc7ff6bba64 100644 --- a/services/cloudsync/tests/xpcshell/test_tabs.js +++ b/services/cloudsync/tests/xpcshell/test_tabs.js @@ -17,10 +17,17 @@ add_task(function* test_get_remote_tabs() { yield cloudSync.tabs.mergeRemoteTabs({ id: "001", name: "FakeClient", - }, [ - {url:"https://www.google.ca?a=å%20ä%20ö", title:"Google Canada", icon:"https://www.google.ca/favicon.ico", lastUsed:0}, - {url:"http://www.reddit.com", title:"Reddit", icon:"http://www.reddit.com/favicon.ico", lastUsed:1}, - ]); + }, [{ + url: "https://www.google.ca?a=å%20ä%20ö", + title: "Google Canada", + icon: "https://www.google.ca/favicon.ico", + lastUsed: 0 + }, { + url: "http://www.reddit.com", + title: "Reddit", + icon: "http://www.reddit.com/favicon.ico", + lastUsed: 1 + }]); ok(cloudSync.tabs.hasRemoteTabs()); clients = yield cloudSync.tabs.getRemoteTabs(); diff --git a/services/common/tests/unit/test_blocklist_certificates.js b/services/common/tests/unit/test_blocklist_certificates.js index 392bc1b59ece..acefc4515de9 100644 --- a/services/common/tests/unit/test_blocklist_certificates.js +++ b/services/common/tests/unit/test_blocklist_certificates.js @@ -169,7 +169,16 @@ function getSampleResponse(req, port) { "Server: waitress" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"}) + "responseBody": JSON.stringify({ + "settings": { + "batch_max_requests": 25 + }, + "url": `http://localhost:${port}/v1/`, + "documentation": "https://kinto.readthedocs.org/", + "version": "1.5.1", + "commit": "cbc6f58", + "hello": "kinto" + }) }, "GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified": { "sampleHeaders": [ @@ -180,7 +189,7 @@ function getSampleResponse(req, port) { "Etag: \"1000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{}]}) + "responseBody": JSON.stringify({"data": [{}]}) }, "GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=1000": { "sampleHeaders": [ @@ -191,11 +200,11 @@ function getSampleResponse(req, port) { "Etag: \"3000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "issuerName": "MEQxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwx0aGF3dGUsIEluYy4xHjAcBgNVBAMTFXRoYXd0ZSBFViBTU0wgQ0EgLSBHMw==", - "serialNumber":"CrTHPEE6AZSfI3jysin2bA==", - "id":"78cf8900-fdea-4ce5-f8fb-b78710617718", - "last_modified":3000 + "serialNumber": "CrTHPEE6AZSfI3jysin2bA==", + "id": "78cf8900-fdea-4ce5-f8fb-b78710617718", + "last_modified": 3000 }]}) }, "GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=3000": { @@ -207,16 +216,16 @@ function getSampleResponse(req, port) { "Etag: \"4000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ - "issuerName":"MFkxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKjAoBgNVBAMTIVN0YWF0IGRlciBOZWRlcmxhbmRlbiBPdmVyaGVpZCBDQQ", - "serialNumber":"ATFpsA==", - "id":"dabafde9-df4a-ddba-2548-748da04cc02c", - "last_modified":4000 + "responseBody": JSON.stringify({"data": [{ + "issuerName": "MFkxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKjAoBgNVBAMTIVN0YWF0IGRlciBOZWRlcmxhbmRlbiBPdmVyaGVpZCBDQQ", + "serialNumber": "ATFpsA==", + "id": "dabafde9-df4a-ddba-2548-748da04cc02c", + "last_modified": 4000 }, { - "subject":"MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5", - "pubKeyHash":"VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=", - "id":"dabafde9-df4a-ddba-2548-748da04cc02d", - "last_modified":4000 + "subject": "MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5", + "pubKeyHash": "VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=", + "id": "dabafde9-df4a-ddba-2548-748da04cc02d", + "last_modified": 4000 }]}) }, "GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified&_since=4000": { @@ -228,21 +237,21 @@ function getSampleResponse(req, port) { "Etag: \"5000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ - "issuerName":"not a base64 encoded issuer", - "serialNumber":"not a base64 encoded serial", - "id":"dabafde9-df4a-ddba-2548-748da04cc02e", - "last_modified":5000 + "responseBody": JSON.stringify({"data": [{ + "issuerName": "not a base64 encoded issuer", + "serialNumber": "not a base64 encoded serial", + "id": "dabafde9-df4a-ddba-2548-748da04cc02e", + "last_modified": 5000 }, { - "subject":"not a base64 encoded subject", - "pubKeyHash":"not a base64 encoded pubKeyHash", - "id":"dabafde9-df4a-ddba-2548-748da04cc02f", - "last_modified":5000 + "subject": "not a base64 encoded subject", + "pubKeyHash": "not a base64 encoded pubKeyHash", + "id": "dabafde9-df4a-ddba-2548-748da04cc02f", + "last_modified": 5000 }, { - "subject":"MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5", - "pubKeyHash":"VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=", - "id":"dabafde9-df4a-ddba-2548-748da04cc02g", - "last_modified":5000 + "subject": "MCIxIDAeBgNVBAMMF0Fub3RoZXIgVGVzdCBFbmQtZW50aXR5", + "pubKeyHash": "VCIlmPM9NkgFQtrs4Oa5TeFcDu6MWRTKSNdePEhOgD8=", + "id": "dabafde9-df4a-ddba-2548-748da04cc02g", + "last_modified": 5000 }]}) } }; diff --git a/services/common/tests/unit/test_blocklist_clients.js b/services/common/tests/unit/test_blocklist_clients.js index 9fa1f0427c34..b9f02949bb94 100644 --- a/services/common/tests/unit/test_blocklist_clients.js +++ b/services/common/tests/unit/test_blocklist_clients.js @@ -231,7 +231,16 @@ function getSampleResponse(req, port) { "Server: waitress" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"}) + "responseBody": JSON.stringify({ + "settings": { + "batch_max_requests": 25 + }, + "url": `http://localhost:${port}/v1/`, + "documentation": "https://kinto.readthedocs.org/", + "version": "1.5.1", + "commit": "cbc6f58", + "hello": "kinto" + }) }, "GET:/v1/buckets/blocklists/collections/addons/records?_sort=-last_modified": { "sampleHeaders": [ @@ -242,7 +251,7 @@ function getSampleResponse(req, port) { "Etag: \"3000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "prefs": [], "blockID": "i539", "last_modified": 3000, @@ -265,7 +274,7 @@ function getSampleResponse(req, port) { "Etag: \"3000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "matchFilename": "NPFFAddOn.dll", "blockID": "p28", "id": "7b1e0b3c-e390-a817-11b6-a6887f65f56e", @@ -282,7 +291,7 @@ function getSampleResponse(req, port) { "Etag: \"3000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "driverVersionComparator": "LESS_THAN_OR_EQUAL", "driverVersion": "8.17.12.5896", "vendor": "0x10de", @@ -304,7 +313,7 @@ function getSampleResponse(req, port) { "Etag: \"4000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "prefs": [], "blockID": "i808", "last_modified": 4000, @@ -339,7 +348,7 @@ function getSampleResponse(req, port) { "Etag: \"4000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "infoURL": "https://get.adobe.com/flashplayer/", "blockID": "p1044", "matchFilename": "libflashplayer\\.so", @@ -376,7 +385,7 @@ function getSampleResponse(req, port) { "Etag: \"4000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "vendor": "0x8086", "blockID": "g204", "feature": "WEBGL_MSAA", diff --git a/services/common/tests/unit/test_blocklist_pinning.js b/services/common/tests/unit/test_blocklist_pinning.js index 214bf2d484cb..071a926d989e 100644 --- a/services/common/tests/unit/test_blocklist_pinning.js +++ b/services/common/tests/unit/test_blocklist_pinning.js @@ -218,7 +218,16 @@ function getSampleResponse(req, port) { "Server: waitress" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"}) + "responseBody": JSON.stringify({ + "settings": { + "batch_max_requests": 25 + }, + "url": `http://localhost:${port}/v1/`, + "documentation": "https://kinto.readthedocs.org/", + "version": "1.5.1", + "commit": "cbc6f58", + "hello": "kinto" + }) }, "GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified": { "sampleHeaders": [ @@ -229,16 +238,16 @@ function getSampleResponse(req, port) { "Etag: \"3000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "pinType": "KeyPin", "hostName": "one.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", + "pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", "M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="], - "versions" : [appInfo.version], - "id":"78cf8900-fdea-4ce5-f8fb-b78710617718", - "last_modified":3000 + "versions": [appInfo.version], + "id": "78cf8900-fdea-4ce5-f8fb-b78710617718", + "last_modified": 3000 }]}) }, "GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified&_since=3000": { @@ -250,44 +259,44 @@ function getSampleResponse(req, port) { "Etag: \"4000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ + "responseBody": JSON.stringify({"data": [{ "pinType": "KeyPin", "hostName": "two.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", + "pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", "M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="], - "versions" : [appInfo.version], - "id":"dabafde9-df4a-ddba-2548-748da04cc02c", - "last_modified":4000 + "versions": [appInfo.version], + "id": "dabafde9-df4a-ddba-2548-748da04cc02c", + "last_modified": 4000 }, { "pinType": "KeyPin", "hostName": "three.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", + "pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", "M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="], - "versions" : [appInfo.version, "some other version that won't match"], - "id":"dabafde9-df4a-ddba-2548-748da04cc02d", - "last_modified":4000 + "versions": [appInfo.version, "some other version that won't match"], + "id": "dabafde9-df4a-ddba-2548-748da04cc02d", + "last_modified": 4000 }, { "pinType": "KeyPin", "hostName": "four.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "pins" : ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", + "pins": ["cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=", "M8HztCzM3elUxkcjR2S5P4hhyBNf6lHkmjAHKhpGPWE="], - "versions" : ["some version that won't match"], - "id":"dabafde9-df4a-ddba-2548-748da04cc02e", - "last_modified":4000 + "versions": ["some version that won't match"], + "id": "dabafde9-df4a-ddba-2548-748da04cc02e", + "last_modified": 4000 }, { "pinType": "STSPin", "hostName": "five.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "versions" : [appInfo.version, "some version that won't match"], - "id":"dabafde9-df4a-ddba-2548-748da04cc032", - "last_modified":4000 + "versions": [appInfo.version, "some version that won't match"], + "id": "dabafde9-df4a-ddba-2548-748da04cc032", + "last_modified": 4000 }]}) }, "GET:/v1/buckets/pinning/collections/pins/records?_sort=-last_modified&_since=4000": { @@ -299,37 +308,37 @@ function getSampleResponse(req, port) { "Etag: \"5000\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{ - "irrelevant":"this entry looks nothing whatsoever like a pin preload", + "responseBody": JSON.stringify({"data": [{ + "irrelevant": "this entry looks nothing whatsoever like a pin preload", "pinType": "KeyPin", - "id":"dabafde9-df4a-ddba-2548-748da04cc02f", - "last_modified":5000 + "id": "dabafde9-df4a-ddba-2548-748da04cc02f", + "last_modified": 5000 }, { - "irrelevant":"this entry has data of the wrong type", + "irrelevant": "this entry has data of the wrong type", "pinType": "KeyPin", "hostName": 3, "includeSubdomains": "nonsense", "expires": "more nonsense", - "pins" : [1, 2, 3, 4], - "id":"dabafde9-df4a-ddba-2548-748da04cc030", - "last_modified":5000 + "pins": [1, 2, 3, 4], + "id": "dabafde9-df4a-ddba-2548-748da04cc030", + "last_modified": 5000 }, { - "irrelevant":"this entry is missing the actual pins", + "irrelevant": "this entry is missing the actual pins", "pinType": "KeyPin", "hostName": "missingpins.example.com", "includeSubdomains": false, "expires": new Date().getTime() + 1000000, - "versions" : [appInfo.version], - "id":"dabafde9-df4a-ddba-2548-748da04cc031", - "last_modified":5000 + "versions": [appInfo.version], + "id": "dabafde9-df4a-ddba-2548-748da04cc031", + "last_modified": 5000 }, { "pinType": "STSPin", "hostName": "five.example.com", "includeSubdomains": true, "expires": new Date().getTime() + 1000000, - "versions" : [appInfo.version, "some version that won't match"], - "id":"dabafde9-df4a-ddba-2548-748da04cc032", - "last_modified":5000 + "versions": [appInfo.version, "some version that won't match"], + "id": "dabafde9-df4a-ddba-2548-748da04cc032", + "last_modified": 5000 }]}) } }; diff --git a/services/common/tests/unit/test_blocklist_signatures.js b/services/common/tests/unit/test_blocklist_signatures.js index f84f18bf299e..43528b8c5242 100644 --- a/services/common/tests/unit/test_blocklist_signatures.js +++ b/services/common/tests/unit/test_blocklist_signatures.js @@ -255,7 +255,16 @@ add_task(function* test_check_signatures() { "Server: waitress" ], status: {status: 200, statusText: "OK"}, - responseBody: JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"}) + responseBody: JSON.stringify({ + "settings": { + "batch_max_requests": 25 + }, + "url": `http://localhost:${port}/v1/`, + "documentation": "https://kinto.readthedocs.org/", + "version": "1.5.1", + "commit": "cbc6f58", + "hello": "kinto" + }) }; // This is the initial, empty state of the collection. This is only used @@ -281,7 +290,7 @@ add_task(function* test_check_signatures() { // Here, we map request method and path to the available responses const emptyCollectionResponses = { - "GET:/test_blocklist_signatures/test_cert_chain.pem?":[RESPONSE_CERT_CHAIN], + "GET:/test_blocklist_signatures/test_cert_chain.pem?": [RESPONSE_CERT_CHAIN], "GET:/v1/?": [RESPONSE_SERVER_SETTINGS], "GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified": [RESPONSE_EMPTY_INITIAL], diff --git a/services/common/tests/unit/test_kinto.js b/services/common/tests/unit/test_kinto.js index 0847e6680a77..a1e9efeb8d74 100644 --- a/services/common/tests/unit/test_kinto.js +++ b/services/common/tests/unit/test_kinto.js @@ -19,7 +19,7 @@ function do_get_kinto_sqliteHandle() { function do_get_kinto_collection(sqliteHandle, collection = "test_collection") { let config = { - remote:`http://localhost:${server.identity.primaryPort}/v1/`, + remote: `http://localhost:${server.identity.primaryPort}/v1/`, headers: {Authorization: "Basic " + btoa("user:pass")}, adapter: FirefoxAdapter, adapterOptions: {sqliteHandle}, @@ -378,7 +378,16 @@ function getSampleResponse(req, port) { "Server: waitress" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"}) + "responseBody": JSON.stringify({ + "settings": { + "batch_max_requests": 25 + }, + "url": `http://localhost:${port}/v1/`, + "documentation": "https://kinto.readthedocs.org/", + "version": "1.5.1", + "commit": "cbc6f58", + "hello": "kinto" + }) }, "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified": { "sampleHeaders": [ @@ -389,7 +398,14 @@ function getSampleResponse(req, port) { "Etag: \"1445606341071\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{"last_modified":1445606341071, "done":false, "id":"68db8313-686e-4fff-835e-07d78ad6f2af", "title":"New test"}]}) + "responseBody": JSON.stringify({ + "data": [{ + "last_modified": 1445606341071, + "done": false, + "id": "68db8313-686e-4fff-835e-07d78ad6f2af", + "title": "New test" + }] + }) }, "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445606341071": { "sampleHeaders": [ @@ -400,7 +416,14 @@ function getSampleResponse(req, port) { "Etag: \"1445607941223\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{"last_modified":1445607941223, "done":false, "id":"901967b0-f729-4b30-8d8d-499cba7f4b1d", "title":"Another new test"}]}) + "responseBody": JSON.stringify({ + "data": [{ + "last_modified": 1445607941223, + "done": false, + "id": "901967b0-f729-4b30-8d8d-499cba7f4b1d", + "title": "Another new test" + }] + }) }, "GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified&_since=1445607941223": { "sampleHeaders": [ @@ -411,7 +434,14 @@ function getSampleResponse(req, port) { "Etag: \"1445607541265\"" ], "status": {status: 200, statusText: "OK"}, - "responseBody": JSON.stringify({"data":[{"last_modified":1445607541265, "done":false, "id":"901967b0-f729-4b30-8d8d-499cba7f4b1d", "title":"Modified title"}]}) + "responseBody": JSON.stringify({ + "data": [{ + "last_modified": 1445607541265, + "done": false, + "id": "901967b0-f729-4b30-8d8d-499cba7f4b1d", + "title": "Modified title" + }] + }) } }; return responses[`${req.method}:${req.path}?${req.queryString}`] || diff --git a/services/common/tests/unit/test_storage_adapter.js b/services/common/tests/unit/test_storage_adapter.js index 7691e5dc4662..c3c7a5a44024 100644 --- a/services/common/tests/unit/test_storage_adapter.js +++ b/services/common/tests/unit/test_storage_adapter.js @@ -43,7 +43,7 @@ function test_collection_operations() { add_task(function* test_kinto_create_new_get_existing() { let sqliteHandle = yield do_get_kinto_connection(); let adapter = do_get_kinto_adapter(sqliteHandle); - let record = {id:"test-id", foo:"bar"}; + let record = {id: "test-id", foo: "bar"}; yield adapter.execute((transaction) => transaction.create(record)); let newRecord = yield adapter.get("test-id"); // ensure the record is the same as when it was added @@ -56,7 +56,7 @@ function test_collection_operations() { let sqliteHandle = yield do_get_kinto_connection(); let adapter = do_get_kinto_adapter(sqliteHandle); // create a second record - let record = {id:"test-id-2", foo:"baz"}; + let record = {id: "test-id-2", foo: "baz"}; yield adapter.execute((transaction) => transaction.create(record)); let newRecord = yield adapter.get("test-id-2"); deepEqual(record, newRecord); @@ -86,8 +86,8 @@ function test_collection_operations() { add_task(function* test_kinto_update_get_existing() { let sqliteHandle = yield do_get_kinto_connection(); let adapter = do_get_kinto_adapter(sqliteHandle); - let originalRecord = {id:"test-id", foo:"bar"}; - let updatedRecord = {id:"test-id", foo:"baz"}; + let originalRecord = {id: "test-id", foo: "bar"}; + let updatedRecord = {id: "test-id", foo: "baz"}; yield adapter.clear(); yield adapter.execute((transaction) => transaction.create(originalRecord)); yield adapter.execute((transaction) => transaction.update(updatedRecord)); @@ -102,7 +102,7 @@ function test_collection_operations() { add_task(function* test_kinto_list() { let sqliteHandle = yield do_get_kinto_connection(); let adapter = do_get_kinto_adapter(sqliteHandle); - let originalRecord = {id:"test-id-1", foo:"bar"}; + let originalRecord = {id: "test-id-1", foo: "bar"}; let records = yield adapter.list(); do_check_eq(records.length, 1); yield adapter.execute((transaction) => transaction.create(originalRecord)); diff --git a/services/crypto/modules/WeaveCrypto.js b/services/crypto/modules/WeaveCrypto.js index 12905497e31b..03f4d6cddef9 100644 --- a/services/crypto/modules/WeaveCrypto.js +++ b/services/crypto/modules/WeaveCrypto.js @@ -28,14 +28,14 @@ this.WeaveCrypto = function WeaveCrypto() { }; WeaveCrypto.prototype = { - prefBranch : null, - debug : true, // services.sync.log.cryptoDebug + prefBranch: null, + debug: true, // services.sync.log.cryptoDebug - observer : { - _self : null, + observer: { + _self: null, - QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver, - Ci.nsISupportsWeakReference]), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), observe(subject, topic, data) { let self = this._self; diff --git a/services/crypto/modules/utils.js b/services/crypto/modules/utils.js index 3547d110c86d..f14f0f33d125 100644 --- a/services/crypto/modules/utils.js +++ b/services/crypto/modules/utils.js @@ -182,7 +182,7 @@ this.CryptoUtils = { * The output is an octet string of length dkLen, which you * can encode as you wish. */ - pbkdf2Generate : function pbkdf2Generate(P, S, c, dkLen, + pbkdf2Generate: function pbkdf2Generate(P, S, c, dkLen, hmacAlg = Ci.nsICryptoHMAC.SHA1, hmacLen = 20) { // We don't have a default in the algo itself, as NSS does. diff --git a/services/sync/modules/engines/clients.js b/services/sync/modules/engines/clients.js index 4b2d1981759c..8a661917a0fe 100644 --- a/services/sync/modules/engines/clients.js +++ b/services/sync/modules/engines/clients.js @@ -296,7 +296,7 @@ ClientEngine.prototype = { // We assume that clients not present in the FxA Device Manager list have been // disconnected and so are stale _refreshKnownStaleClients() { - this._log.debug('Refreshing the known stale clients list'); + this._log.debug("Refreshing the known stale clients list"); let localClients = Object.values(this._store._remoteClients) .filter(client => client.fxaDeviceId) // iOS client records don't have fxaDeviceId .map(client => client.fxaDeviceId); @@ -304,7 +304,7 @@ ClientEngine.prototype = { try { fxaClients = Async.promiseSpinningly(this.fxAccounts.getDeviceList()).map(device => device.id); } catch (ex) { - this._log.error('Could not retrieve the FxA device list', ex); + this._log.error("Could not retrieve the FxA device list", ex); this._knownStaleFxADeviceIds = []; return; } diff --git a/services/sync/modules/util.js b/services/sync/modules/util.js index 26910b94c8e3..8675baa2a241 100644 --- a/services/sync/modules/util.js +++ b/services/sync/modules/util.js @@ -302,7 +302,7 @@ this.Utils = { * N.B., salt should be base64 encoded, even though we have to decode * it later! */ - derivePresentableKeyFromPassphrase : function derivePresentableKeyFromPassphrase(passphrase, salt, keyLength, forceJS) { + derivePresentableKeyFromPassphrase: function derivePresentableKeyFromPassphrase(passphrase, salt, keyLength, forceJS) { let k = CryptoUtils.deriveKeyFromPassphrase(passphrase, salt, keyLength, forceJS); return Utils.encodeKeyBase32(k); @@ -312,7 +312,7 @@ this.Utils = { * N.B., salt should be base64 encoded, even though we have to decode * it later! */ - deriveEncodedKeyFromPassphrase : function deriveEncodedKeyFromPassphrase(passphrase, salt, keyLength, forceJS) { + deriveEncodedKeyFromPassphrase: function deriveEncodedKeyFromPassphrase(passphrase, salt, keyLength, forceJS) { let k = CryptoUtils.deriveKeyFromPassphrase(passphrase, salt, keyLength, forceJS); return Utils.base64Key(k); @@ -323,7 +323,7 @@ this.Utils = { * uppercase alphanumeric characters, separated by hyphens. * A.K.A. base64-to-base32 encoding. */ - presentEncodedKeyAsSyncKey : function presentEncodedKeyAsSyncKey(encodedKey) { + presentEncodedKeyAsSyncKey: function presentEncodedKeyAsSyncKey(encodedKey) { return Utils.encodeKeyBase32(atob(encodedKey)); }, @@ -461,13 +461,13 @@ this.Utils = { try { if (args) { return Str.errors.formatStringFromName(error, args, args.length); - } else { - return Str.errors.GetStringFromName(error); } + return Str.errors.GetStringFromName(error); + } catch (e) {} // basically returns "Unknown Error" - return Str.errors.GetStringFromName('error.reason.unknown'); + return Str.errors.GetStringFromName("error.reason.unknown"); }, /** diff --git a/services/sync/tests/tps/test_existing_bookmarks.js b/services/sync/tests/tps/test_existing_bookmarks.js index 937acd3def77..efc3195d6e92 100644 --- a/services/sync/tests/tps/test_existing_bookmarks.js +++ b/services/sync/tests/tps/test_existing_bookmarks.js @@ -58,26 +58,26 @@ var bookmarks_after = { * Test phases */ -Phase('phase1', [ +Phase("phase1", [ [Bookmarks.add, bookmarks_initial], [Bookmarks.verify, bookmarks_initial], [Sync] ]); -Phase('phase2', [ +Phase("phase2", [ [Bookmarks.add, bookmarks_initial], [Bookmarks.verify, bookmarks_initial], [Sync] ]); -Phase('phase3', [ +Phase("phase3", [ [Bookmarks.verify, bookmarks_initial], [Bookmarks.modify, bookmarks_initial], [Bookmarks.verify, bookmarks_after], [Sync] ]); -Phase('phase4', [ +Phase("phase4", [ [Sync], [Bookmarks.verify, bookmarks_after] ]); diff --git a/services/sync/tests/unit/test_bookmark_engine.js b/services/sync/tests/unit/test_bookmark_engine.js index 49aabd28b4a1..cf09751f52bd 100644 --- a/services/sync/tests/unit/test_bookmark_engine.js +++ b/services/sync/tests/unit/test_bookmark_engine.js @@ -513,22 +513,22 @@ add_task(async function test_mismatched_types() { let oldRecord = { "id": "l1nZZXfB8nC7", - "type":"folder", - "parentName":"Bookmarks Toolbar", - "title":"Innerst i Sneglehode", - "description":null, + "type": "folder", + "parentName": "Bookmarks Toolbar", + "title": "Innerst i Sneglehode", + "description": null, "parentid": "toolbar" }; oldRecord.cleartext = oldRecord; let newRecord = { "id": "l1nZZXfB8nC7", - "type":"livemark", - "siteUri":"http://sneglehode.wordpress.com/", - "feedUri":"http://sneglehode.wordpress.com/feed/", - "parentName":"Bookmarks Toolbar", - "title":"Innerst i Sneglehode", - "description":null, + "type": "livemark", + "siteUri": "http://sneglehode.wordpress.com/", + "feedUri": "http://sneglehode.wordpress.com/feed/", + "parentName": "Bookmarks Toolbar", + "title": "Innerst i Sneglehode", + "description": null, "children": ["HCRq40Rnxhrd", "YeyWCV1RVsYw", "GCceVZMhvMbP", "sYi2hevdArlF", "vjbZlPlSyGY8", "UtjUhVyrpeG6", "rVq8WMG2wfZI", "Lx0tcy43ZKhZ", diff --git a/services/sync/tests/unit/test_bookmark_livemarks.js b/services/sync/tests/unit/test_bookmark_livemarks.js index caddef4b7fcc..3ccdbbaab78a 100644 --- a/services/sync/tests/unit/test_bookmark_livemarks.js +++ b/services/sync/tests/unit/test_bookmark_livemarks.js @@ -21,14 +21,14 @@ var record631361 = { index: 150, modified: 1296768176.49, payload: - {"id":"M5bwUKK8hPyF", - "type":"livemark", - "siteUri":"http://www.bbc.co.uk/go/rss/int/news/-/news/", - "feedUri":"http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml", - "parentName":"Bookmarks Toolbar", - "parentid":"toolbar", - "title":"Latest Headlines", - "description":"", + {"id": "M5bwUKK8hPyF", + "type": "livemark", + "siteUri": "http://www.bbc.co.uk/go/rss/int/news/-/news/", + "feedUri": "http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml", + "parentName": "Bookmarks Toolbar", + "parentid": "toolbar", + "title": "Latest Headlines", + "description": "", "children": ["7oBdEZB-8BMO", "SUd1wktMNCTB", "eZe4QWzo1BcY", "YNBhGwhVnQsN", "92Aw2SMEkFg0", "uw0uKqrVFwd-", "x7mx2P3--8FJ", "d-jVF8UuC9Ye", diff --git a/services/sync/tests/unit/test_bookmark_repair.js b/services/sync/tests/unit/test_bookmark_repair.js index 089a1b04bdd3..0b7b58df4e33 100644 --- a/services/sync/tests/unit/test_bookmark_repair.js +++ b/services/sync/tests/unit/test_bookmark_repair.js @@ -74,7 +74,7 @@ async function promiseValidationDone(expected) { actual.sort((a, b) => String(a.name).localeCompare(b.name)); expected.sort((a, b) => String(a.name).localeCompare(b.name)); deepEqual(actual, expected); -}; +} async function cleanup(server) { bookmarksEngine._store.wipe(); @@ -166,8 +166,8 @@ add_task(async function test_bookmark_repair_integration() { // sync again - we should have a few problems... _("Sync again to trigger repair"); validationPromise = promiseValidationDone([ - {"name":"missingChildren","count":1}, - {"name":"structuralDifferences","count":1}, + {"name": "missingChildren", "count": 1}, + {"name": "structuralDifferences", "count": 1}, ]); Service.sync(); await validationPromise; @@ -396,8 +396,8 @@ add_task(async function test_repair_client_missing() { // sync again - we should have a few problems... _("Syncing again."); validationPromise = promiseValidationDone([ - {"name":"clientMissing","count":1}, - {"name":"structuralDifferences","count":1}, + {"name": "clientMissing", "count": 1}, + {"name": "structuralDifferences", "count": 1}, ]); Service.sync(); await validationPromise; @@ -480,8 +480,8 @@ add_task(async function test_repair_server_missing() { // sync again - we should have a few problems... _("Syncing again."); validationPromise = promiseValidationDone([ - {"name":"serverMissing","count":1}, - {"name":"missingChildren","count":1}, + {"name": "serverMissing", "count": 1}, + {"name": "missingChildren", "count": 1}, ]); Service.sync(); await validationPromise; @@ -567,9 +567,9 @@ add_task(async function test_repair_server_deleted() { // sync again - we should have a few problems... _("Syncing again."); validationPromise = promiseValidationDone([ - {"name":"serverDeleted","count":1}, - {"name":"deletedChildren","count":1}, - {"name":"orphans","count":1} + {"name": "serverDeleted", "count": 1}, + {"name": "deletedChildren", "count": 1}, + {"name": "orphans", "count": 1} ]); Service.sync(); await validationPromise; diff --git a/services/sync/tests/unit/test_bookmark_repair_requestor.js b/services/sync/tests/unit/test_bookmark_repair_requestor.js index a840ccfa1cb8..8c2a19513407 100644 --- a/services/sync/tests/unit/test_bookmark_repair_requestor.js +++ b/services/sync/tests/unit/test_bookmark_repair_requestor.js @@ -496,17 +496,17 @@ add_task(async function test_requestor_already_repairing_continue() { { method: "started", object: "repair", value: undefined, - extra: { flowID: flowID, numIDs: "3" }, + extra: { flowID, numIDs: "3" }, }, { method: "request", object: "repair", value: "upload", - extra: { flowID: flowID, numIDs: "3", deviceID: "client-a" }, + extra: { flowID, numIDs: "3", deviceID: "client-a" }, }, { method: "aborted", object: "repair", value: undefined, - extra: { flowID: flowID, numIDs: "3", reason: "other clients repairing" }, + extra: { flowID, numIDs: "3", reason: "other clients repairing" }, } ]; diff --git a/services/sync/tests/unit/test_errorhandler_2.js b/services/sync/tests/unit/test_errorhandler_2.js index 3b48b6a227c3..f26f2a1f8124 100644 --- a/services/sync/tests/unit/test_errorhandler_2.js +++ b/services/sync/tests/unit/test_errorhandler_2.js @@ -947,7 +947,7 @@ add_task(async function test_engine_applyFailed() { engine.enabled = true; delete engine.exception; engine.sync = function sync() { - Svc.Obs.notify("weave:engine:sync:applied", {newFailed:1}, "catapult"); + Svc.Obs.notify("weave:engine:sync:applied", {newFailed: 1}, "catapult"); }; Svc.Prefs.set("log.appender.file.logOnError", true); diff --git a/services/sync/tps/extensions/tps/components/tps-cmdline.js b/services/sync/tps/extensions/tps/components/tps-cmdline.js index 45038421d4cc..8d0f1c84a4f2 100644 --- a/services/sync/tps/extensions/tps/components/tps-cmdline.js +++ b/services/sync/tps/extensions/tps/components/tps-cmdline.js @@ -25,23 +25,23 @@ function TPSCmdLineHandler() {} TPSCmdLineHandler.prototype = { classDescription: "TPSCmdLineHandler", - classID : TPS_CMDLINE_CLSID, - contractID : TPS_CMDLINE_CONTRACTID, + classID: TPS_CMDLINE_CLSID, + contractID: TPS_CMDLINE_CONTRACTID, QueryInterface: XPCOMUtils.generateQI([nsISupports, nsICommandLineHandler, nsICmdLineHandler]), /* nsISupports */ /* nsICmdLineHandler */ - commandLineArgument : "-tps", - prefNameForStartup : "general.startup.tps", - helpText : "Run TPS tests with the given test file.", - handlesArgs : true, - defaultArgs : "", - openWindowWithArgs : true, + commandLineArgument: "-tps", + prefNameForStartup: "general.startup.tps", + helpText: "Run TPS tests with the given test file.", + handlesArgs: true, + defaultArgs: "", + openWindowWithArgs: true, /* nsICommandLineHandler */ - handle : function handler_handle(cmdLine) { + handle: function handler_handle(cmdLine) { let options = {}; let uristr = cmdLine.handleFlagWithParam("tps", false); @@ -72,10 +72,10 @@ TPSCmdLineHandler.prototype = { // cmdLine.preventDefault = true; }, - helpInfo : " --tps Run TPS tests with the given test file.\n" + - " --tpsphase Run the specified phase in the TPS test.\n" + - " --tpslogfile Logfile for TPS output.\n" + - " --ignore-unused-engines Don't load engines not used in tests.\n", + helpInfo: " --tps Run TPS tests with the given test file.\n" + + " --tpsphase Run the specified phase in the TPS test.\n" + + " --tpslogfile Logfile for TPS output.\n" + + " --ignore-unused-engines Don't load engines not used in tests.\n", }; diff --git a/servo/Cargo.lock b/servo/Cargo.lock index bb1d7f6d4f26..2d7a8d0b493c 100644 --- a/servo/Cargo.lock +++ b/servo/Cargo.lock @@ -281,7 +281,7 @@ version = "0.0.1" dependencies = [ "azure 0.15.0 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -296,7 +296,7 @@ dependencies = [ name = "canvas_traits" version = "0.0.1" dependencies = [ - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -511,10 +511,10 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.12.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -526,7 +526,7 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -937,7 +937,7 @@ name = "geckoservo" version = "0.0.1" dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1359,7 +1359,7 @@ dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", @@ -1666,7 +1666,7 @@ name = "msg" version = "0.0.1" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2244,7 +2244,7 @@ dependencies = [ "caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "deny_public_fields 0.0.1", "devtools_traits 0.0.1", "dom_struct 0.0.1", @@ -2314,7 +2314,7 @@ dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2385,7 +2385,7 @@ name = "selectors" version = "0.18.0" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2735,7 +2735,7 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2774,7 +2774,7 @@ name = "style_tests" version = "0.0.1" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever-atoms 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2793,7 +2793,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2806,7 +2806,7 @@ name = "stylo_tests" version = "0.0.1" dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "geckoservo 0.0.1", @@ -3359,8 +3359,8 @@ dependencies = [ "checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624" "checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f" "checksum core-text 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9719616a10f717628e074744f8c55df7b450f7a34d29c196d14f4498aad05d" -"checksum cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35e3e110221f306501253d8d34857040de365ce2d92ac0abb2f06dedc845d9d0" -"checksum cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f0415de0bdbce823c0db204e00a62c8240fa2d3e04cd13ff7c6396e4446b95" +"checksum cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b39404c5e04492194e3c69f1a10964b980f2c95c884a940f7903446779f6b027" +"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df" "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" "checksum dbus 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47f881971824401c27bc1ff9f641d54ac66e0f409631806fa7be8cad8e6be450" "checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" diff --git a/servo/components/canvas/Cargo.toml b/servo/components/canvas/Cargo.toml index aef66941282c..e24510fec729 100644 --- a/servo/components/canvas/Cargo.toml +++ b/servo/components/canvas/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] azure = {git = "https://github.com/servo/rust-azure"} canvas_traits = {path = "../canvas_traits"} -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" gleam = "0.4" ipc-channel = "0.7" diff --git a/servo/components/canvas_traits/Cargo.toml b/servo/components/canvas_traits/Cargo.toml index 83c7f0a1f5c1..512e3366e89d 100644 --- a/servo/components/canvas_traits/Cargo.toml +++ b/servo/components/canvas_traits/Cargo.toml @@ -10,7 +10,7 @@ name = "canvas_traits" path = "lib.rs" [dependencies] -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" heapsize = "0.3.0" heapsize_derive = "0.1" diff --git a/servo/components/layout/Cargo.toml b/servo/components/layout/Cargo.toml index 68e5462cbc70..cdeb2f09103e 100644 --- a/servo/components/layout/Cargo.toml +++ b/servo/components/layout/Cargo.toml @@ -14,7 +14,7 @@ app_units = "0.4" atomic_refcell = "0.1" bitflags = "0.7" canvas_traits = {path = "../canvas_traits"} -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" fnv = "1.0" gfx = {path = "../gfx"} diff --git a/servo/components/msg/Cargo.toml b/servo/components/msg/Cargo.toml index 3e873e4d3ad0..836190b1ef68 100644 --- a/servo/components/msg/Cargo.toml +++ b/servo/components/msg/Cargo.toml @@ -11,7 +11,7 @@ path = "lib.rs" [dependencies] bitflags = "0.7" -cssparser = "0.12.1" +cssparser = "0.13" heapsize = "0.3.0" heapsize_derive = "0.1" serde = "0.9" diff --git a/servo/components/script/Cargo.toml b/servo/components/script/Cargo.toml index 37d5d7d6224b..f145e8f65b0e 100644 --- a/servo/components/script/Cargo.toml +++ b/servo/components/script/Cargo.toml @@ -35,7 +35,7 @@ byteorder = "1.0" canvas_traits = {path = "../canvas_traits"} caseless = "0.1.0" cookie = "0.6" -cssparser = "0.12.1" +cssparser = "0.13" deny_public_fields = {path = "../deny_public_fields"} devtools_traits = {path = "../devtools_traits"} dom_struct = {path = "../dom_struct"} diff --git a/servo/components/script/dom/bindings/codegen/CodegenRust.py b/servo/components/script/dom/bindings/codegen/CodegenRust.py index a54ea0c3c979..e7a0541c4dac 100644 --- a/servo/components/script/dom/bindings/codegen/CodegenRust.py +++ b/servo/components/script/dom/bindings/codegen/CodegenRust.py @@ -1850,6 +1850,7 @@ class CGImports(CGWrapper): 'unused_imports', 'unused_variables', 'unused_assignments', + 'unused_mut', ] def componentTypes(type): diff --git a/servo/components/script/dom/dissimilaroriginlocation.rs b/servo/components/script/dom/dissimilaroriginlocation.rs index d3aec5c90ee3..7ea2e3efc3cd 100644 --- a/servo/components/script/dom/dissimilaroriginlocation.rs +++ b/servo/components/script/dom/dissimilaroriginlocation.rs @@ -45,6 +45,7 @@ impl DissimilarOriginLocation { DissimilarOriginLocationBinding::Wrap) } + #[allow(dead_code)] pub fn origin(&self) -> &MutableOrigin { self.window.origin() } diff --git a/servo/components/script/dom/dissimilaroriginwindow.rs b/servo/components/script/dom/dissimilaroriginwindow.rs index e4e8b0dad400..4188f51f0e5f 100644 --- a/servo/components/script/dom/dissimilaroriginwindow.rs +++ b/servo/components/script/dom/dissimilaroriginwindow.rs @@ -65,6 +65,7 @@ impl DissimilarOriginWindow { unsafe { DissimilarOriginWindowBinding::Wrap(cx, win) } } + #[allow(dead_code)] pub fn origin(&self) -> &MutableOrigin { self.globalscope.origin() } diff --git a/servo/components/script/dom/location.rs b/servo/components/script/dom/location.rs index 854cdf424c2a..cac2322be825 100644 --- a/servo/components/script/dom/location.rs +++ b/servo/components/script/dom/location.rs @@ -61,6 +61,7 @@ impl Location { self.window.load_url(self.get_url(), true, true, None); } + #[allow(dead_code)] pub fn origin(&self) -> &MutableOrigin { self.window.origin() } diff --git a/servo/components/script_layout_interface/Cargo.toml b/servo/components/script_layout_interface/Cargo.toml index 9db6a37eea02..2df1a3f3205e 100644 --- a/servo/components/script_layout_interface/Cargo.toml +++ b/servo/components/script_layout_interface/Cargo.toml @@ -13,7 +13,7 @@ path = "lib.rs" app_units = "0.4" atomic_refcell = "0.1" canvas_traits = {path = "../canvas_traits"} -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" diff --git a/servo/components/selectors/Cargo.toml b/servo/components/selectors/Cargo.toml index 4410ea922a8c..9e5e9df6f35a 100644 --- a/servo/components/selectors/Cargo.toml +++ b/servo/components/selectors/Cargo.toml @@ -18,7 +18,7 @@ path = "lib.rs" [dependencies] bitflags = "0.7" matches = "0.1" -cssparser = "0.12.1" +cssparser = "0.13" fnv = "1.0" precomputed-hash = "0.1" smallvec = "0.3" diff --git a/servo/components/style/Cargo.toml b/servo/components/style/Cargo.toml index 06649f36eeb7..54f476b0e737 100644 --- a/servo/components/style/Cargo.toml +++ b/servo/components/style/Cargo.toml @@ -29,7 +29,7 @@ bitflags = "0.7" bit-vec = "0.4.3" byteorder = "1.0" cfg-if = "0.1.0" -cssparser = "0.12.1" +cssparser = "0.13.1" encoding = {version = "0.2", optional = true} euclid = "0.11" fnv = "1.0" diff --git a/servo/components/style/build_gecko.rs b/servo/components/style/build_gecko.rs index 92d512ee75c9..00aac6d8526f 100644 --- a/servo/components/style/build_gecko.rs +++ b/servo/components/style/build_gecko.rs @@ -624,6 +624,7 @@ mod bindings { .whitelisted_function("Gecko_.*"); let structs_types = [ "mozilla::css::URLValue", + "mozilla::Side", "RawGeckoAnimationPropertySegment", "RawGeckoComputedTiming", "RawGeckoDocument", diff --git a/servo/components/style/gecko_bindings/bindings.rs b/servo/components/style/gecko_bindings/bindings.rs index e855aa2819e0..c663df920120 100644 --- a/servo/components/style/gecko_bindings/bindings.rs +++ b/servo/components/style/gecko_bindings/bindings.rs @@ -4,6 +4,7 @@ pub use nsstring::{nsACString, nsAString, nsString}; type nsACString_internal = nsACString; type nsAString_internal = nsAString; use gecko_bindings::structs::mozilla::css::URLValue; +use gecko_bindings::structs::mozilla::Side; use gecko_bindings::structs::RawGeckoAnimationPropertySegment; use gecko_bindings::structs::RawGeckoComputedTiming; use gecko_bindings::structs::RawGeckoDocument; @@ -719,6 +720,21 @@ extern "C" { *const ::std::os::raw::c_char, aLength: u32) -> bool; } +extern "C" { + pub fn Gecko_EnsureMozBorderColors(aBorder: *mut nsStyleBorder); +} +extern "C" { + pub fn Gecko_ClearMozBorderColors(aBorder: *mut nsStyleBorder, + aSide: Side); +} +extern "C" { + pub fn Gecko_AppendMozBorderColors(aBorder: *mut nsStyleBorder, + aSide: Side, aColor: nscolor); +} +extern "C" { + pub fn Gecko_CopyMozBorderColors(aDest: *mut nsStyleBorder, + aSrc: *const nsStyleBorder, aSide: Side); +} extern "C" { pub fn Gecko_FontFamilyList_Clear(aList: *mut FontFamilyList); } diff --git a/servo/components/style/gecko_bindings/structs_debug.rs b/servo/components/style/gecko_bindings/structs_debug.rs index 56899329401f..5f3b90654b3c 100644 --- a/servo/components/style/gecko_bindings/structs_debug.rs +++ b/servo/components/style/gecko_bindings/structs_debug.rs @@ -4010,26 +4010,27 @@ pub mod root { mozHandlerBlocked = 59, mozHandlerCrashed = 60, mozMathIncrementScriptLevel = 61, - required = 62, - optional = 63, - valid = 64, - invalid = 65, - inRange = 66, - outOfRange = 67, - defaultPseudo = 68, - placeholderShown = 69, - mozReadOnly = 70, - mozReadWrite = 71, - mozSubmitInvalid = 72, - mozUIInvalid = 73, - mozUIValid = 74, - mozMeterOptimum = 75, - mozMeterSubOptimum = 76, - mozMeterSubSubOptimum = 77, - mozPlaceholder = 78, - Count = 79, - NotPseudo = 80, - MAX = 81, + mozAutofill = 62, + required = 63, + optional = 64, + valid = 65, + invalid = 66, + inRange = 67, + outOfRange = 68, + defaultPseudo = 69, + placeholderShown = 70, + mozReadOnly = 71, + mozReadWrite = 72, + mozSubmitInvalid = 73, + mozUIInvalid = 74, + mozUIValid = 75, + mozMeterOptimum = 76, + mozMeterSubOptimum = 77, + mozMeterSubSubOptimum = 78, + mozPlaceholder = 79, + Count = 80, + NotPseudo = 81, + MAX = 82, } pub const SERVO_PREF_ENABLED_align_content: bool = false; pub const SERVO_PREF_ENABLED_align_items: bool = false; @@ -4660,6 +4661,24 @@ pub mod root { pub type IntRect = [u32; 4usize]; pub type Matrix4x4 = [u32; 16usize]; #[repr(C)] + #[derive(Debug, Copy)] + pub struct FontVariation { + pub _bindgen_opaque_blob: [u32; 2usize], + } + #[test] + fn bindgen_test_layout_FontVariation() { + assert_eq!(::std::mem::size_of::() , 8usize , + concat ! ( + "Size of: " , stringify ! ( FontVariation ) )); + assert_eq! (::std::mem::align_of::() , 4usize , + concat ! ( + "Alignment of " , stringify ! ( FontVariation ) + )); + } + impl Clone for FontVariation { + fn clone(&self) -> Self { *self } + } + #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct SourceSurface([u8; 0]); #[repr(C)] @@ -9319,6 +9338,24 @@ pub mod root { } pub type FILE = root::_IO_FILE; pub type va_list = root::__builtin_va_list; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct InfallibleAllocPolicy { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_InfallibleAllocPolicy() { + assert_eq!(::std::mem::size_of::() , 1usize , + concat ! ( + "Size of: " , stringify ! ( InfallibleAllocPolicy ) )); + assert_eq! (::std::mem::align_of::() , 1usize , + concat ! ( + "Alignment of " , stringify ! ( InfallibleAllocPolicy ) + )); + } + impl Clone for InfallibleAllocPolicy { + fn clone(&self) -> Self { *self } + } /** * MozRefCountType is Mozilla's reference count type. * @@ -9611,6 +9648,7 @@ pub mod root { = 2152924160, NS_ERROR_DOM_INVALID_ACCESS_XHR_TIMEOUT_AND_RESPONSETYPE_UNSUPPORTED_FOR_SYNC = 2152924161, + NS_ERROR_DOM_JS_DECODING_ERROR = 2152924162, NS_SUCCESS_DOM_NO_OPERATION = 5439489, NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW = 5439490, NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE = 5439491, @@ -12548,7 +12586,7 @@ pub mod root { pub mStyleAttrStyleSheet: root::RefPtr, pub mImageTracker: root::RefPtr, pub mActivityObservers: root::nsAutoPtr<()>, - pub mLinksToUpdate: [u64; 6usize], + pub mLinksToUpdate: [u64; 3usize], pub mAnimationController: root::RefPtr, pub mPropertyTable: root::nsPropertyTable, pub mExtraPropertyTables: root::nsTArray>, @@ -12612,7 +12650,7 @@ pub mod root { pub mXPathEvaluator: root::RefPtr, pub mAnonymousContents: root::nsTArray>, pub mBlockDOMContentLoaded: u32, - pub mDOMMediaQueryLists: root::PRCList, + pub mDOMMediaQueryLists: root::mozilla::LinkedList, pub mUseCounters: [u64; 2usize], pub mChildDocumentUseCounters: [u64; 2usize], pub mNotifiedPageForUseCounter: [u64; 2usize], @@ -12896,9 +12934,10 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsIDocument_FrameRequest([u8; 0]); + pub const nsIDocument_kSegmentSize: usize = 128; #[test] fn bindgen_test_layout_nsIDocument() { - assert_eq!(::std::mem::size_of::() , 912usize , concat ! + assert_eq!(::std::mem::size_of::() , 896usize , concat ! ( "Size of: " , stringify ! ( nsIDocument ) )); assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( "Alignment of " , stringify ! ( nsIDocument ) )); @@ -16987,33 +17026,6 @@ pub mod root { fn clone(&self) -> Self { *self } } #[repr(C)] - #[derive(Debug, Copy)] - pub struct PRCListStr { - pub next: *mut root::PRCList, - pub prev: *mut root::PRCList, - } - #[test] - fn bindgen_test_layout_PRCListStr() { - assert_eq!(::std::mem::size_of::() , 16usize , concat ! ( - "Size of: " , stringify ! ( PRCListStr ) )); - assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( - "Alignment of " , stringify ! ( PRCListStr ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const PRCListStr ) ) . next as * const _ as - usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( PRCListStr ) , "::" - , stringify ! ( next ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const PRCListStr ) ) . prev as * const _ as - usize } , 8usize , concat ! ( - "Alignment of field: " , stringify ! ( PRCListStr ) , "::" - , stringify ! ( prev ) )); - } - impl Clone for PRCListStr { - fn clone(&self) -> Self { *self } - } - pub type PRCList = root::PRCListStr; - #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct gfxUserFontSet([u8; 0]); #[repr(C)] @@ -17076,6 +17088,21 @@ pub mod root { CORS_ANONYMOUS = 2, CORS_USE_CREDENTIALS = 3, } + pub const imgIRequest_CATEGORY_FRAME_INIT: root::imgIRequest__bindgen_ty_3 + = + imgIRequest__bindgen_ty_3::CATEGORY_FRAME_INIT; + pub const imgIRequest_CATEGORY_SIZE_QUERY: root::imgIRequest__bindgen_ty_3 + = + imgIRequest__bindgen_ty_3::CATEGORY_SIZE_QUERY; + pub const imgIRequest_CATEGORY_DISPLAY: root::imgIRequest__bindgen_ty_3 = + imgIRequest__bindgen_ty_3::CATEGORY_DISPLAY; + #[repr(u32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum imgIRequest__bindgen_ty_3 { + CATEGORY_FRAME_INIT = 1, + CATEGORY_SIZE_QUERY = 2, + CATEGORY_DISPLAY = 4, + } #[test] fn bindgen_test_layout_imgIRequest() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( @@ -17725,33 +17752,7 @@ pub mod root { gfxFontFeatureValueSet ) , "::" , stringify ! ( mFontFeatureValues ) )); } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct gfxFontVariation { - pub mTag: u32, - pub mValue: f32, - } - #[test] - fn bindgen_test_layout_gfxFontVariation() { - assert_eq!(::std::mem::size_of::() , 8usize , concat - ! ( "Size of: " , stringify ! ( gfxFontVariation ) )); - assert_eq! (::std::mem::align_of::() , 4usize , - concat ! ( - "Alignment of " , stringify ! ( gfxFontVariation ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const gfxFontVariation ) ) . mTag as * - const _ as usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( gfxFontVariation ) - , "::" , stringify ! ( mTag ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const gfxFontVariation ) ) . mValue as * - const _ as usize } , 4usize , concat ! ( - "Alignment of field: " , stringify ! ( gfxFontVariation ) - , "::" , stringify ! ( mValue ) )); - } - impl Clone for gfxFontVariation { - fn clone(&self) -> Self { *self } - } + pub type gfxFontVariation = root::mozilla::gfx::FontVariation; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct gfxFontStyle([u8; 0]); @@ -17786,7 +17787,7 @@ pub mod root { pub alternateValues: root::nsTArray, pub featureValueLookup: root::RefPtr, pub fontFeatureSettings: root::nsTArray, - pub fontVariationSettings: root::nsTArray, + pub fontVariationSettings: root::nsTArray, pub languageOverride: u32, } #[test] @@ -23514,6 +23515,7 @@ pub mod root { pub mCORSMode: i32, pub mReferrerPolicy: root::imgRequest_ReferrerPolicy, pub mImageErrorCode: root::nsresult, + pub mBoostCategoriesRequested: u32, pub mMutex: root::mozilla::Mutex, pub mProgressTracker: root::RefPtr, pub mImage: root::RefPtr, @@ -28166,6 +28168,19 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_42() { + assert_eq!(::std::mem::size_of::>() + , 24usize , concat ! ( + "Size of template specialization: " , stringify ! ( + root::mozilla::LinkedList + ) )); + assert_eq!(::std::mem::align_of::>() + , 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + root::mozilla::LinkedList + ) )); + } + #[test] + fn __bindgen_test_layout_template_43() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28176,7 +28191,7 @@ pub mod root { root::RefPtr ) )); } #[test] - fn __bindgen_test_layout_template_43() { + fn __bindgen_test_layout_template_44() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28189,7 +28204,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_44() { + fn __bindgen_test_layout_template_45() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28200,7 +28215,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_45() { + fn __bindgen_test_layout_template_46() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28211,7 +28226,7 @@ pub mod root { root::nsTArray> ) )); } #[test] - fn __bindgen_test_layout_template_46() { + fn __bindgen_test_layout_template_47() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28222,7 +28237,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_47() { + fn __bindgen_test_layout_template_48() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28233,7 +28248,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_48() { + fn __bindgen_test_layout_template_49() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28244,7 +28259,18 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_49() { + fn __bindgen_test_layout_template_50() { + assert_eq!(::std::mem::size_of::>() + , 8usize , concat ! ( + "Size of template specialization: " , stringify ! ( + root::nsCOMPtr ) )); + assert_eq!(::std::mem::align_of::>() + , 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + root::nsCOMPtr ) )); + } + #[test] + fn __bindgen_test_layout_template_51() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28255,7 +28281,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_50() { + fn __bindgen_test_layout_template_52() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -28264,7 +28290,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_51() { + fn __bindgen_test_layout_template_53() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28275,7 +28301,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_52() { + fn __bindgen_test_layout_template_54() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28286,7 +28312,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_53() { + fn __bindgen_test_layout_template_55() { assert_eq!(::std::mem::size_of::<[u64; 29usize]>() , 232usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28297,7 +28323,7 @@ pub mod root { [u64; 29usize] ) )); } #[test] - fn __bindgen_test_layout_template_54() { + fn __bindgen_test_layout_template_56() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28308,7 +28334,7 @@ pub mod root { root::nsTArray<*mut root::nsIContent> ) )); } #[test] - fn __bindgen_test_layout_template_55() { + fn __bindgen_test_layout_template_57() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28319,7 +28345,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_56() { + fn __bindgen_test_layout_template_58() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28332,7 +28358,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_57() { + fn __bindgen_test_layout_template_59() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28343,7 +28369,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_58() { + fn __bindgen_test_layout_template_60() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28354,7 +28380,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_59() { + fn __bindgen_test_layout_template_61() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28365,7 +28391,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_60() { + fn __bindgen_test_layout_template_62() { assert_eq!(::std::mem::size_of::<[u64; 6usize]>() , 48usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28376,7 +28402,7 @@ pub mod root { [u64; 6usize] ) )); } #[test] - fn __bindgen_test_layout_template_61() { + fn __bindgen_test_layout_template_63() { assert_eq!(::std::mem::size_of::>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28387,28 +28413,6 @@ pub mod root { root::mozilla::OwningNonNull ) )); } #[test] - fn __bindgen_test_layout_template_62() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] - fn __bindgen_test_layout_template_63() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] fn __bindgen_test_layout_template_64() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( @@ -28421,14 +28425,14 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_65() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); + [u32; 2usize] ) )); } #[test] fn __bindgen_test_layout_template_66() { @@ -28443,6 +28447,17 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_67() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_68() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28453,26 +28468,15 @@ pub mod root { [u32; 2usize] ) )); } #[test] - fn __bindgen_test_layout_template_68() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - } - #[test] fn __bindgen_test_layout_template_69() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); + [u32; 2usize] ) )); } #[test] fn __bindgen_test_layout_template_70() { @@ -28487,6 +28491,28 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_71() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_72() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_73() { assert_eq!(::std::mem::size_of::() , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( u32 ) )); @@ -28495,28 +28521,6 @@ pub mod root { u32 ) )); } #[test] - fn __bindgen_test_layout_template_72() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] - fn __bindgen_test_layout_template_73() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] fn __bindgen_test_layout_template_74() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( @@ -28529,6 +28533,28 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_75() { + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_76() { + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_77() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28539,7 +28565,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_76() { + fn __bindgen_test_layout_template_78() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28552,7 +28578,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_77() { + fn __bindgen_test_layout_template_79() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28565,7 +28591,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_78() { + fn __bindgen_test_layout_template_80() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( @@ -28582,7 +28608,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_79() { + fn __bindgen_test_layout_template_81() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28593,7 +28619,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_80() { + fn __bindgen_test_layout_template_82() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28604,7 +28630,7 @@ pub mod root { root::nsTArray<::std::os::raw::c_uint> ) )); } #[test] - fn __bindgen_test_layout_template_81() { + fn __bindgen_test_layout_template_83() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28617,7 +28643,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_82() { + fn __bindgen_test_layout_template_84() { assert_eq!(::std::mem::size_of::>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28628,7 +28654,7 @@ pub mod root { root::nsPtrHashKey ) )); } #[test] - fn __bindgen_test_layout_template_83() { + fn __bindgen_test_layout_template_85() { assert_eq!(::std::mem::size_of::<[u64; 6usize]>() , 48usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28639,7 +28665,7 @@ pub mod root { [u64; 6usize] ) )); } #[test] - fn __bindgen_test_layout_template_84() { + fn __bindgen_test_layout_template_86() { assert_eq!(::std::mem::size_of::>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28652,7 +28678,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_85() { + fn __bindgen_test_layout_template_87() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28663,7 +28689,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_86() { + fn __bindgen_test_layout_template_88() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28674,7 +28700,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_87() { + fn __bindgen_test_layout_template_89() { assert_eq!(::std::mem::size_of::>() , 24usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28685,7 +28711,7 @@ pub mod root { root::nsMainThreadPtrHolder ) )); } #[test] - fn __bindgen_test_layout_template_88() { + fn __bindgen_test_layout_template_90() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28696,7 +28722,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_89() { + fn __bindgen_test_layout_template_91() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28713,7 +28739,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_90() { + fn __bindgen_test_layout_template_92() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28726,7 +28752,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_91() { + fn __bindgen_test_layout_template_93() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28743,7 +28769,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_92() { + fn __bindgen_test_layout_template_94() { assert_eq!(::std::mem::size_of::<[u64; 2usize]>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28754,7 +28780,7 @@ pub mod root { [u64; 2usize] ) )); } #[test] - fn __bindgen_test_layout_template_93() { + fn __bindgen_test_layout_template_95() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -28763,7 +28789,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_94() { + fn __bindgen_test_layout_template_96() { assert_eq!(::std::mem::size_of::<[u32; 3usize]>() , 12usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28774,7 +28800,7 @@ pub mod root { [u32; 3usize] ) )); } #[test] - fn __bindgen_test_layout_template_95() { + fn __bindgen_test_layout_template_97() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28785,7 +28811,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_96() { + fn __bindgen_test_layout_template_98() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28796,7 +28822,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_97() { + fn __bindgen_test_layout_template_99() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28813,7 +28839,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_98() { + fn __bindgen_test_layout_template_100() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28826,7 +28852,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_99() { + fn __bindgen_test_layout_template_101() { assert_eq!(::std::mem::size_of::>() , 32usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28837,7 +28863,7 @@ pub mod root { root::std::pair<::nsstring::nsStringRepr, ::nsstring::nsStringRepr> ) )); } #[test] - fn __bindgen_test_layout_template_100() { + fn __bindgen_test_layout_template_102() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28852,7 +28878,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_101() { + fn __bindgen_test_layout_template_103() { assert_eq!(::std::mem::size_of::<[u64; 18usize]>() , 144usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28863,7 +28889,7 @@ pub mod root { [u64; 18usize] ) )); } #[test] - fn __bindgen_test_layout_template_102() { + fn __bindgen_test_layout_template_104() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28876,7 +28902,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_103() { + fn __bindgen_test_layout_template_105() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28889,7 +28915,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_104() { + fn __bindgen_test_layout_template_106() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28900,7 +28926,7 @@ pub mod root { root::RefPtr ) )); } #[test] - fn __bindgen_test_layout_template_105() { + fn __bindgen_test_layout_template_107() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -28909,7 +28935,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_106() { + fn __bindgen_test_layout_template_108() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28920,7 +28946,7 @@ pub mod root { root::nsTArray<*mut root::mozilla::css::DocumentRule> ) )); } #[test] - fn __bindgen_test_layout_template_107() { + fn __bindgen_test_layout_template_109() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( diff --git a/servo/components/style/gecko_bindings/structs_release.rs b/servo/components/style/gecko_bindings/structs_release.rs index f463825a2d48..9b3be9962bb5 100644 --- a/servo/components/style/gecko_bindings/structs_release.rs +++ b/servo/components/style/gecko_bindings/structs_release.rs @@ -3962,26 +3962,27 @@ pub mod root { mozHandlerBlocked = 59, mozHandlerCrashed = 60, mozMathIncrementScriptLevel = 61, - required = 62, - optional = 63, - valid = 64, - invalid = 65, - inRange = 66, - outOfRange = 67, - defaultPseudo = 68, - placeholderShown = 69, - mozReadOnly = 70, - mozReadWrite = 71, - mozSubmitInvalid = 72, - mozUIInvalid = 73, - mozUIValid = 74, - mozMeterOptimum = 75, - mozMeterSubOptimum = 76, - mozMeterSubSubOptimum = 77, - mozPlaceholder = 78, - Count = 79, - NotPseudo = 80, - MAX = 81, + mozAutofill = 62, + required = 63, + optional = 64, + valid = 65, + invalid = 66, + inRange = 67, + outOfRange = 68, + defaultPseudo = 69, + placeholderShown = 70, + mozReadOnly = 71, + mozReadWrite = 72, + mozSubmitInvalid = 73, + mozUIInvalid = 74, + mozUIValid = 75, + mozMeterOptimum = 76, + mozMeterSubOptimum = 77, + mozMeterSubSubOptimum = 78, + mozPlaceholder = 79, + Count = 80, + NotPseudo = 81, + MAX = 82, } pub const SERVO_PREF_ENABLED_align_content: bool = false; pub const SERVO_PREF_ENABLED_align_items: bool = false; @@ -4611,6 +4612,24 @@ pub mod root { pub type IntRect = [u32; 4usize]; pub type Matrix4x4 = [u32; 16usize]; #[repr(C)] + #[derive(Debug, Copy)] + pub struct FontVariation { + pub _bindgen_opaque_blob: [u32; 2usize], + } + #[test] + fn bindgen_test_layout_FontVariation() { + assert_eq!(::std::mem::size_of::() , 8usize , + concat ! ( + "Size of: " , stringify ! ( FontVariation ) )); + assert_eq! (::std::mem::align_of::() , 4usize , + concat ! ( + "Alignment of " , stringify ! ( FontVariation ) + )); + } + impl Clone for FontVariation { + fn clone(&self) -> Self { *self } + } + #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct SourceSurface([u8; 0]); #[repr(C)] @@ -8922,6 +8941,24 @@ pub mod root { } } pub type va_list = root::__builtin_va_list; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct InfallibleAllocPolicy { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_InfallibleAllocPolicy() { + assert_eq!(::std::mem::size_of::() , 1usize , + concat ! ( + "Size of: " , stringify ! ( InfallibleAllocPolicy ) )); + assert_eq! (::std::mem::align_of::() , 1usize , + concat ! ( + "Alignment of " , stringify ! ( InfallibleAllocPolicy ) + )); + } + impl Clone for InfallibleAllocPolicy { + fn clone(&self) -> Self { *self } + } /** * MozRefCountType is Mozilla's reference count type. * @@ -9214,6 +9251,7 @@ pub mod root { = 2152924160, NS_ERROR_DOM_INVALID_ACCESS_XHR_TIMEOUT_AND_RESPONSETYPE_UNSUPPORTED_FOR_SYNC = 2152924161, + NS_ERROR_DOM_JS_DECODING_ERROR = 2152924162, NS_SUCCESS_DOM_NO_OPERATION = 5439489, NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW = 5439490, NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE = 5439491, @@ -12083,7 +12121,7 @@ pub mod root { pub mStyleAttrStyleSheet: root::RefPtr, pub mImageTracker: root::RefPtr, pub mActivityObservers: root::nsAutoPtr<()>, - pub mLinksToUpdate: [u64; 5usize], + pub mLinksToUpdate: [u64; 3usize], pub mAnimationController: root::RefPtr, pub mPropertyTable: root::nsPropertyTable, pub mExtraPropertyTables: root::nsTArray>, @@ -12142,7 +12180,7 @@ pub mod root { pub mXPathEvaluator: root::RefPtr, pub mAnonymousContents: root::nsTArray>, pub mBlockDOMContentLoaded: u32, - pub mDOMMediaQueryLists: root::PRCList, + pub mDOMMediaQueryLists: root::mozilla::LinkedList, pub mUseCounters: [u64; 2usize], pub mChildDocumentUseCounters: [u64; 2usize], pub mNotifiedPageForUseCounter: [u64; 2usize], @@ -12426,9 +12464,10 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsIDocument_FrameRequest([u8; 0]); + pub const nsIDocument_kSegmentSize: usize = 128; #[test] fn bindgen_test_layout_nsIDocument() { - assert_eq!(::std::mem::size_of::() , 880usize , concat ! + assert_eq!(::std::mem::size_of::() , 872usize , concat ! ( "Size of: " , stringify ! ( nsIDocument ) )); assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( "Alignment of " , stringify ! ( nsIDocument ) )); @@ -16429,33 +16468,6 @@ pub mod root { fn clone(&self) -> Self { *self } } #[repr(C)] - #[derive(Debug, Copy)] - pub struct PRCListStr { - pub next: *mut root::PRCList, - pub prev: *mut root::PRCList, - } - #[test] - fn bindgen_test_layout_PRCListStr() { - assert_eq!(::std::mem::size_of::() , 16usize , concat ! ( - "Size of: " , stringify ! ( PRCListStr ) )); - assert_eq! (::std::mem::align_of::() , 8usize , concat ! ( - "Alignment of " , stringify ! ( PRCListStr ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const PRCListStr ) ) . next as * const _ as - usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( PRCListStr ) , "::" - , stringify ! ( next ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const PRCListStr ) ) . prev as * const _ as - usize } , 8usize , concat ! ( - "Alignment of field: " , stringify ! ( PRCListStr ) , "::" - , stringify ! ( prev ) )); - } - impl Clone for PRCListStr { - fn clone(&self) -> Self { *self } - } - pub type PRCList = root::PRCListStr; - #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct gfxUserFontSet([u8; 0]); #[repr(C)] @@ -16518,6 +16530,21 @@ pub mod root { CORS_ANONYMOUS = 2, CORS_USE_CREDENTIALS = 3, } + pub const imgIRequest_CATEGORY_FRAME_INIT: root::imgIRequest__bindgen_ty_3 + = + imgIRequest__bindgen_ty_3::CATEGORY_FRAME_INIT; + pub const imgIRequest_CATEGORY_SIZE_QUERY: root::imgIRequest__bindgen_ty_3 + = + imgIRequest__bindgen_ty_3::CATEGORY_SIZE_QUERY; + pub const imgIRequest_CATEGORY_DISPLAY: root::imgIRequest__bindgen_ty_3 = + imgIRequest__bindgen_ty_3::CATEGORY_DISPLAY; + #[repr(u32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum imgIRequest__bindgen_ty_3 { + CATEGORY_FRAME_INIT = 1, + CATEGORY_SIZE_QUERY = 2, + CATEGORY_DISPLAY = 4, + } #[test] fn bindgen_test_layout_imgIRequest() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( @@ -17159,33 +17186,7 @@ pub mod root { gfxFontFeatureValueSet ) , "::" , stringify ! ( mFontFeatureValues ) )); } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct gfxFontVariation { - pub mTag: u32, - pub mValue: f32, - } - #[test] - fn bindgen_test_layout_gfxFontVariation() { - assert_eq!(::std::mem::size_of::() , 8usize , concat - ! ( "Size of: " , stringify ! ( gfxFontVariation ) )); - assert_eq! (::std::mem::align_of::() , 4usize , - concat ! ( - "Alignment of " , stringify ! ( gfxFontVariation ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const gfxFontVariation ) ) . mTag as * - const _ as usize } , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( gfxFontVariation ) - , "::" , stringify ! ( mTag ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const gfxFontVariation ) ) . mValue as * - const _ as usize } , 4usize , concat ! ( - "Alignment of field: " , stringify ! ( gfxFontVariation ) - , "::" , stringify ! ( mValue ) )); - } - impl Clone for gfxFontVariation { - fn clone(&self) -> Self { *self } - } + pub type gfxFontVariation = root::mozilla::gfx::FontVariation; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct gfxFontStyle([u8; 0]); @@ -17220,7 +17221,7 @@ pub mod root { pub alternateValues: root::nsTArray, pub featureValueLookup: root::RefPtr, pub fontFeatureSettings: root::nsTArray, - pub fontVariationSettings: root::nsTArray, + pub fontVariationSettings: root::nsTArray, pub languageOverride: u32, } #[test] @@ -22855,6 +22856,7 @@ pub mod root { pub mCORSMode: i32, pub mReferrerPolicy: root::imgRequest_ReferrerPolicy, pub mImageErrorCode: root::nsresult, + pub mBoostCategoriesRequested: u32, pub mMutex: root::mozilla::Mutex, pub mProgressTracker: root::RefPtr, pub mImage: root::RefPtr, @@ -27507,6 +27509,19 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_42() { + assert_eq!(::std::mem::size_of::>() + , 24usize , concat ! ( + "Size of template specialization: " , stringify ! ( + root::mozilla::LinkedList + ) )); + assert_eq!(::std::mem::align_of::>() + , 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + root::mozilla::LinkedList + ) )); + } + #[test] + fn __bindgen_test_layout_template_43() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27517,7 +27532,7 @@ pub mod root { root::RefPtr ) )); } #[test] - fn __bindgen_test_layout_template_43() { + fn __bindgen_test_layout_template_44() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27530,7 +27545,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_44() { + fn __bindgen_test_layout_template_45() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27541,7 +27556,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_45() { + fn __bindgen_test_layout_template_46() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27552,7 +27567,7 @@ pub mod root { root::nsTArray> ) )); } #[test] - fn __bindgen_test_layout_template_46() { + fn __bindgen_test_layout_template_47() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27563,7 +27578,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_47() { + fn __bindgen_test_layout_template_48() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27574,7 +27589,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_48() { + fn __bindgen_test_layout_template_49() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27585,7 +27600,18 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_49() { + fn __bindgen_test_layout_template_50() { + assert_eq!(::std::mem::size_of::>() + , 8usize , concat ! ( + "Size of template specialization: " , stringify ! ( + root::nsCOMPtr ) )); + assert_eq!(::std::mem::align_of::>() + , 8usize , concat ! ( + "Alignment of template specialization: " , stringify ! ( + root::nsCOMPtr ) )); + } + #[test] + fn __bindgen_test_layout_template_51() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27596,7 +27622,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_50() { + fn __bindgen_test_layout_template_52() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -27605,7 +27631,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_51() { + fn __bindgen_test_layout_template_53() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27616,7 +27642,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_52() { + fn __bindgen_test_layout_template_54() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27627,7 +27653,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_53() { + fn __bindgen_test_layout_template_55() { assert_eq!(::std::mem::size_of::<[u64; 28usize]>() , 224usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27638,7 +27664,7 @@ pub mod root { [u64; 28usize] ) )); } #[test] - fn __bindgen_test_layout_template_54() { + fn __bindgen_test_layout_template_56() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27649,7 +27675,7 @@ pub mod root { root::nsTArray<*mut root::nsIContent> ) )); } #[test] - fn __bindgen_test_layout_template_55() { + fn __bindgen_test_layout_template_57() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27660,7 +27686,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_56() { + fn __bindgen_test_layout_template_58() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27673,7 +27699,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_57() { + fn __bindgen_test_layout_template_59() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27684,7 +27710,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_58() { + fn __bindgen_test_layout_template_60() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27695,7 +27721,7 @@ pub mod root { root::nsCOMPtr ) )); } #[test] - fn __bindgen_test_layout_template_59() { + fn __bindgen_test_layout_template_61() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27706,7 +27732,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_60() { + fn __bindgen_test_layout_template_62() { assert_eq!(::std::mem::size_of::<[u64; 5usize]>() , 40usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27717,7 +27743,7 @@ pub mod root { [u64; 5usize] ) )); } #[test] - fn __bindgen_test_layout_template_61() { + fn __bindgen_test_layout_template_63() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27728,28 +27754,6 @@ pub mod root { root::mozilla::OwningNonNull ) )); } #[test] - fn __bindgen_test_layout_template_62() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] - fn __bindgen_test_layout_template_63() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] fn __bindgen_test_layout_template_64() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( @@ -27762,14 +27766,14 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_65() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); + [u32; 2usize] ) )); } #[test] fn __bindgen_test_layout_template_66() { @@ -27784,6 +27788,17 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_67() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_68() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27794,26 +27809,15 @@ pub mod root { [u32; 2usize] ) )); } #[test] - fn __bindgen_test_layout_template_68() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - } - #[test] fn __bindgen_test_layout_template_69() { - assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( - [u32; 4usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( - [u32; 4usize] ) )); + [u32; 2usize] ) )); } #[test] fn __bindgen_test_layout_template_70() { @@ -27828,6 +27832,28 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_71() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_72() { + assert_eq!(::std::mem::size_of::<[u32; 4usize]>() , 16usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 4usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 4usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_73() { assert_eq!(::std::mem::size_of::() , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( u32 ) )); @@ -27836,28 +27862,6 @@ pub mod root { u32 ) )); } #[test] - fn __bindgen_test_layout_template_72() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] - fn __bindgen_test_layout_template_73() { - assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! - ( - "Size of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! - ( - "Alignment of template specialization: " , stringify ! ( - [u32; 2usize] ) )); - } - #[test] fn __bindgen_test_layout_template_74() { assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! ( @@ -27870,6 +27874,28 @@ pub mod root { } #[test] fn __bindgen_test_layout_template_75() { + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_76() { + assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! + ( + "Size of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + assert_eq!(::std::mem::align_of::<[u32; 2usize]>() , 4usize , concat ! + ( + "Alignment of template specialization: " , stringify ! ( + [u32; 2usize] ) )); + } + #[test] + fn __bindgen_test_layout_template_77() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27880,7 +27906,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_76() { + fn __bindgen_test_layout_template_78() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27893,7 +27919,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_77() { + fn __bindgen_test_layout_template_79() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27906,7 +27932,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_78() { + fn __bindgen_test_layout_template_80() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( @@ -27923,7 +27949,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_79() { + fn __bindgen_test_layout_template_81() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27934,7 +27960,7 @@ pub mod root { root::nsTArray ) )); } #[test] - fn __bindgen_test_layout_template_80() { + fn __bindgen_test_layout_template_82() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27945,7 +27971,7 @@ pub mod root { root::nsTArray<::std::os::raw::c_uint> ) )); } #[test] - fn __bindgen_test_layout_template_81() { + fn __bindgen_test_layout_template_83() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27958,7 +27984,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_82() { + fn __bindgen_test_layout_template_84() { assert_eq!(::std::mem::size_of::>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27969,7 +27995,7 @@ pub mod root { root::nsPtrHashKey ) )); } #[test] - fn __bindgen_test_layout_template_83() { + fn __bindgen_test_layout_template_85() { assert_eq!(::std::mem::size_of::<[u64; 5usize]>() , 40usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27980,7 +28006,7 @@ pub mod root { [u64; 5usize] ) )); } #[test] - fn __bindgen_test_layout_template_84() { + fn __bindgen_test_layout_template_86() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -27993,7 +28019,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_85() { + fn __bindgen_test_layout_template_87() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28004,7 +28030,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_86() { + fn __bindgen_test_layout_template_88() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28015,7 +28041,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_87() { + fn __bindgen_test_layout_template_89() { assert_eq!(::std::mem::size_of::>() , 24usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28026,7 +28052,7 @@ pub mod root { root::nsMainThreadPtrHolder ) )); } #[test] - fn __bindgen_test_layout_template_88() { + fn __bindgen_test_layout_template_90() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28037,7 +28063,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_89() { + fn __bindgen_test_layout_template_91() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28054,7 +28080,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_90() { + fn __bindgen_test_layout_template_92() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28067,7 +28093,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_91() { + fn __bindgen_test_layout_template_93() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28084,7 +28110,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_92() { + fn __bindgen_test_layout_template_94() { assert_eq!(::std::mem::size_of::<[u64; 2usize]>() , 16usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28095,7 +28121,7 @@ pub mod root { [u64; 2usize] ) )); } #[test] - fn __bindgen_test_layout_template_93() { + fn __bindgen_test_layout_template_95() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -28104,7 +28130,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_94() { + fn __bindgen_test_layout_template_96() { assert_eq!(::std::mem::size_of::<[u32; 3usize]>() , 12usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28115,7 +28141,7 @@ pub mod root { [u32; 3usize] ) )); } #[test] - fn __bindgen_test_layout_template_95() { + fn __bindgen_test_layout_template_97() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28126,7 +28152,7 @@ pub mod root { root::already_AddRefed ) )); } #[test] - fn __bindgen_test_layout_template_96() { + fn __bindgen_test_layout_template_98() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28137,7 +28163,7 @@ pub mod root { root::mozilla::DefaultDelete ) )); } #[test] - fn __bindgen_test_layout_template_97() { + fn __bindgen_test_layout_template_99() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28154,7 +28180,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_98() { + fn __bindgen_test_layout_template_100() { assert_eq!(::std::mem::size_of::>() , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28167,7 +28193,7 @@ pub mod root { )); } #[test] - fn __bindgen_test_layout_template_99() { + fn __bindgen_test_layout_template_101() { assert_eq!(::std::mem::size_of::>() , 32usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28178,7 +28204,7 @@ pub mod root { root::std::pair<::nsstring::nsStringRepr, ::nsstring::nsStringRepr> ) )); } #[test] - fn __bindgen_test_layout_template_100() { + fn __bindgen_test_layout_template_102() { assert_eq!(::std::mem::size_of::>>() , 8usize , concat ! ( @@ -28193,7 +28219,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_101() { + fn __bindgen_test_layout_template_103() { assert_eq!(::std::mem::size_of::<[u64; 18usize]>() , 144usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28204,7 +28230,7 @@ pub mod root { [u64; 18usize] ) )); } #[test] - fn __bindgen_test_layout_template_102() { + fn __bindgen_test_layout_template_104() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28217,7 +28243,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_103() { + fn __bindgen_test_layout_template_105() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28230,7 +28256,7 @@ pub mod root { ) )); } #[test] - fn __bindgen_test_layout_template_104() { + fn __bindgen_test_layout_template_106() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28241,7 +28267,7 @@ pub mod root { root::RefPtr ) )); } #[test] - fn __bindgen_test_layout_template_105() { + fn __bindgen_test_layout_template_107() { assert_eq!(::std::mem::size_of::() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( u64 ) )); @@ -28250,7 +28276,7 @@ pub mod root { u64 ) )); } #[test] - fn __bindgen_test_layout_template_106() { + fn __bindgen_test_layout_template_108() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( @@ -28261,7 +28287,7 @@ pub mod root { root::nsTArray<*mut root::mozilla::css::DocumentRule> ) )); } #[test] - fn __bindgen_test_layout_template_107() { + fn __bindgen_test_layout_template_109() { assert_eq!(::std::mem::size_of::>() , 8usize , concat ! ( "Size of template specialization: " , stringify ! ( diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs index 9ab78fa0bbaf..3c2ab7280be8 100644 --- a/servo/components/style/properties/gecko.mako.rs +++ b/servo/components/style/properties/gecko.mako.rs @@ -827,9 +827,13 @@ fn static_assert() { for y in ["color", "style", "width"]] + ["border-{0}-radius".format(x.ident.replace("_", "-")) for x in CORNERS]) %> + +<% skip_moz_border_color_longhands = " ".join("-moz-border-{0}-colors".format(x.ident) + for x in SIDES) %> <%self:impl_trait style_struct_name="Border" skip_longhands="${skip_border_longhands} border-image-source border-image-outset - border-image-repeat border-image-width border-image-slice" + border-image-repeat border-image-width border-image-slice + ${skip_moz_border_color_longhands}" skip_additionals="*"> % for side in SIDES: @@ -880,6 +884,42 @@ fn static_assert() { pub fn border_${side.ident}_has_nonzero_width(&self) -> bool { self.gecko.mComputedBorder.${side.ident} != 0 } + + #[allow(non_snake_case)] + pub fn set__moz_border_${side.ident}_colors(&mut self, + v: longhands::_moz_border_${side.ident}_colors::computed_value::T) { + match v.0 { + None => { + unsafe { + bindings::Gecko_ClearMozBorderColors(&mut self.gecko, + structs::Side::eSide${to_camel_case(side.ident)}); + } + }, + Some(ref colors) => { + unsafe { + bindings::Gecko_EnsureMozBorderColors(&mut self.gecko); + bindings::Gecko_ClearMozBorderColors(&mut self.gecko, + structs::Side::eSide${to_camel_case(side.ident)}); + } + for color in colors { + let c = color_to_nscolor_zero_currentcolor(*color); + unsafe { + bindings::Gecko_AppendMozBorderColors(&mut self.gecko, + structs::Side::eSide${to_camel_case(side.ident)}, + c); + } + } + } + } + } + + #[allow(non_snake_case)] + pub fn copy__moz_border_${side.ident}_colors_from(&mut self, other: &Self) { + unsafe { + bindings::Gecko_CopyMozBorderColors(&mut self.gecko, &other.gecko, + structs::Side::eSide${to_camel_case(side.ident)}); + } + } % endfor % for corner in CORNERS: diff --git a/servo/components/style/properties/longhand/border.mako.rs b/servo/components/style/properties/longhand/border.mako.rs index cad750ba1653..64c64c700fb8 100644 --- a/servo/components/style/properties/longhand/border.mako.rs +++ b/servo/components/style/properties/longhand/border.mako.rs @@ -73,6 +73,130 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', animation_value_type="ComputedValue")} % endfor +/// -moz-border-*-colors: color, string, enum, none, inherit/initial +/// These non-spec properties are just for Gecko (Stylo) internal use. +% for side in PHYSICAL_SIDES: + <%helpers:longhand name="-moz-border-${side}-colors" animation_value_type="none" + spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-border-*-colors)" + products="gecko"> + use std::fmt; + use style_traits::ToCss; + use values::HasViewportPercentage; + use values::specified::CSSColor; + no_viewport_percentage!(SpecifiedValue); + + pub mod computed_value { + use values::computed::CSSColor; + #[derive(Debug, Clone, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub struct T(pub Option>); + } + + #[derive(Debug, Clone, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub enum SpecifiedValue { + None, + Colors(Vec), + } + + impl ToCss for computed_value::T { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + match self.0 { + None => return dest.write_str("none"), + Some(ref vec) => { + let mut first = true; + for ref color in vec { + if !first { + try!(dest.write_str(" ")); + } + first = false; + try!(color.to_css(dest)) + } + Ok(()) + } + } + } + } + + impl ToCss for SpecifiedValue { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + match *self { + SpecifiedValue::None => return dest.write_str("none"), + SpecifiedValue::Colors(ref vec) => { + let mut first = true; + for ref color in vec { + if !first { + try!(dest.write_str(" ")); + } + first = false; + try!(color.to_css(dest)) + } + Ok(()) + } + } + } + } + + #[inline] pub fn get_initial_value() -> computed_value::T { + computed_value::T(None) + } + + #[inline] pub fn get_initial_specified_value() -> SpecifiedValue { + SpecifiedValue::None + } + + impl ToComputedValue for SpecifiedValue { + type ComputedValue = computed_value::T; + + #[inline] + fn to_computed_value(&self, context: &Context) -> computed_value::T { + match *self { + SpecifiedValue::Colors(ref vec) => { + computed_value::T(Some(vec.iter() + .map(|c| c.to_computed_value(context)) + .collect())) + }, + SpecifiedValue::None => { + computed_value::T(None) + } + } + } + #[inline] + fn from_computed_value(computed: &computed_value::T) -> Self { + match *computed { + computed_value::T(Some(ref vec)) => { + SpecifiedValue::Colors(vec.iter() + .map(|c| ToComputedValue::from_computed_value((c))) + .collect()) + }, + computed_value::T(None) => { + SpecifiedValue::None + } + } + } + } + + #[inline] + pub fn parse(context: &ParserContext, input: &mut Parser) + -> Result { + if input.try(|input| input.expect_ident_matching("none")).is_ok() { + return Ok(SpecifiedValue::None) + } + + let mut result = Vec::new(); + while let Ok(value) = input.try(|i| CSSColor::parse(context, i)) { + result.push(value); + } + + if !result.is_empty() { + Ok(SpecifiedValue::Colors(result)) + } else { + Err(()) + } + } + +% endfor + ${helpers.single_keyword("box-decoration-break", "slice clone", gecko_enum_prefix="StyleBoxDecorationBreak", gecko_inexhaustive=True, diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index 439829b8f253..9f486772f4c3 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -841,7 +841,7 @@ impl PropertyId { // FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId // when stable Rust allows destructors in statics. - enum StaticId { + pub enum StaticId { Longhand(LonghandId), Shorthand(ShorthandId), } diff --git a/servo/components/style/properties/shorthand/border.mako.rs b/servo/components/style/properties/shorthand/border.mako.rs index 1ee9d3ff8da8..35afe6232057 100644 --- a/servo/components/style/properties/shorthand/border.mako.rs +++ b/servo/components/style/properties/shorthand/border.mako.rs @@ -14,7 +14,7 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style", <%helpers:shorthand name="border-width" sub_properties="${ ' '.join('border-%s-width' % side - for side in ['top', 'right', 'bottom', 'left'])}" + for side in PHYSICAL_SIDES)}" spec="https://drafts.csswg.org/css-backgrounds/#border-width"> use super::parse_four_sides; use parser::Parse; @@ -23,7 +23,7 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style", pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result { let (top, right, bottom, left) = try!(parse_four_sides(input, |i| specified::BorderWidth::parse(context, i))); Ok(Longhands { - % for side in ["top", "right", "bottom", "left"]: + % for side in PHYSICAL_SIDES: ${to_rust_ident('border-%s-width' % side)}: ${side}, % endfor }) @@ -31,7 +31,7 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style", impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - % for side in ["top", "right", "bottom", "left"]: + % for side in PHYSICAL_SIDES: let ${side} = self.border_${side}_width.clone(); % endfor @@ -124,22 +124,32 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser) <%helpers:shorthand name="border" sub_properties="${' '.join('border-%s-%s' % (side, prop) - for side in ['top', 'right', 'bottom', 'left'] + for side in PHYSICAL_SIDES for prop in ['color', 'style', 'width'])} ${' '.join('border-image-%s' % name - for name in ['outset', 'repeat', 'slice', 'source', 'width'])}" + for name in ['outset', 'repeat', 'slice', 'source', 'width'])} + ${' '.join('-moz-border-%s-colors' % side + for side in PHYSICAL_SIDES) if product == 'gecko' else ''}" spec="https://drafts.csswg.org/css-backgrounds/#border"> + % if product == "gecko": + use properties::longhands::{_moz_border_top_colors, _moz_border_right_colors, + _moz_border_bottom_colors, _moz_border_left_colors}; + % endif + pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result { use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice}; use properties::longhands::{border_image_source, border_image_width}; let (color, style, width) = try!(super::parse_border(context, input)); Ok(Longhands { - % for side in ["top", "right", "bottom", "left"]: + % for side in PHYSICAL_SIDES: border_${side}_color: color.clone(), border_${side}_style: style, border_${side}_width: width.clone(), + % if product == "gecko": + _moz_border_${side}_colors: _moz_border_${side}_colors::get_initial_specified_value(), + % endif % endfor // The ‘border’ shorthand resets ‘border-image’ to its initial value. diff --git a/servo/components/style/values/specified/length.rs b/servo/components/style/values/specified/length.rs index 7897b7815042..3181f5d67b67 100644 --- a/servo/components/style/values/specified/length.rs +++ b/servo/components/style/values/specified/length.rs @@ -1160,8 +1160,12 @@ impl LengthOrPercentage { NoCalcLength::parse_dimension(context, value.value, unit).map(LengthOrPercentage::Length), Token::Percentage(ref value) if num_context.is_ok(value.unit_value) => Ok(LengthOrPercentage::Percentage(Percentage(value.unit_value))), - Token::Number(ref value) if value.value == 0. => - Ok(LengthOrPercentage::zero()), + Token::Number(ref value) => { + if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() { + return Err(()) + } + Ok(LengthOrPercentage::Length(NoCalcLength::Absolute(AbsoluteLength::Px(value.value)))) + } Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => { let calc = try!(input.parse_nested_block(|i| { CalcLengthOrPercentage::parse_length_or_percentage(context, i) @@ -1284,8 +1288,14 @@ impl LengthOrPercentageOrAuto { NoCalcLength::parse_dimension(context, value.value, unit).map(LengthOrPercentageOrAuto::Length), Token::Percentage(ref value) if num_context.is_ok(value.unit_value) => Ok(LengthOrPercentageOrAuto::Percentage(Percentage(value.unit_value))), - Token::Number(ref value) if value.value == 0. => - Ok(Self::zero()), + Token::Number(ref value) if value.value == 0. => { + if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() { + return Err(()) + } + Ok(LengthOrPercentageOrAuto::Length( + NoCalcLength::Absolute(AbsoluteLength::Px(value.value)) + )) + } Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => Ok(LengthOrPercentageOrAuto::Auto), Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => { @@ -1363,8 +1373,14 @@ impl LengthOrPercentageOrNone { NoCalcLength::parse_dimension(context, value.value, unit).map(LengthOrPercentageOrNone::Length), Token::Percentage(ref value) if num_context.is_ok(value.unit_value) => Ok(LengthOrPercentageOrNone::Percentage(Percentage(value.unit_value))), - Token::Number(ref value) if value.value == 0. => - Ok(LengthOrPercentageOrNone::Length(NoCalcLength::zero())), + Token::Number(ref value) if value.value == 0. => { + if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() { + return Err(()) + } + Ok(LengthOrPercentageOrNone::Length( + NoCalcLength::Absolute(AbsoluteLength::Px(value.value)) + )) + } Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => { let calc = try!(input.parse_nested_block(|i| { CalcLengthOrPercentage::parse_length_or_percentage(context, i) diff --git a/servo/components/style_traits/Cargo.toml b/servo/components/style_traits/Cargo.toml index f61d92029e83..3acba6598204 100644 --- a/servo/components/style_traits/Cargo.toml +++ b/servo/components/style_traits/Cargo.toml @@ -15,7 +15,7 @@ servo = ["heapsize", "heapsize_derive", "serde", "serde_derive", [dependencies] app_units = "0.4" -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" heapsize = {version = "0.3.0", optional = true} heapsize_derive = {version = "0.1", optional = true} diff --git a/servo/ports/geckolib/Cargo.toml b/servo/ports/geckolib/Cargo.toml index 8148aa27ab92..6cb93fa3466a 100644 --- a/servo/ports/geckolib/Cargo.toml +++ b/servo/ports/geckolib/Cargo.toml @@ -16,7 +16,7 @@ gecko_debug = ["style/gecko_debug"] [dependencies] atomic_refcell = "0.1" -cssparser = "0.12.1" +cssparser = "0.13" env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size libc = "0.2" log = {version = "0.3.5", features = ["release_max_level_info"]} diff --git a/servo/ports/glutin/window.rs b/servo/ports/glutin/window.rs index 4b0ceb65666b..bc162f8f9ecb 100644 --- a/servo/ports/glutin/window.rs +++ b/servo/ports/glutin/window.rs @@ -693,6 +693,7 @@ impl Window { G_NESTED_EVENT_LOOP_LISTENER = None } + #[cfg(target_os = "windows")] fn char_to_script_key(c: char) -> Option { match c { ' ' => Some(Key::Space), diff --git a/servo/ports/servo/main.rs b/servo/ports/servo/main.rs index 420d17ffc4d4..dc0ae0329aa8 100644 --- a/servo/ports/servo/main.rs +++ b/servo/ports/servo/main.rs @@ -33,6 +33,7 @@ extern crate sig; use backtrace::Backtrace; use servo::Browser; use servo::compositing::windowing::WindowEvent; +#[cfg(target_os = "android")] use servo::config; use servo::config::opts::{self, ArgumentParsingResult}; use servo::config::servo_version; diff --git a/servo/tests/unit/style/Cargo.toml b/servo/tests/unit/style/Cargo.toml index bba488f01243..4450cb901b45 100644 --- a/servo/tests/unit/style/Cargo.toml +++ b/servo/tests/unit/style/Cargo.toml @@ -14,7 +14,7 @@ testing = ["style/testing"] [dependencies] app_units = "0.4" -cssparser = "0.12.1" +cssparser = "0.13" euclid = "0.11" html5ever-atoms = "0.3" parking_lot = "0.3" diff --git a/servo/tests/unit/stylo/Cargo.toml b/servo/tests/unit/stylo/Cargo.toml index b9fff8503591..239763a68663 100644 --- a/servo/tests/unit/stylo/Cargo.toml +++ b/servo/tests/unit/stylo/Cargo.toml @@ -16,7 +16,7 @@ testing = ["style/testing"] [dependencies] atomic_refcell = "0.1" -cssparser = "0.12.1" +cssparser = "0.13" env_logger = "0.4" euclid = "0.11" libc = "0.2" diff --git a/taskcluster/ci/test/tests.yml b/taskcluster/ci/test/tests.yml index c7be3eb339d3..f85b06a4716a 100644 --- a/taskcluster/ci/test/tests.yml +++ b/taskcluster/ci/test/tests.yml @@ -1347,12 +1347,12 @@ talos-tp5o: talos-perf-reftest: description: "Talos perf-reftest" suite: talos - talos-try-name: perfref + talos-try-name: perf-reftest treeherder-symbol: tc-T(p) run-on-projects: by-test-platform: - linux64-stylo/.*: ['try'] - default: ['try'] + linux64-stylo/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 3600 mozharness: script: talos_script.py diff --git a/taskcluster/scripts/builder/hazard-analysis.sh b/taskcluster/scripts/builder/hazard-analysis.sh index 4b56025001a1..e9370ef65305 100755 --- a/taskcluster/scripts/builder/hazard-analysis.sh +++ b/taskcluster/scripts/builder/hazard-analysis.sh @@ -151,7 +151,7 @@ function check_hazards () { exit 1 fi - NUM_ALLOWED_WRITE_HAZARDS=3 + NUM_ALLOWED_WRITE_HAZARDS=7 if [ $NUM_WRITE_HAZARDS -gt $NUM_ALLOWED_WRITE_HAZARDS ]; then echo "TEST-UNEXPECTED-FAIL $NUM_WRITE_HAZARDS heap write hazards detected out of $NUM_ALLOWED_WRITE_HAZARDS allowed" >&2 echo "TinderboxPrint: documentation
heap write hazard analysis failures, visit \"Inspect Task\" link for hazard details" diff --git a/third_party/rust/cssparser-macros/.cargo-checksum.json b/third_party/rust/cssparser-macros/.cargo-checksum.json index 8279deeec016..da4ef0d78dca 100644 --- a/third_party/rust/cssparser-macros/.cargo-checksum.json +++ b/third_party/rust/cssparser-macros/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"e740a473ab5e2339d639a86f1996b1ecc72f25b25f23b2789c836bff1455cf5a","lib.rs":"2b54cf96da2049eb03e4b30a223124e7f5a9c067975d54ec0ecf92f0245777a1"},"package":"b8f0415de0bdbce823c0db204e00a62c8240fa2d3e04cd13ff7c6396e4446b95"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"3080a72e897022e23ede1dd38cf28049e74a077518cc25d91f559c3b575aa3e3","lib.rs":"17331a3a0b0be3c05fe360e08538baf26b343ae61feec9062429a34a1c1eb1e2"},"package":"079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"} \ No newline at end of file diff --git a/third_party/rust/cssparser-macros/Cargo.toml b/third_party/rust/cssparser-macros/Cargo.toml index 3dd61a72fbb5..4770b4b11f63 100644 --- a/third_party/rust/cssparser-macros/Cargo.toml +++ b/third_party/rust/cssparser-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser-macros" -version = "0.2.0" +version = "0.3.0" authors = ["Simon Sapin "] description = "Procedural macros for cssparser" documentation = "https://docs.rs/cssparser-macros/" diff --git a/third_party/rust/cssparser-macros/lib.rs b/third_party/rust/cssparser-macros/lib.rs index 1e6f359037cf..80d3e545743c 100644 --- a/third_party/rust/cssparser-macros/lib.rs +++ b/third_party/rust/cssparser-macros/lib.rs @@ -27,15 +27,7 @@ define_proc_macros! { max_len(arms.iter().flat_map(|arm| &arm.pats).filter_map(|pattern| { let expr = match *pattern { syn::Pat::Lit(ref expr) => expr, - syn::Pat::Wild | - syn::Pat::Ident(_, _, None) => return None, - syn::Pat::Ident(_, _, Some(ref sub_pattern)) => { - match **sub_pattern { - syn::Pat::Lit(ref expr) => expr, - syn::Pat::Wild => return None, - _ => panic!("expected string or wildcard pattern, got {:?}", pattern) - } - } + syn::Pat::Wild => return None, _ => panic!("expected string or wildcard pattern, got {:?}", pattern) }; match **expr { @@ -62,7 +54,7 @@ define_proc_macros! { /// and the corresponding value as a const expression. /// /// Output: a rust-phf map, with keys ASCII-lowercased: - /// ``` + /// ```text /// static MAP: &'static ::cssparser::phf::Map<&'static str, $ValueType> = …; /// ``` #[allow(non_snake_case)] diff --git a/third_party/rust/cssparser/.cargo-checksum.json b/third_party/rust/cssparser/.cargo-checksum.json index d4734f77816a..027529f13d9d 100644 --- a/third_party/rust/cssparser/.cargo-checksum.json +++ b/third_party/rust/cssparser/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"e32812a8f09b0c5b0b972e2e090f8929eb5b600a37ca7aac2ed07ba10c30291e",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"410baf41d446e2e281eabe0c52a0b094b457dbb5d7c096fcfbd6ce4e5e01b998","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"9afe084d70a5d9396674a2624012d6ac749df35f81e322d2d75b042bf208f523","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/big-data-url.css":"04a8f6197ea1181123bca48bd1ebd016268e1da40f01b8f21055814e44bf62b8","src/color.rs":"09249793df09c51ce0f2a8eabae85405cfdbd8c23330bb121f8b61665df853fd","src/css-parsing-tests/An+B.json":"d24559c1dad55d3da9d1fca29383edefdfc6046988435d6388a9bc0f28850257","src/css-parsing-tests/LICENSE":"5f9019a92f4aa8917aadc8e035aa673c2c1bf08d5ca2e535a0564106599f44eb","src/css-parsing-tests/README.rst":"775c5f957dd1d46d3ce954aaad219c821d2b64b4a9fb93c42e9737a11131ca44","src/css-parsing-tests/color3.json":"5104348cc58a10d113ad4c20f05bdba846ecb4920ee606203fe5d28a6a9f0a13","src/css-parsing-tests/color3_hsl.json":"88936185b3ead36f8613372bf595024073d7787adbf659a62446789a2504b59f","src/css-parsing-tests/color3_keywords.json":"95609bf9fe762c316878a30f371fa375a2e51c21a6fda24fa188a95cd9118f5c","src/css-parsing-tests/component_value_list.json":"dda7244eb3a4fcf6d296762e285f7031028837d987065a09e584e8d973edc7f3","src/css-parsing-tests/declaration_list.json":"0b85cc3f19e945f838432acbfb9edb003abea13debc4ea27bcdcef25d117eac5","src/css-parsing-tests/make_color3_hsl.py":"6297d9fb7b23875ccf99111a56a8e971a37c4206d7d6782001e95a7194fa6182","src/css-parsing-tests/make_color3_keywords.py":"66bccab3f1dea18698fcfd854be79b1fd1cd724dd487e25b1f057b522163aad2","src/css-parsing-tests/one_component_value.json":"8798017709002e14cf11e203c9d716f82d308ce6ba0f6e64ee4eea331b8485c6","src/css-parsing-tests/one_declaration.json":"a34c9da56edfff9e2e21615f059e141b0e878e90f794dc8fa58d65b47cd193ed","src/css-parsing-tests/one_rule.json":"88f7b1b6049be88e1e2827673b75fc9261986b216e8ee6bf09621fecbe274e3c","src/css-parsing-tests/rule_list.json":"97c45e80fb83abef149a4016c5625a74f053e7ad70a2ce5a95c02fce1c195686","src/css-parsing-tests/stylesheet.json":"05f1e10fc486bfbda2c059c313a74ff78c0063c0768b99737cab41969c0c87ce","src/css-parsing-tests/stylesheet_bytes.json":"890fd856a596e61f82cf7ed77920ffe95df89209fdb5ee0afe0b26bdfdb80a42","src/css-parsing-tests/urange.json":"90a0348cb785f8761d956458880486136de75f2c7ce44ec66da233f73d9098bf","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"ccc0f04541147d4fb90d3fe70591bacfb0c7030706c9be8fa60b80533e522bbc","src/macros.rs":"bd492479eee8c65850bdfc2c9de100eddc224e5d6629cd583219058901cd0ca7","src/nth.rs":"0a5e68bd8a597403e184ebf34e69230ae1e955f92b16b99b3f67cf8730a180a9","src/parser.rs":"a41b1d885389d34b4d81176f844ae3c4100e621628dd50d7348c42b08cdd13ae","src/rules_and_declarations.rs":"6b66a986e411a56998546ab0e64de5285df3368d7c4018c7230a1b6cf6bcc532","src/serializer.rs":"480043750508944fb75295d8638b6b33665273a2ac5791ec8261ae1fe63c0fcd","src/tests.rs":"80e4fec507258fe4e63a590f842f3213b44418cd69d755f78f938894966037db","src/tokenizer.rs":"945c29ff9f4a79d58aee956e27c8b476068859d878ead7c7fed83a9e89d2159f","src/unicode_range.rs":"fa0198eb00a68cd71d009551194a3f6d2cb0501513b77d9ea2fea22bfa45c141"},"package":"fb067f9d88368ca9053aea00581556151ef96f2591e32ad44f3312d7e6b67392"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"0b944a5f5edfe3dca4796907e63f537a0e919630df66dca7945d51ba4e3c8051",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"a6a5eab45b7398c4930ad529f4bf3f77b70fd4a3ea8c82fff5bb93ae305eacf9","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"9afe084d70a5d9396674a2624012d6ac749df35f81e322d2d75b042bf208f523","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/big-data-url.css":"04a8f6197ea1181123bca48bd1ebd016268e1da40f01b8f21055814e44bf62b8","src/color.rs":"0751c51a39a2d5d03dd5c41405bafc791eb12b508b7347d3a48ebddd97b67ba3","src/css-parsing-tests/An+B.json":"d24559c1dad55d3da9d1fca29383edefdfc6046988435d6388a9bc0f28850257","src/css-parsing-tests/LICENSE":"5f9019a92f4aa8917aadc8e035aa673c2c1bf08d5ca2e535a0564106599f44eb","src/css-parsing-tests/README.rst":"775c5f957dd1d46d3ce954aaad219c821d2b64b4a9fb93c42e9737a11131ca44","src/css-parsing-tests/color3.json":"6a09e71e7095374a6b44b9cb4341b7f675afe66a93427c62a9a0ff5f8c20ac6f","src/css-parsing-tests/color3_hsl.json":"88936185b3ead36f8613372bf595024073d7787adbf659a62446789a2504b59f","src/css-parsing-tests/color3_keywords.json":"95609bf9fe762c316878a30f371fa375a2e51c21a6fda24fa188a95cd9118f5c","src/css-parsing-tests/component_value_list.json":"dda7244eb3a4fcf6d296762e285f7031028837d987065a09e584e8d973edc7f3","src/css-parsing-tests/declaration_list.json":"0b85cc3f19e945f838432acbfb9edb003abea13debc4ea27bcdcef25d117eac5","src/css-parsing-tests/make_color3_hsl.py":"d7c3533f5f7158da10fa5c34ae5e1bd2b3b0da5d2ca90c16b6cd76f310f22941","src/css-parsing-tests/make_color3_keywords.py":"66bccab3f1dea18698fcfd854be79b1fd1cd724dd487e25b1f057b522163aad2","src/css-parsing-tests/one_component_value.json":"8798017709002e14cf11e203c9d716f82d308ce6ba0f6e64ee4eea331b8485c6","src/css-parsing-tests/one_declaration.json":"a34c9da56edfff9e2e21615f059e141b0e878e90f794dc8fa58d65b47cd193ed","src/css-parsing-tests/one_rule.json":"88f7b1b6049be88e1e2827673b75fc9261986b216e8ee6bf09621fecbe274e3c","src/css-parsing-tests/rule_list.json":"97c45e80fb83abef149a4016c5625a74f053e7ad70a2ce5a95c02fce1c195686","src/css-parsing-tests/stylesheet.json":"05f1e10fc486bfbda2c059c313a74ff78c0063c0768b99737cab41969c0c87ce","src/css-parsing-tests/stylesheet_bytes.json":"890fd856a596e61f82cf7ed77920ffe95df89209fdb5ee0afe0b26bdfdb80a42","src/css-parsing-tests/urange.json":"62720b143ddf52508baad42921473dd69519aad6c1cd49f37f3f264dc29e1c13","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"ccc0f04541147d4fb90d3fe70591bacfb0c7030706c9be8fa60b80533e522bbc","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"0a5e68bd8a597403e184ebf34e69230ae1e955f92b16b99b3f67cf8730a180a9","src/parser.rs":"a41b1d885389d34b4d81176f844ae3c4100e621628dd50d7348c42b08cdd13ae","src/rules_and_declarations.rs":"6b66a986e411a56998546ab0e64de5285df3368d7c4018c7230a1b6cf6bcc532","src/serializer.rs":"480043750508944fb75295d8638b6b33665273a2ac5791ec8261ae1fe63c0fcd","src/tests.rs":"80e4fec507258fe4e63a590f842f3213b44418cd69d755f78f938894966037db","src/tokenizer.rs":"945c29ff9f4a79d58aee956e27c8b476068859d878ead7c7fed83a9e89d2159f","src/unicode_range.rs":"f1f1dee3cc4efb6647557c6166aa5a93354fc0ee9beba53c1d63427beffe5a8d"},"package":"b39404c5e04492194e3c69f1a10964b980f2c95c884a940f7903446779f6b027"} \ No newline at end of file diff --git a/third_party/rust/cssparser/.gitignore b/third_party/rust/cssparser/.gitignore index 7cbe84a5e21e..0b837eae334b 100644 --- a/third_party/rust/cssparser/.gitignore +++ b/third_party/rust/cssparser/.gitignore @@ -1,3 +1,3 @@ -/target +target /Cargo.lock /.cargo/config diff --git a/third_party/rust/cssparser/Cargo.toml b/third_party/rust/cssparser/Cargo.toml index 74b4a006e7a3..ba3cd60de85f 100644 --- a/third_party/rust/cssparser/Cargo.toml +++ b/third_party/rust/cssparser/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cssparser" -version = "0.12.2" +version = "0.13.1" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3" @@ -20,7 +20,7 @@ difference = "1.0" encoding_rs = "0.5" [dependencies] -cssparser-macros = {path = "./macros", version = "0.2"} +cssparser-macros = {path = "./macros", version = "0.3"} heapsize = {version = "0.3", optional = true} matches = "0.1" phf = "0.7" diff --git a/third_party/rust/cssparser/src/color.rs b/third_party/rust/cssparser/src/color.rs index a1e2a4962376..d6a44d1f6cbd 100644 --- a/third_party/rust/cssparser/src/color.rs +++ b/third_party/rust/cssparser/src/color.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::cmp; use std::fmt; use std::f32::consts::PI; @@ -31,7 +30,12 @@ impl RGBA { /// clamped to the 0.0 ... 1.0 range. #[inline] pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self { - Self::new(clamp_f32(red), clamp_f32(green), clamp_f32(blue), clamp_f32(alpha)) + Self::new( + clamp_unit_f32(red), + clamp_unit_f32(green), + clamp_unit_f32(blue), + clamp_unit_f32(alpha), + ) } /// Returns a transparent color. @@ -99,7 +103,7 @@ impl ToCss for RGBA { { // Try first with two decimal places, then with three. let mut rounded_alpha = (self.alpha_f32() * 100.).round() / 100.; - if clamp_f32(rounded_alpha) != self.alpha { + if clamp_unit_f32(rounded_alpha) != self.alpha { rounded_alpha = (self.alpha_f32() * 1000.).round() / 1000.; } @@ -381,12 +385,7 @@ fn parse_color_hash(value: &str) -> Result { } } - -fn clamp_i32(val: i32) -> u8 { - cmp::min(cmp::max(0, val), 255) as u8 -} - -fn clamp_f32(val: f32) -> u8 { +fn clamp_unit_f32(val: f32) -> u8 { // Scale by 256, not 255, so that each of the 256 u8 values has an equal range // of f32 values mapping to it. Floor before clamping. // @@ -394,23 +393,21 @@ fn clamp_f32(val: f32) -> u8 { // `256.0_f32 as u8` is undefined behavior: // // https://github.com/rust-lang/rust/issues/10184 - (val * 256.).floor().max(0.).min(255.) as u8 + clamp_256_f32(val * 256.) +} + +fn clamp_256_f32(val: f32) -> u8 { + val.floor().max(0.).min(255.) as u8 } #[inline] fn parse_color_function(name: &str, arguments: &mut Parser) -> Result { - let is_rgb = match_ignore_ascii_case! { name, - "rgb" | "rgba" => true, - "hsl" | "hsla" => false, + let (red, green, blue, uses_commas) = match_ignore_ascii_case! { name, + "rgb" | "rgba" => parse_rgb_components_rgb(arguments)?, + "hsl" | "hsla" => parse_rgb_components_hsl(arguments)?, _ => return Err(()) }; - let (red, green, blue, uses_commas) = if is_rgb { - parse_rgb_components_rgb(arguments)? - } else { - parse_rgb_components_hsl(arguments)? - }; - let alpha = if !arguments.is_exhausted() { if uses_commas { try!(arguments.expect_comma()); @@ -423,10 +420,10 @@ fn parse_color_function(name: &str, arguments: &mut Parser) -> Result let token = try!(arguments.next()); match token { Token::Number(NumericValue { value: v, .. }) => { - clamp_f32(v) + clamp_unit_f32(v) } Token::Percentage(ref v) => { - clamp_f32(v.unit_value) + clamp_unit_f32(v.unit_value) } _ => { return Err(()) @@ -452,23 +449,23 @@ fn parse_rgb_components_rgb(arguments: &mut Parser) -> Result<(u8, u8, u8, bool) // https://drafts.csswg.org/css-color/#rgb-functions match try!(arguments.next()) { Token::Number(NumericValue { value: v, .. }) => { - red = clamp_i32(v as i32); - green = clamp_i32(match try!(arguments.next()) { + red = clamp_256_f32(v); + green = clamp_256_f32(match try!(arguments.next()) { Token::Number(NumericValue { value: v, .. }) => v, Token::Comma => { uses_commas = true; try!(arguments.expect_number()) } _ => return Err(()) - } as i32); + }); if uses_commas { try!(arguments.expect_comma()); } - blue = clamp_i32(try!(arguments.expect_number()) as i32); + blue = clamp_256_f32(try!(arguments.expect_number())); } Token::Percentage(ref v) => { - red = clamp_f32(v.unit_value); - green = clamp_f32(match try!(arguments.next()) { + red = clamp_unit_f32(v.unit_value); + green = clamp_unit_f32(match try!(arguments.next()) { Token::Percentage(ref v) => v.unit_value, Token::Comma => { uses_commas = true; @@ -479,7 +476,7 @@ fn parse_rgb_components_rgb(arguments: &mut Parser) -> Result<(u8, u8, u8, bool) if uses_commas { try!(arguments.expect_comma()); } - blue = clamp_f32(try!(arguments.expect_percentage())); + blue = clamp_unit_f32(try!(arguments.expect_percentage())); } _ => return Err(()) }; @@ -542,8 +539,8 @@ fn parse_rgb_components_hsl(arguments: &mut Parser) -> Result<(u8, u8, u8, bool) else { lightness + saturation - lightness * saturation }; let m1 = lightness * 2. - m2; let hue_times_3 = hue * 3.; - let red = clamp_f32(hue_to_rgb(m1, m2, hue_times_3 + 1.)); - let green = clamp_f32(hue_to_rgb(m1, m2, hue_times_3)); - let blue = clamp_f32(hue_to_rgb(m1, m2, hue_times_3 - 1.)); + let red = clamp_unit_f32(hue_to_rgb(m1, m2, hue_times_3 + 1.)); + let green = clamp_unit_f32(hue_to_rgb(m1, m2, hue_times_3)); + let blue = clamp_unit_f32(hue_to_rgb(m1, m2, hue_times_3 - 1.)); return Ok((red, green, blue, uses_commas)); } diff --git a/third_party/rust/cssparser/src/css-parsing-tests/color3.json b/third_party/rust/cssparser/src/css-parsing-tests/color3.json index 3a987ccd2269..d018749ac4a7 100644 --- a/third_party/rust/cssparser/src/css-parsing-tests/color3.json +++ b/third_party/rust/cssparser/src/css-parsing-tests/color3.json @@ -253,5 +253,8 @@ "hsl(10.4719755118rad, 75%, 50%)", [32, 32, 224, 255], "hsl(2.6666666666turn, 75%, 50%)", [32, 32, 224, 255], +"rgb(-2147483649, 4294967298, -18446744073709551619) /* https://github.com/w3c/web-platform-tests/blob/master/2dcontext/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.html */", +[0, 255, 0, 255], + "cmyk(0, 0, 0, 0)", null ] diff --git a/third_party/rust/cssparser/src/css-parsing-tests/make_color3_hsl.py b/third_party/rust/cssparser/src/css-parsing-tests/make_color3_hsl.py index c037bc707658..f8e911dfdd69 100644 --- a/third_party/rust/cssparser/src/css-parsing-tests/make_color3_hsl.py +++ b/third_party/rust/cssparser/src/css-parsing-tests/make_color3_hsl.py @@ -2,18 +2,32 @@ import colorsys # It turns out Python already does HSL -> RGB! trim = lambda s: s if not s.endswith('.0') else s[:-2] print('[') print(',\n'.join( - f[0] % ( - (n, h, trim(str(s/10.)), trim(str(l/10.)), - f[1] % round(a / 255., 2) if a is not None else '') - + tuple(trim(str(min(255, v * 256))) - for v in colorsys.hls_to_rgb(h/360., l/1000., s/1000.)) - + (a if a is not None else 255,) + function_format % tuple( + [ + function_name, + hue, + trim(str(saturation / 10.)), + trim(str(lightness / 10.)), + alpha_format % round(alpha / 255., 2) if alpha is not None else '' + ] + [ + trim(str(min(255, component * 256))) + for component in colorsys.hls_to_rgb( + hue / 360., + lightness / 1000., + saturation / 1000. + ) + ] + [ + alpha if alpha is not None else 255 + ] ) - for f in [('"%s(%s, %s%%, %s%%%s)", [%s, %s, %s, %s]', ', %s'), ('"%s(%s %s%% %s%%%s)", [%s, %s, %s, %s]', ' / %s')] - for n in ["hsl", "hsla"] - for a in [None, 255, 64, 0] - for l in range(0, 1001, 125) - for s in range(0, 1001, 125) - for h in range(0, 360, 30) + for function_format, alpha_format in [ + ('"%s(%s, %s%%, %s%%%s)", [%s, %s, %s, %s]', ', %s'), + ('"%s(%s %s%% %s%%%s)", [%s, %s, %s, %s]', ' / %s') + ] + for function_name in ["hsl", "hsla"] + for alpha in [None, 255, 64, 0] + for lightness in range(0, 1001, 125) + for saturation in range(0, 1001, 125) + for hue in range(0, 360, 30) )) print(']') diff --git a/third_party/rust/cssparser/src/css-parsing-tests/urange.json b/third_party/rust/cssparser/src/css-parsing-tests/urange.json index 64fb7f3508be..857d1d62d356 100644 --- a/third_party/rust/cssparser/src/css-parsing-tests/urange.json +++ b/third_party/rust/cssparser/src/css-parsing-tests/urange.json @@ -60,6 +60,10 @@ [0, 4095] ], +"U+4E-9F", [ + [78, 159] +], + "u+20-3F, u+3F-3F, u+3F-3E, U+0-110000, U+0-10FFFF, U+100000-2, U+1000000-2, U+10-200000", [ [32, 63], [63, 63], diff --git a/third_party/rust/cssparser/src/macros.rs b/third_party/rust/cssparser/src/macros.rs index 6b75d46b6ba3..f3b80f09add3 100644 --- a/third_party/rust/cssparser/src/macros.rs +++ b/third_party/rust/cssparser/src/macros.rs @@ -22,7 +22,7 @@ define_invoke_proc_macro!(cssparser_internal__invoke_proc_macro); /// "rgba" => parse_rgba(..), /// "hsl" => parse_hsl(..), /// "hsla" => parse_hsla(..), -/// name @ _ => Err(format!("unknown function: {}", name)) +/// _ => Err(format!("unknown function: {}", function_name)) /// } /// # ;} /// # use std::ops::RangeFull; @@ -82,7 +82,7 @@ macro_rules! ascii_case_insensitive_phf_map { ascii_case_insensitive_phf_map!($name -> $ValueType = { $( $key => $value, )* }) }; ($name: ident -> $ValueType: ty = { $( $key: expr => $value: expr, )* }) => { - fn $name(input: &str) -> Option<&'static $ValueType> { + pub fn $name(input: &str) -> Option<&'static $ValueType> { cssparser_internal__invoke_proc_macro! { cssparser_internal__phf_map!( ($ValueType) $( $key ($value) )+ ) } diff --git a/third_party/rust/cssparser/src/unicode_range.rs b/third_party/rust/cssparser/src/unicode_range.rs index f13a1ad2cca4..6a6dc02242af 100644 --- a/third_party/rust/cssparser/src/unicode_range.rs +++ b/third_party/rust/cssparser/src/unicode_range.rs @@ -8,8 +8,7 @@ use {Parser, ToCss}; use std::char; use std::cmp; use std::fmt; -use std::io::{self, Write}; -use tokenizer::{Token, NumericValue}; +use tokenizer::Token; /// One contiguous range of code points. /// @@ -35,22 +34,15 @@ impl UnicodeRange { // u '+' '?'+ input.expect_ident_matching("u")?; + let after_u = input.position(); + parse_tokens(input)?; - // Since start or end can’t be above 0x10FFFF, they can’t have more than 6 hex digits - // Conversely, input with more digits would end up returning Err anyway. - const MAX_LENGTH_AFTER_U_PLUS: usize = 6 + 1 + 6; // 6 digits, '-', 6 digits - let mut buffer = [0; MAX_LENGTH_AFTER_U_PLUS]; + // This deviates from the spec in case there are CSS comments + // between tokens in the middle of one , + // but oh well… + let concatenated_tokens = input.slice_from(after_u); - let remaining_len; - { - let mut remaining = &mut buffer[..]; - concatenate_tokens(input, &mut remaining)?; - remaining_len = remaining.len(); - } - - let text_len = buffer.len() - remaining_len; - let text = &buffer[..text_len]; - let range = parse_concatenated(text)?; + let range = parse_concatenated(concatenated_tokens.as_bytes())?; if range.end > char::MAX as u32 || range.start > range.end { Err(()) } else { @@ -59,93 +51,52 @@ impl UnicodeRange { } } -fn concatenate_tokens(input: &mut Parser, remaining: &mut &mut [u8]) -> Result<(), Error> { +fn parse_tokens(input: &mut Parser) -> Result<(), ()> { match input.next_including_whitespace()? { Token::Delim('+') => { match input.next_including_whitespace()? { - Token::Ident(ident) => remaining.write_all(ident.as_bytes())?, - Token::Delim('?') => remaining.write_all(b"?")?, - _ => return Err(Error) + Token::Ident(_) => {} + Token::Delim('?') => {} + _ => return Err(()) } - parse_question_marks(input, remaining) + parse_question_marks(input) } - - Token::Dimension(ref value, ref unit) => { - // Require a '+' sign as part of the number - let int_value = positive_integer_with_plus_sign(value)?; - write!(remaining, "{}{}", int_value, unit)?; - parse_question_marks(input, remaining) + Token::Dimension(..) => { + parse_question_marks(input) } - - Token::Number(ref value) => { - // Require a '+' sign as part of the number - let int_value = positive_integer_with_plus_sign(value)?; - write!(remaining, "{}", int_value)?; - + Token::Number(_) => { let after_number = input.position(); match input.next_including_whitespace() { - Ok(Token::Delim('?')) => { - // If `remaining` is already full, `int_value` has too many digits - // so we can use `result?` Rust syntax. - remaining.write_all(b"?")?; - parse_question_marks(input, remaining) - } - - Ok(Token::Dimension(ref value, ref unit)) => { - // Require a '-' sign as part of the number - let int_value = negative_integer(value)?; - write!(remaining, "{}{}", int_value, unit)? - } - - Ok(Token::Number(ref value)) => { - // Require a '-' sign as part of the number - let int_value = negative_integer(value)?; - write!(remaining, "{}", int_value)? - } - + Ok(Token::Delim('?')) => parse_question_marks(input), + Ok(Token::Dimension(..)) => {} + Ok(Token::Number(_)) => {} _ => input.reset(after_number) } } - - _ => return Err(Error) + _ => return Err(()) } Ok(()) } -/// Consume as many '?' as possible and write them to `remaining` until it’s full -fn parse_question_marks(input: &mut Parser, remaining: &mut &mut [u8]) { +/// Consume as many '?' as possible +fn parse_question_marks(input: &mut Parser) { loop { - let result = input.try(|input| { - match input.next_including_whitespace() { - Ok(Token::Delim('?')) => remaining.write_all(b"?").map_err(|_| ()), - _ => Err(()) + let position = input.position(); + match input.next_including_whitespace() { + Ok(Token::Delim('?')) => {} + _ => { + input.reset(position); + return } - }); - if result.is_err() { - return } } } -fn positive_integer_with_plus_sign(value: &NumericValue) -> Result { - let int_value = value.int_value.ok_or(())?; - if value.has_sign && int_value >= 0 { - Ok(int_value) - } else { - Err(()) - } -} - -fn negative_integer(value: &NumericValue) -> Result { // Necessarily had a negative sign. - let int_value = value.int_value.ok_or(())?; - if int_value <= 0 { - Ok(int_value) - } else { - Err(()) - } -} - -fn parse_concatenated(mut text: &[u8]) -> Result { +fn parse_concatenated(text: &[u8]) -> Result { + let mut text = match text.split_first() { + Some((&b'+', text)) => text, + _ => return Err(()) + }; let (first_hex_value, hex_digit_count) = consume_hex(&mut text); let question_marks = consume_question_marks(&mut text); let consumed = hex_digit_count + question_marks; @@ -241,18 +192,3 @@ impl ToCss for UnicodeRange { Ok(()) } } - -/// Make conversions from io::Error implicit in `?` syntax. -struct Error; - -impl From for () { - fn from(_: Error) -> Self { () } -} - -impl From<()> for Error { - fn from(_: ()) -> Self { Error } -} - -impl From for Error { - fn from(_: io::Error) -> Self { Error } -} diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index edd4f3c7093d..ae4ec7a2f387 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -181,10 +181,10 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.12.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -194,7 +194,7 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -302,7 +302,7 @@ name = "geckoservo" version = "0.0.1" dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -687,7 +687,7 @@ name = "selectors" version = "0.18.0" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -767,7 +767,7 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -797,7 +797,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1093,8 +1093,8 @@ dependencies = [ "checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624" "checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f" "checksum core-text 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9719616a10f717628e074744f8c55df7b450f7a34d29c196d14f4498aad05d" -"checksum cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fb067f9d88368ca9053aea00581556151ef96f2591e32ad44f3312d7e6b67392" -"checksum cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f0415de0bdbce823c0db204e00a62c8240fa2d3e04cd13ff7c6396e4446b95" +"checksum cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b39404c5e04492194e3c69f1a10964b980f2c95c884a940f7903446779f6b027" +"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df" "checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" "checksum dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74114b6b49d6731835da7a28a3642651451e315f7f9b9d04e907e65a45681796" diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 7ef88abe827b..263b9b5388d9 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -179,10 +179,10 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.12.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -192,7 +192,7 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -300,7 +300,7 @@ name = "geckoservo" version = "0.0.1" dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -674,7 +674,7 @@ name = "selectors" version = "0.18.0" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -754,7 +754,7 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -784,7 +784,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1080,8 +1080,8 @@ dependencies = [ "checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624" "checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f" "checksum core-text 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9719616a10f717628e074744f8c55df7b450f7a34d29c196d14f4498aad05d" -"checksum cssparser 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fb067f9d88368ca9053aea00581556151ef96f2591e32ad44f3312d7e6b67392" -"checksum cssparser-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f0415de0bdbce823c0db204e00a62c8240fa2d3e04cd13ff7c6396e4446b95" +"checksum cssparser 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b39404c5e04492194e3c69f1a10964b980f2c95c884a940f7903446779f6b027" +"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df" "checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" "checksum dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74114b6b49d6731835da7a28a3642651451e315f7f9b9d04e907e65a45681796" diff --git a/widget/cocoa/OSXNotificationCenter.mm b/widget/cocoa/OSXNotificationCenter.mm index e9e36a96be33..f7fff3df30dd 100644 --- a/widget/cocoa/OSXNotificationCenter.mm +++ b/widget/cocoa/OSXNotificationCenter.mm @@ -161,7 +161,7 @@ public: nsCOMPtr mObserver; nsString mCookie; RefPtr mIconRequest; - id mPendingNotifiction; + id mPendingNotification; }; NS_IMPL_ISUPPORTS0(OSXNotificationInfo) @@ -175,7 +175,7 @@ OSXNotificationInfo::OSXNotificationInfo(NSString *name, nsIObserver *observer, mName = [name retain]; mObserver = observer; mCookie = alertCookie; - mPendingNotifiction = nil; + mPendingNotification = nil; NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -185,7 +185,7 @@ OSXNotificationInfo::~OSXNotificationInfo() NS_OBJC_BEGIN_TRY_ABORT_BLOCK; [mName release]; - [mPendingNotifiction release]; + [mPendingNotification release]; NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -404,7 +404,7 @@ OSXNotificationCenter::ShowAlertWithIconData(nsIAlertNotification* aAlert, } } else { mPendingAlerts.AppendElement(osxni); - osxni->mPendingNotifiction = notification; + osxni->mPendingNotification = notification; // Wait six seconds for the image to load. rv = aAlert->LoadImage(6000, this, osxni, getter_AddRefs(osxni->mIconRequest)); @@ -530,14 +530,14 @@ OSXNotificationCenter::ShowPendingNotification(OSXNotificationInfo *osxni) } } - [GetNotificationCenter() deliverNotification:osxni->mPendingNotifiction]; + [GetNotificationCenter() deliverNotification:osxni->mPendingNotification]; if (osxni->mObserver) { osxni->mObserver->Observe(nullptr, "alertshow", osxni->mCookie.get()); } - [osxni->mPendingNotifiction release]; - osxni->mPendingNotifiction = nil; + [osxni->mPendingNotification release]; + osxni->mPendingNotification = nil; NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -548,7 +548,7 @@ OSXNotificationCenter::OnImageMissing(nsISupports* aUserData) NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; OSXNotificationInfo *osxni = static_cast(aUserData); - if (osxni->mPendingNotifiction) { + if (osxni->mPendingNotification) { // If there was an error getting the image, or the request timed out, show // the notification without a content image. ShowPendingNotification(osxni); @@ -571,13 +571,13 @@ OSXNotificationCenter::OnImageReady(nsISupports* aUserData, } OSXNotificationInfo *osxni = static_cast(aUserData); - if (!osxni->mPendingNotifiction) { + if (!osxni->mPendingNotification) { return NS_ERROR_FAILURE; } NSImage *cocoaImage = nil; nsCocoaUtils::CreateNSImageFromImageContainer(image, imgIContainer::FRAME_FIRST, &cocoaImage, 1.0f); - (osxni->mPendingNotifiction).contentImage = cocoaImage; + (osxni->mPendingNotification).contentImage = cocoaImage; [cocoaImage release]; ShowPendingNotification(osxni); diff --git a/widget/reftests/reftest-stylo.list b/widget/reftests/reftest-stylo.list index 78fe1b539aef..dfbf0c61b5dd 100644 --- a/widget/reftests/reftest-stylo.list +++ b/widget/reftests/reftest-stylo.list @@ -1,6 +1,6 @@ # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing skip-if(!cocoaWidget) == 507947.html 507947.html -fails == progressbar-fallback-default-style.html progressbar-fallback-default-style.html +== progressbar-fallback-default-style.html progressbar-fallback-default-style.html == meter-native-style.html meter-native-style.html fails == meter-vertical-native-style.html meter-vertical-native-style.html fails == meter-fallback-default-style.html meter-fallback-default-style.html diff --git a/xpcom/base/ErrorList.py b/xpcom/base/ErrorList.py index 6f785f63a3ab..8a1b22daa100 100644 --- a/xpcom/base/ErrorList.py +++ b/xpcom/base/ErrorList.py @@ -1064,6 +1064,7 @@ with modules["DOM_PUSH"]: errors["NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE"] = FAILURE(4) errors["NS_ERROR_DOM_PUSH_INVALID_KEY_ERR"] = FAILURE(5) errors["NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR"] = FAILURE(6) + errors["NS_ERROR_DOM_PUSH_GCM_DISABLED"] = FAILURE(7) # =======================================================================