Add advanced setting to control logger popup type

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/663

The advanced setting `loggerPopupType` has been added, to
control the type of window to be used when the logger is
launched as a separate window.

The default value is `popup`, it can be changed to any of
the values documented at:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/CreateType
This commit is contained in:
Raymond Hill 2019-09-06 11:41:07 -04:00
parent 5688888ec1
commit bcf5ac1fee
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 10 additions and 9 deletions

View File

@ -387,11 +387,11 @@ vAPI.Tabs = class {
// Properties of the details object: // Properties of the details object:
// - url: 'URL', => the address that will be opened // - url: 'URL', => the address that will be opened
// - index: -1, => undefined: end of the list, -1: following tab, or // - index: -1, => undefined: end of the list, -1: following tab,
// after index // or after index
// - active: false, => opens the tab in background - true and undefined: // - active: false, => opens the tab... in background: true,
// foreground // foreground: undefined
// - popup: true => open in a new window // - popup: 'popup' => open in a new window
create(url, details) { create(url, details) {
if ( details.active === undefined ) { if ( details.active === undefined ) {
@ -443,10 +443,10 @@ vAPI.Tabs = class {
// For some reasons, some platforms do not honor the left,top // For some reasons, some platforms do not honor the left,top
// position when specified. I found that further calling // position when specified. I found that further calling
// windows.update again with the same position _may_ help. // windows.update again with the same position _may_ help.
if ( details.popup === true && browser.windows instanceof Object ) { if ( details.popup !== undefined && browser.windows instanceof Object ) {
const createDetails = { const createDetails = {
url: details.url, url: details.url,
type: 'popup', type: details.popup,
}; };
if ( details.box instanceof Object ) { if ( details.box instanceof Object ) {
Object.assign(createDetails, details.box); Object.assign(createDetails, details.box);

View File

@ -52,6 +52,7 @@ const µBlock = (function() { // jshint ignore:line
disableWebAssembly: false, disableWebAssembly: false,
ignoreRedirectFilters: false, ignoreRedirectFilters: false,
ignoreScriptInjectFilters: false, ignoreScriptInjectFilters: false,
loggerPopupType: 'popup',
manualUpdateAssetFetchPeriod: 500, manualUpdateAssetFetchPeriod: 500,
popupFontSize: 'unset', popupFontSize: 'unset',
requestJournalProcessPeriod: 1000, requestJournalProcessPeriod: 1000,

View File

@ -386,8 +386,8 @@
!this.userSettings.alwaysDetachLogger !this.userSettings.alwaysDetachLogger
); );
} }
details.popup = this.userSettings.alwaysDetachLogger; if ( this.userSettings.alwaysDetachLogger ) {
if ( details.popup ) { details.popup = this.hiddenSettings.loggerPopupType;
const url = new URL(vAPI.getURL(details.url)); const url = new URL(vAPI.getURL(details.url));
url.searchParams.set('popup', '1'); url.searchParams.set('popup', '1');
details.url = url.href; details.url = url.href;