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:
// - url: 'URL', => the address that will be opened
// - index: -1, => undefined: end of the list, -1: following tab, or
// after index
// - active: false, => opens the tab in background - true and undefined:
// foreground
// - popup: true => open in a new window
// - index: -1, => undefined: end of the list, -1: following tab,
// or after index
// - active: false, => opens the tab... in background: true,
// foreground: undefined
// - popup: 'popup' => open in a new window
create(url, details) {
if ( details.active === undefined ) {
@ -443,10 +443,10 @@ vAPI.Tabs = class {
// For some reasons, some platforms do not honor the left,top
// position when specified. I found that further calling
// 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 = {
url: details.url,
type: 'popup',
type: details.popup,
};
if ( details.box instanceof Object ) {
Object.assign(createDetails, details.box);

View File

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

View File

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