Skip to content

Commit

Permalink
Add advanced setting to control logger popup type
Browse files Browse the repository at this point in the history
Related issue:
- uBlockOrigin/uBlock-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
  • Loading branch information
gorhill committed Sep 6, 2019
1 parent 5688888 commit bcf5ac1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions platform/chromium/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const µBlock = (function() { // jshint ignore:line
disableWebAssembly: false,
ignoreRedirectFilters: false,
ignoreScriptInjectFilters: false,
loggerPopupType: 'popup',
manualUpdateAssetFetchPeriod: 500,
popupFontSize: 'unset',
requestJournalProcessPeriod: 1000,
Expand Down
4 changes: 2 additions & 2 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcf5ac1

Please sign in to comment.