diff --git a/background/usercss-helper.js b/background/usercss-helper.js
index 8a9a3a0c..26bf92d8 100644
--- a/background/usercss-helper.js
+++ b/background/usercss-helper.js
@@ -27,24 +27,18 @@ var usercssHelper = (() => {
}
// Parse the source and find the duplication
- // style: {sourceCode: string, checkDup: boolean}
- function build(request, noReject) {
- const pending = buildMeta(request)
- .then(style => Promise.all([buildCode(style), checkDup(style)]))
+ function build({sourceCode, checkDup = false}, noReject) {
+ const pending = buildMeta({sourceCode})
+ .then(style => Promise.all([
+ buildCode(style),
+ checkDup && findDup(style)
+ ]))
.then(([style, dup]) => ({style, dup}));
if (noReject) {
return wrapReject(pending);
}
return pending;
-
- function checkDup(style) {
- const {checkDup} = style;
- delete style.checkDup;
- if (checkDup) {
- return findDup(style);
- }
- }
}
function save(style, noReject) {
diff --git a/content/install-user-css.js b/content/install-user-css.js
index 99c31496..8e4c61fc 100644
--- a/content/install-user-css.js
+++ b/content/install-user-css.js
@@ -1,14 +1,6 @@
+/* global runtimeSend */
'use strict';
-function runtimeSend(request) {
- return new Promise((resolve, reject) => {
- chrome.runtime.sendMessage(
- request,
- ({status, result}) => (status === 'error' ? reject : resolve)(result)
- );
- });
-}
-
function createSourceLoader() {
let source;
diff --git a/content/util.js b/content/util.js
new file mode 100644
index 00000000..c639440f
--- /dev/null
+++ b/content/util.js
@@ -0,0 +1,10 @@
+'use strict';
+
+function runtimeSend(request) {
+ return new Promise((resolve, reject) => {
+ chrome.runtime.sendMessage(
+ request,
+ ({status, result}) => (status === 'error' ? reject : resolve)(result)
+ );
+ });
+}
diff --git a/install-usercss.html b/install-usercss.html
index b2f6b78a..aa7762e1 100644
--- a/install-usercss.html
+++ b/install-usercss.html
@@ -83,6 +83,7 @@
+