[Pkg-mozext-commits] [tabmixplus] 04/22: Follow up bug 1363977 - Have loadTabs() provide the correct triggeringPrincipal

David Prévot taffit at moszumanska.debian.org
Sat Aug 5 15:28:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 0.5.0.4pre.170625a1
in repository tabmixplus.

commit 8444522ff72e5f487709f4d0f207ac90e1e7929e
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Jun 19 18:35:18 2017 +0300

    Follow up bug 1363977 - Have loadTabs() provide the correct triggeringPrincipal
---
 chrome/content/minit/minit.js   |  9 +++++++--
 chrome/content/places/places.js | 17 ++++++++++++++---
 modules/Places.jsm              |  2 +-
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index 2e5ff0d..9a81531 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -608,14 +608,19 @@ var TMP_tabDNDObserver = {
       }
       if (Tabmix.isVersion(520)) {
         let urls = links.map(link => link.url);
-        gBrowser.tabContainer.tabbrowser.loadTabs(urls, {
+        let params = {
           inBackground: bgLoad,
           replace: replaceCurrentTab,
           allowThirdPartyFixup: true,
           targetTab: tab,
           newIndex: newIndex + left_right,
           userContextId: gBrowser.tabContainer.selectedItem.getAttribute("usercontextid"),
-        });
+        };
+        if (Tabmix.isVersion(550)) {
+          params.triggeringPrincipal = dt.mozSourceNode ?
+            dt.mozSourceNode.nodePrincipal : Services.scriptSecurityManager.getSystemPrincipal();
+        }
+        gBrowser.tabContainer.tabbrowser.loadTabs(urls, params);
       } else if (!replaceCurrentTab) {
         // We're adding a new tab.
         let newTab = gBrowser.loadOneTab(url, {
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 536d750..38e386c 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -290,7 +290,14 @@ var TMP_Places = {
           const browser = aTab.linkedBrowser;
           try {
             browser.userTypedValue = url;
-            browser.loadURI(url);
+            if (Tabmix.isVersion(550)) {
+              browser.loadURIWithFlags(url, {
+                flags: Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
+                triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
+              });
+            } else {
+              browser.loadURI(url);
+            }
           } catch (ex) { }
         }
         this.resetRestoreState(aTab);
@@ -302,12 +309,16 @@ var TMP_Places = {
         } else
           aTab.setAttribute("reloadcurrent", true);
       } else {
-        aTab = gBrowser.addTab(loadProgressively ? "about:blank" : url, {
+        let params = {
           skipAnimation: multiple,
           noInitialLabel: true,
           dontMove: true,
           forceNotRemote: loadProgressively,
-        });
+        };
+        if (Tabmix.isVersion(550)) {
+          params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
+        }
+        aTab = gBrowser.addTab(loadProgressively ? "about:blank" : url, params);
       }
       this.setTabTitle(aTab, url, bmIds[i]);
       if (Tabmix.isVersion(550)) {
diff --git a/modules/Places.jsm b/modules/Places.jsm
index 56a6206..7ef6bc9 100644
--- a/modules/Places.jsm
+++ b/modules/Places.jsm
@@ -111,7 +111,7 @@ PlacesUtilsInternal = {
         /let openGroupBookmarkBehavior =|TSTOpenGroupBookmarkBehavior =/,
         '$& behavior =', {check: treeStyleTab, silent: true}
       )._replace(
-        'browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);',
+        /browserWindow\.gBrowser\.loadTabs\([^;]+;/,
         'var changeWhere = where == "tabshifted" && aEvent.target.localName != "menuitem";\n' +
         '    if (changeWhere)\n' +
         '      where = "current";\n' +

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list