Closed
Bug 1314123
Opened 8 years ago
Closed 7 years ago
block moz-extension from history?
Categories
(WebExtensions :: Request Handling, defect, P3)
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
Comment 1•8 years ago
|
||
Probably not. We already disable history in background and popup browsers. The URLs that actually open in tabs probably belong in history.
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: triaged
Updated•8 years ago
|
Whiteboard: triaged
Updated•8 years ago
|
Component: WebExtensions: Untriaged → WebExtensions: Request Handling
Whiteboard: [history]triaged
Comment 2•8 years ago
|
||
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.
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
This page: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Bundled_web_pages seemed like the best place to put it:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Bundled_web_pages#Bundled_pages_and_history
Let me know if this covers it.
Flags: needinfo?(jkt)
Updated•7 years ago
|
Keywords: dev-doc-needed → dev-doc-complete
Comment 6•7 years ago
|
||
(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)
Comment 7•7 years ago
|
||
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)
Comment 8•7 years ago
|
||
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.
Comment 11•7 years ago
|
||
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.
Comment 12•7 years ago
|
||
(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://".
Comment 13•7 years ago
|
||
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.
Comment 16•7 years ago
|
||
Is it possible to do it by extension?
Comment 17•7 years ago
|
||
(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.
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•