From d17844e0bf0b2defcccc0c78c1bae834479c50bc Mon Sep 17 00:00:00 2001 From: fvsch Date: Mon, 27 Aug 2018 13:47:06 +0000 Subject: [PATCH 01/64] Bug 1483782 - Remove old webconsole.svg sprite; r=nchevobbe Differential Revision: https://phabricator.services.mozilla.com/D4283 --HG-- extra : moz-landing-system : lando --- devtools/client/jar.mn | 1 - devtools/client/themes/debugger.css | 11 +- devtools/client/themes/images/webconsole.svg | 101 ------------------ .../client/themes/images/webconsole/alert.svg | 2 +- .../client/themes/images/webconsole/info.svg | 2 +- devtools/client/themes/jit-optimizations.css | 31 +++--- devtools/client/themes/memory.css | 16 ++- devtools/client/themes/performance.css | 18 ++-- 8 files changed, 34 insertions(+), 148 deletions(-) delete mode 100644 devtools/client/themes/images/webconsole.svg diff --git a/devtools/client/jar.mn b/devtools/client/jar.mn index a04e46e51a81..e2aed8ff265b 100644 --- a/devtools/client/jar.mn +++ b/devtools/client/jar.mn @@ -149,7 +149,6 @@ devtools.jar: skin/images/editor-error.png (themes/images/editor-error.png) skin/images/breakpoint.svg (themes/images/breakpoint.svg) skin/webconsole.css (themes/webconsole.css) - skin/images/webconsole.svg (themes/images/webconsole.svg) skin/images/webconsole/alert.svg (themes/images/webconsole/alert.svg) skin/images/webconsole/info.svg (themes/images/webconsole/info.svg) skin/images/webconsole/input.svg (themes/images/webconsole/input.svg) diff --git a/devtools/client/themes/debugger.css b/devtools/client/themes/debugger.css index fc2fff8fb3d7..84a2d97b091c 100644 --- a/devtools/client/themes/debugger.css +++ b/devtools/client/themes/debugger.css @@ -31,16 +31,17 @@ .dbg-wasm-item .icon { display: block; - background-image: url(chrome://devtools/skin/images/webconsole.svg); - background-repeat: no-repeat; - background-size: 72px 60px; - /* show warning icon */ - background-position: -24px -24px; width: 10px; height: 10px; position: absolute; margin-inline-start: -15px; margin-top: 3px; + /* show warning icon */ + background-image: var(--theme-console-alert-image); + background-repeat: no-repeat; + background-size: contain; + -moz-context-properties: fill; + fill: #ec8633; } .dbg-breakpoint-line { diff --git a/devtools/client/themes/images/webconsole.svg b/devtools/client/themes/images/webconsole.svg deleted file mode 100644 index 6c21e549e904..000000000000 --- a/devtools/client/themes/images/webconsole.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/devtools/client/themes/images/webconsole/alert.svg b/devtools/client/themes/images/webconsole/alert.svg index 972bd6e5ce16..a3f98f97a4ed 100644 --- a/devtools/client/themes/images/webconsole/alert.svg +++ b/devtools/client/themes/images/webconsole/alert.svg @@ -3,5 +3,5 @@ - 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/. --> - + diff --git a/devtools/client/themes/images/webconsole/info.svg b/devtools/client/themes/images/webconsole/info.svg index 28827fdeff62..f3ad2bcdf394 100644 --- a/devtools/client/themes/images/webconsole/info.svg +++ b/devtools/client/themes/images/webconsole/info.svg @@ -3,5 +3,5 @@ - 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/. --> - + diff --git a/devtools/client/themes/jit-optimizations.css b/devtools/client/themes/jit-optimizations.css index 363810504859..7266d26e136b 100644 --- a/devtools/client/themes/jit-optimizations.css +++ b/devtools/client/themes/jit-optimizations.css @@ -75,31 +75,24 @@ color: var(--theme-highlight-red); } -.theme-dark .opt-icon::before { - background-image: url(chrome://devtools/skin/images/webconsole.svg); -} -.theme-light .opt-icon::before { - background-image: url(chrome://devtools/skin/images/webconsole.svg#light-icons); -} - .opt-icon::before { - display: inline-block; content: ""; - background-repeat: no-repeat; - background-size: 72px 60px; - /* show grey "i" bubble by default */ - background-position: -36px -36px; - width: 10px; - height: 10px; + display: inline-block; + vertical-align: -2px; + width: 12px; + height: 12px; max-height: 12px; -} - -.opt-icon::before { - margin: 1px 6px 0 0; + margin-inline-end: 5px; + background-image: var(--theme-console-info-image); + background-repeat: no-repeat; + background-size: contain; + -moz-context-properties: fill; + fill: #808080; } .opt-icon.warning::before { - background-position: -24px -24px; + background-image: var(--theme-console-alert-image); + fill: #ec8633; } /* Frame Component */ diff --git a/devtools/client/themes/memory.css b/devtools/client/themes/memory.css index 525634264259..90e0645ebab5 100644 --- a/devtools/client/themes/memory.css +++ b/devtools/client/themes/memory.css @@ -557,20 +557,16 @@ html, body, #app, #memory-tool { .error::before { content: ""; display: inline-block; + vertical-align: -2px; width: 12px; height: 12px; max-height: 12px; - background-image: url(chrome://devtools/skin/images/webconsole.svg); - background-size: 72px 60px; - background-position: -24px -24px; - background-repeat: no-repeat; - margin: 0px; - margin-top: 2px; margin-inline-end: 5px; -} - -.theme-light .error::before { - background-image: url(chrome://devtools/skin/images/webconsole.svg#light-icons); + background-image: var(--theme-console-alert-image); + background-repeat: no-repeat; + background-size: contain; + -moz-context-properties: fill; + fill: #ec8633; } /** diff --git a/devtools/client/themes/performance.css b/devtools/client/themes/performance.css index fcd3949a835e..cb162b53d3b0 100644 --- a/devtools/client/themes/performance.css +++ b/devtools/client/themes/performance.css @@ -761,19 +761,17 @@ menuitem.marker-color-graphs-grey .menu-iconic-left::after, */ menuitem.experimental-option::before { content: ""; - background-image: url(chrome://devtools/skin/images/webconsole.svg); - background-repeat: no-repeat; - background-size: 72px 60px; + display: inline-block; width: 12px; height: 12px; - display: inline-block; - - background-position: -24px -24px; - margin: 2px 5px 0 0; max-height: 12px; -} -.theme-light menuitem.experimental-option::before { - background-image: url(chrome://devtools/skin/images/webconsole.svg#light-icons); + margin-top: 2px; + margin-inline-end: 5px; + background-image: var(--theme-console-alert-image); + background-repeat: no-repeat; + background-size: contain; + -moz-context-properties: fill; + fill: currentColor; } #performance-options-menupopup:not(.experimental-enabled) .experimental-option, From 226365011f8a8cd03dbdbb4573686577105f4634 Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Mon, 27 Aug 2018 07:30:02 +0000 Subject: [PATCH 02/64] Bug 1486364 - Revert changes in Tree component and test; r=jdescottes. In https://github.com/devtools-html/debugger.html/pull/6809 a check was removed in the Tree component because seens as unnecessary, and a test was modified to accomodate the change. Turns out the test was needed in its original form, and was surfacing a bug. This patch rolls back both the change in the Tree component _and_ in the test. The Tree modification will be backported to the Github repository. Differential Revision: https://phabricator.services.mozilla.com/D4307 --HG-- extra : moz-landing-system : lando --- devtools/client/shared/components/reps/reps.js | 12 +++++++++++- .../browser_webconsole_object_inspector_scroll.js | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/devtools/client/shared/components/reps/reps.js b/devtools/client/shared/components/reps/reps.js index b6d968c4db7e..5c8e5c85149f 100644 --- a/devtools/client/shared/components/reps/reps.js +++ b/devtools/client/shared/components/reps/reps.js @@ -4465,7 +4465,17 @@ class Tree extends Component { if (focused || !nativeEvent || !this.treeRef) { return; } - this._focus(traversal[0].item); + + const { explicitOriginalTarget } = nativeEvent; + // Only set default focus to the first tree node if the focus came + // from outside the tree (e.g. by tabbing to the tree from other + // external elements). + if ( + explicitOriginalTarget !== this.treeRef && + !this.treeRef.contains(explicitOriginalTarget) + ) { + this._focus(traversal[0].item); + } }, onBlur: this._onBlur, "aria-label": this.props.label, diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_scroll.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_scroll.js index fde7a97f7825..99fb524c2212 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_scroll.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_scroll.js @@ -39,7 +39,8 @@ add_task(async function() { }); info("Expand the last node"); - lastNode.click(); + const view = lastNode.ownerDocument.defaultView; + EventUtils.synthesizeMouseAtCenter(lastNode, {}, view); await onOiMutation; is(scrollTop, outputContainer.scrollTop, From e71a066abf04b44470b4c86019d1944793da2a86 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 27 Aug 2018 14:23:34 +0000 Subject: [PATCH 03/64] Bug 1477213 - Replace cpp_guard with operating_systems for compile-time OS check. r=gfritzsche `cpp_guard` was only used for operating system checks. We can check this value in our Python build scripts and exclude histograms that shouldn't be included for the target OS. Differential Revision: https://phabricator.services.mozilla.com/D2927 --HG-- extra : moz-landing-system : lando --- toolkit/components/telemetry/Histograms.json | 132 ++++++++++++------ .../telemetry/docs/collection/histograms.rst | 18 ++- .../telemetry/gen_histogram_data.py | 49 +++---- .../telemetry/gen_histogram_enum.py | 9 +- .../components/telemetry/parse_histograms.py | 59 +++++--- .../telemetry/shared_telemetry_utils.py | 41 ++++++ .../tests/unit/test_TelemetryHistograms.js | 39 ++++++ 7 files changed, 253 insertions(+), 94 deletions(-) diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 0faea38e5553..5e8207a1b89a 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1100,7 +1100,7 @@ "high": 1024, "n_buckets": 21, "description": "Number of low-virtual-memory events fired since last ping", - "cpp_guard": "XP_WIN", + "operating_systems": ["windows"], "bug_numbers": [711490,1451005] }, "LOW_MEMORY_EVENTS_PHYSICAL": { @@ -1111,7 +1111,7 @@ "high": 1024, "n_buckets": 21, "description": "Number of low-physical-memory events fired since last ping", - "cpp_guard": "XP_WIN", + "operating_systems": ["windows"], "bug_numbers": [711490,1451005] }, "LOW_MEMORY_EVENTS_COMMIT_SPACE": { @@ -1122,7 +1122,7 @@ "high": 1024, "n_buckets": 21, "description": "Number of low-commit-space events fired since last ping", - "cpp_guard": "XP_WIN", + "operating_systems": ["windows"], "bug_numbers": [1451005] }, "PAGE_FAULTS_HARD": { @@ -1133,7 +1133,7 @@ "high": 65536, "n_buckets": 13, "description": "Hard page faults (since last telemetry ping)", - "cpp_guard": "XP_UNIX" + "operating_systems": ["unix"] }, "FONTLIST_INITOTHERFAMILYNAMES": { "record_in_processes": ["main", "content"], @@ -1166,7 +1166,7 @@ "high": 30000, "n_buckets": 10, "description": "gfxDWriteFontList::DelayedInitFontList Total (ms)", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "DWRITEFONT_DELAYEDINITFONTLIST_COUNT": { "record_in_processes": ["main", "content"], @@ -1175,7 +1175,7 @@ "high": 10000, "n_buckets": 10, "description": "gfxDWriteFontList::DelayedInitFontList Font Family Count", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "DWRITEFONT_DELAYEDINITFONTLIST_COLLECT": { "record_in_processes": ["main", "content"], @@ -1184,7 +1184,7 @@ "high": 30000, "n_buckets": 10, "description": "gfxDWriteFontList::DelayedInitFontList GetSystemFontCollection (ms)", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "DWRITEFONT_INIT_PROBLEM": { "record_in_processes": ["main", "content"], @@ -1192,7 +1192,7 @@ "kind": "enumerated", "n_values": 8, "description": "DirectWrite system fontlist initialization problem (1=GDI interop, 2=system font collection, 3=no fonts)", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "GDI_INITFONTLIST_TOTAL": { "record_in_processes": ["main", "content"], @@ -1201,7 +1201,7 @@ "high": 30000, "n_buckets": 10, "description": "gfxGDIFontList::InitFontList Total (ms)", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "MAC_INITFONTLIST_TOTAL": { "record_in_processes": ["main", "content"], @@ -1210,7 +1210,7 @@ "high": 30000, "n_buckets": 10, "description": "gfxMacPlatformFontList::InitFontList Total (ms)", - "cpp_guard": "XP_DARWIN" + "operating_systems": ["mac"] }, "SYSTEM_FONT_FALLBACK": { "record_in_processes": ["main", "content"], @@ -5033,7 +5033,7 @@ "expires_in_version": "never", "kind": "flag", "description": "Whether the referrer intent specified an invalid distribution name", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_DISTRIBUTION_CODE_CATEGORY": { "record_in_processes": ["main", "content"], @@ -5041,7 +5041,7 @@ "kind": "enumerated", "n_values": 20, "description": "First digit of HTTP result code, or error category, during distribution download", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_DISTRIBUTION_DOWNLOAD_TIME_MS": { "record_in_processes": ["main", "content"], @@ -5051,7 +5051,7 @@ "high": 40000, "n_buckets": 30, "description": "Time taken to download a specified distribution file (msec)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_BOOKMARKS_COUNT": { "record_in_processes": ["main", "content"], @@ -5067,7 +5067,7 @@ "record_in_processes": ["main", "content"], "expires_in_version": "70", "kind": "flag", - "cpp_guard": "ANDROID", + "operating_systems": ["android"], "description": "Whether or not users have Orbot installed", "alert_emails": ["seceng@mozilla.org"], "bug_numbers": [1314784] @@ -5078,7 +5078,7 @@ "kind": "exponential", "high": 1000, "n_buckets": 10, - "cpp_guard": "ANDROID", + "operating_systems": ["android"], "description": "Number of reading list items stored in the browser DB *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***" }, "FENNEC_READER_VIEW_CACHE_SIZE": { @@ -5102,7 +5102,7 @@ "n_buckets": 22, "description": "Latency in microseconds of UI events in the Android event loop between posting and processing", "bug_numbers": [1322574], - "cpp_guard": "MOZ_WIDGET_ANDROID" + "operating_systems": ["android"] }, "FENNEC_LOOP_OTHER_LATENCY": { "record_in_processes": ["main", "content"], @@ -5114,7 +5114,7 @@ "n_buckets": 22, "description": "Latency in microseconds of non-UI events in the Android event loop between posting and processing", "bug_numbers": [1322574], - "cpp_guard": "MOZ_WIDGET_ANDROID" + "operating_systems": ["android"] }, "PLACES_SORTED_BOOKMARKS_PERC": { "record_in_processes": ["main", "content"], @@ -7626,6 +7626,54 @@ "description": "a testing histogram; not meant to be touched", "products": ["fennec", "geckoview"] }, + "TELEMETRY_TEST_OS_ANDROID_ONLY": { + "record_in_processes": ["all"], + "alert_emails": ["telemetry-client-dev@mozilla.com"], + "expires_in_version": "never", + "kind": "linear", + "low": 1, + "high": 10000, + "n_buckets": 10, + "bug_numbers": [1477213], + "description": "a testing histogram; not meant to be touched", + "operating_systems": ["android"] + }, + "TELEMETRY_TEST_OS_WIN_ONLY": { + "record_in_processes": ["all"], + "alert_emails": ["telemetry-client-dev@mozilla.com"], + "expires_in_version": "never", + "kind": "linear", + "low": 1, + "high": 10000, + "n_buckets": 10, + "bug_numbers": [1477213], + "description": "a testing histogram; not meant to be touched", + "operating_systems": ["windows"] + }, + "TELEMETRY_TEST_OS_LINUX_ONLY": { + "record_in_processes": ["all"], + "alert_emails": ["telemetry-client-dev@mozilla.com"], + "expires_in_version": "never", + "kind": "linear", + "low": 1, + "high": 10000, + "n_buckets": 10, + "bug_numbers": [1477213], + "description": "a testing histogram; not meant to be touched", + "operating_systems": ["linux"] + }, + "TELEMETRY_TEST_OS_MAC_ONLY": { + "record_in_processes": ["all"], + "alert_emails": ["telemetry-client-dev@mozilla.com"], + "expires_in_version": "never", + "kind": "linear", + "low": 1, + "high": 10000, + "n_buckets": 10, + "bug_numbers": [1477213], + "description": "a testing histogram; not meant to be touched", + "operating_systems": ["mac"] + }, "STARTUP_CRASH_DETECTED": { "record_in_processes": ["main", "content"], "expires_in_version": "never", @@ -7682,7 +7730,7 @@ "high": 50000, "n_buckets": 20, "description": "Number of bookmarks in the original XUL places database", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_GLOBALHISTORY_ADD_MS": { "record_in_processes": ["main", "content"], @@ -7692,7 +7740,7 @@ "high": 20000, "n_buckets": 20, "description": "Time for a record to be added to history (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_GLOBALHISTORY_UPDATE_MS": { "record_in_processes": ["main", "content"], @@ -7702,7 +7750,7 @@ "high": 20000, "n_buckets": 20, "description": "Time for a record to be updated in history (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_GLOBALHISTORY_VISITED_BUILD_MS": { "record_in_processes": ["main", "content"], @@ -7712,14 +7760,14 @@ "high": 20000, "n_buckets": 20, "description": "Time to update the visited link set (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_RESTORING_ACTIVITY": { "record_in_processes": ["main", "content"], "expires_in_version": "never", "kind": "flag", "description": "Fennec is starting up but the Gecko thread was still running", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_SEARCH_LOADER_TIME_MS": { "record_in_processes": ["main", "content"], @@ -7729,7 +7777,7 @@ "high": 20000, "n_buckets": 20, "description": "Time for a URL bar DB search to return (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_STARTUP_TIME_GECKOREADY": { "record_in_processes": ["main", "content"], @@ -7739,7 +7787,7 @@ "high": 20000, "n_buckets": 20, "description": "Time for the Gecko:Ready message to arrive (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_STARTUP_TIME_JAVAUI": { "record_in_processes": ["main", "content"], @@ -7749,7 +7797,7 @@ "high": 5000, "n_buckets": 20, "description": "Time for the Java UI to load (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_TOPSITES_LOADER_TIME_MS": { "record_in_processes": ["main", "content"], @@ -7759,7 +7807,7 @@ "high": 20000, "n_buckets": 20, "description": "Time for the home screen Top Sites query to return with no filter set (ms)", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_ACTIVITY_STREAM_TOPSITES_LOADER_TIME_MS": { "record_in_processes": ["main", "content"], @@ -7771,7 +7819,7 @@ "description": "Time for the Activity Stream home screen Top Sites query to return (ms)", "alert_emails": ["mobile-frontend@mozilla.com"], "bug_numbers": [1293790], - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_ACTIVITY_STREAM_HIGHLIGHTS_LOADER_TIME_MS": { "record_in_processes": ["main", "content"], @@ -7783,7 +7831,7 @@ "description": "Time for the Activity Stream highlights query to return (ms)", "alert_emails": ["mobile-frontend@mozilla.com"], "bug_numbers": [1298786], - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_HOMEPANELS_CUSTOM": { "record_in_processes": ["main", "content"], @@ -7791,14 +7839,14 @@ "kind": "boolean", "bug_numbers": [1245368], "description": "Whether the user has customized their homepanels", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_WAS_KILLED": { "record_in_processes": ["main", "content"], "expires_in_version": "never", "kind": "flag", "description": "Killed, likely due to an OOM condition", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FIPS_ENABLED": { "record_in_processes": ["main", "content"], @@ -7987,7 +8035,7 @@ "bug_numbers": [795307, 1390269], "alert_emails": ["jimm@mozilla.com"], "description": "Boolean indicating if a touch input device is detected.", - "cpp_guard": "XP_WIN" + "operating_systems": ["windows"] }, "COMPONENTS_SHIM_ACCESSED_BY_CONTENT": { "record_in_processes": ["main", "content"], @@ -12579,7 +12627,7 @@ "bug_numbers": [1098428], "expires_in_version": "55", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether the system has seccomp-bpf capability" }, "SANDBOX_HAS_SECCOMP_TSYNC": { @@ -12588,7 +12636,7 @@ "bug_numbers": [1098428, 1370578], "expires_in_version": "61", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether the system has seccomp-bpf thread-sync capability" }, "SANDBOX_HAS_USER_NAMESPACES": { @@ -12598,7 +12646,7 @@ "expires_in_version": "65", "releaseChannelCollection": "opt-out", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether our process succedeed in creating a user namespace" }, "SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED": { @@ -12607,7 +12655,7 @@ "bug_numbers": [1098428, 1370578], "expires_in_version": "61", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether the system has the capability to create privileged user namespaces" }, "SANDBOX_MEDIA_ENABLED": { @@ -12616,7 +12664,7 @@ "bug_numbers": [1098428], "expires_in_version": "55", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether the sandbox is enabled for media/GMP plugins" }, "SANDBOX_CONTENT_ENABLED": { @@ -12625,7 +12673,7 @@ "bug_numbers": [1098428], "expires_in_version": "55", "kind": "boolean", - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "Whether the sandbox is enabled for the content process" }, "SANDBOX_REJECTED_SYSCALLS": { @@ -12636,7 +12684,7 @@ "releaseChannelCollection": "opt-out", "kind": "count", "keyed": true, - "cpp_guard": "XP_LINUX", + "operating_systems": ["linux"], "description": "System calls blocked by a seccomp-bpf sandbox policy; limited to syscalls where we would crash on Nightly. The key is generally the architecture and syscall ID but in some cases we include non-personally-identifying information from the syscall arguments; see the function SubmitToTelemetry in security/sandbox/linux/reporter/SandboxReporter.cpp for details." }, "SANDBOX_FAILED_LAUNCH_KEYED": { @@ -12647,7 +12695,7 @@ "keyed": true, "n_values": 50, "bug_numbers": [1368600], - "cpp_guard": "XP_WIN", + "operating_systems": ["windows"], "description": "Error code when a Windows sandboxed process fails to launch, keyed by process type and Windows error code. See https://dxr.mozilla.org/mozilla-central/search?q=ResultCode++path%3Asandbox_types.h&redirect=true for definitions of the error codes." }, "SYNC_WORKER_OPERATION": { @@ -12819,7 +12867,7 @@ "kind": "flag", "bug_numbers": [1284017], "description": "When restoring tabs on startup, reading from sessionstore.js failed, even though the file exists and is not containing an explicitly empty window.", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_SESSIONSTORE_RESTORING_FROM_BACKUP": { "record_in_processes": ["main", "content"], @@ -12828,7 +12876,7 @@ "kind": "flag", "bug_numbers": [1190627], "description": "When restoring tabs on startup, reading from sessionstore.js failed, but sessionstore.bak was read successfully.", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "FENNEC_SESSIONSTORE_ALL_FILES_DAMAGED": { "record_in_processes": ["main", "content"], @@ -12837,7 +12885,7 @@ "kind": "flag", "bug_numbers": [1337115], "description": "Both the main session file and its backup could not be read and and the first run pref is false.", - "cpp_guard": "ANDROID" + "operating_systems": ["android"] }, "NUMBER_OF_PROFILES": { "record_in_processes": ["main", "content"], diff --git a/toolkit/components/telemetry/docs/collection/histograms.rst b/toolkit/components/telemetry/docs/collection/histograms.rst index ef91621676d7..8fb81a3d39c9 100644 --- a/toolkit/components/telemetry/docs/collection/histograms.rst +++ b/toolkit/components/telemetry/docs/collection/histograms.rst @@ -184,10 +184,24 @@ Required for all new histograms. This is an array of integers and should at leas --------------- Required. A description of the data tracked by the histogram, e.g. _"Resident memory size"_ -``cpp_guard`` -------------- +``cpp_guard`` (obsolete, use ``operating_systems``) +--------------------------------------------------- Optional. This field inserts an #ifdef directive around the histogram's C++ declaration. This is typically used for platform-specific histograms, e.g. ``"cpp_guard": "ANDROID"`` +``operating_systems`` +--------------------- +Optional. This field restricts recording to certain operating systems only. Use that in-place of previous ``cpp_guards`` to avoid inclusion on not-specified operating systems. +Currently supported values are: + +- ``mac`` +- ``linux`` +- ``windows`` +- ``android`` +- ``unix`` +- ``all`` (record on all operating systems) + +If this field is left out it defaults to ``all``. + ``releaseChannelCollection`` ---------------------------- Optional. This is one of: diff --git a/toolkit/components/telemetry/gen_histogram_data.py b/toolkit/components/telemetry/gen_histogram_data.py index 9e28f9a6a9d6..7af76cc72e87 100644 --- a/toolkit/components/telemetry/gen_histogram_data.py +++ b/toolkit/components/telemetry/gen_histogram_data.py @@ -10,6 +10,7 @@ from shared_telemetry_utils import StringTable, static_assert, ParserError import sys import parse_histograms +import buildconfig banner = """/* This file is auto-generated, see gen_histogram_data.py. */ """ @@ -17,26 +18,22 @@ banner = """/* This file is auto-generated, see gen_histogram_data.py. */ def print_array_entry(output, histogram, name_index, exp_index, label_index, label_count, key_index, key_count): - cpp_guard = histogram.cpp_guard() - if cpp_guard: - print("#if defined(%s)" % cpp_guard, file=output) - print(" { %s, %s, %s, %s, %d, %d, %s, %d, %d, %d, %d, %s, %s, %s }," - % (histogram.low(), - histogram.high(), - histogram.n_buckets(), - histogram.nsITelemetry_kind(), - name_index, - exp_index, - histogram.dataset(), - label_index, - label_count, - key_index, - key_count, - " | ".join(histogram.record_in_processes_enum()), - "true" if histogram.keyed() else "false", - " | ".join(histogram.products_enum())), file=output) - if cpp_guard: - print("#endif", file=output) + if histogram.record_on_os(buildconfig.substs["OS_TARGET"]): + print(" { %s, %s, %s, %s, %d, %d, %s, %d, %d, %d, %d, %s, %s, %s }," + % (histogram.low(), + histogram.high(), + histogram.n_buckets(), + histogram.nsITelemetry_kind(), + name_index, + exp_index, + histogram.dataset(), + label_index, + label_count, + key_index, + key_count, + " | ".join(histogram.record_in_processes_enum()), + "true" if histogram.keyed() else "false", + " | ".join(histogram.products_enum())), file=output) def write_histogram_table(output, histograms): @@ -190,21 +187,17 @@ def write_histogram_ranges(output, histograms): if offset > 32767: raise Exception('Histogram offsets exceeded maximum value for an int16_t.') + target_os = buildconfig.substs["OS_TARGET"] print("#if defined(_MSC_VER) && !defined(__clang__)", file=output) print("const int16_t gHistogramBucketLowerBoundIndex[] = {", file=output) print("#else", file=output) print("constexpr int16_t gHistogramBucketLowerBoundIndex[] = {", file=output) print("#endif", file=output) for histogram in histograms: - cpp_guard = histogram.cpp_guard() - if cpp_guard: - print("#if defined(%s)" % cpp_guard, file=output) + if histogram.record_on_os(target_os): + our_offset = ranges_offsets[tuple(histogram.ranges())] + print("%d," % our_offset, file=output) - our_offset = ranges_offsets[tuple(histogram.ranges())] - print("%d," % our_offset, file=output) - - if cpp_guard: - print("#endif", file=output) print("};", file=output) diff --git a/toolkit/components/telemetry/gen_histogram_enum.py b/toolkit/components/telemetry/gen_histogram_enum.py index 9b92ab5a33f1..9a9fde03431f 100644 --- a/toolkit/components/telemetry/gen_histogram_enum.py +++ b/toolkit/components/telemetry/gen_histogram_enum.py @@ -18,6 +18,7 @@ from shared_telemetry_utils import ParserError import parse_histograms import itertools import sys +import buildconfig banner = """/* This file is auto-generated, see gen_histogram_enum.py. */ @@ -72,12 +73,8 @@ def main(output, *filenames): print(" HistogramDUMMY1 = HistogramFirstUseCounter - 1,", file=output) for histogram in histograms: - cpp_guard = histogram.cpp_guard() - if cpp_guard: - print("#if defined(%s)" % cpp_guard, file=output) - print(" %s," % histogram.name(), file=output) - if cpp_guard: - print("#endif", file=output) + if histogram.record_on_os(buildconfig.substs["OS_TARGET"]): + print(" %s," % histogram.name(), file=output) if use_counter_group: print(" HistogramDUMMY2,", file=output) diff --git a/toolkit/components/telemetry/parse_histograms.py b/toolkit/components/telemetry/parse_histograms.py index aeb27dba1171..a552d75283cd 100755 --- a/toolkit/components/telemetry/parse_histograms.py +++ b/toolkit/components/telemetry/parse_histograms.py @@ -28,7 +28,7 @@ CPP_IDENTIFIER_PATTERN = '^[a-z][a-z0-9_]+[a-z0-9]$' ALWAYS_ALLOWED_KEYS = [ 'kind', 'description', - 'cpp_guard', + 'operating_systems', 'expires_in_version', 'alert_emails', 'keyed', @@ -122,10 +122,7 @@ definition is a dict-like object that must contain at least the keys: - 'description': A textual description of the histogram. - 'strict_type_checks': A boolean indicating whether to use the new, stricter type checks. The server-side still has to deal with old, oddly typed submissions, - so we have to skip them there by default. - -The key 'cpp_guard' is optional; if present, it denotes a preprocessor -symbol that should guard C/C++ definitions associated with the histogram.""" + so we have to skip them there by default.""" self._strict_type_checks = strict_type_checks self._is_use_counter = name.startswith("USE_COUNTER2_") if self._is_use_counter: @@ -135,12 +132,12 @@ symbol that should guard C/C++ definitions associated with the histogram.""" self._description = definition['description'] self._kind = definition['kind'] self._keys = definition.get('keys', []) - self._cpp_guard = definition.get('cpp_guard') self._keyed = definition.get('keyed', False) self._expiration = definition.get('expires_in_version') self._labels = definition.get('labels', []) self._record_in_processes = definition.get('record_in_processes') self._products = definition.get('products', ["all"]) + self._operating_systems = definition.get('operating_systems', ["all"]) self.compute_bucket_parameters(definition) self.set_nsITelemetry_kind() @@ -181,11 +178,6 @@ the histogram.""" """Return the number of buckets in the histogram.""" return self._n_buckets - def cpp_guard(self): - """Return the preprocessor symbol that should guard C/C++ definitions -associated with the histogram. Returns None if no guarding is necessary.""" - return self._cpp_guard - def keyed(self): """Returns True if this a keyed histogram, false otherwise.""" return self._keyed @@ -218,6 +210,23 @@ associated with the histogram. Returns None if no guarding is necessary.""" """Get the non-empty list of flags representing products to record data on""" return [utils.product_name_to_enum(p) for p in self.products()] + def operating_systems(self): + """Get the list of operating systems to record data on""" + return self._operating_systems + + def record_on_os(self, target_os): + """Check if this probe should be recorded on the passed os.""" + os = self.operating_systems() + if "all" in os: + return True + + canonical_os = utils.canonical_os(target_os) + + if "unix" in os and canonical_os in utils.UNIX_LIKE_OS: + return True + + return canonical_os in os + def ranges(self): """Return an array of lower bounds for each bucket in the histogram.""" bucket_fns = { @@ -288,6 +297,7 @@ associated with the histogram. Returns None if no guarding is necessary.""" self.check_label_values(name, definition) self.check_record_in_processes(name, definition) self.check_products(name, definition) + self.check_operating_systems(name, definition) def check_name(self, name): if '#' in name: @@ -393,6 +403,24 @@ associated with the histogram. Returns None if no guarding is necessary.""" ParserError('Histogram "%s" has unknown product "%s" in %s.\n%s' % (name, product, field, DOC_URL)).handle_later() + def check_operating_systems(self, name, definition): + if not self._strict_type_checks: + return + + field = 'operating_systems' + operating_systems = definition.get(field) + + DOC_URL = HISTOGRAMS_DOC_URL + "#operating_systems" + + if not operating_systems: + # operating_systems is optional + return + + for operating_system in operating_systems: + if not utils.is_valid_os(operating_system): + ParserError('Histogram "%s" has unknown operating system "%s" in %s.\n%s' % + (name, operating_system, field, DOC_URL)).handle_later() + def check_keys_field(self, name, definition): keys = definition.get('keys') if not self._strict_type_checks or keys is None: @@ -422,10 +450,9 @@ associated with the histogram. Returns None if no guarding is necessary.""" # scalars instead. Allow using these histograms on Android, as we # don't support scalars there yet. hist_kind = definition.get("kind") - android_cpp_guard =\ - definition.get("cpp_guard") in ["ANDROID", "MOZ_WIDGET_ANDROID"] + android_target = "android" in definition.get("operating_systems", []) - if not android_cpp_guard and \ + if not android_target and \ hist_kind in ["flag", "count"] and \ name not in whitelists["kind"]: ParserError(('Unsupported kind "%s" for histogram "%s":\n' @@ -433,7 +460,7 @@ associated with the histogram. Returns None if no guarding is necessary.""" ' use scalars instead:\n' '%s\n' 'Are you trying to add a histogram on Android?' - ' Add "cpp_guard": "ANDROID" to your histogram definition.') + ' Add "operating_systems": ["android"] to your histogram definition.') % (hist_kind, name, hist_kind, SCALARS_DOC_URL)).handle_now() # Check for the presence of fields that old histograms are whitelisted for. @@ -468,7 +495,6 @@ associated with the histogram. Returns None if no guarding is necessary.""" "expires_in_version": basestring, "kind": basestring, "description": basestring, - "cpp_guard": basestring, "releaseChannelCollection": basestring, } @@ -480,6 +506,7 @@ associated with the histogram. Returns None if no guarding is necessary.""" "record_in_processes": basestring, "keys": basestring, "products": basestring, + "operating_systems": basestring, } # For the server-side, where _strict_type_checks==False, we want to diff --git a/toolkit/components/telemetry/shared_telemetry_utils.py b/toolkit/components/telemetry/shared_telemetry_utils.py index 6e6b1af22aff..dd461a3df669 100644 --- a/toolkit/components/telemetry/shared_telemetry_utils.py +++ b/toolkit/components/telemetry/shared_telemetry_utils.py @@ -30,6 +30,37 @@ SUPPORTED_PRODUCTS = { 'all': 'All', } +SUPPORTED_OPERATING_SYSTEMS = [ + 'mac', + 'linux', + 'windows', + 'android', + 'unix', + 'all', +] + +# mozinfo identifies linux, BSD variants, Solaris and SunOS as unix +# Solaris and SunOS are identified as "unix" OS. +UNIX_LIKE_OS = [ + "unix", + "linux", + "bsd", +] + +CANONICAL_OPERATING_SYSTEMS = { + 'darwin': 'mac', + 'linux': 'linux', + 'winnt': 'windows', + 'android': 'android', + # for simplicity we treat all BSD and Solaris systems as unix + 'gnu/kfreebsd': 'unix', + 'sunos': 'unix', + 'dragonfly': 'unix', + 'freeunix': 'unix', + 'netunix': 'unix', + 'openunix': 'unix' +} + PROCESS_ENUM_PREFIX = "mozilla::Telemetry::Common::RecordedProcessType::" PRODUCT_ENUM_PREFIX = "mozilla::Telemetry::Common::SupportedProduct::" @@ -75,6 +106,16 @@ def is_valid_product(name): return (name in SUPPORTED_PRODUCTS) +def is_valid_os(name): + return (name in SUPPORTED_OPERATING_SYSTEMS) + + +def canonical_os(os): + """Translate possible OS_TARGET names to their canonical value.""" + + return CANONICAL_OPERATING_SYSTEMS.get(os.lower()) or "unknown" + + def product_name_to_enum(product): return PRODUCT_ENUM_PREFIX + SUPPORTED_PRODUCTS.get(product) diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js b/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js index 9e34de6ac7d0..7a43d3547b39 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js @@ -1197,3 +1197,42 @@ async function test_clearHistogramsOnSnapshot() { false /* clear */).parent; Assert.ok(!(COUNT in snapshot)); }); + +add_task(async function test_valid_os_smoketest() { + let nonExistingProbe; + let existingProbe; + + switch (AppConstants.platform) { + case "linux": + nonExistingProbe = "TELEMETRY_TEST_OS_ANDROID_ONLY"; + existingProbe = "TELEMETRY_TEST_OS_LINUX_ONLY"; + break; + case "macosx": + nonExistingProbe = "TELEMETRY_TEST_OS_ANDROID_ONLY"; + existingProbe = "TELEMETRY_TEST_OS_MAC_ONLY"; + break; + case "win": + nonExistingProbe = "TELEMETRY_TEST_OS_ANDROID_ONLY"; + existingProbe = "TELEMETRY_TEST_OS_WIN_ONLY"; + break; + case "android": + nonExistingProbe = "TELEMETRY_TEST_OS_LINUX_ONLY"; + existingProbe = "TELEMETRY_TEST_OS_ANDROID_ONLY"; + break; + default: + /* Unknown OS. Let's not test OS-specific probes */ + return; + } + + Assert.throws(() => Telemetry.getHistogramById(nonExistingProbe), + /NS_ERROR_FAILURE/, + `Should throw on ${nonExistingProbe} probe that's not available on ${AppConstants.platform}`); + + let h = Telemetry.getHistogramById(existingProbe); + h.clear(); + h.add(1); + let snapshot = Telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, + false /* clear */).parent; + Assert.ok(existingProbe in snapshot, `${existingProbe} should be recorded on ${AppConstants.platform}`); + Assert.equal(snapshot[existingProbe].sum, 1); +}); From d42b22c11af2c25c9876197b836c5bedcd465f36 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 27 Aug 2018 14:25:30 +0000 Subject: [PATCH 04/64] Bug 1477213 - Replace Name->ID map with pre-generated hash table. r=kmag,gfritzsche By using a hash table based on a perfect hash function, generated at build time, we can avoid dynamic memory allocation for every process at start. Depends on D2927 Differential Revision: https://phabricator.services.mozilla.com/D2928 --HG-- extra : moz-landing-system : lando --- .../telemetry/TelemetryHistogram.cpp | 47 ++++---------- .../components/telemetry/gen_histogram_phf.py | 65 +++++++++++++++++++ toolkit/components/telemetry/moz.build | 5 ++ 3 files changed, 83 insertions(+), 34 deletions(-) create mode 100644 toolkit/components/telemetry/gen_histogram_phf.py diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index a23ce2ff5ca9..37b70daf73dc 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -25,6 +25,7 @@ #include "TelemetryCommon.h" #include "TelemetryHistogram.h" +#include "TelemetryHistogramNameMap.h" #include "TelemetryScalar.h" #include "ipc/TelemetryIPCAccumulator.h" @@ -45,6 +46,7 @@ using mozilla::Telemetry::KeyedHistogramAccumulation; using mozilla::Telemetry::HistogramID; using mozilla::Telemetry::ProcessID; using mozilla::Telemetry::HistogramCount; +using mozilla::Telemetry::HistogramIDByNameLookup; using mozilla::Telemetry::Common::LogToBrowserConsole; using mozilla::Telemetry::Common::RecordedProcessType; using mozilla::Telemetry::Common::AutoHashtable; @@ -236,9 +238,6 @@ Histogram** gHistogramStorage; // Keyed histograms internally map string keys to individual Histogram instances. KeyedHistogram** gKeyedHistogramStorage; -// Cache of histogram name to a histogram id. -StringToHistogramIdMap gNameToHistogramIDMap(HistogramCount); - // To simplify logic below we use a single histogram instance for all expired histograms. Histogram* gExpiredHistogram = nullptr; @@ -254,7 +253,6 @@ bool gHistogramRecordingDisabled[HistogramCount] = {}; } // namespace - //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // @@ -418,12 +416,18 @@ internal_GetHistogramIdByName(const StaticMutexAutoLock& aLock, const nsACString& name, HistogramID* id) { - const bool found = gNameToHistogramIDMap.Get(name, id); - if (!found) { - return NS_ERROR_ILLEGAL_VALUE; + const uint32_t idx = HistogramIDByNameLookup(name); + MOZ_ASSERT(idx < HistogramCount, "Intermediate lookup should always give a valid index."); + + // The lookup hashes the input and uses it as an index into the value array. + // Hash collisions can still happen for unknown values, + // therefore we check that the name matches. + if (name.Equals(gHistogramInfos[idx].name())) { + *id = HistogramID(idx); + return NS_OK; } - return NS_OK; + return NS_ERROR_ILLEGAL_VALUE; } // Clear a histogram from storage. @@ -1994,29 +1998,6 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase, new KeyedHistogram*[HistogramCount * size_t(ProcessID::Count)] {}; } - // gNameToHistogramIDMap should have been pre-sized correctly at the - // declaration point further up in this file. - - // Populate the static histogram name->id cache. - // Note that the histogram names come from a static table so we can wrap them - // in a literal string to avoid allocations when it gets copied. - for (uint32_t i = 0; i < HistogramCount; i++) { - auto name = gHistogramInfos[i].name(); - - // Make sure the name pointer is in a valid region. See bug 1428612. - MOZ_DIAGNOSTIC_ASSERT(name >= gHistogramStringTable); - MOZ_DIAGNOSTIC_ASSERT( - uintptr_t(name) < (uintptr_t(gHistogramStringTable) + sizeof(gHistogramStringTable))); - - nsCString wrappedName; - wrappedName.AssignLiteral(name, strlen(name)); - gNameToHistogramIDMap.Put(wrappedName, HistogramID(i)); - } - -#ifdef DEBUG - gNameToHistogramIDMap.MarkImmutable(); -#endif - // Some Telemetry histograms depend on the value of C++ constants and hardcode // their values in Histograms.json. // We add static asserts here for those values to match so that future changes @@ -2046,7 +2027,6 @@ void TelemetryHistogram::DeInitializeGlobalState() StaticMutexAutoLock locker(gTelemetryHistogramMutex); gCanRecordBase = false; gCanRecordExtended = false; - gNameToHistogramIDMap.Clear(); gInitDone = false; // FactoryGet `new`s Histograms for us, but requires us to manually delete. @@ -2581,8 +2561,7 @@ size_t TelemetryHistogram::GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) { - StaticMutexAutoLock locker(gTelemetryHistogramMutex); - return gNameToHistogramIDMap.ShallowSizeOfExcludingThis(aMallocSizeOf); + return 0; } size_t diff --git a/toolkit/components/telemetry/gen_histogram_phf.py b/toolkit/components/telemetry/gen_histogram_phf.py new file mode 100644 index 000000000000..f291f10f56dc --- /dev/null +++ b/toolkit/components/telemetry/gen_histogram_phf.py @@ -0,0 +1,65 @@ +# 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/. + +from __future__ import print_function +from shared_telemetry_utils import ParserError +from perfecthash import PerfectHash + +PHFSIZE = 512 + +import parse_histograms +import sys +import buildconfig + + +banner = """/* This file is auto-generated, see gen_histogram_phf.py. */ +""" + +header = """ +#ifndef mozilla_TelemetryHistogramNameMap_h +#define mozilla_TelemetryHistogramNameMap_h + +namespace mozilla { +namespace Telemetry { +""" + +footer = """ +} // namespace mozilla +} // namespace Telemetry +#endif // mozilla_TelemetryHistogramNameMap_h +""" + + +def main(output, *filenames): + """ + Generate a Perfect Hash Table for the Histogram name -> Histogram ID lookup. + The table is immutable once generated and we can avoid any dynamic memory allocation. + """ + + output.write(banner) + output.write(header) + + try: + histograms = list(parse_histograms.from_files(filenames)) + histograms = [h for h in histograms if h.record_on_os(buildconfig.substs["OS_TARGET"])] + except ParserError as ex: + print("\nError processing histograms:\n" + str(ex) + "\n") + sys.exit(1) + + histograms = [(bytearray(hist.name(), 'ascii'), idx) for (idx, hist) in enumerate(histograms)] + name_phf = PerfectHash(histograms, PHFSIZE) + + output.write(name_phf.cxx_codegen( + name='HistogramIDByNameLookup', + entry_type="uint32_t", + lower_entry=lambda (_, v): str(v), + key_type="const nsACString&", + key_bytes="aKey.BeginReading()", + key_length="aKey.Length()")) + + output.write(footer) + + +if __name__ == '__main__': + main(sys.stdout, *sys.argv[1:]) diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build index f4bc8260a0f1..2bda9795ab40 100644 --- a/toolkit/components/telemetry/moz.build +++ b/toolkit/components/telemetry/moz.build @@ -121,6 +121,7 @@ GENERATED_FILES = [ 'TelemetryEventEnums.h', 'TelemetryHistogramData.inc', 'TelemetryHistogramEnums.h', + 'TelemetryHistogramNameMap.h', 'TelemetryProcessData.h', 'TelemetryProcessEnums.h', 'TelemetryScalarData.h', @@ -142,6 +143,10 @@ enums = GENERATED_FILES['TelemetryHistogramEnums.h'] enums.script = 'gen_histogram_enum.py' enums.inputs = histogram_files +data = GENERATED_FILES['TelemetryHistogramNameMap.h'] +data.script = 'gen_histogram_phf.py' +data.inputs = histogram_files + # Generate scalar files. scalar_files = [ 'Scalars.yaml', From b86463d4c7ae90cf08c6eb5cde7dc978b166052c Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 27 Aug 2018 14:26:51 +0000 Subject: [PATCH 05/64] Bug 1477213 - Remove now-empty shallow sizes. r=gfritzsche Depends On D2928 Differential Revision: https://phabricator.services.mozilla.com/D2929 --HG-- extra : moz-landing-system : lando --- toolkit/components/telemetry/Telemetry.cpp | 4 ---- toolkit/components/telemetry/TelemetryHistogram.cpp | 7 ------- toolkit/components/telemetry/TelemetryHistogram.h | 3 --- 3 files changed, 14 deletions(-) diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index d9283c8b00a2..4f2a2a620495 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -227,10 +227,6 @@ TelemetryImpl::CollectReports(nsIHandleReportCallback* aHandleReport, COLLECT_REPORT("explicit/telemetry/impl", aMallocSizeOf(this), "Memory used by the Telemetry core implemenation"); - COLLECT_REPORT("explicit/telemetry/histogram/shallow", - TelemetryHistogram::GetMapShallowSizesOfExcludingThis(aMallocSizeOf), - "Memory used by the Telemetry Histogram implementation"); - COLLECT_REPORT("explicit/telemetry/scalar/shallow", TelemetryScalar::GetMapShallowSizesOfExcludingThis(aMallocSizeOf), "Memory used by the Telemetry Scalar implemenation"); diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index 37b70daf73dc..49180f87d9a9 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -2557,13 +2557,6 @@ TelemetryHistogram::GetKeyedHistogramSnapshots(JSContext* aCx, return NS_OK; } -size_t -TelemetryHistogram::GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf - aMallocSizeOf) -{ - return 0; -} - size_t TelemetryHistogram::GetHistogramSizesOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) diff --git a/toolkit/components/telemetry/TelemetryHistogram.h b/toolkit/components/telemetry/TelemetryHistogram.h index 7df5da747b0f..b9ffafaa6b4f 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.h +++ b/toolkit/components/telemetry/TelemetryHistogram.h @@ -76,9 +76,6 @@ nsresult GetKeyedHistogramSnapshots(JSContext *aCx, JS::MutableHandleValue aResult, unsigned int aDataset, bool aClearSubsession); -size_t -GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf); - size_t GetHistogramSizesOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); From cb45cd7b82a0e92179a1f2d32b12136107338259 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 27 Aug 2018 15:06:58 +0000 Subject: [PATCH 06/64] Bug 1483985 - use std::move to avoid a copy in a few places that clang recommends; r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D3543 --HG-- extra : moz-landing-system : lando --- dom/storage/LocalStorageManager.cpp | 2 +- gfx/thebes/gfxPlatform.cpp | 2 +- layout/painting/DisplayItemClip.cpp | 2 +- layout/painting/DisplayItemClipChain.cpp | 2 +- layout/painting/nsDisplayList.cpp | 2 +- toolkit/components/extensions/WebExtensionPolicy.cpp | 4 ++-- toolkit/components/url-classifier/LookupCache.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dom/storage/LocalStorageManager.cpp b/dom/storage/LocalStorageManager.cpp index b83e00cee19e..b5d9739b5e7e 100644 --- a/dom/storage/LocalStorageManager.cpp +++ b/dom/storage/LocalStorageManager.cpp @@ -142,7 +142,7 @@ LocalStorageManager::CreateOrigin(const nsACString& aOriginSuffix, scope.Append(aOriginSuffix); scope.Append(':'); scope.Append(aOriginNoSuffix); - return scope; + return std::move(scope); } LocalStorageCache* diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index bf62658f7186..d3fecf4065a4 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1668,7 +1668,7 @@ gfxPlatform::GetDefaultFontName(const nsACString& aLangGroup, fontFamily->LocalizedName(result); } // (else, leave 'result' empty) - return result; + return std::move(result); } bool diff --git a/layout/painting/DisplayItemClip.cpp b/layout/painting/DisplayItemClip.cpp index dcd2e22a09ed..b813e485d25c 100644 --- a/layout/painting/DisplayItemClip.cpp +++ b/layout/painting/DisplayItemClip.cpp @@ -545,7 +545,7 @@ DisplayItemClip::ToString() const r.mRadii[4], r.mRadii[5], r.mRadii[6], r.mRadii[7]); } } - return str; + return std::move(str); } void diff --git a/layout/painting/DisplayItemClipChain.cpp b/layout/painting/DisplayItemClipChain.cpp index d95d9800a57c..3014e000984c 100644 --- a/layout/painting/DisplayItemClipChain.cpp +++ b/layout/painting/DisplayItemClipChain.cpp @@ -79,7 +79,7 @@ DisplayItemClipChain::ToString(const DisplayItemClipChain* aClipChain) str.AppendLiteral(", "); } } - return str; + return std::move(str); } bool diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 3c902a103e25..4e9e311cb993 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -174,7 +174,7 @@ ActiveScrolledRoot::ToString(const ActiveScrolledRoot* aActiveScrolledRoot) str.AppendLiteral(", "); } } - return str; + return std::move(str); } static inline CSSAngle diff --git a/toolkit/components/extensions/WebExtensionPolicy.cpp b/toolkit/components/extensions/WebExtensionPolicy.cpp index f27241b5a5a1..478b21d70ce5 100644 --- a/toolkit/components/extensions/WebExtensionPolicy.cpp +++ b/toolkit/components/extensions/WebExtensionPolicy.cpp @@ -459,7 +459,7 @@ WebExtensionPolicy::BackgroundPageHTML() const if (mBackgroundScripts.IsNull()) { result.SetIsVoid(true); - return result; + return std::move(result); } result.AppendLiteral(kBackgroundPageHTMLStart); @@ -472,7 +472,7 @@ WebExtensionPolicy::BackgroundPageHTML() const } result.AppendLiteral(kBackgroundPageHTMLEnd); - return result; + return std::move(result); } void diff --git a/toolkit/components/url-classifier/LookupCache.h b/toolkit/components/url-classifier/LookupCache.h index 200eb463d17c..98e6e02c2e7c 100644 --- a/toolkit/components/url-classifier/LookupCache.h +++ b/toolkit/components/url-classifier/LookupCache.h @@ -60,7 +60,7 @@ public: for (size_t i = 0; i < mPartialHashLength; i++) { hex.AppendPrintf("%.2X", hash.complete.buf[i]); } - return hex; + return std::move(hex); } bool Confirmed() const { return mConfirmed || mProtocolConfirmed; } From ccf5df3d8e257c4c2c01792a24ced898f57f8367 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Mon, 27 Aug 2018 15:15:21 +0000 Subject: [PATCH 07/64] Bug 1474847 - Fix GeckoSurfaceTexture not correctly removed from container when released: r=snorp,rbarker When entering and exiting immersive mode multiple time (~30) the WebGL context can be lost. This is caused because GeckoSurfaceTexture things there are more than 200 textures created. Differential Revision: https://phabricator.services.mozilla.com/D4236 --HG-- extra : moz-landing-system : lando --- .../mozilla/gecko/gfx/GeckoSurfaceTexture.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java index f5c6dffbdde7..edc50cc0ee2d 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java @@ -118,6 +118,18 @@ import org.mozilla.gecko.annotation.WrapForJNI; } } + @Override + public synchronized void release() { + try { + super.release(); + synchronized (sSurfaceTextures) { + sSurfaceTextures.remove(mHandle); + } + } catch (Exception e) { + Log.w(LOGTAG, "release() failed", e); + } + } + @Override @WrapForJNI public synchronized void releaseTexImage() { @@ -185,10 +197,6 @@ import org.mozilla.gecko.annotation.WrapForJNI; for (GeckoSurfaceTexture tex : list) { try { - synchronized (sSurfaceTextures) { - sSurfaceTextures.remove(tex.mHandle); - } - if (tex.isSingleBuffer()) { tex.releaseTexImage(); } From e259742bdfa01f544758dd2095b1b489ec4ed1a1 Mon Sep 17 00:00:00 2001 From: yulia Date: Mon, 27 Aug 2018 15:14:10 +0000 Subject: [PATCH 08/64] Bug 1483173 - introduce screenshot actor; r=ochameau This patch introduces a screenshot actor, which allows the screenshot functionality to be shared across tools, and also implements it for the toolbox itself Differential Revision: https://phabricator.services.mozilla.com/D3341 --HG-- rename : devtools/server/actors/webconsole/screenshot.js => devtools/shared/screenshot/capture.js rename : devtools/shared/webconsole/screenshot-helper.js => devtools/shared/screenshot/save.js extra : moz-landing-system : lando --- devtools/client/definitions.js | 12 +++--- devtools/client/inspector/inspector.js | 22 ++++++----- .../client/webconsole/components/JSTerm.js | 4 +- devtools/server/actors/moz.build | 1 + devtools/server/actors/screenshot.js | 20 ++++++++++ devtools/server/actors/webconsole/moz.build | 1 - devtools/server/actors/webconsole/utils.js | 10 ++--- devtools/server/main.js | 5 +++ devtools/shared/fronts/moz.build | 1 + devtools/shared/fronts/screenshot.js | 38 +++++++++++++++++++ devtools/shared/moz.build | 1 + .../screenshot/capture.js} | 26 +++++++------ devtools/shared/screenshot/moz.build | 10 +++++ .../save.js} | 36 +++++++----------- devtools/shared/specs/moz.build | 1 + devtools/shared/specs/screenshot.js | 32 ++++++++++++++++ devtools/shared/webconsole/moz.build | 1 - 17 files changed, 162 insertions(+), 59 deletions(-) create mode 100644 devtools/server/actors/screenshot.js create mode 100644 devtools/shared/fronts/screenshot.js rename devtools/{server/actors/webconsole/screenshot.js => shared/screenshot/capture.js} (90%) create mode 100644 devtools/shared/screenshot/moz.build rename devtools/shared/{webconsole/screenshot-helper.js => screenshot/save.js} (88%) create mode 100644 devtools/shared/specs/screenshot.js diff --git a/devtools/client/definitions.js b/devtools/client/definitions.js index 5d317f77b6f2..85164e6dcbd8 100644 --- a/devtools/client/definitions.js +++ b/devtools/client/definitions.js @@ -33,6 +33,7 @@ loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer loader.lazyRequireGetter(this, "CommandState", "devtools/shared/gcli/command-state", true); loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true); loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm"); +loader.lazyRequireGetter(this, "getScreenshotFront", "resource://devtools/shared/fronts/screenshot", true); const {MultiLocalizationHelper} = require("devtools/shared/l10n"); const L10N = new MultiLocalizationHelper( @@ -594,16 +595,17 @@ exports.ToolboxButtons = [ }, { id: "command-button-screenshot", description: l10n("toolbox.buttons.screenshot"), - isTargetSupported: target => target.isLocalTab, - onClick(event, toolbox) { + isTargetSupported: target => !target.chrome && target.hasActor("screenshot"), + async onClick(event, toolbox) { // Special case for screenshot button to check for clipboard preference const clipboardEnabled = Services.prefs .getBoolPref("devtools.screenshot.clipboard.enabled"); - let args = "--fullpage --file"; + const args = { fullpage: true, file: true }; if (clipboardEnabled) { - args += " --clipboard"; + args.clipboard = true; } - CommandUtils.executeOnTarget(toolbox.target, "screenshot " + args); + const screenshotFront = getScreenshotFront(toolbox.target); + await screenshotFront.captureAndSave(toolbox.win, args); } }, { id: "command-button-rulers", diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js index c09d2b3c3944..4d4b564dc9d1 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector.js @@ -33,9 +33,10 @@ loader.lazyRequireGetter(this, "nodeConstants", "devtools/shared/dom-node-consta loader.lazyRequireGetter(this, "Menu", "devtools/client/framework/menu"); loader.lazyRequireGetter(this, "MenuItem", "devtools/client/framework/menu-item"); loader.lazyRequireGetter(this, "ExtensionSidebar", "devtools/client/inspector/extensions/extension-sidebar"); -loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true); loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clipboard"); loader.lazyRequireGetter(this, "openContentLink", "devtools/client/shared/link", true); +loader.lazyRequireGetter(this, "getScreenshotFront", "devtools/shared/fronts/screenshot", true); +loader.lazyRequireGetter(this, "saveScreenshot", "devtools/shared/screenshot/save"); loader.lazyImporter(this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm"); @@ -2311,21 +2312,22 @@ Inspector.prototype = { * Initiate gcli screenshot command on selected node. */ async screenshotNode() { - const command = Services.prefs.getBoolPref("devtools.screenshot.clipboard.enabled") ? - "screenshot --file --clipboard --selector" : - "screenshot --file --selector"; - // Bug 1332936 - it's possible to call `screenshotNode` while the BoxModel highlighter // is still visible, therefore showing it in the picture. // To avoid that, we have to hide it before taking the screenshot. The `hideBoxModel` // will do that, calling `hide` for the highlighter only if previously shown. await this.highlighter.hideBoxModel(); - // Bug 1180314 - CssSelector might contain white space so need to make sure it is - // passed to screenshot as a single parameter. More work *might* be needed if - // CssSelector could contain escaped single- or double-quotes, backslashes, etc. - CommandUtils.executeOnTarget(this._target, - `${command} '${this.selectionCssSelector}'`); + const clipboardEnabled = Services.prefs + .getBoolPref("devtools.screenshot.clipboard.enabled"); + const args = { + file: true, + selector: this.selectionCssSelector, + clipboard: clipboardEnabled + }; + const screenshotFront = getScreenshotFront(this.target); + const screenshot = await screenshotFront.capture(args); + await saveScreenshot(this.panelWin, args, screenshot); }, /** diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index b2b04861803a..f49f881904f8 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -18,7 +18,7 @@ loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools" loader.lazyRequireGetter(this, "KeyCodes", "devtools/client/shared/keycodes", true); loader.lazyRequireGetter(this, "Editor", "devtools/client/sourceeditor/editor"); loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry"); -loader.lazyRequireGetter(this, "processScreenshot", "devtools/shared/webconsole/screenshot-helper"); +loader.lazyRequireGetter(this, "saveScreenshot", "devtools/shared/screenshot/save"); const l10n = require("devtools/client/webconsole/webconsole-l10n"); @@ -473,7 +473,7 @@ class JSTerm extends Component { break; case "screenshotOutput": const { args, value } = helperResult; - const results = await processScreenshot(this.hud.window, args, value); + const results = await saveScreenshot(this.hud.window, args, value); this.screenshotNotify(results); // early return as screenshot notify has dispatched all necessary messages return null; diff --git a/devtools/server/actors/moz.build b/devtools/server/actors/moz.build index 0839a42c722a..bd79292d7e5b 100644 --- a/devtools/server/actors/moz.build +++ b/devtools/server/actors/moz.build @@ -57,6 +57,7 @@ DevToolsModules( 'promises.js', 'reflow.js', 'root.js', + 'screenshot.js', 'source.js', 'storage.js', 'string.js', diff --git a/devtools/server/actors/screenshot.js b/devtools/server/actors/screenshot.js new file mode 100644 index 000000000000..57adc5bef128 --- /dev/null +++ b/devtools/server/actors/screenshot.js @@ -0,0 +1,20 @@ +/* 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/. */ + +"use strict"; + +const protocol = require("devtools/shared/protocol"); +const {captureScreenshot} = require("devtools/shared/screenshot/capture"); +const {screenshotSpec} = require("devtools/shared/specs/screenshot"); + +exports.ScreenshotActor = protocol.ActorClassWithSpec(screenshotSpec, { + initialize: function(conn, targetActor) { + protocol.Actor.prototype.initialize.call(this, conn); + this.document = targetActor.window.document; + }, + + capture: function(args) { + return captureScreenshot(args, this.document); + } +}); diff --git a/devtools/server/actors/webconsole/moz.build b/devtools/server/actors/webconsole/moz.build index c7d156a80ff5..c98340a1071a 100644 --- a/devtools/server/actors/webconsole/moz.build +++ b/devtools/server/actors/webconsole/moz.build @@ -13,7 +13,6 @@ DevToolsModules( 'content-process-forward.js', 'eval-with-debugger.js', 'message-manager-mock.js', - 'screenshot.js', 'utils.js', 'worker-listeners.js', ) diff --git a/devtools/server/actors/webconsole/utils.js b/devtools/server/actors/webconsole/utils.js index f7f3433c65b3..595868e4c8d7 100644 --- a/devtools/server/actors/webconsole/utils.js +++ b/devtools/server/actors/webconsole/utils.js @@ -7,11 +7,10 @@ const {Ci, Cu} = require("chrome"); -loader.lazyRequireGetter(this, "screenshot", "devtools/server/actors/webconsole/screenshot", true); - -// Note that this is only used in WebConsoleCommands, see $0 and pprint(). +// Note that this is only used in WebConsoleCommands, see $0, screenshot and pprint(). if (!isWorker) { loader.lazyImporter(this, "VariablesView", "resource://devtools/client/shared/widgets/VariablesView.jsm"); + loader.lazyRequireGetter(this, "captureScreenshot", "devtools/shared/screenshot/capture", true); } const CONSOLE_WORKER_IDS = exports.CONSOLE_WORKER_IDS = [ @@ -599,10 +598,11 @@ WebConsoleCommands._registerOriginal("copy", function(owner, value) { * The arguments to be passed to the screenshot * @return void */ -WebConsoleCommands._registerOriginal("screenshot", function(owner, args) { +WebConsoleCommands._registerOriginal("screenshot", function(owner, args = {}) { owner.helperResult = (async () => { // creates data for saving the screenshot - const value = await screenshot(owner, args); + // help is handled on the client side + const value = await captureScreenshot(args, owner.window.document); return { type: "screenshotOutput", value, diff --git a/devtools/server/main.js b/devtools/server/main.js index 533ae3e1ab93..eaf2c7721029 100644 --- a/devtools/server/main.js +++ b/devtools/server/main.js @@ -426,6 +426,11 @@ var DebuggerServer = { constructor: "AccessibilityActor", type: { target: true } }); + this.registerModule("devtools/server/actors/screenshot", { + prefix: "screenshot", + constructor: "ScreenshotActor", + type: { target: true } + }); }, /** diff --git a/devtools/shared/fronts/moz.build b/devtools/shared/fronts/moz.build index 70a53a124458..eebfa5f6bf4a 100644 --- a/devtools/shared/fronts/moz.build +++ b/devtools/shared/fronts/moz.build @@ -31,6 +31,7 @@ DevToolsModules( 'preference.js', 'promises.js', 'reflow.js', + 'screenshot.js', 'storage.js', 'string.js', 'styles.js', diff --git a/devtools/shared/fronts/screenshot.js b/devtools/shared/fronts/screenshot.js new file mode 100644 index 000000000000..c56cb9ace161 --- /dev/null +++ b/devtools/shared/fronts/screenshot.js @@ -0,0 +1,38 @@ +/* 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/. */ +"use strict"; + +const {screenshotSpec} = require("devtools/shared/specs/screenshot"); +const saveScreenshot = require("devtools/shared/screenshot/save"); +const protocol = require("devtools/shared/protocol"); + +const ScreenshotFront = protocol.FrontClassWithSpec(screenshotSpec, { + initialize: function(client, form) { + protocol.Front.prototype.initialize.call(this, client); + this.actorID = form.screenshotActor; + this.manage(this); + }, + + async captureAndSave(window, args) { + const screenshot = await this.capture(args); + return saveScreenshot(window, args, screenshot); + } +}); + +// A cache of created fronts: WeakMap +const knownFronts = new WeakMap(); + +/** + * Create a screenshot front only when needed + */ +function getScreenshotFront(target) { + let front = knownFronts.get(target.client); + if (front == null && target.form.screenshotActor != null) { + front = new ScreenshotFront(target.client, target.form); + knownFronts.set(target.client, front); + } + return front; +} + +exports.getScreenshotFront = getScreenshotFront; diff --git a/devtools/shared/moz.build b/devtools/shared/moz.build index c3c38d52b10a..2e490329aa4c 100644 --- a/devtools/shared/moz.build +++ b/devtools/shared/moz.build @@ -25,6 +25,7 @@ DIRS += [ 'platform', 'pretty-fast', 'qrcode', + 'screenshot', 'security', 'sourcemap', 'sprintfjs', diff --git a/devtools/server/actors/webconsole/screenshot.js b/devtools/shared/screenshot/capture.js similarity index 90% rename from devtools/server/actors/webconsole/screenshot.js rename to devtools/shared/screenshot/capture.js index 61c5b0d7af34..e3da3dff3740 100644 --- a/devtools/server/actors/webconsole/screenshot.js +++ b/devtools/shared/screenshot/capture.js @@ -3,25 +3,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; - const { Cu } = require("chrome"); -const { getRect } = require("devtools/shared/layout/utils"); const { LocalizationHelper } = require("devtools/shared/l10n"); const CONTAINER_FLASHING_DURATION = 500; const STRINGS_URI = "devtools/shared/locales/screenshot.properties"; const L10N = new LocalizationHelper(STRINGS_URI); -exports.screenshot = function takeAsyncScreenshot(owner, args = {}) { - if (args.help) { - // Early return as help will be handled on the client side. - return null; - } - return captureScreenshot(args, owner.window.document); -}; +loader.lazyRequireGetter(this, "getRect", "devtools/shared/layout/utils", true); /** * This function is called to simulate camera effects + * @param object document + * The target document. */ function simulateCameraFlash(document) { const window = document.defaultView; @@ -34,21 +28,26 @@ function simulateCameraFlash(document) { * createScreenshotData */ function captureScreenshot(args, document) { + if (args.help) { + return null; + } if (args.delay > 0) { return new Promise((resolve, reject) => { document.defaultView.setTimeout(() => { - createScreenshotData(document, args).then(resolve, reject); + createScreenshotDataURL(document, args).then(resolve, reject); }, args.delay * 1000); }); } - return createScreenshotData(document, args); + return createScreenshotDataURL(document, args); } +exports.captureScreenshot = captureScreenshot; + /** * This does the dirty work of creating a base64 string out of an * area of the browser window */ -function createScreenshotData(document, args) { +function createScreenshotDataURL(document, args) { const window = document.defaultView; let left = 0; let top = 0; @@ -111,6 +110,8 @@ function createScreenshotData(document, args) { }); } +exports.createScreenshotDataURL = createScreenshotDataURL; + /** * We may have a filename specified in args, or we might have to generate * one. @@ -138,3 +139,4 @@ function getFilename(defaultName) { timeString ) + ".png"; } + diff --git a/devtools/shared/screenshot/moz.build b/devtools/shared/screenshot/moz.build new file mode 100644 index 000000000000..f8d16a902e6c --- /dev/null +++ b/devtools/shared/screenshot/moz.build @@ -0,0 +1,10 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +DevToolsModules( + 'capture.js', + 'save.js', +) diff --git a/devtools/shared/webconsole/screenshot-helper.js b/devtools/shared/screenshot/save.js similarity index 88% rename from devtools/shared/webconsole/screenshot-helper.js rename to devtools/shared/screenshot/save.js index bb32ee38185a..56c588a68095 100644 --- a/devtools/shared/webconsole/screenshot-helper.js +++ b/devtools/shared/screenshot/save.js @@ -98,8 +98,8 @@ function getFormattedHelpData() { /** * Main entry point in this file; Takes the original arguments that `:screenshot` was - * called with and the image value from the server, and uses the client window to save - * the screenshot to the remote debugging machine's memory or clipboard. + * called with and the image value from the server, and uses the client window to add + * and audio effect. * * @param object window * The Debugger Client window. @@ -113,14 +113,14 @@ function getFormattedHelpData() { * @return string[] * Response messages from processing the screenshot */ -function processScreenshot(window, args = {}, value) { +function saveScreenshot(window, args = {}, value) { if (args.help) { const message = getFormattedHelpData(); - // Wrap meesage in an array so that the return value is consistant with saveScreenshot + // Wrap message in an array so that the return value is consistant with save return [message]; } - simulateCameraShutter(window.document); - return saveScreenshot(window, args, value); + simulateCameraShutter(window); + return save(args, value); } /** @@ -129,8 +129,7 @@ function processScreenshot(window, args = {}, value) { * @param object document * The Debugger Client document. */ -function simulateCameraShutter(document) { - const window = document.defaultView; +function simulateCameraShutter(window) { if (Services.prefs.getBoolPref("devtools.screenshot.audio.enabled")) { const audioCamera = new window.Audio("resource://devtools/client/themes/audio/shutter.wav"); audioCamera.play(); @@ -140,9 +139,6 @@ function simulateCameraShutter(document) { /** * Save the captured screenshot to one of several destinations. * - * @param object window - * The Debugger Client window. - * * @param object args * The original args with which the screenshot was called. * @@ -152,18 +148,18 @@ function simulateCameraShutter(document) { * @return string[] * Response messages from processing the screenshot. */ -async function saveScreenshot(window, args, image) { +async function save(args, image) { const fileNeeded = args.filename || !args.clipboard || args.file; const results = []; if (args.clipboard) { - const result = saveToClipboard(window, image.data); + const result = saveToClipboard(image.data); results.push(result); } if (fileNeeded) { - const result = await saveToFile(window, image); + const result = await saveToFile(image); results.push(result); } return results; @@ -173,16 +169,13 @@ async function saveScreenshot(window, args, image) { * Save the image data to the clipboard. This returns a promise, so it can * be treated exactly like file processing. * - * @param object window - * The Debugger Client window. - * * @param string base64URI * The image data encoded in a base64 URI that was sent from the server. * * @return string * Response message from processing the screenshot. */ -function saveToClipboard(window, base64URI) { +function saveToClipboard(base64URI) { try { const imageTools = Cc["@mozilla.org/image/tools;1"] .getService(Ci.imgITools); @@ -212,16 +205,13 @@ function saveToClipboard(window, base64URI) { * Save the screenshot data to disk, returning a promise which is resolved on * completion. * - * @param object window - * The Debugger Client window. - * * @param object image * The image object that was sent from the server. * * @return string * Response message from processing the screenshot. */ -async function saveToFile(window, image) { +async function saveToFile(image) { let filename = image.filename; // Check there is a .png extension to filename @@ -258,4 +248,4 @@ async function saveToFile(window, image) { } } -module.exports = processScreenshot; +module.exports = saveScreenshot; diff --git a/devtools/shared/specs/moz.build b/devtools/shared/specs/moz.build index 43a2abcdf4c4..2dcd598f8255 100644 --- a/devtools/shared/specs/moz.build +++ b/devtools/shared/specs/moz.build @@ -42,6 +42,7 @@ DevToolsModules( 'promises.js', 'property-iterator.js', 'reflow.js', + 'screenshot.js', 'script.js', 'source.js', 'storage.js', diff --git a/devtools/shared/specs/screenshot.js b/devtools/shared/specs/screenshot.js new file mode 100644 index 000000000000..58be5e557042 --- /dev/null +++ b/devtools/shared/specs/screenshot.js @@ -0,0 +1,32 @@ +/* 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/. */ +"use strict"; + +const {RetVal, Arg, generateActorSpec, types} = require("devtools/shared/protocol"); + +types.addDictType("screenshot.args", { + fullpage: "nullable:boolean", + file: "nullable:boolean", + clipboard: "nullable:boolean", + selector: "nullable:string", + dpr: "nullable:string", + delay: "nullable:string" +}); + +const screenshotSpec = generateActorSpec({ + typeName: "screenshot", + + methods: { + capture: { + request: { + args: Arg(0, "screenshot.args") + }, + response: { + value: RetVal("json")} + }, + }, +}); + +exports.screenshotSpec = screenshotSpec; + diff --git a/devtools/shared/webconsole/moz.build b/devtools/shared/webconsole/moz.build index 0ba7e8e21e44..a93ccff8b505 100644 --- a/devtools/shared/webconsole/moz.build +++ b/devtools/shared/webconsole/moz.build @@ -12,6 +12,5 @@ DevToolsModules( 'client.js', 'js-property-provider.js', 'network-helper.js', - 'screenshot-helper.js', 'throttle.js', ) From 2cbfcdeacb607b8bd4107a2fab11e79759f46c20 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 27 Aug 2018 18:26:41 +0300 Subject: [PATCH 09/64] Backed out changeset be4fd8ee7afd (bug 1483985) for causing build bustages on LookupCache. CLOSED TREE --- dom/storage/LocalStorageManager.cpp | 2 +- gfx/thebes/gfxPlatform.cpp | 2 +- layout/painting/DisplayItemClip.cpp | 2 +- layout/painting/DisplayItemClipChain.cpp | 2 +- layout/painting/nsDisplayList.cpp | 2 +- toolkit/components/extensions/WebExtensionPolicy.cpp | 4 ++-- toolkit/components/url-classifier/LookupCache.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dom/storage/LocalStorageManager.cpp b/dom/storage/LocalStorageManager.cpp index b5d9739b5e7e..b83e00cee19e 100644 --- a/dom/storage/LocalStorageManager.cpp +++ b/dom/storage/LocalStorageManager.cpp @@ -142,7 +142,7 @@ LocalStorageManager::CreateOrigin(const nsACString& aOriginSuffix, scope.Append(aOriginSuffix); scope.Append(':'); scope.Append(aOriginNoSuffix); - return std::move(scope); + return scope; } LocalStorageCache* diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index d3fecf4065a4..bf62658f7186 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1668,7 +1668,7 @@ gfxPlatform::GetDefaultFontName(const nsACString& aLangGroup, fontFamily->LocalizedName(result); } // (else, leave 'result' empty) - return std::move(result); + return result; } bool diff --git a/layout/painting/DisplayItemClip.cpp b/layout/painting/DisplayItemClip.cpp index b813e485d25c..dcd2e22a09ed 100644 --- a/layout/painting/DisplayItemClip.cpp +++ b/layout/painting/DisplayItemClip.cpp @@ -545,7 +545,7 @@ DisplayItemClip::ToString() const r.mRadii[4], r.mRadii[5], r.mRadii[6], r.mRadii[7]); } } - return std::move(str); + return str; } void diff --git a/layout/painting/DisplayItemClipChain.cpp b/layout/painting/DisplayItemClipChain.cpp index 3014e000984c..d95d9800a57c 100644 --- a/layout/painting/DisplayItemClipChain.cpp +++ b/layout/painting/DisplayItemClipChain.cpp @@ -79,7 +79,7 @@ DisplayItemClipChain::ToString(const DisplayItemClipChain* aClipChain) str.AppendLiteral(", "); } } - return std::move(str); + return str; } bool diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 4e9e311cb993..3c902a103e25 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -174,7 +174,7 @@ ActiveScrolledRoot::ToString(const ActiveScrolledRoot* aActiveScrolledRoot) str.AppendLiteral(", "); } } - return std::move(str); + return str; } static inline CSSAngle diff --git a/toolkit/components/extensions/WebExtensionPolicy.cpp b/toolkit/components/extensions/WebExtensionPolicy.cpp index 478b21d70ce5..f27241b5a5a1 100644 --- a/toolkit/components/extensions/WebExtensionPolicy.cpp +++ b/toolkit/components/extensions/WebExtensionPolicy.cpp @@ -459,7 +459,7 @@ WebExtensionPolicy::BackgroundPageHTML() const if (mBackgroundScripts.IsNull()) { result.SetIsVoid(true); - return std::move(result); + return result; } result.AppendLiteral(kBackgroundPageHTMLStart); @@ -472,7 +472,7 @@ WebExtensionPolicy::BackgroundPageHTML() const } result.AppendLiteral(kBackgroundPageHTMLEnd); - return std::move(result); + return result; } void diff --git a/toolkit/components/url-classifier/LookupCache.h b/toolkit/components/url-classifier/LookupCache.h index 98e6e02c2e7c..200eb463d17c 100644 --- a/toolkit/components/url-classifier/LookupCache.h +++ b/toolkit/components/url-classifier/LookupCache.h @@ -60,7 +60,7 @@ public: for (size_t i = 0; i < mPartialHashLength; i++) { hex.AppendPrintf("%.2X", hash.complete.buf[i]); } - return std::move(hex); + return hex; } bool Confirmed() const { return mConfirmed || mProtocolConfirmed; } From 8918ef83759a55d4b224bbb8a465413e9165b8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 27 Aug 2018 15:35:56 +0000 Subject: [PATCH 10/64] Bug 1486399 - Teach the layout debugger about relative URIs. r=mats It always bites me when I want to load a standalone test-case in there. Differential Revision: https://phabricator.services.mozilla.com/D4324 --HG-- extra : moz-landing-system : lando --- layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp b/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp index 2a6db7be58ee..26245cdfa6f4 100644 --- a/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp +++ b/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp @@ -51,13 +51,17 @@ nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) nsCOMPtr argsArray = nsArray::Create(); - if (!url.IsEmpty()) - { + if (!url.IsEmpty()) { + nsCOMPtr uri; + rv = aCmdLine->ResolveURI(url, getter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr scriptableURL = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID); NS_ENSURE_TRUE(scriptableURL, NS_ERROR_FAILURE); - - scriptableURL->SetData(url); + nsAutoCString resolvedSpec; + rv = uri->GetSpec(resolvedSpec); + NS_ENSURE_SUCCESS(rv, rv); + scriptableURL->SetData(NS_ConvertUTF8toUTF16(resolvedSpec)); argsArray->AppendElement(scriptableURL); } From 19916781837c4bd29c7eb673ff24f1563b0e56b6 Mon Sep 17 00:00:00 2001 From: ahillier Date: Mon, 27 Aug 2018 15:53:18 +0000 Subject: [PATCH 11/64] Bug 1471391 - Create initial CFR doorhanger r=k88hudson Differential Revision: https://phabricator.services.mozilla.com/D4266 --HG-- extra : moz-landing-system : lando --- browser/base/content/browser.js | 3 + .../content/assets/glyph-webextension-16.svg | 2 +- .../components/newtab/lib/CFRPageActions.jsm | 247 ++++++++++++++++++ 3 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 browser/components/newtab/lib/CFRPageActions.jsm diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 3d11006b10bc..5db666184d07 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -19,6 +19,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm", BrowserUtils: "resource://gre/modules/BrowserUtils.jsm", BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm", + CFRPageActions: "resource://activity-stream/lib/CFRPageActions.jsm", CharsetMenu: "resource://gre/modules/CharsetMenu.jsm", Color: "resource://gre/modules/Color.jsm", ContentSearch: "resource:///modules/ContentSearch.jsm", @@ -4817,6 +4818,8 @@ var XULBrowserWindow = { CustomizationHandler.isCustomizing()) { gCustomizeMode.exit(); } + + CFRPageActions.updatePageActions(gBrowser.selectedBrowser); } UpdateBackForwardCommands(gBrowser.webNavigation); ReaderParent.updateReaderButton(gBrowser.selectedBrowser); diff --git a/browser/components/newtab/data/content/assets/glyph-webextension-16.svg b/browser/components/newtab/data/content/assets/glyph-webextension-16.svg index c057f148e7e7..1b65dd449041 100644 --- a/browser/components/newtab/data/content/assets/glyph-webextension-16.svg +++ b/browser/components/newtab/data/content/assets/glyph-webextension-16.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/browser/components/newtab/lib/CFRPageActions.jsm b/browser/components/newtab/lib/CFRPageActions.jsm new file mode 100644 index 000000000000..5be4c035b82e --- /dev/null +++ b/browser/components/newtab/lib/CFRPageActions.jsm @@ -0,0 +1,247 @@ +/* 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/. */ +"use strict"; + +const POPUP_NOTIFICATION_ID = "contextual-feature-recommendation"; + +const DELAY_BEFORE_EXPAND_MS = 1000; +const DURATION_OF_EXPAND_MS = 5000; + +/** + * A WeakMap from browsers to {host, recommendation} pairs. Recommendations are + * defined in the ExtensionDoorhanger.schema.json. + * + * A recommendation is specific to a browser and host and is active until the + * given browser is closed or the user navigates (within that browser) away from + * the host. + */ +const RecommendationMap = new WeakMap(); + +/** + * A WeakMap from windows to their CFR PageAction. + */ +const PageActionMap = new WeakMap(); + +/** + * We need one PageAction for each window + */ +class PageAction { + constructor(win, dispatchToASRouter) { + this.window = win; + this.urlbar = win.document.getElementById("urlbar"); + this.container = win.document.getElementById("contextual-feature-recommendation"); + this.button = win.document.getElementById("cfr-button"); + this.label = win.document.getElementById("cfr-label"); + + this._dispatchToASRouter = dispatchToASRouter; + this._popupStateChange = this._popupStateChange.bind(this); + this._collapse = this._collapse.bind(this); + this._handleClick = this._handleClick.bind(this); + + // Saved timeout IDs for scheduled state changes, so they can be cancelled + this.stateTransitionTimeoutIDs = []; + + this.container.onclick = this._handleClick; + } + + async show(notificationText, shouldExpand = false) { + this.container.hidden = false; + + this.label.value = notificationText; + + // Wait for layout to flush to avoid a synchronous reflow then calculate the + // label width. We can safely get the width even though the recommendation is + // collapsed; the label itself remains full width (with its overflow hidden) + await this.window.promiseDocumentFlushed; + const [{width}] = this.label.getClientRects(); + this.urlbar.style.setProperty("--cfr-label-width", `${width}px`); + + if (shouldExpand) { + this._clearScheduledStateChanges(); + + // After one second, expand + this._expand(DELAY_BEFORE_EXPAND_MS); + + // Five seconds later, collapse again + this._collapse(DELAY_BEFORE_EXPAND_MS + DURATION_OF_EXPAND_MS); + } + } + + hide() { + this.container.hidden = true; + this._clearScheduledStateChanges(); + this.urlbar.removeAttribute("cfr-recommendation-state"); + } + + _expand(delay = 0) { + if (!delay) { + // Non-delayed state change overrides any scheduled state changes + this._clearScheduledStateChanges(); + this.urlbar.setAttribute("cfr-recommendation-state", "expanded"); + } else { + this.stateTransitionTimeoutIDs.push(this.window.setTimeout(() => { + this.urlbar.setAttribute("cfr-recommendation-state", "expanded"); + }, delay)); + } + } + + _collapse(delay = 0) { + if (!delay) { + // Non-delayed state change overrides any scheduled state changes + this._clearScheduledStateChanges(); + if (this.urlbar.getAttribute("cfr-recommendation-state") === "expanded") { + this.urlbar.setAttribute("cfr-recommendation-state", "collapsed"); + } + } else { + this.stateTransitionTimeoutIDs.push(this.window.setTimeout(() => { + if (this.urlbar.getAttribute("cfr-recommendation-state") === "expanded") { + this.urlbar.setAttribute("cfr-recommendation-state", "collapsed"); + } + }, delay)); + } + } + + _clearScheduledStateChanges() { + while (this.stateTransitionTimeoutIDs.length > 0) { + // clearTimeout is safe even with invalid/expired IDs + this.window.clearTimeout(this.stateTransitionTimeoutIDs.pop()); + } + } + + // This is called when the popup closes as a result of interaction _outside_ + // the popup, e.g. by hitting + _popupStateChange(state) { + if (["dismissed", "removed"].includes(state)) { + this._collapse(); + } + } + + /** + * Respond to a user click on the recommendation by showing a doorhanger/ + * popup notification + */ + _handleClick(event) { + const browser = this.window.gBrowser.selectedBrowser; + if (!RecommendationMap.has(browser)) { + // There's no recommendation for this browser, so the user shouldn't have + // been able to click + this.hide(); + return; + } + const {content} = RecommendationMap.get(browser); + + // The recommendation should remain either collapsed or expanded while the + // doorhanger is showing + this._clearScheduledStateChanges(); + + // A hacky way of setting the popup anchor outside the usual url bar icon box + // See https://searchfox.org/mozilla-central/rev/847b64cc28b74b44c379f9bff4f415b97da1c6d7/toolkit/modules/PopupNotifications.jsm#42 + browser.cfrpopupnotificationanchor = this.container; + + const {primary, secondary} = content.buttons; + + const mainAction = { + label: primary.label, + accessKey: primary.accessKey, + callback: () => this._dispatchToASRouter(primary.action) + }; + + const secondaryActions = [{ + label: secondary.label, + accessKey: secondary.accessKey, + callback: this._collapse + }]; + + const options = { + popupIconURL: content.addon.icon, + hideClose: true, + eventCallback: this._popupStateChange + }; + + this.window.PopupNotifications.show( + browser, + POPUP_NOTIFICATION_ID, + content.text, + "cfr", + mainAction, + secondaryActions, + options + ); + } +} + +function isHostMatch(browser, host) { + return (browser.documentURI.scheme.startsWith("http") && + browser.documentURI.host === host); +} + +const CFRPageActions = { + // For testing purposes + RecommendationMap, + PageActionMap, + + /** + * To be called from browser.js on a location change, passing in the browser + * that's been updated + */ + updatePageActions(browser) { + const win = browser.ownerGlobal; + const pageAction = PageActionMap.get(win); + if (!pageAction || browser !== win.gBrowser.selectedBrowser) { + return; + } + if (RecommendationMap.has(browser)) { + const {host, content} = RecommendationMap.get(browser); + if (isHostMatch(browser, host)) { + // The browser has a recommendation specified with this host, so show + // the page action + pageAction.show(content.notification_text); + } else { + // The user has navigated away from the specified host in the given + // browser, so the recommendation is no longer valid and should be removed + RecommendationMap.delete(browser); + pageAction.hide(); + } + } else { + // There's no recommendation specified for this browser, so hide the page action + pageAction.hide(); + } + }, + + /** + * Add a recommendation specific to the given browser and host. + * @param browser The browser for the recommendation + * @param host The host for the recommendation + * @param recommendation The recommendation to show + * @param dispatchToASRouter A function to dispatch resulting actions to + * @param force Force the recommendation to appear if the host doesn't match + * @return Did adding the recommendation succeed? + */ + async addRecommendation(browser, host, recommendation, dispatchToASRouter, force = false) { + const win = browser.ownerGlobal; + if (browser !== win.gBrowser.selectedBrowser || !(force || isHostMatch(browser, host))) { + return false; + } + const {id, content} = recommendation; + RecommendationMap.set(browser, {id, host, content}); + if (!PageActionMap.has(win)) { + PageActionMap.set(win, new PageAction(win, dispatchToASRouter)); + } + await PageActionMap.get(win).show(recommendation.content.notification_text, true); + return true; + }, + + /** + * Clear all recommendations and hide all PageActions + */ + clearRecommendations() { + for (const [win, pageAction] of PageActionMap) { + pageAction.hide(); + PageActionMap.delete(win); + } + RecommendationMap.clear(); + } +}; + +const EXPORTED_SYMBOLS = ["CFRPageActions"]; From 47b25bfccadab0fd955ef7065b740f899b751152 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Mon, 27 Aug 2018 15:49:01 +0000 Subject: [PATCH 12/64] Bug 1486329 - Fix some clang-cl warnings in accessible. r=eeejay Specifically this fixes pessimizing-move warnings and some others. Differential Revision: https://phabricator.services.mozilla.com/D4302 --HG-- extra : moz-landing-system : lando --- accessible/ipc/DocAccessibleParent.cpp | 2 +- accessible/ipc/win/HandlerProvider.cpp | 2 +- accessible/ipc/win/PlatformChild.cpp | 4 ++-- accessible/ipc/win/ProxyAccessible.cpp | 4 ++-- accessible/windows/msaa/AccessibleWrap.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/accessible/ipc/DocAccessibleParent.cpp b/accessible/ipc/DocAccessibleParent.cpp index 44bd73fa6b6f..259d62c575dd 100644 --- a/accessible/ipc/DocAccessibleParent.cpp +++ b/accessible/ipc/DocAccessibleParent.cpp @@ -760,7 +760,7 @@ DocAccessibleParent::SendParentCOMProxy() } #if defined(MOZ_CONTENT_SANDBOX) - mParentProxyStream = std::move(holder.GetPreservedStream()); + mParentProxyStream = holder.GetPreservedStream(); #endif // defined(MOZ_CONTENT_SANDBOX) } diff --git a/accessible/ipc/win/HandlerProvider.cpp b/accessible/ipc/win/HandlerProvider.cpp index cf5e27bea746..17ff81dac0af 100644 --- a/accessible/ipc/win/HandlerProvider.cpp +++ b/accessible/ipc/win/HandlerProvider.cpp @@ -247,7 +247,7 @@ HandlerProvider::BuildDynamicIA2Data(DynamicIA2Data* aOutIA2Data) return FAILED(hr); }; - auto cleanup = [this, aOutIA2Data]() -> void { + auto cleanup = [aOutIA2Data]() -> void { CleanupDynamicIA2Data(*aOutIA2Data); }; diff --git a/accessible/ipc/win/PlatformChild.cpp b/accessible/ipc/win/PlatformChild.cpp index 1dfc8baf827b..f2c79c69a67e 100644 --- a/accessible/ipc/win/PlatformChild.cpp +++ b/accessible/ipc/win/PlatformChild.cpp @@ -70,14 +70,14 @@ PlatformChild::PlatformChild() UniquePtr customProxy; mozilla::mscom::EnsureMTA([&customProxy]() -> void { - customProxy = std::move(mozilla::mscom::RegisterProxy()); + customProxy = mozilla::mscom::RegisterProxy(); }); mCustomProxy = std::move(customProxy); // IA2 needs to be registered in both the main thread's STA as well as the MTA UniquePtr ia2ProxyMTA; mozilla::mscom::EnsureMTA([&ia2ProxyMTA]() -> void { - ia2ProxyMTA = std::move(mozilla::mscom::RegisterProxy(L"ia2marshal.dll")); + ia2ProxyMTA = mozilla::mscom::RegisterProxy(L"ia2marshal.dll"); }); mIA2ProxyMTA = std::move(ia2ProxyMTA); } diff --git a/accessible/ipc/win/ProxyAccessible.cpp b/accessible/ipc/win/ProxyAccessible.cpp index 9724bb6b4f52..45b7bf7857c1 100644 --- a/accessible/ipc/win/ProxyAccessible.cpp +++ b/accessible/ipc/win/ProxyAccessible.cpp @@ -244,7 +244,7 @@ ProxyAccessible::BoundsInCSSPixels() } nsIntRect rect; - HRESULT hr = custom->get_boundsInCSSPixels(&rect.x, &rect.y, &rect.width, &rect.height); + Unused << custom->get_boundsInCSSPixels(&rect.x, &rect.y, &rect.width, &rect.height); return rect; } @@ -416,7 +416,7 @@ ProxyAccessible::RelationByType(RelationType aType) const } CoTaskMemFree(targets); - return std::move(proxies); + return proxies; } double diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index 29a778b25f66..ccd4a4f378c3 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -1770,7 +1770,7 @@ AccessibleWrap::InvalidateHandlers() if (hr == CO_E_OBJNOTCONNECTED || hr == kErrorServerDied) { sHandlerControllers->RemoveElement(controller); } else { - NS_WARN_IF(FAILED(hr)); + Unused << NS_WARN_IF(FAILED(hr)); } } } From b965d1aa0ed08e2a01bd62de991f381a9f9cb2cd Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Mon, 27 Aug 2018 16:25:54 +0000 Subject: [PATCH 13/64] Bug 1486502 - Add widevine CDM headers to third party paths, clang-format ignore. r=sylvestre We wish to keep the widevine headers in the same formatting as upstream to ease comparison and as we do not modify these files. This patch adds the existing headers, as well as another we anticipate pulling down for our next bump (content_decryption_module_proxy.h) to the ignored paths. These files are ignored individually rather than the whole directory they're in, as we also have Mozilla code in that dir. Differential Revision: https://phabricator.services.mozilla.com/D4347 --HG-- extra : moz-landing-system : lando --- .clang-format-ignore | 4 ++++ tools/rewriting/ThirdPartyPaths.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.clang-format-ignore b/.clang-format-ignore index ee5d4763575f..e78ab84b7704 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -35,6 +35,10 @@ browser/extensions/mortar/ppapi/.* db/sqlite3/src/.* devtools/client/sourceeditor/codemirror/.* devtools/client/sourceeditor/tern/.* +dom/media/gmp/widevine-adapter/content_decryption_module.h +dom/media/gmp/widevine-adapter/content_decryption_module_export.h +dom/media/gmp/widevine-adapter/content_decryption_module_ext.h +dom/media/gmp/widevine-adapter/content_decryption_module_proxy.h editor/libeditor/tests/browserscope/lib/richtext/.* editor/libeditor/tests/browserscope/lib/richtext2/.* extensions/spellcheck/hunspell/src/.* diff --git a/tools/rewriting/ThirdPartyPaths.txt b/tools/rewriting/ThirdPartyPaths.txt index d88e671aaaeb..7229f3ebcc83 100644 --- a/tools/rewriting/ThirdPartyPaths.txt +++ b/tools/rewriting/ThirdPartyPaths.txt @@ -5,6 +5,10 @@ devtools/client/sourceeditor/codemirror/ devtools/client/sourceeditor/tern/ devtools/shared/heapsnapshot/CoreDump.pb.cc devtools/shared/heapsnapshot/CoreDump.pb.h +dom/media/gmp/widevine-adapter/content_decryption_module.h +dom/media/gmp/widevine-adapter/content_decryption_module_export.h +dom/media/gmp/widevine-adapter/content_decryption_module_ext.h +dom/media/gmp/widevine-adapter/content_decryption_module_proxy.h editor/libeditor/tests/browserscope/lib/richtext/ editor/libeditor/tests/browserscope/lib/richtext2/ extensions/spellcheck/hunspell/src/ From 4ff4d6af9a033eed86f94d16241e9db32ea5b6bd Mon Sep 17 00:00:00 2001 From: ffxbld Date: Mon, 27 Aug 2018 16:49:15 +0000 Subject: [PATCH 14/64] No Bug, taskcluster/docker/funsize-update-generator pipfile-update. r=bhearsum Differential Revision: https://phabricator.services.mozilla.com/D4320 --HG-- extra : moz-landing-system : lando --- .../funsize-update-generator/Pipfile.lock | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/taskcluster/docker/funsize-update-generator/Pipfile.lock b/taskcluster/docker/funsize-update-generator/Pipfile.lock index 928f055f34c7..cb16c4ccd5ce 100644 --- a/taskcluster/docker/funsize-update-generator/Pipfile.lock +++ b/taskcluster/docker/funsize-update-generator/Pipfile.lock @@ -18,24 +18,31 @@ "default": { "aiohttp": { "hashes": [ - "sha256:1a112a1fdf3802b7f2b182e22e51d71e4a8fa7387d0d38e79a268921b869e384", - "sha256:33aa7c937ebaf063a860cbb0c263a771b33333a84965c6148eeafe64fb4e29ca", - "sha256:550b4a0788500f6d00f41b7fdd9fcce6d78f99706a7b2f6f81d4d331c7ca468e", - "sha256:601e8e83123b4d423a9dfddf7d6943f4f520651a78ffcd50c99d065136c7ff7b", - "sha256:620f19ba7628b70b177f5c2e6a55a6fd6e7c8591cde38c3f8f52551733d31b66", - "sha256:70d56c784da1239c89d39fefa166fd429306dada641178389be4184a9c04e501", - "sha256:7de2c9e445a5d257935011268202338538abef1aaff341a4733eca56419ca6f6", - "sha256:96bb80b659cc2bafa160f3f0c346ce7fc10de1ffec4908d7f9690797f155f658", - "sha256:ae7501cc6a6c37b8d4774bf2218c37be47fe42019a2570e8510fc2044e59d573", - "sha256:c833aa6f4c9ac3e3eb843e3d999bae51339ad33a937303f43ce78064e61cb4b6", - "sha256:dd81d85a342edf3d2a388e2f24d9facebc9c04550043888f970ee2f228c93059", - "sha256:f20deec7a3fbaec7b5eb7ad99878427ad2ee4cc16a46732b705e8121cbb3cc12", - "sha256:f52e7287eb9286a1e91e4c67c207c2573147fbaddc68f70efb5aeee5d1992f2e", - "sha256:fe7b2972ff7e779e812f974aa5695edc328ecf559ceeea887ac46f06f090ad4c", - "sha256:ff1447c84a02b9cd5dd3a9332d1fb181a4386c3625765bb5caf1cfbc210ab3f9" + "sha256:01a2059a0505460828854d218cf090d80db277033b8e6906144ab9bd4677fc82", + "sha256:01bcaf83911c5a88f74629f116540a1b80391e6e496e6fb8708bb2987b60da63", + "sha256:199ea4a9c424904f04a86563a8e9e2759d49e3a0bf789496714253237f16015f", + "sha256:229975cb8ff6056c8ef581383a653e7110480d52c9f46eaf560113f8d5005510", + "sha256:2bb4224e3a3d7dd2ee18f6c42c1925c3200cd46fe18ec9f293b9bc88644c4878", + "sha256:2ddf47c31048efad5a566d82822194bbb680fc1be852915c2949eb69891b5d5a", + "sha256:3bc9c87845962f583d6929f837b02b80d2544920be65daf0d0a1306ad1a2089b", + "sha256:3f88a3428f40c788321cf5b8191f9dd9e002145545fa0cefc023b4b11e17aaa7", + "sha256:4785935328facee0878c29d46f02b12f1e8e8db1cd3d9ec9af666eb163418a64", + "sha256:48e8d1973ba62a952f19a7916e54a7155f4b14505507432fc0559d8b5b0e5cad", + "sha256:5cd8662ddd7c95e99010e30cc52e20a092939844e8e8a4f37abf1866231f1880", + "sha256:6880406a0c776fbff63c0d9eb8a2d96d8134b17fafeeea01180b58ab8ff0f6f5", + "sha256:6a8e447742fc45791ffea0b3ce308f1476a9f4707fb6525a2f23b43d4b26cfb3", + "sha256:81456c04c54288928da4e7e1893314c8e74d5e9f33163e39aa47c26c5e5c7911", + "sha256:9b15efa7411dcf3b59c1f4766eb16ba1aba4531a33e54d469ee22106eabce460", + "sha256:a6132db365def76145084041cede574a0c8ed53aa1a680a3027e41ee8f291bd4", + "sha256:ddee38858a9ef52ca33cb5dd1607d07d0fb99e2efe523ecb437b1758c49622a5", + "sha256:de703f333381864dce788dbfa1a49ef4551e8f082b607a943b94b239d97965cc", + "sha256:e08cacfede41291c05b4668c3178d303d078417c013bc3d5287b2b0d0e6a3aa7", + "sha256:e4c37c7ec1e1157ae4af73fd1d7f201accebf6ed2222120bc660fd002c45cbac", + "sha256:e4f9fc91d617d2e54bda97bc1db9814918691fe799e037ccf973fda434fd2c18", + "sha256:f6f73c812c1830a06de76ccbea10a4ebb1fd46230a80f280362e84578e4932a2" ], "index": "pypi", - "version": "==3.3.2" + "version": "==3.4.0" }, "arrow": { "hashes": [ @@ -73,10 +80,10 @@ }, "certifi": { "hashes": [ - "sha256:4c1d68a1408dd090d2f3a869aa94c3947cc1d967821d1ed303208c9f41f0f2f4", - "sha256:b6e8b28b2b7e771a41ecdd12d4d43262ecab52adebbafa42c77d6b57fb6ad3a4" + "sha256:376690d6f16d32f9d1fe8932551d80b23e9d393a8578c5633a2ed39a64861638", + "sha256:456048c7e371c089d0a77a5212fb37a2c2dce1e24146e3b7e0261736aaeaa22a" ], - "version": "==2018.8.13" + "version": "==2018.8.24" }, "cffi": { "hashes": [ @@ -204,13 +211,14 @@ "hashes": [ "sha256:a933e3bb13da54383f9e8f35dc4f9cb9eb9b3b78c6b36f311254d6d0d92c6c7c" ], + "markers": "python_version < '3.7'", "version": "==1.1.0" }, "json-e": { "hashes": [ - "sha256:fcdb79e0da91466260af9a5a67a25916f02eac66e8f02e8dc3161182bd11c1bc" + "sha256:d8c1ec3f5bbc7728c3a504ebe58829f283c64eca230871e4eefe974b4cdaae4a" ], - "version": "==2.6.0" + "version": "==2.7.0" }, "jsonschema": { "hashes": [ @@ -370,6 +378,7 @@ "sha256:99dd90bc1c566968868c8b07ede32f8e031cbccd52c7195a61e802679d461447", "sha256:d0360063c1a3fcaaa514bb31c03954ba573d2b671df40a2ecfdfd9339cc8e93e" ], + "markers": "python_version >= '3.5.3'", "version": "==4.0.1" }, "urllib3": { @@ -377,7 +386,7 @@ "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf", "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5" ], - "markers": "python_version != '3.0.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version >= '2.6' and python_version < '4' and python_version != '3.1.*'", + "markers": "python_version < '4' and python_version >= '2.6' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.3.*' and python_version != '3.0.*'", "version": "==1.23" }, "virtualenv": { @@ -385,7 +394,7 @@ "sha256:2ce32cd126117ce2c539f0134eb89de91a8413a29baac49cbab3eb50e2026669", "sha256:ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752" ], - "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*'", + "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.0.*' and python_version != '3.2.*'", "version": "==16.0.0" }, "yarl": { @@ -400,7 +409,6 @@ "sha256:f17495e6fe3d377e3faac68121caef6f974fcb9e046bc075bcff40d8e5cc69a4", "sha256:f85900b9cca0c67767bb61b2b9bd53208aaa7373dae633dbe25d179b4bf38aa7" ], - "markers": "python_version >= '3.4.1'", "version": "==1.2.6" } }, From 975d7098fd9f29e91910b12c3674d07df1a7b781 Mon Sep 17 00:00:00 2001 From: Razvan Caliman Date: Mon, 27 Aug 2018 16:58:44 +0000 Subject: [PATCH 15/64] Bug 1486011 - Refactor auto-increment behaviour on sliders in font editor. r=gl - increase delay before auto-increment starts and between iterations. - ensure auto-increment happens only when *dragging and holding* the slider thumb. - ensure auto-increment works consistently when switching from number input directly to slider. Depends on D4225 Differential Revision: https://phabricator.services.mozilla.com/D4226 --HG-- extra : moz-landing-system : lando --- .../fonts/components/FontPropertyValue.js | 54 +++++++++++-------- .../inspector/fonts/components/FontSize.js | 2 +- .../inspector/fonts/components/LineHeight.js | 2 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/devtools/client/inspector/fonts/components/FontPropertyValue.js b/devtools/client/inspector/fonts/components/FontPropertyValue.js index 406a0de60f21..9ed94a1a3e0a 100644 --- a/devtools/client/inspector/fonts/components/FontPropertyValue.js +++ b/devtools/client/inspector/fonts/components/FontPropertyValue.js @@ -10,12 +10,12 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const { KeyCodes } = require("devtools/client/shared/keycodes"); // Milliseconds between auto-increment interval iterations. -const AUTOINCREMENT_DELAY = 300; +const AUTOINCREMENT_DELAY = 1000; class FontPropertyValue extends PureComponent { static get propTypes() { return { - allowAutoIncrement: PropTypes.bool, + autoIncrement: PropTypes.bool, className: PropTypes.string, defaultValue: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]), label: PropTypes.string.isRequired, @@ -23,7 +23,7 @@ class FontPropertyValue extends PureComponent { max: PropTypes.number.isRequired, name: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, - step: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]), + step: PropTypes.number, unit: PropTypes.oneOfType([ PropTypes.string, null ]), unitOptions: PropTypes.array, value: PropTypes.number, @@ -32,7 +32,9 @@ class FontPropertyValue extends PureComponent { static get defaultProps() { return { + autoIncrement: false, className: "", + step: 1, unitOptions: [] }; } @@ -59,6 +61,7 @@ class FontPropertyValue extends PureComponent { this.onKeyDown = this.onKeyDown.bind(this); this.onKeyUp = this.onKeyUp.bind(this); this.onMouseDown = this.onMouseDown.bind(this); + this.onMouseMove = this.onMouseMove.bind(this); this.onMouseUp = this.onMouseUp.bind(this); this.onUnitChange = this.onUnitChange.bind(this); this.stopAutoIncrement = this.stopAutoIncrement.bind(this); @@ -100,7 +103,7 @@ class FontPropertyValue extends PureComponent { /** * Check if the given value is valid according to the constraints of this component. * Ensure it is a number and that it does not go outside the min/max limits, unless - * allowed by the `allowAutoIncrement` props flag. + * allowed by the `autoIncrement` props flag. * * @param {Number} value * Numeric value @@ -108,7 +111,7 @@ class FontPropertyValue extends PureComponent { * Whether the value conforms to the components contraints. */ isValueValid(value) { - const { allowAutoIncrement, min, max } = this.props; + const { autoIncrement, min, max } = this.props; if (typeof value !== "number" || isNaN(value)) { return false; @@ -119,7 +122,7 @@ class FontPropertyValue extends PureComponent { } // Ensure it does not exceed maximum value, unless auto-incrementing is permitted. - if (max !== undefined && value > this.props.max && !allowAutoIncrement) { + if (max !== undefined && value > this.props.max && !autoIncrement) { return false; } @@ -243,29 +246,33 @@ class FontPropertyValue extends PureComponent { }); } - /** - * Handler for "keydown" events from the sider and input fields. - * Toggles on the "interactive" state. @See toggleInteractiveState(); - * Begins auto-incrementing if the value is already at the upper bound. - * - * @param {Event} e - * MouseDown event. - */ - onMouseDown(e) { - // Begin auto-incrementing if the value is already at the upper bound. - if (this.isAtUpperBound(this.props.value) && e.target.type === "range") { - this.startAutoIncrement(); - } + onMouseDown() { this.toggleInteractiveState(true); } - onMouseUp(e) { + /** + * Handler for "mousemove" event from range input. If the user is actively interacting + * by dragging the slider thumb, start or stop the auto-incrementing behavior depending + * on whether the input value is at the upper bound or not. + * + * @param {MouseEvent} e + */ + onMouseMove(e) { + if (this.state.interactive && e.buttons) { + this.isAtUpperBound(this.props.value) + ? this.startAutoIncrement() + : this.stopAutoIncrement(); + } + } + + onMouseUp() { + this.stopAutoIncrement(); this.toggleInteractiveState(false); } startAutoIncrement() { // Do not set auto-increment interval if not allowed to or if one is already set. - if (!this.props.allowAutoIncrement || this.interval) { + if (!this.props.autoIncrement || this.interval) { return; } @@ -360,7 +367,7 @@ class FontPropertyValue extends PureComponent { onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, - step: this.props.step || 1, + step: this.props.step, // While interacting with the range and number inputs, prevent updating value from // outside props which is debounced and causes jitter on successive renders. value: this.state.interactive @@ -374,6 +381,7 @@ class FontPropertyValue extends PureComponent { onKeyDown: this.onKeyDown, onKeyUp: this.onKeyUp, onMouseDown: this.onMouseDown, + onMouseMove: this.onMouseMove, onMouseUp: this.onMouseUp, className: "font-value-slider", name: this.props.name, @@ -386,7 +394,7 @@ class FontPropertyValue extends PureComponent { { ...defaults, // Remove upper limit from number input if it is allowed to auto-increment. - max: this.props.allowAutoIncrement ? null : this.props.max, + max: this.props.autoIncrement ? null : this.props.max, name: this.props.name, className: "font-value-input", type: "number", diff --git a/devtools/client/inspector/fonts/components/FontSize.js b/devtools/client/inspector/fonts/components/FontSize.js index bb3e4897130d..ca73802f8a16 100644 --- a/devtools/client/inspector/fonts/components/FontSize.js +++ b/devtools/client/inspector/fonts/components/FontSize.js @@ -58,7 +58,7 @@ class FontSize extends PureComponent { : max; return FontPropertyValue({ - allowAutoIncrement: true, + autoIncrement: true, label: getStr("fontinspector.fontSizeLabel"), min: 0, max: this.historicMax[unit], diff --git a/devtools/client/inspector/fonts/components/LineHeight.js b/devtools/client/inspector/fonts/components/LineHeight.js index 022e43640668..239783fca38f 100644 --- a/devtools/client/inspector/fonts/components/LineHeight.js +++ b/devtools/client/inspector/fonts/components/LineHeight.js @@ -61,7 +61,7 @@ class LineHeight extends PureComponent { : max; return FontPropertyValue({ - allowAutoIncrement: true, + autoIncrement: true, label: getStr("fontinspector.lineHeightLabel"), min: 0, max: this.historicMax[unit], From f9b5460bf22ae6d8215053a76452026a53fafff2 Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Mon, 27 Aug 2018 16:08:56 +0000 Subject: [PATCH 16/64] Bug 672733 - Make autocomplete search case insensitive; r=Honza. This patch adds a smarter heuristic for autocompletion results: if the input first letter is lowercased, then we'll filter matching properties case insensitively. But if the user starts with an uppercase, we assume they know the property they want and thus respect the casing. For example: `win` will return both `window` and `Window`, but `Win` will return `Window` only. Due to this behavior, we change the order of the autocomplete results so lowercased property are displayed before the uppercased one. If we take are example again, it's likely that if a user type `win`, they want `window`, but the alphabetical order would return `Window` first which would annoy user. Now, since we return results that does not match exactly the user input, we need to modify the frontend. Usually, we only show the autocompletion popup if there are at least 2 matching items, since 1 matching item will still be displayed using the autocompletion text. But now, since the input might not match, we want to still display the popup if there is one matching item, but starts differentely than what the user entered. For example, the user typed `window.addeve`, which matches `addEventListener`. The completion text will make it looks like it will be completed to `window.addeventListener`, which would be undefined. So showing the popup with the actual matching property might avoid some confusion for the user. A test was added to make sure the frontend works as expected. Some test cases were added in the server test to make sure the actor returns expected results. Other tests needed some adjustement because of the insensitive case matches and the new order of results. Differential Revision: https://phabricator.services.mozilla.com/D4061 --HG-- extra : moz-landing-system : lando --- .../client/webconsole/components/JSTerm.js | 74 ++++++++----- .../webconsole/test/mochitest/browser.ini | 1 + .../browser_jsterm_autocomplete_width.js | 14 +-- .../mochitest/browser_jsterm_completion.js | 17 +-- ...wser_jsterm_completion_case_sensitivity.js | 101 ++++++++++++++++++ devtools/server/actors/webconsole.js | 30 ++++-- .../shared/webconsole/js-property-provider.js | 22 ++-- .../test/test_jsterm_autocomplete.html | 47 +++++++- .../test/unit/test_js_property_provider.js | 6 +- 9 files changed, 250 insertions(+), 62 deletions(-) create mode 100644 devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index f49f881904f8..c50ba20fa50f 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -1104,7 +1104,15 @@ class JSTerm extends Component { filterBy = input.substring(input.lastIndexOf(lastNonAlpha) + 1); } - const newList = this._autocompleteCache.sort().filter(l => l.startsWith(filterBy)); + const filterByLc = filterBy.toLocaleLowerCase(); + const looseMatching = !filterBy || filterBy[0].toLocaleLowerCase() === filterBy[0]; + const newList = this._autocompleteCache.filter(l => { + if (looseMatching) { + return l.toLocaleLowerCase().startsWith(filterByLc); + } + + return l.startsWith(filterBy); + }); this._receiveAutocompleteProperties(null, { matches: newList, @@ -1146,21 +1154,35 @@ class JSTerm extends Component { this._autocompleteQuery = inputUntilCursor; } - const matches = message.matches; - const lastPart = message.matchProp; + const {matches, matchProp} = message; if (!matches.length) { this.clearCompletion(); this.emit("autocomplete-updated"); return; } + const items = matches.map(match => ({ + preLabel: match.substring(0, matchProp.length), + label: match + })); + + if (items.length > 0) { + const suffix = items[0].label.substring(matchProp.length); + this.setAutoCompletionText(suffix); + } + const popup = this.autocompletePopup; - const items = matches.map(match => ({ preLabel: lastPart, label: match })); popup.setItems(items); const minimumAutoCompleteLength = 2; - if (items.length >= minimumAutoCompleteLength) { + // We want to show the autocomplete popup if: + // - there are at least 2 matching results + // - OR, if there's 1 result, but whose label does not start like the input (this can + // happen with insensitive search: `num` will match `Number`). + if (items.length >= minimumAutoCompleteLength || ( + items.length === 1 && items[0].preLabel !== matchProp + )) { let popupAlignElement; let xOffset; let yOffset; @@ -1168,12 +1190,12 @@ class JSTerm extends Component { if (this.editor) { popupAlignElement = this.node.querySelector(".CodeMirror-cursor"); // We need to show the popup at the ".". - xOffset = -1 * lastPart.length * this._inputCharWidth; + xOffset = -1 * matchProp.length * this._inputCharWidth; yOffset = 5; } else if (this.inputNode) { const offset = inputUntilCursor.length - (inputUntilCursor.lastIndexOf("\n") + 1) - - lastPart.length; + matchProp.length; xOffset = (offset * this._inputCharWidth) + this._chevronWidth; popupAlignElement = this.inputNode; } @@ -1185,10 +1207,6 @@ class JSTerm extends Component { popup.hidePopup(); } - if (items.length > 0) { - const suffix = items[0].label.substring(lastPart.length); - this.setAutoCompletionText(suffix); - } this.emit("autocomplete-updated"); } @@ -1234,22 +1252,21 @@ class JSTerm extends Component { */ acceptProposedCompletion() { let completionText = this.getAutoCompletionText(); - // In some cases the completion text might not be displayed (e.g. there is some text - // just after the cursor so we can't display it). In those case, if the popup is - // open and has a selectedItem, we use it for completing the input. - if ( - !completionText - && this.autocompletePopup.isOpen - && this.autocompletePopup.selectedItem - ) { + let numberOfCharsToReplaceCharsBeforeCursor; + + // If the autocompletion popup is open, we always get the selected element from there, + // since the autocompletion text might not be enough (e.g. `dOcUmEn` should + // autocomplete to `document`, but the autocompletion text only shows `t`). + if (this.autocompletePopup.isOpen && this.autocompletePopup.selectedItem) { const {selectedItem} = this.autocompletePopup; - completionText = selectedItem.label.substring(selectedItem.preLabel.length); + completionText = selectedItem.label; + numberOfCharsToReplaceCharsBeforeCursor = selectedItem.preLabel.length; } this.clearCompletion(); if (completionText) { - this.insertStringAtCursor(completionText); + this.insertStringAtCursor(completionText, numberOfCharsToReplaceCharsBeforeCursor); } } @@ -1270,16 +1287,21 @@ class JSTerm extends Component { * Insert a string into the console at the cursor location, * moving the cursor to the end of the string. * - * @param string str + * @param {string} str + * @param {int} numberOfCharsToReplaceCharsBeforeCursor - defaults to 0 */ - insertStringAtCursor(str) { + insertStringAtCursor(str, numberOfCharsToReplaceCharsBeforeCursor = 0) { const value = this.getInputValue(); - const prefix = this.getInputValueBeforeCursor(); + let prefix = this.getInputValueBeforeCursor(); const suffix = value.replace(prefix, ""); + if (numberOfCharsToReplaceCharsBeforeCursor) { + prefix = + prefix.substring(0, prefix.length - numberOfCharsToReplaceCharsBeforeCursor); + } + // We need to retrieve the cursor before setting the new value. const editorCursor = this.editor && this.editor.getCursor(); - this.setInputValue(prefix + str + suffix); if (this.inputNode) { @@ -1289,7 +1311,7 @@ class JSTerm extends Component { // Set the cursor on the same line it was already at, after the autocompleted text this.editor.setCursor({ line: editorCursor.line, - ch: editorCursor.ch + str.length + ch: editorCursor.ch + str.length - numberOfCharsToReplaceCharsBeforeCursor }); } } diff --git a/devtools/client/webconsole/test/mochitest/browser.ini b/devtools/client/webconsole/test/mochitest/browser.ini index 8dff18db5a24..50dab883c8cc 100644 --- a/devtools/client/webconsole/test/mochitest/browser.ini +++ b/devtools/client/webconsole/test/mochitest/browser.ini @@ -200,6 +200,7 @@ skip-if = verify [browser_jsterm_autocomplete_return_key.js] [browser_jsterm_autocomplete_width.js] [browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js] +[browser_jsterm_completion_case_sensitivity.js] [browser_jsterm_completion.js] [browser_jsterm_content_defined_helpers.js] [browser_jsterm_copy_command.js] diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_width.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_width.js index 2183f2b219a5..6cc0e181329f 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_width.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_width.js @@ -13,11 +13,11 @@ const TEST_URI = `data:text/html;charset=utf-8, /* Create prototype-less object so popup does not contain native * Object prototype properties. */ - window.x = Object.create(null, Object.getOwnPropertyDescriptors({ + window.xx = Object.create(null, Object.getOwnPropertyDescriptors({ ["y".repeat(10)]: 1, ["z".repeat(20)]: 2 })); - window.xx = 1; + window.xxx = 1; Test`; @@ -36,14 +36,14 @@ async function performTests() { const onPopUpOpen = popup.once("popup-opened"); - info(`wait for completion suggestions for "x"`); - EventUtils.sendString("x"); + info(`wait for completion suggestions for "xx"`); + EventUtils.sendString("xx"); await onPopUpOpen; ok(popup.isOpen, "popup is open"); - const expectedPopupItems = ["x", "xx"]; + const expectedPopupItems = ["xx", "xxx"]; is(popup.items.map(i => i.label).join("-"), expectedPopupItems.join("-"), "popup has expected items"); @@ -51,7 +51,7 @@ async function performTests() { ok(originalWidth > 2 * jsterm._inputCharWidth, "popup is at least wider than the width of the longest list item"); - info(`wait for completion suggestions for "x."`); + info(`wait for completion suggestions for "xx."`); let onAutocompleteUpdated = jsterm.once("autocomplete-updated"); EventUtils.sendString("."); await onAutocompleteUpdated; @@ -63,7 +63,7 @@ async function performTests() { ok(newPopupWidth > 20 * jsterm._inputCharWidth, "popup is at least wider than the width of the longest list item"); - info(`wait for completion suggestions for "x"`); + info(`wait for completion suggestions for "xx"`); onAutocompleteUpdated = jsterm.once("autocomplete-updated"); EventUtils.synthesizeKey("KEY_Backspace"); await onAutocompleteUpdated; diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js index 01e12ad518af..b7bac4563f54 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion.js @@ -7,7 +7,10 @@ "use strict"; -const TEST_URI = "data:text/html;charset=utf8,

test code completion"; +const TEST_URI = `data:text/html;charset=utf8,

test code completion + `; add_task(async function() { // Run test with legacy JsTerm @@ -23,18 +26,18 @@ async function performTests() { const {autocompletePopup} = jsterm; // Test typing 'docu'. - await setInputValueForAutocompletion(jsterm, "docu"); - is(jsterm.getInputValue(), "docu", "'docu' completion (input.value)"); - checkJsTermCompletionValue(jsterm, " ment", "'docu' completion (completeNode)"); + await setInputValueForAutocompletion(jsterm, "foob"); + is(jsterm.getInputValue(), "foob", "'foob' completion (input.value)"); + checkJsTermCompletionValue(jsterm, " ar", "'foob' completion (completeNode)"); is(autocompletePopup.items.length, 1, "autocomplete popup has 1 item"); is(autocompletePopup.isOpen, false, "autocomplete popup is not open"); // Test typing 'docu' and press tab. EventUtils.synthesizeKey("KEY_Tab"); - is(jsterm.getInputValue(), "document", "'docu' tab completion"); + is(jsterm.getInputValue(), "foobar", "'foob' tab completion"); - checkJsTermCursor(jsterm, "document".length, "cursor is at the end of 'document'"); - is(getJsTermCompletionValue(jsterm).replace(/ /g, ""), "", "'docu' completed"); + checkJsTermCursor(jsterm, "foobar".length, "cursor is at the end of 'foobar'"); + is(getJsTermCompletionValue(jsterm).replace(/ /g, ""), "", "'foob' completed"); // Test typing 'window.Ob' and press tab. Just 'window.O' is // ambiguous: could be window.Object, window.Option, etc. diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js new file mode 100644 index 000000000000..005c585b2b90 --- /dev/null +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_completion_case_sensitivity.js @@ -0,0 +1,101 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that code completion works properly in regards to case sensitivity. + +"use strict"; + +const TEST_URI = `data:text/html;charset=utf8,

test case-sensitivity completion. + `; + +add_task(async function() { + // Run test with legacy JsTerm + await pushPref("devtools.webconsole.jsterm.codeMirror", false); + await performTests(); + // And then run it with the CodeMirror-powered one. + await pushPref("devtools.webconsole.jsterm.codeMirror", true); + await performTests(); +}); + +async function performTests() { + const {jsterm} = await openNewTabAndConsole(TEST_URI); + const {autocompletePopup} = jsterm; + + const checkInput = (expected, assertionInfo) => + checkJsTermValueAndCursor(jsterm, expected, assertionInfo); + + info("Check that lowercased input is case-insensitive"); + let onPopUpOpen = autocompletePopup.once("popup-opened"); + EventUtils.sendString("foob"); + await onPopUpOpen; + + is(getAutocompletePopupLabels(autocompletePopup).join(" - "), "fooBar - FooBar", + "popup has expected item, in expected order"); + checkJsTermCompletionValue(jsterm, " ar", "completeNode has expected value"); + + info("Check that filtering the autocomplete cache is also case insensitive"); + let onAutoCompleteUpdated = jsterm.once("autocomplete-updated"); + // Send "a" to make the input "fooba" + EventUtils.sendString("a"); + await onAutoCompleteUpdated; + + checkInput("fooba|"); + is(getAutocompletePopupLabels(autocompletePopup).join(" - "), "fooBar - FooBar", + "popup cache filtering is also case-insensitive"); + checkJsTermCompletionValue(jsterm, " r", "completeNode has expected value"); + + info("Check that accepting the completion value will change the input casing"); + let onPopupClose = autocompletePopup.once("popup-closed"); + EventUtils.synthesizeKey("KEY_Tab"); + await onPopupClose; + checkInput("fooBar|", "The input was completed with the correct casing"); + checkJsTermCompletionValue(jsterm, "", "completeNode is empty"); + + info("Check that the popup is displayed with only 1 matching item"); + onPopUpOpen = autocompletePopup.once("popup-opened"); + EventUtils.sendString(".f"); + await onPopUpOpen; + + // Here we want to match "Foo", and since the completion text will only be "oo", we want + // to display the popup so the user knows that we are matching "Foo" and not "foo". + checkInput("fooBar.f|"); + ok(true, "The popup was opened even if there's 1 item matching"); + is(getAutocompletePopupLabels(autocompletePopup).join(" - "), "Foo", + "popup has expected item"); + checkJsTermCompletionValue(jsterm, " oo", "completeNode has expected value"); + + onPopupClose = autocompletePopup.once("popup-closed"); + EventUtils.synthesizeKey("KEY_Tab"); + await onPopupClose; + checkInput("fooBar.Foo|", "The input was completed with the correct casing"); + checkJsTermCompletionValue(jsterm, "", "completeNode is empty"); + + jsterm.setInputValue(""); + + info("Check that filtering the cache works like on the server"); + onPopUpOpen = autocompletePopup.once("popup-opened"); + EventUtils.sendString("fooBar."); + await onPopUpOpen; + is(getAutocompletePopupLabels(autocompletePopup).join(" - "), + "test - Foo - TEST - Test", "popup has expected items"); + + onAutoCompleteUpdated = jsterm.once("autocomplete-updated"); + EventUtils.sendString("T"); + await onAutoCompleteUpdated; + is(getAutocompletePopupLabels(autocompletePopup).join(" - "), "TEST - Test", + "popup was filtered case-sensitively, as expected"); +} + +function getAutocompletePopupLabels(autocompletePopup) { + return autocompletePopup.items.map(i => i.label); +} diff --git a/devtools/server/actors/webconsole.js b/devtools/server/actors/webconsole.js index 82a7f70e1f20..0ee3ffe191ae 100644 --- a/devtools/server/actors/webconsole.js +++ b/devtools/server/actors/webconsole.js @@ -1175,7 +1175,7 @@ WebConsoleActor.prototype = this.dbg.removeDebuggee(this.evalWindow); } - matches = result.matches || []; + matches = result.matches || new Set(); matchProp = result.matchProp; // We consider '$' as alphanumeric because it is used in the names of some @@ -1183,18 +1183,26 @@ WebConsoleActor.prototype = // be seen as break in the evaled string. const lastNonAlphaIsDot = /[.][a-zA-Z0-9$\s]*$/.test(reqText); if (!lastNonAlphaIsDot) { - matches = matches.concat(this._getWebConsoleCommandsCache().filter(n => - // filter out `screenshot` command as it is inaccessible without - // the `:` prefix - n !== "screenshot" && n.startsWith(result.matchProp) - )); + this._getWebConsoleCommandsCache().forEach(n => { + // filter out `screenshot` command as it is inaccessible without the `:` prefix + if (n !== "screenshot" && n.startsWith(result.matchProp)) { + matches.add(n); + } + }); } - } - // Make sure we return an array with unique items, since `matches` can hold twice - // the same function name if it was defined in the content page and match an helper - // function (e.g. $, keys, …). - matches = [...new Set(matches)].sort(); + // Sort the results in order to display lowercased item first (e.g. we want to + // display `document` then `Document` as we loosely match the user input if the + // first letter they typed was lowercase). + matches = Array.from(matches).sort((a, b) => { + const lA = a[0].toLocaleLowerCase() === a[0]; + const lB = b[0].toLocaleLowerCase() === b[0]; + if (lA === lB) { + return a < b ? -1 : 1; + } + return lA ? -1 : 1; + }); + } return { from: this.actorID, diff --git a/devtools/shared/webconsole/js-property-provider.js b/devtools/shared/webconsole/js-property-provider.js index 144f46ed9d0a..f5348f12241e 100644 --- a/devtools/shared/webconsole/js-property-provider.js +++ b/devtools/shared/webconsole/js-property-provider.js @@ -180,7 +180,7 @@ function findCompletionBeginning(str) { * If no completion valued could be computed, null is returned, * otherwise a object with the following form is returned: * { - * matches: [ string, string, string ], + * matches: Set * matchProp: Last part of the inputValue that was used to find * the matches-strings. * } @@ -407,17 +407,25 @@ function getMatchedProps(obj, match) { * Get all properties in the given object (and its parent prototype chain) that * match a given prefix. * - * @param mixed obj + * @param {Mixed} obj * Object whose properties we want to filter. - * @param string match + * @param {string} match * Filter for properties that match this string. - * @return object - * Object that contains the matchProp and the list of names. + * @returns {object} which holds the following properties: + * - {string} matchProp. + * - {Set} matches: List of matched properties. */ function getMatchedPropsImpl(obj, match, {chainIterator, getProperties}) { const matches = new Set(); let numProps = 0; + const insensitiveMatching = match && match[0].toUpperCase() !== match[0]; + const propertyMatches = prop => { + return insensitiveMatching + ? prop.toLocaleLowerCase().startsWith(match.toLocaleLowerCase()) + : prop.startsWith(match); + }; + // We need to go up the prototype chain. const iter = chainIterator(obj); for (obj of iter) { @@ -437,7 +445,7 @@ function getMatchedPropsImpl(obj, match, {chainIterator, getProperties}) { for (let i = 0; i < props.length; i++) { const prop = props[i]; - if (prop.indexOf(match) != 0) { + if (!propertyMatches(prop)) { continue; } if (prop.indexOf("-") > -1) { @@ -459,7 +467,7 @@ function getMatchedPropsImpl(obj, match, {chainIterator, getProperties}) { return { matchProp: match, - matches: [...matches], + matches, }; } diff --git a/devtools/shared/webconsole/test/test_jsterm_autocomplete.html b/devtools/shared/webconsole/test/test_jsterm_autocomplete.html index a4bf1b9a6e6d..91daae91b675 100644 --- a/devtools/shared/webconsole/test/test_jsterm_autocomplete.html +++ b/devtools/shared/webconsole/test/test_jsterm_autocomplete.html @@ -67,6 +67,14 @@ }); window.emojiObject = Object.create(null); window.emojiObject["😎"] = "😎"; + + window.insensitiveTestCase = Object.create(null, Object.getOwnPropertyDescriptors({ + PROP: "", + Prop: "", + prop: "", + PRÖP: "", + pröp: "", + })); `; await state.client.evaluateJSAsync(script); @@ -81,6 +89,7 @@ doAutocompleteProxyThrowsOwnKeys, doAutocompleteDotSurroundedBySpaces, doAutocompleteAfterOr, + doInsensitiveAutocomplete, ]; if (!isWorker) { @@ -182,7 +191,8 @@ ok(!response.matchProp, "matchProp"); let keys = Object.getOwnPropertyNames(Object.prototype).sort(); is(response.matches.length, keys.length, "matches.length"); - checkObject(response.matches, keys); + // checkObject(response.matches, keys); + is(response.matches.join(" - "), keys.join(" - ")); } async function doAutocompleteArray(client) { @@ -242,6 +252,41 @@ is(matches.length, 1, "autocomplete returns expected results"); is(matches.join("-"), "foobarObject"); } + + async function doInsensitiveAutocomplete(client) { + info("test autocomplete for 'window.insensitiveTestCase.'"); + let {matches} = await client.autocomplete("window.insensitiveTestCase."); + is(matches.join("-"), "prop-pröp-PROP-PRÖP-Prop", + "autocomplete returns the expected items, in the expected order"); + + info("test autocomplete for 'window.insensitiveTestCase.p'"); + matches = (await client.autocomplete("window.insensitiveTestCase.p")).matches; + is(matches.join("-"), "prop-pröp-PROP-PRÖP-Prop", + "autocomplete is case-insensitive when first letter is lowercased"); + + info("test autocomplete for 'window.insensitiveTestCase.pRoP'"); + matches = (await client.autocomplete("window.insensitiveTestCase.pRoP")).matches; + is(matches.join("-"), "prop-PROP-Prop", + "autocomplete is case-insensitive when first letter is lowercased"); + + info("test autocomplete for 'window.insensitiveTestCase.P'"); + matches = (await client.autocomplete("window.insensitiveTestCase.P")).matches; + is(matches.join("-"), "PROP-PRÖP-Prop", + "autocomplete is case-sensitive when first letter is uppercased"); + + info("test autocomplete for 'window.insensitiveTestCase.PROP'"); + matches = (await client.autocomplete("window.insensitiveTestCase.PROP")).matches; + is(matches.join("-"), "PROP", + "autocomplete is case-sensitive when first letter is uppercased"); + + info("test autocomplete for 'window.insensitiveTestCase.prö'"); + matches = (await client.autocomplete("window.insensitiveTestCase.prö")).matches; + is(matches.join("-"), "pröp-PRÖP", "expected result with lowercase diacritic"); + + info("test autocomplete for 'window.insensitiveTestCase.PRÖ'"); + matches = (await client.autocomplete("window.insensitiveTestCase.PRÖ")).matches; + is(matches.join("-"), "PRÖP", "expected result with uppercase diacritic"); + } diff --git a/devtools/shared/webconsole/test/unit/test_js_property_provider.js b/devtools/shared/webconsole/test/unit/test_js_property_provider.js index a74896a99779..fed67f08c9a9 100644 --- a/devtools/shared/webconsole/test/unit/test_js_property_provider.js +++ b/devtools/shared/webconsole/test/unit/test_js_property_provider.js @@ -187,7 +187,7 @@ function runChecks(dbgObject, dbgEnv, sandbox) { */ function test_has_no_results(results) { Assert.notEqual(results, null); - Assert.equal(results.matches.length, 0); + Assert.equal(results.matches.size, 0); } /** * A helper that ensures (required) results were found. @@ -198,6 +198,6 @@ function test_has_no_results(results) { */ function test_has_result(results, requiredSuggestion) { Assert.notEqual(results, null); - Assert.ok(results.matches.length > 0); - Assert.ok(results.matches.includes(requiredSuggestion)); + Assert.ok(results.matches.size > 0); + Assert.ok(results.matches.has(requiredSuggestion)); } From 0d7183224a57811b1330d55e441e49549e8c32cf Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Mon, 27 Aug 2018 16:25:57 +0000 Subject: [PATCH 17/64] Bug 1485990 - Display 1-item-only autocomplete popup if autocompletion text can't be displayed; r=bgrins. If the autocomplete only returns 1 item, we usually close the popup and show the autocompletion text. But in some cases the autocompletion text can't be shown (e.g. there's some text after the cursor). So we end up showing nothing for the user, which is not ideal. In such case, this patch ensures we do show the popup so the user can autocomplete and save some keystrokes. Depends on D4061 Differential Revision: https://phabricator.services.mozilla.com/D4335 --HG-- extra : moz-landing-system : lando --- .../client/webconsole/components/JSTerm.js | 13 +++++-- ...browser_jsterm_autocomplete_inside_text.js | 36 ++++++++++--------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index c50ba20fa50f..bdba98ae5189 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -1180,9 +1180,16 @@ class JSTerm extends Component { // - there are at least 2 matching results // - OR, if there's 1 result, but whose label does not start like the input (this can // happen with insensitive search: `num` will match `Number`). - if (items.length >= minimumAutoCompleteLength || ( - items.length === 1 && items[0].preLabel !== matchProp - )) { + // - OR, if there's 1 result, but we can't show the completionText (because there's + // some text after the cursor), unless the text in the popup is the same as the input. + if (items.length >= minimumAutoCompleteLength + || (items.length === 1 && items[0].preLabel !== matchProp) + || ( + items.length === 1 + && !this.canDisplayAutoCompletionText() + && items[0].label !== matchProp + ) + ) { let popupAlignElement; let xOffset; let yOffset; diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js index 977d20bac3c5..11ed99e710b0 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_inside_text.js @@ -49,9 +49,7 @@ async function performTests() { EventUtils.synthesizeKey("KEY_ArrowRight"); await onPopupClose; ok(true, "popup was closed"); - let expectedInput = "dump(window.testB)"; - is(jsterm.getInputValue(), expectedInput, "input wasn't modified"); - checkJsTermCursor(jsterm, expectedInput.length, "cursor was moved to the right"); + checkJsTermValueAndCursor(jsterm, "dump(window.testB)|", "input wasn't modified"); await setInitialState(jsterm); EventUtils.synthesizeKey("KEY_ArrowDown"); @@ -69,9 +67,8 @@ async function performTests() { // At this point the completion suggestion should be accepted. ok(!popup.isOpen, "popup is not open"); - expectedInput = "dump(window.testBugBB)"; - is(jsterm.getInputValue(), expectedInput, "completion was successful after VK_TAB"); - checkJsTermCursor(jsterm, expectedInput.length - 1, "cursor location is correct"); + checkJsTermValueAndCursor(jsterm, "dump(window.testBugBB|)", + "completion was successful after VK_TAB"); ok(!getJsTermCompletionValue(jsterm), "there is no completion text"); info("Test ENTER key when popup is visible with a selected item"); @@ -82,33 +79,40 @@ async function performTests() { await onPopupClose; ok(!popup.isOpen, "popup is not open"); - expectedInput = "dump(window.testBugAA)"; - is(jsterm.getInputValue(), expectedInput, "completion was successful after Enter"); - checkJsTermCursor(jsterm, expectedInput.length - 1, "cursor location is correct"); + checkJsTermValueAndCursor(jsterm, "dump(window.testBugAA|)", + "completion was successful after Enter"); ok(!getJsTermCompletionValue(jsterm), "there is no completion text"); - info("Test TAB key when there is no autocomplete suggestion"); + info("Test autocomplete inside parens"); jsterm.setInputValue("dump()"); EventUtils.synthesizeKey("KEY_ArrowLeft"); const onAutocompleteUpdated = jsterm.once("autocomplete-updated"); EventUtils.sendString("window.testBugA"); await onAutocompleteUpdated; + ok(popup.isOpen, "popup is open"); + ok(!getJsTermCompletionValue(jsterm), "there is no completion text"); + + info("Matching the completion proposal should close the popup"); + onPopupClose = popup.once("popup-closed"); + EventUtils.sendString("A"); + await onPopupClose; + + info("Test TAB key when there is no autocomplete suggestion"); ok(!popup.isOpen, "popup is not open"); ok(!getJsTermCompletionValue(jsterm), "there is no completion text"); EventUtils.synthesizeKey("KEY_Tab"); - - expectedInput = "dump(window.testBugAA)"; - is(jsterm.getInputValue(), "dump(window.testBugA\t)", "Tab inserted a tab char"); - checkJsTermCursor(jsterm, expectedInput.length - 1, "cursor location is correct"); + checkJsTermValueAndCursor(jsterm, "dump(window.testBugAA\t|)", + "completion was successful after Enter"); } -function setInitialState(jsterm) { +async function setInitialState(jsterm) { jsterm.focus(); jsterm.setInputValue("dump()"); EventUtils.synthesizeKey("KEY_ArrowLeft"); const onPopUpOpen = jsterm.autocompletePopup.once("popup-opened"); EventUtils.sendString("window.testB"); - return onPopUpOpen; + checkJsTermValueAndCursor(jsterm, "dump(window.testB|)"); + await onPopUpOpen; } From 70e2c73f5a30f31b52ae298a17251dfc5e13f755 Mon Sep 17 00:00:00 2001 From: Robert Helmer Date: Mon, 27 Aug 2018 15:39:46 +0000 Subject: [PATCH 18/64] bug 1485946 - skip building libprio on MSVC r=froydnj libprio does not currently build with MSVC (since it only supports C90 as a compiler), this is being worked on upstream at https://github.com/mozilla/libprio/issues/17 As we are almost certainly not going to ship Firefox build with MSVC anymore, let's disable this to get it working on this Tier-2 platform. Differential Revision: https://phabricator.services.mozilla.com/D4292 --HG-- extra : moz-landing-system : lando --- config/external/moz.build | 6 +++++- config/external/msgpack/moz.build | 3 ++- config/external/prio/moz.build | 2 +- dom/bindings/moz.build | 4 +++- dom/chrome-webidl/moz.build | 7 ++++++- dom/moz.build | 4 +++- third_party/moz.build | 9 +++++---- toolkit/moz.configure | 13 +++++++++++++ 8 files changed, 38 insertions(+), 10 deletions(-) diff --git a/config/external/moz.build b/config/external/moz.build index 21667e0543f8..86aa5351335a 100644 --- a/config/external/moz.build +++ b/config/external/moz.build @@ -8,12 +8,16 @@ external_dirs = [] DIRS += [ 'lgpllibs', - 'prio', 'sqlite', ] if not CONFIG['MOZ_SYSTEM_JPEG']: external_dirs += ['media/libjpeg'] +if CONFIG['MOZ_LIBPRIO']: + DIRS += [ + 'prio', + ] + # There's no "native" brotli or woff2 yet, but probably in the future... external_dirs += ['modules/brotli'] external_dirs += ['modules/woff2'] diff --git a/config/external/msgpack/moz.build b/config/external/msgpack/moz.build index 9e9599a8b228..3dc3955bf237 100644 --- a/config/external/msgpack/moz.build +++ b/config/external/msgpack/moz.build @@ -4,5 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['/third_party/msgpack'] +if CONFIG['MOZ_LIBPRIO']: + DIRS += ['/third_party/msgpack'] diff --git a/config/external/prio/moz.build b/config/external/prio/moz.build index b8a167496189..df3540f8ef49 100644 --- a/config/external/prio/moz.build +++ b/config/external/prio/moz.build @@ -4,5 +4,5 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['../../../third_party/prio'] +DIRS += ['/third_party/prio'] diff --git a/dom/bindings/moz.build b/dom/bindings/moz.build index 6131c66d270b..a4fdcc710d77 100644 --- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -95,9 +95,11 @@ LOCAL_INCLUDES += [ '/media/webrtc/signaling/src/common/time_profiling', '/media/webrtc/signaling/src/peerconnection', '/media/webrtc/trunk/', - '/third_party/msgpack/include', ] +if CONFIG['MOZ_LIBPRIO']: + LOCAL_INCLUDES += ['/third_party/msgpack/include'] + DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True diff --git a/dom/chrome-webidl/moz.build b/dom/chrome-webidl/moz.build index 071cbb8b88f8..f4c2e1ceedd5 100644 --- a/dom/chrome-webidl/moz.build +++ b/dom/chrome-webidl/moz.build @@ -44,7 +44,6 @@ WEBIDL_FILES = [ 'MozStorageStatementParams.webidl', 'MozStorageStatementRow.webidl', 'PrecompiledScript.webidl', - 'PrioEncoder.webidl', 'PromiseDebugging.webidl', 'StructuredCloneHolder.webidl', 'WebExtensionContentScript.webidl', @@ -58,3 +57,9 @@ if CONFIG['MOZ_PLACES']: 'PlacesEvent.webidl', 'PlacesObservers.webidl', ] + +if CONFIG['MOZ_LIBPRIO']: + WEBIDL_FILES += [ + 'PrioEncoder.webidl', + ] + diff --git a/dom/moz.build b/dom/moz.build index 741a04267558..b6d13707cf73 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -63,7 +63,6 @@ DIRS += [ 'notification', 'offline', 'power', - 'prio', 'push', 'quota', 'security', @@ -105,6 +104,9 @@ DIRS += [ 'simpledb', ] +if CONFIG['MOZ_LIBPRIO']: + DIRS += ['prio'] + if CONFIG['OS_ARCH'] == 'WINNT': DIRS += ['plugins/ipc/hangui'] diff --git a/third_party/moz.build b/third_party/moz.build index 183f5a2fb3e0..425eb33ccec2 100644 --- a/third_party/moz.build +++ b/third_party/moz.build @@ -10,8 +10,9 @@ with Files('rust/**'): with Files('webkit/**'): BUG_COMPONENT = ('Firefox Build System', 'General') -with Files('prio/**'): - BUG_COMPONENT = ('Firefox Build System', 'General') +if CONFIG['MOZ_LIBPRIO']: + with Files('prio/**'): + BUG_COMPONENT = ('Firefox Build System', 'General') -with Files('msgpack/**'): - BUG_COMPONENT = ('Firefox Build System', 'General') + with Files('msgpack/**'): + BUG_COMPONENT = ('Firefox Build System', 'General') diff --git a/toolkit/moz.configure b/toolkit/moz.configure index e1a361d19b7f..78f9e2ac9b32 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -1064,3 +1064,16 @@ def launcher(value, target): set_config('MOZ_LAUNCHER_PROCESS', launcher) set_define('MOZ_LAUNCHER_PROCESS', launcher) + +# Prio +# ============================================================== +@depends(c_compiler) +def libprio(info): + if info: + if info.type in ('msvc'): + return None + else: + return True + +set_config('MOZ_LIBPRIO', libprio) + From eec002c6dffbd103eec727d89b540b8fd03f8556 Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Mon, 27 Aug 2018 21:41:38 +0300 Subject: [PATCH 19/64] Backed out changeset df602a252b66 (bug 1485946) for Linting failure. CLOSED TREE --- config/external/moz.build | 6 +----- config/external/msgpack/moz.build | 3 +-- config/external/prio/moz.build | 2 +- dom/bindings/moz.build | 4 +--- dom/chrome-webidl/moz.build | 7 +------ dom/moz.build | 4 +--- third_party/moz.build | 9 ++++----- toolkit/moz.configure | 13 ------------- 8 files changed, 10 insertions(+), 38 deletions(-) diff --git a/config/external/moz.build b/config/external/moz.build index 86aa5351335a..21667e0543f8 100644 --- a/config/external/moz.build +++ b/config/external/moz.build @@ -8,16 +8,12 @@ external_dirs = [] DIRS += [ 'lgpllibs', + 'prio', 'sqlite', ] if not CONFIG['MOZ_SYSTEM_JPEG']: external_dirs += ['media/libjpeg'] -if CONFIG['MOZ_LIBPRIO']: - DIRS += [ - 'prio', - ] - # There's no "native" brotli or woff2 yet, but probably in the future... external_dirs += ['modules/brotli'] external_dirs += ['modules/woff2'] diff --git a/config/external/msgpack/moz.build b/config/external/msgpack/moz.build index 3dc3955bf237..9e9599a8b228 100644 --- a/config/external/msgpack/moz.build +++ b/config/external/msgpack/moz.build @@ -4,6 +4,5 @@ # 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/. -if CONFIG['MOZ_LIBPRIO']: - DIRS += ['/third_party/msgpack'] +DIRS += ['/third_party/msgpack'] diff --git a/config/external/prio/moz.build b/config/external/prio/moz.build index df3540f8ef49..b8a167496189 100644 --- a/config/external/prio/moz.build +++ b/config/external/prio/moz.build @@ -4,5 +4,5 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['/third_party/prio'] +DIRS += ['../../../third_party/prio'] diff --git a/dom/bindings/moz.build b/dom/bindings/moz.build index a4fdcc710d77..6131c66d270b 100644 --- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -95,11 +95,9 @@ LOCAL_INCLUDES += [ '/media/webrtc/signaling/src/common/time_profiling', '/media/webrtc/signaling/src/peerconnection', '/media/webrtc/trunk/', + '/third_party/msgpack/include', ] -if CONFIG['MOZ_LIBPRIO']: - LOCAL_INCLUDES += ['/third_party/msgpack/include'] - DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True diff --git a/dom/chrome-webidl/moz.build b/dom/chrome-webidl/moz.build index f4c2e1ceedd5..071cbb8b88f8 100644 --- a/dom/chrome-webidl/moz.build +++ b/dom/chrome-webidl/moz.build @@ -44,6 +44,7 @@ WEBIDL_FILES = [ 'MozStorageStatementParams.webidl', 'MozStorageStatementRow.webidl', 'PrecompiledScript.webidl', + 'PrioEncoder.webidl', 'PromiseDebugging.webidl', 'StructuredCloneHolder.webidl', 'WebExtensionContentScript.webidl', @@ -57,9 +58,3 @@ if CONFIG['MOZ_PLACES']: 'PlacesEvent.webidl', 'PlacesObservers.webidl', ] - -if CONFIG['MOZ_LIBPRIO']: - WEBIDL_FILES += [ - 'PrioEncoder.webidl', - ] - diff --git a/dom/moz.build b/dom/moz.build index b6d13707cf73..741a04267558 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -63,6 +63,7 @@ DIRS += [ 'notification', 'offline', 'power', + 'prio', 'push', 'quota', 'security', @@ -104,9 +105,6 @@ DIRS += [ 'simpledb', ] -if CONFIG['MOZ_LIBPRIO']: - DIRS += ['prio'] - if CONFIG['OS_ARCH'] == 'WINNT': DIRS += ['plugins/ipc/hangui'] diff --git a/third_party/moz.build b/third_party/moz.build index 425eb33ccec2..183f5a2fb3e0 100644 --- a/third_party/moz.build +++ b/third_party/moz.build @@ -10,9 +10,8 @@ with Files('rust/**'): with Files('webkit/**'): BUG_COMPONENT = ('Firefox Build System', 'General') -if CONFIG['MOZ_LIBPRIO']: - with Files('prio/**'): - BUG_COMPONENT = ('Firefox Build System', 'General') +with Files('prio/**'): + BUG_COMPONENT = ('Firefox Build System', 'General') - with Files('msgpack/**'): - BUG_COMPONENT = ('Firefox Build System', 'General') +with Files('msgpack/**'): + BUG_COMPONENT = ('Firefox Build System', 'General') diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 78f9e2ac9b32..e1a361d19b7f 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -1064,16 +1064,3 @@ def launcher(value, target): set_config('MOZ_LAUNCHER_PROCESS', launcher) set_define('MOZ_LAUNCHER_PROCESS', launcher) - -# Prio -# ============================================================== -@depends(c_compiler) -def libprio(info): - if info: - if info.type in ('msvc'): - return None - else: - return True - -set_config('MOZ_LIBPRIO', libprio) - From af81c03a1089ff904f474f396853f1655fa819b6 Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Mon, 27 Aug 2018 18:38:37 +0000 Subject: [PATCH 20/64] Bug 1392106 - random-if more test cases for windows 7 letter rendering failures. r=RyanVM random-if statements for the last 2 days worth of annotated failures Differential Revision: https://phabricator.services.mozilla.com/D4070 --HG-- extra : moz-landing-system : lando --- layout/reftests/bidi/dirAuto/reftest.list | 2 +- layout/reftests/bidi/reftest.list | 38 +++++++++---------- layout/reftests/bugs/reftest.list | 2 +- layout/reftests/canvas/reftest.list | 4 +- layout/reftests/counters/reftest.list | 4 +- .../button-submit/reftest.list | 2 +- layout/reftests/first-letter/reftest.list | 8 ++-- layout/reftests/forms/textarea/reftest.list | 2 +- layout/reftests/mathml/reftest.list | 2 +- layout/reftests/pagination/reftest.list | 22 +++++------ layout/reftests/svg/reftest.list | 4 +- layout/reftests/svg/text/reftest.list | 12 +++--- layout/reftests/text/reftest.list | 2 +- layout/reftests/w3c-css/failures.list | 5 ++- layout/reftests/w3c-css/received/reftest.list | 16 ++++---- .../submitted/counter-styles-3/reftest.list | 8 ++-- .../w3c-css/submitted/flexbox/reftest.list | 8 ++-- .../w3c-css/submitted/lists-3/reftest.list | 4 +- 18 files changed, 74 insertions(+), 71 deletions(-) diff --git a/layout/reftests/bidi/dirAuto/reftest.list b/layout/reftests/bidi/dirAuto/reftest.list index 137d1af839e6..83ada72c41f2 100644 --- a/layout/reftests/bidi/dirAuto/reftest.list +++ b/layout/reftests/bidi/dirAuto/reftest.list @@ -1,4 +1,4 @@ -== bdi-auto-dir-default.html bdi-auto-dir-default-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == bdi-auto-dir-default.html bdi-auto-dir-default-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == dir_auto-set-contained-dir-L.html dir_auto-contained-dir-L-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == dir_auto-set-contained-dir-R.html dir_auto-contained-dir-R-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == dir_auto-set-contained-invalid-dir-L.html dir_auto-contained-dir-L-ref.html # Bug 1392106 diff --git a/layout/reftests/bidi/reftest.list b/layout/reftests/bidi/reftest.list index c877cb45e67e..45eb9d075ba3 100644 --- a/layout/reftests/bidi/reftest.list +++ b/layout/reftests/bidi/reftest.list @@ -122,9 +122,9 @@ fuzzy-if(skiaContent,0-1,0-3) == 698291-1.html 698291-1-ref.html == 698706-1.html 698706-1-ref.html == 704837-1.html 704837-1-ref.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 712600-1.html 712600-1-ref.html # Bug 1392106 -== 712600-2.html 712600-2-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 712600-2.html 712600-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 712600-2-dyn.html 712600-2-ref.html # Bug 1392106 -== 712600-3.html 712600-3-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 712600-3.html 712600-3-ref.html # Bug 1392106 == 718236-1.html 718236-1-ref.html == 718236-2.html 718236-2-ref.html == 718236-3.html 718236-3-ref.html @@ -154,24 +154,24 @@ pref(layout.css.xul-tree-pseudos.content.enabled,true) fuzzy-if(xulRuntime.widge == 1157726-1.html 1157726-1-ref.html == 1161752.html 1161752-ref.html == 1161752-5-embed.html 1161752-5-embed-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1a-ltr.html brackets-1a-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1a-rtl.html brackets-1a-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-ltr.html brackets-1b-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-rtl.html brackets-1b-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-ltr.html brackets-1c-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-rtl.html brackets-1c-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-ltr.html brackets-2a-ltr-ref.html -fuzzy-if(Android,0-254,0-557) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-rtl.html brackets-2a-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-ltr.html brackets-2b-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-rtl.html brackets-2b-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-ltr.html brackets-2c-ltr-ref.html -fuzzy-if(Android,0-254,0-231) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-rtl.html brackets-2c-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-ltr.html brackets-3a-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-rtl.html brackets-3a-rtl-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-ltr.html brackets-3b-ltr-ref.html -random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-rtl.html brackets-3b-rtl-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1a-ltr.html brackets-1a-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1a-rtl.html brackets-1a-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-ltr.html brackets-1b-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-rtl.html brackets-1b-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-ltr.html brackets-1c-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-rtl.html brackets-1c-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-ltr.html brackets-2a-ltr-ref.html # Bug 1392106 +fuzzy-if(Android,0-254,0-557) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-rtl.html brackets-2a-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-ltr.html brackets-2b-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-rtl.html brackets-2b-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-ltr.html brackets-2c-ltr-ref.html # Bug 1392106 +fuzzy-if(Android,0-254,0-231) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-rtl.html brackets-2c-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-ltr.html brackets-3a-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-rtl.html brackets-3a-rtl-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-ltr.html brackets-3b-ltr-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-rtl.html brackets-3b-rtl-ref.html # Bug 1392106 == 1217833-1.html 1217833-1-ref.html == 1217833-2.html 1217833-2-ref.html == 1231175-1.html 1231175-1-ref.html == 1366623-1.html 1366623-1-ref.html -== 1426042-1.html 1426042-1-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1426042-1.html 1426042-1-ref.html # Bug 1392106 diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index fe670e6452bb..6cdf61970f5b 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -968,7 +968,7 @@ fails == 413027-3.html 413027-3-ref.html == 413286-3.html 413286-3-ref.html == 413286-4a.html 413286-4-ref.html == 413286-4b.html 413286-4-ref.html -== 413286-5.html 413286-5-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 413286-5.html 413286-5-ref.html # Bug 1392106 == 413286-6.html 413286-6-ref.html == 413292-1.html 413292-1-ref.html fuzzy-if(Android,0-11,0-17) fuzzy-if(webrender,0-1,0-10) == 413361-1.html 413361-1-ref.html # bug 1128229 diff --git a/layout/reftests/canvas/reftest.list b/layout/reftests/canvas/reftest.list index 9ca8f07769fe..d441a57cdf12 100644 --- a/layout/reftests/canvas/reftest.list +++ b/layout/reftests/canvas/reftest.list @@ -102,8 +102,8 @@ fuzzy-if(skiaContent,0-1,0-43) == 1201272-1.html 1201272-1-ref.html == 1303534-1.html 1303534-1-ref.html == 1304353-text-global-alpha-1.html 1304353-text-global-alpha-1-ref.html -fuzzy-if(winWidget,0-1,0-578) == 1304353-text-global-alpha-2.html 1304353-text-global-alpha-2-ref.html -fuzzy-if(winWidget,0-94,0-1575) fuzzy-if(cocoaWidget,0-1,0-24) == 1304353-text-global-composite-op-1.html 1304353-text-global-composite-op-1-ref.html +fuzzy-if(winWidget,0-1,0-578) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1304353-text-global-alpha-2.html 1304353-text-global-alpha-2-ref.html # Bug 1392106 +fuzzy-if(winWidget,0-94,0-1575) fuzzy-if(cocoaWidget,0-1,0-24) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1304353-text-global-composite-op-1.html 1304353-text-global-composite-op-1-ref.html # Bug 1392106 == text-indent-1a.html text-indent-1-ref.html == text-indent-1b.html text-indent-1-ref.html diff --git a/layout/reftests/counters/reftest.list b/layout/reftests/counters/reftest.list index 761d137a65f6..46d1d22d6e5e 100644 --- a/layout/reftests/counters/reftest.list +++ b/layout/reftests/counters/reftest.list @@ -9,7 +9,7 @@ == t1202-counter-07-b-test.html t1202-counter-07-b-reference.html == t1202-counter-08-b-test.html t1202-counter-08-b-reference.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == t1202-counter-09-b-test.html t1202-counter-09-b-reference.html # Bug 1392106 -== t1202-counter-10-b-test.html t1202-counter-10-b-reference.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == t1202-counter-10-b-test.html t1202-counter-10-b-reference.html # Bug 1392106 == t1202-counter-11-b-test.html t1202-counter-11-b-reference.html == t1202-counter-12-b-test.html t1202-counter-12-b-reference.html == t1202-counter-13-b-test.html t1202-counter-13-b-reference.html @@ -26,7 +26,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == t1202-counter-09-b-test. == t1202-counters-07-b-test.html t1202-counters-07-b-reference.html == t1202-counters-08-b-test.html t1202-counters-08-b-reference.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == t1202-counters-09-b-test.html t1202-counters-09-b-reference.html # Bug 1392106 -== t1202-counters-10-b-test.html t1202-counters-10-b-reference.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == t1202-counters-10-b-test.html t1202-counters-10-b-reference.html # Bug 1392106 == t1202-counters-11-b-test.html t1202-counters-11-b-reference.html == t1202-counters-12-b-test.html t1202-counters-12-b-reference.html == t1202-counters-13-b-test.html t1202-counters-13-b-reference.html diff --git a/layout/reftests/css-submit-invalid/button-submit/reftest.list b/layout/reftests/css-submit-invalid/button-submit/reftest.list index cfb8df94e45c..d398b047dc3f 100644 --- a/layout/reftests/css-submit-invalid/button-submit/reftest.list +++ b/layout/reftests/css-submit-invalid/button-submit/reftest.list @@ -13,4 +13,4 @@ == change-type-submit-control.html invalid-ref.html == change-type-not-submit-control.html valid-ref-4.html == self-invalid.html about:blank -== remove-form.html invalid-ref-3.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == remove-form.html invalid-ref-3.html # bug 1392106 diff --git a/layout/reftests/first-letter/reftest.list b/layout/reftests/first-letter/reftest.list index 1a36da288bee..82f04ff1ce12 100644 --- a/layout/reftests/first-letter/reftest.list +++ b/layout/reftests/first-letter/reftest.list @@ -76,7 +76,7 @@ random-if(gtkWidget) random-if(winWidget&&!d2d) == font-text-styles-floater.html == overflow-inline-overflow.html overflow-inline-overflow-ref.html == 1385656.html 1385656-ref.html -== 1404167-1.html 1404167-1-ref.html -== 1404167-2.html 1404167-2-ref.html -== 1404167-3.html 1404167-3-ref.html -== 1404167-4.html 1404167-4-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1404167-1.html 1404167-1-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1404167-2.html 1404167-2-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1404167-3.html 1404167-3-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1404167-4.html 1404167-4-ref.html # Bug 1392106 diff --git a/layout/reftests/forms/textarea/reftest.list b/layout/reftests/forms/textarea/reftest.list index fbde15894190..f1f5b15a941e 100644 --- a/layout/reftests/forms/textarea/reftest.list +++ b/layout/reftests/forms/textarea/reftest.list @@ -13,5 +13,5 @@ fuzzy-if(skiaContent,0-1,0-1) == rtl.html rtl-dynamic-attr.html fuzzy-if(skiaContent,0-1,0-1) == rtl.html rtl-dynamic-style.html == rtl.html in-dynamic-rtl-doc.html fuzzy-if(skiaContent,0-1,0-3) == setvalue-framereconstruction-1.html setvalue-framereconstruction-ref.html -fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-4168) == padding-scrollbar-placement.html padding-scrollbar-placement-ref.html +fuzzy-if(asyncPan&&!layersGPUAccelerated,0-102,0-4168) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == padding-scrollbar-placement.html padding-scrollbar-placement-ref.html # Bug 1392106 == various-cols.html various-cols-ref.html diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index 4e55b707b6d3..88a74db83816 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -8,7 +8,7 @@ random-if(gtkWidget) == dir-3.html dir-3-ref.html # bug 1309426 == dir-7.html dir-7-ref.html fails == dir-8.html dir-8-ref.html fails == dir-9.html dir-9-ref.html # Bug 787215 -== dir-10.html dir-10-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == dir-10.html dir-10-ref.html # Bug 1392106 == dir-11.html dir-11-ref.html == css-spacing-1.html css-spacing-1-ref.html pref(mathml.disabled,true) == disabled-scriptlevel-1.html disabled-scriptlevel-1-ref.html diff --git a/layout/reftests/pagination/reftest.list b/layout/reftests/pagination/reftest.list index af8ef9197c42..77ce76d84d29 100644 --- a/layout/reftests/pagination/reftest.list +++ b/layout/reftests/pagination/reftest.list @@ -2,17 +2,17 @@ # and layout/reftests/w3c-css/submitted/multicol3/ # Pagination tests # asserts(3) == abspos-breaking-000.xhtml abspos-breaking-000.ref.xhtml # bug 1067755, 1135556 -== abspos-breaking-001.xhtml abspos-breaking-000.ref.xhtml -== abspos-breaking-002.xhtml abspos-breaking-000.ref.xhtml -== abspos-breaking-003.html abspos-breaking-003-ref.html -== abspos-breaking-004.html abspos-breaking-004-ref.html -== abspos-breaking-005.html abspos-breaking-005-ref.html -== abspos-breaking-006.html abspos-breaking-006-ref.html -pref(layout.css.box-decoration-break.enabled,true) == abspos-breaking-007.html abspos-breaking-007-ref.html -pref(layout.css.box-decoration-break.enabled,true) == abspos-breaking-008.html abspos-breaking-008-ref.html -pref(layout.css.box-decoration-break.enabled,true) == abspos-breaking-009.html abspos-breaking-009-ref.html -pref(layout.css.box-decoration-break.enabled,true) == abspos-breaking-010.html abspos-breaking-010-ref.html -== abspos-breaking-011.html abspos-breaking-011-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-001.xhtml abspos-breaking-000.ref.xhtml # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-002.xhtml abspos-breaking-000.ref.xhtml # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-003.html abspos-breaking-003-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-004.html abspos-breaking-004-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-005.html abspos-breaking-005-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-006.html abspos-breaking-006-ref.html # Bug 1392106 +pref(layout.css.box-decoration-break.enabled,true) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-007.html abspos-breaking-007-ref.html # Bug 1392106 +pref(layout.css.box-decoration-break.enabled,true) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-008.html abspos-breaking-008-ref.html # Bug 1392106 +pref(layout.css.box-decoration-break.enabled,true) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-009.html abspos-breaking-009-ref.html # Bug 1392106 +pref(layout.css.box-decoration-break.enabled,true) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-010.html abspos-breaking-010-ref.html # Bug 1392106 +== abspos-breaking-011.html abspos-breaking-011-ref.html # Bug 1392106 == abspos-breaking-dynamic-001.html abspos-breaking-dynamic-001-ref.html == abspos-breaking-dynamic-002.html abspos-breaking-dynamic-002-ref.html == abspos-breaking-dynamic-003.html abspos-breaking-dynamic-003-ref.html diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 3623d48685f4..a64e50bbd802 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -478,7 +478,7 @@ fuzzy-if(skiaContent,0-1,0-610) == textPath-03.svg pass.svg == textPath-04.svg pass.svg == textPath-05.html pass.svg == textPath-06.svg pass.svg -== textPath-line-01.svg textPath-line-01-ref.svg +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == textPath-line-01.svg textPath-line-01-ref.svg # bug 1392106 == textPath-path-attribute-01.svg textPath-path-attribute-01-ref.svg == textPath-side-attribute-01.svg pass.svg @@ -503,7 +503,7 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fuzzy-if(skiaContent,0-1,0- random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fuzzy-if(skiaContent,0-1,0-550) == tspan-rotate-04.svg tspan-rotate-04-ref.svg # bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fuzzy-if(skiaContent,0-1,0-550) == tspan-rotate-05.svg tspan-rotate-ref.svg # bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fuzzy-if(skiaContent,0-1,0-550) == tspan-rotate-06.svg tspan-rotate-ref.svg # bug 1392106 -== tspan-rotate-07.svg tspan-rotate-07-ref.svg +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == tspan-rotate-07.svg tspan-rotate-07-ref.svg # Bug 1392106 == tspan-rotate-textPath-01.svg tspan-rotate-textPath-01-ref.svg fuzzy-if(skiaContent,0-1,0-100) == tspan-xy-01.svg tspan-xy-ref.svg == tspan-xy-02.svg tspan-xy-ref.svg diff --git a/layout/reftests/svg/text/reftest.list b/layout/reftests/svg/text/reftest.list index a270e1a356f4..ef4ef207c89d 100644 --- a/layout/reftests/svg/text/reftest.list +++ b/layout/reftests/svg/text/reftest.list @@ -145,14 +145,14 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.[12]/ == ignore-padding.svg ignore-prop-ref.svg random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == ignore-vertical-align.svg ignore-vertical-align-ref.svg # Bug 1392106 == ignore-overflow-scroll.svg ignore-prop-ref.svg -== ignore-text-align.svg ignore-prop-ref.svg -== ignore-text-align-2.svg ignore-text-align-2-ref.svg +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == ignore-text-align.svg ignore-prop-ref.svg # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == ignore-text-align-2.svg ignore-text-align-2-ref.svg # Bug 1392106 # pseudo-elements == pseudo-first-line.svg pseudo-first-line-ref.svg == pseudo-first-line-2.svg pseudo-first-line-2-ref.svg -== pseudo-first-letter.svg pseudo-first-letter-ref.svg -== pseudo-first-letter-2.svg pseudo-first-letter-2-ref.svg +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == pseudo-first-letter.svg pseudo-first-letter-ref.svg # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == pseudo-first-letter-2.svg pseudo-first-letter-2-ref.svg # Bug 1392106 == ignore-before-after.svg ignore-prop-ref.svg # invalid child nodes @@ -179,8 +179,8 @@ fuzzy-if(skiaContent&&winWidget,0-53,0-112) == mask-content-2.svg mask-content-2 # text and clipPaths == clipPath-applied.svg clipPath-applied-ref.svg -fuzzy-if(skiaContent&&winWidget,0-105,0-56) == clipPath-content.svg clipPath-content-ref.svg -fuzzy-if(skiaContent&&winWidget,0-53,0-112) == clipPath-content-2.svg clipPath-content-2-ref.svg +fuzzy-if(skiaContent&&winWidget,0-105,0-56) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == clipPath-content.svg clipPath-content-ref.svg # Bug 1392106 +fuzzy-if(skiaContent&&winWidget,0-53,0-112) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == clipPath-content-2.svg clipPath-content-2-ref.svg # Bug 1392106 # text and patterns fuzzy-if(cocoaWidget,0-1,0-6) fuzzy-if(skiaContent,0-65,0-313) == pattern-content.svg pattern-content-ref.svg diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index e950d625a64c..7afad03ed82c 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -322,7 +322,7 @@ pref(gfx.font_rendering.graphite.enabled,true) == glyph-decomposition-graphite.h == hyphenation-control-3.html hyphenation-control-3-ref.html == hyphenation-control-4.html hyphenation-control-4-ref.html fuzzy-if(winWidget,0-47,0-6) == hyphenation-control-5.html hyphenation-control-5-ref.html -== hyphenation-control-6.html hyphenation-control-6-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == hyphenation-control-6.html hyphenation-control-6-ref.html # Bug 1392106 == hyphenation-control-7.html hyphenation-control-7-ref.html # osx-font-smoothing - with and without subpixel AA, only under OSX diff --git a/layout/reftests/w3c-css/failures.list b/layout/reftests/w3c-css/failures.list index cbb747f550c6..31eb2b6d146c 100644 --- a/layout/reftests/w3c-css/failures.list +++ b/layout/reftests/w3c-css/failures.list @@ -130,10 +130,13 @@ fuzzy-if(OSX,0-23,0-16) css-writing-modes/text-combine-upright-decorations-001.h fuzzy-if(OSX||winWidget,0-255,0-480) css-writing-modes/text-indent-v??-0??.xht fuzzy-if(OSX||winWidget,0-226,0-960) fails-if(webrender&&cocoaWidget) css-writing-modes/text-orientation-016.xht fuzzy-if(OSX||winWidget,0-223,0-720) css-writing-modes/vertical-alignment-*.xht -fuzzy-if(OSX||winWidget,0-158,0-624) css-writing-modes/writing-mode-vertical-??-00?.* +fuzzy-if(OSX||winWidget,0-158,0-624) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/writing-mode-vertical-??-00?.* fuzzy(0-255,0-960) css-writing-modes/text-combine-upright-value-all-00?.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/text-combine-upright-compression-00?.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/text-combine-upright-inherit-all-00?.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/text-orientation-0??.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/text-orientation-mixed-v??-1??.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) css-writing-modes/text-orientation-sideways-v??-1??.html # Bug 1167911 skip css-writing-modes/abs-pos-non-replaced-icb-vlr-021.xht diff --git a/layout/reftests/w3c-css/received/reftest.list b/layout/reftests/w3c-css/received/reftest.list index 7977493e1737..9ddedaab7b94 100644 --- a/layout/reftests/w3c-css/received/reftest.list +++ b/layout/reftests/w3c-css/received/reftest.list @@ -1121,10 +1121,10 @@ fuzzy-if(OSX||winWidget,0-255,0-480) == css-writing-modes/text-indent-vrl-014.xh fuzzy-if(OSX||winWidget,0-255,0-480) == css-writing-modes/text-indent-vrl-016.xht css-writing-modes/text-indent-vrl-012-ref.xht fuzzy-if(OSX||winWidget,0-226,0-960) fails-if(webrender&&cocoaWidget) == css-writing-modes/text-orientation-016.xht css-writing-modes/text-orientation-016-ref.xht == css-writing-modes/text-orientation-mixed-srl-016.xht css-writing-modes/text-orientation-mixed-srl-016-ref.xht -== css-writing-modes/text-orientation-mixed-vlr-100.html css-writing-modes/text-orientation-mixed-vlr-100-ref.html -== css-writing-modes/text-orientation-mixed-vrl-100.html css-writing-modes/text-orientation-mixed-vrl-100-ref.html -== css-writing-modes/text-orientation-sideways-vlr-100.html css-writing-modes/text-orientation-sideways-vlr-100-ref.html -== css-writing-modes/text-orientation-sideways-vrl-100.html css-writing-modes/text-orientation-sideways-vrl-100-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/text-orientation-mixed-vlr-100.html css-writing-modes/text-orientation-mixed-vlr-100-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/text-orientation-mixed-vrl-100.html css-writing-modes/text-orientation-mixed-vrl-100-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/text-orientation-sideways-vlr-100.html css-writing-modes/text-orientation-sideways-vlr-100-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/text-orientation-sideways-vrl-100.html css-writing-modes/text-orientation-sideways-vrl-100-ref.html == css-writing-modes/text-orientation-upright-srl-018.xht css-writing-modes/text-orientation-mixed-srl-016-ref.xht == css-writing-modes/text-orientation-upright-vlr-100.html css-writing-modes/text-orientation-upright-vlr-100-ref.html == css-writing-modes/text-orientation-upright-vrl-100.html css-writing-modes/text-orientation-upright-vrl-100-ref.html @@ -1159,10 +1159,10 @@ fails == css-writing-modes/wm-propagation-body-011.xht css-writing-modes/wm-prop fails == css-writing-modes/wm-propagation-body-015.xht css-writing-modes/block-flow-direction-025-ref.xht == css-writing-modes/writing-mode-horizontal-001l.html css-writing-modes/reference/writing-mode-horizontal-001l-ref.html == css-writing-modes/writing-mode-horizontal-001r.html css-writing-modes/reference/writing-mode-horizontal-001r-ref.html -fuzzy-if(OSX||winWidget,0-158,0-624) == css-writing-modes/writing-mode-vertical-lr-002.xht css-writing-modes/reftest/writing-mode-vertical-lr-002-ref.xht -fuzzy-if(OSX||winWidget,0-158,0-624) == css-writing-modes/writing-mode-vertical-rl-001.xht css-writing-modes/reftest/writing-mode-vertical-rl-001-ref.xht -fuzzy-if(OSX||winWidget,0-158,0-624) == css-writing-modes/writing-mode-vertical-rl-002.xht css-writing-modes/reftest/writing-mode-vertical-rl-002-ref.xht -fuzzy-if(OSX||winWidget,0-158,0-624) == css-writing-modes/writing-mode-vertical-rl-003.htm css-writing-modes/writing-mode-vertical-rl-003-ref.htm +fuzzy-if(OSX||winWidget,0-158,0-624) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/writing-mode-vertical-lr-002.xht css-writing-modes/reftest/writing-mode-vertical-lr-002-ref.xht +fuzzy-if(OSX||winWidget,0-158,0-624) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/writing-mode-vertical-rl-001.xht css-writing-modes/reftest/writing-mode-vertical-rl-001-ref.xht +fuzzy-if(OSX||winWidget,0-158,0-624) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/writing-mode-vertical-rl-002.xht css-writing-modes/reftest/writing-mode-vertical-rl-002-ref.xht +fuzzy-if(OSX||winWidget,0-158,0-624) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == css-writing-modes/writing-mode-vertical-rl-003.htm css-writing-modes/writing-mode-vertical-rl-003-ref.htm skip == selectors/any-link-dynamic-001.html selectors/any-link-dynamic-001-ref.html needs-focus == selectors/focus-within-001.html selectors/focus-within-001-ref.html needs-focus == selectors/focus-within-002.html selectors/focus-within-001-ref.html diff --git a/layout/reftests/w3c-css/submitted/counter-styles-3/reftest.list b/layout/reftests/w3c-css/submitted/counter-styles-3/reftest.list index 30cc3a9b98a0..e339babc6c09 100644 --- a/layout/reftests/w3c-css/submitted/counter-styles-3/reftest.list +++ b/layout/reftests/w3c-css/submitted/counter-styles-3/reftest.list @@ -1,6 +1,6 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == system-cyclic.html system-cyclic-ref.html # Bug 1392106 -== system-fixed.html system-fixed-ref.html -== system-symbolic.html system-symbolic-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == system-fixed.html system-fixed-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == system-symbolic.html system-symbolic-ref.html # Bug 1392106 fails-if(webrender&&cocoaWidget) == system-alphabetic.html system-alphabetic-ref.html == system-numeric.html system-numeric-ref.html == system-additive.html system-additive-ref.html @@ -13,8 +13,8 @@ fails-if(webrender&&cocoaWidget) == system-alphabetic.html system-alphabetic-ref == system-additive-invalid.html system-common-invalid-ref.html == system-extends-invalid.html system-extends-invalid-ref.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == descriptor-negative.html descriptor-negative-ref.html # Bug 1392106 -== descriptor-prefix.html descriptor-prefix-ref.html -== descriptor-suffix.html descriptor-suffix-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == descriptor-prefix.html descriptor-prefix-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == descriptor-suffix.html descriptor-suffix-ref.html # Bug 1392106 == descriptor-range.html descriptor-range-ref.html fuzzy-if(webrender,0-22,0-3) == descriptor-pad.html descriptor-pad-ref.html == descriptor-fallback.html descriptor-fallback-ref.html diff --git a/layout/reftests/w3c-css/submitted/flexbox/reftest.list b/layout/reftests/w3c-css/submitted/flexbox/reftest.list index 41abbe8e4c77..198a5ce0ecbb 100644 --- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list +++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list @@ -39,10 +39,10 @@ fuzzy-if(webrender,0-1,0-2) == flexbox-align-self-horiz-004.xhtml flexbox-align == flexbox-align-self-vert-003.xhtml flexbox-align-self-vert-003-ref.xhtml == flexbox-align-self-vert-004.xhtml flexbox-align-self-vert-004-ref.xhtml fuzzy-if(Android,0-158,0-32) == flexbox-align-self-vert-rtl-001.xhtml flexbox-align-self-vert-rtl-001-ref.xhtml -== flexbox-align-self-vert-rtl-002.xhtml flexbox-align-self-vert-rtl-002-ref.xhtml -== flexbox-align-self-vert-rtl-003.xhtml flexbox-align-self-vert-rtl-003-ref.xhtml -== flexbox-align-self-vert-rtl-004.xhtml flexbox-align-self-vert-rtl-004-ref.xhtml -== flexbox-align-self-vert-rtl-005.xhtml flexbox-align-self-vert-rtl-005-ref.xhtml +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == flexbox-align-self-vert-rtl-002.xhtml flexbox-align-self-vert-rtl-002-ref.xhtml # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == flexbox-align-self-vert-rtl-003.xhtml flexbox-align-self-vert-rtl-003-ref.xhtml # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == flexbox-align-self-vert-rtl-004.xhtml flexbox-align-self-vert-rtl-004-ref.xhtml # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == flexbox-align-self-vert-rtl-005.xhtml flexbox-align-self-vert-rtl-005-ref.xhtml # Bug 1392106 == flexbox-align-items-center-nested-001.html flexbox-align-items-center-nested-001-ref.html diff --git a/layout/reftests/w3c-css/submitted/lists-3/reftest.list b/layout/reftests/w3c-css/submitted/lists-3/reftest.list index f914145ab8f0..de525942f8e3 100644 --- a/layout/reftests/w3c-css/submitted/lists-3/reftest.list +++ b/layout/reftests/w3c-css/submitted/lists-3/reftest.list @@ -1,3 +1,3 @@ # Tests for list-style-type -== list-style-type-string-001a.html list-style-type-string-001-ref.html -== list-style-type-string-001b.html list-style-type-string-001-ref.html +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == list-style-type-string-001a.html list-style-type-string-001-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == list-style-type-string-001b.html list-style-type-string-001-ref.html # Bug 1392106 From fe373d932232bbbb69edaebe5a12a51105a58eef Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Mon, 27 Aug 2018 19:02:34 +0000 Subject: [PATCH 21/64] Bug 1486413 - Revert 'xul|textbox[focused]' rule accidentally added in Bug 1486413. r=jaws It was accidentally copied from the previous ruleset for the -moz-ui-invalid rules but I meant to invesigate whether -moz-ui-invalid applied to before landing. Differential Revision: https://phabricator.services.mozilla.com/D4359 --HG-- extra : moz-landing-system : lando --- toolkit/themes/shared/in-content/common.inc.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/toolkit/themes/shared/in-content/common.inc.css b/toolkit/themes/shared/in-content/common.inc.css index 7fe51e157b4e..f16620e4ea67 100644 --- a/toolkit/themes/shared/in-content/common.inc.css +++ b/toolkit/themes/shared/in-content/common.inc.css @@ -506,12 +506,13 @@ xul|textbox[focused] { border-color: var(--in-content-border-focus); } -/* Don't show the field error outlines and focus borders at the same time */ +/* Don't show the field error outlines and focus borders at the same time. + This doesn't apply to XUL since they don't expose validity + attributes */ html|input[type="email"]:-moz-ui-invalid:focus, html|input[type="tel"]:-moz-ui-invalid:focus, html|input[type="text"]:-moz-ui-invalid:focus, -html|textarea:-moz-ui-invalid:focus, -xul|textbox[focused] { +html|textarea:-moz-ui-invalid:focus { border-color: transparent; } From 16d89ecabce3a4428bcb6f72bb6554399e790ab5 Mon Sep 17 00:00:00 2001 From: Bianca Danforth Date: Mon, 27 Aug 2018 18:17:43 +0000 Subject: [PATCH 22/64] Bug 1457226 - Revert Savant Shield study commits; r=rhelmer The Savant pref flip Shield study was ended on 08-20-18 (https://bugzilla.mozilla.org/show_bug.cgi?id=1457226#c28), so this patch removes all temporary study code from Firefox. Differential Revision: https://phabricator.services.mozilla.com/D4285 --HG-- extra : moz-landing-system : lando --- browser/app/profile/firefox.js | 4 - browser/base/content/tabbrowser.js | 3 - browser/components/nsBrowserGlue.js | 10 - browser/modules/BrowserUsageTelemetry.jsm | 7 - browser/modules/SavantShieldStudy.jsm | 530 ------------------ browser/modules/moz.build | 1 - .../passwordmgr/LoginManagerContent.jsm | 8 +- .../passwordmgr/LoginManagerParent.jsm | 29 - .../passwordmgr/nsLoginManagerPrompter.js | 20 - toolkit/components/reader/ReaderMode.jsm | 5 - toolkit/components/telemetry/Events.yaml | 200 ------- 11 files changed, 1 insertion(+), 816 deletions(-) delete mode 100644 browser/modules/SavantShieldStudy.jsm diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 3ddc8aeef556..d528c444c423 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1738,10 +1738,6 @@ pref("app.shield.optoutstudies.enabled", true); pref("app.shield.optoutstudies.enabled", false); #endif -// Savant Shield study preferences -pref("shield.savant.enabled", false); -pref("shield.savant.loglevel", "warn"); - // Multi-lingual preferences pref("intl.multilingual.enabled", false); diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 8ac2eadac0eb..981c542ebb06 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -1014,7 +1014,6 @@ window._gBrowser = { } }); newTab.dispatchEvent(event); - Services.telemetry.recordEvent("savant", "tab", "select", null, { subcategory: "frame" }); this._tabAttrModified(oldTab, ["selected"]); this._tabAttrModified(newTab, ["selected"]); @@ -2472,7 +2471,6 @@ window._gBrowser = { // even if the event listener opens or closes tabs. let evt = new CustomEvent("TabOpen", { bubbles: true, detail: eventDetail || {} }); t.dispatchEvent(evt); - Services.telemetry.recordEvent("savant", "tab", "open", null, { subcategory: "frame" }); if (!usingPreloadedContent && originPrincipal && aURI) { let { URI_INHERITS_SECURITY_CONTEXT } = Ci.nsIProtocolHandler; @@ -2886,7 +2884,6 @@ window._gBrowser = { // inspect the tab that's about to close. var evt = new CustomEvent("TabClose", { bubbles: true, detail: { adoptedBy: aAdoptedByTab } }); aTab.dispatchEvent(evt); - Services.telemetry.recordEvent("savant", "tab", "close", null, { subcategory: "frame" }); if (this.tabs.length == 2) { // We're closing one of our two open tabs, inform the other tab that its diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 1f2234879bd4..aebfeb6ba5e0 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -429,7 +429,6 @@ XPCOMUtils.defineLazyModuleGetters(this, { RemoteSettings: "resource://services-settings/remote-settings.js", SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm", Sanitizer: "resource:///modules/Sanitizer.jsm", - SavantShieldStudy: "resource:///modules/SavantShieldStudy.jsm", SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm", SessionStore: "resource:///modules/sessionstore/SessionStore.jsm", ShellService: "resource:///modules/ShellService.jsm", @@ -525,9 +524,6 @@ const listeners = { "RemoteLogins:autoCompleteLogins": ["LoginManagerParent"], "RemoteLogins:removeLogin": ["LoginManagerParent"], "RemoteLogins:insecureLoginFormPresent": ["LoginManagerParent"], - // For Savant Shield study, bug 1465685. Study on desktop only. - "LoginStats:LoginFillSuccessful": ["LoginManagerParent"], - "LoginStats:LoginEncountered": ["LoginManagerParent"], // PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js "WCCR:registerProtocolHandler": ["Feeds"], "rtcpeer:CancelRequest": ["webrtcUI"], @@ -1400,8 +1396,6 @@ BrowserGlue.prototype = { } Normandy.uninit(); - - SavantShieldStudy.uninit(); }, // All initial windows have opened. @@ -1558,10 +1552,6 @@ BrowserGlue.prototype = { Services.tm.idleDispatchToMainThread(() => { Blocklist.loadBlocklistAsync(); }); - - Services.tm.idleDispatchToMainThread(() => { - SavantShieldStudy.init(); - }); }, /** diff --git a/browser/modules/BrowserUsageTelemetry.jsm b/browser/modules/BrowserUsageTelemetry.jsm index bb8eafd837b6..4ccb46a835b7 100644 --- a/browser/modules/BrowserUsageTelemetry.jsm +++ b/browser/modules/BrowserUsageTelemetry.jsm @@ -366,10 +366,6 @@ let urlbarListener = { Services.telemetry .getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE") .add(actionType, idx); - if (actionType === "bookmark" || actionType === "history") { - Services.telemetry.recordEvent("savant", "follow_urlbar_link", actionType, null, - { subcategory: "navigation" }); - } } else { Cu.reportError("Unknown FX_URLBAR_SELECTED_RESULT_TYPE type: " + actionType); @@ -503,9 +499,6 @@ let BrowserUsageTelemetry = { scalarKey, 1); Services.telemetry.recordEvent("navigation", "search", source, action, { engine: getSearchEngineId(engine) }); - Services.telemetry.recordEvent("savant", "search", source, action, - { subcategory: "navigation", - engine: getSearchEngineId(engine) }); }, _handleSearchAction(engine, source, details) { diff --git a/browser/modules/SavantShieldStudy.jsm b/browser/modules/SavantShieldStudy.jsm deleted file mode 100644 index 9a29dae41a7c..000000000000 --- a/browser/modules/SavantShieldStudy.jsm +++ /dev/null @@ -1,530 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public -* License, v. 2.0. If a copy of the MPL was not distributed with this file, -* You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* eslint semi: error */ - -"use strict"; - -var EXPORTED_SYMBOLS = ["SavantShieldStudy"]; - -ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); -ChromeUtils.import("resource://gre/modules/Services.jsm"); - -XPCOMUtils.defineLazyModuleGetters(this, { - AddonManager: "resource://gre/modules/AddonManager.jsm", - PlacesUtils: "resource://gre/modules/PlacesUtils.jsm" -}); - -// See LOG_LEVELS in Console.jsm. Examples: "all", "info", "warn", & "error". -const PREF_LOG_LEVEL = "shield.savant.loglevel"; - -// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref. -XPCOMUtils.defineLazyGetter(this, "log", () => { - let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {}).ConsoleAPI; - let consoleOptions = { - maxLogLevelPref: PREF_LOG_LEVEL, - prefix: "SavantShieldStudy", - }; - return new ConsoleAPI(consoleOptions); -}); - -class SavantShieldStudyClass { - constructor() { - this.STUDY_PREF = "shield.savant.enabled"; - this.STUDY_TELEMETRY_CATEGORY = "savant"; - this.ALWAYS_PRIVATE_BROWSING_PREF = "browser.privatebrowsing.autostart"; - this.STUDY_DURATION_OVERRIDE_PREF = "shield.savant.duration_override"; - this.STUDY_EXPIRATION_DATE_PREF = "shield.savant.expiration_date"; - // ms = 'x' weeks * 7 days/week * 24 hours/day * 60 minutes/hour - // * 60 seconds/minute * 1000 milliseconds/second - this.DEFAULT_STUDY_DURATION_MS = 4 * 7 * 24 * 60 * 60 * 1000; - // If on startupStudy(), user is ineligible or study has expired, - // no probe listeners from this module have been added yet - this.shouldRemoveListeners = true; - } - - init() { - this.telemetryEvents = new TelemetryEvents(this.STUDY_TELEMETRY_CATEGORY); - this.addonListener = new AddonListener(this.STUDY_TELEMETRY_CATEGORY); - this.bookmarkObserver = new BookmarkObserver(this.STUDY_TELEMETRY_CATEGORY); - this.menuListener = new MenuListener(this.STUDY_TELEMETRY_CATEGORY); - - // check the pref in case Normandy flipped it on before we could add the pref listener - this.shouldCollect = Services.prefs.getBoolPref(this.STUDY_PREF); - if (this.shouldCollect) { - this.startupStudy(); - } - Services.prefs.addObserver(this.STUDY_PREF, this); - } - - observe(subject, topic, data) { - if (topic === "nsPref:changed" && data === this.STUDY_PREF) { - // toggle state of the pref - this.shouldCollect = !this.shouldCollect; - if (this.shouldCollect) { - this.startupStudy(); - } else { - // The pref has been turned off - this.endStudy("study_disable"); - } - } - } - - startupStudy() { - // enable before any possible calls to endStudy, since it sends an 'end_study' event - this.telemetryEvents.enableCollection(); - - if (!this.isEligible()) { - this.shouldRemoveListeners = false; - this.endStudy("ineligible"); - return; - } - - this.initStudyDuration(); - - if (this.isStudyExpired()) { - log.debug("Study expired in between this and the previous session."); - this.shouldRemoveListeners = false; - this.endStudy("expired"); - } - - this.addonListener.init(); - this.bookmarkObserver.init(); - this.menuListener.init(); - } - - isEligible() { - const isAlwaysPrivateBrowsing = Services.prefs.getBoolPref(this.ALWAYS_PRIVATE_BROWSING_PREF); - if (isAlwaysPrivateBrowsing) { - return false; - } - - return true; - } - - initStudyDuration() { - if (Services.prefs.getStringPref(this.STUDY_EXPIRATION_DATE_PREF, "")) { - return; - } - Services.prefs.setStringPref( - this.STUDY_EXPIRATION_DATE_PREF, - this.getExpirationDateString() - ); - } - - getDurationFromPref() { - return Services.prefs.getIntPref(this.STUDY_DURATION_OVERRIDE_PREF, 0); - } - - getExpirationDateString() { - const now = Date.now(); - const studyDurationInMs = - this.getDurationFromPref() - || this.DEFAULT_STUDY_DURATION_MS; - const expirationDateInt = now + studyDurationInMs; - return new Date(expirationDateInt).toISOString(); - } - - isStudyExpired() { - const expirationDateInt = - Date.parse(Services.prefs.getStringPref( - this.STUDY_EXPIRATION_DATE_PREF, - this.getExpirationDateString() - )); - - if (isNaN(expirationDateInt)) { - log.error( - `The value for the preference ${this.STUDY_EXPIRATION_DATE_PREF} is invalid.` - ); - return false; - } - - if (Date.now() > expirationDateInt) { - return true; - } - return false; - } - - endStudy(reason) { - log.debug(`Ending the study due to reason: ${ reason }`); - const isStudyEnding = true; - Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, "end_study", reason, null, - { subcategory: "shield" }); - this.telemetryEvents.disableCollection(); - this.uninit(isStudyEnding); - // These prefs needs to persist between restarts, so only reset on endStudy - Services.prefs.clearUserPref(this.STUDY_PREF); - Services.prefs.clearUserPref(this.STUDY_EXPIRATION_DATE_PREF); - } - - // Called on every Firefox shutdown and endStudy - uninit(isStudyEnding = false) { - // if just shutting down, check for expiration, so the endStudy event can - // be sent along with this session's main ping. - if (!isStudyEnding && this.isStudyExpired()) { - log.debug("Study expired during this session."); - this.endStudy("expired"); - return; - } - - this.addonListener.uninit(); - this.bookmarkObserver.uninit(); - this.menuListener.uninit(); - - Services.prefs.removeObserver(this.ALWAYS_PRIVATE_BROWSING_PREF, this); - Services.prefs.removeObserver(this.STUDY_PREF, this); - Services.prefs.removeObserver(this.STUDY_DURATION_OVERRIDE_PREF, this); - Services.prefs.clearUserPref(PREF_LOG_LEVEL); - Services.prefs.clearUserPref(this.STUDY_DURATION_OVERRIDE_PREF); - } -} - -// References: -// - https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/normandy/lib/TelemetryEvents.jsm -// - https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/normandy/lib/PreferenceExperiments.jsm#l357 -class TelemetryEvents { - constructor(studyCategory) { - this.STUDY_TELEMETRY_CATEGORY = studyCategory; - } - - enableCollection() { - log.debug("Study has been enabled; turning ON data collection."); - Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, true); - } - - disableCollection() { - log.debug("Study has been disabled; turning OFF data collection."); - Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, false); - } -} - -class AddonListener { - constructor(studyCategory) { - this.STUDY_TELEMETRY_CATEGORY = studyCategory; - this.METHOD = "addon"; - this.EXTRA_SUBCATEGORY = "customize"; - } - - init() { - this.listener = { - onInstalling: (addon, needsRestart) => { - const addon_id = addon.id; - this.recordEvent("install_start", addon_id); - }, - - onInstalled: (addon) => { - const addon_id = addon.id; - this.recordEvent("install_finish", addon_id); - }, - - onEnabled: (addon) => { - const addon_id = addon.id; - this.recordEvent("enable", addon_id); - }, - - onDisabled: (addon) => { - const addon_id = addon.id; - this.recordEvent("disable", addon_id); - }, - - onUninstalling: (addon, needsRestart) => { - const addon_id = addon.id; - this.recordEvent("remove_start", addon_id); - }, - - onUninstalled: (addon) => { - const addon_id = addon.id; - this.recordEvent("remove_finish", addon_id); - } - }; - this.addListeners(); - } - - addListeners() { - AddonManager.addAddonListener(this.listener); - } - - recordEvent(event, addon_id) { - log.debug(`Addon ID: ${addon_id}; event: ${ event }`); - Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, - this.METHOD, - event, - addon_id, - { subcategory: this.EXTRA_SUBCATEGORY }); - } - - removeListeners() { - AddonManager.removeAddonListener(this.listener); - } - - uninit() { - if (SavantShieldStudy.shouldRemoveListeners) { - this.removeListeners(); - } - } -} - -class BookmarkObserver { - constructor(studyCategory) { - this.STUDY_TELEMETRY_CATEGORY = studyCategory; - // there are two probes: bookmark and follow_bookmark - this.METHOD_1 = "bookmark"; - this.EXTRA_SUBCATEGORY_1 = "feature"; - this.METHOD_2 = "follow_bookmark"; - this.EXTRA_SUBCATEGORY_2 = "navigation"; - this.TYPE_BOOKMARK = Ci.nsINavBookmarksService.TYPE_BOOKMARK; - // Ignore "fake" bookmarks created for bookmark tags - this.skipTags = true; - } - - init() { - this.addObservers(); - } - - addObservers() { - PlacesUtils.bookmarks.addObserver(this); - } - - onItemAdded(itemID, parentID, index, itemType, uri, title, dateAdded, guid, parentGUID, source) { - this.handleItemAddRemove(itemType, uri, source, "save"); - } - - onItemRemoved(itemID, parentID, index, itemType, uri, guid, parentGUID, source) { - this.handleItemAddRemove(itemType, uri, source, "remove"); - } - - handleItemAddRemove(itemType, uri, source, event) { - /* - * "place:query" uris are used to create containers like Most Visited or - * Recently Bookmarked. These are added as default bookmarks. - */ - if (itemType === this.TYPE_BOOKMARK && !uri.schemeIs("place") - && source === PlacesUtils.bookmarks.SOURCE_DEFAULT) { - const isBookmarkProbe = true; - this.recordEvent(event, isBookmarkProbe); - } - } - - // This observer is only fired for TYPE_BOOKMARK items. - onItemVisited(itemID, visitID, time, transitionType, uri, parentID, guid, parentGUID) { - const isBookmarkProbe = false; - this.recordEvent("open", isBookmarkProbe); - } - - recordEvent(event, isBookmarkProbe) { - const method = isBookmarkProbe ? this.METHOD_1 : this.METHOD_2; - const subcategory = isBookmarkProbe ? this.EXTRA_SUBCATEGORY_1 : this.EXTRA_SUBCATEGORY_2; - Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, method, event, null, - { - subcategory - }); - } - - removeObservers() { - PlacesUtils.bookmarks.removeObserver(this); - } - - uninit() { - if (SavantShieldStudy.shouldRemoveListeners) { - this.removeObservers(); - } - } -} - -class MenuListener { - constructor(studyCategory) { - this.STUDY_TELEMETRY_CATEGORY = studyCategory; - this.NAVIGATOR_TOOLBOX_ID = "navigator-toolbox"; - this.OVERFLOW_PANEL_ID = "widget-overflow"; - this.LIBRARY_PANELVIEW_ID = "appMenu-libraryView"; - this.HAMBURGER_PANEL_ID = "appMenu-popup"; - this.DOTDOTDOT_PANEL_ID = "pageActionPanel"; - this.windowWatcher = new WindowWatcher(); - } - - init() { - this.windowWatcher.init(this.loadIntoWindow.bind(this), - this.unloadFromWindow.bind(this), - this.onWindowError.bind(this)); - } - - loadIntoWindow(win) { - this.addListeners(win); - } - - unloadFromWindow(win) { - this.removeListeners(win); - } - - onWindowError(msg) { - log.error(msg); - } - - addListeners(win) { - const doc = win.document; - const navToolbox = doc.getElementById(this.NAVIGATOR_TOOLBOX_ID); - const overflowPanel = doc.getElementById(this.OVERFLOW_PANEL_ID); - const hamburgerPanel = doc.getElementById(this.HAMBURGER_PANEL_ID); - const dotdotdotPanel = doc.getElementById(this.DOTDOTDOT_PANEL_ID); - - /* - * the library menu "ViewShowing" event bubbles up on the navToolbox in its - * default location. A separate listener is needed if it is moved to the - * overflow panel via Hamburger > Customize - */ - navToolbox.addEventListener("ViewShowing", this); - overflowPanel.addEventListener("ViewShowing", this); - hamburgerPanel.addEventListener("popupshown", this); - dotdotdotPanel.addEventListener("popupshown", this); - } - - handleEvent(evt) { - switch (evt.type) { - case "ViewShowing": - if (evt.target.id === this.LIBRARY_PANELVIEW_ID) { - log.debug("Library panel opened."); - this.recordEvent("library_menu"); - } - break; - case "popupshown": - switch (evt.target.id) { - case this.HAMBURGER_PANEL_ID: - log.debug("Hamburger panel opened."); - this.recordEvent("hamburger_menu"); - break; - case this.DOTDOTDOT_PANEL_ID: - log.debug("Dotdotdot panel opened."); - this.recordEvent("dotdotdot_menu"); - break; - default: - break; - } - break; - } - } - - recordEvent(method) { - Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, method, "open", null, - { subcategory: "menu" }); - } - - removeListeners(win) { - const doc = win.document; - const navToolbox = doc.getElementById(this.NAVIGATOR_TOOLBOX_ID); - const overflowPanel = doc.getElementById(this.OVERFLOW_PANEL_ID); - const hamburgerPanel = doc.getElementById(this.HAMBURGER_PANEL_ID); - const dotdotdotPanel = doc.getElementById(this.DOTDOTDOT_PANEL_ID); - - try { - navToolbox.removeEventListener("ViewShowing", this); - overflowPanel.removeEventListener("ViewShowing", this); - hamburgerPanel.removeEventListener("popupshown", this); - dotdotdotPanel.removeEventListener("popupshown", this); - } catch (err) { - // Firefox is shutting down; elements have already been removed. - } - } - - uninit() { - if (SavantShieldStudy.shouldRemoveListeners) { - this.windowWatcher.uninit(); - } - } -} - -/* -* The WindowWatcher is used to add/remove listeners from MenuListener -* to/from all windows. -*/ -class WindowWatcher { - constructor() { - this._isActive = false; - this._loadCallback = null; - this._unloadCallback = null; - this._errorCallback = null; - } - - // It is expected that loadCallback, unloadCallback, and errorCallback are bound - // to a `this` value. - init(loadCallback, unloadCallback, errorCallback) { - if (this._isActive) { - errorCallback("Called init, but WindowWatcher was already running"); - return; - } - - this._isActive = true; - this._loadCallback = loadCallback; - this._unloadCallback = unloadCallback; - this._errorCallback = errorCallback; - - // Add loadCallback to existing windows - for (const win of Services.wm.getEnumerator("navigator:browser")) { - try { - this._loadCallback(win); - } catch (ex) { - this._errorCallback(`WindowWatcher code loading callback failed: ${ ex }`); - } - } - - // Add loadCallback to future windows - // This will call the observe method on WindowWatcher - Services.ww.registerNotification(this); - } - - uninit() { - if (!this._isActive) { - this._errorCallback("Called uninit, but WindowWatcher was already uninited"); - return; - } - - for (const win of Services.wm.getEnumerator("navigator:browser")) { - try { - this._unloadCallback(win); - } catch (ex) { - this._errorCallback(`WindowWatcher code unloading callback failed: ${ ex }`); - } - } - - Services.ww.unregisterNotification(this); - - this._loadCallback = null; - this._unloadCallback = null; - this._errorCallback = null; - this._isActive = false; - } - - observe(win, topic) { - switch (topic) { - case "domwindowopened": - this._onWindowOpened(win); - break; - case "domwindowclosed": - this._onWindowClosed(win); - break; - default: - break; - } - } - - _onWindowOpened(win) { - win.addEventListener("load", this, { once: true }); - } - - // only one event type expected: "load" - handleEvent(evt) { - const win = evt.target.ownerGlobal; - - // make sure we only add window listeners to a DOMWindow (browser.xul) - const winType = win.document.documentElement.getAttribute("windowtype"); - if (winType === "navigator:browser") { - this._loadCallback(win); - } - } - - _onWindowClosed(win) { - this._unloadCallback(win); - } -} - -const SavantShieldStudy = new SavantShieldStudyClass(); diff --git a/browser/modules/moz.build b/browser/modules/moz.build index b7ffc0476c2c..46b68887419e 100644 --- a/browser/modules/moz.build +++ b/browser/modules/moz.build @@ -138,7 +138,6 @@ EXTRA_JS_MODULES += [ 'ReaderParent.jsm', 'RemotePrompt.jsm', 'Sanitizer.jsm', - 'SavantShieldStudy.jsm', 'SchedulePressure.jsm', 'SiteDataManager.jsm', 'SitePermissions.jsm', diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm index 43a708edcaed..6d0a80dfcdfb 100644 --- a/toolkit/components/passwordmgr/LoginManagerContent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm @@ -436,14 +436,8 @@ var LoginManagerContent = { _fetchLoginsFromParentAndFillForm(form, window) { this._detectInsecureFormLikes(window); - const isPrivateWindow = PrivateBrowsingUtils.isContentWindowPrivate(window); - let messageManager = window.docShell.messageManager; - messageManager.sendAsyncMessage("LoginStats:LoginEncountered", - { - isPrivateWindow, - isPwmgrEnabled: gEnabled, - }); + messageManager.sendAsyncMessage("LoginStats:LoginEncountered"); if (!gEnabled) { return; diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm index be231cab01b7..1f7ad30eae0d 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm @@ -94,13 +94,6 @@ var LoginManagerParent = { data.oldPasswordField, msg.objects.openerTopWindow, msg.target); - - const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel; - Services.telemetry.recordEvent("savant", "login_form", "submit", null, - { - subcategory: "encounter", - flow_id, - }); break; } @@ -119,28 +112,6 @@ var LoginManagerParent = { AutoCompletePopup.removeLogin(login); break; } - - case "LoginStats:LoginFillSuccessful": { - const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel; - Services.telemetry.recordEvent("savant", "pwmgr_use", "use", null, - { - subcategory: "feature", - flow_id, - }); - break; - } - - case "LoginStats:LoginEncountered": { - const canRecordSubmit = (!data.isPrivateWindow && data.isPwmgrEnabled).toString(); - const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel; - Services.telemetry.recordEvent("savant", "login_form", "load", null, - { - subcategory: "encounter", - flow_id, - canRecordSubmit, - }); - break; - } } return undefined; diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js index d3b14934f430..d19046e7c9a3 100644 --- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js +++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js @@ -823,14 +823,6 @@ LoginManagerPrompter.prototype = { histogram.add(PROMPT_DISPLAYED); Services.obs.notifyObservers(null, "weave:telemetry:histogram", histogramName); - const promptType = type == "password-save" ? "save" : "update"; - const flow_id = browser.ownerGlobal.gBrowser.getTabForBrowser(browser).linkedPanel; - Services.telemetry.recordEvent("savant", "pwmgr", "ask", promptType, - { - subcategory: "prompt", - flow_id, - }); - let chromeDoc = browser.ownerDocument; let currentNotification; @@ -958,20 +950,8 @@ LoginManagerPrompter.prototype = { accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey), callback: () => { histogram.add(PROMPT_ADD_OR_UPDATE); - const flow_id = browser.ownerGlobal.gBrowser.getTabForBrowser(browser).linkedPanel; if (histogramName == "PWMGR_PROMPT_REMEMBER_ACTION") { Services.obs.notifyObservers(null, "LoginStats:NewSavedPassword"); - Services.telemetry.recordEvent("savant", "pwmgr", "save", null, - { - subcategory: "prompt", - flow_id, - }); - } else if (histogramName == "PWMGR_PROMPT_UPDATE_ACTION") { - Services.telemetry.recordEvent("savant", "pwmgr", "update", null, - { - subcategory: "prompt", - flow_id, - }); } readDataFromUI(); persistData(); diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index b8cce759bc74..a81e031e9c17 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -98,9 +98,6 @@ var ReaderMode = { * if not, append the about:reader page in the history instead. */ enterReaderMode(docShell, win) { - Services.telemetry.recordEvent("savant", "readermode", "on", null, - { subcategory: "feature" }); - let url = win.document.location.href; let readerURL = "about:reader?url=" + encodeURIComponent(url); let webNav = docShell.QueryInterface(Ci.nsIWebNavigation); @@ -122,8 +119,6 @@ var ReaderMode = { * if not, append the original page in the history instead. */ leaveReaderMode(docShell, win) { - Services.telemetry.recordEvent("savant", "readermode", "off", null, - { subcategory: "feature" }); let url = win.document.location.href; let originalURL = this.getOriginalUrl(url); let webNav = docShell.QueryInterface(Ci.nsIWebNavigation); diff --git a/toolkit/components/telemetry/Events.yaml b/toolkit/components/telemetry/Events.yaml index b85499fa5967..1aaf6146e3b8 100644 --- a/toolkit/components/telemetry/Events.yaml +++ b/toolkit/components/telemetry/Events.yaml @@ -113,206 +113,6 @@ navigation: extra_keys: engine: The id of the search engine used. -# This category contains event entries used for the Savant Shield study. -savant: - # Mostly a dupe of "search" event from "navigation" category to ensure only Savant - # code enables/disables it. - search: - objects: ["about_home", "about_newtab", "contextmenu", "oneoff", - "suggestion", "alias", "enter", "searchbar", "urlbar"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded on each search navigation. - The value field records the action used to trigger the search: - "enter", "oneoff", "suggestion", "alias", null (for contextmenu) - bug_numbers: [1316281, 1457226, 1462725] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - engine: The id of the search engine used. - end_study: - objects: ["ineligible", "study_disable", "expired"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time a study ending condition occurs for the Savant - Shield study. The object field records the reason that caused the ending. - bug_numbers: [1457226, 1462725] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - readermode: - objects: ["on", "off"] - release_channel_collection: opt-out - record_in_processes: ["content"] - description: > - This is recorded any time Reader Mode is turned on or off. - bug_numbers: [1457226, 1465698] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - addon: - objects: ["install_start", "install_finish", "remove_start", "remove_finish", - "enable", "disable" ] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time an addon event as listed in the objects field fires. - The value field records the addon ID for the event. - bug_numbers: [1457226, 1465707] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - bookmark: - objects: ["save", "remove"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time a bookmark is saved or removed. - bug_numbers: [1457226, 1465703] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - follow_bookmark: - objects: ["open"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time a bookmark is visited. - bug_numbers: [1457226, 1465703] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - follow_urlbar_link: - objects: ["bookmark", "history"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded when the user selects a urlbar bookmark or history result. - bug_numbers: [1457226, 1465704] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - library_menu: - objects: ["open"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time the library menu is opened. - bug_numbers: [1457226, 1465697] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - hamburger_menu: - objects: ["open"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time the hamburger menu is opened. - bug_numbers: [1457226, 1465697] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - dotdotdot_menu: - objects: ["open"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time the dotdotdot (aka pageAction) menu is opened. - bug_numbers: [1457226, 1465697] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - pwmgr_use: - objects: ["use"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - Client uses saved login information from the Password Manager - bug_numbers: [1457226, 1465685] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - flow_id: A tab identifier to associate events occuring in the same tab - pwmgr: - objects: ["ask", "save", "update"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - Password Manager asks the user to save or update login information. - For ask prompts, the value field indicate a save versus update ask. - bug_numbers: [1457226, 1465685] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - flow_id: A tab identifier to associate events occuring in the same tab - login_form: - objects: ["load", "submit"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - A login form has been loaded or submitted. Login form submit events only - fire in non-private windows with Password Manager enabled. - bug_numbers: [1457226, 1465685] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - flow_id: A tab identifier to associate events occuring in the same tab - canRecordSubmit: True if a login form loads in a non-private window with Password Manager enabled. - tab: - objects: ["open", "close", "select"] - release_channel_collection: opt-out - record_in_processes: ["main"] - description: > - This is recorded any time a tab is opened, closed or selected. - bug_numbers: [1457226, 1465694] - notification_emails: - - "bdanforth@mozilla.com" - - "shong@mozilla.com" - expiry_version: "65" - extra_keys: - subcategory: The broad event category for this probe. E.g. navigation - # This category contains event entries used for Telemetry tests. # They will not be sent out with any pings. telemetry.test: From 5a5b1a138e90b195bb1535deca79d0cf1d2869a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 27 Aug 2018 19:23:34 +0000 Subject: [PATCH 23/64] Bug 1459065 - Clip filter effects at the stacking context level. r=mstange Much like mask images. This is the easy fix, for now. We need to override the ASR clips with Nothing() because we don't really want children of this display item to get the parent filter applied. It's not only redundant, but also may be incorrect if the mask image is not opaque for example (maybe WR should prevent that?). This was caught by layout/reftests/w3c-css/submitted/masking/mask-opacity-1a.html Differential Revision: https://phabricator.services.mozilla.com/D4351 --HG-- extra : moz-landing-system : lando --- layout/painting/nsDisplayList.cpp | 42 +++++++++++++++--- .../svg/filters/css-filters/reftest.list | 4 +- testing/web-platform/meta/MANIFEST.json | 43 ++++++++++++++++++- .../blur-clip-stacking-context-001.html | 35 +++++++++++++++ .../blur-clip-stacking-context-002.html | 28 ++++++++++++ .../blur-clip-stacking-context-ref.html | 14 ++++++ 6 files changed, 158 insertions(+), 8 deletions(-) create mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html create mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html create mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 3c902a103e25..3795f9af882c 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -9421,8 +9421,8 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder { bool snap; float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect displayBound = GetBounds(aDisplayListBuilder, &snap); - LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBound, appUnitsPerDevPixel); + nsRect displayBounds = GetBounds(aDisplayListBuilder, &snap); + LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBounds, appUnitsPerDevPixel); Maybe mask = aManager->CommandBuilder().BuildWrMaskImage(this, aBuilder, aResources, aSc, aDisplayListBuilder, @@ -9455,7 +9455,9 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder /*aTransformForScrollData: */ Nothing(), /*aClipNodeId: */ &clipId); sc = layer.ptr(); - aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Some(clipId)); + // The whole stacking context will be clipped by us, so no need to have any + // parent for the children context's clip. + aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Nothing()); } nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aResources, *sc, aManager, aDisplayListBuilder); @@ -9735,11 +9737,41 @@ nsDisplayFilter::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild } } + bool snap; + float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + nsRect displayBounds = GetBounds(aDisplayListBuilder, &snap); + auto bounds = LayoutDeviceRect::FromAppUnits(displayBounds, auPerDevPixel); + // NOTE(emilio): this clip is going to be intersected with the clip that's + // currently on the clip stack for this item. + // + // FIXME(emilio, bug 1486557): clipping to "bounds" isn't really necessary. + wr::WrClipId clipId = + aBuilder.DefineClip(Nothing(), wr::ToRoundedLayoutRect(bounds)); + float opacity = mFrame->StyleEffects()->mOpacity; - StackingContextHelper sc(aSc, aBuilder, wrFilters, LayoutDeviceRect(), nullptr, - nullptr, opacity != 1.0f && mHandleOpacity ? &opacity : nullptr); + StackingContextHelper sc( + aSc, + aBuilder, + wrFilters, + LayoutDeviceRect(), + nullptr, + nullptr, + opacity != 1.0f && mHandleOpacity ? &opacity : nullptr, + nullptr, + nullptr, + gfx::CompositionOp::OP_OVER, + true, + false, + Nothing(), + &clipId); + + // The whole stacking context will be clipped by us, so no need to have any + // parent for the children context's clip. + aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Nothing()); nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aResources, sc, aManager, aDisplayListBuilder); + + aManager->CommandBuilder().PopOverrideForASR(GetActiveScrolledRoot()); return true; } diff --git a/layout/reftests/svg/filters/css-filters/reftest.list b/layout/reftests/svg/filters/css-filters/reftest.list index ec8b9668c090..a598cef0a577 100644 --- a/layout/reftests/svg/filters/css-filters/reftest.list +++ b/layout/reftests/svg/filters/css-filters/reftest.list @@ -7,12 +7,12 @@ fuzzy-if(webrender,9-9,4780-4784) == blur.html blur-ref.html == blur.svg blur-ref.svg == blur-calc.html blur-calc-ref.html == blur-calc-negative.html blur-calc-negative-ref.html -skip-if(d2d) == blur-cap-large-radius-on-software.html blur-cap-large-radius-on-software-ref.html +fuzzy-if(webrender,3-3,55913-55913) skip-if(d2d) == blur-cap-large-radius-on-software.html blur-cap-large-radius-on-software-ref.html fuzzy-if(webrender,9-9,4780-4784) == blur-em-radius.html blur-em-radius-ref.html == blur-invalid-radius.html blur-invalid-radius-ref.html fuzzy-if(webrender,9-9,4780-4784) == blur-rem-radius.html blur-rem-radius-ref.html == blur-zero-radius.html blur-zero-radius-ref.html -fuzzy-if(webrender,6-7,20420-21308) == blur-zoomed-page.html blur-zoomed-page-ref.html +fuzzy-if(webrender,5-7,20420-21308) == blur-zoomed-page.html blur-zoomed-page-ref.html == brightness.html brightness-ref.html == brightness-darken.html brightness-darken-ref.html == brightness-extreme.html brightness-extreme-ref.html diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index ea0cbe189434..75cda1591a4f 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -112915,6 +112915,30 @@ {} ] ], + "css/css-filter/blur-clip-stacking-context-001.html": [ + [ + "/css/css-filter/blur-clip-stacking-context-001.html", + [ + [ + "/css/css-filter/blur-clip-stacking-context-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-filter/blur-clip-stacking-context-002.html": [ + [ + "/css/css-filter/blur-clip-stacking-context-002.html", + [ + [ + "/css/css-filter/blur-clip-stacking-context-ref.html", + "!=" + ] + ], + {} + ] + ], "css/css-filter/filtered-block-is-container.html": [ [ "/css/css-filter/filtered-block-is-container.html", @@ -244073,6 +244097,11 @@ {} ] ], + "css/css-filter/blur-clip-stacking-context-ref.html": [ + [ + {} + ] + ], "css/css-filter/filtered-block-is-container-ref.html": [ [ {} @@ -521837,7 +521866,7 @@ "reftest" ], "css/css-display/display-contents-fieldset-nested-legend-ref.html": [ - "6f547b3201c3b3c2521102ecbcf144df28447f7a", + "c4afe0e53ba02d47bc0704eb71801aec602759be", "support" ], "css/css-display/display-contents-fieldset-nested-legend.html": [ @@ -523144,6 +523173,18 @@ "8d0683319b0fbbd1262cbdd12cdbcb727b2aa9a0", "support" ], + "css/css-filter/blur-clip-stacking-context-001.html": [ + "48c1bae3042b6912ba5edd7ae74c190e5bd8f2d2", + "reftest" + ], + "css/css-filter/blur-clip-stacking-context-002.html": [ + "f4df453b17b86a6da67c4cf5f71261e9315eab95", + "reftest" + ], + "css/css-filter/blur-clip-stacking-context-ref.html": [ + "82b907334fd71791cd2f6530e2e85169e29afa41", + "support" + ], "css/css-filter/filtered-block-is-container-ref.html": [ "fc9467f8717dfc722dcb6dbbbb31bfd8c2baee3b", "support" diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html new file mode 100644 index 000000000000..a96994a8afe1 --- /dev/null +++ b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html @@ -0,0 +1,35 @@ + +CSS Test: Blurs are correctly clipped by an overflow: hidden ancestor + + + + + + +

+
diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html new file mode 100644 index 000000000000..0473f1294944 --- /dev/null +++ b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html @@ -0,0 +1,28 @@ + +CSS Test: Blurs on an overflow: hidden element are correctly not-clipped to the padding box + + + + + + +
+
diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html new file mode 100644 index 000000000000..82b907334fd7 --- /dev/null +++ b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html @@ -0,0 +1,14 @@ + +CSS Test Reference + + +
From 7f86cca5eab79c5faed7459433ff9409db74e3e5 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Mon, 27 Aug 2018 14:50:35 +0000 Subject: [PATCH 24/64] Bug 1485017 - Make sidebar properties apply to synced tabs sidebar. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D4284 --HG-- extra : moz-landing-system : lando --- browser/components/syncedtabs/sidebar.js | 11 +++++++++ browser/components/syncedtabs/sidebar.xhtml | 1 + browser/themes/osx/syncedtabs/sidebar.css | 2 +- .../themes/shared/syncedtabs/sidebar.inc.css | 24 ++++++++++++++++++- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/browser/components/syncedtabs/sidebar.js b/browser/components/syncedtabs/sidebar.js index bec9a4f1a5dc..32ec08c98ff8 100644 --- a/browser/components/syncedtabs/sidebar.js +++ b/browser/components/syncedtabs/sidebar.js @@ -7,18 +7,29 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.import("resource://services-sync/SyncedTabs.jsm"); ChromeUtils.import("resource:///modules/syncedtabs/SyncedTabsDeckComponent.js"); +ChromeUtils.import("resource:///actors/LightweightThemeChild.jsm"); ChromeUtils.defineModuleGetter(this, "fxAccounts", "resource://gre/modules/FxAccounts.jsm"); var syncedTabsDeckComponent = new SyncedTabsDeckComponent({window, SyncedTabs, fxAccounts}); +let themeListener; + let onLoaded = () => { + themeListener = new LightweightThemeChild({ + content: window, + chromeOuterWindowID: window.top.windowUtils.outerWindowID, + docShell: window.docShell, + }); syncedTabsDeckComponent.init(); document.getElementById("template-container").appendChild(syncedTabsDeckComponent.container); }; let onUnloaded = () => { + if (themeListener) { + themeListener.cleanup(); + } removeEventListener("DOMContentLoaded", onLoaded); removeEventListener("unload", onUnloaded); syncedTabsDeckComponent.uninit(); diff --git a/browser/components/syncedtabs/sidebar.xhtml b/browser/components/syncedtabs/sidebar.xhtml index ef000cb46b93..a1198888fcea 100644 --- a/browser/components/syncedtabs/sidebar.xhtml +++ b/browser/components/syncedtabs/sidebar.xhtml @@ -19,6 +19,7 @@ diff --git a/browser/themes/osx/syncedtabs/sidebar.css b/browser/themes/osx/syncedtabs/sidebar.css index a2b84831e347..f6f96bff03c4 100644 --- a/browser/themes/osx/syncedtabs/sidebar.css +++ b/browser/themes/osx/syncedtabs/sidebar.css @@ -6,7 +6,7 @@ /* These styles are intended to mimic XUL trees and the XUL search box. */ -.content-container { +body:not([lwt-sidebar]) .content-container { -moz-appearance: -moz-mac-source-list; -moz-font-smoothing-background-color: -moz-mac-source-list; } diff --git a/browser/themes/shared/syncedtabs/sidebar.inc.css b/browser/themes/shared/syncedtabs/sidebar.inc.css index 18d8bb90cab2..942e7727c6ad 100644 --- a/browser/themes/shared/syncedtabs/sidebar.inc.css +++ b/browser/themes/shared/syncedtabs/sidebar.inc.css @@ -69,7 +69,6 @@ body { white-space: nowrap; overflow: hidden; outline: none; - color: -moz-FieldText; } .item.selected > .item-title-container { @@ -296,3 +295,26 @@ body { .filtered .textbox-search-icons .textbox-search-clear { display: block; } + +/* Themed sidebars */ + +body[lwt-sidebar] { + background-color: var(--lwt-sidebar-background-color); + color: var(--lwt-sidebar-text-color); +} + +body[lwt-sidebar] .item.selected > .item-title-container { + background-color: hsla(0,0%,80%,.3); + color: inherit; +} + +body[lwt-sidebar-brighttext] .item.selected > .item-title-container { + -moz-appearance: none; + background-color: rgba(249,249,250,.1); +} + +body[lwt-sidebar-highlight] .item.selected:focus > .item-title-container { + -moz-appearance: none; + background-color: var(--lwt-sidebar-highlight-background-color); + color: var(--lwt-sidebar-highlight-text-color); +} From ec82b55b393206266493fef64a1bcf7f9f7a986c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 27 Aug 2018 16:03:30 +0000 Subject: [PATCH 25/64] bug 1486137 - TRR: fix the FAMILY field in the ECS code r=mcmanus ... since AF_INET wouldn't actually use IPv4! MozReview-Commit-ID: FCf7psawENI Differential Revision: https://phabricator.services.mozilla.com/D4328 --HG-- extra : moz-landing-system : lando --- netwerk/dns/TRR.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netwerk/dns/TRR.cpp b/netwerk/dns/TRR.cpp index c7ea17b42402..14ef5a28dca4 100644 --- a/netwerk/dns/TRR.cpp +++ b/netwerk/dns/TRR.cpp @@ -139,8 +139,9 @@ TRR::DohEncode(nsCString &aBody, bool aDisableECS) aBody += '\0'; // upper 8 bit OPTION-LENGTH aBody += 4; // OPTION-LENGTH, 2 octets, contains the length of the payload // after OPTION-LENGTH - aBody += '\0'; // upper 8 bit FAMILY - aBody += AF_INET; // FAMILY, 2 octets + aBody += '\0'; // upper 8 bit FAMILY. IANA Address Family Numbers registry, not the + // AF_* constants! + aBody += 1; // FAMILY (Ipv4), 2 octets aBody += '\0'; // SOURCE PREFIX-LENGTH | SCOPE PREFIX-LENGTH | aBody += '\0'; From bd5c20d12e5220e75527a495e86dc47fa0477788 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 27 Aug 2018 19:20:53 +0000 Subject: [PATCH 26/64] Bug 1486480. Add memory reporting for custom element data. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D4350 --HG-- extra : moz-landing-system : lando --- dom/base/CustomElementRegistry.cpp | 58 +++++++++++++++++++++++++++++ dom/base/CustomElementRegistry.h | 5 +++ dom/base/FragmentOrElement.cpp | 60 +++++++++++++++++++++++++++++- dom/base/FragmentOrElement.h | 2 + dom/base/nsIContent.h | 2 + 5 files changed, 126 insertions(+), 1 deletion(-) diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 781ca153c625..2aea3faf6c72 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -42,6 +42,13 @@ public: aCb.NoteNativeChild(mDefinition, NS_CYCLE_COLLECTION_PARTICIPANT(CustomElementDefinition)); } + + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override + { + // We don't really own mDefinition. + return aMallocSizeOf(this); + } + private: virtual void Invoke(Element* aElement, ErrorResult& aRv) override { @@ -67,6 +74,15 @@ class CustomElementCallbackReaction final : public CustomElementReaction mCustomElementCallback->Traverse(aCb); } + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override + { + size_t n = aMallocSizeOf(this); + + n += mCustomElementCallback->SizeOfIncludingThis(aMallocSizeOf); + + return n; + } + private: virtual void Invoke(Element* aElement, ErrorResult& aRv) override { @@ -79,6 +95,16 @@ class CustomElementCallbackReaction final : public CustomElementReaction //----------------------------------------------------- // CustomElementCallback +size_t +LifecycleCallbackArgs::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const +{ + size_t n = name.SizeOfExcludingThisIfUnshared(aMallocSizeOf); + n += oldValue.SizeOfExcludingThisIfUnshared(aMallocSizeOf); + n += newValue.SizeOfExcludingThisIfUnshared(aMallocSizeOf); + n += namespaceURI.SizeOfExcludingThisIfUnshared(aMallocSizeOf); + return n; +} + void CustomElementCallback::Call() { @@ -113,6 +139,24 @@ CustomElementCallback::Traverse(nsCycleCollectionTraversalCallback& aCb) const aCb.NoteXPCOMChild(mCallback); } +size_t +CustomElementCallback::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const +{ + size_t n = aMallocSizeOf(this); + + // We don't uniquely own mThisObject. + + // We own mCallback but it doesn't have any special memory reporting we can do + // for it other than report its own size. + n += aMallocSizeOf(mCallback); + + n += mArgs.SizeOfExcludingThis(aMallocSizeOf); + + // mAdoptedCallbackArgs doesn't really uniquely own its members. + + return n; +} + CustomElementCallback::CustomElementCallback(Element* aThisObject, nsIDocument::ElementCallbackType aCallbackType, mozilla::dom::CallbackFunction* aCallback) @@ -214,6 +258,20 @@ CustomElementData::Unlink() mCustomElementDefinition = nullptr; } +size_t +CustomElementData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const +{ + size_t n = aMallocSizeOf(this); + + n += mReactionQueue.ShallowSizeOfExcludingThis(aMallocSizeOf); + + for (auto& reaction : mReactionQueue) { + n += reaction->SizeOfIncludingThis(aMallocSizeOf); + } + + return n; +} + //----------------------------------------------------- // CustomElementRegistry diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 2886ae5a63dd..3193af22f33a 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -41,6 +41,8 @@ struct LifecycleCallbackArgs nsString oldValue; nsString newValue; nsString namespaceURI; + + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const; }; struct LifecycleAdoptedCallbackArgs @@ -56,6 +58,7 @@ public: nsIDocument::ElementCallbackType aCallbackType, CallbackFunction* aCallback); void Traverse(nsCycleCollectionTraversalCallback& aCb) const; + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; void Call(); void SetArgs(LifecycleCallbackArgs& aArgs) { @@ -130,6 +133,7 @@ struct CustomElementData void Traverse(nsCycleCollectionTraversalCallback& aCb) const; void Unlink(); + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; nsAtom* GetIs(Element* aElement) { @@ -208,6 +212,7 @@ public: virtual ~CustomElementReaction() = default; virtual void Invoke(Element* aElement, ErrorResult& aRv) = 0; virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const = 0; + virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const = 0; bool IsUpgradeReaction() { diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index b0d97b44ed43..4e8e68f8084d 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -674,6 +674,14 @@ nsIContent::nsExtendedContentSlots::nsExtendedContentSlots() nsIContent::nsExtendedContentSlots::~nsExtendedContentSlots() = default; +size_t +nsIContent::nsExtendedContentSlots::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const +{ + // For now, nothing to measure here. We don't actually own any of our + // members. + return 0; +} + FragmentOrElement::nsDOMSlots::nsDOMSlots() : nsIContent::nsContentSlots(), mDataset(nullptr) @@ -725,8 +733,15 @@ size_t FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); + + nsExtendedContentSlots* extendedSlots = GetExtendedContentSlots(); if (OwnsExtendedSlots()) { - n += aMallocSizeOf(GetExtendedContentSlots()); + MOZ_ASSERT(extendedSlots); + n += aMallocSizeOf(extendedSlots); + } + + if (extendedSlots) { + n += extendedSlots->SizeOfExcludingThis(aMallocSizeOf); } if (mAttributeMap) { @@ -800,6 +815,49 @@ FragmentOrElement::nsExtendedDOMSlots::TraverseExtendedSlots(nsCycleCollectionTr } } +size_t +FragmentOrElement::nsExtendedDOMSlots::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const +{ + size_t n = nsIContent::nsExtendedContentSlots::SizeOfExcludingThis(aMallocSizeOf); + + // We own mSMILOverrideStyle but there seems to be no memory reporting on CSS + // declarations? At least report the memory the declaration takes up + // directly. + if (mSMILOverrideStyle) { + n += aMallocSizeOf(mSMILOverrideStyle); + } + + // We don't really own mSMILOverrideStyleDeclaration. mSMILOverrideStyle owns + // it. + + // We don't seem to have memory reporting for nsXULControllers. At least + // report the memory it's using directly. + if (mControllers) { + n += aMallocSizeOf(mControllers); + } + + // We don't seem to have memory reporting for nsLabelsNodeList. At least + // report the memory it's using directly. + if (mLabelsList) { + n += aMallocSizeOf(mLabelsList); + } + + // mShadowRoot should be handled during normal DOM tree memory reporting, just + // like kids, siblings, etc. + + // We don't seem to have memory reporting for nsXBLBinding. At least + // report the memory it's using directly. + if (mXBLBinding) { + n += aMallocSizeOf(mXBLBinding); + } + + if (mCustomElementData) { + n += mCustomElementData->SizeOfIncludingThis(aMallocSizeOf); + } + + return n; +} + FragmentOrElement::FragmentOrElement(already_AddRefed& aNodeInfo) : nsIContent(aNodeInfo) { diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index f38530aaccda..84d402ba319e 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -174,6 +174,8 @@ public: void TraverseExtendedSlots(nsCycleCollectionTraversalCallback&) final; void UnlinkExtendedSlots() final; + size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const final; + /** * SMIL Overridde style rules (for SMIL animation of CSS properties) * @see Element::GetSMILOverrideStyle diff --git a/dom/base/nsIContent.h b/dom/base/nsIContent.h index 419502c75181..65a423a38dd5 100644 --- a/dom/base/nsIContent.h +++ b/dom/base/nsIContent.h @@ -797,6 +797,8 @@ protected: virtual void TraverseExtendedSlots(nsCycleCollectionTraversalCallback&); virtual void UnlinkExtendedSlots(); + virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; + /** * The nearest enclosing content node with a binding that created us. * TODO(emilio): This should be an Element*. From 5c127a69e4e7bb0aa6a48f703e4c1aff03dbcee4 Mon Sep 17 00:00:00 2001 From: Adam Gashlin Date: Mon, 27 Aug 2018 18:42:28 +0000 Subject: [PATCH 27/64] Bug 1486423: Remove expiring telemetry.os_shutting_down probe r=chutten Differential Revision: https://phabricator.services.mozilla.com/D4357 --HG-- extra : moz-landing-system : lando --- toolkit/components/telemetry/Scalars.yaml | 15 --------------- toolkit/components/telemetry/TelemetrySend.jsm | 1 - .../telemetry/tests/unit/test_TelemetrySession.js | 6 ------ 3 files changed, 22 deletions(-) diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 1ef7817908c6..cf1aa0540f98 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -1564,21 +1564,6 @@ telemetry: record_in_processes: - 'main' - os_shutting_down: - bug_numbers: - - 1480826 - description: > - Records true if there is a signal that Firefox was quitting because - the OS was shutting down. Only available on Windows. - expires: "64" - kind: boolean - notification_emails: - - telemetry-client-dev@mozilla.com - - agashlin@mozilla.com - release_channel_collection: opt-out - record_in_processes: - - 'main' - telemetry.discarded: accumulations: bug_numbers: diff --git a/toolkit/components/telemetry/TelemetrySend.jsm b/toolkit/components/telemetry/TelemetrySend.jsm index da748002641a..dfa392035b11 100644 --- a/toolkit/components/telemetry/TelemetrySend.jsm +++ b/toolkit/components/telemetry/TelemetrySend.jsm @@ -800,7 +800,6 @@ var TelemetrySendImpl = { let setOSShutdown = () => { this._log.trace("setOSShutdown - in OS shutdown"); this._isOSShutdown = true; - Telemetry.scalarSet("telemetry.os_shutting_down", true); }; switch (topic) { diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js index e9e45dee65fb..7ffac74976b5 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js @@ -1032,8 +1032,6 @@ add_task(async function test_sendShutdownPing() { return; } - const OSSHUTDOWN_SCALAR = "telemetry.os_shutting_down"; - let checkPendingShutdownPing = async function() { let pendingPings = await TelemetryStorage.loadPendingPingList(); Assert.equal(pendingPings.length, 1, @@ -1043,8 +1041,6 @@ add_task(async function test_sendShutdownPing() { Assert.ok(shutdownPing, "The 'shutdown' ping must be saved to disk."); Assert.equal("shutdown", shutdownPing.payload.info.reason, "The 'shutdown' ping must be saved to disk."); - Assert.ok(shutdownPing.payload.processes.parent.scalars[OSSHUTDOWN_SCALAR], - "The OS shutdown scalar must be set to true."); }; Preferences.set(TelemetryUtils.Preferences.ShutdownPingSender, true); @@ -1063,8 +1059,6 @@ add_task(async function test_sendShutdownPing() { checkPingFormat(ping, ping.type, true, true); Assert.equal(ping.payload.info.reason, REASON_SHUTDOWN); Assert.equal(ping.clientId, gClientID); - Assert.ok(!(OSSHUTDOWN_SCALAR in ping.payload.processes.parent.scalars), - "The OS shutdown scalar must not be set."); // Try again, this time disable ping upload. The PingSender // should not be sending any ping! PingServer.registerPingHandler(() => Assert.ok(false, "Telemetry must not send pings if not allowed to.")); From 2c847c1eb9c73371eb6281cf3cb518529cf10fdc Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 27 Aug 2018 18:38:58 +0000 Subject: [PATCH 28/64] Bug 1485495 - Move column-span preference to StaticPrefList.h. r=dholbert We can access the bool pref in C++ by writing if (StaticPrefs::layout_css_column_span_enabled()) { // do something } Differential Revision: https://phabricator.services.mozilla.com/D4020 --HG-- extra : moz-landing-system : lando --- modules/libpref/init/StaticPrefList.h | 7 +++++++ modules/libpref/init/all.js | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/libpref/init/StaticPrefList.h b/modules/libpref/init/StaticPrefList.h index 9f3bc1d74a02..6201ff7bd6f8 100644 --- a/modules/libpref/init/StaticPrefList.h +++ b/modules/libpref/init/StaticPrefList.h @@ -448,6 +448,13 @@ VARCACHE_PREF( bool, false ) +// Is support for CSS column-span enabled? +VARCACHE_PREF( + "layout.css.column-span.enabled", + layout_css_column_span_enabled, + bool, false +) + //--------------------------------------------------------------------------- // JavaScript prefs //--------------------------------------------------------------------------- diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index cb3154df3749..7fc2a5ea9d59 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3065,9 +3065,6 @@ pref("layout.css.shape-outside.enabled", true); // Is support for document.fonts enabled? pref("layout.css.font-loading-api.enabled", true); -// Is support for column-span enabled? -pref("layout.css.column-span.enabled", false); - // Are inter-character ruby annotations enabled? pref("layout.css.ruby.intercharacter.enabled", false); From 4a1bf6f650e0299ccab70820b39d5a277053dda8 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Mon, 27 Aug 2018 18:14:49 +0000 Subject: [PATCH 29/64] Bug 1485433 - Parse byte slice in PathParser. r=emilio We only care about ascii char for svg path, so we could parse the string as byte slice. Differential Revision: https://phabricator.services.mozilla.com/D4168 --HG-- extra : moz-landing-system : lando --- .../style/values/specified/svg_path.rs | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/servo/components/style/values/specified/svg_path.rs b/servo/components/style/values/specified/svg_path.rs index 8d92e94aee0c..48ae185477df 100644 --- a/servo/components/style/values/specified/svg_path.rs +++ b/servo/components/style/values/specified/svg_path.rs @@ -7,8 +7,8 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; use std::fmt::{self, Write}; -use std::iter::Peekable; -use std::str::Chars; +use std::iter::{Cloned, Peekable}; +use std::slice; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::values::SequenceWriter; use values::CSSFloat; @@ -133,8 +133,8 @@ impl ToCss for PathCommand { { use self::PathCommand::*; match *self { - Unknown => dest.write_str("X"), - ClosePath => dest.write_str("Z"), + Unknown => dest.write_char('X'), + ClosePath => dest.write_char('Z'), MoveTo { point, absolute } => { dest.write_char(if absolute { 'M' } else { 'm' })?; dest.write_char(' ')?; @@ -219,7 +219,7 @@ impl CoordPair { /// SVG Path parser. struct PathParser<'a> { - chars: Peekable>, + chars: Peekable>>, path: Vec, } @@ -256,7 +256,7 @@ impl<'a> PathParser<'a> { #[inline] fn new(string: &'a str) -> Self { PathParser { - chars: string.chars().peekable(), + chars: string.as_bytes().iter().cloned().peekable(), path: Vec::new(), } } @@ -270,13 +270,13 @@ impl<'a> PathParser<'a> { // Handle other commands. loop { skip_wsp(&mut self.chars); - if self.chars.peek().map_or(true, |m| *m == 'M' || *m == 'm') { + if self.chars.peek().map_or(true, |&m| m == b'M' || m == b'm') { break; } match self.chars.next() { Some(command) => { - let abs = command.is_uppercase(); + let abs = command.is_ascii_uppercase(); macro_rules! parse_command { ( $($($p:pat)|+ => $parse_func:ident,)* ) => { match command { @@ -291,15 +291,15 @@ impl<'a> PathParser<'a> { } } parse_command!( - 'Z' | 'z' => parse_closepath, - 'L' | 'l' => parse_lineto, - 'H' | 'h' => parse_h_lineto, - 'V' | 'v' => parse_v_lineto, - 'C' | 'c' => parse_curveto, - 'S' | 's' => parse_smooth_curveto, - 'Q' | 'q' => parse_quadratic_bezier_curveto, - 'T' | 't' => parse_smooth_quadratic_bezier_curveto, - 'A' | 'a' => parse_elliprical_arc, + b'Z' | b'z' => parse_closepath, + b'L' | b'l' => parse_lineto, + b'H' | b'h' => parse_h_lineto, + b'V' | b'v' => parse_v_lineto, + b'C' | b'c' => parse_curveto, + b'S' | b's' => parse_smooth_curveto, + b'Q' | b'q' => parse_quadratic_bezier_curveto, + b'T' | b't' => parse_smooth_quadratic_bezier_curveto, + b'A' | b'a' => parse_elliprical_arc, ); }, _ => break, // no more commands. @@ -311,13 +311,13 @@ impl<'a> PathParser<'a> { /// Parse "moveto" command. fn parse_moveto(&mut self) -> Result<(), ()> { let command = match self.chars.next() { - Some(c) if c == 'M' || c == 'm' => c, + Some(c) if c == b'M' || c == b'm' => c, _ => return Err(()), }; skip_wsp(&mut self.chars); let point = parse_coord(&mut self.chars)?; - let absolute = command == 'M'; + let absolute = command == b'M'; self.path.push(PathCommand::MoveTo { point, absolute } ); // End of string or the next character is a possible new command. @@ -382,13 +382,11 @@ impl<'a> PathParser<'a> { /// Parse elliptical arc curve command. fn parse_elliprical_arc(&mut self, absolute: bool) -> Result<(), ()> { // Parse a flag whose value is '0' or '1'; otherwise, return Err(()). - let parse_flag = |iter: &mut Peekable| -> Result { - let value = match iter.peek() { - Some(c) if *c == '0' || *c == '1' => *c == '1', - _ => return Err(()), - }; - iter.next(); - Ok(value) + let parse_flag = |iter: &mut Peekable>>| -> Result { + match iter.next() { + Some(c) if c == b'0' || c == b'1' => Ok(c == b'1'), + _ => Err(()), + } }; parse_arguments!(self, absolute, EllipticalArc, [ rx => parse_number, @@ -403,7 +401,7 @@ impl<'a> PathParser<'a> { /// Parse a pair of numbers into CoordPair. -fn parse_coord(iter: &mut Peekable) -> Result { +fn parse_coord(iter: &mut Peekable>>) -> Result { let x = parse_number(iter)?; skip_comma_wsp(iter); let y = parse_number(iter)?; @@ -417,28 +415,28 @@ fn parse_coord(iter: &mut Peekable) -> Result { /// input is a Peekable and we only accept an integer of a floating point number. /// /// The "number" syntax in https://www.w3.org/TR/SVG/paths.html#PathDataBNF -fn parse_number(iter: &mut Peekable) -> Result { +fn parse_number(iter: &mut Peekable>>) -> Result { // 1. Check optional sign. - let sign = if iter.peek().map_or(false, |&sign: &char| sign == '+' || sign == '-') { - if iter.next().unwrap() == '-' { -1. } else { 1. } + let sign = if iter.peek().map_or(false, |&sign| sign == b'+' || sign == b'-') { + if iter.next().unwrap() == b'-' { -1. } else { 1. } } else { 1. }; // 2. Check integer part. let mut integral_part: f64 = 0.; - let got_dot = if !iter.peek().map_or(false, |&n: &char| n == '.') { + let got_dot = if !iter.peek().map_or(false, |&n| n == b'.') { // If the first digit in integer part is neither a dot nor a digit, this is not a number. - if iter.peek().map_or(true, |n: &char| !n.is_ascii_digit()) { + if iter.peek().map_or(true, |n| !n.is_ascii_digit()) { return Err(()); } - while iter.peek().map_or(false, |n: &char| n.is_ascii_digit()) { + while iter.peek().map_or(false, |n| n.is_ascii_digit()) { integral_part = - integral_part * 10. + iter.next().unwrap().to_digit(10).unwrap() as f64; + integral_part * 10. + (iter.next().unwrap() - b'0') as f64; } - iter.peek().map_or(false, |&n: &char| n == '.') + iter.peek().map_or(false, |&n| n == b'.') } else { true }; @@ -449,13 +447,13 @@ fn parse_number(iter: &mut Peekable) -> Result { // Consume '.'. iter.next(); // If the first digit in fractional part is not a digit, this is not a number. - if iter.peek().map_or(true, |n: &char| !n.is_ascii_digit()) { + if iter.peek().map_or(true, |n| !n.is_ascii_digit()) { return Err(()); } let mut factor = 0.1; - while iter.peek().map_or(false, |n: &char| n.is_ascii_digit()) { - fractional_part += iter.next().unwrap().to_digit(10).unwrap() as f64 * factor; + while iter.peek().map_or(false, |n| n.is_ascii_digit()) { + fractional_part += (iter.next().unwrap() - b'0') as f64 * factor; factor *= 0.1; } } @@ -464,18 +462,18 @@ fn parse_number(iter: &mut Peekable) -> Result { // 4. Check exp part. The segment name of SVG Path doesn't include 'E' or 'e', so it's ok to // treat the numbers after 'E' or 'e' are in the exponential part. - if iter.peek().map_or(false, |&exp: &char| exp == 'E' || exp == 'e') { + if iter.peek().map_or(false, |&exp| exp == b'E' || exp == b'e') { // Consume 'E' or 'e'. iter.next(); - let exp_sign = if iter.peek().map_or(false, |&sign: &char| sign == '+' || sign == '-') { - if iter.next().unwrap() == '-' { -1. } else { 1. } + let exp_sign = if iter.peek().map_or(false, |&sign| sign == b'+' || sign == b'-') { + if iter.next().unwrap() == b'-' { -1. } else { 1. } } else { 1. }; let mut exp: f64 = 0.; - while iter.peek().map_or(false, |n: &char| n.is_ascii_digit()) { - exp = exp * 10. + iter.next().unwrap().to_digit(10).unwrap() as f64; + while iter.peek().map_or(false, |n| n.is_ascii_digit()) { + exp = exp * 10. + (iter.next().unwrap() - b'0') as f64; } value *= f64::powf(10., exp * exp_sign); @@ -490,12 +488,12 @@ fn parse_number(iter: &mut Peekable) -> Result { /// Skip all svg whitespaces, and return true if |iter| hasn't finished. #[inline] -fn skip_wsp(iter: &mut Peekable) -> bool { +fn skip_wsp(iter: &mut Peekable>>) -> bool { // Note: SVG 1.1 defines the whitespaces as \u{9}, \u{20}, \u{A}, \u{D}. // However, SVG 2 has one extra whitespace: \u{C}. // Therefore, we follow the newest spec for the definition of whitespace, - // i.e. \u{9}, \u{20}, \u{A}, \u{C}, \u{D}, by is_ascii_whitespace(). - while iter.peek().map_or(false, |c: &char| c.is_ascii_whitespace()) { + // i.e. \u{9}, \u{20}, \u{A}, \u{C}, \u{D}. + while iter.peek().map_or(false, |c| c.is_ascii_whitespace()) { iter.next(); } iter.peek().is_some() @@ -503,12 +501,12 @@ fn skip_wsp(iter: &mut Peekable) -> bool { /// Skip all svg whitespaces and one comma, and return true if |iter| hasn't finished. #[inline] -fn skip_comma_wsp(iter: &mut Peekable) -> bool { +fn skip_comma_wsp(iter: &mut Peekable>>) -> bool { if !skip_wsp(iter) { return false; } - if *iter.peek().unwrap() != ',' { + if *iter.peek().unwrap() != b',' { return true; } iter.next(); From 9fbf0f764cc2c6e5b051e0bca1b4f3c527835cc5 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 27 Aug 2018 18:38:58 +0000 Subject: [PATCH 30/64] Bug 1485495 - Use AutoRestore to restore aState.mAdditionalStateBits. r=dholbert Depends On D4020 Differential Revision: https://phabricator.services.mozilla.com/D4021 --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 9961afd76d2f..774f2e1c4874 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5943,7 +5943,7 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState, // guaranteed that they will be started before onload fires. computedStyle->StartBackgroundImageLoads(); - nsFrameState savedStateBits = aState.mAdditionalStateBits; + AutoRestore savedStateBits(aState.mAdditionalStateBits); if (item.mIsGeneratedContent) { // Ensure that frames created here are all tagged with // NS_FRAME_GENERATED_CONTENT. @@ -5962,8 +5962,6 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState, // our generated content flag so we don't release or unbind it ourselves. item.mIsGeneratedContent = false; } - - aState.mAdditionalStateBits = savedStateBits; } From 350c943d93a38734c71262270375addfce6a1d33 Mon Sep 17 00:00:00 2001 From: Margareta Eliza Balazs Date: Tue, 28 Aug 2018 15:33:55 +0300 Subject: [PATCH 31/64] Backed out changeset 9dc25841ff4f (bug 1486480) for causing Assertion failure: extendedSlots, at /builds/worker/workspace/build/src/dom/base/FragmentOrElement.cpp CLOSED TREE --- dom/base/CustomElementRegistry.cpp | 58 ----------------------------- dom/base/CustomElementRegistry.h | 5 --- dom/base/FragmentOrElement.cpp | 60 +----------------------------- dom/base/FragmentOrElement.h | 2 - dom/base/nsIContent.h | 2 - 5 files changed, 1 insertion(+), 126 deletions(-) diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 2aea3faf6c72..781ca153c625 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -42,13 +42,6 @@ public: aCb.NoteNativeChild(mDefinition, NS_CYCLE_COLLECTION_PARTICIPANT(CustomElementDefinition)); } - - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override - { - // We don't really own mDefinition. - return aMallocSizeOf(this); - } - private: virtual void Invoke(Element* aElement, ErrorResult& aRv) override { @@ -74,15 +67,6 @@ class CustomElementCallbackReaction final : public CustomElementReaction mCustomElementCallback->Traverse(aCb); } - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override - { - size_t n = aMallocSizeOf(this); - - n += mCustomElementCallback->SizeOfIncludingThis(aMallocSizeOf); - - return n; - } - private: virtual void Invoke(Element* aElement, ErrorResult& aRv) override { @@ -95,16 +79,6 @@ class CustomElementCallbackReaction final : public CustomElementReaction //----------------------------------------------------- // CustomElementCallback -size_t -LifecycleCallbackArgs::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const -{ - size_t n = name.SizeOfExcludingThisIfUnshared(aMallocSizeOf); - n += oldValue.SizeOfExcludingThisIfUnshared(aMallocSizeOf); - n += newValue.SizeOfExcludingThisIfUnshared(aMallocSizeOf); - n += namespaceURI.SizeOfExcludingThisIfUnshared(aMallocSizeOf); - return n; -} - void CustomElementCallback::Call() { @@ -139,24 +113,6 @@ CustomElementCallback::Traverse(nsCycleCollectionTraversalCallback& aCb) const aCb.NoteXPCOMChild(mCallback); } -size_t -CustomElementCallback::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const -{ - size_t n = aMallocSizeOf(this); - - // We don't uniquely own mThisObject. - - // We own mCallback but it doesn't have any special memory reporting we can do - // for it other than report its own size. - n += aMallocSizeOf(mCallback); - - n += mArgs.SizeOfExcludingThis(aMallocSizeOf); - - // mAdoptedCallbackArgs doesn't really uniquely own its members. - - return n; -} - CustomElementCallback::CustomElementCallback(Element* aThisObject, nsIDocument::ElementCallbackType aCallbackType, mozilla::dom::CallbackFunction* aCallback) @@ -258,20 +214,6 @@ CustomElementData::Unlink() mCustomElementDefinition = nullptr; } -size_t -CustomElementData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const -{ - size_t n = aMallocSizeOf(this); - - n += mReactionQueue.ShallowSizeOfExcludingThis(aMallocSizeOf); - - for (auto& reaction : mReactionQueue) { - n += reaction->SizeOfIncludingThis(aMallocSizeOf); - } - - return n; -} - //----------------------------------------------------- // CustomElementRegistry diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 3193af22f33a..2886ae5a63dd 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -41,8 +41,6 @@ struct LifecycleCallbackArgs nsString oldValue; nsString newValue; nsString namespaceURI; - - size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const; }; struct LifecycleAdoptedCallbackArgs @@ -58,7 +56,6 @@ public: nsIDocument::ElementCallbackType aCallbackType, CallbackFunction* aCallback); void Traverse(nsCycleCollectionTraversalCallback& aCb) const; - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; void Call(); void SetArgs(LifecycleCallbackArgs& aArgs) { @@ -133,7 +130,6 @@ struct CustomElementData void Traverse(nsCycleCollectionTraversalCallback& aCb) const; void Unlink(); - size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; nsAtom* GetIs(Element* aElement) { @@ -212,7 +208,6 @@ public: virtual ~CustomElementReaction() = default; virtual void Invoke(Element* aElement, ErrorResult& aRv) = 0; virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const = 0; - virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const = 0; bool IsUpgradeReaction() { diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 4e8e68f8084d..b0d97b44ed43 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -674,14 +674,6 @@ nsIContent::nsExtendedContentSlots::nsExtendedContentSlots() nsIContent::nsExtendedContentSlots::~nsExtendedContentSlots() = default; -size_t -nsIContent::nsExtendedContentSlots::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const -{ - // For now, nothing to measure here. We don't actually own any of our - // members. - return 0; -} - FragmentOrElement::nsDOMSlots::nsDOMSlots() : nsIContent::nsContentSlots(), mDataset(nullptr) @@ -733,15 +725,8 @@ size_t FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); - - nsExtendedContentSlots* extendedSlots = GetExtendedContentSlots(); if (OwnsExtendedSlots()) { - MOZ_ASSERT(extendedSlots); - n += aMallocSizeOf(extendedSlots); - } - - if (extendedSlots) { - n += extendedSlots->SizeOfExcludingThis(aMallocSizeOf); + n += aMallocSizeOf(GetExtendedContentSlots()); } if (mAttributeMap) { @@ -815,49 +800,6 @@ FragmentOrElement::nsExtendedDOMSlots::TraverseExtendedSlots(nsCycleCollectionTr } } -size_t -FragmentOrElement::nsExtendedDOMSlots::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const -{ - size_t n = nsIContent::nsExtendedContentSlots::SizeOfExcludingThis(aMallocSizeOf); - - // We own mSMILOverrideStyle but there seems to be no memory reporting on CSS - // declarations? At least report the memory the declaration takes up - // directly. - if (mSMILOverrideStyle) { - n += aMallocSizeOf(mSMILOverrideStyle); - } - - // We don't really own mSMILOverrideStyleDeclaration. mSMILOverrideStyle owns - // it. - - // We don't seem to have memory reporting for nsXULControllers. At least - // report the memory it's using directly. - if (mControllers) { - n += aMallocSizeOf(mControllers); - } - - // We don't seem to have memory reporting for nsLabelsNodeList. At least - // report the memory it's using directly. - if (mLabelsList) { - n += aMallocSizeOf(mLabelsList); - } - - // mShadowRoot should be handled during normal DOM tree memory reporting, just - // like kids, siblings, etc. - - // We don't seem to have memory reporting for nsXBLBinding. At least - // report the memory it's using directly. - if (mXBLBinding) { - n += aMallocSizeOf(mXBLBinding); - } - - if (mCustomElementData) { - n += mCustomElementData->SizeOfIncludingThis(aMallocSizeOf); - } - - return n; -} - FragmentOrElement::FragmentOrElement(already_AddRefed& aNodeInfo) : nsIContent(aNodeInfo) { diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index 84d402ba319e..f38530aaccda 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -174,8 +174,6 @@ public: void TraverseExtendedSlots(nsCycleCollectionTraversalCallback&) final; void UnlinkExtendedSlots() final; - size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const final; - /** * SMIL Overridde style rules (for SMIL animation of CSS properties) * @see Element::GetSMILOverrideStyle diff --git a/dom/base/nsIContent.h b/dom/base/nsIContent.h index 65a423a38dd5..419502c75181 100644 --- a/dom/base/nsIContent.h +++ b/dom/base/nsIContent.h @@ -797,8 +797,6 @@ protected: virtual void TraverseExtendedSlots(nsCycleCollectionTraversalCallback&); virtual void UnlinkExtendedSlots(); - virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; - /** * The nearest enclosing content node with a binding that created us. * TODO(emilio): This should be an Element*. From 123404288d00403ee9ea7ee61700b32f0ab01939 Mon Sep 17 00:00:00 2001 From: Gurzau Raul Date: Tue, 28 Aug 2018 16:29:25 +0300 Subject: [PATCH 32/64] Backed out changeset 0192efea1b66 (bug 1486137) for failing at netwerk/test/unit/test_trr.js on a CLOSED TREE --- netwerk/dns/TRR.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/netwerk/dns/TRR.cpp b/netwerk/dns/TRR.cpp index 14ef5a28dca4..c7ea17b42402 100644 --- a/netwerk/dns/TRR.cpp +++ b/netwerk/dns/TRR.cpp @@ -139,9 +139,8 @@ TRR::DohEncode(nsCString &aBody, bool aDisableECS) aBody += '\0'; // upper 8 bit OPTION-LENGTH aBody += 4; // OPTION-LENGTH, 2 octets, contains the length of the payload // after OPTION-LENGTH - aBody += '\0'; // upper 8 bit FAMILY. IANA Address Family Numbers registry, not the - // AF_* constants! - aBody += 1; // FAMILY (Ipv4), 2 octets + aBody += '\0'; // upper 8 bit FAMILY + aBody += AF_INET; // FAMILY, 2 octets aBody += '\0'; // SOURCE PREFIX-LENGTH | SCOPE PREFIX-LENGTH | aBody += '\0'; From adae89f267fd727a0e8da8882b73d7252ae9bf83 Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Mon, 27 Aug 2018 16:31:58 +0000 Subject: [PATCH 33/64] Bug 1486446 - Remove Console Launchpad support; r=bgrins. It's broken and unmaintained for a long time now, the Console Team does not use it and has no plan doing so. Differential Revision: https://phabricator.services.mozilla.com/D4348 --HG-- extra : moz-landing-system : lando --- devtools/client/webconsole/README.md | 104 ++---------- devtools/client/webconsole/bin/configure.js | 29 ---- devtools/client/webconsole/bin/dev-server.js | 19 --- devtools/client/webconsole/local-dev/index.js | 99 ----------- devtools/client/webconsole/package.json | 29 ---- .../test/fixtures/DebuggerClient.js | 88 ---------- .../client/webconsole/webconsole-frame.js | 10 +- devtools/client/webconsole/webpack.config.js | 160 ------------------ 8 files changed, 13 insertions(+), 525 deletions(-) delete mode 100644 devtools/client/webconsole/bin/configure.js delete mode 100644 devtools/client/webconsole/bin/dev-server.js delete mode 100644 devtools/client/webconsole/local-dev/index.js delete mode 100644 devtools/client/webconsole/package.json delete mode 100644 devtools/client/webconsole/test/fixtures/DebuggerClient.js delete mode 100644 devtools/client/webconsole/webpack.config.js diff --git a/devtools/client/webconsole/README.md b/devtools/client/webconsole/README.md index aa320ff24dc0..54232c863581 100644 --- a/devtools/client/webconsole/README.md +++ b/devtools/client/webconsole/README.md @@ -6,125 +6,39 @@ It can also display network logs, and you can evaluate expressions using the con input, a.k.a. JsTerm. You can read more about it on [MDN](https://developer.mozilla.org/en-US/docs/Tools/Web_Console) to learn all the features and how to use the tool. -## Old / New frontend - -The current console used in the toolbox is called the new frontend, and the code lives at -the root of the `devtools/client/webconsole/` folder. -The old console code is located in the `devtools/client/webconsole/old` folder. -Both frontends use the same code for the console input, also called JsTerm (see `jsterm.js`). -The old frontend is still used for the Browser Console, but is planned to be removed in the -near future (see Bug 1381834). - -## Run WebConsole in DevTools panel +## Run WebConsole If you want to build the WebConsole inside of the DevTools toolbox (Firefox Devtools Panels), follow the [simple Firefox build](http://docs.firefox-dev.tools/getting-started/build.html) -document in MDN. Start your compiled firefox and open the Firefox developer tool, you can +documentation. Start your compiled firefox and open the Firefox developer tool, you can then see the WebConsole tab. -## Run WebConsole in a browser tab (experimental) - -### Prerequisite - -If you would like to run the WebConsole in the browser tab, you need following packages: - -* [node](https://nodejs.org/) >= 7.10.0 JavaScript runtime. -* [yarn](https://yarnpkg.com/docs/install) >= 1.0.0 the package dependency management tool. -* [Firefox](https://www.mozilla.org/firefox/new/) any version or build from the source code. - -### Run WebConsole - -Navigate to the `mozilla-central/devtools/client/webconsole` folder with your terminal. -Note that this folder is available after `mozilla-central` was cloned in order to get a -local copy of the repository. Then run the following commands: - -```bash -# Install packages -yarn install - -# Create a dev server instance for hosting webconsole on browser -yarn start -``` - -Open `localhost:8000` to see what we call the [launchpad](https://github.com/devtools-html/devtools-core/tree/master/packages/devtools-launchpad). -The UI that let you start a new Firefox window which will be the target (or debuggee). -Launchpad will communicate with Firefox (the remote debugging server) and list all opened tabs from Firefox. -You can then navigate to a website you want in the target window, and you should see it appears -in the `localhost:8000` page. Clicking on it will start the WebConsole in the browser tab. - -### How it works - -The WebConsole uses [webpack](https://webpack.js.org/) and several packages from [devtools-core](https://github.com/devtools-html/devtools-core) -to run as a normal web page. The WebConsole uses [Mozilla remote debugging protocol](http://searchfox.org/mozilla-central/source/devtools/docs/backend/protocol.md) -to fetch messages and execute commands against Firefox. - -Open `localhost:8000` in any browser to see the -interface. Devtools Launchpad will communicate with Firefox (the remote debugging server) -and list all opened tabs from Firefox. Click one of the browser tab entry, now you can see -the WebConsole runs in a browser tab. - -### DevTools shared modules - -When working on console running via launchpad, you may need to modify code on external modules. -Besides the third party modules, here are modules required for the WebConsole -(hosted under the `devtools-core` Github repo, which contains modules shared across Devtools). - -* [devtools-config](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-config/#readme) config used in dev server -* [devtools-launchpad](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-launchpad/#readme) provide the dev server, landing page and the bootstrap functions to run devtools in the browser tab. -* [devtools-modules](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-modules/#readme) Devtools shared and shim modules. -* [devtools-source-editor](https://github.com/devtools-html/devtools-core/blob/master/packages/devtools-source-editor/#readme) Source Editor component. -* [devtools-reps](https://github.com/devtools-html/debugger.html/blob/master/packages/devtools-reps/#readme) remote object formatter for variables representation. - -Changes to those modules need to be done on Github, using the Pull Request workflow. -Then, a new version of the modified package need to be released on npm so the version number -can be updated in WebConsole's `package.json`. Some modules have a release process, -look for `RELEASE.md` file in the module folder, or ask a maintainer if you are -unsure about the release process. - ## Code Structure -Top level files are used to launch the WebConsole inside of the DevTools toolbox or run in -the browser tab (experimental). The same code base is used to run in both environments. - -### Run inside of the DevTools toolbox - -Files used to run the WebConsole inside of the DevTools toolbox. +Top level files are used to launch the WebConsole inside of the DevTools toolbox. +The main files used to run the WebConsole are: * `main.js` called by devtools toolbox to launch the WebConsole panel. * `index.html` panel UI and launch scripts. -### Run in the browser tab (experimental) - -Files used to run the WebConsole in the browser tab - -* `bin/` files to launch test server. -* `configs/` dev configs. -* `local-dev/index.js` the entry point, equivalent to `index.html`. -* `webpack.config.js` the webpack config file, including plenty of module aliases map to shims and polyfills. -* `package.json` declare every required packages and available commands. - -To run in the browser tab, the WebConsole needs to get some dependencies from npm module. -Check `package.json` to see all dependencies. Check `webpack.config.js` to find the module alias, -and check [devtools-core](https://github.com/devtools-html/devtools-core) packages to dive -into actual modules used by the WebConsole and other Devtools. - ### UI The WebConsole UI is built using [React](http://docs.firefox-dev.tools/frontend/react.html) components (in `components/`). The React application is rendered from `webconsole-output-wrapper.js`. -It contains 3 top components: +It contains 4 top components: * **ConsoleOutput** (in `ConsoleOutput.js`) is the component where messages are rendered. * **FilterBar** (in `FilterBar.js`) is the component for the filter bars (filter input and toggle buttons). * **SideBar** (in `SideBar.js`) is the component that render the sidebar where objects can be placed in. +* **JsTerm** (in `JsTerm.js`) is the component that render the console input. We prefer stateless component (defined by function) instead of stateful component (defined by class) unless the component has to maintain its internal state. ### State -Besides the UI, the WebConsole manages the app state via [Redux](When working on console running via launchpad). +Besides the UI, the WebConsole manages the app state via [Redux]. The following locations define the app state: * `src/constants.js` constants used across the tool including action and event names. @@ -137,8 +51,12 @@ The redux state is a plain javascript object with the following properties: { // State of the filter input and toggle buttons filters, + // State of the input history + history, // Console messages data and state (hidden, expanded, groups, …) messages, + // State of notifications displayed on the output (e.g. self-XSS warning message) + notifications, // Preferences (persist message, message limit, …) prefs, // Interface state (filter bar visible, sidebar visible, …) diff --git a/devtools/client/webconsole/bin/configure.js b/devtools/client/webconsole/bin/configure.js deleted file mode 100644 index 38922cee175f..000000000000 --- a/devtools/client/webconsole/bin/configure.js +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* eslint-env node */ - -"use strict"; - -const fs = require("fs"); -const path = require("path"); - -function getConfig() { - if (process.env.TARGET === "firefox-panel") { - return require("../configs/firefox-panel.json"); - } - - const developmentConfig = require("../configs/development.json"); - - let localConfig = {}; - if (fs.existsSync(path.resolve(__dirname, "../configs/local.json"))) { - localConfig = require("../configs/local.json"); - } - - return Object.assign({}, developmentConfig, localConfig); -} - -module.exports = { - getConfig, -}; diff --git a/devtools/client/webconsole/bin/dev-server.js b/devtools/client/webconsole/bin/dev-server.js deleted file mode 100644 index e1aadfbd5475..000000000000 --- a/devtools/client/webconsole/bin/dev-server.js +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* eslint-env node */ - -"use strict"; - -const toolbox = require("devtools-launchpad/index"); -const feature = require("devtools-config"); -const { getConfig } = require("./configure"); - -const envConfig = getConfig(); - -feature.setConfig(envConfig); - -const webpackConfig = require("../webpack.config"); - -toolbox.startDevServer(envConfig, webpackConfig, __dirname); diff --git a/devtools/client/webconsole/local-dev/index.js b/devtools/client/webconsole/local-dev/index.js deleted file mode 100644 index 03ade69fb34a..000000000000 --- a/devtools/client/webconsole/local-dev/index.js +++ /dev/null @@ -1,99 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - /* eslint-env browser */ - -"use strict"; - -const React = require("react"); -const ReactDOM = require("react-dom"); -const { EventEmitter } = require("devtools-modules"); -const { Services: { appinfo, pref } } = require("devtools-modules"); -const { bootstrap } = require("devtools-launchpad"); - -EventEmitter.decorate(window); - -require("../../themes/widgets.css"); -require("../../themes/webconsole.css"); -require("../../themes/components-frame.css"); -require("../../themes/light-theme.css"); -require("../../shared/components/reps/reps.css"); -require("../../shared/components/tabs/Tabs.css"); -require("../../shared/components/tabs/TabBar.css"); -require("../../netmonitor/src/assets/styles/httpi.css"); - -pref("devtools.debugger.remote-timeout", 10000); -pref("devtools.hud.loglimit", 10000); -pref("devtools.webconsole.filter.error", true); -pref("devtools.webconsole.filter.warn", true); -pref("devtools.webconsole.filter.info", true); -pref("devtools.webconsole.filter.log", true); -pref("devtools.webconsole.filter.debug", true); -pref("devtools.webconsole.filter.css", false); -pref("devtools.webconsole.filter.net", false); -pref("devtools.webconsole.filter.netxhr", false); -pref("devtools.webconsole.ui.filterbar", false); -pref("devtools.webconsole.inputHistoryCount", 50); -pref("devtools.webconsole.persistlog", false); -pref("devtools.webconsole.timestampMessages", false); -pref("devtools.webconsole.sidebarToggle", true); - -const WebConsoleOutputWrapper = require("../webconsole-output-wrapper"); -const WebConsoleFrame = require("../webconsole-frame").WebConsoleFrame; - -// Copied from netmonitor/index.js: -window.addEventListener("DOMContentLoaded", () => { - for (const link of document.head.querySelectorAll("link")) { - link.href = link.href.replace(/(resource|chrome)\:\/\//, "/"); - } - - if (appinfo.OS === "Darwin") { - document.documentElement.setAttribute("platform", "mac"); - } else if (appinfo.OS === "Linux") { - document.documentElement.setAttribute("platform", "linux"); - } else { - document.documentElement.setAttribute("platform", "win"); - } -}); - -let consoleFrame; -function onConnect(connection) { - // If we are on the main dashboard don't render the component - if (!connection || !connection.tabConnection || !connection.tabConnection.tabTarget) { - return; - } - - // Replicate the DOM that the root component lives within - document.querySelector("#mount").innerHTML = ` -
-
-
- `; - - // Stub out properties that are received from hudservice - const owner = { - iframeWindow: window, - chromeWindow: window, - hudId: "hud_0", - getDebuggerFrames: () => { }, - getInspectorSelection: () => { }, - target: connection.tabConnection.tabTarget, - _browserConsole: false, - WebConsoleOutputWrapper, - }; - consoleFrame = new WebConsoleFrame(owner); - consoleFrame.init().then(function() { - console.log("WebConsoleFrame initialized"); - }); -} - -// This is just a hack until the local dev environment includes jsterm -window.evaluateJS = function(input) { - consoleFrame.webConsoleClient.evaluateJSAsync(`${input}`, function(r) { - consoleFrame.consoleOutput.dispatchMessageAdd(r); - }, {}); -}; - -document.documentElement.classList.add("theme-light"); -bootstrap(React, ReactDOM).then(onConnect); diff --git a/devtools/client/webconsole/package.json b/devtools/client/webconsole/package.json deleted file mode 100644 index 3a335ee696ff..000000000000 --- a/devtools/client/webconsole/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "webconsole", - "version": "0.0.1", - "engines": { - "node": ">=7.10.0" - }, - "scripts": { - "start": "cross-env NODE_ENV=production node bin/dev-server", - "dev": " cross-env NODE_ENV=development node bin/dev-server" - }, - "dependencies": { - "babel-plugin-transform-flow-strip-types": "^6.22.0", - "babel-plugin-transform-react-jsx": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "cross-env": "^3.1.3", - "devtools-config": "0.0.12", - "devtools-launchpad": "^0.0.119", - "devtools-modules": "0.0.37", - "file-loader": "^1.1.6", - "netmonitor": "file:../netmonitor", - "raw-loader": "^0.5.1", - "react": "=16.2.0", - "react-dom": "=16.2.0", - "react-prop-types": "=0.4.0", - "react-redux": "=5.0.6", - "redux": "^3.7.2", - "require-hacker": "^2.1.4" - } -} diff --git a/devtools/client/webconsole/test/fixtures/DebuggerClient.js b/devtools/client/webconsole/test/fixtures/DebuggerClient.js deleted file mode 100644 index 650946710a7c..000000000000 --- a/devtools/client/webconsole/test/fixtures/DebuggerClient.js +++ /dev/null @@ -1,88 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -// Objects and functions were cherry-picked from devtools/shared/client/main.js, in -// order to make the console launchpad Worker. - -// mock, we only need DebuggerClient.requester -const DebuggerClient = function(transport) {}; - -/** - * A declarative helper for defining methods that send requests to the server. - * - * @param packetSkeleton - * The form of the packet to send. Can specify fields to be filled from - * the parameters by using the |arg| function. - * @param before - * The function to call before sending the packet. Is passed the packet, - * and the return value is used as the new packet. The |this| context is - * the instance of the client object we are defining a method for. - * @param after - * The function to call after the response is received. It is passed the - * response, and the return value is considered the new response that - * will be passed to the callback. The |this| context is the instance of - * the client object we are defining a method for. - * @return Request - * The `Request` object that is a Promise object and resolves once - * we receive the response. (See request method for more details) - */ -DebuggerClient.requester = function(packetSkeleton, config = {}) { - const { before, after } = config; - return function(...args) { - let outgoingPacket = { - to: packetSkeleton.to || this.actor - }; - - let maxPosition = -1; - for (const k of Object.keys(packetSkeleton)) { - if (packetSkeleton[k] instanceof DebuggerClient.Argument) { - const { position } = packetSkeleton[k]; - outgoingPacket[k] = packetSkeleton[k].getArgument(args); - maxPosition = Math.max(position, maxPosition); - } else { - outgoingPacket[k] = packetSkeleton[k]; - } - } - - if (before) { - outgoingPacket = before.call(this, outgoingPacket); - } - - return this.request(outgoingPacket, (response) => { - if (after) { - const { from } = response; - response = after.call(this, response); - if (!response.from) { - response.from = from; - } - } - - // The callback is always the last parameter. - const thisCallback = args[maxPosition + 1]; - if (thisCallback) { - thisCallback(response); - } - return response; - }, "DebuggerClient.requester request callback"); - }; -}; - -function arg(pos) { - return new DebuggerClient.Argument(pos); -} - -DebuggerClient.Argument = function(position) { - this.position = position; -}; - -DebuggerClient.Argument.prototype.getArgument = function(params) { - if (!(this.position in params)) { - throw new Error("Bad index into params: " + this.position); - } - return params[this.position]; -}; - -module.exports = { arg, DebuggerClient }; diff --git a/devtools/client/webconsole/webconsole-frame.js b/devtools/client/webconsole/webconsole-frame.js index 531f4c33de26..482109281ad8 100644 --- a/devtools/client/webconsole/webconsole-frame.js +++ b/devtools/client/webconsole/webconsole-frame.js @@ -24,10 +24,6 @@ const PREF_MESSAGE_TIMESTAMP = "devtools.webconsole.timestampMessages"; const PREF_PERSISTLOG = "devtools.webconsole.persistlog"; const PREF_SIDEBAR_ENABLED = "devtools.webconsole.sidebarToggle"; -// XXX: This file is incomplete (see bug 1326937). -// It's used when loading the webconsole with devtools-launchpad, but will ultimately be -// the entry point for the new frontend - /** * A WebConsoleFrame instance is an interactive console initialized *per target* * that displays console log data as well as provides an interactive terminal to @@ -236,10 +232,8 @@ WebConsoleFrame.prototype = { const toolbox = gDevTools.getToolbox(this.owner.target); - // Handle both launchpad and toolbox loading - const Wrapper = this.owner.WebConsoleOutputWrapper || this.window.WebConsoleOutput; - this.consoleOutput = - new Wrapper(this.outputNode, this, toolbox, this.owner, this.document); + this.consoleOutput = new this.window.WebConsoleOutput( + this.outputNode, this, toolbox, this.owner, this.document); // Toggle the timestamp on preference change Services.prefs.addObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged); this._onToolboxPrefChanged(); diff --git a/devtools/client/webconsole/webpack.config.js b/devtools/client/webconsole/webpack.config.js deleted file mode 100644 index 4b8a8b2aeb72..000000000000 --- a/devtools/client/webconsole/webpack.config.js +++ /dev/null @@ -1,160 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* eslint-env node */ -/* eslint max-len: [0] */ - -"use strict"; - -const {toolboxConfig} = require("./node_modules/devtools-launchpad/index"); -const { NormalModuleReplacementPlugin } = require("webpack"); -const {getConfig} = require("./bin/configure"); - -const path = require("path"); -const projectPath = path.join(__dirname, "local-dev"); - -const webpackConfig = { - entry: { - console: [path.join(projectPath, "index.js")], - }, - - module: { - rules: [ - { - test: /\.(png|svg)$/, - loader: "file-loader?name=[path][name].[ext]", - }, - { - test: /\.js$/, - loaders: [ - /* - * The version of webpack used in the launchpad seems to have trouble - * with the require("raw!${file}") that we use for the properties - * file in l10.js. - * This loader goes through the whole code and remove the "raw!" prefix - * so the raw-loader declared in devtools-launchpad config can load - * those files. - */ - "rewrite-raw", - // Replace all references to this.browserRequire() by require() - "rewrite-browser-require", - // Replace all references to loader.lazyRequire() by require() - "rewrite-lazy-require", - // Replace all references to loader.lazyGetter() by require() - "rewrite-lazy-getter", - ], - } - ] - }, - - resolveLoader: { - modules: [ - path.resolve("./node_modules"), - path.resolve("../shared/webpack"), - ] - }, - - output: { - path: path.join(__dirname, "assets/build"), - filename: "[name].js", - publicPath: "/assets/build", - }, - - externals: [ - { - "promise": "var Promise", - } - ], -}; - -webpackConfig.resolve = { - modules: [ - // Make sure webpack is always looking for modules in - // `webconsole/node_modules` directory first. - path.resolve(__dirname, "node_modules"), "node_modules" - ], - alias: { - "Services": "devtools-modules/src/Services", - - "devtools/client/webconsole/utils": path.join(__dirname, "test/fixtures/WebConsoleUtils"), - - "devtools/client/shared/vendor/immutable": "immutable", - "devtools/client/shared/vendor/react": "react", - "devtools/client/shared/vendor/react-dom": "react-dom", - "devtools/client/shared/vendor/react-redux": "react-redux", - "devtools/client/shared/vendor/redux": "redux", - "devtools/client/shared/vendor/reselect": "reselect", - - "resource://gre/modules/AppConstants.jsm": path.join(__dirname, "../../client/shared/webpack/shims/app-constants-stub"), - - "devtools/client/framework/devtools": path.join(__dirname, "../../client/shared/webpack/shims/framework-devtools-shim"), - "devtools/client/framework/menu": "devtools-modules/src/menu", - "devtools/client/sourceeditor/editor": "devtools-source-editor/src/source-editor", - - "devtools/client/shared/unicode-url": "./node_modules/devtools-modules/src/unicode-url", - "devtools/client/shared/zoom-keys": "devtools-modules/src/zoom-keys", - - "devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"), - "devtools/shared/event-emitter": "devtools-modules/src/utils/event-emitter", - "devtools/shared/client/debugger-client": path.join(__dirname, "test/fixtures/DebuggerClient"), - "devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"), - "devtools/shared/platform/stack": path.join(__dirname, "../../client/shared/webpack/shims/platform-stack-stub"), - - // Locales need to be explicitly mapped to the en-US subfolder - "toolkit/locales": path.join(__dirname, "../../../toolkit/locales/en-US"), - "devtools/client/locales": path.join(__dirname, "../../client/locales/en-US"), - "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"), - "devtools/startup/locales": path.join(__dirname, "../../shared/locales/en-US"), - - // Unless a path explicitly needs to be rewritten or shimmed, all devtools paths can - // be mapped to ../../ - "devtools": path.join(__dirname, "../../"), - } -}; - -const mappings = [ - [ - /utils\/menu/, "devtools-launchpad/src/components/shared/menu" - ], - [ - /chrome:\/\/devtools\/skin/, - (result) => { - result.request = result.request - .replace("./chrome://devtools/skin", path.join(__dirname, "../themes")); - } - ], - [ - /chrome:\/\/devtools\/content/, - (result) => { - result.request = result.request - .replace("./chrome://devtools/content", path.join(__dirname, "..")); - } - ], - [ - /resource:\/\/devtools/, - (result) => { - result.request = result.request - .replace("./resource://devtools/client", path.join(__dirname, "..")); - } - ], -]; - -webpackConfig.plugins = mappings.map(([regex, res]) => - new NormalModuleReplacementPlugin(regex, res)); - -const basePath = path.join(__dirname, "../../").replace(/\\/g, "\\\\"); - -const config = toolboxConfig(webpackConfig, getConfig(), { - // Exclude to transpile all scripts in devtools/ but not for this folder nor netmonitor. - babelExcludes: new RegExp(`^${basePath}(.(?!(webconsole|netmonitor)))*$`), - disablePostCSS: true, -}); - -// Remove loaders from devtools-launchpad's webpack.config.js -// * For svg-inline loader: -// Webconsole uses file loader to bundle image assets instead of svg-inline-loader -config.module.rules = config.module.rules - .filter((rule) => !["svg-inline-loader"].includes(rule.loader)); - -module.exports = config; From 27f61415a8278e21d66099947b231169ac5884c3 Mon Sep 17 00:00:00 2001 From: Raynald Mirville Date: Tue, 28 Aug 2018 13:02:23 +0000 Subject: [PATCH 34/64] Bug 1476552 - GeckoSession::WebResponseInfo Kotlin annotations and static r=sebastian MozReview-Commit-ID: 1HWEStKaGVl Bug 1476552 part 1 - Add @NonNull/@Nullable annotations to GeckoSession::WebResponseInfo for Kotlin interoperability Bug 1476552 part 2 - Make GeckoSession::WebResponseInfo static MozReview-Commit-ID: 4ce92G7i2nz Differential Revision: https://phabricator.services.mozilla.com/D2885 --HG-- extra : moz-landing-system : lando --- .../main/java/org/mozilla/geckoview/GeckoSession.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java index 1a1e33a01422..e619912245c3 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java @@ -2069,27 +2069,27 @@ public class GeckoSession extends LayerSession /** * WebResponseInfo contains information about a single web response. */ - public class WebResponseInfo { + static public class WebResponseInfo { /** * The URI of the response. Cannot be null. */ - public final String uri; + @NonNull public final String uri; /** * The content type (mime type) of the response. May be null. */ - public final String contentType; + @Nullable public final String contentType; /** * The content length of the response. May be 0 if unknokwn. */ - public final long contentLength; + @Nullable public final long contentLength; /** * The filename obtained from the content disposition, if any. * May be null. */ - public final String filename; + @Nullable public final String filename; /* package */ WebResponseInfo(GeckoBundle message) { uri = message.getString("uri"); From 49299af1f0aeaaaef6f607383f0245ba02e786e7 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Mon, 27 Aug 2018 13:27:39 +0000 Subject: [PATCH 35/64] Bug 1486157 - Change language provider attribution to use openWebLinkIn. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D4273 --HG-- extra : moz-landing-system : lando --- browser/components/translation/Translation.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/translation/Translation.jsm b/browser/components/translation/Translation.jsm index a1e1167fa926..1ea11f8fbe29 100644 --- a/browser/components/translation/Translation.jsm +++ b/browser/components/translation/Translation.jsm @@ -75,7 +75,7 @@ var Translation = { openProviderAttribution() { let attribution = this.supportedEngines[this.translationEngine]; ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm"); - BrowserWindowTracker.getTopWindow().openUILinkIn(attribution, "tab"); + BrowserWindowTracker.getTopWindow().openWebLinkIn(attribution, "tab"); }, /** From e262584728651e164cc94bb2e25dd829ac7f107d Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 27 Aug 2018 15:55:13 +0000 Subject: [PATCH 36/64] Bug 1485342 - Avoid isdigit() and isxdigit() in URL classifier. r=francois MozReview-Commit-ID: IvadP10PFEZ Differential Revision: https://phabricator.services.mozilla.com/D4312 --HG-- extra : moz-landing-system : lando --- .../components/url-classifier/nsUrlClassifierUtils.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp index ce445d4a473e..036e69f3e3e8 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -19,6 +19,7 @@ #include "nsIHttpChannelInternal.h" #include "mozIThirdPartyUtil.h" #include "nsIDocShell.h" +#include "mozilla/TextUtils.h" #define DEFAULT_PROTOCOL_VERSION "2.2" @@ -32,7 +33,7 @@ static bool IsDecimal(const nsACString & num) { for (uint32_t i = 0; i < num.Length(); i++) { - if (!isdigit(num[i])) { + if (!mozilla::IsAsciiDigit(num[i])) { return false; } } @@ -52,7 +53,7 @@ IsHex(const nsACString & num) } for (uint32_t i = 2; i < num.Length(); i++) { - if (!isxdigit(num[i])) { + if (!mozilla::IsAsciiHexDigit(num[i])) { return false; } } @@ -72,7 +73,7 @@ IsOctal(const nsACString & num) } for (uint32_t i = 1; i < num.Length(); i++) { - if (!isdigit(num[i]) || num[i] == '8' || num[i] == '9') { + if (!mozilla::IsAsciiDigit(num[i]) || num[i] == '8' || num[i] == '9') { return false; } } @@ -947,7 +948,7 @@ nsUrlClassifierUtils::ParseIPAddress(const nsACString & host, } for (host.BeginReading(iter); iter != end; iter++) { - if (!(isxdigit(*iter) || *iter == 'x' || *iter == 'X' || *iter == '.')) { + if (!(mozilla::IsAsciiHexDigit(*iter) || *iter == 'x' || *iter == 'X' || *iter == '.')) { // not an IP return; } From 1345af50dd27e762d5e47d2dd2fcb72bb18519d9 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Tue, 28 Aug 2018 08:45:38 +0000 Subject: [PATCH 37/64] Bug 1464714 - Make disabled .subviewbutton use --panel-disabled-color. r=dao Differential Revision: https://phabricator.services.mozilla.com/D4396 --HG-- extra : moz-landing-system : lando --- browser/themes/shared/customizableui/panelUI.inc.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/browser/themes/shared/customizableui/panelUI.inc.css b/browser/themes/shared/customizableui/panelUI.inc.css index 3c9624d51c8b..8fd2bdc42a02 100644 --- a/browser/themes/shared/customizableui/panelUI.inc.css +++ b/browser/themes/shared/customizableui/panelUI.inc.css @@ -871,6 +871,10 @@ panelview .toolbarbutton-1, outline: 0; } +.subviewbutton[disabled="true"] { + color: var(--panel-disabled-color); +} + .subviewbutton > .toolbarbutton-text { padding: 0; padding-inline-start: 24px; /* This is 16px for the icon + 8px for the padding as defined below. */ From 618a64cb286483c39de19f2d5392ef3c722d645f Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Tue, 28 Aug 2018 05:28:21 +0000 Subject: [PATCH 38/64] Bug 1465388 - Resume about:blank parser upon unblocking the document r=hsivonen When `document.blockParsing()` is called, the nsIParser is suspended until the document is unblocked. For about:blank documents, this is a nsParser. When a document is unblocked, nsParser::ContinueInterruptedParsingAsync is invoked, which delegates its implementation to nsIContentSink, which is a nsHTMLContentSink for about:blank documents. Due to a missing implementation of nsHTMLContentSink::ContinueInterruptedParsingAsync, the parser was never resumed, causing bug 1465388 and bug 1407501. This patch fixes the problem, by implementing the required method (and using a load blocker to ensure that the (about:blank) document does not finish before the parser finishes). This patch is tested through extension tests: Currently document_start stylesheets always activate the parser blocker, and document_start scripts trigger the parser blocker when the script has not been preloaded yet (e.g. at the first run). Before this patch, the test failed due to the assertion failure as reported in the linked bugs. After this patch, the tests pass. Differential Revision: https://phabricator.services.mozilla.com/D4352 --HG-- extra : moz-landing-system : lando --- dom/base/nsDocument.cpp | 2 + dom/html/nsHTMLContentSink.cpp | 24 +++++++ ...est_ext_contentscript_about_blank_start.js | 69 +++++++++++++++++++ .../test/xpcshell/xpcshell-content.ini | 2 +- 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index c5c55ce645b9..5496aac43ad0 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -10038,6 +10038,7 @@ public: parser->BlockParser(); mParser = do_GetWeakReference(parser); mDocument = aDocument; + mDocument->BlockOnload(); } } @@ -10076,6 +10077,7 @@ private: if (parser == docParser) { parser->UnblockParser(); parser->ContinueInterruptedParsingAsync(); + mDocument->UnblockOnload(false); } } mParser = nullptr; diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp index d0584cc6335f..055ae40ec2b7 100644 --- a/dom/html/nsHTMLContentSink.cpp +++ b/dom/html/nsHTMLContentSink.cpp @@ -131,6 +131,7 @@ public: virtual void SetDocumentCharset(NotNull aEncoding) override; virtual nsISupports *GetTarget() override; virtual bool IsScriptExecuting() override; + virtual void ContinueInterruptedParsingAsync() override; // nsIHTMLContentSink NS_IMETHOD OpenContainer(ElementType aNodeType) override; @@ -175,6 +176,9 @@ protected: void NotifyInsert(nsIContent* aContent, nsIContent* aChildContent); void NotifyRootInsertion(); + +private: + void ContinueInterruptedParsingIfEnabled(); }; class SinkContext @@ -1047,3 +1051,23 @@ HTMLContentSink::IsScriptExecuting() { return IsScriptExecutingImpl(); } + +void +HTMLContentSink::ContinueInterruptedParsingIfEnabled() +{ + if (mParser->IsParserEnabled()) { + static_cast(mParser.get())->ContinueInterruptedParsing(); + } +} + +void +HTMLContentSink::ContinueInterruptedParsingAsync() +{ + nsCOMPtr ev = + NewRunnableMethod("HTMLContentSink::ContinueInterruptedParsingIfEnabled", + this, + &HTMLContentSink::ContinueInterruptedParsingIfEnabled); + + nsCOMPtr doc = do_QueryInterface(mHTMLDocument); + doc->Dispatch(mozilla::TaskCategory::Other, ev.forget()); +} diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js new file mode 100644 index 000000000000..ab9715869d67 --- /dev/null +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js @@ -0,0 +1,69 @@ +"use strict"; + +const server = createHttpServer({hosts: ["example.com"]}); + +server.registerPathHandler("/blank-iframe.html", (request, response) => { + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "text/html; charset=utf-8", false); + response.write(""); +}); + +add_task(async function content_script_at_document_start() { + let extensionData = { + manifest: { + content_scripts: [{ + "matches": [""], + "js": ["start.js"], + "run_at": "document_start", + "match_about_blank": true, + }], + }, + + files: { + "start.js": function() { + browser.test.sendMessage("content-script-done"); + }, + }, + }; + + let extension = ExtensionTestUtils.loadExtension(extensionData); + await extension.startup(); + let contentPage = await ExtensionTestUtils.loadContentPage(`about:blank`); + await extension.awaitMessage("content-script-done"); + await contentPage.close(); + await extension.unload(); +}); + +add_task(async function content_style_at_document_start() { + let extensionData = { + manifest: { + content_scripts: [{ + "matches": [""], + "css": ["start.css"], + "run_at": "document_start", + "match_about_blank": true, + }, { + "matches": [""], + "js": ["end.js"], + "run_at": "document_end", + "match_about_blank": true, + }], + }, + + files: { + "start.css": "body { background: red; }", + "end.js": function() { + let style = window.getComputedStyle(document.body); + browser.test.assertEq("rgb(255, 0, 0)", style.backgroundColor, "document_start style should have been applied"); + browser.test.sendMessage("content-script-done"); + }, + }, + }; + + let extension = ExtensionTestUtils.loadExtension(extensionData); + await extension.startup(); + let contentPage = await ExtensionTestUtils.loadContentPage(`about:blank`); + await extension.awaitMessage("content-script-done"); + await contentPage.close(); + await extension.unload(); +}); diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini b/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini index 06c4edbf52a6..952442e3493c 100644 --- a/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini +++ b/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini @@ -2,8 +2,8 @@ skip-if = os == "android" || (os == "win" && debug) || (os == "linux") [test_ext_i18n_css.js] [test_ext_contentscript.js] +[test_ext_contentscript_about_blank_start.js] [test_ext_contentscript_scriptCreated.js] -skip-if = debug # Bug 1407501 [test_ext_contentscript_triggeringPrincipal.js] skip-if = (os == "android" && debug) || (os == "win" && debug) # Windows: Bug 1438796 [test_ext_contentscript_xrays.js] From 595e7789c310e9dc17687292a83ee45e90c6c6d5 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Mon, 27 Aug 2018 17:56:03 +0000 Subject: [PATCH 39/64] Bug 1486410 - Bug 1466427 - Enable new clang-tidy 7.0 checks. r=andi Differential Revision: https://phabricator.services.mozilla.com/D4210 --HG-- extra : moz-landing-system : lando --- tools/clang-tidy/config.yaml | 24 ++++++++--- ...ang-analyzer-security.insecureAPI.bcmp.cpp | 6 +++ ...ng-analyzer-security.insecureAPI.bcmp.json | 1 + ...ng-analyzer-security.insecureAPI.bcopy.cpp | 6 +++ ...g-analyzer-security.insecureAPI.bcopy.json | 1 + ...ng-analyzer-security.insecureAPI.bzero.cpp | 6 +++ ...g-analyzer-security.insecureAPI.bzero.json | 1 + ...erformance-implicit-conversion-in-loop.cpp | 43 +++++++++++++++++++ ...rformance-implicit-conversion-in-loop.json | 1 + .../performance-inefficient-algorithm.cpp | 31 +++++++++++++ .../performance-inefficient-algorithm.json | 1 + .../test/performance-move-const-arg.cpp | 22 ++++++++++ .../test/performance-move-const-arg.json | 1 + .../performance-move-constructor-init.cpp | 11 +++++ .../performance-move-constructor-init.json | 1 + .../performance-noexcept-move-constructor.cpp | 4 ++ ...performance-noexcept-move-constructor.json | 1 + ...ility-static-accessed-through-instance.cpp | 11 +++++ ...lity-static-accessed-through-instance.json | 1 + tools/clang-tidy/test/structures.h | 4 ++ 20 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp create mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json create mode 100644 tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp create mode 100644 tools/clang-tidy/test/performance-implicit-conversion-in-loop.json create mode 100644 tools/clang-tidy/test/performance-inefficient-algorithm.cpp create mode 100644 tools/clang-tidy/test/performance-inefficient-algorithm.json create mode 100644 tools/clang-tidy/test/performance-move-const-arg.cpp create mode 100644 tools/clang-tidy/test/performance-move-const-arg.json create mode 100644 tools/clang-tidy/test/performance-move-constructor-init.cpp create mode 100644 tools/clang-tidy/test/performance-move-constructor-init.json create mode 100644 tools/clang-tidy/test/performance-noexcept-move-constructor.cpp create mode 100644 tools/clang-tidy/test/performance-noexcept-move-constructor.json create mode 100644 tools/clang-tidy/test/readability-static-accessed-through-instance.cpp create mode 100644 tools/clang-tidy/test/readability-static-accessed-through-instance.json diff --git a/tools/clang-tidy/config.yaml b/tools/clang-tidy/config.yaml index 02f2f691ff2e..0092afa71df8 100644 --- a/tools/clang-tidy/config.yaml +++ b/tools/clang-tidy/config.yaml @@ -43,6 +43,12 @@ clang_checkers: publish: !!bool yes - name: clang-analyzer-security.FloatLoopCounter publish: !!bool yes + - name: clang-analyzer-security.insecureAPI.bcmp + publish: !!bool yes + - name: clang-analyzer-security.insecureAPI.bcopy + publish: !!bool yes + - name: clang-analyzer-security.insecureAPI.bzero + publish: !!bool yes - name: clang-analyzer-security.insecureAPI.getpw publish: !!bool yes # We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated. @@ -101,13 +107,20 @@ clang_checkers: publish: !!bool yes - name: performance-for-range-copy publish: !!bool yes - # Only available from clang tidy 6.0. We are currently using 5.0 - # - name: performance-implicit-conversion-in-loop - # publish: !!bool yes + - name: performance-implicit-conversion-in-loop + publish: !!bool yes + - name: performance-inefficient-algorithm + publish: !!bool yes - name: performance-inefficient-string-concatenation publish: !!bool yes - name: performance-inefficient-vector-operation publish: !!bool yes + - name: performance-move-const-arg + publish: !!bool yes + - name: performance-move-constructor-init + publish: !!bool yes + - name: performance-noexcept-move-constructor + publish: !!bool yes - name: performance-type-promotion-in-math-fn publish: !!bool yes - name: performance-unnecessary-copy-initialization @@ -130,9 +143,8 @@ clang_checkers: publish: !!bool yes - name: readability-uniqueptr-delete-release publish: !!bool yes -# Only available from clang tidy 6.0. We are currently using 5.0 -# - name: readability-static-accessed-through-instance -# publish: !!bool yes + - name: readability-static-accessed-through-instance + publish: !!bool yes # Third party files from mozilla-central third_party: tools/rewriting/ThirdPartyPaths.txt diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp new file mode 100644 index 000000000000..4a0d1c0c63fc --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp @@ -0,0 +1,6 @@ +#include "structures.h" + +int test_bcmp(void *a, void *b, size_t n) { + return bcmp(a, b, n); +} + diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json new file mode 100644 index 000000000000..a34c991e87b8 --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json @@ -0,0 +1 @@ +"[[\"warning\", \"The bcmp() function is obsoleted by memcmp()\", \"clang-analyzer-security.insecureAPI.bcmp\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp new file mode 100644 index 000000000000..28641653450f --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp @@ -0,0 +1,6 @@ +#include "structures.h" + +void test_bcopy(void *a, void *b, size_t n) { + bcopy(a, b, n); +} + diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json new file mode 100644 index 000000000000..0ac72ad06d4f --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json @@ -0,0 +1 @@ +"[[\"warning\", \"The bcopy() function is obsoleted by memcpy() or memmove()\", \"clang-analyzer-security.insecureAPI.bcopy\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp new file mode 100644 index 000000000000..5efa40c750b1 --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp @@ -0,0 +1,6 @@ +#include "structures.h" + +void test_bzero(void *a, size_t n) { + bzero(a, n); +} + diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json new file mode 100644 index 000000000000..a22074f45da5 --- /dev/null +++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json @@ -0,0 +1 @@ +"[[\"warning\", \"The bzero() function is obsoleted by memset()\", \"clang-analyzer-security.insecureAPI.bzero\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp new file mode 100644 index 000000000000..75ed510f3f5a --- /dev/null +++ b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp @@ -0,0 +1,43 @@ +// Iterator returning by value. +template +struct Iterator { + void operator++(); + T operator*(); + bool operator!=(const Iterator& other); +}; + +// The template argument is an iterator type, and a view is an object you can +// run a for loop on. +template +struct View { + T begin(); + T end(); +}; + +// With this class, the implicit conversion is a call to the (implicit) +// constructor of the class. +template +class ImplicitWrapper { + public: + // Implicit! + ImplicitWrapper(const T& t); +}; + +template +class OperatorWrapper { + public: + OperatorWrapper() = delete; +}; + +struct SimpleClass { + int foo; + operator OperatorWrapper(); +}; + +typedef View> SimpleView; + +void ImplicitSimpleClassIterator() { + for (const ImplicitWrapper& foo : SimpleView()) {} + for (const ImplicitWrapper foo : SimpleView()) {} + for (ImplicitWrapper foo : SimpleView()) {} +} diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json new file mode 100644 index 000000000000..b4c58e1bc68c --- /dev/null +++ b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json @@ -0,0 +1 @@ +"[[\"warning\", \"the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value\", \"performance-implicit-conversion-in-loop\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.cpp b/tools/clang-tidy/test/performance-inefficient-algorithm.cpp new file mode 100644 index 000000000000..8893a6a4a0d7 --- /dev/null +++ b/tools/clang-tidy/test/performance-inefficient-algorithm.cpp @@ -0,0 +1,31 @@ +namespace std { +template struct less { + bool operator()(const T &lhs, const T &rhs) { return lhs < rhs; } +}; + +template struct greater { + bool operator()(const T &lhs, const T &rhs) { return lhs > rhs; } +}; + +struct iterator_type {}; + +template > struct set { + typedef iterator_type iterator; + iterator find(const K &k); + unsigned count(const K &k); + + iterator begin(); + iterator end(); + iterator begin() const; + iterator end() const; +}; + +template +FwIt find(FwIt, FwIt end, const K &) { return end; } +} + +template void f(const T &t) { + std::set s; + find(s.begin(), s.end(), 46); +} + diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.json b/tools/clang-tidy/test/performance-inefficient-algorithm.json new file mode 100644 index 000000000000..95c55fcb6c41 --- /dev/null +++ b/tools/clang-tidy/test/performance-inefficient-algorithm.json @@ -0,0 +1 @@ +"[[\"warning\", \"this STL algorithm call should be replaced with a container method\", \"performance-inefficient-algorithm\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-move-const-arg.cpp b/tools/clang-tidy/test/performance-move-const-arg.cpp new file mode 100644 index 000000000000..a2d72ed6306b --- /dev/null +++ b/tools/clang-tidy/test/performance-move-const-arg.cpp @@ -0,0 +1,22 @@ +namespace std { +template +struct remove_reference { + typedef _Tp type; +}; + +template +constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) { + return static_cast::type &&>(__t); +} +} // namespace std + +struct TriviallyCopyable { + int i; +}; + +void f(TriviallyCopyable) {} + +void g() { + TriviallyCopyable obj; + f(std::move(obj)); +} diff --git a/tools/clang-tidy/test/performance-move-const-arg.json b/tools/clang-tidy/test/performance-move-const-arg.json new file mode 100644 index 000000000000..27d8e03b20d8 --- /dev/null +++ b/tools/clang-tidy/test/performance-move-const-arg.json @@ -0,0 +1 @@ +"[[\"warning\", \"std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move()\", \"performance-move-const-arg\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-move-constructor-init.cpp b/tools/clang-tidy/test/performance-move-constructor-init.cpp new file mode 100644 index 000000000000..243b399e9505 --- /dev/null +++ b/tools/clang-tidy/test/performance-move-constructor-init.cpp @@ -0,0 +1,11 @@ +struct B { + B() {} + B(const B&) {} + B(B &&) {} +}; + +struct D : B { + D() : B() {} + D(const D &RHS) : B(RHS) {} + D(D &&RHS) : B(RHS) {} +}; diff --git a/tools/clang-tidy/test/performance-move-constructor-init.json b/tools/clang-tidy/test/performance-move-constructor-init.json new file mode 100644 index 000000000000..8e86975370b2 --- /dev/null +++ b/tools/clang-tidy/test/performance-move-constructor-init.json @@ -0,0 +1 @@ +"[[\"warning\", \"move constructor initializes base class by calling a copy constructor\", \"performance-move-constructor-init\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp b/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp new file mode 100644 index 000000000000..8b4900b00d62 --- /dev/null +++ b/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp @@ -0,0 +1,4 @@ +class A { + A(A &&); + A &operator=(A &&); +}; diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.json b/tools/clang-tidy/test/performance-noexcept-move-constructor.json new file mode 100644 index 000000000000..e970af7b10d3 --- /dev/null +++ b/tools/clang-tidy/test/performance-noexcept-move-constructor.json @@ -0,0 +1 @@ +"[[\"warning\", \"move constructors should be marked noexcept\", \"performance-noexcept-move-constructor\"], [\"warning\", \"move assignment operators should be marked noexcept\", \"performance-noexcept-move-constructor\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp b/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp new file mode 100644 index 000000000000..95f13b994cb7 --- /dev/null +++ b/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp @@ -0,0 +1,11 @@ +struct C { + static int x; +}; + +int C::x = 0; + +// Expressions with side effects +C &f(int, int, int, int); +void g() { + f(1, 2, 3, 4).x; +} diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.json b/tools/clang-tidy/test/readability-static-accessed-through-instance.json new file mode 100644 index 000000000000..8fc304a56a5f --- /dev/null +++ b/tools/clang-tidy/test/readability-static-accessed-through-instance.json @@ -0,0 +1 @@ +"[[\"warning\", \"static member accessed through instance\", \"readability-static-accessed-through-instance\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/structures.h b/tools/clang-tidy/test/structures.h index d2df400f1e52..0966109635fd 100644 --- a/tools/clang-tidy/test/structures.h +++ b/tools/clang-tidy/test/structures.h @@ -81,6 +81,10 @@ bind_rt bind(Fp &&, Arguments &&...); typedef unsigned int uid_t; typedef unsigned int pid_t; +int bcmp(void *, void *, size_t); +void bcopy(void *, void *, size_t); +void bzero(void *, size_t); + int getpw(uid_t uid, char *buf); int setuid(uid_t uid); From 5dae2f12c657a905ccb69cd27c52013feae9be1e Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 28 Aug 2018 13:54:34 +0000 Subject: [PATCH 40/64] Bug 1486757 - Check that pageInfo is also valid in waitForAnnotation in downloads's head.js to avoid intermittents. r=paolo Differential Revision: https://phabricator.services.mozilla.com/D4442 --HG-- extra : moz-landing-system : lando --- toolkit/components/downloads/test/unit/head.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/downloads/test/unit/head.js b/toolkit/components/downloads/test/unit/head.js index f17840c8266d..74712596b6d0 100644 --- a/toolkit/components/downloads/test/unit/head.js +++ b/toolkit/components/downloads/test/unit/head.js @@ -589,7 +589,7 @@ function isValidDate(aDate) { function waitForAnnotation(sourceUriSpec, annotationName) { return TestUtils.waitForCondition(async () => { let pageInfo = await PlacesUtils.history.fetch(sourceUriSpec, {includeAnnotations: true}); - return pageInfo.annotations.has(annotationName); + return pageInfo && pageInfo.annotations.has(annotationName); }, `Should have found annotation ${annotationName} for ${sourceUriSpec}`); } From dd1853e164581eaef2c99424304a3d55543461c9 Mon Sep 17 00:00:00 2001 From: Nicholas Hurley Date: Mon, 27 Aug 2018 18:56:44 +0000 Subject: [PATCH 41/64] Bug 1483294 - Always advertise h2 if TLS 1.3 is being offered. r=dragana Previously (under TLS 1.2), we would avoid advertising h2 support if the spec-mandatory suite was disabled. That suite is only required for TLS 1.2, though. We would like to offer h2 in more cases, so only check for the mandatory suite if someone has turned off TLS 1.3. Differential Revision: https://phabricator.services.mozilla.com/D4345 --HG-- extra : moz-landing-system : lando --- netwerk/protocol/http/Http2Session.cpp | 12 +++++++----- netwerk/test/unit/test_http2.js | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 0701ee312cd0..7106fea096d0 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -4137,16 +4137,18 @@ Http2Session::BufferOutput(const char *buf, bool // static Http2Session::ALPNCallback(nsISupports *securityInfo) { - if (!gHttpHandler->IsH2MandatorySuiteEnabled()) { - LOG3(("Http2Session::ALPNCallback Mandatory Cipher Suite Unavailable\n")); - return false; - } - nsCOMPtr ssl = do_QueryInterface(securityInfo); LOG3(("Http2Session::ALPNCallback sslsocketcontrol=%p\n", ssl.get())); if (ssl) { int16_t version = ssl->GetSSLVersionOffered(); LOG3(("Http2Session::ALPNCallback version=%x\n", version)); + + if (version == nsISSLSocketControl::TLS_VERSION_1_2 && + !gHttpHandler->IsH2MandatorySuiteEnabled()) { + LOG3(("Http2Session::ALPNCallback Mandatory Cipher Suite Unavailable\n")); + return false; + } + if (version >= nsISSLSocketControl::TLS_VERSION_1_2) { return true; } diff --git a/netwerk/test/unit/test_http2.js b/netwerk/test/unit/test_http2.js index 2990c8214e71..5db8b2624ed0 100644 --- a/netwerk/test/unit/test_http2.js +++ b/netwerk/test/unit/test_http2.js @@ -789,15 +789,29 @@ WrongSuiteListener.prototype = new Http2CheckListener(); WrongSuiteListener.prototype.shouldBeHttp2 = false; WrongSuiteListener.prototype.onStopRequest = function(request, ctx, status) { prefs.setBoolPref("security.ssl3.ecdhe_rsa_aes_128_gcm_sha256", true); + prefs.clearUserPref("security.tls.version.max"); Http2CheckListener.prototype.onStopRequest.call(this); }; -// test that we use h1 without the mandatory cipher suite available -function test_http2_wrongsuite() { +// test that we use h1 without the mandatory cipher suite available when +// offering at most tls1.2 +function test_http2_wrongsuite_tls12() { + prefs.setBoolPref("security.ssl3.ecdhe_rsa_aes_128_gcm_sha256", false); + prefs.setIntPref("security.tls.version.max", 3); + var chan = makeChan("https://localhost:" + serverPort + "/wrongsuite"); + chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION | Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI; + var listener = new WrongSuiteListener(); + chan.asyncOpen2(listener); +} + +// test that we use h2 when offering tls1.3 or higher regardless of if the +// mandatory cipher suite is available +function test_http2_wrongsuite_tls13() { prefs.setBoolPref("security.ssl3.ecdhe_rsa_aes_128_gcm_sha256", false); var chan = makeChan("https://localhost:" + serverPort + "/wrongsuite"); chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION | Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI; var listener = new WrongSuiteListener(); + listener.shouldBeHttp2 = true; chan.asyncOpen2(listener); } @@ -1145,7 +1159,8 @@ var tests = [ test_http2_post_big , test_http2_h11required_stream , test_http2_h11required_session , test_http2_retry_rst - , test_http2_wrongsuite + , test_http2_wrongsuite_tls12 + , test_http2_wrongsuite_tls13 , test_http2_push_firstparty1 , test_http2_push_firstparty2 , test_http2_push_firstparty3 From 16c9e3c5c9f05d127b3dc7af629f1141e48595db Mon Sep 17 00:00:00 2001 From: Preeti Mukherjee Date: Tue, 28 Aug 2018 05:16:26 +0000 Subject: [PATCH 42/64] Bug 696385 - change dom.a to dom.span in mozilla-central/devtools/client/webconsole/components/message-types/NetworkEventMessage.js#109; r=nchevobbe MozReview-Commit-ID: 2PBUG8yQIXY Differential Revision: https://phabricator.services.mozilla.com/D4136 --HG-- extra : moz-landing-system : lando --- devtools/client/themes/webconsole.css | 3 +++ .../webconsole/components/message-types/NetworkEventMessage.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/client/themes/webconsole.css b/devtools/client/themes/webconsole.css index c5a3265be29c..5c6bb9bfec8d 100644 --- a/devtools/client/themes/webconsole.css +++ b/devtools/client/themes/webconsole.css @@ -285,15 +285,18 @@ a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + cursor: default; } .message.network .status { flex: none; margin-inline-start: 6px; + cursor: default; } .message.network.mixed-content .url { color: var(--theme-highlight-red); + cursor: default; } .message .learn-more-link { diff --git a/devtools/client/webconsole/components/message-types/NetworkEventMessage.js b/devtools/client/webconsole/components/message-types/NetworkEventMessage.js index 3e5ec50e032d..55f442552eb2 100644 --- a/devtools/client/webconsole/components/message-types/NetworkEventMessage.js +++ b/devtools/client/webconsole/components/message-types/NetworkEventMessage.js @@ -106,7 +106,7 @@ function NetworkEventMessage({ const xhr = isXHR ? dom.span({ className: "xhr" }, l10n.getStr("webConsoleXhrIndicator")) : null; - const requestUrl = dom.a({ className: "url", title: request.url, onClick: toggle }, + const requestUrl = dom.span({ className: "url", title: request.url, onClick: toggle }, request.url); const statusBody = statusInfo ? dom.a({ className: "status", onClick: toggle }, statusInfo) From 4bf90558627ca8613ef30e63b599164eccf2ad61 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 27 Aug 2018 18:12:16 +0000 Subject: [PATCH 43/64] Bug 1485592 - Avoid isdigit() in sdp_utils.c. r=drno This fixes two problems: 1) On Windows, isdigit() is locale-dependent. 2) On platforms where char is signed, sign-extending char to int and passing the result to isdigit() was UB when the high bit was set, because isdigit() is defined to take a (signed) int with the value space of unsigned char or EOF. MozReview-Commit-ID: D1lY88PEcpc Differential Revision: https://phabricator.services.mozilla.com/D4316 --HG-- extra : moz-landing-system : lando --- .../signaling/src/sdp/sipcc/sdp_utils.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c index 4d46115574dc..bcdae9d92263 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c +++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c @@ -15,6 +15,13 @@ static const char* logTag = "sdp_utils"; +// Actually checks for ASCII only unlike isdigit() on Windows. +// Also avoids UB issues with isdigit() sign extension when +// char is signed. +int sdp_is_ascii_digit(const char c) { + return '0' <= c && c <= '9'; +} + sdp_mca_t *sdp_alloc_mca (uint32_t line) { sdp_mca_t *mca_p; @@ -155,7 +162,7 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, uint16_t *mkiLen) ptr = buf; /* MKI must begin with a digit */ - if (!ptr || (!isdigit((int) *ptr))) { + if (!ptr || (!sdp_is_ascii_digit(*ptr))) { return FALSE; } @@ -166,7 +173,7 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, uint16_t *mkiLen) mkiValBuf[idx] = 0; ptr++; break; - } else if ((isdigit((int) *ptr) && (idx < SDP_SRTP_MAX_MKI_SIZE_BYTES-1))) { + } else if ((sdp_is_ascii_digit(*ptr) && (idx < SDP_SRTP_MAX_MKI_SIZE_BYTES-1))) { mkiValBuf[idx++] = *ptr; } else { return FALSE; @@ -184,7 +191,7 @@ verify_sdescriptions_mki (char *buf, char *mkiVal, uint16_t *mkiLen) /* verify the mki length (max 3 digits) */ while (*ptr) { - if (isdigit((int) *ptr) && (idx < 3)) { + if (sdp_is_ascii_digit(*ptr) && (idx < 3)) { mkiLenBuf[idx++] = *ptr; } else { return FALSE; @@ -251,7 +258,7 @@ verify_sdescriptions_lifetime (char *buf) return FALSE; } } - } else if (!isdigit((int) *ptr)) { + } else if (!sdp_is_ascii_digit(*ptr)) { return FALSE; } @@ -282,13 +289,13 @@ sdp_validate_maxprate(const char *string_parm) tinybool retval = FALSE; if (string_parm && (*string_parm)) { - while (isdigit((int)*string_parm)) { + while (sdp_is_ascii_digit(*string_parm)) { string_parm++; } if (*string_parm == '.') { string_parm++; - while (isdigit((int)*string_parm)) { + while (sdp_is_ascii_digit(*string_parm)) { string_parm++; } } From 403b2ebd260449067c5e766cfbf0f90206eb2667 Mon Sep 17 00:00:00 2001 From: Csoregi Natalia Date: Tue, 28 Aug 2018 18:25:24 +0300 Subject: [PATCH 44/64] Backed out changeset f4739ab0ece1 (bug 1459065) for /svg/filters/ failures. CLOSED TREE --- layout/painting/nsDisplayList.cpp | 42 +++--------------- .../svg/filters/css-filters/reftest.list | 4 +- testing/web-platform/meta/MANIFEST.json | 43 +------------------ .../blur-clip-stacking-context-001.html | 35 --------------- .../blur-clip-stacking-context-002.html | 28 ------------ .../blur-clip-stacking-context-ref.html | 14 ------ 6 files changed, 8 insertions(+), 158 deletions(-) delete mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html delete mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html delete mode 100644 testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 3795f9af882c..3c902a103e25 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -9421,8 +9421,8 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder { bool snap; float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect displayBounds = GetBounds(aDisplayListBuilder, &snap); - LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBounds, appUnitsPerDevPixel); + nsRect displayBound = GetBounds(aDisplayListBuilder, &snap); + LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBound, appUnitsPerDevPixel); Maybe mask = aManager->CommandBuilder().BuildWrMaskImage(this, aBuilder, aResources, aSc, aDisplayListBuilder, @@ -9455,9 +9455,7 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder /*aTransformForScrollData: */ Nothing(), /*aClipNodeId: */ &clipId); sc = layer.ptr(); - // The whole stacking context will be clipped by us, so no need to have any - // parent for the children context's clip. - aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Nothing()); + aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Some(clipId)); } nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aResources, *sc, aManager, aDisplayListBuilder); @@ -9737,41 +9735,11 @@ nsDisplayFilter::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild } } - bool snap; - float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - nsRect displayBounds = GetBounds(aDisplayListBuilder, &snap); - auto bounds = LayoutDeviceRect::FromAppUnits(displayBounds, auPerDevPixel); - // NOTE(emilio): this clip is going to be intersected with the clip that's - // currently on the clip stack for this item. - // - // FIXME(emilio, bug 1486557): clipping to "bounds" isn't really necessary. - wr::WrClipId clipId = - aBuilder.DefineClip(Nothing(), wr::ToRoundedLayoutRect(bounds)); - float opacity = mFrame->StyleEffects()->mOpacity; - StackingContextHelper sc( - aSc, - aBuilder, - wrFilters, - LayoutDeviceRect(), - nullptr, - nullptr, - opacity != 1.0f && mHandleOpacity ? &opacity : nullptr, - nullptr, - nullptr, - gfx::CompositionOp::OP_OVER, - true, - false, - Nothing(), - &clipId); - - // The whole stacking context will be clipped by us, so no need to have any - // parent for the children context's clip. - aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(), Nothing()); + StackingContextHelper sc(aSc, aBuilder, wrFilters, LayoutDeviceRect(), nullptr, + nullptr, opacity != 1.0f && mHandleOpacity ? &opacity : nullptr); nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aResources, sc, aManager, aDisplayListBuilder); - - aManager->CommandBuilder().PopOverrideForASR(GetActiveScrolledRoot()); return true; } diff --git a/layout/reftests/svg/filters/css-filters/reftest.list b/layout/reftests/svg/filters/css-filters/reftest.list index a598cef0a577..ec8b9668c090 100644 --- a/layout/reftests/svg/filters/css-filters/reftest.list +++ b/layout/reftests/svg/filters/css-filters/reftest.list @@ -7,12 +7,12 @@ fuzzy-if(webrender,9-9,4780-4784) == blur.html blur-ref.html == blur.svg blur-ref.svg == blur-calc.html blur-calc-ref.html == blur-calc-negative.html blur-calc-negative-ref.html -fuzzy-if(webrender,3-3,55913-55913) skip-if(d2d) == blur-cap-large-radius-on-software.html blur-cap-large-radius-on-software-ref.html +skip-if(d2d) == blur-cap-large-radius-on-software.html blur-cap-large-radius-on-software-ref.html fuzzy-if(webrender,9-9,4780-4784) == blur-em-radius.html blur-em-radius-ref.html == blur-invalid-radius.html blur-invalid-radius-ref.html fuzzy-if(webrender,9-9,4780-4784) == blur-rem-radius.html blur-rem-radius-ref.html == blur-zero-radius.html blur-zero-radius-ref.html -fuzzy-if(webrender,5-7,20420-21308) == blur-zoomed-page.html blur-zoomed-page-ref.html +fuzzy-if(webrender,6-7,20420-21308) == blur-zoomed-page.html blur-zoomed-page-ref.html == brightness.html brightness-ref.html == brightness-darken.html brightness-darken-ref.html == brightness-extreme.html brightness-extreme-ref.html diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 75cda1591a4f..ea0cbe189434 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -112915,30 +112915,6 @@ {} ] ], - "css/css-filter/blur-clip-stacking-context-001.html": [ - [ - "/css/css-filter/blur-clip-stacking-context-001.html", - [ - [ - "/css/css-filter/blur-clip-stacking-context-ref.html", - "==" - ] - ], - {} - ] - ], - "css/css-filter/blur-clip-stacking-context-002.html": [ - [ - "/css/css-filter/blur-clip-stacking-context-002.html", - [ - [ - "/css/css-filter/blur-clip-stacking-context-ref.html", - "!=" - ] - ], - {} - ] - ], "css/css-filter/filtered-block-is-container.html": [ [ "/css/css-filter/filtered-block-is-container.html", @@ -244097,11 +244073,6 @@ {} ] ], - "css/css-filter/blur-clip-stacking-context-ref.html": [ - [ - {} - ] - ], "css/css-filter/filtered-block-is-container-ref.html": [ [ {} @@ -521866,7 +521837,7 @@ "reftest" ], "css/css-display/display-contents-fieldset-nested-legend-ref.html": [ - "c4afe0e53ba02d47bc0704eb71801aec602759be", + "6f547b3201c3b3c2521102ecbcf144df28447f7a", "support" ], "css/css-display/display-contents-fieldset-nested-legend.html": [ @@ -523173,18 +523144,6 @@ "8d0683319b0fbbd1262cbdd12cdbcb727b2aa9a0", "support" ], - "css/css-filter/blur-clip-stacking-context-001.html": [ - "48c1bae3042b6912ba5edd7ae74c190e5bd8f2d2", - "reftest" - ], - "css/css-filter/blur-clip-stacking-context-002.html": [ - "f4df453b17b86a6da67c4cf5f71261e9315eab95", - "reftest" - ], - "css/css-filter/blur-clip-stacking-context-ref.html": [ - "82b907334fd71791cd2f6530e2e85169e29afa41", - "support" - ], "css/css-filter/filtered-block-is-container-ref.html": [ "fc9467f8717dfc722dcb6dbbbb31bfd8c2baee3b", "support" diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html deleted file mode 100644 index a96994a8afe1..000000000000 --- a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-001.html +++ /dev/null @@ -1,35 +0,0 @@ - -CSS Test: Blurs are correctly clipped by an overflow: hidden ancestor - - - - - - -
-
diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html deleted file mode 100644 index 0473f1294944..000000000000 --- a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-002.html +++ /dev/null @@ -1,28 +0,0 @@ - -CSS Test: Blurs on an overflow: hidden element are correctly not-clipped to the padding box - - - - - - -
-
diff --git a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html b/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html deleted file mode 100644 index 82b907334fd7..000000000000 --- a/testing/web-platform/tests/css/css-filter/blur-clip-stacking-context-ref.html +++ /dev/null @@ -1,14 +0,0 @@ - -CSS Test Reference - - -
From 294c48bb262624e4d4dd43dd7e1f5a794611ab45 Mon Sep 17 00:00:00 2001 From: Margareta Eliza Balazs Date: Tue, 28 Aug 2018 18:28:41 +0300 Subject: [PATCH 45/64] Backed out changeset f9d93a20e6d6 (bug 1486410) for Sa failures error: clang-tidy auto-test failed for checker performance-inefficient-algorithm CLOSED TREE --HG-- extra : rebase_source : b7234db6fde4e4ec59933e20f10820f5a8fc82ec --- tools/clang-tidy/config.yaml | 24 +++-------- ...ang-analyzer-security.insecureAPI.bcmp.cpp | 6 --- ...ng-analyzer-security.insecureAPI.bcmp.json | 1 - ...ng-analyzer-security.insecureAPI.bcopy.cpp | 6 --- ...g-analyzer-security.insecureAPI.bcopy.json | 1 - ...ng-analyzer-security.insecureAPI.bzero.cpp | 6 --- ...g-analyzer-security.insecureAPI.bzero.json | 1 - ...erformance-implicit-conversion-in-loop.cpp | 43 ------------------- ...rformance-implicit-conversion-in-loop.json | 1 - .../performance-inefficient-algorithm.cpp | 31 ------------- .../performance-inefficient-algorithm.json | 1 - .../test/performance-move-const-arg.cpp | 22 ---------- .../test/performance-move-const-arg.json | 1 - .../performance-move-constructor-init.cpp | 11 ----- .../performance-move-constructor-init.json | 1 - .../performance-noexcept-move-constructor.cpp | 4 -- ...performance-noexcept-move-constructor.json | 1 - ...ility-static-accessed-through-instance.cpp | 11 ----- ...lity-static-accessed-through-instance.json | 1 - tools/clang-tidy/test/structures.h | 4 -- 20 files changed, 6 insertions(+), 171 deletions(-) delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp delete mode 100644 tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json delete mode 100644 tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp delete mode 100644 tools/clang-tidy/test/performance-implicit-conversion-in-loop.json delete mode 100644 tools/clang-tidy/test/performance-inefficient-algorithm.cpp delete mode 100644 tools/clang-tidy/test/performance-inefficient-algorithm.json delete mode 100644 tools/clang-tidy/test/performance-move-const-arg.cpp delete mode 100644 tools/clang-tidy/test/performance-move-const-arg.json delete mode 100644 tools/clang-tidy/test/performance-move-constructor-init.cpp delete mode 100644 tools/clang-tidy/test/performance-move-constructor-init.json delete mode 100644 tools/clang-tidy/test/performance-noexcept-move-constructor.cpp delete mode 100644 tools/clang-tidy/test/performance-noexcept-move-constructor.json delete mode 100644 tools/clang-tidy/test/readability-static-accessed-through-instance.cpp delete mode 100644 tools/clang-tidy/test/readability-static-accessed-through-instance.json diff --git a/tools/clang-tidy/config.yaml b/tools/clang-tidy/config.yaml index 0092afa71df8..02f2f691ff2e 100644 --- a/tools/clang-tidy/config.yaml +++ b/tools/clang-tidy/config.yaml @@ -43,12 +43,6 @@ clang_checkers: publish: !!bool yes - name: clang-analyzer-security.FloatLoopCounter publish: !!bool yes - - name: clang-analyzer-security.insecureAPI.bcmp - publish: !!bool yes - - name: clang-analyzer-security.insecureAPI.bcopy - publish: !!bool yes - - name: clang-analyzer-security.insecureAPI.bzero - publish: !!bool yes - name: clang-analyzer-security.insecureAPI.getpw publish: !!bool yes # We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated. @@ -107,20 +101,13 @@ clang_checkers: publish: !!bool yes - name: performance-for-range-copy publish: !!bool yes - - name: performance-implicit-conversion-in-loop - publish: !!bool yes - - name: performance-inefficient-algorithm - publish: !!bool yes + # Only available from clang tidy 6.0. We are currently using 5.0 + # - name: performance-implicit-conversion-in-loop + # publish: !!bool yes - name: performance-inefficient-string-concatenation publish: !!bool yes - name: performance-inefficient-vector-operation publish: !!bool yes - - name: performance-move-const-arg - publish: !!bool yes - - name: performance-move-constructor-init - publish: !!bool yes - - name: performance-noexcept-move-constructor - publish: !!bool yes - name: performance-type-promotion-in-math-fn publish: !!bool yes - name: performance-unnecessary-copy-initialization @@ -143,8 +130,9 @@ clang_checkers: publish: !!bool yes - name: readability-uniqueptr-delete-release publish: !!bool yes - - name: readability-static-accessed-through-instance - publish: !!bool yes +# Only available from clang tidy 6.0. We are currently using 5.0 +# - name: readability-static-accessed-through-instance +# publish: !!bool yes # Third party files from mozilla-central third_party: tools/rewriting/ThirdPartyPaths.txt diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp deleted file mode 100644 index 4a0d1c0c63fc..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "structures.h" - -int test_bcmp(void *a, void *b, size_t n) { - return bcmp(a, b, n); -} - diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json deleted file mode 100644 index a34c991e87b8..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"The bcmp() function is obsoleted by memcmp()\", \"clang-analyzer-security.insecureAPI.bcmp\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp deleted file mode 100644 index 28641653450f..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "structures.h" - -void test_bcopy(void *a, void *b, size_t n) { - bcopy(a, b, n); -} - diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json deleted file mode 100644 index 0ac72ad06d4f..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"The bcopy() function is obsoleted by memcpy() or memmove()\", \"clang-analyzer-security.insecureAPI.bcopy\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp deleted file mode 100644 index 5efa40c750b1..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "structures.h" - -void test_bzero(void *a, size_t n) { - bzero(a, n); -} - diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json deleted file mode 100644 index a22074f45da5..000000000000 --- a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"The bzero() function is obsoleted by memset()\", \"clang-analyzer-security.insecureAPI.bzero\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp deleted file mode 100644 index 75ed510f3f5a..000000000000 --- a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Iterator returning by value. -template -struct Iterator { - void operator++(); - T operator*(); - bool operator!=(const Iterator& other); -}; - -// The template argument is an iterator type, and a view is an object you can -// run a for loop on. -template -struct View { - T begin(); - T end(); -}; - -// With this class, the implicit conversion is a call to the (implicit) -// constructor of the class. -template -class ImplicitWrapper { - public: - // Implicit! - ImplicitWrapper(const T& t); -}; - -template -class OperatorWrapper { - public: - OperatorWrapper() = delete; -}; - -struct SimpleClass { - int foo; - operator OperatorWrapper(); -}; - -typedef View> SimpleView; - -void ImplicitSimpleClassIterator() { - for (const ImplicitWrapper& foo : SimpleView()) {} - for (const ImplicitWrapper foo : SimpleView()) {} - for (ImplicitWrapper foo : SimpleView()) {} -} diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json deleted file mode 100644 index b4c58e1bc68c..000000000000 --- a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value\", \"performance-implicit-conversion-in-loop\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.cpp b/tools/clang-tidy/test/performance-inefficient-algorithm.cpp deleted file mode 100644 index 8893a6a4a0d7..000000000000 --- a/tools/clang-tidy/test/performance-inefficient-algorithm.cpp +++ /dev/null @@ -1,31 +0,0 @@ -namespace std { -template struct less { - bool operator()(const T &lhs, const T &rhs) { return lhs < rhs; } -}; - -template struct greater { - bool operator()(const T &lhs, const T &rhs) { return lhs > rhs; } -}; - -struct iterator_type {}; - -template > struct set { - typedef iterator_type iterator; - iterator find(const K &k); - unsigned count(const K &k); - - iterator begin(); - iterator end(); - iterator begin() const; - iterator end() const; -}; - -template -FwIt find(FwIt, FwIt end, const K &) { return end; } -} - -template void f(const T &t) { - std::set s; - find(s.begin(), s.end(), 46); -} - diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.json b/tools/clang-tidy/test/performance-inefficient-algorithm.json deleted file mode 100644 index 95c55fcb6c41..000000000000 --- a/tools/clang-tidy/test/performance-inefficient-algorithm.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"this STL algorithm call should be replaced with a container method\", \"performance-inefficient-algorithm\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-move-const-arg.cpp b/tools/clang-tidy/test/performance-move-const-arg.cpp deleted file mode 100644 index a2d72ed6306b..000000000000 --- a/tools/clang-tidy/test/performance-move-const-arg.cpp +++ /dev/null @@ -1,22 +0,0 @@ -namespace std { -template -struct remove_reference { - typedef _Tp type; -}; - -template -constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) { - return static_cast::type &&>(__t); -} -} // namespace std - -struct TriviallyCopyable { - int i; -}; - -void f(TriviallyCopyable) {} - -void g() { - TriviallyCopyable obj; - f(std::move(obj)); -} diff --git a/tools/clang-tidy/test/performance-move-const-arg.json b/tools/clang-tidy/test/performance-move-const-arg.json deleted file mode 100644 index 27d8e03b20d8..000000000000 --- a/tools/clang-tidy/test/performance-move-const-arg.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move()\", \"performance-move-const-arg\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-move-constructor-init.cpp b/tools/clang-tidy/test/performance-move-constructor-init.cpp deleted file mode 100644 index 243b399e9505..000000000000 --- a/tools/clang-tidy/test/performance-move-constructor-init.cpp +++ /dev/null @@ -1,11 +0,0 @@ -struct B { - B() {} - B(const B&) {} - B(B &&) {} -}; - -struct D : B { - D() : B() {} - D(const D &RHS) : B(RHS) {} - D(D &&RHS) : B(RHS) {} -}; diff --git a/tools/clang-tidy/test/performance-move-constructor-init.json b/tools/clang-tidy/test/performance-move-constructor-init.json deleted file mode 100644 index 8e86975370b2..000000000000 --- a/tools/clang-tidy/test/performance-move-constructor-init.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"move constructor initializes base class by calling a copy constructor\", \"performance-move-constructor-init\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp b/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp deleted file mode 100644 index 8b4900b00d62..000000000000 --- a/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp +++ /dev/null @@ -1,4 +0,0 @@ -class A { - A(A &&); - A &operator=(A &&); -}; diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.json b/tools/clang-tidy/test/performance-noexcept-move-constructor.json deleted file mode 100644 index e970af7b10d3..000000000000 --- a/tools/clang-tidy/test/performance-noexcept-move-constructor.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"move constructors should be marked noexcept\", \"performance-noexcept-move-constructor\"], [\"warning\", \"move assignment operators should be marked noexcept\", \"performance-noexcept-move-constructor\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp b/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp deleted file mode 100644 index 95f13b994cb7..000000000000 --- a/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp +++ /dev/null @@ -1,11 +0,0 @@ -struct C { - static int x; -}; - -int C::x = 0; - -// Expressions with side effects -C &f(int, int, int, int); -void g() { - f(1, 2, 3, 4).x; -} diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.json b/tools/clang-tidy/test/readability-static-accessed-through-instance.json deleted file mode 100644 index 8fc304a56a5f..000000000000 --- a/tools/clang-tidy/test/readability-static-accessed-through-instance.json +++ /dev/null @@ -1 +0,0 @@ -"[[\"warning\", \"static member accessed through instance\", \"readability-static-accessed-through-instance\"]]" \ No newline at end of file diff --git a/tools/clang-tidy/test/structures.h b/tools/clang-tidy/test/structures.h index 0966109635fd..d2df400f1e52 100644 --- a/tools/clang-tidy/test/structures.h +++ b/tools/clang-tidy/test/structures.h @@ -81,10 +81,6 @@ bind_rt bind(Fp &&, Arguments &&...); typedef unsigned int uid_t; typedef unsigned int pid_t; -int bcmp(void *, void *, size_t); -void bcopy(void *, void *, size_t); -void bzero(void *, size_t); - int getpw(uid_t uid, char *buf); int setuid(uid_t uid); From 38831149e3f498e2aa2e62f094afe69386a2d47a Mon Sep 17 00:00:00 2001 From: Alphan Chen Date: Tue, 28 Aug 2018 06:28:56 +0000 Subject: [PATCH 46/64] Bug 1452569 - Implement Event's returnValue. r=smaug Add retrunValue into Event's interface Differential Revision: https://phabricator.services.mozilla.com/D4084 --HG-- extra : moz-landing-system : lando --- dom/events/Event.cpp | 14 ++++++++ dom/events/Event.h | 4 +++ dom/webidl/Event.webidl | 2 ++ .../AddEventListenerOptions-passive.html.ini | 4 --- .../dom/events/Event-constructors.html.ini | 7 ---- ...t-defaultPrevented-after-dispatch.html.ini | 4 --- .../meta/dom/events/Event-initEvent.html.ini | 13 ------- .../dom/events/Event-returnValue.html.ini | 19 ---------- ...tTarget-dispatchEvent-returnvalue.html.ini | 7 ---- .../web-platform/meta/dom/interfaces.html.ini | 35 ------------------- 10 files changed, 20 insertions(+), 89 deletions(-) delete mode 100644 testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini delete mode 100644 testing/web-platform/meta/dom/events/Event-constructors.html.ini delete mode 100644 testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini delete mode 100644 testing/web-platform/meta/dom/events/Event-initEvent.html.ini delete mode 100644 testing/web-platform/meta/dom/events/Event-returnValue.html.ini delete mode 100644 testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp index 4ffbaae6af63..663716ac3973 100644 --- a/dom/events/Event.cpp +++ b/dom/events/Event.cpp @@ -1003,6 +1003,20 @@ Event::DefaultPrevented(CallerType aCallerType) const aCallerType == CallerType::System; } +bool +Event::ReturnValue(CallerType aCallerType) const +{ + return !DefaultPrevented(aCallerType); +} + +void +Event::SetReturnValue(bool aReturnValue, CallerType aCallerType) +{ + if (!aReturnValue) { + PreventDefaultInternal(aCallerType == CallerType::System); + } +} + double Event::TimeStamp() { diff --git a/dom/events/Event.h b/dom/events/Event.h index f7a85688d06f..7b849c4b8eaa 100755 --- a/dom/events/Event.h +++ b/dom/events/Event.h @@ -281,6 +281,10 @@ public: return mEvent->mFlags.mMultipleActionsPrevented; } + bool ReturnValue(CallerType aCallerType) const; + + void SetReturnValue(bool aReturnValue, CallerType aCallerType); + bool IsTrusted() const { return mEvent->IsTrusted(); diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl index f66e084d8bfa..2d02ff7ef468 100644 --- a/dom/webidl/Event.webidl +++ b/dom/webidl/Event.webidl @@ -37,6 +37,8 @@ interface Event { [Pure] readonly attribute boolean cancelable; [NeedsCallerType] + attribute boolean returnValue; + [NeedsCallerType] void preventDefault(); [Pure, NeedsCallerType] readonly attribute boolean defaultPrevented; diff --git a/testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini b/testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini deleted file mode 100644 index daa2db61f616..000000000000 --- a/testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[AddEventListenerOptions-passive.html] - [returnValue should be ignored if-and-only-if the passive option is true] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/events/Event-constructors.html.ini b/testing/web-platform/meta/dom/events/Event-constructors.html.ini deleted file mode 100644 index 69db3949a539..000000000000 --- a/testing/web-platform/meta/dom/events/Event-constructors.html.ini +++ /dev/null @@ -1,7 +0,0 @@ -[Event-constructors.html] - [Event constructors 2] - expected: FAIL - - [Event constructors 3] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini b/testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini deleted file mode 100644 index 5187ca566809..000000000000 --- a/testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[Event-defaultPrevented-after-dispatch.html] - [Default prevention via returnValue] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/events/Event-initEvent.html.ini b/testing/web-platform/meta/dom/events/Event-initEvent.html.ini deleted file mode 100644 index 0b4ce51d9406..000000000000 --- a/testing/web-platform/meta/dom/events/Event-initEvent.html.ini +++ /dev/null @@ -1,13 +0,0 @@ -[Event-initEvent.html] - [Properties of initEvent(type, true, true)] - expected: FAIL - - [Properties of initEvent(type, true, false)] - expected: FAIL - - [Properties of initEvent(type, false, true)] - expected: FAIL - - [Properties of initEvent(type, false, false)] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/events/Event-returnValue.html.ini b/testing/web-platform/meta/dom/events/Event-returnValue.html.ini deleted file mode 100644 index e9c34f6438f4..000000000000 --- a/testing/web-platform/meta/dom/events/Event-returnValue.html.ini +++ /dev/null @@ -1,19 +0,0 @@ -[Event-returnValue.html] - [When an event is created, returnValue should be initialized to true.] - expected: FAIL - - [preventDefault() should not change returnValue if cancelable is false.] - expected: FAIL - - [returnValue=false should have no effect if cancelable is false.] - expected: FAIL - - [preventDefault() should change returnValue if cancelable is true.] - expected: FAIL - - [initEvent should unset returnValue.] - expected: FAIL - - [returnValue=true should have no effect once the canceled flag was set.] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini deleted file mode 100644 index 5fe7e8ffe604..000000000000 --- a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini +++ /dev/null @@ -1,7 +0,0 @@ -[EventTarget-dispatchEvent-returnvalue.html] - [Return value of EventTarget.dispatchEvent() affected by preventDefault().] - expected: FAIL - - [Return value of EventTarget.dispatchEvent() affected by returnValue.] - expected: FAIL - diff --git a/testing/web-platform/meta/dom/interfaces.html.ini b/testing/web-platform/meta/dom/interfaces.html.ini index 72558edf059f..e1543cbd5a99 100644 --- a/testing/web-platform/meta/dom/interfaces.html.ini +++ b/testing/web-platform/meta/dom/interfaces.html.ini @@ -87,17 +87,6 @@ [Range interface: existence and properties of interface prototype object] expected: FAIL - [Event interface: attribute returnValue] - expected: FAIL - - [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new Event("foo") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type] - expected: FAIL [interfaces.html?1-1000] @@ -115,19 +104,6 @@ expected: FAIL -[interfaces.html?exclude=Node] - [Event interface: attribute returnValue] - expected: FAIL - - [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new Event("foo") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type] - expected: FAIL - [Document interface: attribute origin] expected: FAIL @@ -198,17 +174,6 @@ [interfaces.html?include=Node] [interfaces.html?exclude=Node] - [Event interface: attribute returnValue] - expected: FAIL - - [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new Event("foo") must inherit property "returnValue" with the proper type] - expected: FAIL - - [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type] - expected: FAIL [Document interface: attribute origin] expected: FAIL From 5bf3453bc2578068ffa5f531d6028fd94f0c0c04 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 27 Aug 2018 18:20:17 +0000 Subject: [PATCH 47/64] Bug 1486547 - renamed the mState field on generated protocol classes; r=froydnj There's also a field named mState on IProtocol, and this reduces confusion. Differential Revision: https://phabricator.services.mozilla.com/D4356 --HG-- extra : moz-landing-system : lando --- ipc/glue/ProtocolUtils.cpp | 20 ++++++++++---------- ipc/glue/ProtocolUtils.h | 8 ++++---- ipc/ipdl/ipdl/lower.py | 12 ++++++------ ipc/ipdl/test/cxx/PTestSyncHang.ipdl | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp index 07be2c37a478..ad1d2ba3b7bc 100644 --- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -358,15 +358,15 @@ SentinelReadError(const char* aClassName) } bool -StateTransition(bool aIsDelete, State* aNext) +StateTransition(bool aIsDelete, LivenessState* aNext) { switch (*aNext) { - case State::Null: + case LivenessState::Null: if (aIsDelete) { - *aNext = State::Dead; + *aNext = LivenessState::Dead; } break; - case State::Dead: + case LivenessState::Dead: return false; default: return false; @@ -377,19 +377,19 @@ StateTransition(bool aIsDelete, State* aNext) bool ReEntrantDeleteStateTransition(bool aIsDelete, bool aIsDeleteReply, - ReEntrantDeleteState* aNext) + ReEntrantDeleteLivenessState* aNext) { switch (*aNext) { - case ReEntrantDeleteState::Null: + case ReEntrantDeleteLivenessState::Null: if (aIsDelete) { - *aNext = ReEntrantDeleteState::Dying; + *aNext = ReEntrantDeleteLivenessState::Dying; } break; - case ReEntrantDeleteState::Dead: + case ReEntrantDeleteLivenessState::Dead: return false; - case ReEntrantDeleteState::Dying: + case ReEntrantDeleteLivenessState::Dying: if (aIsDeleteReply) { - *aNext = ReEntrantDeleteState::Dead; + *aNext = ReEntrantDeleteLivenessState::Dead; } break; default: diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h index 988a9d77ce74..32e42abc7ed4 100644 --- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -773,7 +773,7 @@ DuplicateHandle(HANDLE aSourceHandle, */ void AnnotateSystemError(); -enum class State +enum class LivenessState { Dead, Null, @@ -781,9 +781,9 @@ enum class State }; bool -StateTransition(bool aIsDelete, State* aNext); +StateTransition(bool aIsDelete, LivenessState* aNext); -enum class ReEntrantDeleteState +enum class ReEntrantDeleteLivenessState { Dead, Null, @@ -794,7 +794,7 @@ enum class ReEntrantDeleteState bool ReEntrantDeleteStateTransition(bool aIsDelete, bool aIsDeleteReply, - ReEntrantDeleteState* aNext); + ReEntrantDeleteLivenessState* aNext); /** * An endpoint represents one end of a partially initialized IPDL channel. To diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index fc554a456a24..ee7d20b10d98 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -153,7 +153,7 @@ def _actorManager(actor): def _actorState(actor): - return ExprSelect(actor, '->', 'mState') + return ExprSelect(actor, '->', 'mLivenessState') def _backstagePass(): @@ -1182,9 +1182,9 @@ def _subtreeUsesShmem(p): def _stateType(hasReentrantDelete): if hasReentrantDelete: - return Type('mozilla::ipc::ReEntrantDeleteState') + return Type('mozilla::ipc::ReEntrantDeleteLivenessState') else: - return Type('mozilla::ipc::State') + return Type('mozilla::ipc::LivenessState') def _startState(hasReentrantDelete): @@ -1310,8 +1310,8 @@ class Protocol(ipdl.ast.Protocol): def stateVar(self, actorThis=None): if actorThis is not None: - return ExprSelect(actorThis, '->', 'mState') - return ExprVar('mState') + return ExprSelect(actorThis, '->', 'mLivenessState') + return ExprVar('mLivenessState') def fqStateType(self): return _stateType(self.decl.type.hasReentrantDelete) @@ -3464,7 +3464,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): if ptype.hasReentrantDelete: msgVar = ExprVar(params[0].name) ifdying = StmtIf(ExprBinary( - ExprBinary(ExprVar('mState'), '==', self.protocol.dyingState()), + ExprBinary(ExprVar('mLivenessState'), '==', self.protocol.dyingState()), '&&', ExprBinary( ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_reply')), diff --git a/ipc/ipdl/test/cxx/PTestSyncHang.ipdl b/ipc/ipdl/test/cxx/PTestSyncHang.ipdl index 2dc51dd640cd..ebb340bf4f37 100644 --- a/ipc/ipdl/test/cxx/PTestSyncHang.ipdl +++ b/ipc/ipdl/test/cxx/PTestSyncHang.ipdl @@ -7,7 +7,7 @@ protocol PTestSyncHang { child: // Add this unused message so we don't get compiler errors - // complaining that mState is an unused private field. + // complaining that mLivenessState is an unused private field. async UnusedMessage(); }; From 8e0cd59f7c7ddce8141e5a457032384a924c2200 Mon Sep 17 00:00:00 2001 From: Daosheng Mu Date: Mon, 27 Aug 2018 20:51:16 +0000 Subject: [PATCH 48/64] Bug 1485388 - Checking VRGPUChild is created before asking stop VRService. r=kip MozReview-Commit-ID: 8NM2bcmqVAa Differential Revision: https://phabricator.services.mozilla.com/D4054 --HG-- extra : moz-landing-system : lando --- gfx/vr/VRManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gfx/vr/VRManager.cpp b/gfx/vr/VRManager.cpp index 2fa59946af7e..dd0983c88325 100644 --- a/gfx/vr/VRManager.cpp +++ b/gfx/vr/VRManager.cpp @@ -177,7 +177,8 @@ VRManager::Shutdown() if (mVRService) { mVRService->Stop(); } - if (gfxPrefs::VRProcessEnabled()) { + if (gfxPrefs::VRProcessEnabled() && + VRGPUChild::IsCreated()) { RefPtr task = NS_NewRunnableFunction( "VRGPUChild::SendStopVRService", [] () -> void { From a1f03332c28cdd9138a0c87208db8325a02ccbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 28 Aug 2018 09:06:08 +0000 Subject: [PATCH 49/64] Bug 1486488 - Don't assume that SVGAnimationElement has a parent on bind. r=dholbert This is a regression from bug 1450250, which removed a if (!GetCx()) early return in this function. That early return was wrong, both because it prevented elements that were in shadow trees from targeting other elements, but also because that check was not present in AfterSetAttr, which means that dynamic updates to the attribute would work. Pass the SVGAnimationElement itself to resolve references. That's what we do for attribute mutations, and also it's the same behavior we have, since the ID lookup IDTracker does only depends on containing shadow root and containing document, and that's invariant between a kid and it's DOM parent. Some other code has been updated to take references instead of pointers so the null-safety of those methods is explicit. Differential Revision: https://phabricator.services.mozilla.com/D4349 --HG-- extra : moz-landing-system : lando --- dom/base/IDTracker.cpp | 7 ++----- dom/base/IDTracker.h | 2 +- dom/smil/nsSMILTimeValueSpec.cpp | 16 +++++++-------- dom/smil/nsSMILTimeValueSpec.h | 6 +++--- dom/smil/nsSMILTimedElement.cpp | 31 +++++++++++++++--------------- dom/smil/nsSMILTimedElement.h | 27 +++++++++++++------------- dom/svg/SVGAnimationElement.cpp | 4 ++-- dom/svg/crashtests/1486488.html | 11 +++++++++++ dom/svg/crashtests/crashtests.list | 1 + 9 files changed, 56 insertions(+), 49 deletions(-) create mode 100644 dom/svg/crashtests/1486488.html diff --git a/dom/base/IDTracker.cpp b/dom/base/IDTracker.cpp index 87c5e67706d6..f0f98fdfcbf1 100644 --- a/dom/base/IDTracker.cpp +++ b/dom/base/IDTracker.cpp @@ -144,11 +144,8 @@ IDTracker::Reset(nsIContent* aFromContent, } void -IDTracker::ResetWithID(nsIContent* aFromContent, - nsAtom* aID, - bool aWatch) +IDTracker::ResetWithID(Element& aFrom, nsAtom* aID, bool aWatch) { - MOZ_ASSERT(aFromContent); MOZ_ASSERT(aID); if (aWatch) { @@ -158,7 +155,7 @@ IDTracker::ResetWithID(nsIContent* aFromContent, mReferencingImage = false; - DocumentOrShadowRoot* docOrShadow = DocOrShadowFromContent(*aFromContent); + DocumentOrShadowRoot* docOrShadow = DocOrShadowFromContent(aFrom); HaveNewDocumentOrShadowRoot(docOrShadow, aWatch, nsDependentAtomString(aID)); } diff --git a/dom/base/IDTracker.h b/dom/base/IDTracker.h index 18b0fab7964b..e4e728e72bfa 100644 --- a/dom/base/IDTracker.h +++ b/dom/base/IDTracker.h @@ -78,7 +78,7 @@ public: * changes, so ElementChanged won't fire and get() will always return the same * value, the current element for the ID. */ - void ResetWithID(nsIContent* aFrom, nsAtom* aID, bool aWatch = true); + void ResetWithID(Element& aFrom, nsAtom* aID, bool aWatch = true); /** * Clears the reference. ElementChanged is not triggered. get() will return diff --git a/dom/smil/nsSMILTimeValueSpec.cpp b/dom/smil/nsSMILTimeValueSpec.cpp index 12fea9b763e9..19bd77a9f0a3 100644 --- a/dom/smil/nsSMILTimeValueSpec.cpp +++ b/dom/smil/nsSMILTimeValueSpec.cpp @@ -57,7 +57,7 @@ nsSMILTimeValueSpec::~nsSMILTimeValueSpec() nsresult nsSMILTimeValueSpec::SetSpec(const nsAString& aStringSpec, - Element* aContextNode) + Element& aContextElement) { nsSMILTimeValueSpecParams params; @@ -80,23 +80,21 @@ nsSMILTimeValueSpec::SetSpec(const nsAString& aStringSpec, mParams.mEventSymbol = nsGkAtoms::repeatEvent; } - ResolveReferences(aContextNode); + ResolveReferences(aContextElement); return NS_OK; } void -nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode) +nsSMILTimeValueSpec::ResolveReferences(Element& aContextElement) { - if (mParams.mType != nsSMILTimeValueSpecParams::SYNCBASE && !IsEventBased()) + if (mParams.mType != nsSMILTimeValueSpecParams::SYNCBASE && !IsEventBased()) { return; - - MOZ_ASSERT(aContextNode, - "null context node for resolving timing references against"); + } // If we're not bound to the document yet, don't worry, we'll get called again // when that happens - if (!aContextNode->IsInComposedDoc()) + if (!aContextElement.IsInComposedDoc()) return; // Hold ref to the old element so that it isn't destroyed in between resetting @@ -105,7 +103,7 @@ nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode) RefPtr oldReferencedElement = mReferencedElement.get(); if (mParams.mDependentElemID) { - mReferencedElement.ResetWithID(aContextNode, mParams.mDependentElemID); + mReferencedElement.ResetWithID(aContextElement, mParams.mDependentElemID); } else if (mParams.mType == nsSMILTimeValueSpecParams::EVENT) { Element* target = mOwner->GetTargetElement(); mReferencedElement.ResetWithElement(target); diff --git a/dom/smil/nsSMILTimeValueSpec.h b/dom/smil/nsSMILTimeValueSpec.h index b39ad413acbc..fb14a5e8c5d5 100644 --- a/dom/smil/nsSMILTimeValueSpec.h +++ b/dom/smil/nsSMILTimeValueSpec.h @@ -48,9 +48,9 @@ public: nsSMILTimeValueSpec(nsSMILTimedElement& aOwner, bool aIsBegin); ~nsSMILTimeValueSpec(); - nsresult SetSpec(const nsAString& aStringSpec, Element* aContextNode); - void ResolveReferences(nsIContent* aContextNode); - bool IsEventBased() const; + nsresult SetSpec(const nsAString& aStringSpec, Element& aContextElement); + void ResolveReferences(Element& aContextElement); + bool IsEventBased() const; void HandleNewInterval(nsSMILInterval& aInterval, const nsSMILTimeContainer* aSrcContainer); diff --git a/dom/smil/nsSMILTimedElement.cpp b/dom/smil/nsSMILTimedElement.cpp index e36d7edc9765..624d65a6fe6e 100644 --- a/dom/smil/nsSMILTimedElement.cpp +++ b/dom/smil/nsSMILTimedElement.cpp @@ -853,20 +853,21 @@ namespace } // namespace bool -nsSMILTimedElement::SetAttr(nsAtom* aAttribute, const nsAString& aValue, +nsSMILTimedElement::SetAttr(nsAtom* aAttribute, + const nsAString& aValue, nsAttrValue& aResult, - Element* aContextNode, + Element& aContextElement, nsresult* aParseResult) { bool foundMatch = true; nsresult parseResult = NS_OK; if (aAttribute == nsGkAtoms::begin) { - parseResult = SetBeginSpec(aValue, aContextNode, RemoveNonDOM); + parseResult = SetBeginSpec(aValue, aContextElement, RemoveNonDOM); } else if (aAttribute == nsGkAtoms::dur) { parseResult = SetSimpleDuration(aValue); } else if (aAttribute == nsGkAtoms::end) { - parseResult = SetEndSpec(aValue, aContextNode, RemoveNonDOM); + parseResult = SetEndSpec(aValue, aContextElement, RemoveNonDOM); } else if (aAttribute == nsGkAtoms::fill) { parseResult = SetFillMode(aValue); } else if (aAttribute == nsGkAtoms::max) { @@ -928,10 +929,10 @@ nsSMILTimedElement::UnsetAttr(nsAtom* aAttribute) nsresult nsSMILTimedElement::SetBeginSpec(const nsAString& aBeginSpec, - Element* aContextNode, + Element& aContextElement, RemovalTestFunction aRemove) { - return SetBeginOrEndSpec(aBeginSpec, aContextNode, true /*isBegin*/, + return SetBeginOrEndSpec(aBeginSpec, aContextElement, true /*isBegin*/, aRemove); } @@ -944,10 +945,10 @@ nsSMILTimedElement::UnsetBeginSpec(RemovalTestFunction aRemove) nsresult nsSMILTimedElement::SetEndSpec(const nsAString& aEndSpec, - Element* aContextNode, + Element& aContextElement, RemovalTestFunction aRemove) { - return SetBeginOrEndSpec(aEndSpec, aContextNode, false /*!isBegin*/, + return SetBeginOrEndSpec(aEndSpec, aContextElement, false /*!isBegin*/, aRemove); } @@ -1205,7 +1206,7 @@ nsSMILTimedElement::IsTimeDependent(const nsSMILTimedElement& aOther) const } void -nsSMILTimedElement::BindToTree(nsIContent* aContextNode) +nsSMILTimedElement::BindToTree(Element& aContextElement) { // Reset previously registered milestone since we may be registering with // a different time container now. @@ -1225,12 +1226,12 @@ nsSMILTimedElement::BindToTree(nsIContent* aContextNode) // Resolve references to other parts of the tree uint32_t count = mBeginSpecs.Length(); for (uint32_t i = 0; i < count; ++i) { - mBeginSpecs[i]->ResolveReferences(aContextNode); + mBeginSpecs[i]->ResolveReferences(aContextElement); } count = mEndSpecs.Length(); for (uint32_t j = 0; j < count; ++j) { - mEndSpecs[j]->ResolveReferences(aContextNode); + mEndSpecs[j]->ResolveReferences(aContextElement); } } @@ -1304,7 +1305,7 @@ nsSMILTimedElement::Unlink() nsresult nsSMILTimedElement::SetBeginOrEndSpec(const nsAString& aSpec, - Element* aContextNode, + Element& aContextElement, bool aIsBegin, RemovalTestFunction aRemove) { @@ -1323,7 +1324,7 @@ nsSMILTimedElement::SetBeginOrEndSpec(const nsAString& aSpec, bool hadFailure = false; while (tokenizer.hasMoreTokens()) { auto spec = MakeUnique(*this, aIsBegin); - nsresult rv = spec->SetSpec(tokenizer.nextToken(), aContextNode); + nsresult rv = spec->SetSpec(tokenizer.nextToken(), aContextElement); if (NS_SUCCEEDED(rv)) { timeSpecsList.AppendElement(std::move(spec)); } else { @@ -1481,13 +1482,13 @@ nsSMILTimedElement::RebuildTimingState(RemovalTestFunction aRemove) if (mAnimationElement->HasAttr(nsGkAtoms::begin)) { nsAutoString attValue; mAnimationElement->GetAttr(nsGkAtoms::begin, attValue); - SetBeginSpec(attValue, mAnimationElement, aRemove); + SetBeginSpec(attValue, *mAnimationElement, aRemove); } if (mAnimationElement->HasAttr(nsGkAtoms::end)) { nsAutoString attValue; mAnimationElement->GetAttr(nsGkAtoms::end, attValue); - SetEndSpec(attValue, mAnimationElement, aRemove); + SetEndSpec(attValue, *mAnimationElement, aRemove); } mPrevRegisteredMilestone = sMaxMilestone; diff --git a/dom/smil/nsSMILTimedElement.h b/dom/smil/nsSMILTimedElement.h index 7b0dc904a066..47f603a2285e 100644 --- a/dom/smil/nsSMILTimedElement.h +++ b/dom/smil/nsSMILTimedElement.h @@ -60,7 +60,7 @@ public: * Returns the element targeted by the animation element. Needed for * registering event listeners against the appropriate element. */ - mozilla::dom::Element* GetTargetElement(); + Element* GetTargetElement(); /** * Methods for supporting the ElementTimeControl interface. @@ -265,8 +265,8 @@ public: * @param aValue The attribute value. * @param aResult The nsAttrValue object that may be used for storing the * parsed result. - * @param aContextNode The element to use for context when resolving - * references to other elements. + * @param aContextElement The element to use for context when resolving + * references to other elements. * @param[out] aParseResult The result of parsing the attribute. Will be set * to NS_OK if parsing is successful. * @@ -274,8 +274,8 @@ public: * otherwise. */ bool SetAttr(nsAtom* aAttribute, const nsAString& aValue, - nsAttrValue& aResult, Element* aContextNode, - nsresult* aParseResult = nullptr); + nsAttrValue& aResult, Element& aContextElement, + nsresult* aParseResult = nullptr); /** * Attempts to unset an attribute on this timed element. @@ -326,18 +326,17 @@ public: * Called when the timed element has been bound to the document so that * references from this timed element to other elements can be resolved. * - * @param aContextNode The node which provides the necessary context for - * resolving references. This is typically the element in - * the host language that owns this timed element. Should - * not be null. + * @param aContextElement The element which provides the necessary context for + * resolving references. This is typically the element + * in the host language that owns this timed element. */ - void BindToTree(nsIContent* aContextNode); + void BindToTree(Element& aContextElement); /** * Called when the target of the animation has changed so that event * registrations can be updated. */ - void HandleTargetElementChange(mozilla::dom::Element* aNewTarget); + void HandleTargetElementChange(Element* aNewTarget); /** * Called when the timed element has been removed from a document so that @@ -377,10 +376,10 @@ protected: // nsresult SetBeginSpec(const nsAString& aBeginSpec, - Element* aContextNode, + Element& aContextElement, RemovalTestFunction aRemove); nsresult SetEndSpec(const nsAString& aEndSpec, - Element* aContextNode, + Element& aContextElement, RemovalTestFunction aRemove); nsresult SetSimpleDuration(const nsAString& aDurSpec); nsresult SetMin(const nsAString& aMinSpec); @@ -401,7 +400,7 @@ protected: void UnsetFillMode(); nsresult SetBeginOrEndSpec(const nsAString& aSpec, - Element* aContextNode, + Element& aContextElement, bool aIsBegin, RemovalTestFunction aRemove); void ClearSpecs(TimeValueSpecList& aSpecs, diff --git a/dom/svg/SVGAnimationElement.cpp b/dom/svg/SVGAnimationElement.cpp index 5e28448c35f5..c90ead06a96f 100644 --- a/dom/svg/SVGAnimationElement.cpp +++ b/dom/svg/SVGAnimationElement.cpp @@ -185,7 +185,7 @@ SVGAnimationElement::BindToTree(nsIDocument* aDocument, UpdateHrefTarget(hrefStr); } - mTimedElement.BindToTree(aParent); + mTimedElement.BindToTree(*this); } AnimationNeedsResample(); @@ -234,7 +234,7 @@ SVGAnimationElement::ParseAttribute(int32_t aNamespaceID, // try to parse it. if (!foundMatch) { foundMatch = - mTimedElement.SetAttr(aAttribute, aValue, aResult, this, &rv); + mTimedElement.SetAttr(aAttribute, aValue, aResult, *this, &rv); } if (foundMatch) { diff --git a/dom/svg/crashtests/1486488.html b/dom/svg/crashtests/1486488.html new file mode 100644 index 000000000000..ba61cb277bd6 --- /dev/null +++ b/dom/svg/crashtests/1486488.html @@ -0,0 +1,11 @@ + + + + + + + diff --git a/dom/svg/crashtests/crashtests.list b/dom/svg/crashtests/crashtests.list index fd2cafcbae90..8f62dd1a9d42 100644 --- a/dom/svg/crashtests/crashtests.list +++ b/dom/svg/crashtests/crashtests.list @@ -88,3 +88,4 @@ load 1402798.html load 1419250-1.html load 1420492.html load 1477853.html +load 1486488.html From d239e37b44f3ed32ff112fb1768944f39f6848bd Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Mon, 27 Aug 2018 12:12:58 +0000 Subject: [PATCH 50/64] Bug 1486374 - Increase profiler buffer entries to cover one full DAMP run. r=jmaher Differential Revision: https://phabricator.services.mozilla.com/D4317 --HG-- extra : moz-landing-system : lando --- testing/talos/talos/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/talos/talos/test.py b/testing/talos/talos/test.py index 70afa73c77e0..609290aec1c7 100644 --- a/testing/talos/talos/test.py +++ b/testing/talos/talos/test.py @@ -428,7 +428,7 @@ class damp(PageloaderTest): tploadnocache = True tpmozafterpaint = False gecko_profile_interval = 10 - gecko_profile_entries = 1000000 + gecko_profile_entries = 2000000 win_counters = w7_counters = linux_counters = mac_counters = None filters = filter.ignore_first.prepare(1) + filter.median.prepare() preferences = {'devtools.memory.enabled': True, From a69092408a76ab9ced072ac05952bed9a1b1ff2a Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Tue, 28 Aug 2018 11:07:34 +0000 Subject: [PATCH 51/64] Bug 1486079 - create initial browser dynamically so we can set various attributes from the start, r=dao Differential Revision: https://phabricator.services.mozilla.com/D4248 --HG-- extra : moz-landing-system : lando --- browser/base/content/browser.xul | 42 +++++----------- browser/base/content/tabbrowser.js | 77 ++++++++++++++++-------------- 2 files changed, 53 insertions(+), 66 deletions(-) diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 61b518a7947b..c3b60cbd56a0 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -634,6 +634,16 @@ xmlns="http://www.w3.org/1999/xhtml" accesskey="&syncSyncNowItem.accesskey;" id="syncedTabsRefreshFilter"/> + + + + +