From 7232407be57d1c8fa720d07dee838714ec799be8 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Wed, 14 Aug 2019 09:04:16 +0000 Subject: [PATCH 001/100] Bug 1573161 - Restore padding: 0; on ::-moz-tree-twisty(title, separator) in tree-icons.css. r=dao This was removed in https://hg.mozilla.org/integration/mozilla-inbound/rev/973b58266e4437e2cb14cd47d4cf8f052f4a1fa4#l19.14 because it was thought to be dead code. Differential Revision: https://phabricator.services.mozilla.com/D41793 --HG-- extra : moz-landing-system : lando --- browser/themes/shared/places/tree-icons.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/browser/themes/shared/places/tree-icons.css b/browser/themes/shared/places/tree-icons.css index 645f930bf53b..3f99d64c9ddd 100644 --- a/browser/themes/shared/places/tree-icons.css +++ b/browser/themes/shared/places/tree-icons.css @@ -85,6 +85,11 @@ treechildren::-moz-tree-cell-text(title, separator, selected, focus) { color: HighlightText; } +/* Remove tiny spacing in separators appearing after the twisty column */ +treechildren::-moz-tree-twisty(title, separator) { + padding: 0; +} + treechildren::-moz-tree-image(cutting) { opacity: 0.5; } From 7158682131eb84806f4edfc0e7563ae5ad6e7352 Mon Sep 17 00:00:00 2001 From: Alex Rosenfeld Date: Tue, 13 Aug 2019 19:39:59 +0000 Subject: [PATCH 002/100] Bug 1573241 - close conditionalPanel on right gutter click r=davidwalsh On a right click to the gutter, close any previously opened conditionalPanel. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D41694 --HG-- extra : moz-landing-system : lando --- devtools/client/debugger/src/components/Editor/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devtools/client/debugger/src/components/Editor/index.js b/devtools/client/debugger/src/components/Editor/index.js index ab18e1218df5..9394a56c5f65 100644 --- a/devtools/client/debugger/src/components/Editor/index.js +++ b/devtools/client/debugger/src/components/Editor/index.js @@ -335,12 +335,19 @@ class Editor extends PureComponent { breakpointActions, editorActions, isPaused, + conditionalPanelLocation, + closeConditionalPanel, } = this.props; const { editor } = this.state; if (!selectedSourceWithContent || !editor) { return; } + // only allow one conditionalPanel location. + if (conditionalPanelLocation) { + closeConditionalPanel(); + } + const target: Element = (event.target: any); const { id: sourceId } = selectedSourceWithContent.source; const line = lineAtHeight(editor, sourceId, event); From 32a649a30a274bc3265d1b1fc0dcb874642b03f6 Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Wed, 14 Aug 2019 14:37:05 +0000 Subject: [PATCH 003/100] Bug 1573649 - Implement feOffset SVG filter primitive in WebRender r=nical Differential Revision: https://phabricator.services.mozilla.com/D41840 --HG-- extra : moz-landing-system : lando --- gfx/wr/webrender/src/picture.rs | 4 ++++ gfx/wr/webrender/src/prim_store/picture.rs | 3 +++ gfx/wr/webrender/src/render_task.rs | 20 +++++++++++++++++++ gfx/wr/webrender_api/src/display_item.rs | 9 +++++++++ gfx/wr/wrench/reftests/filters/reftest.list | 1 + .../filters/svg-filter-offset-ref.yaml | 11 ++++++++++ .../reftests/filters/svg-filter-offset.yaml | 15 ++++++++++++++ gfx/wr/wrench/src/yaml_frame_writer.rs | 5 +++++ gfx/wr/wrench/src/yaml_helper.rs | 6 ++++++ 9 files changed, 74 insertions(+) create mode 100644 gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml create mode 100644 gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs index 735a8c636cdb..8191047da9dd 100644 --- a/gfx/wr/webrender/src/picture.rs +++ b/gfx/wr/webrender/src/picture.rs @@ -1964,6 +1964,10 @@ impl PictureCompositeMode { primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect), FilterPrimitiveKind::ComponentTransfer(ref primitive) => primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect), + FilterPrimitiveKind::Offset(ref primitive) => { + let input_rect = primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect); + input_rect.translate(primitive.offset * Scale::new(1.0)) + }, FilterPrimitiveKind::Flood(..) => picture_rect, }; diff --git a/gfx/wr/webrender/src/prim_store/picture.rs b/gfx/wr/webrender/src/prim_store/picture.rs index d4b0d9295edd..40f948b29570 100644 --- a/gfx/wr/webrender/src/prim_store/picture.rs +++ b/gfx/wr/webrender/src/prim_store/picture.rs @@ -31,6 +31,7 @@ pub enum FilterPrimitiveKey { ColorMatrix(ColorSpace, [Au; 20], FilterPrimitiveInput), DropShadow(ColorSpace, (VectorKey, Au, ColorU), FilterPrimitiveInput), ComponentTransfer(ColorSpace, FilterPrimitiveInput, Vec), + Offset(ColorSpace, FilterPrimitiveInput, VectorKey), } /// Represents a hashable description of how a picture primitive @@ -175,6 +176,8 @@ impl From> for PictureCompositeKey { } FilterPrimitiveKind::ComponentTransfer(component_transfer) => FilterPrimitiveKey::ComponentTransfer(primitive.color_space, component_transfer.input, filter_data.clone()), + FilterPrimitiveKind::Offset(info) => + FilterPrimitiveKey::Offset(primitive.color_space, info.input, info.offset.into()), } }).collect()) } diff --git a/gfx/wr/webrender/src/render_task.rs b/gfx/wr/webrender/src/render_task.rs index 4eab18a998ea..6d0cede74cf9 100644 --- a/gfx/wr/webrender/src/render_task.rs +++ b/gfx/wr/webrender/src/render_task.rs @@ -1467,6 +1467,26 @@ impl RenderTask { render_tasks.add(task) } } + FilterPrimitiveKind::Offset(ref info) => { + let input_task_id = get_task_input( + &info.input, + filter_primitives, + render_tasks, + cur_index, + &outputs, + original_task_id, + primitive.color_space + ); + + let offset = info.offset * LayoutToWorldScale::new(1.0) * device_pixel_scale; + let offset_task = RenderTask::new_svg_filter_primitive( + vec![input_task_id], + content_size, + uv_rect_kind, + SvgFilterInfo::Offset(offset), + ); + render_tasks.add(offset_task) + } }; outputs.push(render_task_id); } diff --git a/gfx/wr/webrender_api/src/display_item.rs b/gfx/wr/webrender_api/src/display_item.rs index b0341bde84b5..cc1af20253b9 100644 --- a/gfx/wr/webrender_api/src/display_item.rs +++ b/gfx/wr/webrender_api/src/display_item.rs @@ -837,6 +837,13 @@ pub struct IdentityPrimitive { pub input: FilterPrimitiveInput, } +#[repr(C)] +#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] +pub struct OffsetPrimitive { + pub input: FilterPrimitiveInput, + pub offset: LayoutVector2D, +} + /// See: https://github.com/eqrion/cbindgen/issues/9 /// cbindgen:derive-eq=false #[repr(C)] @@ -852,6 +859,7 @@ pub enum FilterPrimitiveKind { ColorMatrix(ColorMatrixPrimitive), DropShadow(DropShadowPrimitive), ComponentTransfer(ComponentTransferPrimitive), + Offset(OffsetPrimitive), } impl Default for FilterPrimitiveKind { @@ -872,6 +880,7 @@ impl FilterPrimitiveKind { FilterPrimitiveKind::Identity(..) | FilterPrimitiveKind::Blend(..) | FilterPrimitiveKind::ColorMatrix(..) | + FilterPrimitiveKind::Offset(..) | // Component transfer's filter data is sanitized separately. FilterPrimitiveKind::ComponentTransfer(..) => {} } diff --git a/gfx/wr/wrench/reftests/filters/reftest.list b/gfx/wr/wrench/reftests/filters/reftest.list index 3852f77622a8..ee1124a1667d 100644 --- a/gfx/wr/wrench/reftests/filters/reftest.list +++ b/gfx/wr/wrench/reftests/filters/reftest.list @@ -56,5 +56,6 @@ platform(linux,mac) == fuzzy(4,28250) svg-filter-drop-shadow-rotate.yaml svg-fil platform(linux,mac) == svg-filter-blur-transforms.yaml svg-filter-blur-transforms.png platform(linux,mac) == svg-filter-drop-shadow-on-viewport-edge.yaml svg-filter-drop-shadow-on-viewport-edge.png platform(linux,mac) == svg-filter-drop-shadow-perspective.yaml svg-filter-drop-shadow-perspective.png +== svg-filter-offset.yaml svg-filter-offset-ref.yaml == backdrop-filter-basic.yaml backdrop-filter-basic-ref.yaml platform(linux,mac) == backdrop-filter-perspective.yaml backdrop-filter-perspective.png diff --git a/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml b/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml new file mode 100644 index 000000000000..f6326b51347d --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml @@ -0,0 +1,11 @@ +# Tests the SVG offset filter primitive +# An offset filter should have the same effect as changing the origin of the rectangle. +--- +root: + items: + - type: stacking-context + bounds: 0 0 0 0 + items: + - type: rect + bounds: 20 20 100 100 + color: red diff --git a/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml b/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml new file mode 100644 index 000000000000..f48fb5104e4b --- /dev/null +++ b/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml @@ -0,0 +1,15 @@ +# Tests the SVG offset filter primitive +# An offset filter should have the same effect as changing the origin of the rectangle. +--- +root: + items: + - type: stacking-context + bounds: 0 0 0 0 + filter-primitives: + - type: offset + offset: 10 10 + in: original + items: + - type: rect + bounds: 10 10 100 100 + color: red diff --git a/gfx/wr/wrench/src/yaml_frame_writer.rs b/gfx/wr/wrench/src/yaml_frame_writer.rs index 2de2f5f85855..5839a8f79775 100644 --- a/gfx/wr/wrench/src/yaml_frame_writer.rs +++ b/gfx/wr/wrench/src/yaml_frame_writer.rs @@ -399,6 +399,11 @@ fn write_filter_primitives( yaml_node(&mut table, "type", Yaml::String("component-transfer".into())); filter_input_node(&mut table, "in", component_transfer_primitive.input); } + FilterPrimitiveKind::Offset(info) => { + yaml_node(&mut table, "type", Yaml::String("offset".into())); + filter_input_node(&mut table, "in", info.input); + vector_node(&mut table, "offset", &info.offset); + } } enum_node(&mut table, "color-space", filter_primitive.color_space); filter_primitives.push(Yaml::Hash(table)); diff --git a/gfx/wr/wrench/src/yaml_helper.rs b/gfx/wr/wrench/src/yaml_helper.rs index bc005e63678b..b4613207fa6b 100644 --- a/gfx/wr/wrench/src/yaml_helper.rs +++ b/gfx/wr/wrench/src/yaml_helper.rs @@ -769,6 +769,12 @@ impl YamlHelper for Yaml { input: self["in"].as_filter_input().unwrap(), }) } + "offset" => { + FilterPrimitiveKind::Offset(OffsetPrimitive { + input: self["in"].as_filter_input().unwrap(), + offset: self["offset"].as_vector().unwrap(), + }) + } _ => return None, }; From d5c4354d05f68ba20002ed21c4bdec602c7ec8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 14 Aug 2019 16:06:46 +0000 Subject: [PATCH 004/100] Bug 1571764 - Subtract combobox display frame border-padding when inferring the height from line-height. r=mats,jfkthame This fixes it and seems to be an acceptable fix... Should I make it conditional on box-sizing: border-box for completeness? The display frame has border-box box-sizing, and not having it would be a bug, I'd think... Differential Revision: https://phabricator.services.mozilla.com/D41939 --HG-- extra : moz-landing-system : lando --- layout/forms/nsComboboxControlFrame.cpp | 18 ++++++++++---- .../themed-select-padding-no-clip-ref.html | 2 +- .../select-1-block-size-001-ref-2.html | 24 +++++++++++++++++++ .../select-1-block-size-001-ref.html | 23 ++++++++++++++++++ .../select-1-block-size-001.html | 23 ++++++++++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref-2.html create mode 100644 testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref.html create mode 100644 testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001.html diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 42e011d0217c..6846443707b6 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1237,19 +1237,27 @@ void nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext, MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); ReflowInput state(aReflowInput); + WritingMode wm = aReflowInput.GetWritingMode(); + LogicalMargin bp = state.ComputedLogicalBorderPadding(); if (state.ComputedBSize() == NS_UNCONSTRAINEDSIZE) { float inflation = nsLayoutUtils::FontSizeInflationFor(mComboBox); // We intentionally use the combobox frame's style here, which has // the 'line-height' specified by the author, if any. // (This frame has 'line-height: -moz-block-height' in the UA // sheet which is suitable when there's a specified block-size.) - auto lh = ReflowInput::CalcLineHeight(mComboBox->GetContent(), - mComboBox->Style(), aPresContext, - NS_UNCONSTRAINEDSIZE, inflation); + nscoord lh = ReflowInput::CalcLineHeight(mComboBox->GetContent(), + mComboBox->Style(), aPresContext, + NS_UNCONSTRAINEDSIZE, inflation); + if (!mComboBox->StyleText()->mLineHeight.IsNormal()) { + // If the author specified a different line-height than normal, or a + // different appearance, subtract the border-padding from the + // comboboxdisplay frame, so as to respect that line-height rather than + // that line-height + 2px (from the UA sheet). + lh = std::max(0, lh - bp.BStartEnd(wm)); + } state.SetComputedBSize(lh); } - WritingMode wm = aReflowInput.GetWritingMode(); - nscoord inlineBp = state.ComputedLogicalBorderPadding().IStartEnd(wm); + nscoord inlineBp = bp.IStartEnd(wm); nscoord computedISize = mComboBox->mDisplayISize - inlineBp; // Other UAs ignore padding in some (but not all) platforms for (themed only) diff --git a/layout/reftests/forms/select/themed-select-padding-no-clip-ref.html b/layout/reftests/forms/select/themed-select-padding-no-clip-ref.html index ab908cdd6547..605acf664718 100644 --- a/layout/reftests/forms/select/themed-select-padding-no-clip-ref.html +++ b/layout/reftests/forms/select/themed-select-padding-no-clip-ref.html @@ -19,7 +19,7 @@ -
XXXXXXXXXX
+
XXXXXXXXXX
diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref-2.html b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref-2.html new file mode 100644 index 000000000000..385c2a75d427 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref-2.html @@ -0,0 +1,24 @@ + +CSS Test Reference + + + + +
A
+
A
diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref.html b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref.html new file mode 100644 index 000000000000..84417d318e49 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001-ref.html @@ -0,0 +1,23 @@ + +CSS Test Reference + + + + + + + diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001.html b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001.html new file mode 100644 index 000000000000..dd2fec3b370e --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/the-select-element/select-1-block-size-001.html @@ -0,0 +1,23 @@ + +Select block size when line-height is specified + + + + + + + From 22c051e31f75ba82646836cce9bf8bf86f4c0486 Mon Sep 17 00:00:00 2001 From: John Lin Date: Wed, 14 Aug 2019 15:47:52 +0000 Subject: [PATCH 005/100] Bug 1565838 - don't check timestamp of EOS samples. r=jya Bug 1540748/D28167 checks the output sample timestamp against the time parsed by demuxer to determine the validness. However, unlike Android builtin MP3 decoder which sets EOS flag in the final valid output, the Samsung MP3 decoder always emit additional EOS sample with invalid timestamp. To address this, the timestamp check should be ignore for EOS samples. Differential Revision: https://phabricator.services.mozilla.com/D41872 --HG-- extra : moz-landing-system : lando --- dom/media/platforms/android/RemoteDataDecoder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dom/media/platforms/android/RemoteDataDecoder.cpp b/dom/media/platforms/android/RemoteDataDecoder.cpp index a1b620da8d18..e85a733d2a3b 100644 --- a/dom/media/platforms/android/RemoteDataDecoder.cpp +++ b/dom/media/platforms/android/RemoteDataDecoder.cpp @@ -477,8 +477,9 @@ class RemoteAudioDecoder : public RemoteDataDecoder { BufferInfo::LocalRef info = aSample->Info(); MOZ_ASSERT(info); - int32_t flags; + int32_t flags = 0; bool ok = NS_SUCCEEDED(info->Flags(&flags)); + bool isEOS = !!(flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM); int32_t offset; ok &= NS_SUCCEEDED(info->Offset(&offset)); @@ -490,7 +491,8 @@ class RemoteAudioDecoder : public RemoteDataDecoder { ok &= NS_SUCCEEDED(info->Size(&size)); if (!ok || - IsSampleTimeSmallerThanFirstDemuxedSampleTime(presentationTimeUs)) { + (IsSampleTimeSmallerThanFirstDemuxedSampleTime(presentationTimeUs) && + !isEOS)) { Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__)); return; } @@ -518,7 +520,7 @@ class RemoteAudioDecoder : public RemoteDataDecoder { UpdateOutputStatus(std::move(data)); } - if ((flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM) != 0) { + if (isEOS) { DrainComplete(); } } From ddc7d4d0ea51cf50c6fb8a146735800769e38c92 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Wed, 14 Aug 2019 16:15:41 +0000 Subject: [PATCH 006/100] Bug 1564359 - Add additional detail to in-tree Fission documentation. r=jdai Differential Revision: https://phabricator.services.mozilla.com/D40474 --HG-- extra : moz-landing-system : lando --- dom/docs/Fission.rst | 160 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 144 insertions(+), 16 deletions(-) diff --git a/dom/docs/Fission.rst b/dom/docs/Fission.rst index 7b0591dfb348..f2f344c2a313 100644 --- a/dom/docs/Fission.rst +++ b/dom/docs/Fission.rst @@ -16,45 +16,169 @@ IPC Diagram JS Window Actor =============== -What are actors? ----------------- +What are JS Window Actors? +-------------------------- -In the Fission world, Actors will be the replacement for framescripts. Framescripts were how we structured code to be aware of the parent (UI) and child (content) separation, including establishing the communication channel between the two (via the message manager). +In the Fission world, JS Window Actors will be the replacement for framescripts. Framescripts were how we structured code to be aware of the parent (UI) and child (content) separation, including establishing the communication channel between the two (via the Frame Message Manager). -However, the framescripts had no way to establish further process separation downwards (that is, for out-of-process iframes). Actors will be the replacement. +However, the framescripts had no way to establish further process separation downwards (that is, for out-of-process iframes). JS Window Actors will be the replacement. How are they structured? ------------------------ -Currently, in the post-e10s Firefox codebase, we have code living in the parent process (UI) that is in plain JS (.js files) or in JS modules (.jsm). In the child process (hosting the content), we use framescripts (.js) and also JS modules. The framescripts are instantiated once per top-level frame (or, in simpler terms, once per tab). This code has access to all of the DOM from the web content, including iframes on it. +A review of the current Message Manager mechanism +````````````````````````````````````````````````` -The two processes communicate between them through the message manager (mm) using the sendAsyncMessage API, and any code in the parent can communicate with any code in the child (and vice versa), by just listening to the messsages of interest. +.. note:: + There are actually several types of Message Managers: Frame Message Managers, Window Message Managers, Group Message Managers and Process Message Managers. For the purposes of this documentation, it's simplest to refer to all of these mechanisms altogether as the "Message Manager mechanism". Most of the examples in this document will be operating on the assumption that the Message Manager is a Frame Message Manager, which is the most commonly used one. + +Currently, in the post `Electrolysis Project`_ Firefox codebase, we have code living in the parent process (UI) that is in plain JS (.js files) or in JS modules (.jsm files). In the child process (hosting the content), we use framescripts (.js) and also JS modules. The framescripts are instantiated once per top-level frame (or, in simpler terms, once per tab). This code has access to all of the DOM from the web content, including all iframes within it. + +The two processes communicate via the Frame Message Manager (mm) using the ``sendAsyncMessage`` / ``receiveMessage`` API, and any code in the parent can communicate with any code in the child (and vice versa), by just listening to the messages of interest. + +The Frame Message Manager communication mechanism follows a publish / subscribe pattern similar to how Events work in Firefox: + +1. Something exposes a mechanism for subscribing to notifications (``addMessageListener`` for the Frame Message Manager, ``addEventListener`` for Events). +2. The subscriber is responsible for unsubscribing when there's no longer interest in the notifications (``removeMessageListener`` for the Frame Message Manager, ``removeEventListener`` for Events). +3. Any number of subscribers can be attached at any one time. .. figure:: Fission-framescripts.png :width: 320px :height: 200px -For fission, the actors replacing FrameScript will be structured in pairs. A pair of actors will be instantiated lazily: one in the parent and one in the child process, and a direct channel of communication between the two will be established. -These actors are "managed" by the WindowGlobal actors, and are implemented as JS classes instantiated when requested for any particular window. +How JS Window Actors differ from the Frame Message Manager +`````````````````````````````````````````````````````````` + +For Fission, the JS Window Actors replacing framescripts will be structured in pairs. A pair of JS Window Actors will be instantiated lazily: one in the parent and one in the child process, and a direct channel of communication between the two will be established. The JS Window Actor in the parent must extend the global ``JSWindowActorParent`` class, and the JS Window Actor in the child must extend the global ``JSWindowActorChild`` class. + +The JS Window Actor mechanism is similar to how `IPC Actors`_ work in the native layer of Firefox: + +#. Every Actor has one counterpart in another process that they can communicate directly with. +#. Every Actor inherits a common communications API from a parent class. +#. Every Actor has a name that ends in either ``Parent`` or ``Child``. +#. There is no built-in mechanism for subscribing to messages. When one JS Window Actor sends a message, the counterpart JS Window Actor on the other side will receive it without needing to explicitly listen for it. + +Other notable differences between JSWindowActor's and Message Manager / framescripts: + +#. Each JSWindowActor pair is associated with a particular frame. For example, given the following DOM hierarchy:: + + +

