summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-16 13:13:04 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-16 21:43:35 -0500
commit2c3f510010ca2910b8c227a9888e2c3584840402 (patch)
tree253ec4be97869bfe7248639b0c64ac95ddd8f9f2 /ext/bg
parent1c6ed1d2866d9912b3b65d9e5addf710a6f26b38 (diff)
Allow apiInjectStylesheet to inject a URL
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/backend.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index d1a34f82..eeed841c 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -499,19 +499,28 @@ class Backend {
return Promise.resolve({frameId});
}
- _onApiInjectStylesheet({css}, sender) {
+ _onApiInjectStylesheet({type, value}, sender) {
if (!sender.tab) {
return Promise.reject(new Error('Invalid tab'));
}
const tabId = sender.tab.id;
const frameId = sender.frameId;
- const details = {
- code: css,
- runAt: 'document_start',
- cssOrigin: 'user',
- allFrames: false
- };
+ const details = (
+ type === 'file' ?
+ {
+ file: value,
+ runAt: 'document_start',
+ cssOrigin: 'author',
+ allFrames: false
+ } :
+ {
+ code: value,
+ runAt: 'document_start',
+ cssOrigin: 'user',
+ allFrames: false
+ }
+ );
if (typeof frameId === 'number') {
details.frameId = frameId;
}