- commit
- eb3814810a623dc75a02f64339f140305c7d788c
- parent
- 8abf86040f55578052ccdf824fa9b8cdb1800425
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-01-16 21:26
provide own createTab to fix open links in browsers
Diffstat
| M | background.js | 2 | +- |
| M | experiment-api/api.js | 8 | ++++++++ |
| M | experiment-api/schema.json | 8 | ++++++++ |
3 files changed, 17 insertions, 1 deletions
diff --git a/background.js b/background.js
@@ -1,5 +1,5 @@ 1 1 /* global browser */ 2 2 3 3 browser.xi.onOpenTab.addListener(uris => {4 -1 browser.tabs.create({url: '/content/main.html?uris=' + encodeURIComponent(uris)});-1 4 browser.xi.createTab('/content/main.html?uris=' + encodeURIComponent(uris)); 5 5 });
diff --git a/experiment-api/api.js b/experiment-api/api.js
@@ -125,6 +125,14 @@ var xi = class extends ExtensionCommon.ExtensionAPI {
125 125 var attInfo = new win.AttachmentInfo(null, url, params.filename, msg2uri(msgHdr));
126 126 attInfo.save();
127 127 },
-1 128 createTab(url) {
-1 129 let win = Services.wm.getMostRecentWindow("mail:3pane");
-1 130 let nativeTabInfo = win.openTab("contentTab", {
-1 131 url: context.uri.resolve(url),
-1 132 linkHandler: "single-page",
-1 133 principal: context.extension.principal,
-1 134 });
-1 135 },
128 136 onOpenTab: new ExtensionCommon.EventManager({
129 137 context,
130 138 name: 'xi.onOpenTab',
diff --git a/experiment-api/schema.json b/experiment-api/schema.json
@@ -48,6 +48,14 @@ 48 48 "name": "url", 49 49 "type": "string" 50 50 }] -1 51 }, { -1 52 "name": "createTab", -1 53 "type": "function", -1 54 "async": false, -1 55 "parameters": [{ -1 56 "name": "url", -1 57 "type": "string" -1 58 }] 51 59 }], 52 60 "events": [{ 53 61 "name": "onOpenTab",