Merge mozilla-central to mozilla-inbound

This commit is contained in:
Dorel Luca 2019-08-26 12:47:46 +03:00
Родитель 8e49d537cb 325c1a7078
Коммит f37365e4d7
110 изменённых файлов: 2225 добавлений и 1326 удалений

Просмотреть файл

@ -111,9 +111,6 @@ devtools/client/shared/components/reps/
# Ignore devtools preferences files
devtools/client/preferences/
devtools/client/webide/preferences/
devtools/shared/preferences/
devtools/startup/preferences/devtools-startup.js
# Ignore devtools generated code
devtools/shared/css/generated/properties-db.js

Просмотреть файл

@ -15,10 +15,6 @@ browser/branding/nightly/pref/firefox-branding.js
browser/branding/official/pref/firefox-branding.js
browser/branding/unofficial/pref/firefox-branding.js
devtools/client/preferences/debugger.js
devtools/client/preferences/devtools-client.js
devtools/client/webide/preferences/webide.js
devtools/shared/preferences/devtools-shared.js
devtools/startup/preferences/devtools-startup.js
extensions/pref/autoconfig/test/unit/autoconfig.js
mobile/android/app/geckoview-prefs.js
mobile/android/app/mobile.js

6
Cargo.lock сгенерированный
Просмотреть файл

@ -553,7 +553,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cookie"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3575,7 +3575,7 @@ name = "webdriver"
version = "0.40.1"
dependencies = [
"base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3910,7 +3910,7 @@ dependencies = [
"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
"checksum comedy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f03fbb05a4df3523a44cda10340e6ae6bea03ee9d01240a1a2c1ef6c73e95"
"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
"checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf"
"checksum cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"
"checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
"checksum core-graphics 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62ceafe1622ffc9a332199096841d0ff9912ec8cf8f9cde01e254a7d5217cd10"

Просмотреть файл

@ -1949,3 +1949,432 @@ pref("privacy.socialtracking.notification.period.min", 172800000);
pref("privacy.socialtracking.notification.counter", 0);
// maximum number of popup shown in the profile.
pref("privacy.socialtracking.notification.max", 2);
// Disable WebIDE and ConnectPage by default (Bug 1539451)
pref("devtools.webide.enabled", false);
pref("devtools.connectpage.enabled", false);
// Toolbox preferences
pref("devtools.toolbox.footer.height", 250);
pref("devtools.toolbox.sidebar.width", 500);
pref("devtools.toolbox.host", "bottom");
pref("devtools.toolbox.previousHost", "right");
pref("devtools.toolbox.selectedTool", "inspector");
pref("devtools.toolbox.sideEnabled", true);
pref("devtools.toolbox.zoomValue", "1");
pref("devtools.toolbox.splitconsoleEnabled", false);
pref("devtools.toolbox.splitconsoleHeight", 100);
pref("devtools.toolbox.tabsOrder", "");
// The fission pref is enabling the "Omniscient Browser Toolbox", which will
// make it possible to debug anything in Firefox (See Bug 1570639 for more
// information).
// ⚠ This is a work in progress. Expect weirdness when the pref is enabled. ⚠
pref("devtools.browsertoolbox.fission", false);
// Toolbox Button preferences
pref("devtools.command-button-pick.enabled", true);
pref("devtools.command-button-frames.enabled", true);
pref("devtools.command-button-splitconsole.enabled", true);
pref("devtools.command-button-paintflashing.enabled", false);
pref("devtools.command-button-scratchpad.enabled", false);
pref("devtools.command-button-responsive.enabled", true);
pref("devtools.command-button-screenshot.enabled", false);
pref("devtools.command-button-rulers.enabled", false);
pref("devtools.command-button-measure.enabled", false);
pref("devtools.command-button-noautohide.enabled", false);
// Inspector preferences
// Enable the Inspector
pref("devtools.inspector.enabled", true);
// What was the last active sidebar in the inspector
pref("devtools.inspector.activeSidebar", "layoutview");
pref("devtools.inspector.remote", false);
// Enable the 3 pane mode in the inspector
pref("devtools.inspector.three-pane-enabled", true);
// Enable the 3 pane mode in the chrome inspector
pref("devtools.inspector.chrome.three-pane-enabled", false);
// Collapse pseudo-elements by default in the rule-view
pref("devtools.inspector.show_pseudo_elements", false);
// The default size for image preview tooltips in the rule-view/computed-view/markup-view
pref("devtools.inspector.imagePreviewTooltipSize", 300);
// Enable user agent style inspection in rule-view
pref("devtools.inspector.showUserAgentStyles", false);
// Show all native anonymous content
pref("devtools.inspector.showAllAnonymousContent", false);
// Show user agent shadow roots
pref("devtools.inspector.showUserAgentShadowRoots", false);
// Enable the new Rules View
pref("devtools.inspector.new-rulesview.enabled", false);
// Grid highlighter preferences
pref("devtools.gridinspector.gridOutlineMaxColumns", 50);
pref("devtools.gridinspector.gridOutlineMaxRows", 50);
pref("devtools.gridinspector.showGridAreas", false);
pref("devtools.gridinspector.showGridLineNumbers", false);
pref("devtools.gridinspector.showInfiniteLines", false);
// Max number of grid highlighters that can be displayed
pref("devtools.gridinspector.maxHighlighters", 3);
// Whether or not the box model panel is opened in the layout view
pref("devtools.layout.boxmodel.opened", true);
// Whether or not the flexbox panel is opened in the layout view
pref("devtools.layout.flexbox.opened", true);
// Whether or not the grid inspector panel is opened in the layout view
pref("devtools.layout.grid.opened", true);
// Enable hovering Box Model values and jumping to their source CSS rule in the
// rule-view.
#if defined(NIGHTLY_BUILD)
pref("devtools.layout.boxmodel.highlightProperty", true);
#else
pref("devtools.layout.boxmodel.highlightProperty", false);
#endif
// By how many times eyedropper will magnify pixels
pref("devtools.eyedropper.zoom", 6);
// Enable to collapse attributes that are too long.
pref("devtools.markup.collapseAttributes", true);
// Length to collapse attributes
pref("devtools.markup.collapseAttributeLength", 120);
// Whether to auto-beautify the HTML on copy.
pref("devtools.markup.beautifyOnCopy", false);
// Whether or not the DOM mutation breakpoints context menu are enabled in the
// markup view.
pref("devtools.markup.mutationBreakpoints.enabled", false);
// DevTools default color unit
pref("devtools.defaultColorUnit", "authored");
// Enable the Memory tools
pref("devtools.memory.enabled", true);
pref("devtools.memory.custom-census-displays", "{}");
pref("devtools.memory.custom-label-displays", "{}");
pref("devtools.memory.custom-tree-map-displays", "{}");
pref("devtools.memory.max-individuals", 1000);
pref("devtools.memory.max-retaining-paths", 10);
// Enable the Performance tools
pref("devtools.performance.enabled", true);
// The default Performance UI settings
pref("devtools.performance.memory.sample-probability", "0.05");
// Can't go higher than this without causing internal allocation overflows while
// serializing the allocations data over the RDP.
pref("devtools.performance.memory.max-log-length", 125000);
pref("devtools.performance.timeline.hidden-markers",
"[\"Composite\",\"CompositeForwardTransaction\"]");
pref("devtools.performance.profiler.buffer-size", 10000000);
pref("devtools.performance.profiler.sample-frequency-hz", 1000);
pref("devtools.performance.ui.invert-call-tree", true);
pref("devtools.performance.ui.invert-flame-graph", false);
pref("devtools.performance.ui.flatten-tree-recursion", true);
pref("devtools.performance.ui.show-platform-data", false);
pref("devtools.performance.ui.show-idle-blocks", true);
pref("devtools.performance.ui.enable-memory", false);
pref("devtools.performance.ui.enable-allocations", false);
pref("devtools.performance.ui.enable-framerate", true);
pref("devtools.performance.ui.show-jit-optimizations", false);
pref("devtools.performance.ui.show-triggers-for-gc-types",
"TOO_MUCH_MALLOC ALLOC_TRIGGER LAST_DITCH EAGER_ALLOC_TRIGGER");
// Temporary pref disabling memory flame views
// TODO remove once we have flame charts via bug 1148663
pref("devtools.performance.ui.enable-memory-flame", false);
// Enable experimental options in the UI only in Nightly
#if defined(NIGHTLY_BUILD)
pref("devtools.performance.ui.experimental", true);
#else
pref("devtools.performance.ui.experimental", false);
#endif
// Preferences for the new performance panel. This pref configures the base URL
// for the profiler.firefox.com instance to use. This is useful so that a
// developer can change it while working on profiler.firefox.com, or in tests.
// This isn't exposed directly to the user.
pref("devtools.performance.recording.ui-base-url", "https://profiler.firefox.com");
// A JSON array of strings, where each string is a file path to an objdir on
// the host machine. This is used in order to look up symbol information from
// build artifacts of local builds.
pref("devtools.performance.recording.objdirs", "[]");
// The default cache UI setting
pref("devtools.cache.disabled", false);
// The default service workers UI setting
pref("devtools.serviceWorkers.testing.enabled", false);
// Enable the Network Monitor
pref("devtools.netmonitor.enabled", true);
// Enable Network Search
pref("devtools.netmonitor.features.search", false);
// Enable the Application panel
pref("devtools.application.enabled", false);
// The default Network Monitor UI settings
pref("devtools.netmonitor.panes-network-details-width", 550);
pref("devtools.netmonitor.panes-network-details-height", 450);
pref("devtools.netmonitor.panes-search-width", 550);
pref("devtools.netmonitor.panes-search-height", 450);
pref("devtools.netmonitor.filters", "[\"all\"]");
pref("devtools.netmonitor.visibleColumns",
"[\"status\",\"method\",\"domain\",\"file\",\"cause\",\"type\",\"transferred\",\"contentSize\",\"waterfall\"]"
);
pref("devtools.netmonitor.columnsData",
'[{"name":"status","minWidth":30,"width":5}, {"name":"method","minWidth":30,"width":5}, {"name":"domain","minWidth":30,"width":10}, {"name":"file","minWidth":30,"width":25}, {"name":"url","minWidth":30,"width":25}, {"name":"cause","minWidth":30,"width":10},{"name":"type","minWidth":30,"width":5},{"name":"transferred","minWidth":30,"width":10},{"name":"contentSize","minWidth":30,"width":5},{"name":"waterfall","minWidth":150,"width":25}]');
pref("devtools.netmonitor.ws.payload-preview-height", 128);
pref("devtools.netmonitor.ws.visibleColumns",
'["data", "time"]'
);
pref("devtools.netmonitor.ws.displayed-frames.limit", 500);
pref("devtools.netmonitor.response.ui.limit", 10240);
// Save request/response bodies yes/no.
pref("devtools.netmonitor.saveRequestAndResponseBodies", true);
// The default Network monitor HAR export setting
pref("devtools.netmonitor.har.defaultLogDir", "");
pref("devtools.netmonitor.har.defaultFileName", "%hostname_Archive [%date]");
pref("devtools.netmonitor.har.jsonp", false);
pref("devtools.netmonitor.har.jsonpCallback", "");
pref("devtools.netmonitor.har.includeResponseBodies", true);
pref("devtools.netmonitor.har.compress", false);
pref("devtools.netmonitor.har.forceExport", false);
pref("devtools.netmonitor.har.pageLoadedTimeout", 1500);
pref("devtools.netmonitor.har.enableAutoExportToFile", false);
// Enable WebSocket monitoring in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.netmonitor.features.webSockets", true);
#else
pref("devtools.netmonitor.features.webSockets", false);
#endif
// Scratchpad settings
// - recentFileMax: The maximum number of recently-opened files
// stored. Setting this preference to 0 will not
// clear any recent files, but rather hide the
// 'Open Recent'-menu.
// - lineNumbers: Whether to show line numbers or not.
// - wrapText: Whether to wrap text or not.
// - showTrailingSpace: Whether to highlight trailing space or not.
// - editorFontSize: Editor font size configuration.
// - enableAutocompletion: Whether to enable JavaScript autocompletion.
pref("devtools.scratchpad.recentFilesMax", 10);
pref("devtools.scratchpad.lineNumbers", true);
pref("devtools.scratchpad.wrapText", false);
pref("devtools.scratchpad.showTrailingSpace", false);
pref("devtools.scratchpad.editorFontSize", 12);
pref("devtools.scratchpad.enableAutocompletion", true);
// Enable the Storage Inspector
pref("devtools.storage.enabled", true);
// Enable the Style Editor.
pref("devtools.styleeditor.enabled", true);
pref("devtools.styleeditor.autocompletion-enabled", true);
pref("devtools.styleeditor.showMediaSidebar", true);
pref("devtools.styleeditor.mediaSidebarWidth", 238);
pref("devtools.styleeditor.navSidebarWidth", 245);
pref("devtools.styleeditor.transitions", true);
// Screenshot Option Settings.
pref("devtools.screenshot.clipboard.enabled", false);
pref("devtools.screenshot.audio.enabled", true);
// Enable Scratchpad
pref("devtools.scratchpad.enabled", false);
// Make sure the DOM panel is hidden by default
pref("devtools.dom.enabled", false);
// Enable the Accessibility panel.
pref("devtools.accessibility.enabled", true);
// Web console filters
pref("devtools.webconsole.filter.error", true);
pref("devtools.webconsole.filter.warn", true);
pref("devtools.webconsole.filter.info", true);
pref("devtools.webconsole.filter.log", true);
pref("devtools.webconsole.filter.debug", true);
pref("devtools.webconsole.filter.css", false);
pref("devtools.webconsole.filter.net", false);
pref("devtools.webconsole.filter.netxhr", false);
// Webconsole autocomplete preference
pref("devtools.webconsole.input.autocomplete",true);
// Browser console filters
pref("devtools.browserconsole.filter.error", true);
pref("devtools.browserconsole.filter.warn", true);
pref("devtools.browserconsole.filter.info", true);
pref("devtools.browserconsole.filter.log", true);
pref("devtools.browserconsole.filter.debug", true);
pref("devtools.browserconsole.filter.css", false);
pref("devtools.browserconsole.filter.net", false);
pref("devtools.browserconsole.filter.netxhr", false);
// Max number of inputs to store in web console history.
pref("devtools.webconsole.inputHistoryCount", 300);
// Persistent logging: |true| if you want the relevant tool to keep all of the
// logged messages after reloading the page, |false| if you want the output to
// be cleared each time page navigation happens.
pref("devtools.webconsole.persistlog", false);
pref("devtools.netmonitor.persistlog", false);
// Web Console timestamp: |true| if you want the logs and instructions
// in the Web Console to display a timestamp, or |false| to not display
// any timestamps.
pref("devtools.webconsole.timestampMessages", false);
// Enable the webconsole sidebar toggle in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.webconsole.sidebarToggle", true);
#else
pref("devtools.webconsole.sidebarToggle", false);
#endif
// Enable editor mode in the console in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.webconsole.features.editor", true);
#else
pref("devtools.webconsole.features.editor", false);
#endif
// Saved editor mode state in the console.
pref("devtools.webconsole.input.editor", false);
// Editor width for webconsole and browserconsole
pref("devtools.webconsole.input.editorWidth", 0);
pref("devtools.browserconsole.input.editorWidth", 0);
// Disable the new performance recording panel by default
pref("devtools.performance.new-panel-enabled", false);
// Enable message grouping in the console, true by default
pref("devtools.webconsole.groupWarningMessages", true);
// Saved state of the Display content messages checkbox in the browser console.
pref("devtools.browserconsole.contentMessages", false);
// Enable client-side mapping service for source maps
pref("devtools.source-map.client-service.enabled", true);
// The number of lines that are displayed in the web console.
pref("devtools.hud.loglimit", 10000);
// The developer tools editor configuration:
// - tabsize: how many spaces to use when a Tab character is displayed.
// - expandtab: expand Tab characters to spaces.
// - keymap: which keymap to use (can be 'default', 'emacs' or 'vim')
// - autoclosebrackets: whether to permit automatic bracket/quote closing.
// - detectindentation: whether to detect the indentation from the file
// - enableCodeFolding: Whether to enable code folding or not.
pref("devtools.editor.tabsize", 2);
pref("devtools.editor.expandtab", true);
pref("devtools.editor.keymap", "default");
pref("devtools.editor.autoclosebrackets", true);
pref("devtools.editor.detectindentation", true);
pref("devtools.editor.enableCodeFolding", true);
pref("devtools.editor.autocomplete", true);
// The angle of the viewport.
pref("devtools.responsive.viewport.angle", 0);
// The width of the viewport.
pref("devtools.responsive.viewport.width", 320);
// The height of the viewport.
pref("devtools.responsive.viewport.height", 480);
// The pixel ratio of the viewport.
pref("devtools.responsive.viewport.pixelRatio", 0);
// Whether or not the viewports are left aligned.
pref("devtools.responsive.leftAlignViewport.enabled", false);
// Whether to reload when touch simulation is toggled
pref("devtools.responsive.reloadConditions.touchSimulation", false);
// Whether to reload when user agent is changed
pref("devtools.responsive.reloadConditions.userAgent", false);
// Whether to show the notification about reloading to apply emulation
pref("devtools.responsive.reloadNotification.enabled", true);
// Whether or not touch simulation is enabled.
pref("devtools.responsive.touchSimulation.enabled", false);
// Whether or not meta viewport is enabled, if and only if touchSimulation
// is also enabled.
pref("devtools.responsive.metaViewport.enabled", false);
// The user agent of the viewport.
pref("devtools.responsive.userAgent", "");
// Whether to show the settings onboarding tooltip only in release or beta
// builds.
#if defined(RELEASE_OR_BETA)
pref("devtools.responsive.show-setting-tooltip", true);
#else
pref("devtools.responsive.show-setting-tooltip", false);
#endif
// Show the custom user agent input in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.responsive.showUserAgentInput", true);
#else
pref("devtools.responsive.showUserAgentInput", false);
#endif
// Show tab debug targets for This Firefox (on by default for local builds).
#ifdef MOZILLA_OFFICIAL
pref("devtools.aboutdebugging.local-tab-debugging", false);
#else
pref("devtools.aboutdebugging.local-tab-debugging", true);
#endif
// Show process debug targets.
pref("devtools.aboutdebugging.process-debugging", true);
// Stringified array of network locations that users can connect to.
pref("devtools.aboutdebugging.network-locations", "[]");
// Debug target pane collapse/expand settings.
pref("devtools.aboutdebugging.collapsibilities.installedExtension", false);
pref("devtools.aboutdebugging.collapsibilities.otherWorker", false);
pref("devtools.aboutdebugging.collapsibilities.serviceWorker", false);
pref("devtools.aboutdebugging.collapsibilities.sharedWorker", false);
pref("devtools.aboutdebugging.collapsibilities.tab", false);
pref("devtools.aboutdebugging.collapsibilities.temporaryExtension", false);
// about:debugging: only show system and hidden extensions in local builds by
// default.
#ifdef MOZILLA_OFFICIAL
pref("devtools.aboutdebugging.showHiddenAddons", false);
#else
pref("devtools.aboutdebugging.showHiddenAddons", true);
#endif
// Map top-level await expressions in the console
pref("devtools.debugger.features.map-await-expression", true);
// Disable autohide for DevTools popups and tooltips.
// This is currently not exposed by any UI to avoid making
// about:devtools-toolbox tabs unusable by mistake.
pref("devtools.popup.disable_autohide", false);
// Load the DevTools toolbox in a frame with type=content instead of type=chrome
// See Bug 1539979 for more details.
// We keep the option of running devtools in a chrome frame while we fix racy
// tests that started failing when using type=content, but this ultimately
// should be removed.
pref("devtools.toolbox.content-frame", true);
pref("devtools.webide.templatesURL", "https://code.cdn.mozilla.net/templates/list.json");
pref("devtools.webide.autoinstallADBExtension", true);
pref("devtools.webide.autoConnectRuntime", true);
pref("devtools.webide.restoreLastProject", true);
pref("devtools.webide.enableLocalRuntime", false);
pref("devtools.webide.lastConnectedRuntime", "");
pref("devtools.webide.lastSelectedProject", "");
pref("devtools.webide.zoom", "1");
pref("devtools.webide.busyTimeout", 10000);

Просмотреть файл

@ -92,6 +92,42 @@ cfr-whatsnew-button =
cfr-whatsnew-panel-header = Whats New
cfr-whatsnew-release-notes-link-text = Read the release notes
cfr-whatsnew-fx70-title = { -brand-short-name } now fights harder for your privacy
cfr-whatsnew-fx70-body =
The latest update enhances the Tracking Protection feature and makes it
easier than ever to create secure passwords for every site.
cfr-whatsnew-tracking-protect-title = Protect yourself from trackers
cfr-whatsnew-tracking-protect-body =
{ -brand-short-name } blocks many common social and cross-site trackers that
follow what you do online.
cfr-whatsnew-tracking-protect-link-text = View Your Report
# This string is displayed before a large numeral that indicates the total
# number of tracking elements blocked. Dont add $blockedCount to your
# localization, because it would result in the number showing twice.
cfr-whatsnew-tracking-blocked-title =
{ $blockedCount ->
[one] Tracker blocked
*[other] Trackers blocked
}
cfr-whatsnew-tracking-blocked-subtitle =
Since { DATETIME($earliestDate, month: "long", year: "numeric") }
cfr-whatsnew-tracking-blocked-link-text = View Report
cfr-whatsnew-lockwise-backup-title = Back up your passwords
cfr-whatsnew-lockwise-backup-body =
Now generate secure passwords you can access anywhere you sign in.
cfr-whatsnew-lockwise-backup-link-text = Turn on backups
cfr-whatsnew-lockwise-take-title = Take your passwords with you
cfr-whatsnew-lockwise-take-body =
The { -lockwise-brand-short-name } mobile app lets you securely access your
backed up passwords from anywhere.
cfr-whatsnew-lockwise-take-link-text = Get the app
## Bookmark Sync
cfr-doorhanger-sync-bookmarks-header = Get this bookmark on your phone

Просмотреть файл

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files("**"):
BUG_COMPONENT = ("Firefox", "Activity Streams: Newtab")
BUG_COMPONENT = ("Firefox", "New Tab Page")
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']

Просмотреть файл

@ -261,17 +261,14 @@
; [Webide Files]
@RESPATH@/browser/chrome/webide@JAREXT@
@RESPATH@/browser/chrome/webide.manifest
@RESPATH@/browser/@PREF_DIR@/webide.js
; [DevTools Startup Files]
@RESPATH@/browser/chrome/devtools-startup@JAREXT@
@RESPATH@/browser/chrome/devtools-startup.manifest
@RESPATH@/browser/@PREF_DIR@/devtools-startup.js
; DevTools
@RESPATH@/browser/chrome/devtools@JAREXT@
@RESPATH@/browser/chrome/devtools.manifest
@RESPATH@/browser/@PREF_DIR@/devtools-client.js
@RESPATH@/browser/@PREF_DIR@/debugger.js
; shell icons

Просмотреть файл

@ -92,6 +92,42 @@ cfr-whatsnew-button =
cfr-whatsnew-panel-header = Whats New
cfr-whatsnew-release-notes-link-text = Read the release notes
cfr-whatsnew-fx70-title = { -brand-short-name } now fights harder for your privacy
cfr-whatsnew-fx70-body =
The latest update enhances the Tracking Protection feature and makes it
easier than ever to create secure passwords for every site.
cfr-whatsnew-tracking-protect-title = Protect yourself from trackers
cfr-whatsnew-tracking-protect-body =
{ -brand-short-name } blocks many common social and cross-site trackers that
follow what you do online.
cfr-whatsnew-tracking-protect-link-text = View Your Report
# This string is displayed before a large numeral that indicates the total
# number of tracking elements blocked. Dont add $blockedCount to your
# localization, because it would result in the number showing twice.
cfr-whatsnew-tracking-blocked-title =
{ $blockedCount ->
[one] Tracker blocked
*[other] Trackers blocked
}
cfr-whatsnew-tracking-blocked-subtitle =
Since { DATETIME($earliestDate, month: "long", year: "numeric") }
cfr-whatsnew-tracking-blocked-link-text = View Report
cfr-whatsnew-lockwise-backup-title = Back up your passwords
cfr-whatsnew-lockwise-backup-body =
Now generate secure passwords you can access anywhere you sign in.
cfr-whatsnew-lockwise-backup-link-text = Turn on backups
cfr-whatsnew-lockwise-take-title = Take your passwords with you
cfr-whatsnew-lockwise-take-body =
The { -lockwise-brand-short-name } mobile app lets you securely access your
backed up passwords from anywhere.
cfr-whatsnew-lockwise-take-link-text = Get the app
## Bookmark Sync
cfr-doorhanger-sync-bookmarks-header = Get this bookmark on your phone

Просмотреть файл

@ -62,6 +62,9 @@ def phc_default(milestone, target, replace_malloc_default, replace_malloc):
return False
# Both Linux32 and Win32 have frequent crashes when stack tracing (for
# unclear reasons), so PHC is enabled only on 64-bit only in both cases.
#
# XXX: PHC is implemented but not yet enabled on Mac. Bug 1576515 is about
# enabling it on Mac, but it is blocked by bug 1035892.
return (target.os == 'GNU' and target.kernel == 'Linux' and
target.bitness == 64) or \
(target.kernel == 'WINNT' and target.bitness == 64)

Просмотреть файл

@ -8,6 +8,10 @@
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [["devtools.netmonitor.features.webSockets", true]],
});
const { tab, monitor } = await initNetMonitor(WS_PAGE_URL);
info("Starting test... ");

