From 6be967c711476801fc1d28067839533479e5670a Mon Sep 17 00:00:00 2001 From: "Francesco Lodolo (:flod)" Date: Mon, 16 Jul 2018 08:44:28 +0200 Subject: [PATCH 01/23] Bug 1475298 - [en-GB] Switch URL to https for Chambers searchplugin r=mkaply MozReview-Commit-ID: 81dG8xbbxdq --HG-- extra : rebase_source : c48b42239231ef0e84e45cafdc3825b6cc0174ff --- browser/components/search/searchplugins/chambers-en-GB.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/search/searchplugins/chambers-en-GB.xml b/browser/components/search/searchplugins/chambers-en-GB.xml index d2487aed2d6b..04467999305f 100644 --- a/browser/components/search/searchplugins/chambers-en-GB.xml +++ b/browser/components/search/searchplugins/chambers-en-GB.xml @@ -7,7 +7,7 @@ Chambers 21st Century Dictionary Search UTF-8 data:image/x-icon;base64,AAABAAIAICAAAAEAIAAsAwAAJgAAABAQAAABACAAPwIAAFIDAACJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAALzSURBVFiF7ddNqBVlHMfxz5nqHpN8y7DyqjTYG2RwQWKCW5uiRRD2CkGbIl1IOxdBGFKgQRgkWC2iRUG1bBG0iUyCopgKJSyNskYjKiz0Kr1crzanxfMYc+fOOZ5z4tQi/6vhef7z/L4zz8v/9/B/j9agL+RJmuAiLMHF8fk3HMWvOJ6VxalKfgttzGRlUQ4NkCfpJbgFt+J6LMeCOPjJKD6Fb7APu7EHV2MLHs/K4ouBAfIknY97sRFrMYaf8DE+ww9YEaHWRrAEJ5Cjg5uxLiuLXfXxzz+L+DiexAOYH7/0ZezEl1lZnKzkjuHKmLsBl+K22N3BqiaNrgB5kq7E87gjftEMnsXTWVmcqOdnZTGD/XmSPoH38AwmYnerm1bSRXwxtlfE4U1sbxKvgfwZf/V6fF7purwvgLjKN+KeSv9RPJeVxVQv8RrIHjyGI7FpvC8ArIkAY5W2D/Bpv+KVeBuvoMSKPEnbPQHi1z9o9oLpYFdWFn8Mqp6VxWm8hINYink9AYQtdLvZ23Ma+wcVr8S3eEc4tBacDeAGrK61TeH7YdXj6fcCNuHnen99a9xo9twTtt/0sAAR4gAONPX9/Qfi/F/2T4SGieoUtLHyvwTodlq1ceG/AdDBqYacRUKxGTnANL5ryJmHa0YOkJVFB4caclq4KU/SC0YKEOMj/N6QN2nu+TASgL2a9+s47oz2aqQAv+AtoXjU8x425FrIk7SVJ+lknqRX9ASI6+B1fN0wzlXYHL3CoDEpOKm7egLEOIgd5q6FFu7HtjxJl/WjmifpWJ6k6/Ci4B3fqOc0zmk0ok/hEXNrw2m8i634JFqxpvcn8JBgaA9hQ1YWe/sCiIMsxOYIMaeMCk5nt2BWvoptqwQbPiE45CV4H5uaxHsCRIg27sOjglM6ryGtI7hlwrF9ZsxjeE3wkV3LeT/3gpZQpO4WfOJ1WNwFZgY/Cn/mVXxYte5DAdRgFgoH0rVCjViOZcKtqBAW2j4crl7PzkWv+AufXtBu3nNrKQAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAgZJREFUOI2Nk7FrU1EUxn/n3PdSFYOCowX7koY4FAdbkUKFig5OIojF1UVwFbcKxsH/QF3sII4RRJwEhSpoadJYHSpYrEYDIlSDUCvSJu8eh7ynaQziN9zpnu9+3+/eC10ykDI4/k/ye0mHBQxgkWhfSzkpWM6QQLB1RJcs3nhohIUMwbuDrHwxEO0drmp0eVNZwuyEiCya2GMPP73ZNTSzrCr3Nmnn+6ao6NDNuhasqtH13rzPKGbnJXr0WvNWIToCUAanZVCAqsud24W7sEr7g3qZBqgxGhpojdFwguXvmDu9jm+YkwLAmdR9jsHtFY1evdVhq2h0O3XvTlBjNOykzF2s6NCVdE/QYRAeAkY2MAwa/ZCP8aIFYF5nMrR2AkyBDwBCZ7nA1FnnPtpb4nWpA3tlDVhL2FkngbEtJSmwG+BuHwMBsz/kDRKAJnyOMTwGJgeSBL5flV4pQBDryxhrtjvW48/JjwjYLJNBTwUnYMnpAqAGOsb7Bsj9AYQQ2RGqTQMc5Um7DM6SgwTiOQb3LrjoPGmFq6m7d6Uf+HoGQbGz8xrdeEMxOwWxJHWqQe6Yk+COh28AJVBJoqmAXyAqesfMgMlEFqVJ/BXjqSFqYvsFAi9cGo/rD0qgJfDdn0kFvDEZ1NzHU97kOGbDCHswVk1sVnzr1mE+NdO9fxFNu/5LvS/0F8COyR9a0q7OAAAAAElFTkSuQmCC - + From 74a2266627f47d7b6081964d53d08dc4123766c7 Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Tue, 17 Jul 2018 09:32:30 +0200 Subject: [PATCH 02/23] Bug 1472080 - Make Enter always autocomplete the selected result; r=bgrins. This patch ensure that we have a consistent behavior when the autocomplete popup is open and the user hit Enter. We remove the autocompletePopupNavigated property which is now useless. We also make sure that we always show the popup when we have at least one result (previously we needed to have 2 results to make it visible). This is again for consistency sake and making it more obvious for the user what will happen when hitting Enter or Tab. Tests are modified to reflect these new behaviors. MozReview-Commit-ID: 8QgoeU6DNk6 --HG-- extra : rebase_source : 5f62365ffaa46e12997d81bb8fe71c79f8178eb7 --- .../client/webconsole/components/JSTerm.js | 71 +++++-------------- ...rm_autocomplete_return_key_no_selection.js | 11 +-- .../mochitest/browser_jsterm_completion.js | 3 + 3 files changed, 26 insertions(+), 59 deletions(-) diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index b257e9b4848a..662056aa00f3 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -129,14 +129,6 @@ class JSTerm extends Component { */ this.lastInputValue = ""; - /** - * Tells if the autocomplete popup was navigated since the last open. - * - * @private - * @type boolean - */ - this._autocompletePopupNavigated = false; - this.autocompletePopup = null; this.inputNode = null; this.completeNode = null; @@ -192,9 +184,9 @@ class JSTerm extends Component { return "CodeMirror.Pass"; } - if (this._autocompletePopupNavigated && - this.autocompletePopup.isOpen && - this.autocompletePopup.selectedIndex > -1 + if ( + this.autocompletePopup.isOpen + && this.autocompletePopup.selectedIndex > -1 ) { return this.acceptProposedCompletion(); } @@ -231,9 +223,6 @@ class JSTerm extends Component { let inputUpdated; if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_BACKWARD); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else if (this.canCaretGoPrevious()) { inputUpdated = this.historyPeruse(HISTORY_BACK); } @@ -248,9 +237,6 @@ class JSTerm extends Component { let inputUpdated; if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_FORWARD); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else if (this.canCaretGoNext()) { inputUpdated = this.historyPeruse(HISTORY_FORWARD); } @@ -271,12 +257,9 @@ class JSTerm extends Component { "Right": () => { const haveSuggestion = this.autocompletePopup.isOpen || this.lastCompletion.value; - const useCompletion = - this.canCaretGoNext() || this._autocompletePopupNavigated; if ( haveSuggestion && - useCompletion && this.complete(this.COMPLETE_HINT_ONLY) && this.lastCompletion.value && this.acceptProposedCompletion() @@ -334,9 +317,7 @@ class JSTerm extends Component { "PageUp": () => { if (this.autocompletePopup.isOpen) { - if (this.complete(this.COMPLETE_PAGEUP)) { - this._autocompletePopupNavigated = true; - } + this.complete(this.COMPLETE_PAGEUP); return null; } @@ -345,9 +326,7 @@ class JSTerm extends Component { "PageDown": () => { if (this.autocompletePopup.isOpen) { - if (this.complete(this.COMPLETE_PAGEDOWN)) { - this._autocompletePopupNavigated = true; - } + this.complete(this.COMPLETE_PAGEDOWN); return null; } @@ -845,7 +824,7 @@ class JSTerm extends Component { break; case KeyCodes.DOM_VK_RETURN: - if (this._autocompletePopupNavigated && + if ( this.autocompletePopup.isOpen && this.autocompletePopup.selectedIndex > -1) { this.acceptProposedCompletion(); @@ -858,9 +837,6 @@ class JSTerm extends Component { case KeyCodes.DOM_VK_UP: if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_BACKWARD); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else if (this.canCaretGoPrevious()) { inputUpdated = this.historyPeruse(HISTORY_BACK); } @@ -872,9 +848,6 @@ class JSTerm extends Component { case KeyCodes.DOM_VK_DOWN: if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_FORWARD); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else if (this.canCaretGoNext()) { inputUpdated = this.historyPeruse(HISTORY_FORWARD); } @@ -886,9 +859,6 @@ class JSTerm extends Component { case KeyCodes.DOM_VK_PAGE_UP: if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_PAGEUP); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else { this.hud.outputScroller.scrollTop = Math.max(0, @@ -902,9 +872,6 @@ class JSTerm extends Component { case KeyCodes.DOM_VK_PAGE_DOWN: if (this.autocompletePopup.isOpen) { inputUpdated = this.complete(this.COMPLETE_PAGEDOWN); - if (inputUpdated) { - this._autocompletePopupNavigated = true; - } } else { this.hud.outputScroller.scrollTop = Math.min(this.hud.outputScroller.scrollHeight, @@ -944,17 +911,13 @@ class JSTerm extends Component { break; case KeyCodes.DOM_VK_RIGHT: - const cursorAtTheEnd = this.inputNode.selectionStart == - this.inputNode.selectionEnd && - this.inputNode.selectionStart == - inputValue.length; - const haveSuggestion = this.autocompletePopup.isOpen || - this.lastCompletion.value; - const useCompletion = cursorAtTheEnd || this._autocompletePopupNavigated; - if (haveSuggestion && useCompletion && - this.complete(this.COMPLETE_HINT_ONLY) && - this.lastCompletion.value && - this.acceptProposedCompletion()) { + const haveSuggestion = this.autocompletePopup.isOpen || this.lastCompletion.value; + if ( + haveSuggestion && + this.complete(this.COMPLETE_HINT_ONLY) && + this.lastCompletion.value && + this.acceptProposedCompletion() + ) { event.preventDefault(); } if (this.autocompletePopup.isOpen) { @@ -1301,7 +1264,7 @@ class JSTerm extends Component { value: inputValue, matchProp: lastPart, }; - if (items.length > 1 && !popup.isOpen) { + if (items.length > 0 && !popup.isOpen) { let popupAlignElement; let xOffset; let yOffset; @@ -1321,12 +1284,11 @@ class JSTerm extends Component { if (popupAlignElement) { popup.openPopup(popupAlignElement, xOffset, yOffset); - this._autocompletePopupNavigated = false; } - } else if (items.length < 2 && popup.isOpen) { + } else if (items.length === 0 && popup.isOpen) { popup.hidePopup(); - this._autocompletePopupNavigated = false; } + if (items.length == 1) { popup.selectedIndex = 0; } @@ -1381,7 +1343,6 @@ class JSTerm extends Component { this.focus(); }); this.autocompletePopup.hidePopup(); - this._autocompletePopupNavigated = false; } } } diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js index 11e77c872a57..f7542f96abdf 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key_no_selection.js @@ -50,15 +50,18 @@ async function performTests() { info("press Return and wait for popup to hide"); const onPopUpClose = popup.once("popup-closed"); - executeSoon(() => EventUtils.synthesizeKey("KEY_Enter")); + EventUtils.synthesizeKey("KEY_Enter"); await onPopUpClose; ok(!popup.isOpen, "popup is not open after KEY_Enter"); - is(jsterm.getInputValue(), "", "inputNode is empty after KEY_Enter"); + is(jsterm.getInputValue(), "window.testBugA", + "input was completed with the first item of the popup"); ok(!getJsTermCompletionValue(jsterm), "completeNode is empty"); + EventUtils.synthesizeKey("KEY_Enter"); + is(jsterm.getInputValue(), "", "input is empty after KEY_Enter"); + const state = ui.consoleOutput.getStore().getState(); const entries = getHistoryEntries(state); - is(entries[entries.length - 1], "window.testBug", - "jsterm history is correct"); + is(entries[entries.length - 1], "window.testBugA", "jsterm history is correct"); } diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js index 79c4aef94123..3d55ea8abc73 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js @@ -19,11 +19,14 @@ add_task(async function() { async function performTests() { const {jsterm, ui} = await openNewTabAndConsole(TEST_URI); + const {autocompletePopup} = jsterm; // Test typing 'docu'. await jstermSetValueAndComplete(jsterm, "docu"); is(jsterm.getInputValue(), "docu", "'docu' completion (input.value)"); checkJsTermCompletionValue(jsterm, " ment", "'docu' completion (completeNode)"); + is(autocompletePopup.items.length, 1, "autocomplete popup has 1 item"); + ok(autocompletePopup.isOpen, "autocomplete popup is open with 1 item"); // Test typing 'docu' and press tab. await jstermSetValueAndComplete(jsterm, "docu", undefined, jsterm.COMPLETE_FORWARD); From 8d7c4afeb3649acedce083f5aa1e863abcfc37d3 Mon Sep 17 00:00:00 2001 From: Johannes Willbold Date: Wed, 11 Jul 2018 10:49:17 -0700 Subject: [PATCH 03/23] Bug 1474711: Added C++/Rust glue code for rtcp-fb transport-cc, r=bwc Added the C++/Rust glue code for the rtcp-fb transport-cc type. Extended the C++ unit test CheckRtcpFb Extended the Rust unit tests for rtcp-fb. MozReview-Commit-ID: 26hAexM0QeV --HG-- extra : rebase_source : 1615700ac62ee5d61a26ad7234d42b82e4151109 --- media/webrtc/signaling/gtest/sdp_unittests.cpp | 13 ++++++++++++- media/webrtc/signaling/src/sdp/SdpAttribute.h | 5 ++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/media/webrtc/signaling/gtest/sdp_unittests.cpp b/media/webrtc/signaling/gtest/sdp_unittests.cpp index 8c17ab2b2287..cf9b7cf4497a 100644 --- a/media/webrtc/signaling/gtest/sdp_unittests.cpp +++ b/media/webrtc/signaling/gtest/sdp_unittests.cpp @@ -3050,6 +3050,7 @@ const std::string kBasicAudioVideoDataOffer = "a=rtcp-fb:97 nack pli" CRLF "a=rtcp-fb:97 ccm fir" CRLF "a=rtcp-fb:* ccm tmmbr" CRLF +"a=rtcp-fb:120 transport-cc" CRLF "a=setup:actpass" CRLF "a=rtcp-mux" CRLF "m=application 9 DTLS/SCTP 5000" CRLF @@ -3136,7 +3137,13 @@ TEST_P(NewSdpTest, CheckRtcpFb) { auto& video_attrs = mSdp->GetMediaSection(1).GetAttributeList(); ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kRtcpFbAttribute)); auto& rtcpfbs = video_attrs.GetRtcpFb().mFeedbacks; - ASSERT_EQ(20U, rtcpfbs.size()); + + if (IsParsingWithSipccParser()) { + ASSERT_EQ(20U, rtcpfbs.size()); + } else { + ASSERT_EQ(21U, rtcpfbs.size()); + } + CheckRtcpFb(rtcpfbs[0], "120", SdpRtcpFbAttributeList::kAck, "rpsi"); CheckRtcpFb(rtcpfbs[1], "120", SdpRtcpFbAttributeList::kAck, "app", "foo"); CheckRtcpFb(rtcpfbs[2], "120", SdpRtcpFbAttributeList::kNack, ""); @@ -3157,6 +3164,10 @@ TEST_P(NewSdpTest, CheckRtcpFb) { CheckRtcpFb(rtcpfbs[17], "97", SdpRtcpFbAttributeList::kNack, "pli"); CheckRtcpFb(rtcpfbs[18], "97", SdpRtcpFbAttributeList::kCcm, "fir"); CheckRtcpFb(rtcpfbs[19], "*", SdpRtcpFbAttributeList::kCcm, "tmmbr"); + + if (!IsParsingWithSipccParser()) { + CheckRtcpFb(rtcpfbs[20], "120", SdpRtcpFbAttributeList::kTransCC, ""); + } } TEST_P(NewSdpTest, CheckRtcp) { diff --git a/media/webrtc/signaling/src/sdp/SdpAttribute.h b/media/webrtc/signaling/src/sdp/SdpAttribute.h index ba319a44472d..725d9d57004a 100644 --- a/media/webrtc/signaling/src/sdp/SdpAttribute.h +++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h @@ -1062,7 +1062,7 @@ class SdpRtcpFbAttributeList : public SdpAttribute public: SdpRtcpFbAttributeList() : SdpAttribute(kRtcpFbAttribute) {} - enum Type { kAck, kApp, kCcm, kNack, kTrrInt, kRemb }; + enum Type { kAck, kApp, kCcm, kNack, kTrrInt, kRemb, kTransCC }; static const char* pli; static const char* sli; @@ -1116,6 +1116,9 @@ inline std::ostream& operator<<(std::ostream& os, case SdpRtcpFbAttributeList::kRemb: os << "goog-remb"; break; + case SdpRtcpFbAttributeList::kTransCC: + os << "transport-cc"; + break; default: MOZ_ASSERT(false); os << "?"; From 46aa6eadb7e0e5d4befe4795f4dbe79f1881a486 Mon Sep 17 00:00:00 2001 From: ahillier Date: Fri, 13 Jul 2018 14:30:35 -0700 Subject: [PATCH 04/23] Bug 1471350: Add Jexl transforms for ASRouter topFrecentSites targeting r=k88hudson,mythmon MozReview-Commit-ID: E48oxYmfAAv --HG-- extra : rebase_source : 899ded7eaa6f90798eaeaf36980a764378e8ccfd --- .../components/utils/FilterExpressions.jsm | 22 ++++++ .../utils/test/unit/test_FilterExpressions.js | 79 +++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/toolkit/components/utils/FilterExpressions.jsm b/toolkit/components/utils/FilterExpressions.jsm index b137045ca6be..ee10e93fda3a 100644 --- a/toolkit/components/utils/FilterExpressions.jsm +++ b/toolkit/components/utils/FilterExpressions.jsm @@ -22,6 +22,8 @@ XPCOMUtils.defineLazyGetter(this, "jexl", () => { preferenceIsUserSet: PreferenceFilters.preferenceIsUserSet, preferenceExists: PreferenceFilters.preferenceExists, keys, + length, + mapToProperty }); jexl.addBinaryOp("intersect", 40, operatorIntersect); return jexl; @@ -48,6 +50,26 @@ function keys(obj) { return Object.keys(obj); } +/** + * Return the length of an array + * @param {Array} arr + * @return {number} + */ +function length(arr) { + return Array.isArray(arr) ? arr.length : undefined; +} + +/** + * Given an input array and property name, return an array with each element of + * the original array replaced with the given property of that element. + * @param {Array} arr + * @param {string} prop + * @return {Array} + */ +function mapToProperty(arr, prop) { + return Array.isArray(arr) ? arr.map(elem => elem[prop]) : undefined; +} + /** * Find all the values that are present in both lists. Returns undefined if * the arguments are not both Arrays. diff --git a/toolkit/components/utils/test/unit/test_FilterExpressions.js b/toolkit/components/utils/test/unit/test_FilterExpressions.js index aaef4722ce6f..08ba524af9a3 100644 --- a/toolkit/components/utils/test/unit/test_FilterExpressions.js +++ b/toolkit/components/utils/test/unit/test_FilterExpressions.js @@ -158,6 +158,85 @@ add_task(async function testKeys() { equal(pong, 2, "Properties are not reifed"); }); +add_task(async function testLength() { + equal( + await FilterExpressions.eval("[1, null, {a: 2, b: 3}, Infinity]|length"), + 4, + "length returns the length of the array it's applied to" + ); + + equal( + await FilterExpressions.eval("[]|length"), + 0, + "length is zero for an empty array" + ); + + // Should be undefined for non-Arrays + equal( + await FilterExpressions.eval("5|length"), + undefined, + "length is undefined when applied to numbers" + ); + equal( + await FilterExpressions.eval("null|length"), + undefined, + "length is undefined when applied to null" + ); + equal( + await FilterExpressions.eval("undefined|length"), + undefined, + "length is undefined when applied to undefined" + ); + equal( + await FilterExpressions.eval("{a: 1, b: 2, c: 3}|length"), + undefined, + "length is undefined when applied to non-Array objects" + ); +}); + +add_task(async function testMapToProperty() { + Assert.deepEqual( + await FilterExpressions.eval('[{a: 1}, {a: {b: 10}}, {a: [5,6,7,8]}]|mapToProperty("a")'), + [1, {b: 10}, [5, 6, 7, 8]], + "mapToProperty returns an array of values when applied to an array of objects all with the property defined" + ); + + Assert.deepEqual( + await FilterExpressions.eval('[]|mapToProperty("a")'), + [], + "mapToProperty returns an empty array when applied to an empty array" + ); + + Assert.deepEqual( + await FilterExpressions.eval('[{a: 1}, {b: 2}, {a: 3}]|mapToProperty("a")'), + [1, undefined, 3], + "mapToProperty returns an array with undefined entries where the property is undefined" + ); + + // Should be undefined for non-Arrays + equal( + await FilterExpressions.eval('5|mapToProperty("a")'), + undefined, + "mapToProperty returns undefined when applied numbers" + ); + equal( + await FilterExpressions.eval('null|mapToProperty("a")'), + undefined, + "mapToProperty returns undefined when applied null" + ); + equal( + await FilterExpressions.eval('undefined|mapToProperty("a")'), + undefined, + "mapToProperty returns undefined when applied undefined" + ); + equal( + await FilterExpressions.eval('{a: 1, b: 2, c: 3}|mapToProperty("a")'), + undefined, + "mapToProperty returns undefined when applied non-Array objects" + ); +}); + + // intersect tests add_task(async function testIntersect() { let val; From f5a293984db402f7904734778b8f2f4d5647b34b Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Tue, 17 Jul 2018 16:53:03 +0100 Subject: [PATCH 05/23] Bug 1476322 - Make browser_parsable_css.js parse more types of rules. r=jaws MozReview-Commit-ID: HZmMUEJsROz --HG-- extra : rebase_source : 00fd2dd98397375d596677f8025012e8ad3d48bc --- .../content/test/static/browser_parsable_css.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index bc7595bd633b..1f55346acd7b 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -120,16 +120,12 @@ let propNameWhitelist = [ platforms: ["win", "macosx"], isFromDevTools: false}, - // These properties *are* actually referenced. Need to find why - // their reference isn't getting counted. + // These variables are used in a shorthand, but the CSS parser deletes the values + // when expanding the shorthands. See https://github.com/w3c/csswg-drafts/issues/2515 {propName: "--bezier-diagonal-color", isFromDevTools: true}, {propName: "--bezier-grid-color", isFromDevTools: true}, - - // Bug 1476322 - Doesn't parse CSSKeyframeRules - {propName: "--tracking-protection-shield-color", - isFromDevTools: false}, ]; // Add suffix to stylesheets' URI so that we always load them here and @@ -256,15 +252,15 @@ let customPropsToReferencesMap = new Map(); function processCSSRules(sheet) { for (let rule of sheet.cssRules) { - if (rule instanceof CSSMediaRule) { + if (rule instanceof CSSConditionRule || rule instanceof CSSKeyframesRule) { processCSSRules(rule); continue; } - if (!(rule instanceof CSSStyleRule)) + if (!(rule instanceof CSSStyleRule) && !(rule instanceof CSSKeyframeRule)) continue; // Extract urls from the css text. - // Note: CSSStyleRule.cssText always has double quotes around URLs even + // Note: CSSRule.cssText always has double quotes around URLs even // when the original CSS file didn't. let urls = rule.cssText.match(/url\("[^"]*"\)/g); // Extract props by searching all "--" preceeded by "var(" or a non-word From 104efdacd0de141e7ef7dbea6bbf3fc1658f167f Mon Sep 17 00:00:00 2001 From: Johannes Willbold Date: Mon, 16 Jul 2018 12:20:06 -0700 Subject: [PATCH 06/23] Bug 1476081: Removed two leftover debugging statements, r=dminor Removed two leftover debugging statements MozReview-Commit-ID: 7Cbsa2MJ2OS --HG-- extra : rebase_source : dd5125022c842ac8db17000976d25f5108cb4fe6 --- media/webrtc/signaling/src/sdp/RsdparsaSdp.cpp | 1 - media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/media/webrtc/signaling/src/sdp/RsdparsaSdp.cpp b/media/webrtc/signaling/src/sdp/RsdparsaSdp.cpp index d36d4c6d7d8b..413fb33db83c 100644 --- a/media/webrtc/signaling/src/sdp/RsdparsaSdp.cpp +++ b/media/webrtc/signaling/src/sdp/RsdparsaSdp.cpp @@ -91,7 +91,6 @@ RsdparsaSdp::AddMediaSection(SdpMediaSection::MediaType mediaType, protocol,addrType,rustAddr); if (NS_SUCCEEDED(nr)) { - std::cout << "Hello World" << std::endl; size_t level = mMediaSections.values.size(); RsdparsaSessionHandle newSessHandle(sdp_new_reference(mSession.get())); diff --git a/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs b/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs index 20e460ac333a..e9de855b6add 100644 --- a/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs +++ b/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs @@ -159,7 +159,6 @@ pub unsafe extern "C" fn sdp_add_media_section(session: *mut SdpSession, 38 => SdpProtocolValue::UdpDtlsSctp, // Protocol::kUdpDtlsSctp 39 => SdpProtocolValue::TcpDtlsSctp, // Protocol::kTcpDtlsSctp _ => { - println!("INVALID PROTOCOL"); return NS_ERROR_INVALID_ARG; } }; From df91e88f35b0df5a8be28160077dcdfbf5c2ca9b Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Tue, 17 Jul 2018 07:59:45 +0000 Subject: [PATCH 07/23] Bug 1476103 - Remove nsNavHistory::invalidateFrecencies since it's now unused. r=mak Differential Revision: https://phabricator.services.mozilla.com/D2170 --HG-- extra : moz-landing-system : lando --- toolkit/components/places/nsNavHistory.cpp | 76 ------------------- toolkit/components/places/nsNavHistory.h | 10 --- .../tests/unit/test_frecency_observers.js | 10 +-- 3 files changed, 5 insertions(+), 91 deletions(-) diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 1e1cf689834e..450ae72fbec0 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -928,82 +928,6 @@ nsNavHistory::hasHistoryEntries() } -namespace { - -class InvalidateAllFrecenciesCallback : public AsyncStatementCallback -{ -public: - InvalidateAllFrecenciesCallback() - { - } - - NS_IMETHOD HandleCompletion(uint16_t aReason) override - { - if (aReason == REASON_FINISHED) { - nsNavHistory *navHistory = nsNavHistory::GetHistoryService(); - NS_ENSURE_STATE(navHistory); - navHistory->NotifyManyFrecenciesChanged(); - } - return NS_OK; - } -}; - -} // namespace - -nsresult -nsNavHistory::invalidateFrecencies(const nsCString& aPlaceIdsQueryString) -{ - // Exclude place: queries by setting their frecency to zero. - nsCString invalidFrecenciesSQLFragment( - "UPDATE moz_places SET frecency = " - ); - if (!aPlaceIdsQueryString.IsEmpty()) - invalidFrecenciesSQLFragment.AppendLiteral("NOTIFY_FRECENCY("); - invalidFrecenciesSQLFragment.AppendLiteral( - "(CASE " - "WHEN url_hash BETWEEN hash('place', 'prefix_lo') AND " - "hash('place', 'prefix_hi') " - "THEN 0 " - "ELSE -1 " - "END) " - ); - if (!aPlaceIdsQueryString.IsEmpty()) { - invalidFrecenciesSQLFragment.AppendLiteral( - ", url, guid, hidden, last_visit_date) " - ); - } - invalidFrecenciesSQLFragment.AppendLiteral( - "WHERE frecency > 0 " - ); - if (!aPlaceIdsQueryString.IsEmpty()) { - invalidFrecenciesSQLFragment.AppendLiteral("AND id IN("); - invalidFrecenciesSQLFragment.Append(aPlaceIdsQueryString); - invalidFrecenciesSQLFragment.Append(')'); - } - RefPtr cb = - aPlaceIdsQueryString.IsEmpty() ? new InvalidateAllFrecenciesCallback() - : nullptr; - - nsCOMPtr stmt = mDB->GetAsyncStatement( - invalidFrecenciesSQLFragment - ); - NS_ENSURE_STATE(stmt); - - nsCOMPtr ps; - nsresult rv = stmt->ExecuteAsync(cb, getter_AddRefs(ps)); - NS_ENSURE_SUCCESS(rv, rv); - - // Trigger frecency updates for affected origins. - nsCOMPtr updateOriginFrecenciesStmt = - mDB->GetAsyncStatement("DELETE FROM moz_updateoriginsupdate_temp"); - NS_ENSURE_STATE(updateOriginFrecenciesStmt); - rv = updateOriginFrecenciesStmt->ExecuteAsync(nullptr, getter_AddRefs(ps)); - NS_ENSURE_SUCCESS(rv, rv); - - return NS_OK; -} - - // Call this method before visiting a URL in order to help determine the // transition type of the visit. // diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index 13a3b7fe39cc..618a1d9593b6 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -172,16 +172,6 @@ public: */ nsresult UpdateFrecency(int64_t aPlaceId); - /** - * Invalidate the frecencies of a list of places, so they will be recalculated - * at the first idle-daily notification. - * - * @param aPlacesIdsQueryString - * Query string containing list of places to be invalidated. If it's - * an empty string all places will be invalidated. - */ - nsresult invalidateFrecencies(const nsCString& aPlaceIdsQueryString); - /** * These functions return non-owning references to the locale-specific * objects for places components. diff --git a/toolkit/components/places/tests/unit/test_frecency_observers.js b/toolkit/components/places/tests/unit/test_frecency_observers.js index 0b37f5e098ba..643bd05d542e 100644 --- a/toolkit/components/places/tests/unit/test_frecency_observers.js +++ b/toolkit/components/places/tests/unit/test_frecency_observers.js @@ -28,9 +28,9 @@ add_task(async function test_nsNavHistory_UpdateFrecency() { await promise; }); -// nsNavHistory::invalidateFrecencies for particular pages -add_task(async function test_nsNavHistory_invalidateFrecencies_somePages() { - let url = Services.io.newURI("http://test-nsNavHistory-invalidateFrecencies-somePages.com/"); +// History.jsm invalidateFrecencies() +add_task(async function test_invalidateFrecencies() { + let url = Services.io.newURI("http://test-invalidateFrecencies.com/"); // Bookmarking the URI is enough to add it to moz_places, and importantly, it // means that removeByFilter doesn't remove it from moz_places, so its // frecency is able to be changed. @@ -44,8 +44,8 @@ add_task(async function test_nsNavHistory_invalidateFrecencies_somePages() { await promise; }); -// nsNavHistory::invalidateFrecencies for all pages -add_task(async function test_nsNavHistory_invalidateFrecencies_allPages() { +// History.jsm clear() +add_task(async function test_clear() { await Promise.all([onManyFrecenciesChanged(), PlacesUtils.history.clear()]); }); From 82e51211f8855cf0422e3f44012645ca4b7a2144 Mon Sep 17 00:00:00 2001 From: Petru Lingurar Date: Mon, 16 Jul 2018 18:54:26 +0300 Subject: [PATCH 08/23] Bug 1460074 - Still cannot switch between years in date picker; r=jchen The problem stemmed from having the DatePicker inside a ScrollView which was receiving the swipe events. To avoid this I've created the new FocusableDatePicker which has the ability to prevent it's parent from receiving touch events. MozReview-Commit-ID: 6VntjE5A0ec --HG-- extra : rebase_source : 1c8d93e033c6cd37524b11b9ac70cc604af41a25 --- .../mozilla/gecko/prompts/PromptInput.java | 4 +- .../gecko/widget/FocusableDatePicker.java | 49 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 mobile/android/base/java/org/mozilla/gecko/widget/FocusableDatePicker.java diff --git a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java index 4f9fc7323f24..51d6fc82a697 100644 --- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java +++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java @@ -12,6 +12,7 @@ import java.util.GregorianCalendar; import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.util.GeckoBundle; import org.mozilla.gecko.widget.AllCapsTextView; +import org.mozilla.gecko.widget.FocusableDatePicker; import org.mozilla.gecko.widget.DateTimePicker; import android.content.Context; @@ -180,7 +181,8 @@ public abstract class PromptInput { @Override public View getView(Context context) throws UnsupportedOperationException { if (mType.equals("date")) { - DatePicker input = new DatePicker(context); + // FocusableDatePicker allow us to have priority in responding to scroll events. + DatePicker input = new FocusableDatePicker(context); try { if (!TextUtils.isEmpty(mValue)) { GregorianCalendar calendar = new GregorianCalendar(); diff --git a/mobile/android/base/java/org/mozilla/gecko/widget/FocusableDatePicker.java b/mobile/android/base/java/org/mozilla/gecko/widget/FocusableDatePicker.java new file mode 100644 index 000000000000..e8d71ed3f3d3 --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/widget/FocusableDatePicker.java @@ -0,0 +1,49 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.gecko.widget; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ViewParent; +import android.widget.DatePicker; + +/** + * This is based on the platform's {@link DatePicker}.
+ * The only difference is that it will prevent it's parent from receiving touch events. + */ +public class FocusableDatePicker extends DatePicker { + public FocusableDatePicker(Context context) { + super(context); + } + + public FocusableDatePicker(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public FocusableDatePicker(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @SuppressLint("NewApi") + public FocusableDatePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + ViewParent parentView = getParent(); + + if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) { + if (parentView != null) { + parentView.requestDisallowInterceptTouchEvent(true); + } + } + + return false; + } +} From 9dd417a6d302d4a2f23d2060983ca640ce846d50 Mon Sep 17 00:00:00 2001 From: Petru Lingurar Date: Mon, 16 Jul 2018 11:34:38 +0300 Subject: [PATCH 09/23] Bug 1474925 - TimePicker swipe not possible in landscape; r=jchen MozReview-Commit-ID: DVp6d40OLE3 --HG-- extra : rebase_source : 1d26806fcd4a6974ee647ae2120f41d98c4e2cd1 --- .../mozilla/gecko/prompts/PromptInput.java | 4 +- .../gecko/widget/FocusableTimePicker.java | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java diff --git a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java index 51d6fc82a697..05e8b759618d 100644 --- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java +++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java @@ -14,6 +14,7 @@ import org.mozilla.gecko.util.GeckoBundle; import org.mozilla.gecko.widget.AllCapsTextView; import org.mozilla.gecko.widget.FocusableDatePicker; import org.mozilla.gecko.widget.DateTimePicker; +import org.mozilla.gecko.widget.FocusableTimePicker; import android.content.Context; import android.content.res.Configuration; @@ -210,7 +211,8 @@ public abstract class PromptInput { DateTimePicker.PickersState.WEEK, mMinValue, mMaxValue); mView = (View)input; } else if (mType.equals("time")) { - TimePicker input = new TimePicker(context); + // FocusableDatePicker allow us to have priority in responding to scroll events. + TimePicker input = new FocusableTimePicker(context); input.setIs24HourView(DateFormat.is24HourFormat(context)); GregorianCalendar calendar = new GregorianCalendar(); diff --git a/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java b/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java new file mode 100644 index 000000000000..ddead79be156 --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java @@ -0,0 +1,47 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.gecko.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.ViewParent; +import android.widget.TimePicker; + +/** + * This is based on the platform's {@link TimePicker}.
+ * The only difference is that it will prevent it's parent from receiving touch events. + */ +public class FocusableTimePicker extends TimePicker { + public FocusableTimePicker(Context context) { + super(context); + } + + public FocusableTimePicker(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public FocusableTimePicker(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public FocusableTimePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + ViewParent parentView = getParent(); + + if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) { + if (parentView != null) { + parentView.requestDisallowInterceptTouchEvent(true); + } + } + + return false; + } +} From d76c41e21031496aef6fdbc5e74b7d0ac2387468 Mon Sep 17 00:00:00 2001 From: Andreea Pavel Date: Tue, 17 Jul 2018 22:02:45 +0300 Subject: [PATCH 10/23] Backed out changeset 5bac5fa077ea (bug 1474925) for failing lint on a CLOSED TREE --- .../mozilla/gecko/prompts/PromptInput.java | 4 +- .../gecko/widget/FocusableTimePicker.java | 47 ------------------- 2 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java diff --git a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java index 05e8b759618d..51d6fc82a697 100644 --- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java +++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java @@ -14,7 +14,6 @@ import org.mozilla.gecko.util.GeckoBundle; import org.mozilla.gecko.widget.AllCapsTextView; import org.mozilla.gecko.widget.FocusableDatePicker; import org.mozilla.gecko.widget.DateTimePicker; -import org.mozilla.gecko.widget.FocusableTimePicker; import android.content.Context; import android.content.res.Configuration; @@ -211,8 +210,7 @@ public abstract class PromptInput { DateTimePicker.PickersState.WEEK, mMinValue, mMaxValue); mView = (View)input; } else if (mType.equals("time")) { - // FocusableDatePicker allow us to have priority in responding to scroll events. - TimePicker input = new FocusableTimePicker(context); + TimePicker input = new TimePicker(context); input.setIs24HourView(DateFormat.is24HourFormat(context)); GregorianCalendar calendar = new GregorianCalendar(); diff --git a/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java b/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java deleted file mode 100644 index ddead79be156..000000000000 --- a/mobile/android/base/java/org/mozilla/gecko/widget/FocusableTimePicker.java +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.widget; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.ViewParent; -import android.widget.TimePicker; - -/** - * This is based on the platform's {@link TimePicker}.
- * The only difference is that it will prevent it's parent from receiving touch events. - */ -public class FocusableTimePicker extends TimePicker { - public FocusableTimePicker(Context context) { - super(context); - } - - public FocusableTimePicker(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public FocusableTimePicker(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public FocusableTimePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - public boolean onInterceptTouchEvent(MotionEvent ev) { - ViewParent parentView = getParent(); - - if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) { - if (parentView != null) { - parentView.requestDisallowInterceptTouchEvent(true); - } - } - - return false; - } -} From f5b27fe2bee91929adce9c371e20d8db93fbc6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tudor-Gabriel=20V=C3=AEjial=C4=83?= Date: Fri, 13 Jul 2018 15:02:21 +0100 Subject: [PATCH 11/23] Bug 1334940 - Re-enable SCCACHE for linux64-ccov. r=ted MozReview-Commit-ID: 6BQt984Rl39 --HG-- extra : rebase_source : b92e2bd0daab858f49eefd1b07dd251346524649 --- taskcluster/ci/build/linux.yml | 2 ++ taskcluster/scripts/misc/build-sccache.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index e6ea81ddd43a..7eaab993b6bf 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -973,6 +973,7 @@ linux64-ccov/debug: - linux64-clang - linux64-rust - linux64-gcc + - linux64-sccache linux64-ccov/opt: description: "Linux64-CCov Opt" @@ -1002,6 +1003,7 @@ linux64-ccov/opt: - linux64-clang - linux64-rust - linux64-gcc + - linux64-sccache linux64-add-on-devel/opt: description: "Linux64 add-on-devel" diff --git a/taskcluster/scripts/misc/build-sccache.sh b/taskcluster/scripts/misc/build-sccache.sh index ab00472ff2a8..dfb72ec6ca15 100755 --- a/taskcluster/scripts/misc/build-sccache.sh +++ b/taskcluster/scripts/misc/build-sccache.sh @@ -1,8 +1,8 @@ #!/bin/bash set -x -e -v -# 0.2.6 + a few fixes -SCCACHE_REVISION=9f4c18b4a6300e3a9250a09811cc985311c20217 +# 0.2.7 + --coverage suppport +SCCACHE_REVISION=1ab9a33e8d328941acc23c74c949b765f975f309 # This script is for building sccache From 48e892f643eb44eee22dcec3849a835d0dc1ba79 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Sun, 15 Jul 2018 18:00:26 +0200 Subject: [PATCH 12/23] Bug 1475714 - Remove webextension code for legacy 18x18 icons r=mixedpuppy MozReview-Commit-ID: CNU1c7IA3Hn --HG-- extra : rebase_source : 6dfb48b079415601113c69d923dfb73a8425fb45 --- .../extensions/parent/ext-browserAction.js | 52 +++++-------------- ...owser_ext_browserAction_pageAction_icon.js | 6 --- .../components/extensions/ext-pageAction.js | 2 +- .../components/extensions/ExtensionParent.jsm | 2 +- 4 files changed, 16 insertions(+), 46 deletions(-) diff --git a/browser/components/extensions/parent/ext-browserAction.js b/browser/components/extensions/parent/ext-browserAction.js index 65cb83d67099..75d55bcfdf23 100644 --- a/browser/components/extensions/parent/ext-browserAction.js +++ b/browser/components/extensions/parent/ext-browserAction.js @@ -458,14 +458,7 @@ this.browserAction = class extends ExtensionAPI { node.removeAttribute("badgeStyle"); } - let {style, legacy} = this.iconData.get(tabData.icon); - const LEGACY_CLASS = "toolbarbutton-legacy-addon"; - if (legacy) { - node.classList.add(LEGACY_CLASS); - } else { - node.classList.remove(LEGACY_CLASS); - } - + let style = this.iconData.get(tabData.icon); node.setAttribute("style", style); }; if (sync) { @@ -476,47 +469,30 @@ this.browserAction = class extends ExtensionAPI { } getIconData(icons) { - let baseSize = 16; - let {icon, size} = IconDetails.getPreferredIcon(icons, this.extension, baseSize); - - let legacy = false; - - // If the best available icon size is not divisible by 16, check if we have - // an 18px icon to fall back to, and trim off the padding instead. - if (size % 16 && typeof icon === "string" && !icon.endsWith(".svg")) { - let result = IconDetails.getPreferredIcon(icons, this.extension, 18); - - if (result.size % 18 == 0) { - baseSize = 18; - icon = result.icon; - legacy = true; - } - } - - let getIcon = (size, theme) => { - let {icon} = IconDetails.getPreferredIcon(icons, this.extension, size); + let getIcon = (icon, theme) => { if (typeof icon === "object") { return IconDetails.escapeUrl(icon[theme]); } return IconDetails.escapeUrl(icon); }; - let getStyle = (name, size) => { + let getStyle = (name, icon) => { return ` - --webextension-${name}: url("${getIcon(size, "default")}"); - --webextension-${name}-light: url("${getIcon(size, "light")}"); - --webextension-${name}-dark: url("${getIcon(size, "dark")}"); + --webextension-${name}: url("${getIcon(icon, "default")}"); + --webextension-${name}-light: url("${getIcon(icon, "light")}"); + --webextension-${name}-dark: url("${getIcon(icon, "dark")}"); `; }; - let style = ` - ${getStyle("menupanel-image", 32)} - ${getStyle("menupanel-image-2x", 64)} - ${getStyle("toolbar-image", baseSize)} - ${getStyle("toolbar-image-2x", baseSize * 2)} + let icon16 = IconDetails.getPreferredIcon(icons, this.extension, 16).icon; + let icon32 = IconDetails.getPreferredIcon(icons, this.extension, 32).icon; + let icon64 = IconDetails.getPreferredIcon(icons, this.extension, 64).icon; + return ` + ${getStyle("menupanel-image", icon32)} + ${getStyle("menupanel-image-2x", icon64)} + ${getStyle("toolbar-image", icon16)} + ${getStyle("toolbar-image-2x", icon32)} `; - - return {style, legacy}; } /** diff --git a/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js b/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js index 5a35afdf8228..b02c208d3a86 100644 --- a/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_pageAction_icon.js @@ -111,7 +111,6 @@ add_task(async function testDetailsObjects() { // Various resolutions {details: {"path": {"18": "a.png", "36": "a-x2.png"}}, - legacy: true, resolutions: { "1": browser.runtime.getURL("data/a.png"), "2": browser.runtime.getURL("data/a-x2.png")}}, @@ -139,7 +138,6 @@ add_task(async function testDetailsObjects() { "36": "36.png", "48": "48.png", "128": "128.png"}}, - legacy: true, resolutions: { "1": browser.runtime.getURL("data/18.png"), "2": browser.runtime.getURL("data/36.png")}, @@ -206,7 +204,6 @@ add_task(async function testDetailsObjects() { for (let [idx, icon] of iconDetails.entries()) { tests.push({ index: idx, - legacy: !!icon.legacy, menuResolutions: icon.menuResolutions, resolutions: icon.resolutions, }); @@ -289,9 +286,6 @@ add_task(async function testDetailsObjects() { is(getListStyleImage(browserActionButton), imageURL, `browser action has the correct image at ${resolution}x resolution`); is(getListStyleImage(pageActionImage), imageURL, `page action has the correct image at ${resolution}x resolution`); - let isLegacy = browserActionButton.classList.contains("toolbarbutton-legacy-addon"); - is(isLegacy, test.legacy, "Legacy class should be present?"); - await SpecialPowers.popPrefEnv(); } diff --git a/mobile/android/components/extensions/ext-pageAction.js b/mobile/android/components/extensions/ext-pageAction.js index cbb5c93ad165..770d2e955eca 100644 --- a/mobile/android/components/extensions/ext-pageAction.js +++ b/mobile/android/components/extensions/ext-pageAction.js @@ -169,7 +169,7 @@ class PageAction extends EventEmitter { // Bug 1372783: Why is this contentWindow.devicePixelRatio, while // convertImageURLToDataURL uses browserWindow.devicePixelRatio? let {icon} = IconDetails.getPreferredIcon(this.defaults.icons, this.extension, - 18 * contentWindow.devicePixelRatio); + 16 * contentWindow.devicePixelRatio); let browserWindow = Services.wm.getMostRecentWindow("navigator:browser"); return IconDetails.convertImageURLToDataURL(icon, contentWindow, browserWindow).then(dataURI => { diff --git a/toolkit/components/extensions/ExtensionParent.jsm b/toolkit/components/extensions/ExtensionParent.jsm index 0131492832e3..27ab136c3b5a 100644 --- a/toolkit/components/extensions/ExtensionParent.jsm +++ b/toolkit/components/extensions/ExtensionParent.jsm @@ -1517,7 +1517,7 @@ let IconDetails = { return {size, icon: DEFAULT}; }, - convertImageURLToDataURL(imageURL, contentWindow, browserWindow, size = 18) { + convertImageURLToDataURL(imageURL, contentWindow, browserWindow, size = 16) { return new Promise((resolve, reject) => { let image = new contentWindow.Image(); image.onload = function() { From 91d1f8bd84549b129552f150b5ddf80c6f82f3fa Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Tue, 17 Jul 2018 18:17:42 +0000 Subject: [PATCH 13/23] Bug 1476358 - Replace while-loop with FindFirstBlock() in WrapFramesInFirstLineFrame(). r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D2193 --HG-- extra : moz-landing-system : lando --- layout/base/nsCSSFrameConstructor.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 25268f6e11ea..5f18dc60f9d6 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10444,9 +10444,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLineFrame( { // Find the part of aFrameItems that we want to put in the first-line nsFrameList::FrameLinkEnumerator link(aFrameItems); - while (!link.AtEnd() && link.NextFrame()->IsInlineOutside()) { - link.Next(); - } + FindFirstBlock(link); nsFrameList firstLineChildren = aFrameItems.ExtractHead(link); From d9ab58bfa9a41487aa0051b64db961b6d6d5d9a6 Mon Sep 17 00:00:00 2001 From: Razvan Caliman Date: Mon, 16 Jul 2018 19:06:06 +0200 Subject: [PATCH 14/23] Bug 1475947 - (Part 1) implement getOwnerGlobalDimensions() on Node actor. r=gl MozReview-Commit-ID: Ij59UBVlCBD --HG-- extra : rebase_source : b4b078106f4abb5e16a1ba7e435e65f13082d163 --- devtools/server/actors/inspector/node.js | 13 +++++++++++++ devtools/shared/specs/node.js | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/devtools/server/actors/inspector/node.js b/devtools/server/actors/inspector/node.js index 3f4c230f4cf2..43d73d7aea89 100644 --- a/devtools/server/actors/inspector/node.js +++ b/devtools/server/actors/inspector/node.js @@ -672,6 +672,19 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, { current = current.parentNode; } return "rgba(255, 255, 255, 1)"; + }, + + /** + * Returns an object with the width and height of the node's owner window. + * + * @return {Object} + */ + getOwnerGlobalDimensions: function() { + const win = this.rawNode.ownerGlobal; + return { + innerWidth: win.innerWidth, + innerHeight: win.innerHeight, + }; } }); diff --git a/devtools/shared/specs/node.js b/devtools/shared/specs/node.js index edd36bc10233..9ef900611cb3 100644 --- a/devtools/shared/specs/node.js +++ b/devtools/shared/specs/node.js @@ -17,6 +17,13 @@ types.addDictType("imageData", { size: "json" }); +types.addDictType("windowDimensions", { + // The window innerWidth + innerWidth: "nullable:number", + // The window innerHeight + innerHeight: "nullable:number", +}); + /** * Returned from any call that might return a node that isn't connected to root * by nodes the child has seen, such as querySelector. @@ -123,6 +130,10 @@ const nodeSpec = generateActorSpec({ value: RetVal("string") } }, + getOwnerGlobalDimensions: { + request: {}, + response: RetVal("windowDimensions") + } } }); From 8103ba1197e56b692b2bfca0a196d3630aca3330 Mon Sep 17 00:00:00 2001 From: Razvan Caliman Date: Mon, 16 Jul 2018 19:08:21 +0200 Subject: [PATCH 15/23] Bug 1475947 - (Part 2) Update font editor unit conversion to use getOwnerGlobalDimensions(). r=gl MozReview-Commit-ID: A9efHXiMs46 --HG-- extra : rebase_source : 5de4e66f6ead40e02f08e6cf8fc742ed2955b120 --- devtools/client/inspector/fonts/fonts.js | 63 ++++++++++-------------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/devtools/client/inspector/fonts/fonts.js b/devtools/client/inspector/fonts/fonts.js index fd7dee624e48..931a39799347 100644 --- a/devtools/client/inspector/fonts/fonts.js +++ b/devtools/client/inspector/fonts/fonts.js @@ -178,8 +178,6 @@ class FontInspector { let out = value; // Computed style for reference node used for conversion of "em", "rem", "%". let computedStyle; - // Raw DOM node of selected element used for conversion of "vh", "vw", "vmin", "vmax". - let rawNode; if (unit === "in") { out = fromPx @@ -233,36 +231,31 @@ class FontInspector { : value * parseFloat(computedStyle["font-size"].value); } - if (unit === "vh") { - rawNode = await node.rawNode(); - out = fromPx - ? value * 100 / rawNode.ownerGlobal.innerHeight - : value / 100 * rawNode.ownerGlobal.innerHeight; - } + if (unit === "vh" || unit === "vw" || unit === "vmin" || unit === "vmax") { + const dim = await node.getOwnerGlobalDimensions(); - if (unit === "vw") { - rawNode = await node.rawNode(); - out = fromPx - ? value * 100 / rawNode.ownerGlobal.innerWidth - : value / 100 * rawNode.ownerGlobal.innerWidth; - } - - if (unit === "vmin") { - rawNode = await node.rawNode(); - out = fromPx - ? value * 100 / Math.min( - rawNode.ownerGlobal.innerWidth, rawNode.ownerGlobal.innerHeight) - : value / 100 * Math.min( - rawNode.ownerGlobal.innerWidth, rawNode.ownerGlobal.innerHeight); - } - - if (unit === "vmax") { - rawNode = await node.rawNode(); - out = fromPx - ? value * 100 / Math.max( - rawNode.ownerGlobal.innerWidth, rawNode.ownerGlobal.innerHeight) - : value / 100 * Math.max( - rawNode.ownerGlobal.innerWidth, rawNode.ownerGlobal.innerHeight); + // The getOwnerGlobalDimensions() method does not exist on the NodeFront API spec + // prior to Firefox 63. In that case, return a 1-to-1 conversion which isn't a + // correct conversion, but doesn't break the font editor either. + if (!dim || !dim.innerWidth || !dim.innerHeight) { + out = value; + } else if (unit === "vh") { + out = fromPx + ? value * 100 / dim.innerHeight + : value / 100 * dim.innerHeight; + } else if (unit === "vw") { + out = fromPx + ? value * 100 / dim.innerWidth + : value / 100 * dim.innerWidth; + } else if (unit === "vmin") { + out = fromPx + ? value * 100 / Math.min(dim.innerWidth, dim.innerHeight) + : value / 100 * Math.min(dim.innerWidth, dim.innerHeight); + } else if (unit === "vmax") { + out = fromPx + ? value * 100 / Math.max(dim.innerWidth, dim.innerHeight) + : value / 100 * Math.max(dim.innerWidth, dim.innerHeight); + } } // Return rounded pixel values. Limit other values to 3 decimals. @@ -728,12 +721,8 @@ class FontInspector { let unit = fromUnit; if (toUnit && fromUnit) { - try { - value = await this.convertUnits(value, fromUnit, toUnit); - unit = toUnit; - } catch (err) { - // Silent error - } + value = await this.convertUnits(value, fromUnit, toUnit); + unit = toUnit; } this.onFontPropertyUpdate(property, value, unit); From 630efc5cec4631d863025d4cbb968142c894ba01 Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Fri, 13 Jul 2018 21:52:33 -0700 Subject: [PATCH 16/23] Bug 1473840: fixed Teredo IPv6 prefix detection. r=mjf MozReview-Commit-ID: 6dRsirith0O --HG-- extra : rebase_source : 2af77d2420464a0b0ba855d94f9cd6e088d2a777 --- media/mtransport/third_party/nICEr/src/net/transport_addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/mtransport/third_party/nICEr/src/net/transport_addr.c b/media/mtransport/third_party/nICEr/src/net/transport_addr.c index 5239714fc326..fffb1f0d3782 100644 --- a/media/mtransport/third_party/nICEr/src/net/transport_addr.c +++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.c @@ -467,7 +467,7 @@ int nr_transport_addr_is_teredo(nr_transport_addr *addr) case NR_IPV6: { UINT4* addrTop = (UINT4*)(addr->u.addr6.sin6_addr.s6_addr); - if ((*addrTop & htonl(0xFFFF0000)) == htonl(0x20010000)) + if ((*addrTop & htonl(0xFFFFFFFF)) == htonl(0x20010000)) return(1); } break; From f94ac37cc829a780918761436e194b075cb2efbc Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Tue, 17 Jul 2018 11:55:49 -0700 Subject: [PATCH 17/23] Bug 1456852 - Programatically create the edit menu in the browser console input;r=nchevobbe This allows us to open the context menu directly from webconsole.html when it's running as a top level window. Ultimately, I'd like to not have to use special handling in the console - all top-level windows should get the edit menu working automatically for HTML inputs - but this lets us prove it out as a first consumer. MozReview-Commit-ID: BYisQDtXWe4 --HG-- extra : rebase_source : 8000147713000a30af48f1da17d50356a4cd4a04 --- devtools/client/framework/menu-item.js | 2 + devtools/client/framework/menu.js | 68 ++++++++--------- .../client/framework/test/browser_menu_api.js | 10 ++- devtools/client/webconsole/browserconsole.xul | 2 + devtools/client/webconsole/components/App.js | 1 + .../client/webconsole/components/JSTerm.js | 16 ++++ devtools/client/webconsole/index.html | 3 + .../browser_console_context_menu_entries.js | 25 +++++++ .../client/webconsole/utils/context-menu.js | 75 +++++++++++++++++++ .../webconsole/webconsole-output-wrapper.js | 12 ++- 10 files changed, 175 insertions(+), 39 deletions(-) diff --git a/devtools/client/framework/menu-item.js b/devtools/client/framework/menu-item.js index 034c78c5c1e7..33e707727e28 100644 --- a/devtools/client/framework/menu-item.js +++ b/devtools/client/framework/menu-item.js @@ -51,6 +51,7 @@ function MenuItem({ accelerator = null, accesskey = null, + l10nID = null, checked = false, click = () => {}, disabled = false, @@ -63,6 +64,7 @@ function MenuItem({ } = { }) { this.accelerator = accelerator; this.accesskey = accesskey; + this.l10nID = l10nID; this.checked = checked; this.click = click; this.disabled = disabled; diff --git a/devtools/client/framework/menu.js b/devtools/client/framework/menu.js index fcc9f02e3411..e34d2c30f1a9 100644 --- a/devtools/client/framework/menu.js +++ b/devtools/client/framework/menu.js @@ -136,26 +136,15 @@ Menu.prototype._createMenuItems = function(parent) { const menu = doc.createElementNS(XUL_NS, "menu"); menu.appendChild(menupopup); - menu.setAttribute("label", item.label); - if (item.disabled) { - menu.setAttribute("disabled", "true"); - } - if (item.accelerator) { - menu.setAttribute("acceltext", item.accelerator); - } - if (item.accesskey) { - menu.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menu.id = item.id; - } + applyItemAttributesToNode(item, menu); parent.appendChild(menu); } else if (item.type === "separator") { const menusep = doc.createElementNS(XUL_NS, "menuseparator"); parent.appendChild(menusep); } else { const menuitem = doc.createElementNS(XUL_NS, "menuitem"); - menuitem.setAttribute("label", item.label); + applyItemAttributesToNode(item, menuitem); + menuitem.addEventListener("command", () => { item.click(); }); @@ -163,28 +152,6 @@ Menu.prototype._createMenuItems = function(parent) { item.hover(); }); - if (item.type === "checkbox") { - menuitem.setAttribute("type", "checkbox"); - } - if (item.type === "radio") { - menuitem.setAttribute("type", "radio"); - } - if (item.disabled) { - menuitem.setAttribute("disabled", "true"); - } - if (item.checked) { - menuitem.setAttribute("checked", "true"); - } - if (item.accelerator) { - menuitem.setAttribute("acceltext", item.accelerator); - } - if (item.accesskey) { - menuitem.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menuitem.id = item.id; - } - parent.appendChild(menuitem); } }); @@ -202,4 +169,33 @@ Menu.buildFromTemplate = () => { throw Error("Not implemented"); }; +function applyItemAttributesToNode(item, node) { + if (item.l10nID) { + node.setAttribute("data-l10n-id", item.l10nID); + } else { + node.setAttribute("label", item.label); + if (item.accelerator) { + node.setAttribute("acceltext", item.accelerator); + } + if (item.accesskey) { + node.setAttribute("accesskey", item.accesskey); + } + } + if (item.type === "checkbox") { + node.setAttribute("type", "checkbox"); + } + if (item.type === "radio") { + node.setAttribute("type", "radio"); + } + if (item.disabled) { + node.setAttribute("disabled", "true"); + } + if (item.checked) { + node.setAttribute("checked", "true"); + } + if (item.id) { + node.id = item.id; + } +} + module.exports = Menu; diff --git a/devtools/client/framework/test/browser_menu_api.js b/devtools/client/framework/test/browser_menu_api.js index 0c1863b2b355..ecc0d9f21f7d 100644 --- a/devtools/client/framework/test/browser_menu_api.js +++ b/devtools/client/framework/test/browser_menu_api.js @@ -65,6 +65,9 @@ async function testMenuPopup(toolbox) { label: "Disabled Item", disabled: true, }), + new MenuItem({ + l10nID: "foo", + }), ]; for (const item of MENU_ITEMS) { @@ -102,6 +105,8 @@ async function testMenuPopup(toolbox) { is(menuItems[3].getAttribute("label"), MENU_ITEMS[3].label, "Correct label"); is(menuItems[3].getAttribute("disabled"), "true", "disabled attr menuitem"); + is(menuItems[4].getAttribute("data-l10n-id"), MENU_ITEMS[4].l10nID, "Correct localization attribute"); + await once(menu, "open"); const closed = once(menu, "close"); EventUtils.synthesizeMouseAtCenter(menuItems[0], {}, toolbox.win); @@ -127,7 +132,7 @@ async function testSubmenu(toolbox) { }, })); menu.append(new MenuItem({ - label: "Submenu parent", + l10nID: "submenu-parent", submenu: submenu, })); menu.append(new MenuItem({ @@ -145,8 +150,9 @@ async function testSubmenu(toolbox) { const menus = toolbox.doc.querySelectorAll("#menu-popup > menu"); is(menus.length, 2, "Correct number of menus"); - is(menus[0].getAttribute("label"), "Submenu parent", "Correct label"); + ok(!menus[0].hasAttribute("label"), "No label: should be set by localization"); ok(!menus[0].hasAttribute("disabled"), "Correct disabled state"); + is(menus[0].getAttribute("data-l10n-id"), "submenu-parent", "Correct localization attribute"); is(menus[1].getAttribute("accesskey"), "A", "Correct accesskey"); ok(menus[1].hasAttribute("disabled"), "Correct disabled state"); diff --git a/devtools/client/webconsole/browserconsole.xul b/devtools/client/webconsole/browserconsole.xul index 6eb6b7cd4f96..6044978ac026 100644 --- a/devtools/client/webconsole/browserconsole.xul +++ b/devtools/client/webconsole/browserconsole.xul @@ -11,6 +11,8 @@ windowtype="devtools:webconsole" width="900" height="350" persist="screenX screenY width height sizemode"> + + diff --git a/devtools/client/webconsole/components/App.js b/devtools/client/webconsole/components/App.js index bdc10421e073..f0f0b41fac7c 100644 --- a/devtools/client/webconsole/components/App.js +++ b/devtools/client/webconsole/components/App.js @@ -163,6 +163,7 @@ class App extends Component { }), JSTerm({ hud, + serviceContainer, onPaste: this.onPaste, codeMirrorEnabled: jstermCodeMirror, }), diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index 662056aa00f3..35faedc68f12 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -70,6 +70,8 @@ class JSTerm extends Component { history: PropTypes.object.isRequired, // Console object. hud: PropTypes.object.isRequired, + // Needed for opening context menu + serviceContainer: PropTypes.object.isRequired, // Handler for clipboard 'paste' event (also used for 'drop' event, callback). onPaste: PropTypes.func, codeMirrorEnabled: PropTypes.bool, @@ -97,6 +99,7 @@ class JSTerm extends Component { this._keyPress = this._keyPress.bind(this); this._inputEventHandler = this._inputEventHandler.bind(this); this._blurEventHandler = this._blurEventHandler.bind(this); + this.onContextMenu = this.onContextMenu.bind(this); this.SELECTED_FRAME = -1; @@ -1467,6 +1470,17 @@ class JSTerm extends Component { .paddingLeft.replace(/[^0-9.]/g, "") - 4; } + onContextMenu(e) { + // The toolbox does it's own edit menu handling with + // toolbox-textbox-context-popup and friends. For now, fall + // back to use that if running inside the toolbox, but use our + // own menu when running in the Browser Console (see Bug 1476097). + if (this.props.hud.isBrowserConsole && + Services.prefs.getBoolPref("devtools.browserconsole.html")) { + this.props.serviceContainer.openEditContextMenu(e); + } + } + destroy() { this.clearCompletion(); @@ -1509,6 +1523,7 @@ class JSTerm extends Component { key: "jsterm-container", style: {direction: "ltr"}, "aria-live": "off", + onContextMenu: this.onContextMenu, ref: node => { this.node = node; }, @@ -1545,6 +1560,7 @@ class JSTerm extends Component { }, onPaste: onPaste, onDrop: onPaste, + onContextMenu: this.onContextMenu, }) ) ); diff --git a/devtools/client/webconsole/index.html b/devtools/client/webconsole/index.html index 2a7ba0ca4696..9bbc4ec3c09e 100644 --- a/devtools/client/webconsole/index.html +++ b/devtools/client/webconsole/index.html @@ -9,6 +9,8 @@ persist="screenX screenY width height sizemode"> + + @@ -18,6 +20,7 @@ + diff --git a/devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js b/devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js index 58c19ba7c30d..5d7a9dd9c917 100644 --- a/devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js +++ b/devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js @@ -11,6 +11,9 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" + add_task(async function() { // Enable net messages in the console for this test. await pushPref("devtools.browserconsole.filter.net", true); + // These are required for testing the text input in the browser console: + await pushPref("devtools.browserconsole.html", true); + await pushPref("devtools.chrome.enabled", true); await addTab(TEST_URI); const hud = await HUDService.toggleBrowserConsole(); @@ -56,6 +59,19 @@ add_task(async function() { is(getSimplifiedContextMenu(menuPopup).join("\n"), expectedContextMenu.join("\n"), "The context menu has the expected entries for a simple log message"); + menuPopup = await openContextMenu(hud, hud.jsterm.inputNode); + + expectedContextMenu = [ + "#editmenu-undo (editmenu-undo) [disabled]", + "#editmenu-cut (editmenu-cut)", + "#editmenu-copy (editmenu-copy)", + "#editmenu-paste (editmenu-paste)", + "#editmenu-delete (editmenu-delete) [disabled]", + "#editmenu-selectAll (editmenu-select-all) [disabled]", + ]; + is(getL10NContextMenu(menuPopup).join("\n"), expectedContextMenu.join("\n"), + "The context menu has the correct edit menu items"); + await hideContextMenu(hud); }); @@ -67,6 +83,15 @@ function addPrefBasedEntries(expectedEntries) { return expectedEntries; } +function getL10NContextMenu(popupElement) { + return [...popupElement.querySelectorAll("menuitem")] + .map(entry => { + const l10nID = entry.getAttribute("data-l10n-id"); + const disabled = entry.hasAttribute("disabled"); + return `#${entry.id} (${l10nID})${disabled ? " [disabled]" : ""}`; + }); +} + function getSimplifiedContextMenu(popupElement) { return [...popupElement.querySelectorAll("menuitem")] .map(entry => { diff --git a/devtools/client/webconsole/utils/context-menu.js b/devtools/client/webconsole/utils/context-menu.js index 7d9658732bde..6a06eccb5e9f 100644 --- a/devtools/client/webconsole/utils/context-menu.js +++ b/devtools/client/webconsole/utils/context-menu.js @@ -181,3 +181,78 @@ function createContextMenu(hud, parentNode, { } exports.createContextMenu = createContextMenu; + +/** + * Return an 'edit' menu for a input field. This integrates directly + * with docshell commands to provide the right enabled state and editor + * functionality. + * + * You'll need to call menu.popup() yourself, this just returns the Menu instance. + * + * @returns {Menu} + */ +function createEditContextMenu() { + const docshell = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + const menu = new Menu({ + id: "webconsole-menu" + }); + menu.append(new MenuItem({ + id: "editmenu-undo", + l10nID: "editmenu-undo", + disabled: !docshell.isCommandEnabled("cmd_undo"), + click: () => { + docshell.doCommand("cmd_undo"); + }, + })); + menu.append(new MenuItem({ + type: "separator" + })); + menu.append(new MenuItem({ + id: "editmenu-cut", + l10nID: "editmenu-cut", + disabled: !docshell.isCommandEnabled("cmd_cut"), + click: () => { + docshell.doCommand("cmd_cut"); + }, + })); + menu.append(new MenuItem({ + id: "editmenu-copy", + l10nID: "editmenu-copy", + disabled: !docshell.isCommandEnabled("cmd_copy"), + click: () => { + docshell.doCommand("cmd_copy"); + }, + })); + menu.append(new MenuItem({ + id: "editmenu-paste", + l10nID: "editmenu-paste", + disabled: !docshell.isCommandEnabled("cmd_paste"), + click: () => { + docshell.doCommand("cmd_paste"); + }, + })); + menu.append(new MenuItem({ + id: "editmenu-delete", + l10nID: "editmenu-delete", + disabled: !docshell.isCommandEnabled("cmd_delete"), + click: () => { + docshell.doCommand("cmd_delete"); + }, + })); + menu.append(new MenuItem({ + type: "separator" + })); + menu.append(new MenuItem({ + id: "editmenu-selectAll", + l10nID: "editmenu-select-all", + disabled: !docshell.isCommandEnabled("cmd_selectAll"), + click: () => { + docshell.doCommand("cmd_selectAll"); + }, + })); + return menu; +} + +exports.createEditContextMenu = createEditContextMenu; diff --git a/devtools/client/webconsole/webconsole-output-wrapper.js b/devtools/client/webconsole/webconsole-output-wrapper.js index 9e24ad631bfe..b4bfe75d08eb 100644 --- a/devtools/client/webconsole/webconsole-output-wrapper.js +++ b/devtools/client/webconsole/webconsole-output-wrapper.js @@ -8,7 +8,7 @@ const ReactDOM = require("devtools/client/shared/vendor/react-dom"); const { Provider } = require("devtools/client/shared/vendor/react-redux"); const actions = require("devtools/client/webconsole/actions/index"); -const { createContextMenu } = require("devtools/client/webconsole/utils/context-menu"); +const { createContextMenu, createEditContextMenu } = require("devtools/client/webconsole/utils/context-menu"); const { configureStore } = require("devtools/client/webconsole/store"); const { isPacketPrivate } = require("devtools/client/webconsole/utils/messages"); const { getAllMessagesById, getMessage } = require("devtools/client/webconsole/selectors/messages"); @@ -160,6 +160,16 @@ WebConsoleOutputWrapper.prototype = { return menu; }; + serviceContainer.openEditContextMenu = (e) => { + const { screenX, screenY } = e; + const menu = createEditContextMenu(); + // Emit the "menu-open" event for testing. + menu.once("open", () => this.emit("menu-open")); + menu.popup(screenX, screenY, { doc: this.owner.chromeWindow.document }); + + return menu; + }; + if (this.toolbox) { Object.assign(serviceContainer, { onViewSourceInDebugger: frame => { From de4cf43a86c919618a64ef0e39c8255d0142d59f Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 17 Jul 2018 20:50:01 +0000 Subject: [PATCH 18/23] Bug 1475196 - [ci] Move 'run-on-projects' to the job-defaults section in taskcluster/ci/talos.yml r=jmaher This refactoring will make it easier to set 'run-on-projects' keys across all talos tasks in one go (rather than needing to modify each task individually). The job-defaults are recursively (and naively) merged into the task definitions, so each task that changes 'run-on-projects' also needs to use the 'by-test-platform' key. Differential Revision: https://phabricator.services.mozilla.com/D2136 --HG-- extra : moz-landing-system : lando --- taskcluster/ci/test/talos.yml | 173 +++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 34 deletions(-) diff --git a/taskcluster/ci/test/talos.yml b/taskcluster/ci/test/talos.yml index 1fbd1144f777..512eb6b77551 100644 --- a/taskcluster/ci/test/talos.yml +++ b/taskcluster/ci/test/talos.yml @@ -32,6 +32,7 @@ talos-bcv: run-on-projects: by-test-platform: .*-qr/.*: [] # this test is not useful with webrender + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] tier: by-test-platform: @@ -49,6 +50,7 @@ talos-bcv-profiling: run-on-projects: by-test-platform: .*-qr/.*: [] # this test is not useful with webrender + windows.*msvc/.*: ['mozilla-central', 'try'] default: ['mozilla-central', 'try'] tier: by-test-platform: @@ -64,7 +66,10 @@ talos-chrome: description: "Talos chrome" try-name: chromez treeherder-symbol: T(c) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -74,7 +79,10 @@ talos-chrome-profiling: description: "Talos profiling chrome" try-name: chromez-profiling treeherder-symbol: T-P(c) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -92,6 +100,7 @@ talos-damp: run-on-projects: by-test-platform: linux64-ccov/.*: ['try'] # Bug 1407593 + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: @@ -101,7 +110,10 @@ talos-damp-profiling: description: "Talos profiling devtools" try-name: damp-profiling treeherder-symbol: T-P(damp) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -112,7 +124,10 @@ talos-dromaeojs: description: "Talos dromaeojs" try-name: dromaeojs treeherder-symbol: T(d) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 2100 mozharness: extra-options: @@ -122,7 +137,10 @@ talos-dromaeojs-profiling: description: "Talos profiling dromaeojs" try-name: dromaeojs-profiling treeherder-symbol: T-P(d) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 2100 mozharness: extra-options: @@ -134,7 +152,10 @@ talos-flex: try-name: flex treeherder-symbol: T(f) tier: 3 - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1800 mozharness: extra-options: @@ -144,7 +165,10 @@ talos-g1: description: "Talos g1" try-name: g1 treeherder-symbol: T(g1) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: by-test-platform: linux64.*: 2700 @@ -157,7 +181,10 @@ talos-g1-profiling: description: "Talos profiling g1" try-name: g1-profiling treeherder-symbol: T-P(g1) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: by-test-platform: linux64.*: 2700 @@ -171,7 +198,10 @@ talos-g3: description: "Talos g3" try-name: g3 treeherder-symbol: T(g3) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 900 mozharness: extra-options: @@ -181,7 +211,10 @@ talos-g3-profiling: description: "Talos profiling g3" try-name: g3-profiling treeherder-symbol: T-P(g3) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 900 mozharness: extra-options: @@ -192,7 +225,10 @@ talos-g4: description: "Talos g4" try-name: g4 treeherder-symbol: T(g4) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: by-test-platform: linux64.*: 1500 @@ -205,7 +241,10 @@ talos-g4-profiling: description: "Talos profiling g4" try-name: g4-profiling treeherder-symbol: T-P(g4) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] mozharness: extra-options: - --suite=g4 @@ -219,7 +258,10 @@ talos-g5: description: "Talos g5" try-name: g5 treeherder-symbol: T(g5) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: - --suite=g5 @@ -232,7 +274,10 @@ talos-g5-profiling: description: "Talos profiling g5" try-name: g5-profiling treeherder-symbol: T-P(g5) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] mozharness: extra-options: - --suite=g5 @@ -246,7 +291,10 @@ talos-h1: description: "Talos h1" try-name: h1 treeherder-symbol: T(h1) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: - --suite=h1 @@ -263,7 +311,10 @@ talos-h2: by-test-platform: linux64.*: 900 default: 7200 - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: - --suite=h2 @@ -272,7 +323,10 @@ talos-motionmark: description: "Talos motionmark" try-name: motionmark treeherder-symbol: T(mm) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 3600 tier: by-test-platform: @@ -287,7 +341,10 @@ talos-motionmark-profiling: description: "Talos profiling motionmark" try-name: motionmark-profiling treeherder-symbol: T-P(mm) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 3600 tier: by-test-platform: @@ -303,7 +360,10 @@ talos-other: description: "Talos other" try-name: other treeherder-symbol: T(o) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1500 mozharness: extra-options: @@ -313,7 +373,10 @@ talos-other-profiling: description: "Talos profiling other" try-name: other-profiling treeherder-symbol: T-P(o) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1500 mozharness: extra-options: @@ -324,7 +387,10 @@ talos-perf-reftest: description: "Talos perf-reftest" try-name: perf-reftest treeherder-symbol: T(p) - run-on-projects: ['mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -334,7 +400,10 @@ talos-perf-reftest-profiling: description: "Talos profiling perf-reftest" try-name: perf-reftest-profiling treeherder-symbol: T-P(p) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -345,7 +414,10 @@ talos-perf-reftest-singletons: description: "Talos perf-reftest singletons" try-name: perf-reftest-singletons treeherder-symbol: T(ps) - run-on-projects: ['mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -355,7 +427,10 @@ talos-perf-reftest-singletons-profiling: description: "Talos profiling perf-reftest singletons" try-name: perf-reftest-singletons-profiling treeherder-symbol: T-P(ps) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -366,7 +441,10 @@ talos-speedometer: description: "Talos speedometer" try-name: speedometer treeherder-symbol: T(sp) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1500 mozharness: extra-options: @@ -376,7 +454,10 @@ talos-speedometer-profiling: description: "Talos profiling speedometer" try-name: speedometer-profiling treeherder-symbol: T-P(sp) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1500 mozharness: extra-options: @@ -387,7 +468,10 @@ talos-svgr: description: "Talos svgr" try-name: svgr treeherder-symbol: T(s) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1800 mozharness: extra-options: @@ -397,7 +481,10 @@ talos-svgr-profiling: description: "Talos profiling svgr" try-name: svgr-profiling treeherder-symbol: T-P(s) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1800 mozharness: extra-options: @@ -408,7 +495,10 @@ talos-tp5o: description: "Talos tp5o" try-name: tp5o treeherder-symbol: T(tp) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1800 mozharness: extra-options: @@ -418,7 +508,10 @@ talos-tp5o-profiling: description: "Talos profiling tp5o" try-name: tp5o-profiling treeherder-symbol: T-P(tp) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1800 mozharness: extra-options: @@ -429,7 +522,10 @@ talos-tp6: description: "Talos tp6" try-name: tp6 treeherder-symbol: T(tp6) - run-on-projects: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -439,7 +535,10 @@ talos-tp6-profiling: description: "Talos profiling tp6" try-name: tp6-profiling treeherder-symbol: T-P(tp6) - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] max-run-time: 1200 mozharness: extra-options: @@ -454,6 +553,7 @@ talos-tp6-stylo-threads: run-on-projects: by-test-platform: macosx.*: ['mozilla-beta', 'autoland', 'try'] + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: @@ -467,6 +567,7 @@ talos-tps: run-on-projects: by-test-platform: linux64-ccov/.*: ['try'] # Bug 1407593 + windows.*msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] default: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] mozharness: extra-options: @@ -477,7 +578,10 @@ talos-tps-profiling: try-name: tps-profiling treeherder-symbol: T-P(tps) max-run-time: 900 - run-on-projects: ['mozilla-central', 'try'] + run-on-projects: + by-test-platform: + windows.*msvc/.*: ['mozilla-central', 'try'] + default: ['mozilla-central', 'try'] mozharness: extra-options: - --suite=tps @@ -490,7 +594,8 @@ talos-xperf: virtualization: virtual run-on-projects: by-test-platform: - windows7-32.*: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] + windows7-32-msvc/.*: ['mozilla-beta', 'mozilla-central', 'try'] + windows7-32(-pgo)?/.*: ['mozilla-beta', 'mozilla-central', 'mozilla-inbound', 'autoland', 'try'] default: [] tier: by-test-platform: From 0a7333067e2684de7677bd76af79f6511c180d66 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 17 Jul 2018 11:18:41 +0000 Subject: [PATCH 19/23] Bug 1475196 - [ci] Stop scheduling test-verify tasks on Windows msvc builds on inbound/autoland r=jmaher Depends on D2137. Differential Revision: https://phabricator.services.mozilla.com/D2138 --HG-- extra : moz-landing-system : lando --- taskcluster/ci/test/misc.yml | 2 ++ taskcluster/ci/test/web-platform.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/taskcluster/ci/test/misc.yml b/taskcluster/ci/test/misc.yml index d45945d6e785..9e3290d47625 100644 --- a/taskcluster/ci/test/misc.yml +++ b/taskcluster/ci/test/misc.yml @@ -104,6 +104,7 @@ test-verify: .*-jsdcov/.*: [] .*-asan/.*: [] # do not run on beta or release: usually just confirms earlier results + .*-msvc/.*: ['mozilla-central', 'try'] default: ['trunk', 'try'] tier: 2 mozharness: @@ -148,6 +149,7 @@ test-verify-gpu: .*-jsdcov/.*: [] .*-asan/.*: [] # do not run on beta or release: usually just confirms earlier results + .*-msvc/.*: ['mozilla-central', 'try'] default: ['trunk', 'try'] tier: 2 mozharness: diff --git a/taskcluster/ci/test/web-platform.yml b/taskcluster/ci/test/web-platform.yml index e403b144641b..0bdbf43fc4ac 100644 --- a/taskcluster/ci/test/web-platform.yml +++ b/taskcluster/ci/test/web-platform.yml @@ -168,6 +168,7 @@ test-verify-wpt: .*-jsdcov/.*: [] .*-asan/.*: [] # do not run on beta or release: usually just confirms earlier results + .*-msvc/.*: ['mozilla-central', 'try'] default: ['trunk', 'try'] tier: 2 mozharness: From 60111bbc337317a2a054db8ddbc40bdec733fde6 Mon Sep 17 00:00:00 2001 From: Mihir Iyer Date: Tue, 26 Jun 2018 14:33:02 -0700 Subject: [PATCH 20/23] Bug 1297774 - Implement safe/unsafe for flexbox 'justify-content' and 'align-{content,self,items}' r=dholbert MozReview-Commit-ID: BHpaSvj5EOW --HG-- extra : rebase_source : b8b9326fb6f439418471b3e972b80ba78efd43ca --- layout/generic/nsFlexContainerFrame.cpp | 41 +++++++++-- ...lexbox-safe-overflow-position-001-ref.html | 73 +++++++++++++++++++ .../flexbox-safe-overflow-position-001.html | 66 +++++++++++++++++ .../w3c-css/submitted/flexbox/reftest.list | 3 + 4 files changed, 175 insertions(+), 8 deletions(-) create mode 100644 layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001-ref.html create mode 100644 layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001.html diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 832f05517d36..4e167341fc82 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -584,7 +584,8 @@ public: WritingMode GetWritingMode() const { return mWM; } - uint8_t GetAlignSelf() const { return mAlignSelf; } + uint8_t GetAlignSelf() const { return mAlignSelf; } + uint8_t GetAlignSelfFlags() const { return mAlignSelfFlags; } // Returns the flex factor (flex-grow or flex-shrink), depending on // 'aIsUsingFlexGrow'. @@ -878,6 +879,7 @@ protected: uint8_t mAlignSelf; // My "align-self" computed value (with "auto" // swapped out for parent"s "align-items" value, // in our constructor). + uint8_t mAlignSelfFlags; // Flags for 'align-self' (safe/unsafe/legacy) }; /** @@ -1941,7 +1943,8 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowInput, mAlignSelf = NS_STYLE_ALIGN_STRETCH; } - // XXX strip off the bit until we implement that + // Store and strip off the bits + mAlignSelfFlags = mAlignSelf & NS_STYLE_ALIGN_FLAG_BITS; mAlignSelf &= ~NS_STYLE_ALIGN_FLAG_BITS; } @@ -2923,6 +2926,10 @@ MainAxisPositionTracker:: mNumPackingSpacesRemaining(0), mJustifyContent(aJustifyContent) { + // Extract the flag portion of mJustifyContent and strip off the flag bits + uint8_t justifyContentFlags = mJustifyContent & NS_STYLE_JUSTIFY_FLAG_BITS; + mJustifyContent &= ~NS_STYLE_JUSTIFY_FLAG_BITS; + // 'normal' behaves as 'stretch', and 'stretch' behaves as 'flex-start', // in the main axis // https://drafts.csswg.org/css-align-3/#propdef-justify-content @@ -2931,9 +2938,6 @@ MainAxisPositionTracker:: mJustifyContent = NS_STYLE_JUSTIFY_FLEX_START; } - // XXX strip off the bit until we implement that - mJustifyContent &= ~NS_STYLE_JUSTIFY_FLAG_BITS; - // mPackingSpaceRemaining is initialized to the container's main size. Now // we'll subtract out the main sizes of our flex items, so that it ends up // with the *actual* amount of packing space. @@ -2949,6 +2953,11 @@ MainAxisPositionTracker:: if (mPackingSpaceRemaining <= 0) { // No available packing space to use for resolving auto margins. mNumAutoMarginsInMainAxis = 0; + // If packing space is negative and is set to 'safe' + // all justify options fall back to 'start' + if (justifyContentFlags & NS_STYLE_JUSTIFY_SAFE) { + mJustifyContent = NS_STYLE_JUSTIFY_START; + } } // If packing space is negative or we only have one item, 'space-between' @@ -3104,14 +3113,15 @@ CrossAxisPositionTracker:: { MOZ_ASSERT(aFirstLine, "null first line pointer"); + // Extract and strip the flag bits from alignContent + uint8_t alignContentFlags = mAlignContent & NS_STYLE_ALIGN_FLAG_BITS; + mAlignContent &= ~NS_STYLE_ALIGN_FLAG_BITS; + // 'normal' behaves as 'stretch' if (mAlignContent == NS_STYLE_ALIGN_NORMAL) { mAlignContent = NS_STYLE_ALIGN_STRETCH; } - // XXX strip of the bit until we implement that - mAlignContent &= ~NS_STYLE_ALIGN_FLAG_BITS; - const bool isSingleLine = NS_STYLE_FLEX_WRAP_NOWRAP == aReflowInput.mStylePosition->mFlexWrap; if (isSingleLine) { @@ -3158,6 +3168,13 @@ CrossAxisPositionTracker:: "GenerateFlexLines should've produced at least 1 line"); mPackingSpaceRemaining -= aCrossGapSize * (numLines - 1); + // If is 'safe' and packing space is negative + // all align options fall back to 'start' + if ((alignContentFlags & NS_STYLE_ALIGN_SAFE) && + mPackingSpaceRemaining < 0) { + mAlignContent = NS_STYLE_ALIGN_START; + } + // If packing space is negative, 'space-between' and 'stretch' behave like // 'flex-start', and 'space-around' and 'space-evenly' behave like 'center'. // In those cases, it's simplest to just pretend we have a different @@ -3516,6 +3533,14 @@ SingleLineCrossAxisPositionTracker:: } } + // 'align-self' falls back to 'flex-start' if it is 'center'/'flex-end' and we + // have cross axis overflow + // XXX we should really be falling back to 'start' as of bug 1472843 + if (aLine.GetLineCrossSize() < aItem.GetOuterCrossSize(mAxis) && + (aItem.GetAlignSelfFlags() & NS_STYLE_ALIGN_SAFE)) { + alignSelf = NS_STYLE_ALIGN_FLEX_START; + } + switch (alignSelf) { case NS_STYLE_ALIGN_SELF_START: case NS_STYLE_ALIGN_SELF_END: diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001-ref.html new file mode 100644 index 000000000000..b921f35ca3b8 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001-ref.html @@ -0,0 +1,73 @@ + + + + + Reference: Testing safe overflow-position for align-content, justify-content, and align-items in flex containers + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001.html new file mode 100644 index 000000000000..8114832aa349 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-safe-overflow-position-001.html @@ -0,0 +1,66 @@ + + + + + CSS Test: Testing safe overflow-position for align-content, justify-content, and align-items in flex containers + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/layout/reftests/w3c-css/submitted/flexbox/reftest.list b/layout/reftests/w3c-css/submitted/flexbox/reftest.list index 7f5c57e14003..9481e54dcff5 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list +++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list @@ -214,6 +214,9 @@ fails == flexbox-min-height-auto-002b.html flexbox-min-height-auto-002-ref.html == flexbox-root-node-001a.html flexbox-root-node-001-ref.html == flexbox-root-node-001b.html flexbox-root-node-001-ref.html +# Tests for "safe" keyword in CSS Alignment properties +== flexbox-safe-overflow-position-001.html flexbox-safe-overflow-position-001-ref.html + # Tests for sizing of flex containers, e.g. under min/max size constraints == flexbox-sizing-horiz-001.xhtml flexbox-sizing-horiz-001-ref.xhtml == flexbox-sizing-horiz-002.xhtml flexbox-sizing-horiz-002-ref.xhtml From 6bd85a621e97240857656300201f4051f7edc148 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 17 Jul 2018 22:23:26 +0000 Subject: [PATCH 21/23] Bug 1476445 - Use an acquire load for is_unique in servo_arc. r=manishearth MozReview-Commit-ID: Dv7Rql4KUgr Differential Revision: https://phabricator.services.mozilla.com/D2205 --HG-- extra : moz-landing-system : lando --- servo/components/servo_arc/lib.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/servo/components/servo_arc/lib.rs b/servo/components/servo_arc/lib.rs index e2063c79a9c2..3e6cd65e85da 100644 --- a/servo/components/servo_arc/lib.rs +++ b/servo/components/servo_arc/lib.rs @@ -349,15 +349,10 @@ impl Arc { #[inline] pub fn is_unique(&self) -> bool { - // We can use Relaxed here, but the justification is a bit subtle. + // See the extensive discussion in [1] for why this needs to be Acquire. // - // The reason to use Acquire would be to synchronize with other threads - // that are modifying the refcount with Release, i.e. to ensure that - // their writes to memory guarded by this refcount are flushed. However, - // we know that threads only modify the contents of the Arc when they - // observe the refcount to be 1, and no other thread could observe that - // because we're holding one strong reference here. - self.inner().count.load(Relaxed) == 1 + // [1] https://github.com/servo/servo/issues/21186 + self.inner().count.load(Acquire) == 1 } } From f7f703b0e1b0bffcf85f6bbb3178a107af6d8e79 Mon Sep 17 00:00:00 2001 From: Anny Gakhokidze Date: Tue, 17 Jul 2018 19:02:51 -0400 Subject: [PATCH 22/23] Bug 1473161 - Add missing bound check in nsContentUtils::DataTransferItemToImage. r=nika MozReview-Commit-ID: 3dq5yWZwJiG --- dom/base/nsContentUtils.cpp | 51 +++++++++++++++++++++++++++++-------- dom/base/nsContentUtils.h | 8 +++++- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index f428fdfc29cc..c049ad6142a7 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -7868,6 +7868,23 @@ nsContentUtils::IsFileImage(nsIFile* aFile, nsACString& aType) return StringBeginsWith(aType, NS_LITERAL_CSTRING("image/")); } +nsresult +nsContentUtils::CalculateBufferSizeForImage(const uint32_t& aStride, + const IntSize& aImageSize, + const SurfaceFormat& aFormat, + size_t* aMaxBufferSize, + size_t* aUsedBufferSize) +{ + CheckedInt32 requiredBytes = + CheckedInt32(aStride) * CheckedInt32(aImageSize.height); + if (!requiredBytes.isValid()) { + return NS_ERROR_FAILURE; + } + *aMaxBufferSize = requiredBytes.value(); + *aUsedBufferSize = *aMaxBufferSize - aStride + (aImageSize.width * BytesPerPixel(aFormat)); + return NS_OK; +} + nsresult nsContentUtils::DataTransferItemToImage(const IPCDataTransferItem& aItem, imgIContainer** aContainer) @@ -7883,6 +7900,21 @@ nsContentUtils::DataTransferItemToImage(const IPCDataTransferItem& aItem, Shmem data = aItem.data().get_Shmem(); + // Validate shared memory buffer size + size_t imageBufLen = 0; + size_t maxBufLen = 0; + nsresult rv = CalculateBufferSizeForImage(imageDetails.stride(), + size, + imageDetails.format(), + &maxBufLen, + &imageBufLen); + if (NS_FAILED(rv)) { + return rv; + } + if (imageBufLen > data.Size()) { + return NS_ERROR_FAILURE; + } + RefPtr image = CreateDataSourceSurfaceFromData(size, imageDetails.format(), @@ -8233,21 +8265,18 @@ GetSurfaceDataImpl(mozilla::gfx::DataSourceSurface* aSurface, return GetSurfaceDataContext::NullValue(); } - mozilla::gfx::IntSize size = aSurface->GetSize(); - mozilla::CheckedInt32 requiredBytes = - mozilla::CheckedInt32(map.mStride) * mozilla::CheckedInt32(size.height); - if (!requiredBytes.isValid()) { + size_t bufLen = 0; + size_t maxBufLen = 0; + nsresult rv = nsContentUtils::CalculateBufferSizeForImage(map.mStride, + aSurface->GetSize(), + aSurface->GetFormat(), + &maxBufLen, + &bufLen); + if (NS_FAILED(rv)) { aSurface->Unmap(); return GetSurfaceDataContext::NullValue(); } - size_t maxBufLen = requiredBytes.value(); - mozilla::gfx::SurfaceFormat format = aSurface->GetFormat(); - - // Surface data handling is totally nuts. This is the magic one needs to - // know to access the data. - size_t bufLen = maxBufLen - map.mStride + (size.width * BytesPerPixel(format)); - // nsDependentCString wants null-terminated string. typename GetSurfaceDataContext::ReturnType surfaceData = aContext.Allocate(maxBufLen + 1); if (GetSurfaceDataContext::GetBuffer(surfaceData)) { diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 7dd33772fb91..9984e13e5ff9 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -1160,11 +1160,17 @@ public: */ static bool DevToolsEnabled(JSContext* aCx); + static nsresult CalculateBufferSizeForImage(const uint32_t& aStride, + const mozilla::gfx::IntSize& aImageSize, + const mozilla::gfx::SurfaceFormat& aFormat, + size_t* aMaxBufferSize, + size_t* aUsedBufferSize); + +private: /** * Fill (with the parameters given) the localized string named |aKey| in * properties file |aFile|. */ -private: static nsresult FormatLocalizedString(PropertiesFile aFile, const char* aKey, const char16_t** aParams, From c6926db95914842f73c21e7a78874f60fe9a697d Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 18 Jul 2018 10:44:00 +1000 Subject: [PATCH 23/23] Bug 1476477 - Replace nsAutoCString with nsCString for local result variables in windows widget. r=masayuki MozReview-Commit-ID: JN6GVPTZNg2 --HG-- extra : rebase_source : f3b997f3b8fbcefd2de660158f336364282ef2f6 --- widget/windows/KeyboardLayout.cpp | 14 +++++++------- widget/windows/TSFTextStore.cpp | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 112905ff32ac..69e90feb289a 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -272,7 +272,7 @@ GetCharacterCodeName(const char16_t* aChars, uint32_t aLength) if (!aLength) { return EmptyCString(); } - nsAutoCString result; + nsCString result; for (uint32_t i = 0; i < aLength; ++i) { if (!result.IsEmpty()) { result.AppendLiteral(", "); @@ -291,7 +291,7 @@ GetCharacterCodeName(const UniCharsAndModifiers& aUniCharsAndModifiers) if (aUniCharsAndModifiers.IsEmpty()) { return EmptyCString(); } - nsAutoCString result; + nsCString result; for (uint32_t i = 0; i < aUniCharsAndModifiers.Length(); i++) { if (!result.IsEmpty()) { result.AppendLiteral(", "); @@ -578,7 +578,7 @@ private: static const nsCString ToString(const MSG& aMSG) { - nsAutoCString result; + nsCString result; result.AssignLiteral("{ message="); result.Append(GetMessageName(aMSG.message).get()); result.AppendLiteral(", "); @@ -641,7 +641,7 @@ ToString(const UniCharsAndModifiers& aUniCharsAndModifiers) if (aUniCharsAndModifiers.IsEmpty()) { return NS_LITERAL_CSTRING("{}"); } - nsAutoCString result; + nsCString result; result.AssignLiteral("{ "); result.Append(GetCharacterCodeName(aUniCharsAndModifiers.CharAt(0))); for (size_t i = 1; i < aUniCharsAndModifiers.Length(); ++i) { @@ -664,7 +664,7 @@ ToString(const UniCharsAndModifiers& aUniCharsAndModifiers) const nsCString ToString(const ModifierKeyState& aModifierKeyState) { - nsAutoCString result; + nsCString result; result.AssignLiteral("{ "); result.Append(GetModifiersName(aModifierKeyState.GetModifiers()).get()); result.AppendLiteral(" }"); @@ -2857,7 +2857,7 @@ GetResultOfInSendMessageEx() if (!ret) { return NS_LITERAL_CSTRING("ISMEX_NOSEND"); } - nsAutoCString result; + nsCString result; if (ret & ISMEX_CALLBACK) { result = "ISMEX_CALLBACK"; } @@ -4197,7 +4197,7 @@ KeyboardLayout::GetLayoutName(HKL aLayout) const } if (NS_WARN_IF((layout & 0xF000) != 0xF000)) { - nsAutoCString result; + nsCString result; result.AppendPrintf("Odd HKL: 0x%08X", reinterpret_cast(aLayout)); return result; diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index a76a43a9686b..0d9ce6d1a789 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -68,7 +68,7 @@ HandleSeparator(nsCString& aDesc) static const nsCString GetFindFlagName(DWORD aFindFlag) { - nsAutoCString description; + nsCString description; if (!aFindFlag) { description.AppendLiteral("no flags (0)"); return description; @@ -162,7 +162,7 @@ GetCLSIDNameStr(REFCLSID aCLSID) return EmptyCString(); } - nsAutoCString result; + nsCString result; result = NS_ConvertUTF16toUTF8(str); ::CoTaskMemFree(str); return result; @@ -291,7 +291,7 @@ GetRIIDNameStr(REFIID aRIID) nsAutoString key(L"Interface\\"); key += str; - nsAutoCString result; + nsCString result; wchar_t buf[256]; if (WinUtils::GetRegistryKey(HKEY_CLASSES_ROOT, key.get(), nullptr, buf, sizeof(buf))) { @@ -371,7 +371,7 @@ GetTextStoreReturnValueName(HRESULT aResult) static const nsCString GetSinkMaskNameStr(DWORD aSinkMask) { - nsAutoCString description; + nsCString description; if (aSinkMask & TS_AS_TEXT_CHANGE) { description.AppendLiteral("TS_AS_TEXT_CHANGE"); } @@ -408,7 +408,7 @@ GetActiveSelEndName(TsActiveSelEnd aSelEnd) static const nsCString GetLockFlagNameStr(DWORD aLockFlags) { - nsAutoCString description; + nsCString description; if ((aLockFlags & TS_LF_READWRITE) == TS_LF_READWRITE) { description.AppendLiteral("TS_LF_READWRITE"); } else if (aLockFlags & TS_LF_READ) { @@ -507,7 +507,7 @@ GetClauseAttrName(TF_DA_ATTR_INFO aAttr) static nsCString GetDisplayAttrStr(const TF_DISPLAYATTRIBUTE& aDispAttr) { - nsAutoCString str; + nsCString str; str = "crText:{ "; str += GetColorName(aDispAttr.crText); str += " }, crBk:{ "; @@ -549,7 +549,7 @@ GetMouseButtonsName(int16_t aButtons) if (!aButtons) { return NS_LITERAL_CSTRING("no buttons"); } - nsAutoCString names; + nsCString names; if (aButtons & WidgetMouseEventBase::eLeftButtonFlag) { names = "LeftButton"; } @@ -578,7 +578,7 @@ GetModifiersName(Modifiers aModifiers) if (aModifiers == MODIFIER_NONE) { return NS_LITERAL_CSTRING("no modifiers"); } - nsAutoCString names; + nsCString names; if (aModifiers & MODIFIER_ALT) { names = NS_DOM_KEYNAME_ALT; }