Closed Bug 1314123 Opened 8 years ago Closed 7 years ago

block moz-extension from history?

Categories

(WebExtensions :: Request Handling, defect, P3)

49 Branch
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mixedpuppy, Unassigned)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [history]triaged)

Researching for something else, I ran across code that blocks various internal schemes from history. Should moz-extension be added to that list? https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsNavHistory.cpp#1146 https://dxr.mozilla.org/mozilla-central/source/mobile/android/components/build/nsAndroidHistory.cpp#377
Probably not. We already disable history in background and popup browsers. The URLs that actually open in tabs probably belong in history.
Priority: -- → P3
Whiteboard: triaged
Whiteboard: triaged
Component: WebExtensions: Untriaged → WebExtensions: Request Handling
Whiteboard: [history]triaged
Maybe this should just be documented in MDN for browser.extension.getURL that the following code fixes this use case. browser.tabs.create({url: confirmUrl, cookieStoreId: `firefox-container-${userContextId}`, index}).then(() => { // We don't want to sync this URL ever nor clutter the users history browser.history.deleteUrl({url: confirmUrl}); }).catch((e) => { throw e }); Another option would be to make tabs.create have the ability to prevent history but probably that would be unreliable. Seems a shame that the above use-case would require a "history" permission though as it's managing the extension pages history only.
Marking as wont fix based on comment 1, we don't really know why a user opened a moz-extension page, but its a page opened in the browser, let's keep it around. Added dev-doc-need to see if its worth comment as per comment 2.
Status: NEW → RESOLVED
Closed: 7 years ago
Keywords: dev-doc-needed
Resolution: --- → WORKSFORME
Looks good to me thanks for this :wbamberg!
Flags: needinfo?(jkt)
(In reply to Jonathan Kingston [:jkt] from comment #2) > Maybe this should just be documented in MDN for browser.extension.getURL > that the following code fixes this use case. > > browser.tabs.create({url: confirmUrl, cookieStoreId: > `firefox-container-${userContextId}`, index}).then(() => { > // We don't want to sync this URL ever nor clutter the users history > browser.history.deleteUrl({url: confirmUrl}); > }).catch((e) => { throw e }); > > Another option would be to make tabs.create have the ability to prevent > history but probably that would be unreliable. > > Seems a shame that the above use-case would require a "history" permission > though as it's managing the extension pages history only. Hi, as you suggested this workaround, do you know why this only works for browser.tabs.create() and not for browser.tabs.update()? In New Tab Override I need both because it's the only workaround (yes, another workaround…) I know to set the focus either to the website or to the address bar. Code example: async openNewTabPage (url, focus_website) { // set focus on website if (focus_website) { await browser.tabs.getCurrent((tab) => { const tabId = tab.id; browser.tabs.create({ url : url || 'about:blank' }, () => { browser.tabs.remove(tabId); }); }); } // set focus on address bar else { await browser.tabs.update({ url : url || 'about:blank' }); } // delete spammy new tab page entry from history browser.history.deleteUrl({ url : browser.extension.getURL(NEW_TAB_PAGE) }); } With focus_website = true it works as expected, no NEW_TAB_PAGE entry in the history. With focus_website = false the entry in the history remains. Is this expected behaviour and how can I get rid of this history spam? Thank you
Flags: needinfo?(jkt)
I'm not sure as I haven't used update and delete together before. Why not use: browser.history.deleteUrl({ url: url }); ? Perhaps there is a bug, I'm not sure sorry.
Flags: needinfo?(jkt)
I use browser.history.deleteUrl({ url : browser.extension.getURL(NEW_TAB_PAGE) }); as you can see in my code example but it doesn't work after browser.tabs.update() (but it works after browser.tabs.create()). I'll file a new bug, thank you for your answer.
Resolution: WORKSFORME → WONTFIX
Yang, you closed this "per comment 3", which says that you "don't know why the user opened a moz-extension page", as if it was a conscious choice to open it and keep it in the history. However, I gave you the reason. It's the URI used by the settings of new web extensions. We do not want them to be added to the history. Other browsers that support webextensions don't do this.
(In reply to Hide my Email from comment #11) > Yang, you closed this "per comment 3", which says that you "don't know why > the user opened a moz-extension page", as if it was a conscious choice to > open it and keep it in the history. > > However, I gave you the reason. It's the URI used by the settings of new web > extensions. We do not want them to be added to the history. Other browsers > that support webextensions don't do this. Per for the "Marking as wont fix based on comment 1". "we don't really know why a user opened a moz-extension page" means the software internal. Google Chrome record and display the history for "chrome-extension://".
Since comment 0 also mentioned > nsAndroidHistory.cpp#377 (In reply to Kris Maglione [:kmag] (long backlog; ping on IRC if you're blocked) from comment #1) > Probably not. We already disable history in background and popup browsers. > The URLs that actually open in tabs probably belong in history. One problem with this is that things that are popups on Desktop open in a new tab on Fennec and then end up in history after all. Although if we want to do something Fennec-specific in the end, I'd suggest continuing the discussion in bug 1418657.
Is it possible to do it by extension?
(In reply to Krasnaya Ploshchad’ from comment #16) > Is it possible to do it by extension? Yes, e.g. https://github.com/danny0838/content-farm-terminator/commit/ccabf5960aecdac750547e444d163d731c75bc94.
See Also: → 1432423
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.