+ +

+
+

From c1bef1695c26b575e39f2ace6bb12c10eed08e9b Mon Sep 17 00:00:00 2001
From: Bryce Seager van Dyk 
Date: Wed, 14 Aug 2019 19:35:07 +0000
Subject: [PATCH 052/100] Bug 1573902 - Fix CDM Init return value name in IPDL.
 r=dminor

The return value for PChromiumCDM::Init was unused when the IPDL change was
first made. However, that quickly changed, but I failed to update the IPDL to
reflect that the value is now used to propagate the value that CDM interface 10
Widevine modules give us via the OnInitialized callback.

This patch fixes the IPDL to reflect that. The changes in C++ code have already
been made, so no change needed there.

Differential Revision: https://phabricator.services.mozilla.com/D41995

--HG--
extra : moz-landing-system : lando
---
 dom/media/gmp/PChromiumCDM.ipdl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dom/media/gmp/PChromiumCDM.ipdl b/dom/media/gmp/PChromiumCDM.ipdl
index f0bb3eef2a88..232f950e17ed 100644
--- a/dom/media/gmp/PChromiumCDM.ipdl
+++ b/dom/media/gmp/PChromiumCDM.ipdl
@@ -16,7 +16,7 @@ child:
 
   // cdm::ContentDecryptionModule9+10
   async Init(bool aAllowDistinctiveIdentifier,
-             bool aAllowPersistentState) returns (bool unused);
+             bool aAllowPersistentState) returns (bool aSuccess);
 
   async GetStatusForPolicy(uint32_t aPromiseId,
                            nsCString aMinHdcpVersion);

From 3e0e0472e5e7b8f802ad55917b588f36ef083a86 Mon Sep 17 00:00:00 2001
From: "arthur.iakab" 
Date: Wed, 14 Aug 2019 22:34:12 +0300
Subject: [PATCH 053/100] Backed out changeset 71b7ef6e0ed8 (bug 1573649) for
 causing wrench build bustages on svg-filter-offset-ref.yaml.

--HG--
extra : rebase_source : 30f299066d80f51169d6ef3faba107db3c01fb1f
---
 gfx/wr/webrender/src/picture.rs               |  4 ----
 gfx/wr/webrender/src/prim_store/picture.rs    |  3 ---
 gfx/wr/webrender/src/render_task.rs           | 20 -------------------
 gfx/wr/webrender_api/src/display_item.rs      |  9 ---------
 gfx/wr/wrench/reftests/filters/reftest.list   |  1 -
 .../filters/svg-filter-offset-ref.yaml        | 11 ----------
 .../reftests/filters/svg-filter-offset.yaml   | 15 --------------
 gfx/wr/wrench/src/yaml_frame_writer.rs        |  5 -----
 gfx/wr/wrench/src/yaml_helper.rs              |  6 ------
 9 files changed, 74 deletions(-)
 delete mode 100644 gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml
 delete mode 100644 gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml

diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs
index 8191047da9dd..735a8c636cdb 100644
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -1964,10 +1964,6 @@ impl PictureCompositeMode {
                             primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect),
                         FilterPrimitiveKind::ComponentTransfer(ref primitive) =>
                             primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect),
-                        FilterPrimitiveKind::Offset(ref primitive) => {
-                            let input_rect = primitive.input.to_index(cur_index).map(|index| output_rects[index]).unwrap_or(picture_rect);
-                            input_rect.translate(primitive.offset * Scale::new(1.0))
-                        },
 
                         FilterPrimitiveKind::Flood(..) => picture_rect,
                     };
diff --git a/gfx/wr/webrender/src/prim_store/picture.rs b/gfx/wr/webrender/src/prim_store/picture.rs
index 40f948b29570..d4b0d9295edd 100644
--- a/gfx/wr/webrender/src/prim_store/picture.rs
+++ b/gfx/wr/webrender/src/prim_store/picture.rs
@@ -31,7 +31,6 @@ pub enum FilterPrimitiveKey {
     ColorMatrix(ColorSpace, [Au; 20], FilterPrimitiveInput),
     DropShadow(ColorSpace, (VectorKey, Au, ColorU), FilterPrimitiveInput),
     ComponentTransfer(ColorSpace, FilterPrimitiveInput, Vec),
-    Offset(ColorSpace, FilterPrimitiveInput, VectorKey),
 }
 
 /// Represents a hashable description of how a picture primitive
@@ -176,8 +175,6 @@ impl From> for PictureCompositeKey {
                         }
                         FilterPrimitiveKind::ComponentTransfer(component_transfer) =>
                             FilterPrimitiveKey::ComponentTransfer(primitive.color_space, component_transfer.input, filter_data.clone()),
-                        FilterPrimitiveKind::Offset(info) =>
-                            FilterPrimitiveKey::Offset(primitive.color_space, info.input, info.offset.into()),
                     }
                 }).collect())
             }
diff --git a/gfx/wr/webrender/src/render_task.rs b/gfx/wr/webrender/src/render_task.rs
index 6d0cede74cf9..4eab18a998ea 100644
--- a/gfx/wr/webrender/src/render_task.rs
+++ b/gfx/wr/webrender/src/render_task.rs
@@ -1467,26 +1467,6 @@ impl RenderTask {
                         render_tasks.add(task)
                     }
                 }
-                FilterPrimitiveKind::Offset(ref info) => {
-                    let input_task_id = get_task_input(
-                        &info.input,
-                        filter_primitives,
-                        render_tasks,
-                        cur_index,
-                        &outputs,
-                        original_task_id,
-                        primitive.color_space
-                    );
-
-                    let offset = info.offset * LayoutToWorldScale::new(1.0) * device_pixel_scale;
-                    let offset_task = RenderTask::new_svg_filter_primitive(
-                        vec![input_task_id],
-                        content_size,
-                        uv_rect_kind,
-                        SvgFilterInfo::Offset(offset),
-                    );
-                    render_tasks.add(offset_task)
-                }
             };
             outputs.push(render_task_id);
         }
diff --git a/gfx/wr/webrender_api/src/display_item.rs b/gfx/wr/webrender_api/src/display_item.rs
index cc1af20253b9..b0341bde84b5 100644
--- a/gfx/wr/webrender_api/src/display_item.rs
+++ b/gfx/wr/webrender_api/src/display_item.rs
@@ -837,13 +837,6 @@ pub struct IdentityPrimitive {
     pub input: FilterPrimitiveInput,
 }
 
-#[repr(C)]
-#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
-pub struct OffsetPrimitive {
-    pub input: FilterPrimitiveInput,
-    pub offset: LayoutVector2D,
-}
-
 /// See: https://github.com/eqrion/cbindgen/issues/9
 /// cbindgen:derive-eq=false
 #[repr(C)]
@@ -859,7 +852,6 @@ pub enum FilterPrimitiveKind {
     ColorMatrix(ColorMatrixPrimitive),
     DropShadow(DropShadowPrimitive),
     ComponentTransfer(ComponentTransferPrimitive),
-    Offset(OffsetPrimitive),
 }
 
 impl Default for FilterPrimitiveKind {
@@ -880,7 +872,6 @@ impl FilterPrimitiveKind {
             FilterPrimitiveKind::Identity(..) |
             FilterPrimitiveKind::Blend(..) |
             FilterPrimitiveKind::ColorMatrix(..) |
-            FilterPrimitiveKind::Offset(..) |
             // Component transfer's filter data is sanitized separately.
             FilterPrimitiveKind::ComponentTransfer(..) => {}
         }
diff --git a/gfx/wr/wrench/reftests/filters/reftest.list b/gfx/wr/wrench/reftests/filters/reftest.list
index ee1124a1667d..3852f77622a8 100644
--- a/gfx/wr/wrench/reftests/filters/reftest.list
+++ b/gfx/wr/wrench/reftests/filters/reftest.list
@@ -56,6 +56,5 @@ platform(linux,mac) == fuzzy(4,28250) svg-filter-drop-shadow-rotate.yaml svg-fil
 platform(linux,mac) == svg-filter-blur-transforms.yaml svg-filter-blur-transforms.png
 platform(linux,mac) == svg-filter-drop-shadow-on-viewport-edge.yaml svg-filter-drop-shadow-on-viewport-edge.png
 platform(linux,mac) == svg-filter-drop-shadow-perspective.yaml svg-filter-drop-shadow-perspective.png
-== svg-filter-offset.yaml svg-filter-offset-ref.yaml
 == backdrop-filter-basic.yaml backdrop-filter-basic-ref.yaml
 platform(linux,mac) == backdrop-filter-perspective.yaml backdrop-filter-perspective.png
diff --git a/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml b/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml
deleted file mode 100644
index f6326b51347d..000000000000
--- a/gfx/wr/wrench/reftests/filters/svg-filter-offset-ref.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Tests the SVG offset filter primitive
-# An offset filter should have the same effect as changing the origin of the rectangle.
----
-root:
-  items:
-    - type: stacking-context
-      bounds: 0 0 0 0
-      items:
-      - type: rect
-        bounds: 20 20 100 100
-        color: red
diff --git a/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml b/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml
deleted file mode 100644
index f48fb5104e4b..000000000000
--- a/gfx/wr/wrench/reftests/filters/svg-filter-offset.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Tests the SVG offset filter primitive
-# An offset filter should have the same effect as changing the origin of the rectangle.
----
-root:
-  items:
-    - type: stacking-context
-      bounds: 0 0 0 0
-      filter-primitives:
-      - type: offset
-        offset: 10 10
-        in: original
-      items:
-      - type: rect
-        bounds: 10 10 100 100
-        color: red
diff --git a/gfx/wr/wrench/src/yaml_frame_writer.rs b/gfx/wr/wrench/src/yaml_frame_writer.rs
index 5839a8f79775..2de2f5f85855 100644
--- a/gfx/wr/wrench/src/yaml_frame_writer.rs
+++ b/gfx/wr/wrench/src/yaml_frame_writer.rs
@@ -399,11 +399,6 @@ fn write_filter_primitives(
                 yaml_node(&mut table, "type", Yaml::String("component-transfer".into()));
                 filter_input_node(&mut table, "in", component_transfer_primitive.input);
             }
-            FilterPrimitiveKind::Offset(info) => {
-                yaml_node(&mut table, "type", Yaml::String("offset".into()));
-                filter_input_node(&mut table, "in", info.input);
-                vector_node(&mut table, "offset", &info.offset);
-            }
         }
         enum_node(&mut table, "color-space", filter_primitive.color_space);
         filter_primitives.push(Yaml::Hash(table));
diff --git a/gfx/wr/wrench/src/yaml_helper.rs b/gfx/wr/wrench/src/yaml_helper.rs
index b4613207fa6b..bc005e63678b 100644
--- a/gfx/wr/wrench/src/yaml_helper.rs
+++ b/gfx/wr/wrench/src/yaml_helper.rs
@@ -769,12 +769,6 @@ impl YamlHelper for Yaml {
                         input: self["in"].as_filter_input().unwrap(),
                     })
                 }
-                "offset" => {
-                    FilterPrimitiveKind::Offset(OffsetPrimitive {
-                        input: self["in"].as_filter_input().unwrap(),
-                        offset: self["offset"].as_vector().unwrap(),
-                    })
-                }
                 _ => return None,
             };
 

From e0b4be71879a88c5a7ff874715d8703abdc85b1e Mon Sep 17 00:00:00 2001
From: Shane Caraveo 
Date: Wed, 14 Aug 2019 16:10:51 +0000
Subject: [PATCH 054/100] Bug 1547140 add classification data to webRequest API
 r=zombie,kmag,Fallen

Differential Revision: https://phabricator.services.mozilla.com/D35911

--HG--
extra : moz-landing-system : lando
---
 dom/chrome-webidl/ChannelWrapper.webidl       | 36 +++++++
 .../extensions/schemas/web_request.json       | 49 +++++++--
 .../test/mochitest/file_third_party.html      | 12 +++
 .../test/mochitest/mochitest-common.ini       |  2 +
 ...test_ext_webrequest_urlClassification.html | 99 +++++++++++++++++++
 .../test_ext_webRequest_urlclassification.js  | 33 +++++++
 .../extensions/test/xpcshell/xpcshell.ini     |  1 +
 .../extensions/webrequest/ChannelWrapper.cpp  | 58 +++++++++++
 .../extensions/webrequest/ChannelWrapper.h    |  3 +
 .../extensions/webrequest/WebRequest.jsm      | 23 ++++-
 10 files changed, 305 insertions(+), 11 deletions(-)
 create mode 100644 toolkit/components/extensions/test/mochitest/file_third_party.html
 create mode 100644 toolkit/components/extensions/test/mochitest/test_ext_webrequest_urlClassification.html
 create mode 100644 toolkit/components/extensions/test/xpcshell/test_ext_webRequest_urlclassification.js

diff --git a/dom/chrome-webidl/ChannelWrapper.webidl b/dom/chrome-webidl/ChannelWrapper.webidl
index b541212cb85b..6097dcc14f84 100644
--- a/dom/chrome-webidl/ChannelWrapper.webidl
+++ b/dom/chrome-webidl/ChannelWrapper.webidl
@@ -37,6 +37,28 @@ enum MozContentPolicyType {
   "other"
 };
 
+/**
+ * String versions of CLASSIFIED_* tracking flags from nsHttpChannel.idl
+ */
+enum MozUrlClassificationFlags {
+  "fingerprinting",
+  "fingerprinting_content",
+  "cryptomining",
+  "cryptomining_content",
+  "tracking",
+  "tracking_ad",
+  "tracking_analytics",
+  "tracking_social",
+  "tracking_content",
+  "socialtracking",
+  "socialtracking_facebook",
+  "socialtracking_linkedin",
+  "socialtracking_twitter",
+  "any_basic_tracking",
+  "any_strict_tracking",
+  "any_social_tracking"
+};
+
 /**
  * A thin wrapper around nsIChannel and nsIHttpChannel that allows JS
  * callers to access them without XPConnect overhead.
@@ -382,6 +404,20 @@ interface ChannelWrapper : EventTarget {
   void setResponseHeader(ByteString header,
                          ByteString value,
                          optional boolean merge = false);
+
+  /**
+   * Provides the tracking classification data when it is available.
+   */
+  [Cached, Frozen, GetterThrows, Pure]
+  readonly attribute MozUrlClassification? urlClassification;
+};
+
+/**
+ * Wrapper for first and third party tracking classification data.
+ */
+dictionary MozUrlClassification {
+  required sequence firstParty;
+  required sequence thirdParty;
 };
 
 /**
diff --git a/toolkit/components/extensions/schemas/web_request.json b/toolkit/components/extensions/schemas/web_request.json
index 3d462d38bcd5..13d514354d63 100644
--- a/toolkit/components/extensions/schemas/web_request.json
+++ b/toolkit/components/extensions/schemas/web_request.json
@@ -347,6 +347,28 @@
           }
         },
         "description": "Contains data uploaded in a URL request."
+      },
+      {
+        "id": "UrlClassificationFlags",
+        "type": "string",
+        "enum": ["fingerprinting", "fingerprinting_content", "cryptomining", "cryptomining_content",
+                 "tracking", "tracking_ad", "tracking_analytics", "tracking_social", "tracking_content",
+                 "any_basic_tracking", "any_strict_tracking", "any_social_tracking"],
+        "description": "Tracking flags that match our internal tracking classification"
+      },
+      {
+        "id": "UrlClassificationParty",
+        "type": "array",
+        "items": {"$ref": "UrlClassificationFlags"},
+        "description": "If the request has been classified this is an array of $(ref:UrlClassificationFlags)."
+      },
+      {
+        "id": "UrlClassification",
+        "type": "object",
+        "properties": {
+          "firstParty": {"$ref": "UrlClassificationParty", "description": "First party classification flags if the request has been classified."},
+          "thirdParty": {"$ref": "UrlClassificationParty", "description": "Third party classification flags if the request has been classified."}
+        }
       }
     ],
     "functions": [
@@ -456,7 +478,8 @@
               },
               "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
               "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."},
-              "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}
+              "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -503,7 +526,8 @@
               "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
               "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."},
               "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
-              "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."}
+              "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -550,7 +574,8 @@
               "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
               "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."},
               "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
-              "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that have been sent out with this request."}
+              "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that have been sent out with this request."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -594,7 +619,8 @@
               "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
               "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line)."},
               "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that have been received with this response."},
-              "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}
+              "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
              }
           }
         ],
@@ -647,7 +673,8 @@
               "isProxy": {"type": "boolean", "description": "True for Proxy-Authenticate, false for WWW-Authenticate."},
               "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
               "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."},
-              "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}
+              "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           },
           {
@@ -706,7 +733,8 @@
               "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
               "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
               "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
-              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
+              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -753,7 +781,8 @@
               "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
               "redirectUrl": {"type": "string", "description": "The new URL."},
               "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this redirect."},
-              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
+              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -799,7 +828,8 @@
               "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
               "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
               "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
-              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
+              "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."},
+              "urlClassification": {"$ref": "UrlClassification","description": "Tracking classification if the request has been classified."}
             }
           }
         ],
@@ -843,7 +873,8 @@
               "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
               "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
               "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
-              "error": {"type": "string", "description": "The error description. This string is not guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content."}
+              "error": {"type": "string", "description": "The error description. This string is not guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content."},
+              "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}
             }
           }
         ],
diff --git a/toolkit/components/extensions/test/mochitest/file_third_party.html b/toolkit/components/extensions/test/mochitest/file_third_party.html
new file mode 100644
index 000000000000..d39c5b017665
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/file_third_party.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/toolkit/components/extensions/test/mochitest/mochitest-common.ini b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
index 41c53510a599..5b7607ab06c1 100644
--- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini
@@ -28,6 +28,7 @@ support-files =
   file_style_bad.css
   file_style_good.css
   file_style_redirect.css
+  file_third_party.html
   file_to_drawWindow.html
   file_webNavigation_clientRedirect.html
   file_webNavigation_clientRedirect_httpHeaders.html
@@ -158,5 +159,6 @@ skip-if = fission
 [test_ext_webrequest_upload.html]
 skip-if = os == 'android' # Currently fails in emulator tests
 [test_ext_webrequest_redirect_data_uri.html]
+[test_ext_webrequest_urlClassification.html]
 [test_ext_window_postMessage.html]
 [test_ext_webrequest_redirect_bypass_cors.html]
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_urlClassification.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_urlClassification.html
new file mode 100644
index 000000000000..f29ae5e8086e
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_urlClassification.html
@@ -0,0 +1,99 @@
+
+
+
+  Test for WebRequest urlClassification
+  
+  
+  
+  
+
+
+
+
+
+
+
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_urlclassification.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_urlclassification.js
new file mode 100644
index 000000000000..c4eae7af824b
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_urlclassification.js
@@ -0,0 +1,33 @@
+"use strict";
+
+const { Schemas } = ChromeUtils.import("resource://gre/modules/Schemas.jsm");
+
+/**
+ * If this test fails, likely nsIHttpChannel has added or changed a
+ * CLASSIFIED_* flag.  Those changes must be in sync with
+ * ChannelWrapper.webidl/cpp and the web_request.json schema file.
+ */
+add_task(async function test_webrequest_url_classification_enum() {
+  // use normalizeManifest to get the schema loaded.
+  await ExtensionTestUtils.normalizeManifest({ permissions: ["webRequest"] });
+
+  let ns = Schemas.getNamespace("webRequest");
+  let schema_enum = ns.get("UrlClassificationFlags").enumeration;
+  ok(
+    schema_enum.length > 0,
+    `UrlClassificationFlags: ${JSON.stringify(schema_enum)}`
+  );
+
+  let prefix = /^(?:CLASSIFIED_)/;
+  let entries = 0;
+  for (let c of Object.keys(Ci.nsIHttpChannel).filter(name =>
+    prefix.test(name)
+  )) {
+    let entry = c.replace(prefix, "").toLowerCase();
+    if (!entry.startsWith("socialtracking")) {
+      ok(schema_enum.includes(entry), `schema ${entry} is in IDL`);
+      entries++;
+    }
+  }
+  equal(schema_enum.length, entries, "same number of entries");
+});
diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell.ini b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
index a04aad8eab75..330289738c67 100644
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -58,6 +58,7 @@ skip-if = os == 'android' && processor == 'x86_64'
 skip-if = os == 'android' && processor == 'x86_64'
 [test_ext_unknown_permissions.js]
 skip-if = os == 'android' && processor == 'x86_64'
