Closed Bug 1408993 Opened 3 years ago Closed 3 years ago

Allow tabs.create to open URLS in reader mode

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(firefox58 fixed)

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: bsilverberg, Assigned: bsilverberg)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

I am spinning this off from bug 1371793 because that is more general being about the ability to create a number of different types of about: URLs.

For the reader mode API support we are only interested in the ability to call tabs.create with an about:reader URL, so I am narrowing the scope for this bug. Some discussion has already occurred in bug 1371793, and a security review has been opened via bug 1390035.
Note that this is still awaiting a security review (bug 1390035), but if we can finalize the implementation via this bug that might help facilitate the sec-review.
Summary: Allow tabs.create to creats about:reader URLS. → Allow tabs.create to create about:reader URLS.
Is the proposal that extensions actually constructor about:reader urls?  I think that if we can avoid exposing the url structure that would be good, since there's now a reader more property in Tab objects, how about just adding the same property to create options and creating an appropriate reader url if it is set to true?
(In reply to Andrew Swan [:aswan] from comment #3)
> Is the proposal that extensions actually constructor about:reader urls?  I
> think that if we can avoid exposing the url structure that would be good,
> since there's now a reader more property in Tab objects, how about just
> adding the same property to create options and creating an appropriate
> reader url if it is set to true?

That is a very good idea. I will update the patch accordingly.
Summary: Allow tabs.create to create about:reader URLS. → Allow tabs.create to open URLS in reader mode
Comment on attachment 8918916 [details]
Bug 1408993 - Allow tabs.create to create URLS in reader mode,

https://reviewboard.mozilla.org/r/189816/#review194962

r+ with fix

::: browser/components/extensions/ext-tabs.js:351
(Diff revision 2)
>                if (!context.checkLoadURL(url, {dontReportErrors: true})) {
>                  return Promise.reject({message: `Illegal URL: ${url}`});
>                }
> +
> +              if (createProperties.openInReaderMode) {
> +                url = `about:reader?url=${url}`;

${encodeURIComponent(url)}
Attachment #8918916 - Flags: review?(mixedpuppy) → review+
Comment on attachment 8918916 [details]
Bug 1408993 - Allow tabs.create to create URLS in reader mode,

https://reviewboard.mozilla.org/r/189816/#review194962

> ${encodeURIComponent(url)}

Thanks Shane.
Pushed by bsilverberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/beb6d23925c0
Allow tabs.create to create URLS in reader mode, r=mixedpuppy
https://hg.mozilla.org/mozilla-central/rev/beb6d23925c0
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Is manual testing required on this bug? If yes, please provide some STR and the proper extension(if required) or set the “qe-verify -“ flag.

Thanks!
Flags: needinfo?(bob.silverberg)
Flags: needinfo?(bob.silverberg) → qe-verify-
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.