Bug 1408993 - Allow tabs.create to create URLS in reader mode, r=mixedpuppy

MozReview-Commit-ID: B5Nk0ZVvQIC

--HG--
extra : rebase_source : 6f515ef1dbc110c35b527e06f269ae703bb77468
This commit is contained in:
Bob Silverberg 2017-10-16 10:42:45 -04:00
Родитель dd30784f5b
Коммит 272fe41a5f
3 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -346,6 +346,10 @@ this.tabs = class extends ExtensionAPI {
if (!context.checkLoadURL(url, {dontReportErrors: true})) {
return Promise.reject({message: `Illegal URL: ${url}`});
}
if (createProperties.openInReaderMode) {
url = `about:reader?url=${encodeURIComponent(url)}`;
}
}
if (createProperties.cookieStoreId && !extension.hasPermission("cookies")) {

Просмотреть файл

@ -497,7 +497,10 @@
"type": "string",
"optional": true,
"description": "The CookieStoreId for the tab that opened this tab."
}
},
"openInReaderMode": {
"type": "boolean",
"optional": true, "description": "Whether the document in the tab should be opened in reader mode."}
}
},
{

Просмотреть файл

@ -59,6 +59,10 @@ add_task(async function test_create_options() {
create: {url: "blank.html"},
result: {url: browser.runtime.getURL("bg/blank.html")},
},
{
create: {url: "http://example.com/", openInReaderMode: true},
result: {url: `about:reader?url=${encodeURIComponent("http://example.com/")}`},
},
{
create: {},
result: {url: "about:newtab"},