Skip to content

Commit ef4e76f

Browse files
[FB] SSB | Enable SSB on default
1 parent d8eda3b commit ef4e76f

File tree

6 files changed

+52
-61
lines changed

6 files changed

+52
-61
lines changed

browser/base/content/appmenu-viewcache.inc.xhtml

-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
command="Tools:PrivateBrowsing"/>
5757
<toolbarseparator/>
5858
<!-- Floorp Injections +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
59-
#ifdef FLOORP_OFFICIAL_COMPONENTS_ENABLED
6059
<toolbarbutton id="appMenu-ssb-button"
6160
class="subviewbutton subviewbutton-nav"
6261
data-l10n-id="appmenuitem-webapps"
@@ -90,7 +89,6 @@
9089
oncommand=""
9190
hidden="true"/>
9291
</panelview>
93-
#endif
9492
<!-- Floorp Injections +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
9593

9694
<toolbarbutton id="appMenu-bookmarks-button"

browser/base/content/browser.js

+47-54
Original file line numberDiff line numberDiff line change
@@ -2383,73 +2383,66 @@ var gBrowserInit = {
23832383

23842384
/*** Floorp Injections *********************************************************************************************/
23852385

2386-
var { FloorpAppConstants } = ChromeUtils.importESModule(
2387-
"resource:///modules/FloorpAppConstants.sys.mjs"
2388-
);
2386+
if (uri) {
2387+
try {
2388+
// If the URI has "?FloorpEnableSSBWindow=true" at the end, The window will be opened as a SSB window.
2389+
if (uri.endsWith("?FloorpEnableSSBWindow=true")) {
2390+
let parseSsbArgs = uri.split(",");
2391+
let id = parseSsbArgs[1];
23892392

2390-
if (FloorpAppConstants.FLOORP_OFFICIAL_COMPONENTS_ENABLED) {
2391-
if (uri) {
2392-
try {
2393-
// If the URI has "?FloorpEnableSSBWindow=true" at the end, The window will be opened as a SSB window.
2394-
if (uri.endsWith("?FloorpEnableSSBWindow=true")) {
2395-
let parseSsbArgs = uri.split(",");
2396-
let id = parseSsbArgs[1];
2393+
// Replace start uri
2394+
uri = parseSsbArgs[0];
23972395

2398-
// Replace start uri
2399-
uri = parseSsbArgs[0];
2396+
document.documentElement.setAttribute(
2397+
"FloorpEnableSSBWindow",
2398+
"true"
2399+
);
24002400

2401-
document.documentElement.setAttribute(
2402-
"FloorpEnableSSBWindow",
2403-
"true"
2404-
);
2401+
document.documentElement.setAttribute(
2402+
"FloorpSSBId",
2403+
id
2404+
);
24052405

2406-
document.documentElement.setAttribute(
2407-
"FloorpSSBId",
2408-
id
2409-
);
2406+
// Add SSB Window or Tab Attribute
2407+
// This attribute is used to make do not restore the window or tab when the browser is restarted.
2408+
window.floorpSsbWindow = true;
24102409

2411-
// Add SSB Window or Tab Attribute
2412-
// This attribute is used to make do not restore the window or tab when the browser is restarted.
2413-
window.floorpSsbWindow = true;
2414-
2415-
SessionStore.promiseInitialized.then(() => {
2416-
// Load SSB Support Script & CSS
2417-
gBrowser.tabs.forEach(tab => {
2418-
tab.setAttribute("floorpSSB", "true");
2419-
});
2420-
window.gBrowser.floorpSsbWindow = true;
2421-
Services.scriptloader.loadSubScript(
2422-
"chrome://browser/content/browser-ssb-support.js",
2423-
this
2424-
);
2410+
SessionStore.promiseInitialized.then(() => {
2411+
// Load SSB Support Script & CSS
2412+
gBrowser.tabs.forEach(tab => {
2413+
tab.setAttribute("floorpSSB", "true");
24252414
});
2426-
}
2427-
} catch (e) {
2428-
console.error(e);
2415+
window.gBrowser.floorpSsbWindow = true;
2416+
Services.scriptloader.loadSubScript(
2417+
"chrome://browser/content/browser-ssb-support.js",
2418+
this
2419+
);
2420+
});
24292421
}
2422+
} catch (e) {
2423+
console.error(e);
24302424
}
2425+
}
24312426

2432-
const SsbPrefName = "browser.ssb.startup";
2433-
let needSsbOpenWindow = Services.prefs.prefHasUserValue(SsbPrefName);
2434-
if (needSsbOpenWindow) {
2435-
let id = Services.prefs.getStringPref(SsbPrefName);
2436-
var { SiteSpecificBrowserIdUtils } = ChromeUtils.import(
2437-
"resource:///modules/SiteSpecificBrowserIdUtils.jsm"
2438-
);
2427+
const SsbPrefName = "browser.ssb.startup";
2428+
let needSsbOpenWindow = Services.prefs.prefHasUserValue(SsbPrefName);
2429+
if (needSsbOpenWindow) {
2430+
let id = Services.prefs.getStringPref(SsbPrefName);
2431+
var { SiteSpecificBrowserIdUtils } = ChromeUtils.import(
2432+
"resource:///modules/SiteSpecificBrowserIdUtils.jsm"
2433+
);
24392434

2440-
try {
2441-
window.setTimeout(() => {
2442-
SiteSpecificBrowserIdUtils.runSsbById(id);
2443-
Services.prefs.clearUserPref(SsbPrefName);
2444-
window.minimize();
2445-
}, 2000);
2446-
} catch (e) {
2447-
console.error(e);
2448-
}
2435+
try {
2436+
window.setTimeout(() => {
2437+
SiteSpecificBrowserIdUtils.runSsbById(id);
2438+
Services.prefs.clearUserPref(SsbPrefName);
2439+
window.minimize();
2440+
}, 2000);
2441+
} catch (e) {
2442+
console.error(e);
24492443
}
24502444
}
24512445

2452-
24532446
/******************************************************************************************************************/
24542447

24552448
if (!uri || window.XULElement.isInstance(uri)) {

browser/base/content/browser.xhtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@
149149
#include unified-extensions-viewcache.inc.xhtml
150150

151151
#include ../../../floorp/browser/base/content/browser-manager-sidebar-context.inc.xhtml
152+
#include ../../../floorp/browser/base/content/browser-ssb-context.inc.xhtml
152153

153154
#ifdef FLOORP_OFFICIAL_COMPONENTS_ENABLED
154-
#include ../../../floorp/Floorp-private-components/browser/base/content/browser-ssb-context.inc.xhtml
155155
#include ../../../floorp/Floorp-private-components/browser/base/content/browser-workspaces-context-menu.xhtml
156156
#endif
157157

browser/components/preferences/preferences.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ function init_all() {
222222
register_module("paneLepton", gLeptonPane);
223223
register_module("paneNotes", gNotesPane);
224224
register_module("paneBSB", gBSBPane);
225+
register_module("paneSsb", gSsbPane);
225226
register_module("paneDownloads", gDownloads);
226227
register_module("paneUserjs", gUserjsPane);
227228

@@ -233,7 +234,6 @@ function init_all() {
233234
if (FloorpAppConstants.FLOORP_OFFICIAL_COMPONENTS_ENABLED) {
234235
register_module("paneCSK", gCSKPane)
235236
register_module("paneWorkspaces", gWorkspacesPane);
236-
register_module("paneSsb", gSsbPane);
237237
}
238238

239239
if (Services.prefs.getBoolPref("browser.preferences.experimental")) {

browser/components/preferences/preferences.xhtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
<image class="category-icon"/>
149149
<label class="category-name" flex="1" data-l10n-id="category-CSK-title"></label>
150150
</richlistitem>
151+
#endif
151152
<richlistitem id="category-ssb"
152153
class="category"
153154
value="paneSsb"
@@ -158,7 +159,6 @@
158159
<image class="category-icon"/>
159160
<label class="category-name" flex="1" data-l10n-id="category-ssb-title"></label>
160161
</richlistitem>
161-
#endif
162162
<richlistitem id="category-home"
163163
class="category"
164164
value="paneHome"
@@ -302,14 +302,14 @@
302302

303303
#include ../../../floorp/browser/components/preferences/downloads.inc.xhtml
304304
#include ../../../floorp/browser/components/preferences/notes.inc.xhtml
305+
#include ../../../floorp/browser/components/preferences/ssb.inc.xhtml
305306
#include ../../../floorp/browser/components/preferences/bsb.inc.xhtml
306307
#include ../../../floorp/browser/components/preferences/userjs.inc.xhtml
307308
#include ../../../floorp/browser/components/preferences/design.inc.xhtml
308309
#include ../../../floorp/browser/components/preferences/lepton.inc.xhtml
309310

310311
#ifdef FLOORP_OFFICIAL_COMPONENTS_ENABLED
311312
#include ../../../floorp/browser/components/preferences/csk.inc.xhtml
312-
#include ../../../floorp/browser/components/preferences/ssb.inc.xhtml
313313
#include ../../../floorp/browser/components/preferences/workspaces.inc.xhtml
314314
#endif
315315

0 commit comments

Comments
 (0)