piroor / copy-selected-tabs-to-clipboard

Provides ability to copy title and URL of selected tabs to the clipboard for Firefox 63 and later.
Other
75 stars 15 forks source link

Not processing Firefox addon pages when %DESCRIPTION% is in pattern #14

Closed DavidMcRitchie closed 3 years ago

DavidMcRitchie commented 3 years ago

Short description

Firefox Addon pages are not included in output, if there is output, when %DESCRIPTION% is in pattern. Descriptions are in the addon pages, easier to view source (Ctrl+U) in Chrome, as view in Firefox is almost all in a single line. Can see descriptions with a bookmarklet as well. The plain vanilla HTML link works, it has no %DESCRIPTION% in pattern

Steps to reproduce

Some URLs to test with https://addons.mozilla.org/en-US/firefox/addon/remove-google-redirections/ https://addons.mozilla.org/en-US/firefox/addon/search_by_image/ https://addons.mozilla.org/en-US/firefox/addon/search-by-image-on-google/ view-source:https://addons.mozilla.org/en-US/firefox/addon/search-by-image-on-google/ https://addons.mozilla.org/en-US/firefox/addon/tineye-reverse-image-search/ about:newtab http://dmcritchie.mvps.org/dolphin/lesson_from_newtab.htm https://addons.mozilla.org/en-US/firefox/addon/view-page-archive/

Pattern: (sorry, still don't know how to enter code, ^ is substituted for < ) ^a href="%URL_HTML%" title="%DESCRIPTION_HTML%">%TITLE_HTML%^/a>%RT%

same as plain vanilla link with title="%DESCRIPTION_HTML%" added

Expected result

All tabs processed

Actual result

No output for addons when %DESCRIPTION% is included May process all others or be likely to fail to process all urls when addons are included in selection

No problem if all that are selected are not Firefox addons

Environment

piroor commented 3 years ago

Thanks! With the commit 816117e now such special placeholders are filled with blank string if the tab has no permission to execute content scripts.

DavidMcRitchie commented 3 years ago

A bit disconcerting as Description is in the pages, and Google can see it, and you would have to put in an error indication for me to really notice immediately that output is not what I expect from some pages.

Does it have anything to do with data-react-helmet which appears both in TITLE and META.

Is there a configuration option that you know of to change that. I have no idea what we're supposedly being protected from.

I used old Firefox and old Multiple Tab Handler to work on my web pages as my source is on another computer. I'm not really using new Firefox even though Extensions are coming back, but then learned Mozilla was dropping Bookmark Descriptions, so 56.0.2 on that computer, and the small computer I use the most is strictly for browsing and email.

Must have been very rough on you as a developer.

DavidMcRitchie commented 3 years ago

Found: (have to figure out what it means and what to change) https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_security_policy

extensions.webextensions.base-content-security-policy
script-src 'self' https:// moz-extension: blob: filesystem: 'unsafe-eval' 'unsafe-inline'; object-src 'self' https:// moz-extension: blob: filesystem:;

extensions.webextensions.default-content-security-policy
script-src 'self'; object-src 'self';

piroor commented 3 years ago

I like a blank text instead of error information when failed to get content text due to some reasons, but your idea is also reasonable, so I've added an option to do that with commits 80b36b8 and e68e432.

piroor commented 3 years ago

Content Security Policy is not related to the problem failing to get content text. It just allows to load remote resources into pages (panels, popups, the options page, etc.) contained in this addon.

This addon uses a content script to fetch description of the page because it is not exposed via regular WebExtensions API. But content scripts cannot be executed on some special webpages including addons.mozilla.org due to security reasons.