mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
48a4c411fb
This patch implements the window letterboxing. The implementation is based on adding margins around the browser element to round the content viewport size. Whenever the browser content is resized, the RFPHelper will adjust margins around it. But it won't add any margins for an empty browser or a browser loads a content with the system principal. The letterboxing is hidden behind a hidden pref "privacy.resistFingerprinting.letterboxing." By default, it will use stepping size 200x100 to round content window. And we can customize the set of dimensions used for deciding the size of the rounded content viewport by the pref "privacy.resistFingerprinting.letterboxing.dimensions". This pref should be formated as 'width1xheight1, width2xheight2, ...'. We will find the dimensions which can fit into the real content size and have the smallest margins to be the rounded content viewport size. For example , given the set "400x200, 500x300, 800x500" and the real content size "600x300", we would round the content size into 500x300. --HG-- extra : histedit_source : 4d4ced7e899f4f3cae25e11d30cc24a4f1b9e0e7
23 lines
814 B
JavaScript
23 lines
814 B
JavaScript
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
var EXPORTED_SYMBOLS = ["RFPHelperChild"];
|
|
|
|
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
|
|
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
const kPrefLetterboxing = "privacy.resistFingerprinting.letterboxing";
|
|
|
|
XPCOMUtils.defineLazyPreferenceGetter(this, "isLetterboxingEnabled",
|
|
kPrefLetterboxing, false);
|
|
|
|
class RFPHelperChild extends ActorChild {
|
|
handleEvent() {
|
|
if (isLetterboxingEnabled) {
|
|
this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
|
|
}
|
|
}
|
|
}
|