Просмотреть файл

@ -8,6 +8,10 @@
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [["devtools.netmonitor.features.webSockets", true]],
});
const { tab, monitor } = await initNetMonitor(WS_PAGE_URL);
info("Starting test... ");

Просмотреть файл

@ -8,6 +8,10 @@
*/
add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [["devtools.netmonitor.features.webSockets", true]],
});
const { tab, monitor } = await initNetMonitor(WS_PAGE_URL);
info("Starting test... ");

Просмотреть файл

@ -2,6 +2,11 @@
* 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/>. */
// Most devtools prefs are found in browser/app/profile/firefox.js. The
// debugger prefs are separate so they can be easily mirrored to the debugger
// project on GitHub, here:
// https://github.com/firefox-devtools/debugger/blob/master/assets/panel/prefs.js
// Enable the Debugger
pref("devtools.debugger.enabled", true);
pref("devtools.debugger.chrome-debugging-host", "localhost");

Просмотреть файл

@ -1,417 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Disable WebIDE and ConnectPage by default (Bug 1539451)
pref("devtools.webide.enabled", false);
pref("devtools.connectpage.enabled", false);
// Toolbox preferences
pref("devtools.toolbox.footer.height", 250);
pref("devtools.toolbox.sidebar.width", 500);
pref("devtools.toolbox.host", "bottom");
pref("devtools.toolbox.previousHost", "right");
pref("devtools.toolbox.selectedTool", "inspector");
pref("devtools.toolbox.sideEnabled", true);
pref("devtools.toolbox.zoomValue", "1");
pref("devtools.toolbox.splitconsoleEnabled", false);
pref("devtools.toolbox.splitconsoleHeight", 100);
pref("devtools.toolbox.tabsOrder", "");
// The fission pref is enabling the "Omniscient Browser Toolbox", which will make it
// possible to debug anything in Firefox (See Bug 1570639 for more information).
// ⚠ This is a work in progress. Expect weirdness when the pref is flipped on ⚠
pref("devtools.browsertoolbox.fission", false);
// Toolbox Button preferences
pref("devtools.command-button-pick.enabled", true);
pref("devtools.command-button-frames.enabled", true);
pref("devtools.command-button-splitconsole.enabled", true);
pref("devtools.command-button-paintflashing.enabled", false);
pref("devtools.command-button-scratchpad.enabled", false);
pref("devtools.command-button-responsive.enabled", true);
pref("devtools.command-button-screenshot.enabled", false);
pref("devtools.command-button-rulers.enabled", false);
pref("devtools.command-button-measure.enabled", false);
pref("devtools.command-button-noautohide.enabled", false);
// Inspector preferences
// Enable the Inspector
pref("devtools.inspector.enabled", true);
// What was the last active sidebar in the inspector
pref("devtools.inspector.activeSidebar", "layoutview");
pref("devtools.inspector.remote", false);
// Enable the 3 pane mode in the inspector
pref("devtools.inspector.three-pane-enabled", true);
// Enable the 3 pane mode in the chrome inspector
pref("devtools.inspector.chrome.three-pane-enabled", false);
// Collapse pseudo-elements by default in the rule-view
pref("devtools.inspector.show_pseudo_elements", false);
// The default size for image preview tooltips in the rule-view/computed-view/markup-view
pref("devtools.inspector.imagePreviewTooltipSize", 300);
// Enable user agent style inspection in rule-view
pref("devtools.inspector.showUserAgentStyles", false);
// Show all native anonymous content
pref("devtools.inspector.showAllAnonymousContent", false);
// Show user agent shadow roots
pref("devtools.inspector.showUserAgentShadowRoots", false);
// Enable the new Rules View
pref("devtools.inspector.new-rulesview.enabled", false);
// Grid highlighter preferences
pref("devtools.gridinspector.gridOutlineMaxColumns", 50);
pref("devtools.gridinspector.gridOutlineMaxRows", 50);
pref("devtools.gridinspector.showGridAreas", false);
pref("devtools.gridinspector.showGridLineNumbers", false);
pref("devtools.gridinspector.showInfiniteLines", false);
// Max number of grid highlighters that can be displayed
pref("devtools.gridinspector.maxHighlighters", 3);
// Whether or not the box model panel is opened in the layout view
pref("devtools.layout.boxmodel.opened", true);
// Whether or not the flexbox panel is opened in the layout view
pref("devtools.layout.flexbox.opened", true);
// Whether or not the grid inspector panel is opened in the layout view
pref("devtools.layout.grid.opened", true);
// Enable hovering Box Model values and jumping to their source CSS rule in the rule-view
#if defined(NIGHTLY_BUILD)
pref("devtools.layout.boxmodel.highlightProperty", true);
#else
pref("devtools.layout.boxmodel.highlightProperty", false);
#endif
// By how many times eyedropper will magnify pixels
pref("devtools.eyedropper.zoom", 6);
// Enable to collapse attributes that are too long.
pref("devtools.markup.collapseAttributes", true);
// Length to collapse attributes
pref("devtools.markup.collapseAttributeLength", 120);
// Whether to auto-beautify the HTML on copy.
pref("devtools.markup.beautifyOnCopy", false);
// Whether or not the DOM mutation breakpoints context menu are enabled in the markup view
pref("devtools.markup.mutationBreakpoints.enabled", false);
// DevTools default color unit
pref("devtools.defaultColorUnit", "authored");
// Enable the Memory tools
pref("devtools.memory.enabled", true);
pref("devtools.memory.custom-census-displays", "{}");
pref("devtools.memory.custom-label-displays", "{}");
pref("devtools.memory.custom-tree-map-displays", "{}");
pref("devtools.memory.max-individuals", 1000);
pref("devtools.memory.max-retaining-paths", 10);
// Enable the Performance tools
pref("devtools.performance.enabled", true);
// The default Performance UI settings
pref("devtools.performance.memory.sample-probability", "0.05");
// Can't go higher than this without causing internal allocation overflows while
// serializing the allocations data over the RDP.
pref("devtools.performance.memory.max-log-length", 125000);
pref("devtools.performance.timeline.hidden-markers",
"[\"Composite\",\"CompositeForwardTransaction\"]");
pref("devtools.performance.profiler.buffer-size", 10000000);
pref("devtools.performance.profiler.sample-frequency-hz", 1000);
pref("devtools.performance.ui.invert-call-tree", true);
pref("devtools.performance.ui.invert-flame-graph", false);
pref("devtools.performance.ui.flatten-tree-recursion", true);
pref("devtools.performance.ui.show-platform-data", false);
pref("devtools.performance.ui.show-idle-blocks", true);
pref("devtools.performance.ui.enable-memory", false);
pref("devtools.performance.ui.enable-allocations", false);
pref("devtools.performance.ui.enable-framerate", true);
pref("devtools.performance.ui.show-jit-optimizations", false);
pref("devtools.performance.ui.show-triggers-for-gc-types",
"TOO_MUCH_MALLOC ALLOC_TRIGGER LAST_DITCH EAGER_ALLOC_TRIGGER");
// Temporary pref disabling memory flame views
// TODO remove once we have flame charts via bug 1148663
pref("devtools.performance.ui.enable-memory-flame", false);
// Enable experimental options in the UI only in Nightly
#if defined(NIGHTLY_BUILD)
pref("devtools.performance.ui.experimental", true);
#else
pref("devtools.performance.ui.experimental", false);
#endif
// Preferences for the new performance panel
// This pref configures the base URL for the profiler.firefox.com instance to use. This is
// useful so that a developer can change it while working on profiler.firefox.com, or in
// tests.
// This isn't exposed directly to the user.
pref("devtools.performance.recording.ui-base-url", "https://profiler.firefox.com");
// A JSON array of strings, where each string is a file path to an objdir on
// the host machine. This is used in order to look up symbol information from
// build artifacts of local builds.
pref("devtools.performance.recording.objdirs", "[]");
// The default cache UI setting
pref("devtools.cache.disabled", false);
// The default service workers UI setting
pref("devtools.serviceWorkers.testing.enabled", false);
// Enable the Network Monitor
pref("devtools.netmonitor.enabled", true);
// Enable Network Search
pref("devtools.netmonitor.features.search", false);
// Enable the Application panel
pref("devtools.application.enabled", false);
// The default Network Monitor UI settings
pref("devtools.netmonitor.panes-network-details-width", 550);
pref("devtools.netmonitor.panes-network-details-height", 450);
pref("devtools.netmonitor.panes-search-width", 550);
pref("devtools.netmonitor.panes-search-height", 450);
pref("devtools.netmonitor.filters", "[\"all\"]");
pref("devtools.netmonitor.visibleColumns",
"[\"status\",\"method\",\"domain\",\"file\",\"cause\",\"type\",\"transferred\",\"contentSize\",\"waterfall\"]"
);
pref("devtools.netmonitor.columnsData",
'[{"name":"status","minWidth":30,"width":5}, {"name":"method","minWidth":30,"width":5}, {"name":"domain","minWidth":30,"width":10}, {"name":"file","minWidth":30,"width":25}, {"name":"url","minWidth":30,"width":25}, {"name":"cause","minWidth":30,"width":10},{"name":"type","minWidth":30,"width":5},{"name":"transferred","minWidth":30,"width":10},{"name":"contentSize","minWidth":30,"width":5},{"name":"waterfall","minWidth":150,"width":25}]');
pref("devtools.netmonitor.ws.payload-preview-height", 128);
pref("devtools.netmonitor.ws.visibleColumns",
'["data", "time"]'
);
pref("devtools.netmonitor.ws.displayed-frames.limit", 500);
pref("devtools.netmonitor.response.ui.limit", 10240);
// Save request/response bodies yes/no.
pref("devtools.netmonitor.saveRequestAndResponseBodies", true);
// The default Network monitor HAR export setting
pref("devtools.netmonitor.har.defaultLogDir", "");
pref("devtools.netmonitor.har.defaultFileName", "%hostname_Archive [%date]");
pref("devtools.netmonitor.har.jsonp", false);
pref("devtools.netmonitor.har.jsonpCallback", "");
pref("devtools.netmonitor.har.includeResponseBodies", true);
pref("devtools.netmonitor.har.compress", false);
pref("devtools.netmonitor.har.forceExport", false);
pref("devtools.netmonitor.har.pageLoadedTimeout", 1500);
pref("devtools.netmonitor.har.enableAutoExportToFile", false);
// Enable WebSocket monitoring in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.netmonitor.features.webSockets", true);
#else
pref("devtools.netmonitor.features.webSockets", false);
#endif
// Scratchpad settings
// - recentFileMax: The maximum number of recently-opened files
// stored. Setting this preference to 0 will not
// clear any recent files, but rather hide the
// 'Open Recent'-menu.
// - lineNumbers: Whether to show line numbers or not.
// - wrapText: Whether to wrap text or not.
// - showTrailingSpace: Whether to highlight trailing space or not.
// - editorFontSize: Editor font size configuration.
// - enableAutocompletion: Whether to enable JavaScript autocompletion.
pref("devtools.scratchpad.recentFilesMax", 10);
pref("devtools.scratchpad.lineNumbers", true);
pref("devtools.scratchpad.wrapText", false);
pref("devtools.scratchpad.showTrailingSpace", false);
pref("devtools.scratchpad.editorFontSize", 12);
pref("devtools.scratchpad.enableAutocompletion", true);
// Enable the Storage Inspector
pref("devtools.storage.enabled", true);
// Enable the Style Editor.
pref("devtools.styleeditor.enabled", true);
pref("devtools.styleeditor.autocompletion-enabled", true);
pref("devtools.styleeditor.showMediaSidebar", true);
pref("devtools.styleeditor.mediaSidebarWidth", 238);
pref("devtools.styleeditor.navSidebarWidth", 245);
pref("devtools.styleeditor.transitions", true);
// Screenshot Option Settings.
pref("devtools.screenshot.clipboard.enabled", false);
pref("devtools.screenshot.audio.enabled", true);
// Enable Scratchpad
pref("devtools.scratchpad.enabled", false);
// Make sure the DOM panel is hidden by default
pref("devtools.dom.enabled", false);
// Enable the Accessibility panel.
pref("devtools.accessibility.enabled", true);
// Web console filters
pref("devtools.webconsole.filter.error", true);
pref("devtools.webconsole.filter.warn", true);
pref("devtools.webconsole.filter.info", true);
pref("devtools.webconsole.filter.log", true);
pref("devtools.webconsole.filter.debug", true);
pref("devtools.webconsole.filter.css", false);
pref("devtools.webconsole.filter.net", false);
pref("devtools.webconsole.filter.netxhr", false);
// Webconsole autocomplete preference
pref("devtools.webconsole.input.autocomplete",true);
// Browser console filters
pref("devtools.browserconsole.filter.error", true);
pref("devtools.browserconsole.filter.warn", true);
pref("devtools.browserconsole.filter.info", true);
pref("devtools.browserconsole.filter.log", true);
pref("devtools.browserconsole.filter.debug", true);
pref("devtools.browserconsole.filter.css", false);
pref("devtools.browserconsole.filter.net", false);
pref("devtools.browserconsole.filter.netxhr", false);
// Max number of inputs to store in web console history.
pref("devtools.webconsole.inputHistoryCount", 300);
// Persistent logging: |true| if you want the relevant tool to keep all of the
// logged messages after reloading the page, |false| if you want the output to
// be cleared each time page navigation happens.
pref("devtools.webconsole.persistlog", false);
pref("devtools.netmonitor.persistlog", false);
// Web Console timestamp: |true| if you want the logs and instructions
// in the Web Console to display a timestamp, or |false| to not display
// any timestamps.
pref("devtools.webconsole.timestampMessages", false);
// Enable the webconsole sidebar toggle in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.webconsole.sidebarToggle", true);
#else
pref("devtools.webconsole.sidebarToggle", false);
#endif
// Enable editor mode in the console in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.webconsole.features.editor", true);
#else
pref("devtools.webconsole.features.editor", false);
#endif
// Saved editor mode state in the console.
pref("devtools.webconsole.input.editor", false);
// Editor width for webconsole and browserconsole
pref("devtools.webconsole.input.editorWidth", 0);
pref("devtools.browserconsole.input.editorWidth", 0);
// Disable the new performance recording panel by default
pref("devtools.performance.new-panel-enabled", false);
// Enable message grouping in the console, true by default
pref("devtools.webconsole.groupWarningMessages", true);
// Saved state of the Display content messages checkbox in the browser console.
pref("devtools.browserconsole.contentMessages", false);
// Enable client-side mapping service for source maps
pref("devtools.source-map.client-service.enabled", true);
// The number of lines that are displayed in the web console.
pref("devtools.hud.loglimit", 10000);
// The developer tools editor configuration:
// - tabsize: how many spaces to use when a Tab character is displayed.
// - expandtab: expand Tab characters to spaces.
// - keymap: which keymap to use (can be 'default', 'emacs' or 'vim')
// - autoclosebrackets: whether to permit automatic bracket/quote closing.
// - detectindentation: whether to detect the indentation from the file
// - enableCodeFolding: Whether to enable code folding or not.
pref("devtools.editor.tabsize", 2);
pref("devtools.editor.expandtab", true);
pref("devtools.editor.keymap", "default");
pref("devtools.editor.autoclosebrackets", true);
pref("devtools.editor.detectindentation", true);
pref("devtools.editor.enableCodeFolding", true);
pref("devtools.editor.autocomplete", true);
// The angle of the viewport.
pref("devtools.responsive.viewport.angle", 0);
// The width of the viewport.
pref("devtools.responsive.viewport.width", 320);
// The height of the viewport.
pref("devtools.responsive.viewport.height", 480);
// The pixel ratio of the viewport.
pref("devtools.responsive.viewport.pixelRatio", 0);
// Whether or not the viewports are left aligned.
pref("devtools.responsive.leftAlignViewport.enabled", false);
// Whether to reload when touch simulation is toggled
pref("devtools.responsive.reloadConditions.touchSimulation", false);
// Whether to reload when user agent is changed
pref("devtools.responsive.reloadConditions.userAgent", false);
// Whether to show the notification about reloading to apply emulation
pref("devtools.responsive.reloadNotification.enabled", true);
// Whether or not touch simulation is enabled.
pref("devtools.responsive.touchSimulation.enabled", false);
// Whether or not meta viewport is enabled, if and only if touchSimulation
// is also enabled.
pref("devtools.responsive.metaViewport.enabled", false);
// The user agent of the viewport.
pref("devtools.responsive.userAgent", "");
// Whether to show the settings onboarding tooltip only in release or beta builds.
#if defined(RELEASE_OR_BETA)
pref("devtools.responsive.show-setting-tooltip", true);
#else
pref("devtools.responsive.show-setting-tooltip", false);
#endif
// Show the custom user agent input in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.responsive.showUserAgentInput", true);
#else
pref("devtools.responsive.showUserAgentInput", false);
#endif
// Show tab debug targets for This Firefox (on by default for local builds).
#ifdef MOZILLA_OFFICIAL
pref("devtools.aboutdebugging.local-tab-debugging", false);
#else
pref("devtools.aboutdebugging.local-tab-debugging", true);
#endif
// Show process debug targets.
pref("devtools.aboutdebugging.process-debugging", true);
// Stringified array of network locations that users can connect to.
pref("devtools.aboutdebugging.network-locations", "[]");
// Debug target pane collapse/expand settings.
pref("devtools.aboutdebugging.collapsibilities.installedExtension", false);
pref("devtools.aboutdebugging.collapsibilities.otherWorker", false);
pref("devtools.aboutdebugging.collapsibilities.serviceWorker", false);
pref("devtools.aboutdebugging.collapsibilities.sharedWorker", false);
pref("devtools.aboutdebugging.collapsibilities.tab", false);
pref("devtools.aboutdebugging.collapsibilities.temporaryExtension", false);
// about:debugging: only show system and hidden extensions in local builds by default.
#ifdef MOZILLA_OFFICIAL
pref("devtools.aboutdebugging.showHiddenAddons", false);
#else
pref("devtools.aboutdebugging.showHiddenAddons", true);
#endif
// Map top-level await expressions in the console
pref("devtools.debugger.features.map-await-expression", true);
// Disable autohide for DevTools popups and tooltips.
// This is currently not exposed by any UI to avoid making
// about:devtools-toolbox tabs unusable by mistake.
pref("devtools.popup.disable_autohide", false);
// Load the DevTools toolbox in a frame with type=content instead of type=chrome
// See Bug 1539979 for more details.
// We keep the option of running devtools in a chrome frame while we fix racy
// tests that started failing when using type=content, but this ultimately should
// be removed.
pref("devtools.toolbox.content-frame", true);

Просмотреть файл

@ -4,10 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JS_PREFERENCE_PP_FILES += [
'devtools-client.js'
]
JS_PREFERENCE_FILES += [
'debugger.js',
]

Просмотреть файл