+[test_ext_webRequest_urlclassification.js]
 [test_load_all_api_modules.js]
 [test_locale_converter.js]
 [test_locale_data.js]
diff --git a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
index fce9bd4ef668..2e1b3656f942 100644
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp
@@ -48,6 +48,31 @@ namespace extensions {
 #define CHANNELWRAPPER_PROP_KEY \
   NS_LITERAL_STRING("ChannelWrapper::CachedInstance")
 
+using CF = nsIHttpChannel::ClassificationFlags;
+using MUC = MozUrlClassificationFlags;
+
+struct ClassificationStruct {
+  uint32_t mFlag;
+  MozUrlClassificationFlags mValue;
+};
+static const ClassificationStruct classificationArray[] = {
+    {CF::CLASSIFIED_FINGERPRINTING, MUC::Fingerprinting},
+    {CF::CLASSIFIED_FINGERPRINTING_CONTENT, MUC::Fingerprinting_content},
+    {CF::CLASSIFIED_CRYPTOMINING, MUC::Cryptomining},
+    {CF::CLASSIFIED_CRYPTOMINING_CONTENT, MUC::Cryptomining_content},
+    {CF::CLASSIFIED_TRACKING, MUC::Tracking},
+    {CF::CLASSIFIED_TRACKING_AD, MUC::Tracking_ad},
+    {CF::CLASSIFIED_TRACKING_ANALYTICS, MUC::Tracking_analytics},
+    {CF::CLASSIFIED_TRACKING_SOCIAL, MUC::Tracking_social},
+    {CF::CLASSIFIED_TRACKING_CONTENT, MUC::Tracking_content},
+    {CF::CLASSIFIED_SOCIALTRACKING, MUC::Socialtracking},
+    {CF::CLASSIFIED_SOCIALTRACKING_FACEBOOK, MUC::Socialtracking_facebook},
+    {CF::CLASSIFIED_SOCIALTRACKING_LINKEDIN, MUC::Socialtracking_linkedin},
+    {CF::CLASSIFIED_SOCIALTRACKING_TWITTER, MUC::Socialtracking_twitter},
+    {CF::CLASSIFIED_ANY_BASIC_TRACKING, MUC::Any_basic_tracking},
+    {CF::CLASSIFIED_ANY_STRICT_TRACKING, MUC::Any_strict_tracking},
+    {CF::CLASSIFIED_ANY_SOCIAL_TRACKING, MUC::Any_social_tracking}};
+
 /*****************************************************************************
  * Lifetimes
  *****************************************************************************/
@@ -170,6 +195,7 @@ void ChannelWrapper::ClearCachedAttributes() {
   ChannelWrapper_Binding::ClearCachedRemoteAddressValue(this);
   ChannelWrapper_Binding::ClearCachedStatusCodeValue(this);
   ChannelWrapper_Binding::ClearCachedStatusLineValue(this);
+  ChannelWrapper_Binding::ClearCachedUrlClassificationValue(this);
   if (!mFiredErrorEvent) {
     ChannelWrapper_Binding::ClearCachedErrorStringValue(this);
   }
@@ -861,6 +887,38 @@ void ChannelWrapper::GetRemoteAddress(nsCString& aRetVal) const {
   }
 }
 
+void FillClassification(
+    Sequence& classifications,
+    uint32_t classificationFlags, ErrorResult& aRv) {
+  if (classificationFlags == 0) {
+    return;
+  }
+  for (const auto& entry : classificationArray) {
+    if (classificationFlags & entry.mFlag) {
+      if (!classifications.AppendElement(entry.mValue, mozilla::fallible)) {
+        aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
+        return;
+      }
+    }
+  }
+}
+
+void ChannelWrapper::GetUrlClassification(
+    dom::Nullable& aRetVal, ErrorResult& aRv) const {
+  MozUrlClassification classification;
+  if (nsCOMPtr chan = MaybeHttpChannel()) {
+    uint32_t classificationFlags;
+    chan->GetFirstPartyClassificationFlags(&classificationFlags);
+    FillClassification(classification.mFirstParty, classificationFlags, aRv);
+    if (aRv.Failed()) {
+      return;
+    }
+    chan->GetThirdPartyClassificationFlags(&classificationFlags);
+    FillClassification(classification.mThirdParty, classificationFlags, aRv);
+  }
+  aRetVal.SetValue(std::move(classification));
+}
+
 /*****************************************************************************
  * Error handling
  *****************************************************************************/
diff --git a/toolkit/components/extensions/webrequest/ChannelWrapper.h b/toolkit/components/extensions/webrequest/ChannelWrapper.h
index 39614a8cd5ff..e5698d05f375 100644
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.h
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.h
@@ -227,6 +227,9 @@ class ChannelWrapper final : public DOMEventTargetHelper,
   void SetResponseHeader(const nsCString& header, const nsCString& value,
                          bool merge, ErrorResult& aRv);
 
+  void GetUrlClassification(dom::Nullable& aRetVal,
+                            ErrorResult& aRv) const;
+
   using EventTarget::EventListenerAdded;
   using EventTarget::EventListenerRemoved;
   virtual void EventListenerAdded(nsAtom* aType) override;
diff --git a/toolkit/components/extensions/webrequest/WebRequest.jsm b/toolkit/components/extensions/webrequest/WebRequest.jsm
index ca43c26e90bc..2a3b1d1105ac 100644
--- a/toolkit/components/extensions/webrequest/WebRequest.jsm
+++ b/toolkit/components/extensions/webrequest/WebRequest.jsm
@@ -217,6 +217,7 @@ const OPTIONAL_PROPERTIES = [
   "proxyInfo",
   "ip",
   "frameAncestors",
+  "urlClassification",
 ];
 
 function serializeRequestData(eventName) {
@@ -241,6 +242,18 @@ function serializeRequestData(eventName) {
       data[opt] = this[opt];
     }
   }
+
+  if (this.urlClassification) {
+    data.urlClassification = {
+      firstParty: this.urlClassification.firstParty.filter(
+        c => !c.startsWith("socialtracking_")
+      ),
+      thirdParty: this.urlClassification.thirdParty.filter(
+        c => !c.startsWith("socialtracking_")
+      ),
+    };
+  }
+
   return data;
 }
 
@@ -744,7 +757,7 @@ HttpObserverManager = {
     }
   },
 
-  getRequestData(channel, extraData) {
+  getRequestData(channel, extraData, policy) {
     let originAttributes =
       channel.loadInfo && channel.loadInfo.originAttributes;
     let data = {
@@ -771,6 +784,12 @@ HttpObserverManager = {
       serialize: serializeRequestData,
     };
 
+    // We're limiting access to
+    // urlClassification while the feature is further fleshed out.
+    if (policy && policy.extension.isPrivileged) {
+      data.urlClassification = channel.urlClassification;
+    }
+
     return Object.assign(data, extraData);
   },
 
@@ -826,7 +845,7 @@ HttpObserverManager = {
         }
 
         if (!commonData) {
-          commonData = this.getRequestData(channel, extraData);
+          commonData = this.getRequestData(channel, extraData, opts.extension);
           if (this.STATUS_TYPES.has(kind)) {
             commonData.statusCode = channel.statusCode;
             commonData.statusLine = channel.statusLine;

From 11122fd86c4d686bd6cc6e94677e4f2365b8278a Mon Sep 17 00:00:00 2001
From: Matthew Noorenberghe 
Date: Mon, 12 Aug 2019 23:24:46 +0000
Subject: [PATCH 055/100] Bug 1571465 - Stop treating field as generated
 password ones after blanking. r=sfoster

Differential Revision: https://phabricator.services.mozilla.com/D41146

--HG--
extra : moz-landing-system : lando
---
 .../passwordmgr/LoginManagerContent.jsm       | 50 +++++++++++++------
 .../test_autocomplete_new_password.html       | 31 +++++++++++-
 2 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm
index 264908e316ff..d8766c6b95a9 100644
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -210,6 +210,12 @@ const observer = {
         break;
       }
 
+      // Used to watch for changes to fields filled with generated passwords.
+      case "input": {
+        LoginManagerContent._maybeStopTreatingAsGeneratedPasswordField(aEvent);
+        break;
+      }
+
       case "keydown": {
         if (
           aEvent.keyCode == aEvent.DOM_VK_TAB ||
@@ -1522,6 +1528,27 @@ this.LoginManagerContent = {
     });
   },
 
+  _maybeStopTreatingAsGeneratedPasswordField(event) {
+    let passwordField = event.target;
+
+    // If the field isn't empty then keep treating it as a generated password field.
+    if (passwordField.value) {
+      return;
+    }
+
+    log("_maybeStopTreatingAsGeneratedPasswordField: Stopping");
+    // Remove all the event listeners added in _generatedPasswordFilledOrEdited
+    for (let eventType of ["blur", "change", "focus", "input"]) {
+      passwordField.removeEventListener(eventType, observer, {
+        capture: true,
+        mozSystemGroup: true,
+      });
+    }
+
+    // Mask the password field
+    this._togglePasswordFieldMasking(passwordField, false);
+  },
+
   /**
    * Notify the parent that a generated password was filled into a field or
    * edited so that it can potentially be saved.
@@ -1540,24 +1567,17 @@ this.LoginManagerContent = {
 
     this._highlightFilledField(passwordField);
 
-    passwordField.addEventListener("blur", observer, {
-      capture: true,
-      mozSystemGroup: true,
-    });
-    passwordField.addEventListener("focus", observer, {
-      capture: true,
-      mozSystemGroup: true,
-    });
-
+    // change: Listen for changes to the field filled with the generated password so we can preserve edits.
+    // input: Listen for the field getting blanked (without blurring) or a paste
+    for (let eventType of ["blur", "change", "focus", "input"]) {
+      passwordField.addEventListener(eventType, observer, {
+        capture: true,
+        mozSystemGroup: true,
+      });
+    }
     // Unmask the password field
     this._togglePasswordFieldMasking(passwordField, true);
 
-    // Listen for changes to the field filled with the generated password so we can preserve edits.
-    passwordField.addEventListener("change", observer, {
-      capture: true,
-      mozSystemGroup: true,
-    });
-
     if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
       log(
         "_generatedPasswordFilledOrEdited: not automatically saving the password in private browsing mode"
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_new_password.html b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_new_password.html
index 8da89a7c96cc..1a502ad7c78f 100644
--- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_new_password.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_new_password.html
@@ -196,6 +196,7 @@ add_task(async function test_autofillAutocompletePassword_withGeneration() {
   while (pword.value) {
     synthesizeKey("KEY_Backspace");
   }
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blanked field");
 
   info("This time select the generated password");
   shownPromise = promiseACShown();
@@ -237,11 +238,30 @@ add_task(async function test_autofillAutocompletePassword_withGeneration() {
   LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After blur");
   synthesizeKey("KEY_Tab", { shiftKey: true }); // focus again
   LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "After shift-tab to focus again");
+  // Remove selection for OS where the whole value is selected upon focus.
+  synthesizeKey("KEY_ArrowRight");
 
   while (pword.value) {
     LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, pword.value);
     synthesizeKey("KEY_Backspace");
   }
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blanked field");
+
+  info("Blur the empty field to trigger a 'change' event");
+  synthesizeKey("KEY_Tab"); // blur
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blur after blanking");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // focus again
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Focus again after blanking");
+
+  info("Type a single character after blanking");
+  synthesizeKey("@");
+
+  info("Blur the single-character field to trigger a 'change' event");
+  synthesizeKey("KEY_Tab"); // blur
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blur after backspacing");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // focus again
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Focus again after backspacing");
+  synthesizeKey("KEY_Backspace"); // Blank the field again
 
   shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown");
@@ -255,7 +275,7 @@ add_task(async function test_autofillAutocompletePassword_withGeneration() {
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
   await SimpleTest.promiseWaitForCondition(() => !!pword.value, "Check generated pw filled");
-  // Same generated password should be used.
+  // Same generated password should be used, even despite the 'change' to @ earlier.
   checkForm(2, "", generatedPW);
   LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "Second fill of the generated pw");
 
@@ -280,6 +300,15 @@ add_task(async function test_autofillAutocompletePassword_withGeneration() {
     LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, pword.value);
     synthesizeKey("KEY_Backspace");
   }
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blanked field again");
+
+  info("Blur the field to trigger a 'change' event again");
+  synthesizeKey("KEY_Tab"); // blur
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Blur after blanking again");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // focus again
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Focus again after blanking again");
+  // Remove selection for OS where the whole value is selected upon focus.
+  synthesizeKey("KEY_ArrowRight");
 
   shownPromise = promiseACShown();
   synthesizeKey("KEY_ArrowDown");

From a0b6e6a4137279dc474a976c5c093497169df8bc Mon Sep 17 00:00:00 2001
From: Matthew Noorenberghe 
Date: Mon, 12 Aug 2019 23:24:54 +0000
Subject: [PATCH 056/100] Bug 1571465 - Stop treating password fields we're
 about to fill as generated password ones. r=sfoster

Differential Revision: https://phabricator.services.mozilla.com/D41147

--HG--
extra : moz-landing-system : lando
---
 .../components/passwordmgr/LoginManager.jsm   |  2 +-
 .../passwordmgr/LoginManagerContent.jsm       | 26 ++----
 ...browser_context_menu_generated_password.js | 62 ++++++++++++++
 .../browser/browser_context_menu_iframe.js    | 82 ++++++-------------
 4 files changed, 97 insertions(+), 75 deletions(-)

diff --git a/toolkit/components/passwordmgr/LoginManager.jsm b/toolkit/components/passwordmgr/LoginManager.jsm
index 2da4b6d967d2..229092742662 100644
--- a/toolkit/components/passwordmgr/LoginManager.jsm
+++ b/toolkit/components/passwordmgr/LoginManager.jsm
@@ -33,7 +33,7 @@ ChromeUtils.defineModuleGetter(
 );
 
 XPCOMUtils.defineLazyGetter(this, "log", () => {
-  let logger = LoginHelper.createLogger("nsLoginManager");
+  let logger = LoginHelper.createLogger("LoginManager");
   return logger;
 });
 
diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm
index d8766c6b95a9..cc976137b51e 100644
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1006,9 +1006,9 @@ this.LoginManagerContent = {
     if (LoginHelper.isUsernameFieldType(acInputField)) {
       this.onUsernameAutocompleted(acInputField, loginGUID);
     } else if (acInputField.hasBeenTypePassword) {
-      // Ensure the field gets re-masked in case a generated password was
-      // filled into it previously.
-      this._disableAutomaticPasswordFieldUnmasking(acInputField);
+      // Ensure the field gets re-masked and edits don't overwrite the generated
+      // password in case a generated password was filled into it previously.
+      this._stopTreatingAsGeneratedPasswordField(acInputField);
       this._highlightFilledField(acInputField);
     }
   },
@@ -1535,8 +1535,12 @@ this.LoginManagerContent = {
     if (passwordField.value) {
       return;
     }
+    this._stopTreatingAsGeneratedPasswordField(passwordField);
+  },
+
+  _stopTreatingAsGeneratedPasswordField(passwordField) {
+    log("_stopTreatingAsGeneratedPasswordField");
 
-    log("_maybeStopTreatingAsGeneratedPasswordField: Stopping");
     // Remove all the event listeners added in _generatedPasswordFilledOrEdited
     for (let eventType of ["blur", "change", "focus", "input"]) {
       passwordField.removeEventListener(eventType, observer, {
@@ -1634,18 +1638,6 @@ this.LoginManagerContent = {
     editor.mask();
   },
 
-  _disableAutomaticPasswordFieldUnmasking(passwordField) {
-    passwordField.removeEventListener("blur", observer, {
-      capture: true,
-      mozSystemGroup: true,
-    });
-    passwordField.removeEventListener("focus", observer, {
-      capture: true,
-      mozSystemGroup: true,
-    });
-    this._togglePasswordFieldMasking(passwordField, false);
-  },
-
   /** Remove login field highlight when its value is cleared or overwritten.
    */
   _removeFillFieldHighlight(event) {
@@ -2013,7 +2005,7 @@ this.LoginManagerContent = {
       if (passwordField.value != selectedLogin.password) {
         // Ensure the field gets re-masked in case a generated password was
         // filled into it previously.
-        this._disableAutomaticPasswordFieldUnmasking(passwordField);
+        this._stopTreatingAsGeneratedPasswordField(passwordField);
         passwordField.setUserInput(selectedLogin.password);
         let autoFilledLogin = {
           guid: selectedLogin.QueryInterface(Ci.nsILoginMetaInfo).guid,
diff --git a/toolkit/components/passwordmgr/test/browser/browser_context_menu_generated_password.js b/toolkit/components/passwordmgr/test/browser/browser_context_menu_generated_password.js
index e75b21eed61f..05be6624332f 100644
--- a/toolkit/components/passwordmgr/test/browser/browser_context_menu_generated_password.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_context_menu_generated_password.js
@@ -278,9 +278,71 @@ add_task(async function fill_generated_password_with_matching_logins() {
           LTU.loginField.checkPasswordMasked(input, false, "after fill");
         }
       );
+
+      await openPasswordContextMenu(browser, passwordInputSelector);
+
+      // Execute the command of the first login menuitem found at the context menu.
+      let passwordChangedPromise = ContentTask.spawn(
+        browser,
+        null,
+        async function() {
+          let passwordInput = content.document.getElementById(
+            "form-basic-password"
+          );
+          await ContentTaskUtils.waitForEvent(passwordInput, "input");
+        }
+      );
+
+      let popupMenu = document.getElementById("fill-login-popup");
+      let firstLoginItem = popupMenu.getElementsByClassName(
+        "context-login-item"
+      )[0];
+      firstLoginItem.doCommand();
+
+      await passwordChangedPromise;
+
+      let contextMenu = document.getElementById("contentAreaContextMenu");
+      contextMenu.hidePopup();
+
+      // Blur the field to trigger a 'change' event.
+      await BrowserTestUtils.synthesizeKey("KEY_Tab", undefined, browser);
+      await BrowserTestUtils.synthesizeKey(
+        "KEY_Tab",
+        { shiftKey: true },
+        browser
+      );
+
+      await ContentTask.spawn(
+        browser,
+        [passwordInputSelector],
+        function checkFieldNotGeneratedPassword(inputSelector) {
+          let { LoginTestUtils: LTU } = ChromeUtils.import(
+            "resource://testing-common/LoginTestUtils.jsm"
+          );
+          const input = content.document.querySelector(inputSelector);
+          is(
+            input.value,
+            "pass1",
+            "Password field was filled with the saved password"
+          );
+          LTU.loginField.checkPasswordMasked(
+            input,
+            true,
+            "after fill of a saved login"
+          );
+        }
+      );
     }
   );
 
+  let logins = Services.logins.getAllLogins();
+  is(logins.length, 2, "Check 2 logins");
+  isnot(
+    logins[0].password,
+    logins[1].password,
+    "Generated password shouldn't have changed to match the filled password"
+  );
+
   Services.logins.removeAllLogins();
 });
 
diff --git a/toolkit/components/passwordmgr/test/browser/browser_context_menu_iframe.js b/toolkit/components/passwordmgr/test/browser/browser_context_menu_iframe.js
index 9350c61db5f8..4fecb0b35ae4 100644
--- a/toolkit/components/passwordmgr/test/browser/browser_context_menu_iframe.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_context_menu_iframe.js
@@ -36,29 +36,10 @@ add_task(async function test_context_menu_iframe_fill() {
       url: TEST_ORIGIN + IFRAME_PAGE_PATH,
     },
     async function(browser) {
-      let contextMenuShownPromise = BrowserTestUtils.waitForEvent(
-        window,
-        "popupshown"
-      );
-      let eventDetails = { type: "contextmenu", button: 2 };
-
-      // To click at the right point we have to take into account the iframe offset.
-      // Synthesize a right mouse click over the password input element.
-      BrowserTestUtils.synthesizeMouseAtCenter(
-        ["#test-iframe", "#form-basic-password"],
-        eventDetails,
-        browser
-      );
-      await contextMenuShownPromise;
-
-      // Synthesize a mouse click over the fill login menu header.
-      let popupHeader = document.getElementById("fill-login");
-      let popupShownPromise = BrowserTestUtils.waitForEvent(
-        popupHeader,
-        "popupshown"
-      );
-      EventUtils.synthesizeMouseAtCenter(popupHeader, {});
-      await popupShownPromise;
+      await openPasswordContextMenu(browser, [
+        "#test-iframe",
+        "#form-basic-password",
+      ]);
 
       let popupMenu = document.getElementById("fill-login-popup");
 
@@ -124,25 +105,18 @@ add_task(async function test_context_menu_iframe_sandbox() {
       url: TEST_ORIGIN + IFRAME_PAGE_PATH,
     },
     async function(browser) {
-      let contextMenuShownPromise = BrowserTestUtils.waitForEvent(
-        window,
-        "popupshown"
-      );
-      let eventDetails = { type: "contextmenu", button: 2 };
-
-      BrowserTestUtils.synthesizeMouseAtCenter(
+      await openPasswordContextMenu(
+        browser,
         ["#test-iframe-sandbox", "#form-basic-password"],
-        eventDetails,
-        browser
+        function checkDisabled() {
+          let popupHeader = document.getElementById("fill-login");
+          ok(
+            popupHeader.disabled,
+            "Check that the Fill Login menu item is disabled"
+          );
+          return false;
+        }
       );
-      await contextMenuShownPromise;
-
-      let popupHeader = document.getElementById("fill-login");
-      ok(
-        popupHeader.disabled,
-        "Check that the Fill Login menu item is disabled"
-      );
-
       let contextMenu = document.getElementById("contentAreaContextMenu");
       contextMenu.hidePopup();
     }
@@ -159,23 +133,17 @@ add_task(async function test_context_menu_iframe_sandbox_same_origin() {
       url: TEST_ORIGIN + IFRAME_PAGE_PATH,
     },
     async function(browser) {
-      let contextMenuShownPromise = BrowserTestUtils.waitForEvent(
-        window,
-        "popupshown"
-      );
-      let eventDetails = { type: "contextmenu", button: 2 };
-
-      BrowserTestUtils.synthesizeMouseAtCenter(
-        ["#test-iframe-sandbox-same-origin", "#form-basic-password"],
-        eventDetails,
-        browser
-      );
-      await contextMenuShownPromise;
-
-      let popupHeader = document.getElementById("fill-login");
-      ok(
-        !popupHeader.disabled,
-        "Check that the Fill Login menu item is enabled"
+      await openPasswordContextMenu(
+        browser,
+        ["#test-iframe-sandbox", "#form-basic-password"],
+        function checkDisabled() {
+          let popupHeader = document.getElementById("fill-login");
+          ok(
+            popupHeader.disabled,
+            "Check that the Fill Login menu item is disabled"
+          );
+          return false;
+        }
       );
 
       let contextMenu = document.getElementById("contentAreaContextMenu");

From 60b07d7f71c79b12b78c4f15f91d1d5777a04809 Mon Sep 17 00:00:00 2001
From: Matthew Noorenberghe 
Date: Wed, 14 Aug 2019 19:35:09 +0000
Subject: [PATCH 057/100] Bug 1571465 - Stop treating fields with replaced
 values as generated password ones r=sfoster

Depends on D41147

Differential Revision: https://phabricator.services.mozilla.com/D41148

--HG--
extra : moz-landing-system : lando
---
 .../passwordmgr/LoginManagerContent.jsm       |  9 +--
 ...ntent_generatedPasswordFilledOrEdited.html | 55 +++++++++++++++++++
 2 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm
index cc976137b51e..37ab8a2c6308 100644
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1530,12 +1530,13 @@ this.LoginManagerContent = {
 
   _maybeStopTreatingAsGeneratedPasswordField(event) {
     let passwordField = event.target;
+    let { value } = passwordField;
 
-    // If the field isn't empty then keep treating it as a generated password field.
-    if (passwordField.value) {
-      return;
+    // If the field is now empty or the inserted text replaced the whole value
+    // then stop treating it as a generated password field.
+    if (!value || (event.data && event.data == value)) {
+      this._stopTreatingAsGeneratedPasswordField(passwordField);
     }
-    this._stopTreatingAsGeneratedPasswordField(passwordField);
   },
 
   _stopTreatingAsGeneratedPasswordField(passwordField) {
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_LoginManagerContent_generatedPasswordFilledOrEdited.html b/toolkit/components/passwordmgr/test/mochitest/test_LoginManagerContent_generatedPasswordFilledOrEdited.html
index 4edd23594b44..3d6fd511a3e9 100644
--- a/toolkit/components/passwordmgr/test/mochitest/test_LoginManagerContent_generatedPasswordFilledOrEdited.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_LoginManagerContent_generatedPasswordFilledOrEdited.html
@@ -94,6 +94,61 @@ add_task(async function test_fieldsMaskedAfterSavedLoginFill() {
   await promiseFormsProcessed();
 });
 
+add_task(async function test_fieldsMaskedAfterReplacingWholeValue() {
+  let pword = $_(1, "pword");
+  pword.focus();
+
+  SpecialPowers.wrap(pword).setUserInput("generatedpass");
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Before first fill");
+  LoginManagerContent._generatedPasswordFilledOrEdited(pword);
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "After first fill");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // blur pw, focus un
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After blur");
+
+  synthesizeKey("KEY_Tab"); // focus again and replace the whole password value
+  info("Replacing password field value with arbitrary string");
+  sendString("some_other_password");
+  is(pword.value, "some_other_password", "Whole password replaced")
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Replaced password value");
+
+  synthesizeKey("KEY_Tab"); // blur pw
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After blur");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // focus pw again
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After focus again");
+
+  // Cleanup
+  recreateTree(document.getElementById("form1"));
+  await promiseFormsProcessed();
+});
+
+add_task(async function test_fieldsUnmaskedAfterAddingCharacter() {
+  let pword = $_(1, "pword");
+  pword.focus();
+
+  SpecialPowers.wrap(pword).setUserInput("generatedpass");
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "Before first fill");
+  LoginManagerContent._generatedPasswordFilledOrEdited(pword);
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "After first fill");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // blur pw, focus un
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After blur");
+
+  synthesizeKey("KEY_Tab"); // focus again
+  synthesizeKey("KEY_ArrowRight"); // Remove the selection
+  info("Adding a character to the end of the password");
+  sendString("@");
+  is(pword.value, "generatedpass@", "Character was added to the value")
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "Added @");
+
+  synthesizeKey("KEY_Tab"); // blur pw
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, true, "After blur after @");
+  synthesizeKey("KEY_Tab", { shiftKey: true }); // focus pw again
+  LOGIN_FIELD_UTILS.checkPasswordMasked(pword, false, "After focus after @");
+
+  // Cleanup
+  recreateTree(document.getElementById("form1"));
+  await promiseFormsProcessed();
+});
+
 add_task(async function test_typeNotPassword() {
   let pword = $_(1, "pword");
   pword.focus();

From 8c68307d03994b32d1099186a700243bdca2f949 Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 00:02:12 +0000
Subject: [PATCH 058/100] Bug 1573268 - Convert two
 layers.offmainthreadcomposition.* prefs to static prefs. r=njn

Converts layers.offmainthreadcomposition.async-animations and layers.offmainthreadcomposition.log-animations to their respective static prefs. Since all IsAnimationLoggingEnabled() did was create a pref and return the variable sShouldLog, this function is removed and replaced with the static pref.

Differential Revision: https://phabricator.services.mozilla.com/D41651

--HG--
extra : moz-landing-system : lando
---
 dom/animation/EffectCompositor.cpp       |  3 ++-
 dom/animation/KeyframeEffect.cpp         |  3 ++-
 layout/base/nsLayoutUtils.cpp            | 25 +-----------------------
 layout/base/nsLayoutUtils.h              |  5 -----
 modules/libpref/init/StaticPrefList.yaml | 12 ++++++++++++
 modules/libpref/init/all.js              |  6 ------
 6 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp
index 58f05bd2218f..535e15c39326 100644
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -25,6 +25,7 @@
 #include "mozilla/RestyleManager.h"
 #include "mozilla/ServoBindings.h"  // Servo_GetProperties_Overriding_Animation
 #include "mozilla/ServoStyleSet.h"
+#include "mozilla/StaticPrefs_layers.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/TypeTraits.h"  // For std::forward<>
 #include "nsContentUtils.h"
@@ -73,7 +74,7 @@ bool EffectCompositor::AllowCompositorAnimationsOnFrame(
   }
 
   if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
-    if (nsLayoutUtils::IsAnimationLoggingEnabled()) {
+    if (StaticPrefs::layers_offmainthreadcomposition_log_animations()) {
       nsCString message;
       message.AppendLiteral(
           "Performance warning: Async animations are "
diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp
index 1eef545db552..d99c4d123a4d 100644
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -25,6 +25,7 @@
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StaticPrefs_dom.h"
 #include "mozilla/StaticPrefs_gfx.h"
+#include "mozilla/StaticPrefs_layers.h"
 #include "mozilla/TypeTraits.h"
 #include "Layers.h"              // For Layer
 #include "nsComputedDOMStyle.h"  // nsComputedDOMStyle::GetComputedStyle
@@ -49,7 +50,7 @@ void AnimationProperty::SetPerformanceWarning(
   mPerformanceWarning = Some(aWarning);
 
   nsAutoString localizedString;
-  if (nsLayoutUtils::IsAnimationLoggingEnabled() &&
+  if (StaticPrefs::layers_offmainthreadcomposition_log_animations() &&
       mPerformanceWarning->ToLocalizedString(localizedString)) {
     nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString);
     AnimationUtils::LogAsyncAnimationFailure(logMessage, aElement);
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index fa72802a4217..01596f0389f4 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -517,33 +517,10 @@ Size nsLayoutUtils::ComputeSuitableScaleForAnimation(
 }
 
 bool nsLayoutUtils::AreAsyncAnimationsEnabled() {
-  static bool sAreAsyncAnimationsEnabled;
-  static bool sAsyncPrefCached = false;
-
-  if (!sAsyncPrefCached) {
-    sAsyncPrefCached = true;
-    Preferences::AddBoolVarCache(
-        &sAreAsyncAnimationsEnabled,
-        "layers.offmainthreadcomposition.async-animations");
-  }
-
-  return sAreAsyncAnimationsEnabled &&
+  return StaticPrefs::layers_offmainthreadcomposition_async_animations() &&
          gfxPlatform::OffMainThreadCompositingEnabled();
 }
 
-bool nsLayoutUtils::IsAnimationLoggingEnabled() {
-  static bool sShouldLog;
-  static bool sShouldLogPrefCached;
-
-  if (!sShouldLogPrefCached) {
-    sShouldLogPrefCached = true;
-    Preferences::AddBoolVarCache(
-        &sShouldLog, "layers.offmainthreadcomposition.log-animations");
-  }
-
-  return sShouldLog;
-}
-
 bool nsLayoutUtils::AreRetainedDisplayListsEnabled() {
 #ifdef MOZ_WIDGET_ANDROID
   return StaticPrefs::layout_display_list_retain();
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 8f616a9f5757..29cf590333a7 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2370,11 +2370,6 @@ class nsLayoutUtils {
    */
   static bool AreAsyncAnimationsEnabled();
 
-  /**
-   * Checks if we should warn about animations that can't be async
-   */
-  static bool IsAnimationLoggingEnabled();
-
   /**
    * Checks if retained display lists are enabled.
    */
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 9b2c9824e750..013e403fc8af 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -3780,6 +3780,18 @@
 #endif
   mirror: once
 
+# Whether to animate simple opacity and transforms on the compositor.
+- name: layers.offmainthreadcomposition.async-animations
+  type: bool
+  value: true
+  mirror: always
+
+# Whether to log information about off main thread animations to stderr.
+- name: layers.offmainthreadcomposition.log-animations
+  type: bool
+  value: false
+  mirror: always
+
 - name: layers.offmainthreadcomposition.force-disabled
   type: bool
   value: false
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index a139a3048f73..d9e96d1169e1 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4785,12 +4785,6 @@ pref("layers.tiles.edge-padding", true);
 pref("layers.tiles.edge-padding", false);
 #endif
 
-// Whether to animate simple opacity and transforms on the compositor
-pref("layers.offmainthreadcomposition.async-animations", true);
-
-// Whether to log information about off main thread animations to stderr
-pref("layers.offmainthreadcomposition.log-animations", false);
-
 pref("layers.draw-mask-debug", false);
 
 pref("gfx.content.always-paint", false);

From 6c57b2f2a804e66b5830d7e65f33258bb9b92f90 Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 00:03:38 +0000
Subject: [PATCH 059/100] Bug 1573268 - Convert
 layout.animated-image-layers.enabled to static pref. r=njn

Converts layout.animated-image-layers.enabled to a static pref and removes the nsLayoutUtils::AnimatedImageLayersEnabled() function, replacing it with the static pref.

Differential Revision: https://phabricator.services.mozilla.com/D41652

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 13 -------------
 layout/base/nsLayoutUtils.h              |  5 -----
 layout/generic/nsImageFrame.cpp          |  3 ++-
 layout/painting/nsDisplayList.cpp        |  2 +-
 modules/libpref/init/StaticPrefList.yaml |  6 ++++++
 modules/libpref/init/all.js              |  3 ---
 6 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 01596f0389f4..8f4c8b8aa44c 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -557,19 +557,6 @@ bool nsLayoutUtils::GPUImageScalingEnabled() {
   return sGPUImageScalingEnabled;
 }
 
-bool nsLayoutUtils::AnimatedImageLayersEnabled() {
-  static bool sAnimatedImageLayersEnabled;
-  static bool sAnimatedImageLayersPrefCached = false;
-
-  if (!sAnimatedImageLayersPrefCached) {
-    sAnimatedImageLayersPrefCached = true;
-    Preferences::AddBoolVarCache(&sAnimatedImageLayersEnabled,
-                                 "layout.animated-image-layers.enabled", false);
-  }
-
-  return sAnimatedImageLayersEnabled;
-}
-
 bool nsLayoutUtils::IsInterCharacterRubyEnabled() {
   static bool sInterCharacterRubyEnabled;
   static bool sInterCharacterRubyEnabledPrefCached = false;
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 29cf590333a7..c9dc1032724a 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2397,11 +2397,6 @@ class nsLayoutUtils {
    */
   static bool GPUImageScalingEnabled();
 
-  /**
-   * Checks whether we want to layerize animated images whenever possible.
-   */
-  static bool AnimatedImageLayersEnabled();
-
   /**
    * Checks whether support for inter-character ruby is enabled.
    */
diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp
index 1a416d838266..49bb79b42f73 100644
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -29,6 +29,7 @@
 #include "mozilla/MouseEvents.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/PresShellInlines.h"
+#include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/Unused.h"
 
 #include "nsCOMPtr.h"
@@ -1777,7 +1778,7 @@ LayerState nsDisplayImage::GetLayerState(
     const ContainerLayerParameters& aParameters) {
   if (!nsDisplayItem::ForceActiveLayers()) {
     bool animated = false;
-    if (!nsLayoutUtils::AnimatedImageLayersEnabled() ||
+    if (!StaticPrefs::layout_animated_image_layers_enabled() ||
         mImage->GetType() != imgIContainer::TYPE_RASTER ||
         NS_FAILED(mImage->GetAnimated(&animated)) || !animated) {
       if (!aManager->IsCompositingCheap() ||
diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
index 64fc68d5ec0d..ac634680c17f 100644
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4456,7 +4456,7 @@ nsDisplayBackgroundImage::ShouldCreateOwnLayer(nsDisplayListBuilder* aBuilder,
     return WHENEVER_POSSIBLE;
   }
 
-  if (nsLayoutUtils::AnimatedImageLayersEnabled() && mBackgroundStyle) {
+  if (StaticPrefs::layout_animated_image_layers_enabled() && mBackgroundStyle) {
     const nsStyleImageLayers::Layer& layer =
         mBackgroundStyle->StyleBackground()->mImage.mLayers[mLayer];
     const nsStyleImage* image = &layer.mImage;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 013e403fc8af..72c7cca3d557 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4027,6 +4027,12 @@
   value: false
   mirror: always
 
+# Whether we should layerize all animated images (if otherwise possible).
+- name: layout.animated-image-layers.enabled
+  type: bool
+  value: false
+  mirror: always
+
 - name: layout.animation.prerender.partial
   type: RelaxedAtomicBool
   value: false
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index d9e96d1169e1..62b8386c0057 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4950,9 +4950,6 @@ pref("full-screen-api.warning.delay", 500);
 // time for the warning box stays on the screen before sliding out, unit: ms
 pref("pointer-lock-api.warning.timeout", 3000);
 
-// Whether we should layerize all animated images (if otherwise possible).
-pref("layout.animated-image-layers.enabled", false);
-
 pref("dom.vibrator.enabled", true);
 pref("dom.vibrator.max_vibrate_ms", 10000);
 pref("dom.vibrator.max_vibrate_list_len", 128);

From 2809ff7952cbaa26dfaf7edc89c105cdd8ec58fa Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 22:52:38 +0000
Subject: [PATCH 060/100] Bug 1573268 - Convert
 layout.css.ruby.intercharacter.enabled to static pref. r=njn

Converts layout.css.ruby.intercharacter.enabled to a static pref and removes the associated function nsLayoutUtils::IsInterCharacterRubyEnabled(). Also removes the macro INTERCHARACTER_RUBY_ENABLED_PREF_NAME, since it was only being used to add the varcache pref.

Differential Revision: https://phabricator.services.mozilla.com/D41653

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 16 ----------------
 layout/base/nsLayoutUtils.h              |  5 -----
 layout/generic/nsRubyFrame.cpp           |  3 ++-
 modules/libpref/init/StaticPrefList.yaml |  6 ++++++
 modules/libpref/init/all.js              |  3 ---
 5 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 8f4c8b8aa44c..08125ba776f5 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -167,9 +167,6 @@ using namespace mozilla::gfx;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_METADATA;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_NOTHING;
 
-#define INTERCHARACTER_RUBY_ENABLED_PREF_NAME \
-  "layout.css.ruby.intercharacter.enabled"
-
 // The time in number of frames that we estimate for a refresh driver
 // to be quiescent
 #define DEFAULT_QUIESCENT_FRAMES 2
@@ -557,19 +554,6 @@ bool nsLayoutUtils::GPUImageScalingEnabled() {
   return sGPUImageScalingEnabled;
 }
 
-bool nsLayoutUtils::IsInterCharacterRubyEnabled() {
-  static bool sInterCharacterRubyEnabled;
-  static bool sInterCharacterRubyEnabledPrefCached = false;
-
-  if (!sInterCharacterRubyEnabledPrefCached) {
-    sInterCharacterRubyEnabledPrefCached = true;
-    Preferences::AddBoolVarCache(&sInterCharacterRubyEnabled,
-                                 INTERCHARACTER_RUBY_ENABLED_PREF_NAME, false);
-  }
-
-  return sInterCharacterRubyEnabled;
-}
-
 void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame,
                                        nsOverflowAreas& aOverflowAreas,
                                        FrameChildListIDs aSkipChildLists) {
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index c9dc1032724a..40294509cea4 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2397,11 +2397,6 @@ class nsLayoutUtils {
    */
   static bool GPUImageScalingEnabled();
 
-  /**
-   * Checks whether support for inter-character ruby is enabled.
-   */
-  static bool IsInterCharacterRubyEnabled();
-
   static bool InterruptibleReflowEnabled() {
     return sInterruptibleReflowEnabled;
   }
diff --git a/layout/generic/nsRubyFrame.cpp b/layout/generic/nsRubyFrame.cpp
index 7207cd7e13cd..a770df03e04f 100644
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -12,6 +12,7 @@
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/PresShell.h"
+#include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/WritingModes.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
@@ -312,7 +313,7 @@ void nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
 
     LogicalPoint position(lineWM);
     if (side.isSome()) {
-      if (nsLayoutUtils::IsInterCharacterRubyEnabled() &&
+      if (StaticPrefs::layout_css_ruby_intercharacter_enabled() &&
           rtcWM.IsVerticalRL() &&
           lineWM.GetInlineDir() == WritingMode::eInlineLTR) {
         // Inter-character ruby annotations are only supported for vertical-rl
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 72c7cca3d557..bd82af9afb7d 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4329,6 +4329,12 @@
   value: true
   mirror: always
 
+# Are inter-character ruby annotations enabled?
+- name: layout.css.ruby.intercharacter.enabled
+  type: bool
+  value: false
+  mirror: always
+
 - name: layout.css.scroll-behavior.damping-ratio
   type: AtomicFloat
   value: 1.0f
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 62b8386c0057..7fa02290a8d4 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2952,9 +2952,6 @@ pref("layout.css.scroll-behavior.spring-constant", "250.0");
 // at the greatest speed without overshooting.
 pref("layout.css.scroll-behavior.damping-ratio", "1.0");
 
-// Are inter-character ruby annotations enabled?
-pref("layout.css.ruby.intercharacter.enabled", false);
-
 // pref for which side vertical scrollbars should be on
 // 0 = end-side in UI direction
 // 1 = end-side in document/content direction

From c562d89e13e75d6dca9aaf3355330b466f5f9d3d Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 00:07:32 +0000
Subject: [PATCH 061/100] Bug 1573268 - Convert font.size.inflation.maxRatio to
 static pref. r=njn

Creates the new 'font' category in StaticPrefList.yaml and adds font.size.inflation.maxRatio to the category. Removes the old static uint in nsLayoutUtils and the function that returns it.

Differential Revision: https://phabricator.services.mozilla.com/D41654

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            |  7 ++-----
 layout/base/nsLayoutUtils.h              |  9 ---------
 modules/libpref/init/StaticPrefList.yaml | 15 +++++++++++++++
 modules/libpref/init/all.js              | 12 ------------
 modules/libpref/moz.build                |  1 +
 5 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 08125ba776f5..03e7baed3be3 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -26,6 +26,7 @@
 #include "mozilla/ServoStyleSetInlines.h"
 #include "mozilla/StaticPrefs_apz.h"
 #include "mozilla/StaticPrefs_dom.h"
+#include "mozilla/StaticPrefs_font.h"
 #include "mozilla/StaticPrefs_gfx.h"
 #include "mozilla/StaticPrefs_layers.h"
 #include "mozilla/StaticPrefs_layout.h"
@@ -191,8 +192,6 @@ uint32_t nsLayoutUtils::sFontSizeInflationLineThreshold;
 /* static */
 int32_t nsLayoutUtils::sFontSizeInflationMappingIntercept;
 /* static */
-uint32_t nsLayoutUtils::sFontSizeInflationMaxRatio;
-/* static */
 bool nsLayoutUtils::sFontSizeInflationForceEnabled;
 /* static */
 bool nsLayoutUtils::sFontSizeInflationDisabledInMasterProcess;
@@ -7986,8 +7985,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sFontSizeInflationMaxRatio,
-                               "font.size.inflation.maxRatio");
   Preferences::AddUintVarCache(&sFontSizeInflationEmPerLine,
                                "font.size.inflation.emPerLine");
   Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
@@ -8248,7 +8245,7 @@ float nsLayoutUtils::FontSizeInflationInner(const nsIFrame* aFrame,
   }
 
   int32_t interceptParam = nsLayoutUtils::FontSizeInflationMappingIntercept();
-  float maxRatio = (float)nsLayoutUtils::FontSizeInflationMaxRatio() / 100.0f;
+  float maxRatio = (float)StaticPrefs::font_size_inflation_maxRatio() / 100.0f;
 
   float ratio = float(styleFontSize) / float(aMinFontSize);
   float inflationRatio;
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 40294509cea4..5c2f3cbfc0f9 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,14 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  /**
-   * See comment above "font.size.inflation.maxRatio" in
-   * modules/libpref/src/init/all.js .
-   */
-  static uint32_t FontSizeInflationMaxRatio() {
-    return sFontSizeInflationMaxRatio;
-  }
-
   /**
    * See comment above "font.size.inflation.emPerLine" in
    * modules/libpref/src/init/all.js .
@@ -3061,7 +3053,6 @@ class nsLayoutUtils {
   static uint32_t sFontSizeInflationMinTwips;
   static uint32_t sFontSizeInflationLineThreshold;
   static int32_t sFontSizeInflationMappingIntercept;
-  static uint32_t sFontSizeInflationMaxRatio;
   static bool sFontSizeInflationForceEnabled;
   static bool sFontSizeInflationDisabledInMasterProcess;
   static uint32_t sSystemFontScale;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index bd82af9afb7d..ea325d19e373 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2528,6 +2528,21 @@
   value: false
   mirror: always
 
+#---------------------------------------------------------------------------
+# Prefs starting with "font."
+#---------------------------------------------------------------------------
+
+# This controls the percentage that fonts will be inflated, if font
+# size inflation is enabled. Essentially, if we have a specified font
+# size, s, and an inflated font size, i, this specifies that the ratio
+# i/s * 100 should never exceed the value of this preference. In order
+# for this preference to have any effect, its value must be greater
+# than 100, since font inflation can never decrease the ratio i/s.
+- name: font.size.inflation.maxRatio
+  type: uint32_t
+  value: 0
+  mirror: always
+
 #---------------------------------------------------------------------------
 # Prefs starting with "full-screen-api."
 #---------------------------------------------------------------------------
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 7fa02290a8d4..a5671d3080c8 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3446,18 +3446,6 @@ pref("font.size.inflation.lineThreshold", 400);
  */
 pref("font.size.inflation.mappingIntercept", 1);
 
-/*
- * This controls the percentage that fonts will be inflated, if font
- * size inflation is enabled. Essentially, if we have a specified font
- * size, s, and an inflated font size, i, this specifies that the ratio
- * i/s * 100 should never exceed the value of this preference.
- *
- * In order for this preference to have any effect, its value must be
- * greater than 100, since font inflation can never decrease the ratio
- * i/s.
- */
-pref("font.size.inflation.maxRatio", 0);
-
 /**
  * This setting corresponds to a global text zoom setting affecting
  * all content that is not already subject to font size inflation.
diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
index 8a79a347f6af..855f03547ff4 100644
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -40,6 +40,7 @@ pref_groups = [
     'editor',
     'extensions',
     'fission',
+    'font',
     'full_screen_api',
     'general',
     'geo',

From 6a396a81675d91801c8c2af965682faa64bbe139 Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 18:19:33 +0000
Subject: [PATCH 062/100] Bug 1573268 - Convert 3 font.size.inflation.* prefs
 to static prefs. r=njn

Converts font.size.inflation.minTwips, font.size.inflation.emPerLine, and font.size.inflation.mappingIntercept to static prefs and removes their associated functions from nsLayoutUtils. There are associated member variables in PresShell, but since documentation specified that these variables are set specifically to prevent changes to the cache from being read until page reload, I made the decision to leave these and set them to the static prefs.

Differential Revision: https://phabricator.services.mozilla.com/D41656

--HG--
extra : moz-landing-system : lando
---
 layout/base/PresShell.cpp                |  5 ++-
 layout/base/nsLayoutUtils.cpp            | 14 +------
 layout/base/nsLayoutUtils.h              | 27 --------------
 mobile/android/app/mobile.js             |  2 -
 modules/libpref/init/StaticPrefList.yaml | 47 ++++++++++++++++++++++++
 modules/libpref/init/all.js              | 45 -----------------------
 6 files changed, 51 insertions(+), 89 deletions(-)

diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
index 433e4da881c8..61aa4635e576 100644
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -29,6 +29,7 @@
 #include "mozilla/Sprintf.h"
 #include "mozilla/StaticPrefs_apz.h"
 #include "mozilla/StaticPrefs_dom.h"
+#include "mozilla/StaticPrefs_font.h"
 #include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TimeStamp.h"
@@ -1032,8 +1033,8 @@ void PresShell::Init(Document* aDocument, nsPresContext* aPresContext,
   QueryIsActive();
 
   // Setup our font inflation preferences.
-  mFontSizeInflationEmPerLine = nsLayoutUtils::FontSizeInflationEmPerLine();
-  mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
+  mFontSizeInflationEmPerLine = StaticPrefs::font_size_inflation_emPerLine();
+  mFontSizeInflationMinTwips = StaticPrefs::font_size_inflation_minTwips();
   mFontSizeInflationLineThreshold =
       nsLayoutUtils::FontSizeInflationLineThreshold();
   mFontSizeInflationForceEnabled =
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 03e7baed3be3..15e5048cafdc 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,15 +183,9 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-uint32_t nsLayoutUtils::sFontSizeInflationEmPerLine;
-/* static */
-uint32_t nsLayoutUtils::sFontSizeInflationMinTwips;
 /* static */
 uint32_t nsLayoutUtils::sFontSizeInflationLineThreshold;
 /* static */
-int32_t nsLayoutUtils::sFontSizeInflationMappingIntercept;
-/* static */
 bool nsLayoutUtils::sFontSizeInflationForceEnabled;
 /* static */
 bool nsLayoutUtils::sFontSizeInflationDisabledInMasterProcess;
@@ -7985,14 +7979,8 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sFontSizeInflationEmPerLine,
-                               "font.size.inflation.emPerLine");
-  Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
-                               "font.size.inflation.minTwips");
   Preferences::AddUintVarCache(&sFontSizeInflationLineThreshold,
                                "font.size.inflation.lineThreshold");
-  Preferences::AddIntVarCache(&sFontSizeInflationMappingIntercept,
-                              "font.size.inflation.mappingIntercept");
   Preferences::AddBoolVarCache(&sFontSizeInflationForceEnabled,
                                "font.size.inflation.forceEnabled");
   Preferences::AddBoolVarCache(&sFontSizeInflationDisabledInMasterProcess,
@@ -8244,7 +8232,7 @@ float nsLayoutUtils::FontSizeInflationInner(const nsIFrame* aFrame,
     }
   }
 
-  int32_t interceptParam = nsLayoutUtils::FontSizeInflationMappingIntercept();
+  int32_t interceptParam = StaticPrefs::font_size_inflation_mappingIntercept();
   float maxRatio = (float)StaticPrefs::font_size_inflation_maxRatio() / 100.0f;
 
   float ratio = float(styleFontSize) / float(aMinFontSize);
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 5c2f3cbfc0f9..1e0c74e38354 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,22 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  /**
-   * See comment above "font.size.inflation.emPerLine" in
-   * modules/libpref/src/init/all.js .
-   */
-  static uint32_t FontSizeInflationEmPerLine() {
-    return sFontSizeInflationEmPerLine;
-  }
-
-  /**
-   * See comment above "font.size.inflation.minTwips" in
-   * modules/libpref/src/init/all.js .
-   */
-  static uint32_t FontSizeInflationMinTwips() {
-    return sFontSizeInflationMinTwips;
-  }
-
   /**
    * See comment above "font.size.inflation.lineThreshold" in
    * modules/libpref/src/init/all.js .
@@ -2495,14 +2479,6 @@ class nsLayoutUtils {
     return sQuiescentFramesBeforeIdlePeriod;
   }
 
-  /**
-   * See comment above "font.size.inflation.mappingIntercept" in
-   * modules/libpref/src/init/all.js .
-   */
-  static int32_t FontSizeInflationMappingIntercept() {
-    return sFontSizeInflationMappingIntercept;
-  }
-
   /**
    * Returns true if the nglayout.debug.invalidation pref is set to true.
    * Note that sInvalidationDebuggingIsEnabled is declared outside this function
@@ -3049,10 +3025,7 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static uint32_t sFontSizeInflationEmPerLine;
-  static uint32_t sFontSizeInflationMinTwips;
   static uint32_t sFontSizeInflationLineThreshold;
-  static int32_t sFontSizeInflationMappingIntercept;
   static bool sFontSizeInflationForceEnabled;
   static bool sFontSizeInflationDisabledInMasterProcess;
   static uint32_t sSystemFontScale;
diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js
index e42ac1c8f700..4f3e7cba79d2 100644
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -346,8 +346,6 @@ pref("devtools.debugger.unix-domain-socket", "@ANDROID_PACKAGE_NAME@/firefox-deb
 pref("devtools.remote.usb.enabled", false);
 pref("devtools.remote.wifi.enabled", false);
 
-pref("font.size.inflation.minTwips", 0);
-
 // When true, zooming will be enabled on all sites, even ones that declare user-scalable=no.
 pref("browser.ui.zoom.force-user-scalable", false);
 
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ea325d19e373..ef29bcdf894a 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2532,6 +2532,53 @@
 # Prefs starting with "font."
 #---------------------------------------------------------------------------
 
+# A value greater than zero enables font size inflation for
+# pan-and-zoom UIs, so that the fonts in a block are at least the size
+# that, if a block's width is scaled to match the device's width, the
+# fonts in the block are big enough that at most the pref value ems of
+# text fit in *the width of the device*.
+#
+# When both this pref and the next are set, the larger inflation is used.
+- name: font.size.inflation.emPerLine
+  type: uint32_t
+  value: 0
+  mirror: always
+
+# A value greater than zero enables font size inflation for
+# pan-and-zoom UIs, so that if a block's width is scaled to match the
+# device's width, the fonts in a block are at least the given font size.
+# The value given is in twips, i.e., 1/20 of a point, or 1/1440 of an inch.
+#
+# When both this pref and the previous are set, the larger inflation is used.
+- name: font.size.inflation.minTwips
+  type: uint32_t
+  value: 0
+  mirror: always
+
+# Defines the font size inflation mapping intercept parameter.
+#
+# Font size inflation computes a minimum font size, m, based on
+# other preferences (see font.size.inflation.minTwips and
+# font.size.inflation.emPerLine, above) and the width of the
+# frame in which the text resides. Using this minimum, a specified
+# font size, s, is mapped to an inflated font size, i, using an
+# equation that varies depending on the value of the font size
+# inflation mapping intercept parameter, P.
+#
+# If the intercept parameter is negative, then the following mapping
+# function is used:
+#
+# i = m + s
+#
+# If the intercept parameter is non-negative, then the mapping function
+# is a function such that its graph meets the graph of i = s at the
+# point where both i and s are (1 + P/2) * m for values of s that are
+# large enough. This means that when s=0, i is always equal to m.
+- name: font.size.inflation.mappingIntercept
+  type: int32_t
+  value: 1
+  mirror: always
+
 # This controls the percentage that fonts will be inflated, if font
 # size inflation is enabled. Essentially, if we have a specified font
 # size, s, and an inflated font size, i, this specifies that the ratio
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index a5671d3080c8..046e278bf5e4 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3357,28 +3357,6 @@ pref("font.minimum-size.x-math", 0);
 pref("font.size.variable.x-math", 16);
 pref("font.size.monospace.x-math", 13);
 
-/*
- * A value greater than zero enables font size inflation for
- * pan-and-zoom UIs, so that the fonts in a block are at least the size
- * that, if a block's width is scaled to match the device's width, the
- * fonts in the block are big enough that at most the pref value ems of
- * text fit in *the width of the device*.
- *
- * When both this pref and the next are set, the larger inflation is
- * used.
- */
-pref("font.size.inflation.emPerLine", 0);
-/*
- * A value greater than zero enables font size inflation for
- * pan-and-zoom UIs, so that if a block's width is scaled to match the
- * device's width, the fonts in a block are at least the font size
- * given.  The value given is in twips, i.e., 1/20 of a point, or 1/1440
- * of an inch.
- *
- * When both this pref and the previous are set, the larger inflation is
- * used.
- */
-pref("font.size.inflation.minTwips", 0);
 /*
  * In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
  * this pref forces font inflation to always be enabled in all modes.
@@ -3423,29 +3401,6 @@ pref("font.size.inflation.disabledInMasterProcess", false);
  */
 pref("font.size.inflation.lineThreshold", 400);
 
-/*
- * Defines the font size inflation mapping intercept parameter.
- *
- * Font size inflation computes a minimum font size, m, based on
- * other preferences (see font.size.inflation.minTwips and
- * font.size.inflation.emPerLine, above) and the width of the
- * frame in which the text resides. Using this minimum, a specified
- * font size, s, is mapped to an inflated font size, i, using an
- * equation that varies depending on the value of the font size
- * inflation mapping intercept parameter, P:
- *
- * If the intercept parameter is negative, then the following mapping
- * function is used:
- *
- * i = m + s
- *
- * If the intercept parameter is non-negative, then the mapping function
- * is a function such that its graph meets the graph of i = s at the
- * point where both i and s are (1 + P/2) * m for values of s that are
- * large enough. This means that when s=0, i is always equal to m.
- */
-pref("font.size.inflation.mappingIntercept", 1);
-
 /**
  * This setting corresponds to a global text zoom setting affecting
  * all content that is not already subject to font size inflation.

From 1774881905539ed0f61e10a8e174ad10522e8c86 Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 18:23:54 +0000
Subject: [PATCH 063/100] Bug 1573268 - Convert
 font.size.inflation.lineThreshold to a static pref. r=njn

Converts font.size.inflation.lineThreshold varcache pref to a static pref. Like previous revisions, this retains the member variable in PresShell.

Differential Revision: https://phabricator.services.mozilla.com/D41662

--HG--
extra : moz-landing-system : lando
---
 layout/base/PresShell.cpp                |  2 +-
 layout/base/nsLayoutUtils.cpp            |  4 ----
 layout/base/nsLayoutUtils.h              |  9 ---------
 layout/generic/nsFontInflationData.cpp   |  2 +-
 modules/libpref/init/StaticPrefList.yaml | 24 ++++++++++++++++++++++++
 modules/libpref/init/all.js              | 22 ----------------------
 6 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
index 61aa4635e576..5e1730bba5c5 100644
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1036,7 +1036,7 @@ void PresShell::Init(Document* aDocument, nsPresContext* aPresContext,
   mFontSizeInflationEmPerLine = StaticPrefs::font_size_inflation_emPerLine();
   mFontSizeInflationMinTwips = StaticPrefs::font_size_inflation_minTwips();
   mFontSizeInflationLineThreshold =
-      nsLayoutUtils::FontSizeInflationLineThreshold();
+      StaticPrefs::font_size_inflation_lineThreshold();
   mFontSizeInflationForceEnabled =
       nsLayoutUtils::FontSizeInflationForceEnabled();
   mFontSizeInflationDisabledInMasterProcess =
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 15e5048cafdc..3946142fa94f 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-uint32_t nsLayoutUtils::sFontSizeInflationLineThreshold;
 /* static */
 bool nsLayoutUtils::sFontSizeInflationForceEnabled;
 /* static */
@@ -7979,8 +7977,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sFontSizeInflationLineThreshold,
-                               "font.size.inflation.lineThreshold");
   Preferences::AddBoolVarCache(&sFontSizeInflationForceEnabled,
                                "font.size.inflation.forceEnabled");
   Preferences::AddBoolVarCache(&sFontSizeInflationDisabledInMasterProcess,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 1e0c74e38354..b328f43af89a 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,14 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  /**
-   * See comment above "font.size.inflation.lineThreshold" in
-   * modules/libpref/src/init/all.js .
-   */
-  static uint32_t FontSizeInflationLineThreshold() {
-    return sFontSizeInflationLineThreshold;
-  }
-
   static bool FontSizeInflationForceEnabled() {
     return sFontSizeInflationForceEnabled;
   }
@@ -3025,7 +3017,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static uint32_t sFontSizeInflationLineThreshold;
   static bool sFontSizeInflationForceEnabled;
   static bool sFontSizeInflationDisabledInMasterProcess;
   static uint32_t sSystemFontScale;
diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp
index 4f9f8fb77bd0..f445d5cf0ceb 100644
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -194,7 +194,7 @@ void nsFontInflationData::UpdateISize(const ReflowInput& aReflowInput) {
   nscoord newNCAISize = ComputeDescendantISize(aReflowInput, nca);
 
   // See comment above "font.size.inflation.lineThreshold" in
-  // modules/libpref/src/init/all.js .
+  // modules/libpref/src/init/StaticPrefList.yaml .
   PresShell* presShell = bfc->PresShell();
   uint32_t lineThreshold = presShell->FontSizeInflationLineThreshold();
   nscoord newTextThreshold = (newNCAISize * lineThreshold) / 100;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ef29bcdf894a..160e5817197c 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2579,6 +2579,30 @@
   value: 1
   mirror: always
 
+# Since the goal of font size inflation is to avoid having to
+# repeatedly scroll side to side to read a block of text, and there are
+# a number of page layouts where a relatively small chunk of text is
+# better off not being inflated according to the same algorithm we use
+# for larger chunks of text, we want a threshold for an amount of text
+# that triggers font size inflation.  This preference controls that
+# threshold.
+#
+# It controls the threshold used within an *approximation* of the
+# number of lines of text we use.  In particular, if we assume that
+# each character (collapsing collapsible whitespace) has a width the
+# same as the em-size of the font (when, normally, it's actually quite
+# a bit smaller on average), this preference gives the percentage of a
+# number of lines of text we'd need to trigger inflation.  This means
+# that a percentage of 100 means that we'd need a number of characters
+# (we know the font size and the width) equivalent to one line of
+# square text (which is actually a lot less than a real line of text).
+#
+# A value of 0 means there's no character length threshold.
+- name: font.size.inflation.lineThreshold
+  type: uint32_t
+  value: 400
+  mirror: always
+
 # This controls the percentage that fonts will be inflated, if font
 # size inflation is enabled. Essentially, if we have a specified font
 # size, s, and an inflated font size, i, this specifies that the ratio
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 046e278bf5e4..b057ea83154d 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3378,28 +3378,6 @@ pref("font.size.inflation.forceEnabled", false);
  * this pref.
  */
 pref("font.size.inflation.disabledInMasterProcess", false);
-/*
- * Since the goal of font size inflation is to avoid having to
- * repeatedly scroll side to side to read a block of text, and there are
- * a number of page layouts where a relatively small chunk of text is
- * better of not being inflated according to the same algorithm we use
- * for larger chunks of text, we want a threshold for an amount of text
- * that triggers font size inflation.  This preference controls that
- * threshold.
- *
- * It controls the threshold used within an *approximation* of the
- * number of lines of text we use.  In particular, if we assume that
- * each character (collapsing collapsible whitespace) has a width the
- * same as the em-size of the font (when, normally, it's actually quite
- * a bit smaller on average), this preference gives the percentage of a
- * number of lines of text we'd need to trigger inflation.  This means
- * that a percentage of 100 means that we'd need a number of characters
- * (we know the font size and the width) equivalent to one line of
- * square text (which is actually a lot less than a real line of text).
- *
- * A value of 0 means there's no character length threshold.
- */
-pref("font.size.inflation.lineThreshold", 400);
 
 /**
  * This setting corresponds to a global text zoom setting affecting

From cccb97beb8170558dfe0b459a6b5e9fbbeb26964 Mon Sep 17 00:00:00 2001
From: kriswright 
Date: Tue, 13 Aug 2019 20:15:52 +0000
Subject: [PATCH 064/100] Bug 1573268 - Convert two font.size.inflation.* prefs
 to static prefs. r=njn

Converts font.size.inflation.forceEnabled and font.size.inflation.disabledInMasterProcess to static prefs. Like previous revisions, I retained the member variables in PresShell and set them to the static prefs.

Differential Revision: https://phabricator.services.mozilla.com/D41664

--HG--
extra : moz-landing-system : lando
---
 layout/base/PresShell.cpp                |  4 ++--
 layout/base/nsLayoutUtils.cpp            |  8 --------
 layout/base/nsLayoutUtils.h              | 10 ----------
 modules/libpref/init/StaticPrefList.yaml | 25 ++++++++++++++++++++++++
 modules/libpref/init/all.js              | 22 ---------------------
 5 files changed, 27 insertions(+), 42 deletions(-)

diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
index 5e1730bba5c5..30e2f1bc485e 100644
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1038,9 +1038,9 @@ void PresShell::Init(Document* aDocument, nsPresContext* aPresContext,
   mFontSizeInflationLineThreshold =
       StaticPrefs::font_size_inflation_lineThreshold();
   mFontSizeInflationForceEnabled =
-      nsLayoutUtils::FontSizeInflationForceEnabled();
+      StaticPrefs::font_size_inflation_forceEnabled();
   mFontSizeInflationDisabledInMasterProcess =
-      nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
+      StaticPrefs::font_size_inflation_disabledInMasterProcess();
   // We'll compute the font size inflation state in Initialize(), when we know
   // the document type.
 
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 3946142fa94f..8ccc92dd019b 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,10 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-bool nsLayoutUtils::sFontSizeInflationForceEnabled;
-/* static */
-bool nsLayoutUtils::sFontSizeInflationDisabledInMasterProcess;
 /* static */
 uint32_t nsLayoutUtils::sSystemFontScale;
 /* static */
@@ -7977,10 +7973,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddBoolVarCache(&sFontSizeInflationForceEnabled,
-                               "font.size.inflation.forceEnabled");
-  Preferences::AddBoolVarCache(&sFontSizeInflationDisabledInMasterProcess,
-                               "font.size.inflation.disabledInMasterProcess");
   Preferences::AddUintVarCache(&sSystemFontScale, "font.size.systemFontScale",
                                100);
   Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300);
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index b328f43af89a..4dfae1bf3e7b 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,14 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  static bool FontSizeInflationForceEnabled() {
-    return sFontSizeInflationForceEnabled;
-  }
-
-  static bool FontSizeInflationDisabledInMasterProcess() {
-    return sFontSizeInflationDisabledInMasterProcess;
-  }
-
   /**
    * See comment above "font.size.systemFontScale" in
    * modules/libpref/init/all.js.
@@ -3017,8 +3009,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static bool sFontSizeInflationForceEnabled;
-  static bool sFontSizeInflationDisabledInMasterProcess;
   static uint32_t sSystemFontScale;
   static uint32_t sZoomMaxPercent;
   static uint32_t sZoomMinPercent;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 160e5817197c..60b67f5cdafe 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2555,6 +2555,31 @@
   value: 0
   mirror: always
 
+# In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
+# this pref forces font inflation to always be enabled in all modes.
+# That is, any heuristics used to detect pan-and-zoom
+# vs. non-pan-and-zoom modes are disabled and all content is treated
+# as pan-and-zoom mode wrt font inflation.
+#
+# This pref has no effect if font inflation is not enabled through
+# either of the prefs above.  It has no meaning in single-mode UIs.
+- name: font.size.inflation.forceEnabled
+  type: bool
+  value: false
+  mirror: always
+
+# In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
+# this pref disables font inflation in master-process contexts where
+# existing heuristics can't be used determine enabled-ness.
+#
+# This pref has no effect if font inflation is not enabled through
+# either of the prefs above.  The "forceEnabled" pref above overrides
+# this pref.
+- name: font.size.inflation.disabledInMasterProcess
+  type: bool
+  value: false
+  mirror: always
+
 # Defines the font size inflation mapping intercept parameter.
 #
 # Font size inflation computes a minimum font size, m, based on
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index b057ea83154d..f7d9d3fef7a7 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3357,28 +3357,6 @@ pref("font.minimum-size.x-math", 0);
 pref("font.size.variable.x-math", 16);
 pref("font.size.monospace.x-math", 13);
 
-/*
- * In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
- * this pref forces font inflation to always be enabled in all modes.
- * That is, any heuristics used to detect pan-and-zoom
- * vs. non-pan-and-zoom modes are disabled and all content is treated
- * as pan-and-zoom mode wrt font inflation.
- *
- * This pref has no effect if font inflation is not enabled through
- * either of the prefs above.  It has no meaning in single-mode UIs.
- */
-pref("font.size.inflation.forceEnabled", false);
-/*
- * In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
- * this pref disables font inflation in master-process contexts where
- * existing heuristics can't be used determine enabled-ness.
- *
- * This pref has no effect if font inflation is not enabled through
- * either of the prefs above.  The "forceEnabled" pref above overrides
- * this pref.
- */
-pref("font.size.inflation.disabledInMasterProcess", false);
-
 /**
  * This setting corresponds to a global text zoom setting affecting
  * all content that is not already subject to font size inflation.

From 1e91da4122b0fc7340c624a8e370f9111c73989c Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 18:27:11 +0000
Subject: [PATCH 065/100] Bug 1573268 - Convert font.size.systemFontScale to
 static pref. r=njn

Converts font.size.systemFontScale to a static pref. Removes the function in nsLayoutUtils and does the float division directly in PresShell.

Differential Revision: https://phabricator.services.mozilla.com/D41824

--HG--
extra : moz-landing-system : lando
---
 layout/base/PresShell.cpp                |  3 ++-
 layout/base/nsLayoutUtils.cpp            |  4 ----
 layout/base/nsLayoutUtils.h              |  7 -------
 modules/libpref/init/StaticPrefList.yaml | 12 ++++++++++++
 modules/libpref/init/all.js              | 11 -----------
 5 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
index 30e2f1bc485e..3f7f636f4c29 100644
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -10751,7 +10751,8 @@ nsSize PresShell::GetLayoutViewportSize() const {
 void PresShell::RecomputeFontSizeInflationEnabled() {
   mFontSizeInflationEnabled = DetermineFontSizeInflationState();
 
-  float fontScale = nsLayoutUtils::SystemFontScale();
+  // Divide by 100 to convert the pref from a percentage to a fraction.
+  float fontScale = StaticPrefs::font_size_systemFontScale() / 100.0f;
   if (fontScale == 0.0f) {
     return;
   }
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 8ccc92dd019b..87cd42382a50 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-uint32_t nsLayoutUtils::sSystemFontScale;
 /* static */
 uint32_t nsLayoutUtils::sZoomMaxPercent;
 /* static */
@@ -7973,8 +7971,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sSystemFontScale, "font.size.systemFontScale",
-                               100);
   Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300);
   Preferences::AddUintVarCache(&sZoomMinPercent, "zoom.minPercent", 30);
   Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 4dfae1bf3e7b..5abb8043d788 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,12 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  /**
-   * See comment above "font.size.systemFontScale" in
-   * modules/libpref/init/all.js.
-   */
-  static float SystemFontScale() { return sSystemFontScale / 100.0f; }
-
   static float MaxZoom() { return sZoomMaxPercent / 100.0f; }
 
   static float MinZoom() { return sZoomMinPercent / 100.0f; }
@@ -3009,7 +3003,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static uint32_t sSystemFontScale;
   static uint32_t sZoomMaxPercent;
   static uint32_t sZoomMinPercent;
   static bool sInvalidationDebuggingIsEnabled;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 60b67f5cdafe..bb4d6ffec80c 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2639,6 +2639,18 @@
   value: 0
   mirror: always
 
+# This setting corresponds to a global text zoom setting affecting
+# all content that is not already subject to font size inflation.
+# It is interpreted as a percentage value that is applied on top
+# of the document's current text zoom setting.
+#
+# The resulting total zoom factor (text zoom * system font scale)
+# will be limited by zoom.minPercent and maxPercent.
+- name: font.size.systemFontScale
+  type: uint32_t
+  value: 100
+  mirror: always
+
 #---------------------------------------------------------------------------
 # Prefs starting with "full-screen-api."
 #---------------------------------------------------------------------------
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index f7d9d3fef7a7..6e50e1202fef 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3357,17 +3357,6 @@ pref("font.minimum-size.x-math", 0);
 pref("font.size.variable.x-math", 16);
 pref("font.size.monospace.x-math", 13);
 
-/**
- * This setting corresponds to a global text zoom setting affecting
- * all content that is not already subject to font size inflation.
- * It is interpreted as a percentage value that is applied on top
- * of the document's current text zoom setting.
- *
- * The resulting total zoom factor (text zoom * system font scale)
- * will be limited by zoom.minPercent and maxPercent.
- */
-pref("font.size.systemFontScale", 100);
-
 /*
  * When enabled, the touch.radius and mouse.radius prefs allow events to be dispatched
  * to nearby elements that are sensitive to the event. See PositionedEventTargeting.cpp.

From 49185e94811ecb5ac8cdf83252a069553bdf9785 Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 18:29:55 +0000
Subject: [PATCH 066/100] Bug 1573268 - Convert zoom.maxPercent and
 zoom.minPercent to static prefs. r=njn

Converts zoom.maxPercent and zoom.minPercent to static prefs, which creates a new "zoom" category on StaticPrefList.yaml.

Differential Revision: https://phabricator.services.mozilla.com/D41835

--HG--
extra : moz-landing-system : lando
---
 dom/events/EventStateManager.cpp         |  9 +++++----
 layout/base/nsLayoutUtils.cpp            |  6 ------
 layout/base/nsLayoutUtils.h              |  6 ------
 layout/base/nsPresContext.cpp            |  5 +++--
 mobile/android/app/mobile.js             |  3 ---
 modules/libpref/init/StaticPrefList.yaml | 21 +++++++++++++++++++++
 modules/libpref/init/all.js              |  2 --
 modules/libpref/moz.build                |  1 +
 8 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp
index 2968aa856035..1106375ce16e 100644
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -32,6 +32,7 @@
 #include "mozilla/StaticPrefs_dom.h"
 #include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/StaticPrefs_ui.h"
+#include "mozilla/StaticPrefs_zoom.h"
 
 #include "ContentEventHandler.h"
 #include "IMEContentObserver.h"
@@ -2127,8 +2128,8 @@ nsresult EventStateManager::ChangeTextSize(int32_t change) {
 
   if (cv) {
     float textzoom;
-    float zoomMin = ((float)Preferences::GetInt("zoom.minPercent", 50)) / 100;
-    float zoomMax = ((float)Preferences::GetInt("zoom.maxPercent", 300)) / 100;
+    float zoomMin = ((float)StaticPrefs::zoom_minPercent()) / 100;
+    float zoomMax = ((float)StaticPrefs::zoom_maxPercent()) / 100;
     cv->GetTextZoom(&textzoom);
     textzoom += ((float)change) / 10;
     if (textzoom < zoomMin)
@@ -2148,8 +2149,8 @@ nsresult EventStateManager::ChangeFullZoom(int32_t change) {
 
   if (cv) {
     float fullzoom;
-    float zoomMin = ((float)Preferences::GetInt("zoom.minPercent", 50)) / 100;
-    float zoomMax = ((float)Preferences::GetInt("zoom.maxPercent", 300)) / 100;
+    float zoomMin = ((float)StaticPrefs::zoom_minPercent()) / 100;
+    float zoomMax = ((float)StaticPrefs::zoom_maxPercent()) / 100;
     cv->GetFullZoom(&fullzoom);
     fullzoom += ((float)change) / 10;
     if (fullzoom < zoomMin)
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 87cd42382a50..9c350f2d7b41 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,10 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-uint32_t nsLayoutUtils::sZoomMaxPercent;
-/* static */
-uint32_t nsLayoutUtils::sZoomMinPercent;
 /* static */
 bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
 /* static */
@@ -7971,8 +7967,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300);
-  Preferences::AddUintVarCache(&sZoomMinPercent, "zoom.minPercent", 30);
   Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,
                                "nglayout.debug.invalidation");
   Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 5abb8043d788..88350e30eb6c 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2445,10 +2445,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  static float MaxZoom() { return sZoomMaxPercent / 100.0f; }
-
-  static float MinZoom() { return sZoomMinPercent / 100.0f; }
-
   static bool SVGTransformBoxEnabled() { return sSVGTransformBoxEnabled; }
 
   static uint32_t IdlePeriodDeadlineLimit() { return sIdlePeriodDeadlineLimit; }
@@ -3003,8 +2999,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static uint32_t sZoomMaxPercent;
-  static uint32_t sZoomMinPercent;
   static bool sInvalidationDebuggingIsEnabled;
   static bool sInterruptibleReflowEnabled;
   static bool sSVGTransformBoxEnabled;
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
index aa98711a1872..93d271791745 100644
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -76,6 +76,7 @@
 #include "nsFontFaceUtils.h"
 #include "nsLayoutStylesheetCache.h"
 #include "mozilla/ServoBindings.h"
+#include "mozilla/StaticPrefs_zoom.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/Telemetry.h"
@@ -919,8 +920,8 @@ void nsPresContext::SetImageAnimationMode(uint16_t aMode) {
 
 void nsPresContext::UpdateEffectiveTextZoom() {
   float newZoom = mSystemFontScale * mTextZoom;
-  float minZoom = nsLayoutUtils::MinZoom();
-  float maxZoom = nsLayoutUtils::MaxZoom();
+  float minZoom = StaticPrefs::zoom_minPercent() / 100.0f;
+  float maxZoom = StaticPrefs::zoom_maxPercent() / 100.0f;
 
   if (newZoom < minZoom) {
     newZoom = minZoom;
diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js
index 4f3e7cba79d2..4dea5e73afa0 100644
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -41,9 +41,6 @@ pref("browser.tabs.disableBackgroundZombification", false);
 // Controlled by Switchboard experiment "offline-cache".
 pref("browser.tabs.useCache", false);
 
-// From libpref/src/init/all.js, extended to allow a slightly wider zoom range.
-pref("zoom.minPercent", 20);
-pref("zoom.maxPercent", 400);
 pref("toolkit.zoomManager.zoomValues", ".2,.3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3,4");
 
 // Mobile will use faster, less durable mode.
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index bb4d6ffec80c..25beb140ce3c 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -6662,6 +6662,27 @@
 #endif
   mirror: always
 
+#---------------------------------------------------------------------------
+# Prefs starting with "zoom."
+#---------------------------------------------------------------------------
+
+- name: zoom.maxPercent
+  type: uint32_t
+#ifdef ANDROID
+  value: 400
+#else
+  value: 300
+#endif
+  mirror: always
+
+- name: zoom.minPercent
+  type: uint32_t
+#ifdef ANDROID
+  value: 20
+#else
+  value: 30
+#endif
+  mirror: always
 
 #---------------------------------------------------------------------------
 # End of prefs
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 6e50e1202fef..197abd0366ba 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4431,8 +4431,6 @@ pref("browser.formfill.prefixWeight",     5);
 
 // Zoom prefs
 pref("browser.zoom.full", false);
-pref("zoom.minPercent", 30);
-pref("zoom.maxPercent", 300);
 pref("toolkit.zoomManager.zoomValues", ".3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3");
 
 //
diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
index 855f03547ff4..33a41d58b571 100644
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -76,6 +76,7 @@ pref_groups = [
     'webgl',
     'widget',
     'xul',
+    'zoom',
 ]
 if CONFIG['OS_TARGET'] == 'Android':
     pref_groups += [

From 0766a7b0110a5bfed38c7abf81b682c67099accf Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Tue, 13 Aug 2019 23:47:48 +0000
Subject: [PATCH 067/100] Bug 1573268 - Convert nglayout.debug.invalidation to
 static pref. r=njn

Converts nglayout.debug.invalidation to a static pref. Retains the old getter function from the old static bool, because it makes an additional comparison.

Differential Revision: https://phabricator.services.mozilla.com/D41845

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 4 ----
 layout/base/nsLayoutUtils.h              | 6 ++----
 modules/libpref/init/StaticPrefList.yaml | 7 ++++++-
 modules/libpref/init/all.js              | 3 ---
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 9c350f2d7b41..b23503eb4c24 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
 /* static */
 bool nsLayoutUtils::sInterruptibleReflowEnabled;
 /* static */
@@ -7967,8 +7965,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,
-                               "nglayout.debug.invalidation");
   Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
                                "layout.interruptible-reflow.enabled");
   Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 88350e30eb6c..4597b18f33cf 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -12,6 +12,7 @@
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/StaticPrefs_nglayout.h"
 #include "mozilla/TypedEnumBits.h"
 #include "nsBoundingMetrics.h"
 #include "nsChangeHint.h"
@@ -2455,11 +2456,9 @@ class nsLayoutUtils {
 
   /**
    * Returns true if the nglayout.debug.invalidation pref is set to true.
-   * Note that sInvalidationDebuggingIsEnabled is declared outside this function
-   * to allow it to be accessed an manipulated from breakpoint conditions.
    */
   static bool InvalidationDebuggingIsEnabled() {
-    return sInvalidationDebuggingIsEnabled ||
+    return mozilla::StaticPrefs::nglayout_debug_invalidation() ||
            getenv("MOZ_DUMP_INVALIDATION") != 0;
   }
 
@@ -2999,7 +2998,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static bool sInvalidationDebuggingIsEnabled;
   static bool sInterruptibleReflowEnabled;
   static bool sSVGTransformBoxEnabled;
   static uint32_t sIdlePeriodDeadlineLimit;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 25beb140ce3c..457777f9321d 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -5877,12 +5877,17 @@
 # Prefs starting with "nglayout."
 #---------------------------------------------------------------------------
 
+# Enable/disable display list invalidation logging --- useful for debugging.
+- name: nglayout.debug.invalidation
+  type: bool
+  value: false
+  mirror: always
+
 - name: nglayout.debug.widget_update_flashing
   type: RelaxedAtomicBool
   value: false
   mirror: always
 
-
 #---------------------------------------------------------------------------
 # Prefs starting with "page_load."
 #---------------------------------------------------------------------------
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 197abd0366ba..9f1c4ceeb34e 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1121,9 +1121,6 @@ pref("nglayout.debug.paint_flashing_chrome", false);
 // BasicLayers (other layer managers always update the entire widget area)
 pref("nglayout.debug.widget_update_flashing", false);
 
-// Enable/disable display list invalidation logging --- useful for debugging.
-pref("nglayout.debug.invalidation", false);
-
 // Whether frame visibility tracking is enabled globally.
 pref("layout.framevisibility.enabled", true);
 

From e1e114c69db4f58a63cd009a66d6fa4e9ab0fb43 Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 00:01:27 +0000
Subject: [PATCH 068/100] Bug 1573268 - Convert
 layout.interruptible-reflow.enabled to static pref. r=njn

Converts layout.interruptible-reflow.enabled to a static pref and updates its usage.

Differential Revision: https://phabricator.services.mozilla.com/D41849

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 4 ----
 layout/base/nsLayoutUtils.h              | 5 -----
 layout/base/nsPresContext.cpp            | 3 ++-
 modules/libpref/init/StaticPrefList.yaml | 8 ++++++++
 modules/libpref/init/all.js              | 5 -----
 5 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index b23503eb4c24..d4ab2f96006a 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-bool nsLayoutUtils::sInterruptibleReflowEnabled;
 /* static */
 bool nsLayoutUtils::sSVGTransformBoxEnabled;
 /* static */
@@ -7965,8 +7963,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
-                               "layout.interruptible-reflow.enabled");
   Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
                                "svg.transform-box.enabled");
   Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 4597b18f33cf..4c8a96a3eff4 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2398,10 +2398,6 @@ class nsLayoutUtils {
    */
   static bool GPUImageScalingEnabled();
 
-  static bool InterruptibleReflowEnabled() {
-    return sInterruptibleReflowEnabled;
-  }
-
   /**
    * Unions the overflow areas of the children of aFrame with aOverflowAreas.
    * aSkipChildLists specifies any child lists that should be skipped.
@@ -2998,7 +2994,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static bool sInterruptibleReflowEnabled;
   static bool sSVGTransformBoxEnabled;
   static uint32_t sIdlePeriodDeadlineLimit;
   static uint32_t sQuiescentFramesBeforeIdlePeriod;
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
index 93d271791745..266107fd769d 100644
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -76,6 +76,7 @@
 #include "nsFontFaceUtils.h"
 #include "nsLayoutStylesheetCache.h"
 #include "mozilla/ServoBindings.h"
+#include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/StaticPrefs_zoom.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
@@ -2228,7 +2229,7 @@ void nsPresContext::ReflowStarted(bool aInterruptible) {
   // We don't support interrupting in paginated contexts, since page
   // sequences only handle initial reflow
   mInterruptsEnabled = aInterruptible && !IsPaginated() &&
-                       nsLayoutUtils::InterruptibleReflowEnabled();
+                       StaticPrefs::layout_interruptible_reflow_enabled();
 
   // Don't set mHasPendingInterrupt based on HavePendingInputEvent() here.  If
   // we ever change that, then we need to update the code in
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 457777f9321d..0612c718312e 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4649,6 +4649,14 @@
   value: -1
   mirror: always
 
+# Enable/disable interruptible reflow, which allows reflows to stop
+# before completion (and display the partial results) when user events
+# are pending.
+- name: layout.interruptible-reflow.enabled
+  type: bool
+  value: true
+  mirror: always
+
 - name: layout.min-active-layer-size
   type: int32_t
   value: 64
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 9f1c4ceeb34e..e69f88c65975 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2959,11 +2959,6 @@ pref("layout.scrollbar.side", 0);
 // pref to stop overlay scrollbars from fading out, for testing purposes
 pref("layout.testing.overlay-scrollbars.always-visible", false);
 
-// Enable/disable interruptible reflow, which allows reflows to stop
-// before completion (and display the partial results) when user events
-// are pending.
-pref("layout.interruptible-reflow.enabled", true);
-
 // pref to control browser frame rate, in Hz. A value <= 0 means choose
 // automatically based on knowledge of the platform (or 60Hz if no platform-
 // specific information is available).

From 61d69ccebf49fa509192eaae315b5eb152d0dc29 Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 00:17:04 +0000
Subject: [PATCH 069/100] Bug 1573268 - remove the varcache definition for
 svg.transform-box.enabled. r=njn

svg.transform-box.enabled is already a static pref, so I removed the varcache definition of it in nsLayoutUtils.

Differential Revision: https://phabricator.services.mozilla.com/D41850

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp           | 4 ----
 layout/base/nsLayoutUtils.h             | 3 ---
 layout/style/nsStyleTransformMatrix.cpp | 3 ++-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index d4ab2f96006a..774e01a33073 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-bool nsLayoutUtils::sSVGTransformBoxEnabled;
 /* static */
 uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
 /* static */
@@ -7963,8 +7961,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
-                               "svg.transform-box.enabled");
   Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
                                "layout.idle_period.time_limit",
                                DEFAULT_IDLE_PERIOD_TIME_LIMIT);
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 4c8a96a3eff4..6cc547362151 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2442,8 +2442,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  static bool SVGTransformBoxEnabled() { return sSVGTransformBoxEnabled; }
-
   static uint32_t IdlePeriodDeadlineLimit() { return sIdlePeriodDeadlineLimit; }
 
   static uint32_t QuiescentFramesBeforeIdlePeriod() {
@@ -2994,7 +2992,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static bool sSVGTransformBoxEnabled;
   static uint32_t sIdlePeriodDeadlineLimit;
   static uint32_t sQuiescentFramesBeforeIdlePeriod;
 
diff --git a/layout/style/nsStyleTransformMatrix.cpp b/layout/style/nsStyleTransformMatrix.cpp
index b0e6512472ae..e3daa2d933ef 100644
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -13,6 +13,7 @@
 #include "nsPresContext.h"
 #include "nsSVGUtils.h"
 #include "mozilla/ServoBindings.h"
+#include "mozilla/StaticPrefs_svg.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "gfxMatrix.h"
 #include "gfxQuaternion.h"
@@ -47,7 +48,7 @@ void TransformReferenceBox::EnsureDimensionsAreCached() {
   mIsCached = true;
 
   if (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
-    if (!nsLayoutUtils::SVGTransformBoxEnabled()) {
+    if (!StaticPrefs::svg_transform_box_enabled()) {
       mX = -mFrame->GetPosition().x;
       mY = -mFrame->GetPosition().y;
       Size contextSize = nsSVGUtils::GetContextSize(mFrame);

From 6bfb2c7c8552126f80ec29a05bedb75dcf4234d0 Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 19:36:46 +0000
Subject: [PATCH 070/100] Bug 1573268 - Convert two layout.idle-period.* prefs
 to static prefs. r=njn

Converts layout.idle_period.required_quiescent_frames and layout.idle_period.time_limit to static prefs. These are the last prefs in nsLayoutUtils::initialize(), but since the function still calls nsComputedDOMStyle::RegisterPrefChangeCallbacks() the commit retains it.

Differential Revision: https://phabricator.services.mozilla.com/D41856

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 19 -------------------
 layout/base/nsLayoutUtils.h              |  9 ---------
 layout/base/nsRefreshDriver.cpp          |  5 +++--
 modules/libpref/init/StaticPrefList.yaml | 14 ++++++++++++++
 modules/libpref/init/all.js              |  8 --------
 5 files changed, 17 insertions(+), 38 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 774e01a33073..84d8d5d38b02 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -168,13 +168,6 @@ using namespace mozilla::gfx;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_METADATA;
 using mozilla::dom::HTMLMediaElement_Binding::HAVE_NOTHING;
 
-// The time in number of frames that we estimate for a refresh driver
-// to be quiescent
-#define DEFAULT_QUIESCENT_FRAMES 2
-// The time (milliseconds) we estimate is needed between the end of an
-// idle time and the next Tick.
-#define DEFAULT_IDLE_PERIOD_TIME_LIMIT 1.0f
-
 #ifdef DEBUG
 // TODO: remove, see bug 598468.
 bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
@@ -183,11 +176,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
 typedef ScrollableLayerGuid::ViewID ViewID;
 typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
 
-/* static */
-uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
-/* static */
-uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
-
 static ViewID sScrollIdCounter = ScrollableLayerGuid::START_SCROLL_ID;
 
 typedef nsDataHashtable ContentMap;
@@ -7961,13 +7949,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
 
 /* static */
 void nsLayoutUtils::Initialize() {
-  Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
-                               "layout.idle_period.time_limit",
-                               DEFAULT_IDLE_PERIOD_TIME_LIMIT);
-  Preferences::AddUintVarCache(&sQuiescentFramesBeforeIdlePeriod,
-                               "layout.idle_period.required_quiescent_frames",
-                               DEFAULT_QUIESCENT_FRAMES);
-
   nsComputedDOMStyle::RegisterPrefChangeCallbacks();
 }
 
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 6cc547362151..186074633a43 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2442,12 +2442,6 @@ class nsLayoutUtils {
 
   static bool FontSizeInflationEnabled(nsPresContext* aPresContext);
 
-  static uint32_t IdlePeriodDeadlineLimit() { return sIdlePeriodDeadlineLimit; }
-
-  static uint32_t QuiescentFramesBeforeIdlePeriod() {
-    return sQuiescentFramesBeforeIdlePeriod;
-  }
-
   /**
    * Returns true if the nglayout.debug.invalidation pref is set to true.
    */
@@ -2992,9 +2986,6 @@ class nsLayoutUtils {
       const nsIFrame* aFrame);
 
  private:
-  static uint32_t sIdlePeriodDeadlineLimit;
-  static uint32_t sQuiescentFramesBeforeIdlePeriod;
-
   /**
    * Helper function for LogTestDataForPaint().
    */
diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp
index f05305080840..23ec10b250aa 100644
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -271,13 +271,14 @@ class RefreshDriverTimer {
     TimeStamp idleEnd = mostRecentRefresh + refreshRate;
 
     if (idleEnd +
-            refreshRate * nsLayoutUtils::QuiescentFramesBeforeIdlePeriod() <
+            refreshRate *
+                StaticPrefs::layout_idle_period_required_quiescent_frames() <
         TimeStamp::Now()) {
       return aDefault;
     }
 
     idleEnd = idleEnd - TimeDuration::FromMilliseconds(
-                            nsLayoutUtils::IdlePeriodDeadlineLimit());
+                            StaticPrefs::layout_idle_period_time_limit());
     return idleEnd < aDefault ? idleEnd : aDefault;
   }
 
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 0612c718312e..e932205ebbb1 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4649,6 +4649,20 @@
   value: -1
   mirror: always
 
+# The time in number of frames that we estimate for a refresh driver
+# to be quiescent.
+- name: layout.idle_period.required_quiescent_frames
+  type: uint32_t
+  value: 2
+  mirror: always
+
+# The amount of time (milliseconds) needed between an idle period's
+# end and the start of the next tick to avoid jank.
+- name: layout.idle_period.time_limit
+  type: uint32_t
+  value: 1
+  mirror: always
+
 # Enable/disable interruptible reflow, which allows reflows to stop
 # before completion (and display the partial results) when user events
 # are pending.
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index e69f88c65975..a6ccb196b503 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2985,14 +2985,6 @@ pref("layout.display-list.rebuild-frame-limit", 500);
 // pref to control whether layout warnings that are hit quite often are enabled
 pref("layout.spammy_warnings.enabled", false);
 
-// The number of frames times the frame rate is the time required to
-// pass without painting used to guess that we'll not paint again soon
-pref("layout.idle_period.required_quiescent_frames", 2);
-
-// The amount of time (milliseconds) needed between an idle period's
-// end and the start of the next tick to avoid jank.
-pref("layout.idle_period.time_limit", 1);
-
 // Pref to throttle offsreen animations
 pref("dom.animations.offscreen-throttling", true);
 

From 87723c635cf7c179c921a7c9c4b17ed6c8f5f3ba Mon Sep 17 00:00:00 2001
From: Kristen Wright 
Date: Wed, 14 Aug 2019 00:26:02 +0000
Subject: [PATCH 071/100] Bug 1573268 - Convert
 layout.css.outline-style-auto.enabled to static pref. r=njn

Converts layout.css.outline-style-auto.enabled to a static pref and removes nsLayoutUtils::isOutlineStyleAutoEnabled().

Differential Revision: https://phabricator.services.mozilla.com/D41861

--HG--
extra : moz-landing-system : lando
---
 layout/base/nsLayoutUtils.cpp            | 14 --------------
 layout/base/nsLayoutUtils.h              |  2 --
 layout/generic/nsFrame.cpp               |  2 +-
 layout/painting/nsCSSRendering.cpp       |  3 ++-
 layout/painting/nsDisplayList.cpp        |  3 ++-
 modules/libpref/init/StaticPrefList.yaml |  6 ++++++
 modules/libpref/init/all.js              |  3 ---
 7 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 84d8d5d38b02..8b47d7c5f02e 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8735,20 +8735,6 @@ void MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager,
 }  // namespace layout
 }  // namespace mozilla
 
-/* static */
-bool nsLayoutUtils::IsOutlineStyleAutoEnabled() {
-  static bool sOutlineStyleAutoEnabled;
-  static bool sOutlineStyleAutoPrefCached = false;
-
-  if (!sOutlineStyleAutoPrefCached) {
-    sOutlineStyleAutoPrefCached = true;
-    Preferences::AddBoolVarCache(&sOutlineStyleAutoEnabled,
-                                 "layout.css.outline-style-auto.enabled",
-                                 false);
-  }
-  return sOutlineStyleAutoEnabled;
-}
-
 /* static */
 void nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame,
                                             ReflowOutput& aMetrics,
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 186074633a43..29f7d64f3b1a 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2758,8 +2758,6 @@ class nsLayoutUtils {
    */
   static void ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame);
 
-  static bool IsOutlineStyleAutoEnabled();
-
   static void SetBSizeFromFontMetrics(
       const nsIFrame* aFrame, mozilla::ReflowOutput& aMetrics,
       const mozilla::LogicalMargin& aFramePadding, mozilla::WritingMode aLineWM,
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 881a0e6b8fa2..c98302af29d9 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9320,7 +9320,7 @@ static void ComputeAndIncludeOutlineArea(nsIFrame* aFrame,
   const nscoord offset = outline->mOutlineOffset.ToAppUnits();
   nsRect outerRect(innerRect);
   bool useOutlineAuto = false;
-  if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
+  if (StaticPrefs::layout_css_outline_style_auto_enabled()) {
     useOutlineAuto = outline->mOutlineStyle.IsAuto();
     if (MOZ_UNLIKELY(useOutlineAuto)) {
       nsPresContext* presContext = aFrame->PresContext();
diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp
index fb19b1acf60a..0506aa7856af 100644
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -59,6 +59,7 @@
 #include "nsCSSRenderingBorders.h"
 #include "mozilla/css/ImageLoader.h"
 #include "ImageContainer.h"
+#include "mozilla/StaticPrefs_layout.h"
 #include "mozilla/Telemetry.h"
 #include "gfxUtils.h"
 #include "gfxGradientCache.h"
@@ -1038,7 +1039,7 @@ Maybe nsCSSRendering::CreateBorderRendererForOutline(
 
   StyleBorderStyle outlineStyle;
   if (ourOutline->mOutlineStyle.IsAuto()) {
-    if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
+    if (StaticPrefs::layout_css_outline_style_auto_enabled()) {
       nsITheme* theme = aPresContext->GetTheme();
       if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
                                               StyleAppearance::FocusOutline)) {
diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
index ac634680c17f..43a97a65d15c 100644
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -5404,7 +5404,8 @@ bool nsDisplayOutline::CreateWebRenderCommands(
   ContainerLayerParameters parameter;
 
   const auto& outlineStyle = mFrame->StyleOutline()->mOutlineStyle;
-  if (outlineStyle.IsAuto() && nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
+  if (outlineStyle.IsAuto() &&
+      StaticPrefs::layout_css_outline_style_auto_enabled()) {
     nsITheme* theme = mFrame->PresContext()->GetTheme();
     if (theme && theme->ThemeSupportsWidget(mFrame->PresContext(), mFrame,
                                             StyleAppearance::FocusOutline)) {
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index e932205ebbb1..7afeb80e4f0a 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4715,6 +4715,12 @@
   value: true
   mirror: always
 
+# Is layout of CSS outline-style:auto enabled?
+- name: layout.css.outline-style-auto.enabled
+  type: bool
+  value: false
+  mirror: always
+
 # Pref to control enabling scroll anchoring.
 - name: layout.css.scroll-anchoring.enabled
   type: bool
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index a6ccb196b503..d59cbf73d391 100755
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2927,9 +2927,6 @@ pref("layout.css.scroll-snap.prediction-max-velocity", 2000);
 // gestures.
 pref("layout.css.scroll-snap.prediction-sensitivity", "0.750");
 
-// Is layout of CSS outline-style:auto enabled?
-pref("layout.css.outline-style-auto.enabled", false);
-
 // Is CSSOM-View scroll-behavior and its MSD smooth scrolling enabled?
 pref("layout.css.scroll-behavior.enabled", true);
 

From b26b2d5fcc0b9b53252991cae13e11a7b89a32dc Mon Sep 17 00:00:00 2001
From: janelledement 
Date: Wed, 14 Aug 2019 19:57:51 +0000
Subject: [PATCH 072/100] Bug 1561583 - Search bar retains previous query on
 re-opening. r=davidwalsh

This patch allows the search bar to retain the previous query on re-opening.

Differential Revision: https://phabricator.services.mozilla.com/D36664

--HG--
extra : moz-landing-system : lando
---
 .../src/components/Editor/SearchBar.js        | 10 ++---
 .../debugger/test/mochitest/browser.ini       |  2 +
 .../browser_dbg-search-file-retains-query.js  | 45 +++++++++++++++++++
 .../test/mochitest/browser_dbg-search-file.js |  4 +-
 4 files changed, 55 insertions(+), 6 deletions(-)
 create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js

diff --git a/devtools/client/debugger/src/components/Editor/SearchBar.js b/devtools/client/debugger/src/components/Editor/SearchBar.js
index f63924eaa30a..bb2aba105cf7 100644
--- a/devtools/client/debugger/src/components/Editor/SearchBar.js
+++ b/devtools/client/debugger/src/components/Editor/SearchBar.js
@@ -141,15 +141,15 @@ class SearchBar extends Component {
     }
   };
 
-  closeSearch = (e: SyntheticEvent) => {
-    const { cx, closeFileSearch, editor, searchOn } = this.props;
+  closeSearch = (e: SyntheticKeyboardEvent) => {
+    const { cx, closeFileSearch, editor, searchOn, query } = this.props;
+    this.clearSearch();
     if (editor && searchOn) {
-      this.clearSearch();
       closeFileSearch(cx, editor);
       e.stopPropagation();
       e.preventDefault();
     }
-    this.setState({ query: "", inputFocused: false });
+    this.setState({ query, inputFocused: false });
   };
 
   toggleSearch = (e: SyntheticKeyboardEvent) => {
@@ -164,7 +164,7 @@ class SearchBar extends Component {
       setActiveSearch("file");
     }
 
-    if (searchOn && editor) {
+    if (this.props.searchOn && editor) {
       const query = editor.codeMirror.getSelection() || this.state.query;
 
       if (query !== "") {
diff --git a/devtools/client/debugger/test/mochitest/browser.ini b/devtools/client/debugger/test/mochitest/browser.ini
index d5d034fea1ec..eb2c2f1045e1 100644
--- a/devtools/client/debugger/test/mochitest/browser.ini
+++ b/devtools/client/debugger/test/mochitest/browser.ini
@@ -108,6 +108,8 @@ skip-if = os == "win"
 skip-if = true
 [browser_dbg-pause-points.js]
 [browser_dbg-scopes-mutations.js]
+[browser_dbg-search-file-retains-query.js]
+skip-if = os == "win" # Bug 1393121
 [browser_dbg-search-file.js]
 skip-if = os == "win" # Bug 1393121
 [browser_dbg-search-file-paused.js]
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js
new file mode 100644
index 000000000000..142b8287cff6
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-retains-query.js
@@ -0,0 +1,45 @@
+/* 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 . */
+
+// Tests the search bar retains previous query on re-opening.
+
+function waitForSearchState(dbg) {
+  return waitForState(dbg, () => getCM(dbg).state.search);
+}
+
+add_task(async function() {
+  const dbg = await initDebugger("doc-scripts.html", "simple1.js");
+  const {
+    selectors: { getActiveSearch, getFileSearchQuery },
+  } = dbg;
+  const source = findSource(dbg, "simple1.js");
+
+  await selectSource(dbg, source.url);
+
+  // Open search bar
+  pressKey(dbg, "fileSearch");
+  await waitFor(() => getActiveSearch() === "file");
+  is(getActiveSearch(), "file");
+
+  // Type a search query
+  type(dbg, "con");
+  await waitForSearchState(dbg);
+  is(getFileSearchQuery(), "con");
+  is(getCM(dbg).state.search.query, "con");
+
+  // Close the search bar
+  pressKey(dbg, "Escape");
+  await waitFor(() => getActiveSearch() === null);
+  is(getActiveSearch(), null);
+
+  // Re-open search bar
+  pressKey(dbg, "fileSearch");
+  await waitFor(() => getActiveSearch() === "file");
+  is(getActiveSearch(), "file");
+
+  // Test for the retained query
+  is(getCM(dbg).state.search.query, "con");
+  await waitForDispatch(dbg, "UPDATE_FILE_SEARCH_QUERY");
+  is(getFileSearchQuery(), "con");
+});
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js b/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
index 0485b25aad3c..2cdf06cfbd56 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file.js
@@ -39,9 +39,10 @@ add_task(async function() {
 
   type(dbg, "con");
   await waitForSearchState(dbg);
+  await waitForDispatch(dbg, "UPDATE_SEARCH_RESULTS");
 
   const state = cm.state.search;
-
+  
   pressKey(dbg, "Enter");
   is(state.posFrom.line, 3);
 
@@ -75,4 +76,5 @@ add_task(async function() {
   await clickElement(dbg, "codeMirror");
   pressKey(dbg, "fileSearch");
   is(dbg.win.document.activeElement.tagName, "INPUT", "Search field focused");
+  
 });

From 03685b73e14ffef76a9c249168f71ba64c07b8c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tarek=20Ziad=C3=A9?= 
Date: Wed, 14 Aug 2019 20:32:31 +0000
Subject: [PATCH 073/100] Bug 1556637 - Replace all mozDumpDebugInfo calls
 r=jya,jib

Replaces mozDumpDebugInfo with mozRequestDebugInfo

Differential Revision: https://phabricator.services.mozilla.com/D37836

--HG--
extra : moz-landing-system : lando
---
 dom/imptests/testharnessreport.js             |  2 +-
 dom/media/mediasource/test/mediasource.js     |  6 ++---
 .../mediasource/test/test_Eviction_mp4.html   |  2 +-
 .../test/test_ExperimentalAsync.html          |  4 +--
 dom/media/test/manifest.js                    | 25 +++++++++----------
 .../mochitest/tests/SimpleTest/SimpleTest.js  |  6 ++---
 .../mochitest/tests/SimpleTest/TestRunner.js  | 15 ++++++++---
 7 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/dom/imptests/testharnessreport.js b/dom/imptests/testharnessreport.js
index 6bc7ec3ab654..92d199486c33 100644
--- a/dom/imptests/testharnessreport.js
+++ b/dom/imptests/testharnessreport.js
@@ -278,7 +278,7 @@ var W3CTest = {
    * Timeout the current test. Intended to be used from harness code, not
    * from tests.
    */
-  "timeout": function() {
+  "timeout": async function() {
     this.logFailure("Timeout", "Test runner timed us out.");
     timeout();
   }
diff --git a/dom/media/mediasource/test/mediasource.js b/dom/media/mediasource/test/mediasource.js
index 3efd08021899..440b05009f0f 100644
--- a/dom/media/mediasource/test/mediasource.js
+++ b/dom/media/mediasource/test/mediasource.js
@@ -183,12 +183,12 @@ function fetchAndLoadAsync(sb, prefix, chunks, suffix) {
 }
 
 // Register timeout function to dump debugging logs.
-SimpleTest.registerTimeoutFunction(function() {
+SimpleTest.registerTimeoutFunction(async function() {
   for (const v of document.getElementsByTagName("video")) {
-    v.mozDumpDebugInfo();
+    console.log(await SpecialPowers.wrap(v).mozRequestDebugInfo());
   }
   for (const a of document.getElementsByTagName("audio")) {
-    a.mozDumpDebugInfo();
+    console.log(await SpecialPowers.wrap(a).mozRequestDebugInfo());
   }
 });
 
diff --git a/dom/media/mediasource/test/test_Eviction_mp4.html b/dom/media/mediasource/test/test_Eviction_mp4.html
index 4e497ad1a583..e336fae4c732 100644
--- a/dom/media/mediasource/test/test_Eviction_mp4.html
+++ b/dom/media/mediasource/test/test_Eviction_mp4.html
@@ -52,7 +52,7 @@ runWithMSE(async (ms, el) => {
     ok(true, "appendBuffer succeeded");
   } catch (ex) {
     ok(false, "Shouldn't throw another time when data can be evicted");
-    el.mozDumpDebugInfo();
+    dump(JSON.stringify(await SpecialPowers.wrap(el).mozRequestDebugInfo()));
   }
   SimpleTest.finish();
 });
diff --git a/dom/media/mediasource/test/test_ExperimentalAsync.html b/dom/media/mediasource/test/test_ExperimentalAsync.html
index 3c2cd5a35ff0..6617716f268b 100644
--- a/dom/media/mediasource/test/test_ExperimentalAsync.html
+++ b/dom/media/mediasource/test/test_ExperimentalAsync.html
@@ -61,9 +61,9 @@ runWithMSE(async function(ms, el) {
       await once(el, "seeked");
       dump("dump: seeked to " + seekTime);
       is(el.currentTime, seekTime, "correctly seeked to " + seekTime);
-      await audiosb.appendBufferAsync(audioBuffer).catch(function(ex2) {
+      await audiosb.appendBufferAsync(audioBuffer).catch(async function(ex2) {
         ok(false, "Shouldn't throw another time when data can be evicted");
-        el.mozDumpDebugInfo();
+        dump(JSON.stringify(await SpecialPowers.wrap(el).mozRequestDebugInfo()));
         SimpleTest.finish();
       });
       // Test that an error in remove return a rejected promise
diff --git a/dom/media/test/manifest.js b/dom/media/test/manifest.js
index a984df8f8b4c..217c1b78667f 100644
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -1857,24 +1857,16 @@ function mediaTestCleanup(callback) {
 async function dumpDebugInfoForToken(token) {
   for (let v of document.getElementsByTagName("video")) {
     if (token === v.token) {
-      return v.mozDumpDebugInfo();
+      info(JSON.stringify(await SpecialPowers.wrap(v).mozRequestDebugInfo()));
+      return;
     }
   }
   for (let a of document.getElementsByTagName("audio")) {
     if (token === a.token) {
-      return a.mozDumpDebugInfo();
+      info(JSON.stringify(await SpecialPowers.wrap(a).mozRequestDebugInfo()));
+      return;
     }
   }
-  return Promise.resolve();
-}
-
-function dumpDebugInfo() {
-  for (var v of document.getElementsByTagName("video")) {
-    v.mozDumpDebugInfo();
-  }
-  for (var a of document.getElementsByTagName("audio")) {
-    a.mozDumpDebugInfo();
-  }
 }
 
 // Could be undefined in a page opened by the parent test page
@@ -1883,5 +1875,12 @@ if ("SimpleTest" in window) {
   SimpleTest.requestFlakyTimeout("untriaged");
 
   // Register timeout function to dump debugging logs.
-  SimpleTest.registerTimeoutFunction(dumpDebugInfo);
+  SimpleTest.registerTimeoutFunction(async function() {
+    for (const v of document.getElementsByTagName("video")) {
+      SimpleTest.info(JSON.stringify(await SpecialPowers.wrap(v).mozRequestDebugInfo()));
+    }
+    for (const a of document.getElementsByTagName("audio")) {
+      SimpleTest.info(JSON.stringify(await SpecialPowers.wrap(a).mozRequestDebugInfo()));
+    }
+  });
 }
diff --git a/testing/mochitest/tests/SimpleTest/SimpleTest.js b/testing/mochitest/tests/SimpleTest/SimpleTest.js
index fb686cdb0ab9..c59e6b237a04 100644
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -1093,9 +1093,9 @@ SimpleTest.testInChaosMode = function() {
     SimpleTest._inChaosMode = true;
 };
 
-SimpleTest.timeout = function() {
-    for (let func of SimpleTest._timeoutFunctions) {
-        func();
+SimpleTest.timeout = async function() {
+    for (const func of SimpleTest._timeoutFunctions) {
+        await func();
     }
     SimpleTest._timeoutFunctions = [];
 }
diff --git a/testing/mochitest/tests/SimpleTest/TestRunner.js b/testing/mochitest/tests/SimpleTest/TestRunner.js
index a60d1a6bf411..8c1ac5a0a61f 100644
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -124,12 +124,12 @@ TestRunner._checkForHangs = function() {
     }
   }
 
-  function killTest(win) {
+  async function killTest(win) {
     if ("SimpleTest" in win) {
-      win.SimpleTest.timeout();
+      await win.SimpleTest.timeout();
       win.SimpleTest.finish();
     } else if ("W3CTest" in win) {
-      win.W3CTest.timeout();
+      await win.W3CTest.timeout();
     }
   }
 
@@ -154,7 +154,14 @@ TestRunner._checkForHangs = function() {
 
       // Add a little (1 second) delay to ensure automation.py has time to notice
       // "Test timed out" log and process it (= take a screenshot).
-      setTimeout(function delayedKillTest() { killTest(frameWindow); }, 1000);
+      setTimeout(async function delayedKillTest() {
+        try {
+          await killTest(frameWindow);
+        } catch(e) {
+          reportError(frameWindow, "Test error: " + e);
+        }
+      }, 1000);
+
 
       if (TestRunner._haltTests)
         return;

From 76e3983210b57852df3333e13eb98d2a1f545ef1 Mon Sep 17 00:00:00 2001
From: Nick Alexander 
Date: Wed, 14 Aug 2019 20:38:42 +0000
Subject: [PATCH 074/100] Bug 1572859 - Package more aggressively when building
 GeckoView (and Fennec) within Gradle. r=agi

This always invokes `mach package` (in reality `make -C
... stage-package` for historical reasons), sacrificing a few seconds
of package-related time every Gradle build.  We then rely on Gradle's
fingerprinting to know when AAR/APK targets are up to date.

This should be much better for GeckoView engineers: the old input file
computations were simplifications tuned for Fennec engineers consuming
artifact builds.

Differential Revision: https://phabricator.services.mozilla.com/D41447

--HG--
extra : moz-landing-system : lando
---
 build.gradle | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/build.gradle b/build.gradle
index 3b086d1f19ab..2cce45f8b419 100644
--- a/build.gradle
+++ b/build.gradle
@@ -209,16 +209,6 @@ def createMachStagePackageTask(name) {
 
         dependsOn rootProject.machBuildFaster
 
-        // We'd prefer to take these from the :omnijar project directly, but
-        // it's awkward to reach across projects at evaluation time, so we
-        // duplicate the list here.
-        inputs.dir "${topsrcdir}/mobile/android/chrome"
-        inputs.dir "${topsrcdir}/mobile/android/components"
-        inputs.dir "${topsrcdir}/mobile/android/locales"
-        inputs.dir "${topsrcdir}/mobile/android/modules"
-        inputs.dir "${topsrcdir}/mobile/android/themes"
-        inputs.dir "${topsrcdir}/toolkit"
-
         workingDir "${topobjdir}"
 
         // We'd prefer this to be a `mach` invocation, but `mach build
@@ -231,6 +221,9 @@ def createMachStagePackageTask(name) {
         outputs.file "${topobjdir}/dist/fennec/assets/${mozconfig.substs.ANDROID_CPU_ARCH}/libxul.so"
         outputs.file "${topobjdir}/dist/fennec/lib/${mozconfig.substs.ANDROID_CPU_ARCH}/libmozglue.so"
 
+        // Force running `stage-package`.
+        outputs.upToDateWhen { false }
+
         // `path` is like `:machStagePackage`.
         standardOutput = new TaggedLogOutputStream("${path}>", logger)
         errorOutput = standardOutput

From 44608f65abbcd33758cbb98cadce89decad28d53 Mon Sep 17 00:00:00 2001
From: Nick Alexander 
Date: Wed, 14 Aug 2019 20:40:00 +0000
Subject: [PATCH 075/100] Bug 1570411 - Add --without-fennec to make `mach
 package` not produce Fennec APK. r=chmanchester

When working on GeckoView, there's no need to produce a Fennec APK.
This commit avoids doing that work at `mach package` time.  There are
many other things we'd like to stop doing as we remove Fennec from the
tree, so we add a general flag to guard such things.

Depends on D41447

Differential Revision: https://phabricator.services.mozilla.com/D41448

--HG--
extra : moz-landing-system : lando
---
 mobile/android/moz.configure              | 9 +++++++++
 toolkit/mozapps/installer/upload-files.mk | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/mobile/android/moz.configure b/mobile/android/moz.configure
index 4a1c056a7468..7d3ed9f1f03c 100644
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -126,6 +126,15 @@ imply_option('MOZ_SERVICES_HEALTHREPORT', True)
 imply_option('MOZ_ANDROID_HISTORY', True)
 imply_option('--enable-small-chunk-size', True)
 
+option('--without-fennec',
+       help='Build only GeckoView, do not build and package Fennec (Firefox for Android)')
+
+@depends('--with-fennec')
+def with_fennec(value):
+    return bool(value)
+
+set_config('MOZ_ANDROID_WITH_FENNEC', depends_if(with_fennec)(lambda _: True))
+
 @depends(target)
 def check_target(target):
     if target.os != 'Android':
diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk
index 3fa5ab0c5afa..746881eb4fe7 100644
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -225,7 +225,12 @@ endif #Create an RPM file
 
 
 ifeq ($(MOZ_PKG_FORMAT),APK)
+ifdef MOZ_ANDROID_WITH_FENNEC
 include $(MOZILLA_DIR)/toolkit/mozapps/installer/upload-files-$(MOZ_PKG_FORMAT).mk
+else
+INNER_MAKE_PACKAGE = true
+INNER_UNMAKE_PACKAGE = true
+endif # MOZ_ANDROID_WITH_FENNEC
 endif
 
 ifeq ($(MOZ_PKG_FORMAT),DMG)

From 243b7d4b1e795d5e35da00ab5da6e3b3edcdff05 Mon Sep 17 00:00:00 2001
From: Haik Aftandilian 
Date: Wed, 14 Aug 2019 19:42:19 +0000
Subject: [PATCH 076/100] Bug 1570840 - Set
 com.apple.security.cs.disable-library-validation=false in Hardened Runtime
 entitlement files r=handyman

Set com.apple.security.cs.disable-library-validation=false in developer and production Hardened Runtime entitlements now that the definition has changed to mean allow/disallow unsigned libraries.

Differential Revision: https://phabricator.services.mozilla.com/D40525

--HG--
extra : moz-landing-system : lando
---
 security/mac/hardenedruntime/developer.entitlements.xml  | 7 +++----
 security/mac/hardenedruntime/production.entitlements.xml | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/security/mac/hardenedruntime/developer.entitlements.xml b/security/mac/hardenedruntime/developer.entitlements.xml
index f1c3f69fd1d3..7f88d065d86b 100644
--- a/security/mac/hardenedruntime/developer.entitlements.xml
+++ b/security/mac/hardenedruntime/developer.entitlements.xml
@@ -23,12 +23,11 @@
     
     com.apple.security.cs.disable-executable-page-protection
 
-    
-    com.apple.security.cs.disable-library-validation
+    
+    com.apple.security.cs.disable-library-validation
 
     
+         dyld variables to load libaries from within the .app bundle. -->
     com.apple.security.cs.allow-dyld-environment-variables
 
     
diff --git a/security/mac/hardenedruntime/production.entitlements.xml b/security/mac/hardenedruntime/production.entitlements.xml
index 9a1bd9b882ef..a1472493a5e5 100644
--- a/security/mac/hardenedruntime/production.entitlements.xml
+++ b/security/mac/hardenedruntime/production.entitlements.xml
@@ -20,12 +20,11 @@
     
     com.apple.security.cs.disable-executable-page-protection
 
-    
-    com.apple.security.cs.disable-library-validation
+    
+    com.apple.security.cs.disable-library-validation
 
     
+         dyld variables to load libaries from within the .app bundle. -->
     com.apple.security.cs.allow-dyld-environment-variables
 
     
 
-
 
-
 
diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd
index 0c7d0e25ad57..1fd606ab5881 100644
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -112,10 +112,6 @@ convenience of Safari and Chrome users on macOS. See bug 1398988. -->
 
 
-
-
-
-