@ -3,30 +3,46 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URL = "data:text/html;charset=utf-8,";
const TEST_URL =
'data:text/html;charset=utf-8,<iframe id="subframe" ' +
'width="200" height="200"></iframe>';
addRDMTask(TEST_URL, async function({ ui, manager }) {
await pushPref("devtools.responsive.metaViewport.enabled", true);
ok(ui, "An instance of the RDM should be attached to the tab.");
await setViewportSize(ui, manager, 110, 500);
await setViewportSizeAndAwaitReflow(ui, manager, 110, 500);
info("Checking initial width/height properties.");
await doInitialChecks(ui);
await doInitialChecks(ui, 110);
info("Checking initial width/height with meta viewport on");
await setTouchAndMetaViewportSupport(ui, true);
await doInitialChecks(ui, 440);
await setTouchAndMetaViewportSupport(ui, false);
info("Changing the RDM size");
await setViewportSize(ui, manager, 90, 500);
await setViewportSizeAndAwaitReflow(ui, manager, 90, 500);
info("Checking for screen props");
await checkScreenProps(ui);
info("Checking for screen props with meta viewport on");
await setTouchAndMetaViewportSupport(ui, true);
await checkScreenProps(ui);
await setTouchAndMetaViewportSupport(ui, false);
info("Checking for subframe props");
await checkSubframeProps(ui);
info("Checking for subframe props with meta viewport on");
await setTouchAndMetaViewportSupport(ui, true);
await checkSubframeProps(ui);
await setTouchAndMetaViewportSupport(ui, false);
info("Changing the RDM size using input keys");
await setViewportSizeWithInputKeys(ui);
info("Setting docShell.deviceSizeIsPageSize to false");
await ContentTask.spawn(ui.getViewportBrowser(), {}, async function() {
const docShell = content.docShell;
docShell.deviceSizeIsPageSize = false;
});
info("Checking for screen props once again.");
await checkScreenProps2(ui);
});
@ -71,14 +87,14 @@ async function setViewportSizeWithInputKeys(ui) {
await resized;
}
async function doInitialChecks(ui) {
async function doInitialChecks(ui, expectedInnerWidth) {
const {
innerWidth,
matchesMedia,
outerHeight,
outerWidth,
} = await grabContentInfo(ui);
is(innerWidth, 110, "initial width should be 110px");
is(innerWidth, expectedInnerWidth, "inner width should be as expected");
is(outerWidth, 110, "device's outerWidth should be 110px");
is(outerHeight, 500, "device's outerHeight should be 500px");
isnot(
@ -107,15 +123,24 @@ async function checkScreenProps(ui) {
}
async function checkScreenProps2(ui) {
const { matchesMedia, screen } = await grabContentInfo(ui);
ok(!matchesMedia, "media query should be re-evaluated.");
is(
const { screen } = await grabContentInfo(ui);
isnot(
window.screen.width,
screen.width,
"screen.width should be the size of the screen."
"screen.width should not be the size of the screen."
);
}
async function checkSubframeProps(ui) {
const { outerWidth, matchesMedia, screen } = await grabContentSubframeInfo(
ui
);
is(outerWidth, 90, "subframe outerWidth should be 90px");
ok(matchesMedia, "subframe media query should match");
is(screen.width, 90, "subframe screen.width should be the page width");
is(screen.height, 500, "subframe screen.height should be the page height");
}
function grabContentInfo(ui) {
return ContentTask.spawn(ui.getViewportBrowser(), {}, async function() {
return {
@ -130,3 +155,20 @@ function grabContentInfo(ui) {
};
});
}
function grabContentSubframeInfo(ui) {
return ContentTask.spawn(ui.getViewportBrowser(), {}, async function() {
const subframe = content.document.getElementById("subframe");
const win = subframe.contentWindow;
return {
screen: {
width: win.screen.width,
height: win.screen.height,
},
innerWidth: win.innerWidth,
matchesMedia: win.matchMedia("(max-device-width:100px)").matches,
outerHeight: win.outerHeight,
outerWidth: win.outerWidth,
};
});
}

Просмотреть файл

@ -728,24 +728,24 @@ async function testViewportZoomWidthAndHeight(
}
if (typeof width !== "undefined" || typeof height !== "undefined") {
const layoutSize = await spawnViewportTask(ui, {}, function() {
const innerSize = await spawnViewportTask(ui, {}, function() {
return {
width: content.screen.width,
height: content.screen.height,
width: content.innerWidth,
height: content.innerHeight,
};
});
if (typeof width !== "undefined") {
is(
layoutSize.width,
innerSize.width,
width,
message + " should have expected layout width."
message + " should have expected inner width."
);
}
if (typeof height !== "undefined") {
is(
layoutSize.height,
innerSize.height,
height,
message + " should have expected layout height."
message + " should have expected inner height."
);
}
}

Просмотреть файл

@ -7,7 +7,6 @@
DIRS += [
'content',
'modules',
'preferences',
'themes',
]

Просмотреть файл

@ -1,9 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JS_PREFERENCE_FILES += [
'webide.js',
]

Просмотреть файл

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("devtools.webide.templatesURL", "https://code.cdn.mozilla.net/templates/list.json");
pref("devtools.webide.autoinstallADBExtension", true);
pref("devtools.webide.autoConnectRuntime", true);
pref("devtools.webide.restoreLastProject", true);
pref("devtools.webide.enableLocalRuntime", false);
pref("devtools.webide.lastConnectedRuntime", "");
pref("devtools.webide.lastSelectedProject", "");
pref("devtools.webide.zoom", "1");
pref("devtools.webide.busyTimeout", 10000);

Просмотреть файл

@ -68,19 +68,12 @@ These APIs are very similar for each preference type.
## Create a new preference
To create a new preference, it should be assigned a default value. Default preferences are
defined in preferences files such as:
- devtools/client/preferences/devtools-client.js
- devtools/client/preferences/debugger.js
- devtools/shared/preferences/devtools-shared.js
- devtools/startup/preferences/devtools-startup.js
Most new preferences should go in devtools/client/preferences/devtools-client.js. Debugger
specific preferences should go in devtools/client/preferences/debugger.js. If a preference
should be available even when the client for DevTools is not shipped (for instance on
Fennec) the preference should go to devtools/shared/preferences/devtools-shared.js.
Finally if a preference needs to be available very early during the Firefox startup
sequence, it should go in devtools/startup/preferences/devtools-startup.js.
Debugger-specific preferences should go in
devtools/client/preferences/debugger.js. Beyond that, most new preferences
should go in browser/app/profile/firefox.js, which is for desktop Firefox only.
If a preference should be available even when the client for DevTools is not
shipped (for instance on Fennec) it should go in modules/libpref/init/all.js,
which is for preferences that go in all products.
### Projects using Launchpad

Просмотреть файл

@ -1,4 +0,0 @@
# How is devtools-shared loaded?
This preference file is included via modules/libpref/greprefs.js which guarantees it will
be loaded on all distributions, including xpcshell binary.

Просмотреть файл

@ -1,73 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Tells if DevTools have been explicitely enabled by the user.
// This pref allows to disable all features related to DevTools
// for users that never use them.
// Until bug 1361080 lands, we always consider them enabled.
pref("devtools.enabled", true);
// Enable deprecation warnings.
pref("devtools.errorconsole.deprecation_warnings", true);
#ifdef NIGHTLY_BUILD
// Don't show the Browser Toolbox prompt on local builds / nightly
pref("devtools.debugger.prompt-connection", false, sticky);
#else
pref("devtools.debugger.prompt-connection", true, sticky);
#endif
#ifdef MOZILLA_OFFICIAL
// Disable debugging chrome
pref("devtools.chrome.enabled", false, sticky);
// Disable remote debugging connections
pref("devtools.debugger.remote-enabled", false, sticky);
#else
// In local builds, enable the browser toolbox by default
pref("devtools.chrome.enabled", true, sticky);
pref("devtools.debugger.remote-enabled", true, sticky);
#endif
// Disable remote debugging protocol logging
pref("devtools.debugger.log", false);
pref("devtools.debugger.log.verbose", false);
pref("devtools.debugger.remote-port", 6000);
pref("devtools.debugger.remote-websocket", false);
// Force debugger server binding on the loopback interface
pref("devtools.debugger.force-local", true);
// Limit for intercepted request and response bodies (1 MB)
// Possible values:
// 0 => the response body has no limit
// n => represents max number of bytes stored
pref("devtools.netmonitor.responseBodyLimit", 1048576);
pref("devtools.netmonitor.requestBodyLimit", 1048576);
// Limit for WebSocket frames (100 KB)
pref("devtools.netmonitor.ws.messageDataLimit", 100000);
// DevTools default color unit
pref("devtools.defaultColorUnit", "authored");
// Used for devtools debugging
pref("devtools.dump.emit", false);
// Disable device discovery logging
pref("devtools.discovery.log", false);
// Whether to scan for DevTools devices via WiFi
pref("devtools.remote.wifi.scan", true);
// Client must complete TLS handshake within this window (ms)
pref("devtools.remote.tls-handshake-timeout", 10000);
// The extension ID for devtools-adb-extension
pref("devtools.remote.adb.extensionID", "adb@mozilla.org");
// The URL for for devtools-adb-extension (overridden in tests to a local path)
pref("devtools.remote.adb.extensionURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/devtools/adb-extension/#OS#/adb-extension-latest-#OS#.xpi");
// URL of the remote JSON catalog used for device simulation
pref("devtools.devices.url", "https://code.cdn.mozilla.net/devices/devices.json");
// Enable Inactive CSS detection; used both by the client and the server.
pref("devtools.inspector.inactive.css.enabled", true);

Просмотреть файл

@ -6,10 +6,6 @@
JAR_MANIFESTS += ['jar.mn']
DIRS += [
'preferences',
]
# Register the startup components only for 'all' builds.
if CONFIG['MOZ_DEVTOOLS'] == 'all':
EXTRA_JS_MODULES += [

Просмотреть файл

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// The preferences defined here should be used by the components in devtools-startup.
// devtools-startup is always shipped and those preferences will always be available.
// Enable the JSON View tool (an inspector for application/json documents).
pref("devtools.jsonview.enabled", true);
// Default theme ("dark" or "light")
#ifdef MOZ_DEV_EDITION
pref("devtools.theme", "dark", sticky);
#else
pref("devtools.theme", "light", sticky);
#endif
// Completely disable DevTools entry points, as well as all DevTools command line
// arguments This should be merged with devtools.enabled, see Bug 1440675.
pref("devtools.policy.disabled", false);

Просмотреть файл

@ -1,9 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JS_PREFERENCE_PP_FILES += [
'devtools-startup.js'
]

Просмотреть файл

@ -3574,23 +3574,13 @@ nsIntSize nsGlobalWindowOuter::GetOuterSize(CallerType aCallerType,
return nsIntSize(size.width, size.height);
}
if (mDoc && mDoc->InRDMPane()) {
CSSIntSize size;
aError = GetInnerSize(size);
// Obtain the current zoom of the presentation shell. The zoom value will
// be used to scale the size of the visual viewport to the device browser's
// outer size values. Once RDM no longer relies on the having the page
// content being embedded in a <iframe mozbrowser>, we can do away with
// this approach and retrieve the size of the frame containing the browser
// content.
RefPtr<nsPresContext> presContext = mDocShell->GetPresContext();
if (presContext) {
float zoom = presContext->GetDeviceFullZoom();
int32_t width = std::round(size.width * zoom);
int32_t height = std::round(size.height * zoom);
return nsIntSize(width, height);
// Windows showing documents in RDM panes and any subframes within them
// return the simulated device size.
if (mDoc) {
Maybe<CSSIntSize> deviceSize = GetRDMDeviceSize(*mDoc);
if (deviceSize.isSome()) {
const CSSIntSize& size = deviceSize.value();
return nsIntSize(size.width, size.height);
}
}
@ -3732,6 +3722,31 @@ nsRect nsGlobalWindowOuter::GetInnerScreenRect() {
return rootFrame->GetScreenRectInAppUnits();
}
Maybe<CSSIntSize> nsGlobalWindowOuter::GetRDMDeviceSize(
const Document& aDocument) {
// RDM device size should reflect the simulated device resolution, and
// be independent of any full zoom or resolution zoom applied to the
// content. To get this value, we get the unscaled browser child size.
MOZ_RELEASE_ASSERT(NS_IsMainThread());
Maybe<CSSIntSize> deviceSize;
// Bug 1576256: This does not work for cross-process subframes.
const Document* topInProcessContentDoc =
aDocument.GetTopLevelContentDocument();
if (topInProcessContentDoc && topInProcessContentDoc->InRDMPane()) {
nsIDocShell* docShell = topInProcessContentDoc->GetDocShell();
if (docShell) {
nsCOMPtr<nsIBrowserChild> child = docShell->GetBrowserChild();
if (child) {
BrowserChild* bc = static_cast<BrowserChild*>(child.get());
deviceSize = Some(bc->GetUnscaledInnerSize());
}
}
}
return deviceSize;
}
float nsGlobalWindowOuter::GetMozInnerScreenXOuter(CallerType aCallerType) {
// When resisting fingerprinting, always return 0.
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
@ -4037,7 +4052,8 @@ already_AddRefed<BrowsingContext> nsGlobalWindowOuter::GetChildWindow(
const nsAString& aName) {
NS_ENSURE_TRUE(mBrowsingContext, nullptr);
return do_AddRef(mBrowsingContext->FindChildWithName(aName, *mBrowsingContext));
return do_AddRef(
mBrowsingContext->FindChildWithName(aName, *mBrowsingContext));
}
bool nsGlobalWindowOuter::DispatchCustomEvent(const nsAString& aEventName) {

Просмотреть файл

@ -888,6 +888,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
nsRect GetInnerScreenRect();
static Maybe<mozilla::CSSIntSize> GetRDMDeviceSize(const Document& aDocument);
bool IsFrame();

Просмотреть файл

@ -279,7 +279,7 @@ interface nsIDocumentEncoder : nsISupports
/**
* Set a wrap column. This may have no effect in some types of encoders.
* @param aWrapColumn Column to which to wrap.
* @param aWrapColumn Column to which to wrap. If 0, wrapping is disabled.
*/
void setWrapColumn(in unsigned long aWrapColumn);

Просмотреть файл

@ -54,6 +54,8 @@ static const int32_t kIndentSizeDD = kTabSize; // Indention of <dd>
static const char16_t kNBSP = 160;
static const char16_t kSPACE = ' ';
constexpr int32_t kNoFlags = 0;
static int32_t HeaderLevel(nsAtom* aTag);
static int32_t GetUnicharWidth(char16_t ucs);
static int32_t GetUnicharStringWidth(const char16_t* pwcs, int32_t n);
@ -81,8 +83,46 @@ nsresult NS_NewPlainTextSerializer(nsIContentSerializer** aSerializer) {
return NS_OK;
}
// @param aFlags As defined in nsIDocumentEncoder.idl.
static void DetermineLineBreak(const int32_t aFlags, nsAString& aLineBreak) {
// Set the line break character:
if ((aFlags & nsIDocumentEncoder::OutputCRLineBreak) &&
(aFlags & nsIDocumentEncoder::OutputLFLineBreak)) {
// Windows
aLineBreak.AssignLiteral(u"\r\n");
} else if (aFlags & nsIDocumentEncoder::OutputCRLineBreak) {
// Mac
aLineBreak.AssignLiteral(u"\r");
} else if (aFlags & nsIDocumentEncoder::OutputLFLineBreak) {
// Unix/DOM
aLineBreak.AssignLiteral(u"\n");
} else {
// Platform/default
aLineBreak.AssignLiteral(NS_ULINEBREAK);
}
}
nsPlainTextSerializer::CurrentLineContent::CurrentLineContent(
const int32_t aFlags)
: mFlags(aFlags) {
DetermineLineBreak(mFlags, mLineBreak);
}
void nsPlainTextSerializer::CurrentLineContent::MaybeReplaceNbsps() {
if (!(mFlags & nsIDocumentEncoder::OutputPersistNBSP)) {
// First, replace all nbsp characters with spaces,
// which the unicode encoder won't do for us.
mValue.ReplaceChar(kNBSP, kSPACE);
}
}
void nsPlainTextSerializer::CurrentLineContent::AppendLineBreak() {
mValue.Append(mLineBreak);
}
nsPlainTextSerializer::nsPlainTextSerializer()
: mFloatingLines(-1),
: mCurrentLineContent{kNoFlags},
mFloatingLines(-1),
mLineBreakDue(false),
kSpace(NS_LITERAL_STRING(" ")) // Init of "constant"
{
@ -136,7 +176,7 @@ nsPlainTextSerializer::~nsPlainTextSerializer() {
}
NS_IMETHODIMP
nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
nsPlainTextSerializer::Init(const uint32_t aFlags, uint32_t aWrapColumn,
const Encoding* aEncoding, bool aIsCopying,
bool aIsWholeDocument,
bool* aNeedsPreformatScanning) {
@ -164,22 +204,6 @@ nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
mLineBreaker = nsContentUtils::LineBreaker();
}
// Set the line break character:
if ((mSettings.mFlags & nsIDocumentEncoder::OutputCRLineBreak) &&
(mSettings.mFlags & nsIDocumentEncoder::OutputLFLineBreak)) {
// Windows
mLineBreak.AssignLiteral("\r\n");
} else if (mSettings.mFlags & nsIDocumentEncoder::OutputCRLineBreak) {
// Mac
mLineBreak.Assign(char16_t('\r'));
} else if (mSettings.mFlags & nsIDocumentEncoder::OutputLFLineBreak) {
// Unix/DOM
mLineBreak.Assign(char16_t('\n'));
} else {
// Platform/default
mLineBreak.AssignLiteral(NS_LINEBREAK);
}
mLineBreakDue = false;
mFloatingLines = -1;
@ -203,6 +227,8 @@ nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
// XXX We should let the caller decide whether to do this or not
mSettings.mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
mCurrentLineContent = CurrentLineContent{mSettings.mFlags};
return NS_OK;
}
@ -317,7 +343,7 @@ nsPlainTextSerializer::AppendText(nsIContent* aText, int32_t aStartOffset,
}
// Pass in a newline
DoAddText(true, mLineBreak);
DoAddText();
start = offset + 1;
offset = textstr.FindCharInSet("\n\r", start);
@ -951,6 +977,8 @@ bool nsPlainTextSerializer::MustSuppressLeaf() {
return false;
}
void nsPlainTextSerializer::DoAddText() { DoAddText(true, EmptyString()); }
void nsPlainTextSerializer::DoAddText(bool aIsLineBreak,
const nsAString& aText) {
// If we don't want any output, just return
@ -1092,23 +1120,14 @@ void nsPlainTextSerializer::FlushLine() {
OutputQuotesAndIndent(); // XXX: Should we always do this? Bug?
}
MaybeReplaceNbspsForOutput(mCurrentLineContent.mValue);
mCurrentLineContent.MaybeReplaceNbsps();
Output(mCurrentLineContent.mValue);
mAtFirstColumn = mAtFirstColumn && mCurrentLineContent.mValue.IsEmpty();
mAtFirstColumn = false;
mCurrentLineContent.mValue.Truncate();
mCurrentLineContent.mWidth = 0;
}
}
void nsPlainTextSerializer::MaybeReplaceNbspsForOutput(
nsString& aString) const {
if (!(mSettings.mFlags & nsIDocumentEncoder::OutputPersistNBSP)) {
// First, replace all nbsp characters with spaces,
// which the unicode encoder won't do for us.
aString.ReplaceChar(kNBSP, kSPACE);
}
}
void nsPlainTextSerializer::Output(nsString& aString) {
mOutputString->Append(aString);
}
@ -1361,8 +1380,8 @@ void nsPlainTextSerializer::EndLine(bool aSoftlinebreak, bool aBreakBySpace) {
OutputQuotesAndIndent(stripTrailingSpaces);
}
mCurrentLineContent.mValue.Append(mLineBreak);
MaybeReplaceNbspsForOutput(mCurrentLineContent.mValue);
mCurrentLineContent.MaybeReplaceNbsps();
mCurrentLineContent.AppendLineBreak();
Output(mCurrentLineContent.mValue);
mCurrentLineContent.mValue.Truncate();
mCurrentLineContent.mWidth = 0;
@ -1396,7 +1415,6 @@ void nsPlainTextSerializer::OutputQuotesAndIndent(
quotes.Append(char16_t(' '));
}
stringToOutput = quotes;
mAtFirstColumn = false;
}
// Indent if necessary
@ -1408,12 +1426,10 @@ void nsPlainTextSerializer::OutputQuotesAndIndent(
nsAutoString spaces;
for (int i = 0; i < indentwidth; ++i) spaces.Append(char16_t(' '));
stringToOutput += spaces;
mAtFirstColumn = false;
}
if (!mInIndentString.IsEmpty()) {
stringToOutput += mInIndentString;
mAtFirstColumn = false;
mInIndentString.Truncate();
}
@ -1427,6 +1443,7 @@ void nsPlainTextSerializer::OutputQuotesAndIndent(
if (!stringToOutput.IsEmpty()) {
Output(stringToOutput);
mAtFirstColumn = false;
}
}
@ -1559,11 +1576,12 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
OutputQuotesAndIndent();
}
MaybeReplaceNbspsForOutput(mCurrentLineContent.mValue);
Output(mCurrentLineContent.mValue);
mCurrentLineContent.MaybeReplaceNbsps();
if (outputLineBreak) {
Output(mLineBreak);
mCurrentLineContent.AppendLineBreak();
}
Output(mCurrentLineContent.mValue);
mAtFirstColumn = atFirstColumn;
}

Просмотреть файл

@ -89,8 +89,6 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
void FlushLine();
void OutputQuotesAndIndent(bool stripTrailingSpaces = false);
void MaybeReplaceNbspsForOutput(nsString& aString) const;
void Output(nsString& aString);
void Write(const nsAString& aString);
@ -110,15 +108,18 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
nsresult DoOpenContainer(nsAtom* aTag);
nsresult DoCloseContainer(nsAtom* aTag);
nsresult DoAddLeaf(nsAtom* aTag);
void DoAddText(bool aIsWhitespace, const nsAString& aText);
void DoAddText();
// @param aText Ignored if aIsLineBreak is true.
void DoAddText(bool aIsLineBreak, const nsAString& aText);
// Inlined functions
inline bool MayWrap() {
inline bool MayWrap() const {
return mWrapColumn &&
((mSettings.mFlags & nsIDocumentEncoder::OutputFormatted) ||
(mSettings.mFlags & nsIDocumentEncoder::OutputWrap));
}
inline bool MayBreakLines() {
inline bool MayBreakLines() const {
return !(mSettings.mFlags & nsIDocumentEncoder::OutputDisallowLineBreaking);
}
@ -168,12 +169,26 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
Settings mSettings;
struct CurrentLineContent {
// Excludes indentation and quotes.
// Excludes indentation and quotes.
class CurrentLineContent {
public:
// @param aFlags As defined in nsIDocumentEncoder.idl.
explicit CurrentLineContent(int32_t aFlags);
void MaybeReplaceNbsps();
void AppendLineBreak();
nsString mValue;
// The width of the line as it will appear on the screen (approx.).
uint32_t mWidth = 0;
private:
// As defined in nsIDocumentEncoder.idl.
int32_t mFlags;
nsString mLineBreak;
};
CurrentLineContent mCurrentLineContent;
@ -253,7 +268,6 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
uint32_t mULCount;
nsString mLineBreak;
RefPtr<mozilla::intl::LineBreaker> mLineBreaker;
// Conveniance constant. It would be nice to have it as a const static

Просмотреть файл

@ -86,6 +86,22 @@ nsresult nsScreen::GetRect(nsRect& aRect) {
return GetWindowInnerRect(aRect);
}
// Here we manipulate the value of aRect to represent the screen size,
// if in RDM.
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (owner) {
mozilla::dom::Document* doc = owner->GetExtantDoc();
if (doc) {
Maybe<mozilla::CSSIntSize> deviceSize =
nsGlobalWindowOuter::GetRDMDeviceSize(*doc);
if (deviceSize.isSome()) {
const mozilla::CSSIntSize& size = deviceSize.value();
aRect.SetRect(0, 0, size.width, size.height);
return NS_OK;
}
}
}
nsDeviceContext* context = GetDeviceContext();
if (!context) {
@ -113,10 +129,20 @@ nsresult nsScreen::GetAvailRect(nsRect& aRect) {
return GetWindowInnerRect(aRect);
}
// Here we manipulate the value of aRect to represent the screen avail size,
// Here we manipulate the value of aRect to represent the screen size,
// if in RDM.
if (IsInRDMPane()) {
return GetRDMScreenSize(aRect);
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (owner) {
mozilla::dom::Document* doc = owner->GetExtantDoc();
if (doc) {
Maybe<mozilla::CSSIntSize> deviceSize =
nsGlobalWindowOuter::GetRDMDeviceSize(*doc);
if (deviceSize.isSome()) {
const mozilla::CSSIntSize& size = deviceSize.value();
aRect.SetRect(0, 0, size.width, size.height);
return NS_OK;
}
}
}
nsDeviceContext* context = GetDeviceContext();
@ -145,29 +171,6 @@ nsresult nsScreen::GetAvailRect(nsRect& aRect) {
return NS_OK;
}
nsresult nsScreen::GetRDMScreenSize(nsRect& aRect) {
GetWindowInnerRect(aRect);
// GetOwner(), GetDocShell(), and GetPresContext() can potentially return
// nullptr, so to be safe let's make sure we check these before proceeding.
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (owner) {
nsIDocShell* docShell = owner->GetDocShell();
if (docShell) {
RefPtr<nsPresContext> presContext = docShell->GetPresContext();
if (presContext) {
float zoom = presContext->GetDeviceFullZoom();
int32_t width = std::round(aRect.Width() * zoom);
int32_t height = std::round(aRect.Height() * zoom);
aRect.SetHeight(height);
aRect.SetWidth(width);
return NS_OK;
}
}
}
return NS_ERROR_FAILURE;
}
mozilla::dom::ScreenOrientation* nsScreen::Orientation() const {
return mScreenOrientation;
}
@ -281,16 +284,6 @@ void nsScreen::MozUnlockOrientation() {
mScreenOrientation->UnlockDeviceOrientation();
}
bool nsScreen::IsDeviceSizePageSize() {
if (nsPIDOMWindowInner* owner = GetOwner()) {
nsIDocShell* docShell = owner->GetDocShell();
if (docShell) {
return docShell->GetDeviceSizeIsPageSize();
}
}
return false;
}
/* virtual */
JSObject* nsScreen::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
@ -317,15 +310,3 @@ bool nsScreen::ShouldResistFingerprinting() const {
}
return resist;
}
bool nsScreen::IsInRDMPane() const {
bool isInRDM = false;
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (owner) {
Document* doc = owner->GetExtantDoc();
isInRDM = doc && doc->InRDMPane();
}
return isInRDM;
}

Просмотреть файл

@ -47,38 +47,12 @@ class nsScreen : public mozilla::DOMEventTargetHelper {
int32_t GetWidth(ErrorResult& aRv) {
nsRect rect;
if (IsDeviceSizePageSize()) {
if (IsInRDMPane()) {
GetRDMScreenSize(rect);
return rect.Width();
}
if (nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner()) {
int32_t innerWidth = 0;
aRv = owner->GetInnerWidth(&innerWidth);
return innerWidth;
}
}
aRv = GetRect(rect);
return rect.Width();
}
int32_t GetHeight(ErrorResult& aRv) {
nsRect rect;
if (IsDeviceSizePageSize()) {
if (IsInRDMPane()) {
GetRDMScreenSize(rect);
return rect.Height();
}
if (nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner()) {
int32_t innerHeight = 0;
aRv = owner->GetInnerHeight(&innerHeight);
return innerHeight;
}
}
aRv = GetRect(rect);
return rect.Height();
}
@ -146,17 +120,14 @@ class nsScreen : public mozilla::DOMEventTargetHelper {
nsresult GetRect(nsRect& aRect);
nsresult GetAvailRect(nsRect& aRect);
nsresult GetWindowInnerRect(nsRect& aRect);
nsresult GetRDMScreenSize(nsRect& aRect);
private:
explicit nsScreen(nsPIDOMWindowInner* aWindow);
virtual ~nsScreen();
bool IsDeviceSizePageSize();
bool ShouldResistFingerprinting() const;
bool IsInRDMPane() const;
mozilla::dom::Document* TopContentDocumentInRDMPane() const;
RefPtr<mozilla::dom::ScreenOrientation> mScreenOrientation;
};

Просмотреть файл

@ -0,0 +1,8 @@
function handleRequest(request, response)
{
response.setStatusLine("1.1", 500, "Internal Server Error");
response.setHeader("Content-Type", "image/svg+xml", false);
let body = "<svg xmlns='http://www.w3.org/2000/svg' width='70' height='0'></svg>";
response.bodyOutputStream.write(body, body.length);
}

Двоичные данные
dom/base/test/green.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 255 B

Просмотреть файл

@ -52,6 +52,7 @@ support-files =
bug704320.sjs
bug704320_counter.sjs
bug819051.sjs
bug1576154.sjs
chrome/bug418986-1.js
copypaste.js
delayedServerEvents.sjs
@ -244,6 +245,7 @@ support-files =
!/dom/animation/test/testcommon.js
!/dom/events/test/event_leak_utils.js
../../../browser/extensions/pdfjs/test/file_pdfjs_test.pdf
green.png
[test_anchor_area_referrer.html]
[test_anchor_area_referrer_changing.html]
@ -634,6 +636,7 @@ skip-if = os == "mac" # Different tab focus behavior on mac
[test_bug1472427.html]
[test_bug1499169.html]
skip-if = toolkit == 'android' # Timeouts on android due to page closing issues with embedded pdf
[test_bug1576154.html]
[test_caretPositionFromPoint.html]
[test_change_policy.html]
[test_clearTimeoutIntervalNoArg.html]

Просмотреть файл

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1576154
-->
<head>
<title>Test for Bug 1576154</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1576154">Mozilla Bug 1576154</a>
<p id="display"></p>
<!-- bug1576154.sjs returns an SVG image with HTTP error code 500. -->
<img src="bug1576154.sjs">
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 657191 **/
SimpleTest.waitForExplicitFinish();
window.onload = function() {
let img = document.querySelector("img");
img.src = "green.png";
img.onload = function() {
// As long as this doesn't crash, this test passes.
ok(true, "test passed");
SimpleTest.finish();
};
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -546,6 +546,7 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
bool AsyncPanZoomEnabled() const;
ScreenIntSize GetInnerSize();
CSSIntSize GetUnscaledInnerSize() { return RoundedToInt(mUnscaledInnerSize); }
Maybe<LayoutDeviceIntRect> GetVisibleRect() const;

Просмотреть файл

@ -4071,8 +4071,9 @@ nsresult HTMLEditRules::MakeList(nsAtom& aListType, bool aEntireList,
}
SplitNodeResult splitAtSelectionStartResult =
MaybeSplitAncestorsForInsertWithTransaction(aListType,
atStartOfSelection);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(aListType,
atStartOfSelection);
if (NS_WARN_IF(splitAtSelectionStartResult.Failed())) {
return splitAtSelectionStartResult.Rv();
}
@ -4356,7 +4357,9 @@ nsresult HTMLEditRules::MakeList(nsAtom& aListType, bool aEntireList,
// need to make a list to put things in if we haven't already,
if (!curList) {
SplitNodeResult splitCurNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(aListType, atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(aListType,
atCurNode);
if (NS_WARN_IF(splitCurNodeResult.Failed())) {
return splitCurNodeResult.Rv();
}
@ -4670,8 +4673,9 @@ nsresult HTMLEditRules::MakeBasicBlock(nsAtom& blockType) {
}
// Make sure we can put a block here.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(blockType,
pointToInsertBlock);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(blockType,
pointToInsertBlock);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -4714,18 +4718,21 @@ nsresult HTMLEditRules::MakeBasicBlock(nsAtom& blockType) {
// whatever is approriate. Woohoo! Note: blockquote is handled a little
// differently.
if (&blockType == nsGkAtoms::blockquote) {
rv = MakeBlockquote(arrayOfNodes);
rv = MOZ_KnownLive(HTMLEditorRef())
.MoveNodesIntoNewBlockquoteElement(arrayOfNodes);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else if (&blockType == nsGkAtoms::normal ||
&blockType == nsGkAtoms::_empty) {
rv = RemoveBlockStyle(arrayOfNodes);
rv = MOZ_KnownLive(HTMLEditorRef())
.RemoveBlockContainerElements(arrayOfNodes);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else {
rv = ApplyBlockStyle(arrayOfNodes, blockType);
rv = MOZ_KnownLive(HTMLEditorRef())
.CreateOrChangeBlockContainerElement(arrayOfNodes, blockType);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -4866,8 +4873,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithCSS() {
// make sure we can put a block here
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -4989,8 +4997,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithCSS() {
atCurNode.GetContainer()->NodeInfo()->NameAtom();
// Create a new nested list of correct type.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5042,8 +5051,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithCSS() {
}
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5159,8 +5169,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
// Make sure we can put a block here.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
atStartOfSelection);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
atStartOfSelection);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5275,8 +5286,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
atCurNode.GetContainer()->NodeInfo()->NameAtom();
// Create a new nested list of correct type.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5339,8 +5351,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
atListItem.GetContainer()->NodeInfo()->NameAtom();
// Create a new nested list of correct type.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atListItem);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atListItem);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5386,8 +5399,9 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
}
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
*nsGkAtoms::blockquote, atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -5810,10 +5824,10 @@ SplitRangeOffFromNodeResult HTMLEditRules::OutdentAroundSelection() {
}
SplitRangeOffFromNodeResult
HTMLEditRules::SplitRangeOffFromBlockAndRemoveMiddleContainer(
HTMLEditor::SplitRangeOffFromBlockAndRemoveMiddleContainer(
Element& aBlockElement, nsIContent& aStartOfRange,
nsIContent& aEndOfRange) {
MOZ_ASSERT(IsEditorDataAvailable());
MOZ_ASSERT(IsEditActionDataAvailable());
SplitRangeOffFromNodeResult splitResult =
SplitRangeOffFromBlock(aBlockElement, aStartOfRange, aEndOfRange);
@ -5822,9 +5836,8 @@ HTMLEditRules::SplitRangeOffFromBlockAndRemoveMiddleContainer(
}
NS_WARNING_ASSERTION(splitResult.Succeeded(),
"Failed to split the range off from the block element");
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
.RemoveBlockContainerWithTransaction(aBlockElement);
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = RemoveBlockContainerWithTransaction(aBlockElement);
if (NS_WARN_IF(Destroyed())) {
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -5834,10 +5847,10 @@ HTMLEditRules::SplitRangeOffFromBlockAndRemoveMiddleContainer(
splitResult.GetRightContent());
}
SplitRangeOffFromNodeResult HTMLEditRules::SplitRangeOffFromBlock(
SplitRangeOffFromNodeResult HTMLEditor::SplitRangeOffFromBlock(
Element& aBlockElement, nsIContent& aStartOfMiddleElement,
nsIContent& aEndOfMiddleElement) {
MOZ_ASSERT(IsEditorDataAvailable());
MOZ_ASSERT(IsEditActionDataAvailable());
// aStartOfMiddleElement and aEndOfMiddleElement must be exclusive
// descendants of aBlockElement.
@ -5845,12 +5858,10 @@ SplitRangeOffFromNodeResult HTMLEditRules::SplitRangeOffFromBlock(
MOZ_ASSERT(EditorUtils::IsDescendantOf(aEndOfMiddleElement, aBlockElement));
// Split at the start.
SplitNodeResult splitAtStartResult =
MOZ_KnownLive(HTMLEditorRef())
.SplitNodeDeepWithTransaction(
aBlockElement, EditorDOMPoint(&aStartOfMiddleElement),
SplitAtEdges::eDoNotCreateEmptyContainer);
if (NS_WARN_IF(!CanHandleEditAction())) {
SplitNodeResult splitAtStartResult = SplitNodeDeepWithTransaction(
aBlockElement, EditorDOMPoint(&aStartOfMiddleElement),
SplitAtEdges::eDoNotCreateEmptyContainer);
if (NS_WARN_IF(Destroyed())) {
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
NS_WARNING_ASSERTION(splitAtStartResult.Succeeded(),
@ -5860,12 +5871,9 @@ SplitRangeOffFromNodeResult HTMLEditRules::SplitRangeOffFromBlock(
EditorDOMPoint atAfterEnd(&aEndOfMiddleElement);
DebugOnly<bool> advanced = atAfterEnd.AdvanceOffset();
NS_WARNING_ASSERTION(advanced, "Failed to advance offset after the end node");
SplitNodeResult splitAtEndResult =
MOZ_KnownLive(HTMLEditorRef())
.SplitNodeDeepWithTransaction(
aBlockElement, atAfterEnd,
SplitAtEdges::eDoNotCreateEmptyContainer);
if (NS_WARN_IF(!CanHandleEditAction())) {
SplitNodeResult splitAtEndResult = SplitNodeDeepWithTransaction(
aBlockElement, atAfterEnd, SplitAtEdges::eDoNotCreateEmptyContainer);
if (NS_WARN_IF(Destroyed())) {
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
NS_WARNING_ASSERTION(splitAtEndResult.Succeeded(),
@ -5880,7 +5888,9 @@ SplitRangeOffFromNodeResult HTMLEditRules::OutdentPartOfBlock(
MOZ_ASSERT(IsEditorDataAvailable());
SplitRangeOffFromNodeResult splitResult =
SplitRangeOffFromBlock(aBlockElement, aStartOfOutdent, aEndOfOutdent);
MOZ_KnownLive(HTMLEditorRef())
.SplitRangeOffFromBlock(aBlockElement, aStartOfOutdent,
aEndOfOutdent);
if (NS_WARN_IF(splitResult.Rv() == NS_ERROR_EDITOR_DESTROYED)) {
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
@ -6210,8 +6220,9 @@ nsresult HTMLEditRules::AlignContentsAtSelection(const nsAString& aAlignType) {
}
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -6381,8 +6392,9 @@ nsresult HTMLEditRules::AlignContentsAtSelection(const nsAString& aAlignType) {
}
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -8684,9 +8696,9 @@ nsresult HTMLEditRules::ReturnInListItem(Element& aListItem, nsINode& aNode,
return NS_OK;
}
nsresult HTMLEditRules::MakeBlockquote(
nsresult HTMLEditor::MoveNodesIntoNewBlockquoteElement(
nsTArray<OwningNonNull<nsINode>>& aNodeArray) {
MOZ_ASSERT(IsEditorDataAvailable());
MOZ_ASSERT(IsTopLevelEditSubActionDataAvailable());
// The idea here is to put the nodes into a minimal number of blockquotes.
// When the user blockquotes something, they expect one blockquote. That
@ -8709,7 +8721,7 @@ nsresult HTMLEditRules::MakeBlockquote(
// Recursion time
AutoTArray<OwningNonNull<nsINode>, 24> childNodes;
HTMLEditor::GetChildNodesOf(*curNode, childNodes);
nsresult rv = MakeBlockquote(childNodes);
nsresult rv = MoveNodesIntoNewBlockquoteElement(childNodes);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -8735,25 +8747,25 @@ nsresult HTMLEditRules::MakeBlockquote(
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
curBlock = MOZ_KnownLive(HTMLEditorRef())
.CreateNodeWithTransaction(*nsGkAtoms::blockquote,
splitNodeResult.SplitPoint());
if (NS_WARN_IF(!CanHandleEditAction())) {
// XXX Perhaps, we should insert the new `<blockquote>` element after
// moving all nodes into it since the movement does not cause
// running mutation event listeners.
curBlock = CreateNodeWithTransaction(*nsGkAtoms::blockquote,
splitNodeResult.SplitPoint());
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(!curBlock)) {
return NS_ERROR_FAILURE;
}
// remember our new block for postprocessing
HTMLEditorRef().TopLevelEditSubActionDataRef().mNewBlockElement =
curBlock;
TopLevelEditSubActionDataRef().mNewBlockElement = curBlock;
// note: doesn't matter if we set mNewBlockElement multiple times.
}
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
.MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -8763,9 +8775,9 @@ nsresult HTMLEditRules::MakeBlockquote(
return NS_OK;
}
nsresult HTMLEditRules::RemoveBlockStyle(
nsresult HTMLEditor::RemoveBlockContainerElements(
nsTArray<OwningNonNull<nsINode>>& aNodeArray) {
MOZ_ASSERT(IsEditorDataAvailable());
MOZ_ASSERT(IsEditActionDataAvailable());
// Intent of this routine is to be used for converting to/from headers,
// paragraphs, pre, and address. Those blocks that pretty much just contain
@ -8785,14 +8797,13 @@ nsresult HTMLEditRules::RemoveBlockStyle(
}
firstNode = lastNode = curBlock = nullptr;
}
if (!HTMLEditorRef().IsEditable(curNode)) {
if (!IsEditable(curNode)) {
continue;
}
// Remove current block
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
.RemoveBlockContainerWithTransaction(
MOZ_KnownLive(*curNode->AsElement()));
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = RemoveBlockContainerWithTransaction(
MOZ_KnownLive(*curNode->AsElement()));
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -8816,13 +8827,13 @@ nsresult HTMLEditRules::RemoveBlockStyle(
}
firstNode = lastNode = curBlock = nullptr;
}
if (!HTMLEditorRef().IsEditable(curNode)) {
if (!IsEditable(curNode)) {
continue;
}
// Recursion time
AutoTArray<OwningNonNull<nsINode>, 24> childNodes;
HTMLEditor::GetChildNodesOf(*curNode, childNodes);
nsresult rv = RemoveBlockStyle(childNodes);
nsresult rv = RemoveBlockContainerElements(childNodes);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -8849,9 +8860,9 @@ nsresult HTMLEditRules::RemoveBlockStyle(
firstNode = lastNode = curBlock = nullptr;
// Fall out and handle curNode
}
curBlock = HTMLEditorRef().GetBlockNodeParent(curNode);
curBlock = GetBlockNodeParent(curNode);
if (!curBlock || !HTMLEditUtils::IsFormatNode(curBlock) ||
!HTMLEditorRef().IsEditable(curBlock)) {
!IsEditable(curBlock)) {
// Not a block kind that we care about.
curBlock = nullptr;
} else {
@ -8886,15 +8897,14 @@ nsresult HTMLEditRules::RemoveBlockStyle(
return NS_OK;
}
nsresult HTMLEditRules::ApplyBlockStyle(
nsresult HTMLEditor::CreateOrChangeBlockContainerElement(
nsTArray<OwningNonNull<nsINode>>& aNodeArray, nsAtom& aBlockTag) {
MOZ_ASSERT(IsTopLevelEditSubActionDataAvailable());
// Intent of this routine is to be used for converting to/from headers,
// paragraphs, pre, and address. Those blocks that pretty much just contain
// inline things...
MOZ_ASSERT(IsEditorDataAvailable());
nsCOMPtr<Element> newBlock;
nsCOMPtr<Element> curBlock;
for (auto& curNode : aNodeArray) {
if (NS_WARN_IF(!curNode->GetParent())) {
@ -8910,8 +8920,7 @@ nsresult HTMLEditRules::ApplyBlockStyle(
// Is it already the right kind of block, or an uneditable block?
if (curNode->IsHTMLElement(&aBlockTag) ||
(!HTMLEditorRef().IsEditable(curNode) &&
HTMLEditor::NodeIsBlockStatic(curNode))) {
(!IsEditable(curNode) && HTMLEditor::NodeIsBlockStatic(curNode))) {
// Forget any previous block used for previous inline nodes
curBlock = nullptr;
// Do nothing to this block
@ -8925,10 +8934,9 @@ nsresult HTMLEditRules::ApplyBlockStyle(
HTMLEditUtils::IsFormatNode(curNode)) {
// Forget any previous block used for previous inline nodes
curBlock = nullptr;
newBlock = MOZ_KnownLive(HTMLEditorRef())
.ReplaceContainerAndCloneAttributesWithTransaction(
MOZ_KnownLive(*curNode->AsElement()), aBlockTag);
if (NS_WARN_IF(!CanHandleEditAction())) {
newBlock = ReplaceContainerAndCloneAttributesWithTransaction(
MOZ_KnownLive(*curNode->AsElement()), aBlockTag);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(!newBlock)) {
@ -8953,7 +8961,8 @@ nsresult HTMLEditRules::ApplyBlockStyle(
AutoTArray<OwningNonNull<nsINode>, 24> childNodes;
HTMLEditor::GetChildNodesOf(*curNode, childNodes);
if (!childNodes.IsEmpty()) {
nsresult rv = ApplyBlockStyle(childNodes, aBlockTag);
nsresult rv =
CreateOrChangeBlockContainerElement(childNodes, aBlockTag);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -8975,9 +8984,8 @@ nsresult HTMLEditRules::ApplyBlockStyle(
}
EditorDOMPoint splitPoint = splitNodeResult.SplitPoint();
RefPtr<Element> theBlock =
MOZ_KnownLive(HTMLEditorRef())
.CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(!CanHandleEditAction())) {
CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(!theBlock)) {
@ -8990,8 +8998,7 @@ nsresult HTMLEditRules::ApplyBlockStyle(
return NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE;
}
// Remember our new block for postprocessing
HTMLEditorRef().TopLevelEditSubActionDataRef().mNewBlockElement =
std::move(theBlock);
TopLevelEditSubActionDataRef().mNewBlockElement = std::move(theBlock);
continue;
}
@ -9001,9 +9008,8 @@ nsresult HTMLEditRules::ApplyBlockStyle(
if (curBlock) {
// Forget any previous block used for previous inline nodes
curBlock = nullptr;
nsresult rv =
MOZ_KnownLive(HTMLEditorRef()).DeleteNodeWithTransaction(*curNode);
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = DeleteNodeWithTransaction(*curNode);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9027,9 +9033,8 @@ nsresult HTMLEditRules::ApplyBlockStyle(
return NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE;
}
EditorDOMPoint splitPoint = splitNodeResult.SplitPoint();
curBlock = MOZ_KnownLive(HTMLEditorRef())
.CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(!CanHandleEditAction())) {
curBlock = CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(!curBlock)) {
@ -9042,13 +9047,11 @@ nsresult HTMLEditRules::ApplyBlockStyle(
return NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE;
}
// Remember our new block for postprocessing
HTMLEditorRef().TopLevelEditSubActionDataRef().mNewBlockElement =
curBlock;
TopLevelEditSubActionDataRef().mNewBlockElement = curBlock;
// Note: doesn't matter if we set mNewBlockElement multiple times.
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
.MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9065,8 +9068,7 @@ nsresult HTMLEditRules::ApplyBlockStyle(
// added here if that should change
//
// If curNode is a non editable, drop it if we are going to <pre>.
if (&aBlockTag == nsGkAtoms::pre &&
!HTMLEditorRef().IsEditable(curNode)) {
if (&aBlockTag == nsGkAtoms::pre && !IsEditable(curNode)) {
// Do nothing to this block
continue;
}
@ -9086,9 +9088,8 @@ nsresult HTMLEditRules::ApplyBlockStyle(
return NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE;
}
EditorDOMPoint splitPoint = splitNodeResult.SplitPoint();
curBlock = MOZ_KnownLive(HTMLEditorRef())
.CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(!CanHandleEditAction())) {
curBlock = CreateNodeWithTransaction(aBlockTag, splitPoint);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(!curBlock)) {
@ -9106,8 +9107,7 @@ nsresult HTMLEditRules::ApplyBlockStyle(
atCurNode.Set(curNode);
// Remember our new block for postprocessing
HTMLEditorRef().TopLevelEditSubActionDataRef().mNewBlockElement =
curBlock;
TopLevelEditSubActionDataRef().mNewBlockElement = curBlock;
// Note: doesn't matter if we set mNewBlockElement multiple times.
}
@ -9120,10 +9120,9 @@ nsresult HTMLEditRules::ApplyBlockStyle(
// This is a continuation of some inline nodes that belong together in
// the same block item. Use curBlock.
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
.MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(!CanHandleEditAction())) {
nsresult rv = MoveNodeToEndWithTransaction(
MOZ_KnownLive(*curNode->AsContent()), *curBlock);
if (NS_WARN_IF(Destroyed())) {
return NS_ERROR_EDITOR_DESTROYED;
}
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9134,16 +9133,16 @@ nsresult HTMLEditRules::ApplyBlockStyle(
return NS_OK;
}
SplitNodeResult HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
SplitNodeResult HTMLEditor::MaybeSplitAncestorsForInsertWithTransaction(
nsAtom& aTag, const EditorDOMPoint& aStartOfDeepestRightNode) {
MOZ_ASSERT(IsEditorDataAvailable());
MOZ_ASSERT(IsEditActionDataAvailable());
if (NS_WARN_IF(!aStartOfDeepestRightNode.IsSet())) {
return SplitNodeResult(NS_ERROR_INVALID_ARG);
}
MOZ_ASSERT(aStartOfDeepestRightNode.IsSetAndValid());
RefPtr<Element> host = HTMLEditorRef().GetActiveEditingHost();
RefPtr<Element> host = GetActiveEditingHost();
if (NS_WARN_IF(!host)) {
return SplitNodeResult(NS_ERROR_FAILURE);
}
@ -9165,7 +9164,7 @@ SplitNodeResult HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
return SplitNodeResult(NS_ERROR_FAILURE);
}
if (HTMLEditorRef().CanContainTag(*pointToInsert.GetContainer(), aTag)) {
if (CanContainTag(*pointToInsert.GetContainer(), aTag)) {
// Found an ancestor node which can contain the element.
break;
}
@ -9180,13 +9179,10 @@ SplitNodeResult HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
return SplitNodeResult(aStartOfDeepestRightNode);
}
SplitNodeResult splitNodeResult =
MOZ_KnownLive(HTMLEditorRef())
.SplitNodeDeepWithTransaction(
MOZ_KnownLive(*pointToInsert.GetChild()),
aStartOfDeepestRightNode,
SplitAtEdges::eAllowToCreateEmptyContainer);
if (NS_WARN_IF(!CanHandleEditAction())) {
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
MOZ_KnownLive(*pointToInsert.GetChild()), aStartOfDeepestRightNode,
SplitAtEdges::eAllowToCreateEmptyContainer);
if (NS_WARN_IF(Destroyed())) {
return SplitNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
NS_WARNING_ASSERTION(splitNodeResult.Succeeded(),
@ -10868,8 +10864,9 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
// Make sure we can put a block here.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atStartOfSelection);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -10943,8 +10940,9 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
atCurNode.GetContainer()->NodeInfo()->NameAtom();
// Create a new nested list of correct type.
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -11015,8 +11013,9 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
atListItem.GetContainer()->NodeInfo()->NameAtom();
// Create a new nested list of correct type
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atListItem);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(
MOZ_KnownLive(*containerName), atListItem);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}
@ -11067,8 +11066,9 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
continue;
}
SplitNodeResult splitNodeResult =
MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
MOZ_KnownLive(HTMLEditorRef())
.MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
atCurNode);
if (NS_WARN_IF(splitNodeResult.Failed())) {
return splitNodeResult.Rv();
}

Просмотреть файл

@ -425,10 +425,12 @@ class HTMLEditRules : public TextEditRules {
*
* @param aBlockType New block tag name.
* If nsGkAtoms::normal or nsGkAtoms::_empty,
* RemoveBlockStyle() will be called.
* If nsGkAtoms::blockquote, MakeBlockquote()
* will be called.
* Otherwise, ApplyBlockStyle() will be called.
* RemoveBlockContainerElements() will be called.
* If nsGkAtoms::blockquote,
* MoveNodesIntoNewBlockquoteElement() will be
* called. Otherwise,
* CreateOrChangeBlockContainerElement() will be
* called.
*/
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE nsresult MakeBasicBlock(nsAtom& aBlockType);
@ -634,43 +636,6 @@ class HTMLEditRules : public TextEditRules {
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE SplitRangeOffFromNodeResult OutdentAroundSelection();
/**
* SplitRangeOffFromBlockAndRemoveMiddleContainer() splits the nodes
* between aStartOfRange and aEndOfRange, then, removes the middle element
* and moves its content to where the middle element was.
*
* @param aBlockElement The node which will be split.
* @param aStartOfRange The first node which will be unwrapped
* from aBlockElement.
* @param aEndOfRange The last node which will be unwrapped from
* aBlockElement.
* @return The left content is new created left
* element of aBlockElement.
* The right content is split element,
* i.e., must be aBlockElement.
* The middle content is nullptr since
* removing it is the job of this method.
*/
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE SplitRangeOffFromNodeResult
SplitRangeOffFromBlockAndRemoveMiddleContainer(Element& aBlockElement,
nsIContent& aStartOfRange,
nsIContent& aEndOfRange);
/**
* SplitRangeOffFromBlock() splits aBlock at two points, before aStartChild
* and after aEndChild. If they are very start or very end of aBlcok, this
* won't create empty block.
*
* @param aBlockElement A block element which will be split.
* @param aStartOfMiddleElement Start node of middle block element.
* @param aEndOfMiddleElement End node of middle block element.
*/
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE SplitRangeOffFromNodeResult SplitRangeOffFromBlock(
Element& aBlockElement, nsIContent& aStartOfMiddleElement,
nsIContent& aEndOfMiddleElement);
/**
* OutdentPartOfBlock() outdents the nodes between aStartOfOutdent and
* aEndOfOutdent. This splits the range off from aBlockElement first.
@ -791,71 +756,6 @@ class HTMLEditRules : public TextEditRules {
void MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
nsTArray<bool>& aTransitionArray);
/**
* RemoveBlockStyle() removes all format blocks, table related element,
* etc in aNodeArray.
* If aNodeArray has a format node, it will be removed and its contents
* will be moved to where it was.
* If aNodeArray has a table related element, <li>, <blockquote> or <div>,
* it will removed and its contents will be moved to where it was.
*/
MOZ_CAN_RUN_SCRIPT
nsresult RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
/**
* ApplyBlockStyle() formats all nodes in aNodeArray with block elements
* whose name is aBlockTag.
* If aNodeArray has an inline element, a block element is created and the
* inline element and following inline elements are moved into the new block
* element.
* If aNodeArray has <br> elements, they'll be removed from the DOM tree and
* new block element will be created when there are some remaining inline
* elements.
* If aNodeArray has a block element, this calls itself with children of
* the block element. Then, new block element will be created when there
* are some remaining inline elements.
*
* @param aNodeArray Must be descendants of a node.
* @param aBlockTag The element name of new block elements.
*/
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE nsresult ApplyBlockStyle(
nsTArray<OwningNonNull<nsINode>>& aNodeArray, nsAtom& aBlockTag);
/**
* MakeBlockquote() inserts at least one <blockquote> element and moves
* nodes in aNodeArray into new <blockquote> elements. If aNodeArray
* includes a table related element except <table>, this calls itself
* recursively to insert <blockquote> into the cell.
*
* @param aNodeArray Nodes which will be moved into created
* <blockquote> elements.
*/
MOZ_CAN_RUN_SCRIPT
MOZ_MUST_USE nsresult
MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
/**
* MaybeSplitAncestorsForInsertWithTransaction() does nothing if container of
* aStartOfDeepestRightNode can have an element whose tag name is aTag.
* Otherwise, looks for an ancestor node which is or is in active editing
* host and can have an element whose name is aTag. If there is such
* ancestor, its descendants are split.
*
* Note that this may create empty elements while splitting ancestors.
*
* @param aTag The name of element to be inserted
* after calling this method.
* @param aStartOfDeepestRightNode The start point of deepest right node.
* This point must be descendant of
* active editing host.
* @return When succeeded, SplitPoint() returns
* the point to insert the element.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE SplitNodeResult
MaybeSplitAncestorsForInsertWithTransaction(
nsAtom& aTag, const EditorDOMPoint& aStartOfDeepestRightNode);
/**
* JoinNearestEditableNodesWithTransaction() joins two editable nodes which
* are themselves or the nearest editable node of aLeftNode and aRightNode.

Просмотреть файл

@ -45,6 +45,7 @@ class AutoSetTemporaryAncestorLimiter;
class EditActionResult;
class EmptyEditableFunctor;
class ResizerSelectionListener;
class SplitRangeOffFromNodeResult;
enum class EditSubAction : int32_t;
struct PropItem;
template <class T>
@ -1595,6 +1596,105 @@ class HTMLEditor final : public TextEditor,
return true;
}
/**
* MaybeSplitAncestorsForInsertWithTransaction() does nothing if container of
* aStartOfDeepestRightNode can have an element whose tag name is aTag.
* Otherwise, looks for an ancestor node which is or is in active editing
* host and can have an element whose name is aTag. If there is such
* ancestor, its descendants are split.
*
* Note that this may create empty elements while splitting ancestors.
*
* @param aTag The name of element to be inserted
* after calling this method.
* @param aStartOfDeepestRightNode The start point of deepest right node.
* This point must be descendant of
* active editing host.
* @return When succeeded, SplitPoint() returns
* the point to insert the element.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE SplitNodeResult
MaybeSplitAncestorsForInsertWithTransaction(
nsAtom& aTag, const EditorDOMPoint& aStartOfDeepestRightNode);
/**
* SplitRangeOffFromBlock() splits aBlockElement at two points, before
* aStartOfMiddleElement and after aEndOfMiddleElement. If they are very
* start or very end of aBlcok, this won't create empty block.
*
* @param aBlockElement A block element which will be split.
* @param aStartOfMiddleElement Start node of middle block element.
* @param aEndOfMiddleElement End node of middle block element.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE SplitRangeOffFromNodeResult
SplitRangeOffFromBlock(Element& aBlockElement,
nsIContent& aStartOfMiddleElement,
nsIContent& aEndOfMiddleElement);
/**
* SplitRangeOffFromBlockAndRemoveMiddleContainer() splits the nodes
* between aStartOfRange and aEndOfRange, then, removes the middle element
* and moves its content to where the middle element was.
*
* @param aBlockElement The node which will be split.
* @param aStartOfRange The first node which will be unwrapped
* from aBlockElement.
* @param aEndOfRange The last node which will be unwrapped from
* aBlockElement.
* @return The left content is new created left
* element of aBlockElement.
* The right content is split element,
* i.e., must be aBlockElement.
* The middle content is nullptr since
* removing it is the job of this method.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE SplitRangeOffFromNodeResult
SplitRangeOffFromBlockAndRemoveMiddleContainer(Element& aBlockElement,
nsIContent& aStartOfRange,
nsIContent& aEndOfRange);
/**
* MoveNodesIntoNewBlockquoteElement() inserts at least one <blockquote>
* element and moves nodes in aNodeArray into new <blockquote> elements.
* If aNodeArray includes a table related element except <table>, this
* calls itself recursively to insert <blockquote> into the cell.
*
* @param aNodeArray Nodes which will be moved into created
* <blockquote> elements.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult MoveNodesIntoNewBlockquoteElement(
nsTArray<OwningNonNull<nsINode>>& aNodeArray);
/**
* RemoveBlockContainerElements() removes all format blocks, table related
* element, etc in aNodeArray from the DOM tree.
* If aNodeArray has a format node, it will be removed and its contents
* will be moved to where it was.
* If aNodeArray has a table related element, <li>, <blockquote> or <div>,
* it will be removed and its contents will be moved to where it was.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult
RemoveBlockContainerElements(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
/**
* CreateOrChangeBlockContainerElement() formats all nodes in aNodeArray
* with block elements whose name is aBlockTag.
* If aNodeArray has an inline element, a block element is created and the
* inline element and following inline elements are moved into the new block
* element.
* If aNodeArray has <br> elements, they'll be removed from the DOM tree and
* new block element will be created when there are some remaining inline
* elements.
* If aNodeArray has a block element, this calls itself with children of
* the block element. Then, new block element will be created when there
* are some remaining inline elements.
*
* @param aNodeArray Must be descendants of a node.
* @param aBlockTag The element name of new block elements.
*/
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult CreateOrChangeBlockContainerElement(
nsTArray<OwningNonNull<nsINode>>& aNodeArray, nsAtom& aBlockTag);
protected: // Called by helper classes.
virtual void OnStartToHandleTopLevelEditSubAction(
EditSubAction aEditSubAction, nsIEditor::EDirection aDirection) override;

Просмотреть файл

@ -77,7 +77,6 @@ Compositor::Compositor(widget::CompositorWidget* aWidget,
Compositor::~Compositor() { ReadUnlockTextures(); }
void Compositor::Destroy() {
mWidget->DoCompositorCleanup();
mWidget = nullptr;
TextureSourceProvider::Destroy();

Просмотреть файл

@ -130,6 +130,7 @@ class DataTextureSource;
class CompositingRenderTarget;
class CompositorBridgeParent;
class LayerManagerComposite;
class NativeLayer;
class CompositorOGL;
class CompositorD3D11;
class BasicCompositor;
@ -422,6 +423,7 @@ class Compositor : public TextureSourceProvider {
const gfx::IntRect* aClipRectIn,
const gfx::IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
NativeLayer* aNativeLayer,
gfx::IntRect* aClipRectOut = nullptr,
gfx::IntRect* aRenderBoundsOut = nullptr) = 0;

Просмотреть файл

@ -27,6 +27,11 @@
#include <algorithm>
#include "ImageContainer.h"
#ifdef XP_MACOSX
# include "mozilla/gfx/MacIOSurface.h"
# include "mozilla/layers/NativeLayerCA.h"
#endif
namespace mozilla {
using namespace mozilla::gfx;
@ -884,7 +889,7 @@ bool BasicCompositor::BlitRenderTarget(CompositingRenderTarget* aSource,
void BasicCompositor::BeginFrame(
const nsIntRegion& aInvalidRegion, const gfx::IntRect* aClipRectIn,
const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion,
gfx::IntRect* aClipRectOut /* = nullptr */,
NativeLayer* aNativeLayer, gfx::IntRect* aClipRectOut /* = nullptr */,
gfx::IntRect* aRenderBoundsOut /* = nullptr */) {
if (mIsPendingEndRemoteDrawing) {
// Force to end previous remote drawing.
@ -926,6 +931,31 @@ void BasicCompositor::BeginFrame(
mDrawTarget = mTarget;
mDrawTargetBounds = mTargetBounds;
bufferMode = BufferMode::BUFFER_NONE;
} else if (aNativeLayer) {
#ifdef XP_MACOSX
if (mInvalidRect.IsEmpty()) {
return;
}
NativeLayerCA* nativeLayer = aNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
nativeLayer->SetSurfaceIsFlipped(false);
CFTypeRefPtr<IOSurfaceRef> surf = nativeLayer->NextSurface();
if (!surf) {
return;
}
nativeLayer->InvalidateRegionThroughoutSwapchain(mInvalidRegion);
mInvalidRegion = nativeLayer->CurrentSurfaceInvalidRegion();
mInvalidRect = mInvalidRegion.GetBounds();
MOZ_RELEASE_ASSERT(!mInvalidRect.IsEmpty());
mCurrentNativeLayer = aNativeLayer;
mCurrentIOSurface = new MacIOSurface(std::move(surf));
mCurrentIOSurface->Lock(false);
mDrawTarget = mCurrentIOSurface->GetAsDrawTargetLocked(BackendType::SKIA);
mDrawTargetBounds = IntRect(IntPoint(0, 0), mDrawTarget->GetSize());
bufferMode = BufferMode::BUFFER_NONE;
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
} else {
LayoutDeviceIntRegion invalidRegion =
LayoutDeviceIntRegion::FromUnknownRegion(mInvalidRegion);
@ -967,7 +997,7 @@ void BasicCompositor::BeginFrame(
CreateRenderTargetForWindow(mInvalidRect, clearRegion, bufferMode);
if (!target) {
if (!mTarget) {
if (!mTarget && !aNativeLayer) {
mWidget->EndRemoteDrawingInRegion(
mDrawTarget,
LayoutDeviceIntRegion::FromUnknownRegion(mInvalidRegion));
@ -1037,7 +1067,22 @@ void BasicCompositor::EndFrame() {
// Reset the translation that was applied in CreateRenderTargetForWindow.
mRenderTarget->mDrawTarget->SetTransform(gfx::Matrix());
TryToEndRemoteDrawing();
if (mCurrentNativeLayer) {
#ifdef XP_MACOSX
NativeLayerCA* nativeLayer = mCurrentNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
mDrawTarget = nullptr;
mRenderTarget = nullptr;
mCurrentIOSurface->Unlock(false);
mCurrentIOSurface = nullptr;
nativeLayer->NotifySurfaceReady();
mCurrentNativeLayer = nullptr;
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
} else {
TryToEndRemoteDrawing();
}
}
void BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) {

Просмотреть файл

@ -13,6 +13,10 @@
#include "mozilla/gfx/Triangle.h"
#include "mozilla/gfx/Polygon.h"
#ifdef XP_MACOSX
class MacIOSurface;
#endif
namespace mozilla {
namespace layers {
@ -115,7 +119,7 @@ class BasicCompositor : public Compositor {
void BeginFrame(const nsIntRegion& aInvalidRegion,
const gfx::IntRect* aClipRectIn,
const gfx::IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
gfx::IntRect* aClipRectOut = nullptr,
gfx::IntRect* aRenderBoundsOut = nullptr) override;
void NormalDrawingDone() override;
@ -189,6 +193,17 @@ class BasicCompositor : public Compositor {
// The current render target for drawing
RefPtr<BasicCompositingRenderTarget> mRenderTarget;
// The native layer that we're currently rendering to, if any.
// Non-null only between BeginFrame and EndFrame if BeginFrame has been called
// with a non-null aNativeLayer and mTarget is null.
RefPtr<NativeLayer> mCurrentNativeLayer;
#ifdef XP_MACOSX
// The MacIOSurface that we're currently rendering to, if any.
// Non-null in the same cases as mCurrentNativeLayer.
RefPtr<MacIOSurface> mCurrentIOSurface;
#endif
gfx::IntRect mInvalidRect;
gfx::IntRegion mInvalidRegion;

Просмотреть файл

@ -154,6 +154,11 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
mTextRenderer = new TextRenderer();
mDiagnostics = MakeUnique<Diagnostics>();
MOZ_ASSERT(aCompositor);
mNativeLayerRoot = aCompositor->GetWidget()->GetNativeLayerRoot();
if (mNativeLayerRoot) {
mNativeLayerForEntireWindow = mNativeLayerRoot->CreateLayer();
mNativeLayerRoot->AppendLayer(mNativeLayerForEntireWindow);
}
#ifdef USE_SKIA
mPaintCounter = nullptr;
@ -172,6 +177,11 @@ void LayerManagerComposite::Destroy() {
mRoot = nullptr;
mClonedLayerTreeProperties = nullptr;
mProfilerScreenshotGrabber.Destroy();
if (mNativeLayerRoot) {
mNativeLayerRoot->RemoveLayer(mNativeLayerForEntireWindow);
mNativeLayerForEntireWindow = nullptr;
mNativeLayerRoot = nullptr;
}
mDestroyed = true;
#ifdef USE_SKIA
@ -971,16 +981,26 @@ bool LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion,
mCompositor->SetClearColorToDefault();
}
#endif
if (mNativeLayerForEntireWindow) {
mNativeLayerForEntireWindow->SetRect(bounds);
#ifdef XP_MACOSX
mNativeLayerForEntireWindow->SetOpaqueRegion(
mCompositor->GetWidget()->GetOpaqueWidgetRegion().ToUnknownRegion());
#endif
}
if (mRoot->GetClipRect()) {
clipRect = *mRoot->GetClipRect();
IntRect rect(clipRect.X(), clipRect.Y(), clipRect.Width(),
clipRect.Height());
mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, aOpaqueRegion,
nullptr, &actualBounds);
mNativeLayerForEntireWindow, nullptr,
&actualBounds);
} else {
gfx::IntRect rect;
mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, aOpaqueRegion,
&rect, &actualBounds);
mNativeLayerForEntireWindow, &rect, &actualBounds);
clipRect =
ParentLayerIntRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
}
@ -1002,10 +1022,6 @@ bool LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion,
return true;
}
// Allow widget to render a custom background.
mCompositor->GetWidget()->DrawWindowUnderlay(
&widgetContext, LayoutDeviceIntRect::FromUnknownRect(actualBounds));
RefPtr<CompositingRenderTarget> previousTarget;
if (haveLayerEffects) {
previousTarget = PushGroupForLayerEffects();
@ -1224,8 +1240,8 @@ void LayerManagerComposite::RenderToPresentationSurface() {
IntRect bounds = IntRect::Truncate(0, 0, scale * pageWidth, actualHeight);
IntRect rect, actualBounds;
MOZ_ASSERT(mRoot->GetOpacity() == 1);
mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), &rect,
&actualBounds);
mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), nullptr,
&rect, &actualBounds);
// The Java side of Fennec sets a scissor rect that accounts for
// chrome such as the URL bar. Override that so that the entire frame buffer

Просмотреть файл

@ -465,6 +465,8 @@ class LayerManagerComposite final : public HostLayerManager {
RefPtr<CompositingRenderTarget> mTwoPassTmpTarget;
CompositorScreenshotGrabber mProfilerScreenshotGrabber;
RefPtr<TextRenderer> mTextRenderer;
RefPtr<NativeLayerRoot> mNativeLayerRoot;
RefPtr<NativeLayer> mNativeLayerForEntireWindow;
#ifdef USE_SKIA
/**

Просмотреть файл

@ -1098,8 +1098,11 @@ void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
const IntRect* aClipRectIn,
const IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
NativeLayer* aNativeLayer,
IntRect* aClipRectOut,
IntRect* aRenderBoundsOut) {
MOZ_RELEASE_ASSERT(!aNativeLayer, "Unexpected native layer on this platform");
// Don't composite if we are minimised. Other than for the sake of efficency,
// this is important because resizing our buffers when mimised will fail and
// cause a crash when we're restored.

Просмотреть файл

@ -96,7 +96,7 @@ class CompositorD3D11 : public Compositor {
void BeginFrame(const nsIntRegion& aInvalidRegion,
const gfx::IntRect* aClipRectIn,
const gfx::IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
gfx::IntRect* aClipRectOut = nullptr,
gfx::IntRect* aRenderBoundsOut = nullptr) override;

Просмотреть файл

@ -373,7 +373,6 @@ UNIFIED_SOURCES += [
'AxisPhysicsMSDModel.cpp',
'basic/BasicCanvasLayer.cpp',
'basic/BasicColorLayer.cpp',
'basic/BasicCompositor.cpp',
'basic/BasicContainerLayer.cpp',
'basic/BasicImages.cpp',
'basic/BasicLayerManager.cpp',
@ -532,6 +531,7 @@ UNIFIED_SOURCES += [
]
SOURCES += [
'basic/BasicCompositor.cpp',
'basic/BasicImageLayer.cpp',
'ImageContainer.cpp',
'PersistentBufferProvider.cpp',

Просмотреть файл

@ -142,6 +142,9 @@ class CompositingRenderTargetOGL : public CompositingRenderTarget {
return gfx::SurfaceFormat::UNKNOWN;
}
void SetClipRect(const Maybe<gfx::IntRect>& aRect) { mClipRect = aRect; }
const Maybe<gfx::IntRect>& GetClipRect() const { return mClipRect; }
#ifdef MOZ_DUMP_PAINTING
already_AddRefed<gfx::DataSourceSurface> Dump(
Compositor* aCompositor) override;
@ -164,6 +167,7 @@ class CompositingRenderTargetOGL : public CompositingRenderTarget {
*/
RefPtr<CompositorOGL> mCompositor;
RefPtr<GLContext> mGL;
Maybe<gfx::IntRect> mClipRect;
GLuint mTextureHandle;
GLuint mFBO;
};

Просмотреть файл

@ -58,6 +58,11 @@
# include "GeneratedJNIWrappers.h"
#endif
#ifdef XP_MACOSX
# include "GLContextCGL.h"
# include "mozilla/layers/NativeLayerCA.h"
#endif
#include "GeckoProfiler.h"
namespace mozilla {
@ -201,6 +206,11 @@ CompositorOGL::CompositorOGL(CompositorBridgeParent* aParent,
mDestroyed(false),
mViewportSize(0, 0),
mCurrentProgram(nullptr) {
if (aWidget->GetNativeLayerRoot()) {
// We can only render into native layers, our GLContext won't have a usable
// default framebuffer.
mCanRenderToDefaultFramebuffer = false;
}
#ifdef XP_DARWIN
TextureSync::RegisterTextureSourceProvider(this);
#endif
@ -748,11 +758,121 @@ void CompositorOGL::ClearRect(const gfx::Rect& aRect) {
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
}
#ifdef XP_MACOSX
class SurfaceRegistryWrapperAroundCompositorOGL
: public layers::IOSurfaceRegistry {
public:
explicit SurfaceRegistryWrapperAroundCompositorOGL(CompositorOGL* aCompositor)
: mCompositor(aCompositor) {}
void RegisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) override {
mCompositor->RegisterIOSurface((IOSurfacePtr)aSurface.get());
}
void UnregisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) override {
mCompositor->UnregisterIOSurface((IOSurfacePtr)aSurface.get());
}
RefPtr<CompositorOGL> mCompositor;
};
void CompositorOGL::RegisterIOSurface(IOSurfacePtr aSurface) {
MOZ_RELEASE_ASSERT(mRegisteredIOSurfaceRenderTargets.find(aSurface) ==
mRegisteredIOSurfaceRenderTargets.end(),
"double-registering IOSurface");
IOSurfaceRef surface = (IOSurfaceRef)aSurface;
auto glContextCGL = GLContextCGL::Cast(mGLContext);
MOZ_RELEASE_ASSERT(glContextCGL, "Unexpected GLContext type");
IntSize size(IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
mGLContext->MakeCurrent();
GLuint tex = mGLContext->CreateTexture();
{
const ScopedBindTexture bindTex(mGLContext, tex,
LOCAL_GL_TEXTURE_RECTANGLE_ARB);
CGLTexImageIOSurface2D(glContextCGL->GetCGLContext(),
LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_RGBA,
size.width, size.height, LOCAL_GL_BGRA,
LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, surface, 0);
}
GLuint fbo = mGLContext->CreateFramebuffer();
{
const ScopedBindFramebuffer bindFB(mGLContext, fbo);
mGLContext->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_TEXTURE_RECTANGLE_ARB, tex, 0);
}
RefPtr<CompositingRenderTargetOGL> rt =
new CompositingRenderTargetOGL(this, gfx::IntPoint(), tex, fbo);
rt->Initialize(size, size, LOCAL_GL_TEXTURE_RECTANGLE_ARB, INIT_MODE_NONE);
mRegisteredIOSurfaceRenderTargets.insert({aSurface, rt});
}
void CompositorOGL::UnregisterIOSurface(IOSurfacePtr aSurface) {
size_t removeCount = mRegisteredIOSurfaceRenderTargets.erase(aSurface);
MOZ_RELEASE_ASSERT(removeCount == 1,
"Unregistering IOSurface that's not registered");
}
#endif
already_AddRefed<CompositingRenderTargetOGL>
CompositorOGL::RenderTargetForNativeLayer(NativeLayer* aNativeLayer,
IntRegion& aInvalidRegion) {
if (aInvalidRegion.IsEmpty()) {
return nullptr;
}
#ifdef XP_MACOSX
NativeLayerCA* nativeLayer = aNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
nativeLayer->SetSurfaceIsFlipped(true);
auto glContextCGL = GLContextCGL::Cast(mGLContext);
MOZ_RELEASE_ASSERT(glContextCGL, "Unexpected GLContext type");
RefPtr<layers::IOSurfaceRegistry> currentRegistry =
nativeLayer->GetSurfaceRegistry();
if (!currentRegistry) {
nativeLayer->SetSurfaceRegistry(
MakeAndAddRef<SurfaceRegistryWrapperAroundCompositorOGL>(this));
} else {
MOZ_RELEASE_ASSERT(static_cast<SurfaceRegistryWrapperAroundCompositorOGL*>(
currentRegistry.get())
->mCompositor == this);
}
CFTypeRefPtr<IOSurfaceRef> surf = nativeLayer->NextSurface();
if (!surf) {
return nullptr;
}
IntRect layerRect = nativeLayer->GetRect();
IntRegion invalidRelativeToLayer =
aInvalidRegion.MovedBy(-layerRect.TopLeft());
nativeLayer->InvalidateRegionThroughoutSwapchain(invalidRelativeToLayer);
invalidRelativeToLayer = nativeLayer->CurrentSurfaceInvalidRegion();
aInvalidRegion = invalidRelativeToLayer.MovedBy(layerRect.TopLeft());
auto match = mRegisteredIOSurfaceRenderTargets.find((IOSurfacePtr)surf.get());
MOZ_RELEASE_ASSERT(match != mRegisteredIOSurfaceRenderTargets.end(),
"IOSurface has not been registered with this Compositor");
RefPtr<CompositingRenderTargetOGL> rt = match->second;
// Clip the render target to the invalid rect. This conserves memory bandwidth
// and power.
IntRect invalidRect = aInvalidRegion.GetBounds();
rt->SetClipRect(invalidRect == layerRect ? Nothing() : Some(invalidRect));
return rt.forget();
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
}
void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
const IntRect* aClipRectIn,
const IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
IntRect* aClipRectOut,
NativeLayer* aNativeLayer, IntRect* aClipRectOut,
IntRect* aRenderBoundsOut) {
AUTO_PROFILER_LABEL("CompositorOGL::BeginFrame", GRAPHICS);
@ -778,9 +898,6 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
// so just return
if (width == 0 || height == 0) return;
// We're about to actually draw a frame.
mFrameInProgress = true;
// If the widget size changed, we have to force a MakeCurrent
// to make sure that GL sees the updated widget size.
if (mWidgetSize.width != width || mWidgetSize.height != height) {
@ -805,9 +922,32 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
mGLContext->fEnable(LOCAL_GL_BLEND);
RefPtr<CompositingRenderTargetOGL> rt =
CompositingRenderTargetOGL::RenderTargetForWindow(this,
IntSize(width, height));
RefPtr<CompositingRenderTarget> rt;
if (mTarget) {
if (mCanRenderToDefaultFramebuffer) {
rt = CompositingRenderTargetOGL::RenderTargetForWindow(this, rect.Size());
} else {
rt = CreateRenderTarget(rect, INIT_MODE_CLEAR);
}
} else if (aNativeLayer) {
IntRegion layerInvalid;
layerInvalid.And(aInvalidRegion, rect);
rt = RenderTargetForNativeLayer(aNativeLayer, layerInvalid);
mCurrentNativeLayer = aNativeLayer;
} else {
MOZ_RELEASE_ASSERT(mCanRenderToDefaultFramebuffer);
rt = CompositingRenderTargetOGL::RenderTargetForWindow(this, rect.Size());
}
if (!rt) {
*aRenderBoundsOut = IntRect();
mCurrentNativeLayer = nullptr;
return;
}
// We're about to actually draw a frame.
mFrameInProgress = true;
SetRenderTarget(rt);
mWindowRenderTarget = mCurrentRenderTarget;
@ -830,7 +970,26 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
mGLContext->fClearColor(mClearColor.r, mClearColor.g, mClearColor.b,
mClearColor.a);
#endif // defined(MOZ_WIDGET_ANDROID)
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
if (const Maybe<IntRect>& rtClip = mCurrentRenderTarget->GetClipRect()) {
// We need to apply a scissor rect during the clear. And since clears with
// scissor rects are usually treated differently by the GPU than regular
// clears, let's try to clear as little as possible in order to conserve
// memory bandwidth.
IntRegion clearRegion;
clearRegion.Sub(*rtClip, aOpaqueRegion);
if (!clearRegion.IsEmpty()) {
IntRect clearRect = clearRegion.GetBounds();
ScopedGLState scopedScissorTestState(mGLContext, LOCAL_GL_SCISSOR_TEST,
true);
ScopedScissorRect autoScissorRect(mGLContext, clearRect.x,
FlipY(clearRect.YMost()),
clearRect.Width(), clearRect.Height());
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
}
} else {
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
}
}
void CompositorOGL::CreateFBOWithTexture(const gfx::IntRect& aRect,
@ -1182,6 +1341,10 @@ void CompositorOGL::DrawGeometry(const Geometry& aGeometry,
clipRect = clipRect.Intersect(RoundedOut(maskBounds) - offset);
}
if (Maybe<IntRect> rtClip = mCurrentRenderTarget->GetClipRect()) {
clipRect = clipRect.Intersect(*rtClip);
}
// aClipRect is in destination coordinate space (after all
// transforms and offsets have been applied) so if our
// drawing is going to be shifted by mRenderOffset then we need
@ -1739,8 +1902,34 @@ void CompositorOGL::EndFrame() {
}
#endif
if (StaticPrefs::nglayout_debug_widget_update_flashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
EffectChain effectChain;
effectChain.mPrimaryEffect = new EffectSolidColor(Color(r, g, b, 0.2f));
// If we're clipping the render target to the invalid rect, then the
// current render target is still clipped, so just fill the bounds.
IntRect rect = mCurrentRenderTarget->GetRect();
DrawQuad(Rect(rect), rect - rect.TopLeft(), effectChain, 1.0, Matrix4x4(),
Rect(rect));
}
mCurrentRenderTarget->SetClipRect(Nothing());
mFrameInProgress = false;
if (mCurrentNativeLayer) {
#ifdef XP_MACOSX
NativeLayerCA* nativeLayer = mCurrentNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
nativeLayer->NotifySurfaceReady();
mCurrentNativeLayer = nullptr;
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
}
if (mTarget) {
CopyToTarget(mTarget, mTargetBounds.TopLeft(), Matrix());
mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);

Просмотреть файл

@ -8,6 +8,7 @@
#define MOZILLA_GFX_COMPOSITOROGL_H
#include <map>
#include <unordered_map>
#include <unordered_set>
#include "gfx2DGlue.h"
@ -36,6 +37,14 @@
#include "nsXULAppAPI.h" // for XRE_GetProcessType
#include "nscore.h" // for NS_IMETHOD
#ifdef XP_MACOSX
// This file uses IOSurfacePtr instead of IOSurfaceRef because IOSurfaceRef is
// hard to forward declare, and including <IOSurface/IOSurface.h> brings in
// MacTypes.h which defines Point and Rect which cause name lookup trouble.
struct DummyIOSurface;
typedef DummyIOSurface* IOSurfacePtr;
#endif
class nsIWidget;
namespace mozilla {
@ -143,6 +152,13 @@ class CompositorOGL final : public Compositor {
return result;
}
// Returns a render target for the native layer.
// aInvalidRegion will be mutated to include existing invalid areas in the
// layer. aInvalidRegion is in window coordinates, i.e. in the same space
// as aNativeLayer->GetRect().
already_AddRefed<CompositingRenderTargetOGL> RenderTargetForNativeLayer(
NativeLayer* aNativeLayer, gfx::IntRegion& aInvalidRegion);
already_AddRefed<CompositingRenderTarget> CreateRenderTarget(
const gfx::IntRect& aRect, SurfaceInitMode aInit) override;
@ -266,6 +282,11 @@ class CompositorOGL final : public Compositor {
void RegisterTextureSource(TextureSource* aTextureSource);
void UnregisterTextureSource(TextureSource* aTextureSource);
#ifdef XP_MACOSX
void RegisterIOSurface(IOSurfacePtr aSurface);
void UnregisterIOSurface(IOSurfacePtr aSurface);
#endif
private:
template <typename Geometry>
void DrawGeometry(const Geometry& aGeometry, const gfx::Rect& aRect,
@ -285,6 +306,7 @@ class CompositorOGL final : public Compositor {
RefPtr<GLContext> mGLContext;
UniquePtr<GLBlitTextureImageHelper> mBlitTextureImageHelper;
gfx::Matrix4x4 mProjMatrix;
bool mCanRenderToDefaultFramebuffer = true;
#ifdef XP_DARWIN
nsTArray<RefPtr<BufferTextureHost>> mMaybeUnlockBeforeNextComposition;
@ -348,7 +370,7 @@ class CompositorOGL final : public Compositor {
void BeginFrame(const nsIntRegion& aInvalidRegion,
const gfx::IntRect* aClipRectIn,
const gfx::IntRect& aRenderBounds,
const nsIntRegion& aOpaqueRegion,
const nsIntRegion& aOpaqueRegion, NativeLayer* aNativeLayer,
gfx::IntRect* aClipRectOut = nullptr,
gfx::IntRect* aRenderBoundsOut = nullptr) override;
@ -453,6 +475,11 @@ class CompositorOGL final : public Compositor {
RefPtr<CompositorTexturePoolOGL> mTexturePool;
// The native layer that we're currently rendering to, if any.
// Non-null only between BeginFrame and EndFrame if BeginFrame has been called
// with a non-null aNativeLayer.
RefPtr<NativeLayer> mCurrentNativeLayer;
#ifdef MOZ_WIDGET_GTK
// Hold TextureSources which own device data that have to be deleted before
// destroying this CompositorOGL.
@ -468,6 +495,18 @@ class CompositorOGL final : public Compositor {
gfx::IntSize mViewportSize;
ShaderProgramOGL* mCurrentProgram;
#ifdef XP_MACOSX
struct IOSurfaceRefHasher {
std::size_t operator()(const IOSurfacePtr& aSurface) const {
return HashGeneric(reinterpret_cast<uintptr_t>(aSurface));
}
};
std::unordered_map<IOSurfacePtr, RefPtr<CompositingRenderTargetOGL>,
IOSurfaceRefHasher>
mRegisteredIOSurfaceRenderTargets;
#endif
};
} // namespace layers

Просмотреть файл

@ -18,8 +18,9 @@ class GLContext;
}
namespace layers {
class NativeLayer;
class SyncObjectHost;
}
} // namespace layers
namespace widget {
class CompositorWidget;
@ -35,7 +36,7 @@ class RenderCompositor {
RenderCompositor(RefPtr<widget::CompositorWidget>&& aWidget);
virtual ~RenderCompositor();
virtual bool BeginFrame() = 0;
virtual bool BeginFrame(layers::NativeLayer* aNativeLayer) = 0;
virtual void EndFrame() = 0;
// Returns false when waiting gpu tasks is failed.
// It might happen when rendering context is lost.

Просмотреть файл

@ -335,7 +335,8 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
}
}
bool RenderCompositorANGLE::BeginFrame() {
bool RenderCompositorANGLE::BeginFrame(layers::NativeLayer* aNativeLayer) {
MOZ_RELEASE_ASSERT(!aNativeLayer, "Unexpected native layer on this platform");
mWidget->AsWindows()->UpdateCompositorWndSizeIfNecessary();
if (!ResizeBufferIfNeeded()) {

Просмотреть файл

@ -39,7 +39,7 @@ class RenderCompositorANGLE : public RenderCompositor {
virtual ~RenderCompositorANGLE();
bool Initialize();
bool BeginFrame() override;
bool BeginFrame(layers::NativeLayer* aNativeLayer) override;
void EndFrame() override;
bool WaitForGPU() override;
void Pause() override;

Просмотреть файл

@ -63,7 +63,8 @@ RenderCompositorEGL::~RenderCompositorEGL() {
DestroyEGLSurface();
}
bool RenderCompositorEGL::BeginFrame() {
bool RenderCompositorEGL::BeginFrame(layers::NativeLayer* aNativeLayer) {
MOZ_RELEASE_ASSERT(!aNativeLayer, "Unexpected native layer on this platform");
#ifdef MOZ_WAYLAND
bool newSurface =
mWidget->AsX11() && mWidget->AsX11()->WaylandRequestsUpdatingEGLSurface();

Просмотреть файл

@ -22,7 +22,7 @@ class RenderCompositorEGL : public RenderCompositor {
explicit RenderCompositorEGL(RefPtr<widget::CompositorWidget> aWidget);
virtual ~RenderCompositorEGL();
bool BeginFrame() override;
bool BeginFrame(layers::NativeLayer* aNativeLayer) override;
void EndFrame() override;
void Pause() override;
bool Resume() override;

Просмотреть файл

@ -11,6 +11,11 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/widget/CompositorWidget.h"
#ifdef XP_MACOSX
# include "GLContextCGL.h"
# include "mozilla/layers/NativeLayerCA.h"
#endif
namespace mozilla {
namespace wr {
@ -55,12 +60,57 @@ RenderCompositorOGL::~RenderCompositorOGL() {
}
}
bool RenderCompositorOGL::BeginFrame() {
#ifdef XP_MACOSX
class SurfaceRegistryWrapperAroundGLContextCGL
: public layers::IOSurfaceRegistry {
public:
explicit SurfaceRegistryWrapperAroundGLContextCGL(gl::GLContextCGL* aContext)
: mContext(aContext) {}
void RegisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) override {
mContext->RegisterIOSurface(aSurface.get());
}
void UnregisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) override {
mContext->UnregisterIOSurface(aSurface.get());
}
RefPtr<gl::GLContextCGL> mContext;
};
#endif
bool RenderCompositorOGL::BeginFrame(layers::NativeLayer* aNativeLayer) {
if (!mGL->MakeCurrent()) {
gfxCriticalNote << "Failed to make render context current, can't draw.";
return false;
}
if (aNativeLayer) {
#ifdef XP_MACOSX
layers::NativeLayerCA* nativeLayer = aNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
nativeLayer->SetSurfaceIsFlipped(true);
auto glContextCGL = gl::GLContextCGL::Cast(mGL);
MOZ_RELEASE_ASSERT(glContextCGL, "Unexpected GLContext type");
RefPtr<layers::IOSurfaceRegistry> currentRegistry =
nativeLayer->GetSurfaceRegistry();
if (!currentRegistry) {
nativeLayer->SetSurfaceRegistry(
MakeAndAddRef<SurfaceRegistryWrapperAroundGLContextCGL>(
glContextCGL));
} else {
MOZ_RELEASE_ASSERT(static_cast<SurfaceRegistryWrapperAroundGLContextCGL*>(
currentRegistry.get())
->mContext == glContextCGL);
}
CFTypeRefPtr<IOSurfaceRef> surf = nativeLayer->NextSurface();
if (!surf) {
return false;
}
glContextCGL->UseRegisteredIOSurfaceForDefaultFramebuffer(surf.get());
mCurrentNativeLayer = aNativeLayer;
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
}
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mGL->GetDefaultFramebuffer());
return true;
}
@ -68,6 +118,17 @@ bool RenderCompositorOGL::BeginFrame() {
void RenderCompositorOGL::EndFrame() {
InsertFrameDoneSync();
mGL->SwapBuffers();
if (mCurrentNativeLayer) {
#ifdef XP_MACOSX
layers::NativeLayerCA* nativeLayer = mCurrentNativeLayer->AsNativeLayerCA();
MOZ_RELEASE_ASSERT(nativeLayer, "Unexpected native layer type");
nativeLayer->NotifySurfaceReady();
mCurrentNativeLayer = nullptr;
#else
MOZ_CRASH("Unexpected native layer on this platform");
#endif
}
}
void RenderCompositorOGL::InsertFrameDoneSync() {

Просмотреть файл

@ -22,7 +22,7 @@ class RenderCompositorOGL : public RenderCompositor {
RefPtr<widget::CompositorWidget>&& aWidget);
virtual ~RenderCompositorOGL();
bool BeginFrame() override;
bool BeginFrame(layers::NativeLayer* aNativeLayer) override;
void EndFrame() override;
bool WaitForGPU() override;
void Pause() override;
@ -39,6 +39,11 @@ class RenderCompositorOGL : public RenderCompositor {
RefPtr<gl::GLContext> mGL;
// The native layer that we're currently rendering to, if any.
// Non-null only between BeginFrame and EndFrame if BeginFrame has been called
// with a non-null aNativeLayer.
RefPtr<layers::NativeLayer> mCurrentNativeLayer;
// Used to apply back-pressure in WaitForGPU().
GLsync mPreviousFrameDoneSync;
GLsync mThisFrameDoneSync;

Просмотреть файл

@ -58,6 +58,12 @@ RendererOGL::RendererOGL(RefPtr<RenderThread>&& aThread,
MOZ_ASSERT(mRenderer);
MOZ_ASSERT(mBridge);
MOZ_COUNT_CTOR(RendererOGL);
mNativeLayerRoot = mCompositor->GetWidget()->GetNativeLayerRoot();
if (mNativeLayerRoot) {
mNativeLayerForEntireWindow = mNativeLayerRoot->CreateLayer();
mNativeLayerRoot->AppendLayer(mNativeLayerForEntireWindow);
}
}
RendererOGL::~RendererOGL() {
@ -68,7 +74,11 @@ RendererOGL::~RendererOGL() {
// Leak resources!
return;
}
mCompositor->GetWidget()->DoCompositorCleanup();
if (mNativeLayerRoot) {
mNativeLayerRoot->RemoveLayer(mNativeLayerForEntireWindow);
mNativeLayerForEntireWindow = nullptr;
mNativeLayerRoot = nullptr;
}
wr_renderer_delete(mRenderer);
}
@ -110,20 +120,31 @@ bool RendererOGL::UpdateAndRender(const Maybe<gfx::IntSize>& aReadbackSize,
}
// XXX set clear color if MOZ_WIDGET_ANDROID is defined.
if (!mCompositor->BeginFrame()) {
auto size = mCompositor->GetBufferSize();
if (mNativeLayerForEntireWindow) {
gfx::IntRect bounds(gfx::IntPoint(0, 0), size.ToUnknownSize());
mNativeLayerForEntireWindow->SetRect(bounds);
#ifdef XP_MACOSX
mNativeLayerForEntireWindow->SetOpaqueRegion(
mCompositor->GetWidget()->GetOpaqueWidgetRegion().ToUnknownRegion());
#endif
}
if (!mCompositor->BeginFrame(mNativeLayerForEntireWindow)) {
if (mCompositor->IsContextLost()) {
RenderThread::Get()->HandleDeviceReset("BeginFrame", /* aNotify */ true);
}
mCompositor->GetWidget()->PostRender(&widgetContext);
return false;
}
wr_renderer_update(mRenderer);
auto size = mCompositor->GetBufferSize();
if (!wr_renderer_render(mRenderer, size.width, size.height, aHadSlowFrame,
aOutStats)) {
RenderThread::Get()->HandleWebRenderError(WebRenderError::RENDER);
mCompositor->GetWidget()->PostRender(&widgetContext);
return false;
}

Просмотреть файл

@ -26,6 +26,8 @@ class GLContext;
namespace layers {
class CompositorBridgeParent;
class NativeLayerRoot;
class NativeLayer;
class SyncObjectHost;
} // namespace layers
@ -106,6 +108,8 @@ class RendererOGL {
protected:
RefPtr<RenderThread> mThread;
UniquePtr<RenderCompositor> mCompositor;
RefPtr<layers::NativeLayerRoot> mNativeLayerRoot;
RefPtr<layers::NativeLayer> mNativeLayerForEntireWindow;
wr::Renderer* mRenderer;
layers::CompositorBridgeParent* mBridge;
wr::WindowId mWindowId;

Просмотреть файл

@ -1283,7 +1283,8 @@ VectorImage::RequestDiscard() {
mProgressTracker->OnDiscard();
}
if (Document* doc = mSVGDocumentWrapper->GetDocument()) {
if (Document* doc =
mSVGDocumentWrapper ? mSVGDocumentWrapper->GetDocument() : nullptr) {
doc->ReportUseCounters();
}

Просмотреть файл

@ -66,21 +66,20 @@ static nsSize GetSize(const Document* aDocument) {
return pc->GetVisibleArea().Size();
}
static bool IsDeviceSizePageSize(const Document* aDocument) {
nsIDocShell* docShell = aDocument->GetDocShell();
if (!docShell) {
return false;
}
return docShell->GetDeviceSizeIsPageSize();
}
// A helper for three features below.
static nsSize GetDeviceSize(const Document* aDocument) {
if (nsContentUtils::ShouldResistFingerprinting(aDocument) ||
IsDeviceSizePageSize(aDocument)) {
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
return GetSize(aDocument);
}
// Media queries in documents in an RDM pane should use the simulated
// device size.
Maybe<CSSIntSize> deviceSize =
nsGlobalWindowOuter::GetRDMDeviceSize(*aDocument);
if (deviceSize.isSome()) {
return CSSPixel::ToAppUnits(deviceSize.value());
}
nsPresContext* pc = aDocument->GetPresContext();
// NOTE(emilio): We should probably figure out how to return an appropriate
// device size here, though in a multi-screen world that makes no sense

Просмотреть файл

@ -22,41 +22,133 @@ nsLayoutDebugCLH::~nsLayoutDebugCLH() {}
NS_IMPL_ISUPPORTS(nsLayoutDebugCLH, ICOMMANDLINEHANDLER)
NS_IMETHODIMP
nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
nsresult rv;
static nsresult HandleFlagWithOptionalArgument(nsICommandLine* aCmdLine,
const nsAString& aName,
const nsAString& aDefaultValue,
nsAString& aValue,
bool& aFlagPresent) {
aValue = EmptyString();
aFlagPresent = false;
nsresult rv;
int32_t idx;
rv = aCmdLine->FindFlag(NS_LITERAL_STRING("layoutdebug"), false, &idx);
rv = aCmdLine->FindFlag(aName, false, &idx);
NS_ENSURE_SUCCESS(rv, rv);
if (idx < 0) return NS_OK;
aFlagPresent = true;
int32_t length;
aCmdLine->GetLength(&length);
nsAutoString url;
bool argPresent = false;
if (idx + 1 < length) {
rv = aCmdLine->GetArgument(idx + 1, url);
rv = aCmdLine->GetArgument(idx + 1, aValue);
NS_ENSURE_SUCCESS(rv, rv);
if (!url.IsEmpty() && url.CharAt(0) == '-') url.Truncate();
if (!aValue.IsEmpty() && aValue.CharAt(0) == '-') {
aValue = EmptyString();
} else {
argPresent = true;
}
}
aCmdLine->RemoveArguments(idx, idx + !url.IsEmpty());
if (!argPresent) {
aValue = aDefaultValue;
}
return aCmdLine->RemoveArguments(idx, idx + argPresent);
}
static nsresult HandleFlagWithOptionalArgument(nsICommandLine* aCmdLine,
const nsAString& aName,
double aDefaultValue,
double& aValue,
bool& aFlagPresent) {
nsresult rv;
nsString s;
rv = HandleFlagWithOptionalArgument(aCmdLine, aName, NS_LITERAL_STRING("0"),
s, aFlagPresent);
NS_ENSURE_SUCCESS(rv, rv);
if (!aFlagPresent) {
aValue = 0.0;
return NS_OK;
}
aValue = s.ToDouble(&rv);
return rv;
}
static nsresult AppendArg(nsIMutableArray* aArray, const nsAString& aString) {
nsCOMPtr<nsISupportsString> s =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
NS_ENSURE_TRUE(s, NS_ERROR_FAILURE);
s->SetData(aString);
return aArray->AppendElement(s);
}
NS_IMETHODIMP
nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
nsresult rv;
bool flagPresent;
nsString url;
bool autoclose = false;
double delay = 0.0;
bool captureProfile = false;
nsString profileFilename;
rv = HandleFlagWithOptionalArgument(
aCmdLine, NS_LITERAL_STRING("layoutdebug"),
NS_LITERAL_STRING("about:blank"), url, flagPresent);
NS_ENSURE_SUCCESS(rv, rv);
if (!flagPresent) {
return NS_OK;
}
rv = HandleFlagWithOptionalArgument(aCmdLine, NS_LITERAL_STRING("autoclose"),
0.0, delay, autoclose);
NS_ENSURE_SUCCESS(rv, rv);
rv = HandleFlagWithOptionalArgument(
aCmdLine, NS_LITERAL_STRING("capture-profile"),
NS_LITERAL_STRING("profile.json"), profileFilename, captureProfile);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMutableArray> argsArray = nsArray::Create();
if (!url.IsEmpty()) {
nsCOMPtr<nsIURI> uri;
rv = aCmdLine->ResolveURI(url, getter_AddRefs(uri));
nsCOMPtr<nsIURI> uri;
nsAutoCString resolvedSpec;
rv = aCmdLine->ResolveURI(url, getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
rv = uri->GetSpec(resolvedSpec);
NS_ENSURE_SUCCESS(rv, rv);
rv = AppendArg(argsArray, NS_ConvertUTF8toUTF16(resolvedSpec));
NS_ENSURE_SUCCESS(rv, rv);
if (autoclose) {
nsString arg;
arg.AppendPrintf("autoclose=%f", delay);
rv = AppendArg(argsArray, arg);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsString> scriptableURL =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
NS_ENSURE_TRUE(scriptableURL, NS_ERROR_FAILURE);
nsAutoCString resolvedSpec;
rv = uri->GetSpec(resolvedSpec);
}
if (captureProfile) {
nsString arg;
arg.AppendLiteral("profile=");
arg.Append(profileFilename);
rv = AppendArg(argsArray, arg);
NS_ENSURE_SUCCESS(rv, rv);
scriptableURL->SetData(NS_ConvertUTF8toUTF16(resolvedSpec));
argsArray->AppendElement(scriptableURL);
}
nsCOMPtr<nsIWindowWatcher> wwatch =
@ -72,6 +164,14 @@ nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine) {
NS_IMETHODIMP
nsLayoutDebugCLH::GetHelpInfo(nsACString& aResult) {
aResult.AssignLiteral(" --layoutdebug [<url>] Start with Layout Debugger\n");
aResult.AssignLiteral(
" --layoutdebug [<url>] Start with Layout Debugger\n"
" --autoclose [<seconds>] Automatically close the Layout Debugger once\n"
" the page has loaded, after delaying the specified\n"
" number of seconds (which defaults to 0).\n"
" --capture-profile [<filename>] Capture a profile of the Layout\n"
" Debugger using the Gecko Profiler, and save the\n"
" profile to the specified file (which defaults to\n"
" profile.json).\n");
return NS_OK;
}

Просмотреть файл

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gArgs;
var gBrowser;
var gURLBar;
var gDebugger;
@ -9,10 +10,13 @@ var gMultiProcessBrowser = window.docShell.QueryInterface(Ci.nsILoadContext)
.useRemoteTabs;
var gFissionBrowser = window.docShell.QueryInterface(Ci.nsILoadContext)
.useRemoteSubframes;
var gWritingProfile = false;
var gWrittenProfile = false;
const { E10SUtils } = ChromeUtils.import(
"resource://gre/modules/E10SUtils.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { Preferences } = ChromeUtils.import(
"resource://gre/modules/Preferences.jsm"
);
@ -170,6 +174,20 @@ nsLDBBrowserContentListener.prototype = {
this.setButtonEnabled(this.mStopButton, false);
this.mStatusText.value = gURLBar.value + " loaded";
this.mLoading = false;
if (gArgs.autoclose && gBrowser.currentURI.spec != "about:blank") {
// We check for about:blank just to avoid one or two STATE_STOP
// notifications that occur before the loadURI() call completes.
// This does mean that --autoclose doesn't work when the URL on
// the command line is about:blank (or not specified), but that's
// not a big deal.
setTimeout(function() {
if (gArgs.profile && Services.profiler) {
dumpProfile();
} else {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
}
}, gArgs.delay * 1000);
}
}
},
@ -213,6 +231,30 @@ nsLDBBrowserContentListener.prototype = {
mLoading: false,
};
function parseArguments() {
let args = {
url: null,
autoclose: false,
delay: 0,
};
if (window.arguments) {
args.url = window.arguments[0];
for (let i = 1; i < window.arguments.length; ++i) {
let arg = window.arguments[i];
if (/^autoclose=(.*)$/.test(arg)) {
args.autoclose = true;
args.delay = +RegExp.$1;
} else if (/^profile=(.*)$/.test(arg)) {
args.profile = true;
args.profileFilename = RegExp.$1;
} else {
throw `Unknown option ${arg}`;
}
}
}
return args;
}
function OnLDBLoad() {
gBrowser = document.getElementById("browser");
gURLBar = document.getElementById("urlbar");
@ -229,8 +271,32 @@ function OnLDBLoad() {
return null;
};
if (window.arguments && window.arguments[0]) {
loadURI(window.arguments[0]);
gArgs = parseArguments();
if (gArgs.profile) {
if (Services.profiler) {
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
if (!env.exists("MOZ_PROFILER_SYMBOLICATE")) {
dump(
"Warning: MOZ_PROFILER_SYMBOLICATE environment variable not set; " +
"profile will not be symbolicated.\n"
);
}
Services.profiler.StartProfiler(
1 << 20,
1,
["default"],
["GeckoMain", "Compositor", "Renderer", "RenderBackend", "StyleThread"]
);
} else {
dump("Cannot profile Layout Debugger; profiler was not compiled in.\n");
}
}
if (gArgs.url) {
loadURI(gArgs.url);
}
}
@ -250,6 +316,43 @@ function checkPersistentMenus() {
checkPersistentMenu("reflowCounts");
}
function dumpProfile() {
gWritingProfile = true;
let cwd = Services.dirsvc.get("CurWorkD", Ci.nsIFile).path;
let filename = OS.Path.join(cwd, gArgs.profileFilename);
dump(`Writing profile to ${filename}...\n`);
Services.profiler.dumpProfileToFileAsync(filename).then(function() {
gWritingProfile = false;
gWrittenProfile = true;
dump(`done\n`);
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
});
}
function OnLDBBeforeUnload(event) {
if (gArgs.profile && Services.profiler) {
if (gWrittenProfile) {
// We've finished writing the profile. Allow the window to close.
return;
}
event.preventDefault();
if (gWritingProfile) {
// Wait for the profile to finish being written out.
return;
}
// The dumpProfileToFileAsync call can block for a while, so run it off a
// timeout to avoid annoying the window manager if we're doing this in
// response to clicking the window's close button.
setTimeout(dumpProfile, 0);
}
}
function OnLDBUnload() {
gDebugger.detachBrowser();
}

Просмотреть файл

@ -28,6 +28,7 @@
titlemenuseparator=" - "
windowtype="mozapp:layoutdebug"
onload="OnLDBLoad();"
onclose="OnLDBBeforeUnload(event);"
onunload="OnLDBUnload();"
width="1024" height="768"
screenX="4" screenY="4"

Просмотреть файл

@ -91,6 +91,7 @@
#include "mozilla/XorShift128PlusRNG.h"
using namespace mozilla;
using namespace mozilla::recordreplay;
//---------------------------------------------------------------------------
// Utilities
@ -326,16 +327,16 @@ class GAtomic {
// The current time. Relaxed semantics because it's primarily used for
// determining if an allocation can be recycled yet and therefore it doesn't
// need to be exact.
static Atomic<Time, Relaxed> sNow;
static Atomic<Time, Relaxed, Behavior::DontPreserve> sNow;
// Delay until the next attempt at a page allocation. See the comment in
// MaybePageAlloc() for an explanation of why it is a signed integer, and why
// it uses ReleaseAcquire semantics.
static Atomic<Delay, ReleaseAcquire> sAllocDelay;
static Atomic<Delay, ReleaseAcquire, Behavior::DontPreserve> sAllocDelay;
};
Atomic<Time, Relaxed> GAtomic::sNow;
Atomic<Delay, ReleaseAcquire> GAtomic::sAllocDelay;
Atomic<Time, Relaxed, Behavior::DontPreserve> GAtomic::sNow;
Atomic<Delay, ReleaseAcquire, Behavior::DontPreserve> GAtomic::sAllocDelay;
// Shared, immutable global state. Initialized by replace_init() and never
// changed after that. replace_init() runs early enough that no synchronization

Просмотреть файл

@ -1,2 +1 @@
#include init/all.js
#include ../../devtools/shared/preferences/devtools-shared.js

Просмотреть файл

@ -2086,6 +2086,9 @@ pref("network.dns.offline-localhost", true);
// A negative value will keep the thread alive forever.
pref("network.dns.resolver-thread-extra-idle-time-seconds", 60);
// Whether to disable TRR when parental control is enabled.
pref("network.dns.skipTRR-when-parental-control-enabled", true);
// The maximum allowed length for a URL - 1MB default
pref("network.standard-url.max-length", 1048576);
@ -5630,3 +5633,87 @@ pref("remote.force-local", true);
// "Config", "Info", "Warn", "Error", and "Fatal". The value is treated
// case-sensitively.
pref("remote.log.level", "Info");
// Enable the JSON View tool (an inspector for application/json documents).
pref("devtools.jsonview.enabled", true);
// Default theme ("dark" or "light").
#ifdef MOZ_DEV_EDITION
pref("devtools.theme", "dark", sticky);
#else
pref("devtools.theme", "light", sticky);
#endif
// Completely disable DevTools entry points, as well as all DevTools command
// line arguments This should be merged with devtools.enabled, see Bug 1440675.
pref("devtools.policy.disabled", false);
// Tells if DevTools have been explicitely enabled by the user. This pref
// allows to disable all features related to DevTools for users that never use
// them. Until bug 1361080 lands, we always consider them enabled.
pref("devtools.enabled", true);
// Enable deprecation warnings.
pref("devtools.errorconsole.deprecation_warnings", true);
#ifdef NIGHTLY_BUILD
// Don't show the Browser Toolbox prompt on local builds / nightly.
pref("devtools.debugger.prompt-connection", false, sticky);
#else
pref("devtools.debugger.prompt-connection", true, sticky);
#endif
#ifdef MOZILLA_OFFICIAL
// Disable debugging chrome.
pref("devtools.chrome.enabled", false, sticky);
// Disable remote debugging connections.
pref("devtools.debugger.remote-enabled", false, sticky);
#else
// In local builds, enable the browser toolbox by default.
pref("devtools.chrome.enabled", true, sticky);
pref("devtools.debugger.remote-enabled", true, sticky);
#endif
// Disable remote debugging protocol logging.
pref("devtools.debugger.log", false);
pref("devtools.debugger.log.verbose", false);
pref("devtools.debugger.remote-port", 6000);
pref("devtools.debugger.remote-websocket", false);
// Force debugger server binding on the loopback interface.
pref("devtools.debugger.force-local", true);
// Limit for intercepted request and response bodies (1 MB).
// Possible values:
// 0 => the response body has no limit
// n => represents max number of bytes stored
pref("devtools.netmonitor.responseBodyLimit", 1048576);
pref("devtools.netmonitor.requestBodyLimit", 1048576);
// Limit for WebSocket frames (100 KB).
pref("devtools.netmonitor.ws.messageDataLimit", 100000);
// DevTools default color unit.
pref("devtools.defaultColorUnit", "authored");
// Used for devtools debugging.
pref("devtools.dump.emit", false);
// Disable device discovery logging.
pref("devtools.discovery.log", false);
// Whether to scan for DevTools devices via WiFi.
pref("devtools.remote.wifi.scan", true);
// Client must complete TLS handshake within this window (ms).
pref("devtools.remote.tls-handshake-timeout", 10000);
// The extension ID for devtools-adb-extension.
pref("devtools.remote.adb.extensionID", "adb@mozilla.org");
// The URL for for devtools-adb-extension (overridden in tests to a local
// path).
pref("devtools.remote.adb.extensionURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/devtools/adb-extension/#OS#/adb-extension-latest-#OS#.xpi");
// URL of the remote JSON catalog used for device simulation.
pref("devtools.devices.url", "https://code.cdn.mozilla.net/devices/devices.json");
// Enable Inactive CSS detection; used both by the client and the server.
pref("devtools.inspector.inactive.css.enabled", true);

Просмотреть файл

@ -281,6 +281,11 @@ ChildDNSService::GetDNSCacheEntries(
NS_IMETHODIMP
ChildDNSService::ClearCache(bool aTrrToo) { return NS_ERROR_NOT_AVAILABLE; }
NS_IMETHODIMP
ChildDNSService::ReloadParentalControlEnabled() {
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
ChildDNSService::GetMyHostName(nsACString& result) {
// TODO: get value from parent during PNecko construction?

Просмотреть файл

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsICaptivePortalService.h"
#include "nsIParentalControlsService.h"
#include "nsIObserverService.h"
#include "nsIURIMutator.h"
#include "nsNetUtil.h"
@ -50,7 +51,8 @@ TRRService::TRRService()
mClearTRRBLStorage(false),
mConfirmationState(CONFIRM_INIT),
mRetryConfirmInterval(1000),
mTRRFailures(0) {
mTRRFailures(0),
mParentalControlEnabled(false) {
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
}
@ -90,6 +92,8 @@ nsresult TRRService::Init() {
captiveState, (int)mCaptiveIsPassed));
}
GetParentalControlEnabledInternal();
ReadPrefs(nullptr);
gTRRService = this;
@ -98,6 +102,16 @@ nsresult TRRService::Init() {
return NS_OK;
}
void TRRService::GetParentalControlEnabledInternal() {
nsCOMPtr<nsIParentalControlsService> pc =
do_CreateInstance("@mozilla.org/parental-controls-service;1");
if (pc) {
pc->GetParentalControlsEnabled(&mParentalControlEnabled);
LOG(("TRRService::GetParentalControlEnabledInternal=%d\n",
mParentalControlEnabled));
}
}
bool TRRService::Enabled() {
if (mConfirmationState == CONFIRM_INIT &&
(!mWaitForCaptive || mCaptiveIsPassed || (mMode == MODE_TRRONLY))) {

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsIObserver.h"
#include "nsWeakReference.h"
class nsDNSService;
class nsIPrefBranch;
namespace mozilla {
@ -59,6 +60,7 @@ class TRRService : public nsIObserver,
bool MaybeBootstrap(const nsACString& possible, nsACString& result);
enum TrrOkay { OKAY_NORMAL = 0, OKAY_TIMEOUT = 1, OKAY_BAD = 2 };
void TRRIsOkay(enum TrrOkay aReason);
bool ParentalControlEnabled() const { return mParentalControlEnabled; }
private:
virtual ~TRRService();
@ -66,6 +68,8 @@ class TRRService : public nsIObserver,
void GetPrefBranch(nsIPrefBranch** result);
void MaybeConfirm();
void MaybeConfirm_locked();
friend class ::nsDNSService;
void GetParentalControlEnabledInternal();
bool mInitialized;
Atomic<uint32_t, Relaxed> mMode;
@ -115,6 +119,7 @@ class TRRService : public nsIObserver,
nsCOMPtr<nsITimer> mRetryConfirmTimer;
uint32_t mRetryConfirmInterval; // milliseconds until retry
Atomic<uint32_t, Relaxed> mTRRFailures;
bool mParentalControlEnabled;
};
extern TRRService* gTRRService;

Просмотреть файл

@ -1206,6 +1206,14 @@ nsDNSService::ClearCache(bool aTrrToo) {
return NS_OK;
}
NS_IMETHODIMP
nsDNSService::ReloadParentalControlEnabled() {
if (mTrrService) {
mTrrService->GetParentalControlEnabledInternal();
}
return NS_OK;
}
size_t nsDNSService::SizeOfIncludingThis(
mozilla::MallocSizeOf mallocSizeOf) const {
// Measurement of the following members may be added later if DMD finds it

Просмотреть файл

@ -547,6 +547,8 @@ static const char kPrefGetTtl[] = "network.dns.get-ttl";
static const char kPrefNativeIsLocalhost[] = "network.dns.native-is-localhost";
static const char kPrefThreadIdleTime[] =
"network.dns.resolver-thread-extra-idle-time-seconds";
static const char kPrefSkipTRRParentalControl[] =
"network.dns.skipTRR-when-parental-control-enabled";
static bool sGetTtlEnabled = false;
mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
@ -576,6 +578,7 @@ nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
mLock("nsHostResolver.mLock"),
mIdleTaskCV(mLock, "nsHostResolver.mIdleTaskCV"),
mEvictionQSize(0),
mSkipTRRWhenParentalControlEnabled(true),
mShutdown(true),
mNumIdleTasks(0),
mActiveTaskCount(0),
@ -599,6 +602,8 @@ nsresult nsHostResolver::Init() {
mShutdown = false;
mNCS = NetworkConnectivityService::GetSingleton();
mSkipTRRWhenParentalControlEnabled =
Preferences::GetBool(kPrefSkipTRRParentalControl, true);
// The preferences probably haven't been loaded from the disk yet, so we
// need to register a callback that will set up the experiment once they
@ -1396,13 +1401,15 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec) {
addrRec->mTrrAAAAUsed = AddrHostRecord::INIT;
}
// For domains that are excluded from TRR we fallback to NativeLookup.
// This happens even in MODE_TRRONLY.
// By default localhost and local are excluded (so we cover *.local hosts)
// See the network.trr.excluded-domains pref.
// For domains that are excluded from TRR or when parental control is enabled,
// we fallback to NativeLookup. This happens even in MODE_TRRONLY. By default
// localhost and local are excluded (so we cover *.local hosts) See the
// network.trr.excluded-domains pref.
bool skipTRR = true;
if (gTRRService) {
skipTRR = gTRRService->IsExcludedFromTRR(rec->host);
skipTRR = gTRRService->IsExcludedFromTRR(rec->host) ||
(mSkipTRRWhenParentalControlEnabled &&
gTRRService->ParentalControlEnabled());
}
if (rec->flags & RES_DISABLE_TRR) {

Просмотреть файл

@ -551,6 +551,7 @@ class nsHostResolver : public nsISupports, public AHostResolver {
PRTime mCreationTime;
mozilla::TimeDuration mLongIdleTimeout;
mozilla::TimeDuration mShortIdleTimeout;
bool mSkipTRRWhenParentalControlEnabled;
RefPtr<nsIThreadPool> mResolverThreads;
RefPtr<mozilla::net::NetworkConnectivityService> mNCS;

Просмотреть файл

@ -223,6 +223,12 @@ interface nsIDNSService : nsISupports
*/
void clearCache(in boolean aTrrToo);
/**
* The method is used only for test purpose. We use this to recheck if
* parental control is enabled or not.
*/
void reloadParentalControlEnabled();
/**
* @return the hostname of the operating system.
*/

Просмотреть файл

@ -3,11 +3,27 @@
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
Ci.nsIDNSService
);
const { MockRegistrar } = ChromeUtils.import(
"resource://testing-common/MockRegistrar.jsm"
);
const mainThread = Services.tm.currentThread;
const defaultOriginAttributes = {};
let h2Port = null;
async function SetParentalControlEnabled(aEnabled) {
let parentalControlsService = {
parentalControlsEnabled: aEnabled,
QueryInterface: ChromeUtils.generateQI([Ci.nsIParentalControlsService]),
};
let cid = MockRegistrar.register(
"@mozilla.org/parental-controls-service;1",
parentalControlsService
);
dns.reloadParentalControlEnabled();
MockRegistrar.unregister(cid);
}
add_task(function setup() {
dump("start!\n");
@ -48,6 +64,8 @@ add_task(function setup() {
Ci.nsIX509CertDB
);
addCertFromFile(certdb, "http2-ca.pem", "CTu,u,u");
SetParentalControlEnabled(false);
});
registerCleanupFunction(() => {
@ -710,6 +728,14 @@ add_task(async function test24f() {
await new DNSListener("test.detectportal.com", "127.0.0.1");
});
// TRR-first check that a domain is resolved via native DNS when parental control is enabled.
add_task(async function test24g() {
dns.clearCache(true);
await SetParentalControlEnabled(true);
await new DNSListener("www.example.com", "127.0.0.1");
await SetParentalControlEnabled(false);
});
// TRR-only that resolving localhost with TRR-only mode will use the remote
// resolver if it's not in the excluded domains
add_task(async function test25() {
@ -782,6 +808,15 @@ add_task(async function test25e() {
await new DNSListener("test.detectportal.com", "127.0.0.1");
});
// TRR-only check that a domain is resolved via native DNS when parental control is enabled.
add_task(async function test25f() {
dns.clearCache(true);
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
await SetParentalControlEnabled(true);
await new DNSListener("www.example.com", "127.0.0.1");
await SetParentalControlEnabled(false);
});
// Check that none of the requests have set any cookies.
add_task(async function count_cookies() {
let cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);

Просмотреть файл

@ -846,9 +846,6 @@ case "$target" in
CFLAGS="$CFLAGS -mstackrealign"
CXXFLAGS="$CXXFLAGS -mstackrealign"
LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
if test -z "$CLANG_CC"; then
LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
fi
else
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
LDFLAGS="$LDFLAGS -SAFESEH"

Просмотреть файл

@ -11,7 +11,7 @@ license = "MPL-2.0"
[dependencies]
base64 = "0.10"
cookie = { version = "0.11", default-features = false }
cookie = { version = "0.12", default-features = false }
http = "0.1"
log = "0.4"
regex = "1.0"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"6a8f9c03d5260359e497a70910ab444f32b51551e9c0aaffabcfbbb2dd7c906d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"9205f5b7d179b5ca140ec7322c5894540aef149a38bd55874bef9de5a48e0938","src/builder.rs":"4200963d44d1a59f1268965b77407ba977eb5a777875cb76ea927ddc829be3d8","src/delta.rs":"510fc3dbf0a70d635d0488c5a5a32a2ba8e1490ce05bee39d944ea8c02189bbc","src/draft.rs":"950b43b3f6e1c4c13b1e90220c71defe02713170807b41e5ffde9a1327688f48","src/jar.rs":"0e8a6e2f0426834101bd9608baf9f695839053523e9e9ac58aea03a73506b8fb","src/lib.rs":"963ff56045a4ee22e280ee24a42efc9b1d6a96de30d3856b39287ec2b51b00db","src/parse.rs":"549844993601f20f5de3f5d5f8bea0fce3fe4f09d72e343aff9e433948a4ec5c","src/secure/key.rs":"734f35ef4b0d6b63174befdcb970f0304ac63f0895871b7c2f267fefdd43b648","src/secure/macros.rs":"83d770e5c4eb7fbd3c3d86973b69042e9e2bb9fafb72a4456598e2ae78638d5f","src/secure/mod.rs":"5d7fecb62295827d474ed1ce6b7628fe93d4a09eb14babfde036d64e8e4a04f8","src/secure/private.rs":"bea61d91772285e0db7c234bda32d9e95ce386dba5cab640859531d72f13628c","src/secure/signed.rs":"26c46c2d561ea14d1d8d79f85342a98b4bd749df776677dde91dd9b928e91fbe"},"package":"1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf"}
{"files":{"Cargo.toml":"2c65ccbf56c2640abee1927d35423ade48e20588630ac31e094d434595ee80d8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"3fcac69759e004d729a868ed5ef248c84d86fb0f3ab5c7a93abb547b91a0eb4e","src/builder.rs":"4200963d44d1a59f1268965b77407ba977eb5a777875cb76ea927ddc829be3d8","src/delta.rs":"510fc3dbf0a70d635d0488c5a5a32a2ba8e1490ce05bee39d944ea8c02189bbc","src/draft.rs":"950b43b3f6e1c4c13b1e90220c71defe02713170807b41e5ffde9a1327688f48","src/jar.rs":"8cc6531203e2a9422bfe1b2a00aeb96beb57d4676fa147a66f28f2d7c3129b57","src/lib.rs":"6a267d63ad90998f4a463c726be6a93fc33979eb8a72bfb53cae9f5b7a13fae0","src/parse.rs":"549844993601f20f5de3f5d5f8bea0fce3fe4f09d72e343aff9e433948a4ec5c","src/secure/key.rs":"734f35ef4b0d6b63174befdcb970f0304ac63f0895871b7c2f267fefdd43b648","src/secure/macros.rs":"83d770e5c4eb7fbd3c3d86973b69042e9e2bb9fafb72a4456598e2ae78638d5f","src/secure/mod.rs":"5d7fecb62295827d474ed1ce6b7628fe93d4a09eb14babfde036d64e8e4a04f8","src/secure/private.rs":"81d782cd4fa4b1415795710ad9e2e77eca3f4326e20ef96675093db9a378da32","src/secure/signed.rs":"26c46c2d561ea14d1d8d79f85342a98b4bd749df776677dde91dd9b928e91fbe"},"package":"888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"}

8
third_party/rust/cookie/Cargo.toml поставляемый
Просмотреть файл

@ -3,7 +3,7 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
# to registry (e.g., crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
@ -12,7 +12,7 @@
[package]
name = "cookie"
version = "0.11.0"
version = "0.12.0"
authors = ["Alex Crichton <alex@alexcrichton.com>", "Sergio Benitez <sb@sergio.bz>"]
description = "Crate for parsing HTTP cookie headers and managing a cookie jar. Supports signed\nand private (encrypted + signed) jars.\n"
documentation = "https://docs.rs/cookie"
@ -21,11 +21,11 @@ repository = "https://github.com/alexcrichton/cookie-rs"
[package.metadata.docs.rs]
all-features = true
[dependencies.base64]
version = "0.9.0"
version = "0.10.0"
optional = true
[dependencies.ring]
version = "0.13.0"
version = "0.14.0"
optional = true
[dependencies.time]

4
third_party/rust/cookie/README.md поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
# cookie-rs
[![Build Status](https://travis-ci.org/alexcrichton/cookie-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/cookie-rs)
[![Build Status](https://travis-ci.com/SergioBenitez/cookie-rs.svg?branch=master)](https://travis-ci.com/SergioBenitez/cookie-rs)
[![Current Crates.io Version](https://img.shields.io/crates/v/cookie.svg)](https://crates.io/crates/cookie)
A library for parsing HTTP cookies and managing cookie jars.
@ -11,7 +11,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
cookie = "0.10"
cookie = "0.12"
```
See the [documentation](http://docs.rs/cookie) for detailed usage information.

10
third_party/rust/cookie/src/jar.rs поставляемый
Просмотреть файл

@ -344,7 +344,10 @@ impl CookieJar {
/// }
/// ```
pub fn iter(&self) -> Iter {
Iter { delta_cookies: self.delta_cookies.union(&self.original_cookies) }
Iter {
delta_cookies: self.delta_cookies.iter()
.chain(self.original_cookies.difference(&self.delta_cookies)),
}
}
/// Returns a `PrivateJar` with `self` as its parent jar using the key `key`
@ -439,12 +442,13 @@ impl<'a> Iterator for Delta<'a> {
}
}
use std::collections::hash_set::Union;
use std::collections::hash_set::Difference;
use std::collections::hash_map::RandomState;
use std::iter::Chain;
/// Iterator over all of the cookies in a jar.
pub struct Iter<'a> {
delta_cookies: Union<'a, DeltaCookie, RandomState>,
delta_cookies: Chain<HashSetIter<'a, DeltaCookie>, Difference<'a, DeltaCookie, RandomState>>,
}
impl<'a> Iterator for Iter<'a> {

4
third_party/rust/cookie/src/lib.rs поставляемый
Просмотреть файл

@ -10,7 +10,7 @@
//! Add the following to the `[dependencies]` section of your `Cargo.toml`:
//!
//! ```ignore
//! cookie = "0.11"
//! cookie = "0.12"
//! ```
//!
//! Then add the following line to your crate root:
@ -58,7 +58,7 @@
//! features = ["secure", "percent-encode"]
//! ```
#![doc(html_root_url = "https://docs.rs/cookie/0.11")]
#![doc(html_root_url = "https://docs.rs/cookie/0.12")]
#![deny(missing_docs)]
#[cfg(feature = "percent-encode")] extern crate url;

10
third_party/rust/cookie/src/secure/private.rs поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
use secure::ring::aead::{seal_in_place, open_in_place, Algorithm, AES_256_GCM};
use secure::ring::aead::{seal_in_place, open_in_place, Aad, Algorithm, Nonce, AES_256_GCM};
use secure::ring::aead::{OpeningKey, SealingKey};
use secure::ring::rand::{SecureRandom, SystemRandom};
use secure::{base64, Key};
@ -46,9 +46,11 @@ impl<'a> PrivateJar<'a> {
return Err("length of decoded data is <= NONCE_LEN");
}
let ad = name.as_bytes();
let ad = Aad::from(name.as_bytes());
let key = OpeningKey::new(ALGO, &self.key).expect("opening key");
let (nonce, sealed) = data.split_at_mut(NONCE_LEN);
let nonce = Nonce::try_assume_unique_for_key(nonce)
.expect("invalid length of `nonce`");
let unsealed = open_in_place(&key, nonce, ad, 0, sealed)
.map_err(|_| "invalid key/nonce/value: bad seal")?;
@ -156,9 +158,11 @@ impl<'a> PrivateJar<'a> {
let (nonce, in_out) = data.split_at_mut(NONCE_LEN);
SystemRandom::new().fill(nonce).expect("couldn't random fill nonce");
in_out[..cookie_val.len()].copy_from_slice(cookie_val);
let nonce = Nonce::try_assume_unique_for_key(nonce)
.expect("invalid length of `nonce`");
// Use cookie's name as associated data to prevent value swapping.
let ad = cookie.name().as_bytes();
let ad = Aad::from(cookie.name().as_bytes());
// Perform the actual sealing operation and get the output length.
seal_in_place(&key, nonce, ad, in_out, overhead).expect("in-place seal")

Просмотреть файл

@ -6806,6 +6806,33 @@
"bug_numbers": [1254099],
"description": "Generic histogram to track uptake of remote content like blocklists, settings or updates."
},
"THUNDERBIRD_GLODA_SIZE_MB": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never",
"kind": "linear",
"high": 1000,
"n_buckets": 40,
"description": "Gloda: size of global-messages-db.sqlite (MB)"
},
"THUNDERBIRD_CONVERSATIONS_TIME_TO_2ND_GLODA_QUERY_MS": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never",
"kind": "exponential",
"high": 10000,
"n_buckets": 30,
"description": "Conversations: time between the moment we click and the second gloda query returns (ms)"
},
"THUNDERBIRD_INDEXING_RATE_MSG_PER_S": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never",
"kind": "linear",
"high": 100,
"n_buckets": 20,
"description": "Gloda: indexing rate (message/s)"
},
"FX_GESTURE_INSTALL_SNAPSHOT_OF_PAGE": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],

Просмотреть файл

@ -138,14 +138,13 @@ def generate_JSON_definitions(output, *filenames):
We only support a single file.
"""
# Load the event data.
events = []
for filename in filenames:
try:
batch = parse_events.load_events(filename, True)
events.extend(batch)
except ParserError as ex:
print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr)
sys.exit(1)
if len(filenames) > 1:
raise Exception('We don\'t support loading from more than one file.')
try:
events = parse_events.load_events(filenames[0], True)
except ParserError as ex:
print("\nError processing events:\n" + str(ex) + "\n")
sys.exit(1)
event_definitions = OrderedDict()
for event in events:
@ -171,14 +170,13 @@ def generate_JSON_definitions(output, *filenames):
def main(output, *filenames):
# Load the event data.
events = []
for filename in filenames:
try:
batch = parse_events.load_events(filename, True)
events.extend(batch)
except ParserError as ex:
print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr)
sys.exit(1)
if len(filenames) > 1:
raise Exception('We don\'t support loading from more than one file.')
try:
events = parse_events.load_events(filenames[0], True)
except ParserError as ex:
print("\nError processing events:\n" + str(ex) + "\n")
sys.exit(1)
# Write the scalar data file.
print(banner, file=output)

Просмотреть файл

@ -34,14 +34,14 @@ file_footer = """\
def main(output, *filenames):
# Load the events first.
events = []
for filename in filenames:
try:
batch = parse_events.load_events(filename, True)
events.extend(batch)
except ParserError as ex:
print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr)
sys.exit(1)
if len(filenames) > 1:
raise Exception('We don\'t support loading from more than one file.')
try:
events = parse_events.load_events(filenames[0], True)
except ParserError as ex:
print("\nError processing events:\n" + str(ex) + "\n")
sys.exit(1)
grouped = dict()
index = 0

Просмотреть файл

@ -109,15 +109,14 @@ def write_scalar_tables(scalars, output):
def parse_scalar_definitions(filenames):
scalars = []
for filename in filenames:
try:
batch = parse_scalars.load_scalars(filename)
scalars.extend(batch)
except ParserError as ex:
print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr)
sys.exit(1)
return scalars
if len(filenames) > 1:
raise Exception('We don\'t support loading from more than one file.')
try:
return parse_scalars.load_scalars(filenames[0])
except ParserError as ex:
print("\nError processing scalars:\n" + str(ex) + "\n")
sys.exit(1)
def generate_JSON_definitions(output, *filenames):

Просмотреть файл

@ -35,14 +35,14 @@ file_footer = """\
def main(output, *filenames):
# Load the scalars first.
scalars = []
for filename in filenames:
try:
batch = parse_scalars.load_scalars(filename)
scalars.extend(batch)
except ParserError as ex:
print("\nError processing %s:\n%s\n" % (filename, str(ex)), file=sys.stderr)
sys.exit(1)
if len(filenames) > 1:
raise Exception('We don\'t support loading from more than one file.')
try:
scalars = parse_scalars.load_scalars(filenames[0])
except ParserError as ex:
print("\nError processing scalars:\n" + str(ex) + "\n")
sys.exit(1)
# Write the enum file.
print(banner, file=output)

Просмотреть файл

@ -691,7 +691,7 @@ def load_histograms_into_dict(ordered_pairs, strict_type_checks):
# just Histograms.json. For each file's basename, we have a specific
# routine to parse that file, and return a dictionary mapping histogram
# names to histogram parameters.
def from_json(filename, strict_type_checks):
def from_Histograms_json(filename, strict_type_checks):
with open(filename, 'r') as f:
try:
def hook(ps):
@ -731,17 +731,17 @@ def from_nsDeprecatedOperationList(filename, strict_type_checks):
return histograms
FILENAME_PARSERS = [
(lambda x: from_json if x.endswith('.json') else None),
(lambda x: from_nsDeprecatedOperationList if x == 'nsDeprecatedOperationList.h' else None),
]
FILENAME_PARSERS = {
'Histograms.json': from_Histograms_json,
'nsDeprecatedOperationList.h': from_nsDeprecatedOperationList,
}
# Similarly to the dance above with buildconfig, usecounters may not be
# available, so handle that gracefully.
try:
import usecounters
FILENAME_PARSERS.append(lambda x: from_UseCounters_conf if x == 'UseCounters.conf' else None)
FILENAME_PARSERS['UseCounters.conf'] = from_UseCounters_conf
except ImportError:
pass
@ -755,15 +755,7 @@ the histograms defined in filenames.
all_histograms = OrderedDict()
for filename in filenames:
parser = None
for checkFn in FILENAME_PARSERS:
parser = checkFn(os.path.basename(filename))
if parser is not None:
break
if parser is None:
ParserError("Don't know how to parse %s." % filename).handle_now()
parser = FILENAME_PARSERS[os.path.basename(filename)]
histograms = parser(filename, strict_type_checks)
# OrderedDicts are important, because then the iteration order over

Просмотреть файл

@ -29,7 +29,6 @@ SUPPORTED_PRODUCTS = {
'fennec': 'Fennec',
'geckoview': 'Geckoview',
'geckoview_streaming': 'GeckoviewStreaming',
'thunderbird': 'Thunderbird',
}
SUPPORTED_OPERATING_SYSTEMS = [

Просмотреть файл

@ -188,8 +188,6 @@ SupportedProduct GetCurrentProduct() {
} else {
return SupportedProduct::Fennec;
}
#elif defined(MOZ_THUNDERBIRD)
return SupportedProduct::Thunderbird;
#else
return SupportedProduct::Firefox;
#endif

Просмотреть файл

@ -39,7 +39,6 @@ enum class SupportedProduct : uint8_t {
Fennec = (1 << 1),
Geckoview = (1 << 2),
GeckoviewStreaming = (1 << 3),
Thunderbird = (1 << 4),
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(SupportedProduct);

Просмотреть файл

@ -402,6 +402,9 @@
"SYSTEM_FONT_FALLBACK_SCRIPT",
"TAP_TO_LOAD_ENABLED",
"TAP_TO_LOAD_IMAGE_SIZE",
"THUNDERBIRD_CONVERSATIONS_TIME_TO_2ND_GLODA_QUERY_MS",
"THUNDERBIRD_GLODA_SIZE_MB",
"THUNDERBIRD_INDEXING_RATE_MSG_PER_S",
"TLS_ERROR_REPORT_UI",
"TRANSLATED_CHARACTERS",
"TRANSLATED_PAGES",
@ -1036,6 +1039,9 @@
"TELEMETRY_TEST_KEYED_RELEASE_OPTOUT",
"TELEMETRY_TEST_RELEASE_OPTIN",
"TELEMETRY_TEST_RELEASE_OPTOUT",
"THUNDERBIRD_CONVERSATIONS_TIME_TO_2ND_GLODA_QUERY_MS",
"THUNDERBIRD_GLODA_SIZE_MB",
"THUNDERBIRD_INDEXING_RATE_MSG_PER_S",
"TLS_ERROR_REPORT_UI",
"TOTAL_CONTENT_PAGE_LOAD_TIME",
"TOTAL_COUNT_HIGH_ERRORS",

Просмотреть файл

@ -158,8 +158,6 @@ histogram_files = [
'/dom/base/UseCounters.conf',
'/dom/base/nsDeprecatedOperationList.h',
]
if CONFIG['MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES']:
histogram_files.extend(CONFIG['MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES'])
data = GENERATED_FILES['TelemetryHistogramData.inc']
data.script = 'build_scripts/gen_histogram_data.py'
@ -177,8 +175,6 @@ data.inputs = histogram_files
scalar_files = [
'Scalars.yaml',
]
if CONFIG['MOZ_TELEMETRY_EXTRA_SCALAR_FILES']:
scalar_files.extend(CONFIG['MOZ_TELEMETRY_EXTRA_SCALAR_FILES'])
scalar_data = GENERATED_FILES['TelemetryScalarData.h']
scalar_data.script = 'build_scripts/gen_scalar_data.py'
@ -201,8 +197,6 @@ FINAL_TARGET_FILES += ['!ScalarArtifactDefinitions.json']
event_files = [
'Events.yaml',
]
if CONFIG['MOZ_TELEMETRY_EXTRA_EVENT_FILES']:
event_files.extend(CONFIG['MOZ_TELEMETRY_EXTRA_EVENT_FILES'])
event_data = GENERATED_FILES['TelemetryEventData.h']
event_data.script = 'build_scripts/gen_event_data.py'

Просмотреть файл

@ -41,6 +41,10 @@
#include "common/mac/scoped_task_suspend-inl.h"
#include "google_breakpad/common/minidump_exception_mac.h"
#ifdef MOZ_PHC
#include "replace_malloc_bridge.h"
#endif
#include "mozilla/RecordReplay.h"
#ifndef __EXCEPTIONS
@ -348,6 +352,19 @@ bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child,
return result;
}
#ifdef MOZ_PHC
static void GetPHCAddrInfo(int64_t exception_subcode,
mozilla::phc::AddrInfo* addr_info) {
// Is this a crash involving a PHC allocation?
if (exception_subcode) {
// `exception_subcode` is only non-zero when it's a bad access, in which
// case it holds the address of the bad access.
char* addr = reinterpret_cast<char*>(exception_subcode);
ReplaceMalloc::IsPHCAllocation(addr, addr_info);
}
}
#endif
bool ExceptionHandler::WriteMinidumpWithException(
int exception_type,
int exception_code,
@ -363,6 +380,11 @@ bool ExceptionHandler::WriteMinidumpWithException(
exit_after_write = false;
#endif
mozilla::phc::AddrInfo addr_info;
#ifdef MOZ_PHC
GetPHCAddrInfo(exception_subcode, &addr_info);
#endif
if (directCallback_) {
if (directCallback_(callback_context_,
exception_type,
@ -377,7 +399,7 @@ bool ExceptionHandler::WriteMinidumpWithException(
if (exception_type && exception_code) {
// If this is a real exception, give the filter (if any) a chance to
// decide if this should be sent.
if (filter_ && !filter_(callback_context_, nullptr))
if (filter_ && !filter_(callback_context_, &addr_info))
return false;
result = crash_generation_client_->RequestDumpForException(
exception_type,
@ -418,7 +440,7 @@ bool ExceptionHandler::WriteMinidumpWithException(
// (rather than just writing out the file), then we should exit without
// forwarding the exception to the next handler.
if (callback_(dump_path_c_, next_minidump_id_c_, callback_context_,
nullptr, result)) {
&addr_info, result)) {
if (exit_after_write)
_exit(exception_type);
}

Просмотреть файл

@ -18,3 +18,5 @@ LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src',
]
if CONFIG['MOZ_PHC']:
DEFINES['MOZ_PHC'] = True

Просмотреть файл

@ -7,8 +7,9 @@ function check(extra, size) {
Assert.equal(extra.PHCUsableSize, size);
// These are strings holding comma-separated lists of decimal addresses.
Assert.ok(/^(\d+,)+\d+$/.test(extra.PHCAllocStack));
Assert.ok(/^(\d+,)+\d+$/.test(extra.PHCFreeStack));
// Sometimes on Mac they have a single entry.
Assert.ok(/^(\d+,)*\d+$/.test(extra.PHCAllocStack));
Assert.ok(/^(\d+,)*\d+$/.test(extra.PHCFreeStack));
}
function run_test() {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше