diff --git a/examples/test-addon/bin/bundle-shield-studies-addon-utils.sh b/examples/test-addon/bin/bundle-shield-studies-addon-utils.sh index dd3c041..9ea9201 100755 --- a/examples/test-addon/bin/bundle-shield-studies-addon-utils.sh +++ b/examples/test-addon/bin/bundle-shield-studies-addon-utils.sh @@ -7,10 +7,10 @@ set -o errexit script_path=`dirname $0` cd "$script_path/../../" -# bundle the shieldUtils web extension experiment -mkdir -p test-addon/src/privileged/shieldUtils -cp webExtensionApis/shieldUtils/api.js test-addon/src/privileged/shieldUtils/api.js -cp webExtensionApis/shieldUtils/schema.json test-addon/src/privileged/shieldUtils/schema.json +# bundle the study web extension experiment +mkdir -p test-addon/src/privileged/study +cp webExtensionApis/study/api.js test-addon/src/privileged/study/api.js +cp webExtensionApis/study/schema.json test-addon/src/privileged/study/schema.json # bundle the prefs web extension experiment mkdir -p test-addon/src/privileged/prefs diff --git a/examples/test-addon/src/background.js b/examples/test-addon/src/background.js index 6d1eb1a..a77cf69 100644 --- a/examples/test-addon/src/background.js +++ b/examples/test-addon/src/background.js @@ -52,10 +52,10 @@ async function initiateStudy() { // Set dynamic study configuration flags studySetup.eligible = await Study.isEligible(); studySetup.expired = await Study.hasExpired(); - // Ensure we have configured shieldUtils and are supposed to run our feature - await browser.shieldUtils.bootstrapStudy(studySetup); + // Ensure we have configured study and are supposed to run our feature + await browser.study.bootstrapStudy(studySetup); // Get study variation - const { variation } = await browser.shieldUtils.info(); + const { variation } = await browser.study.info(); // Initiate the study new Study(variation); } diff --git a/examples/test-addon/src/manifest.json b/examples/test-addon/src/manifest.json index 78d0c1e..7fb2753 100644 --- a/examples/test-addon/src/manifest.json +++ b/examples/test-addon/src/manifest.json @@ -18,12 +18,12 @@ "paths": [["prefs"]] } }, - "shieldUtils": { - "schema": "./privileged/shieldUtils/schema.json", + "study": { + "schema": "./privileged/study/schema.json", "parent": { "scopes": ["addon_parent"], - "script": "./privileged/shieldUtils/api.js", - "paths": [["shieldUtils"]] + "script": "./privileged/study/api.js", + "paths": [["study"]] } } }, diff --git a/examples/test-addon/src/privileged/.gitignore b/examples/test-addon/src/privileged/.gitignore index 04390e0..3c31506 100644 --- a/examples/test-addon/src/privileged/.gitignore +++ b/examples/test-addon/src/privileged/.gitignore @@ -1,3 +1,3 @@ # ignore APIs that are bundled from shield-studies-addon-utils -shieldUtils/ +study/ prefs/ diff --git a/examples/test-addon/test/functional/shield_utils_test.js b/examples/test-addon/test/functional/shield_utils_test.js index 781c79e..c9d7e59 100644 --- a/examples/test-addon/test/functional/shield_utils_test.js +++ b/examples/test-addon/test/functional/shield_utils_test.js @@ -32,11 +32,11 @@ describe("Shield Study Add-on Utils Functional Tests", function() { assert(hasAccessToWebExtensionApi); }); - it("should be able to access shieldUtils WebExtensions API from the extension page for tests", async () => { + it("should be able to access study WebExtensions API from the extension page for tests", async () => { const hasAccessToShieldUtilsWebExtensionApi = await utils.executeJs.executeAsyncScriptInExtensionPageForTests( driver, async callback => { - callback(browser && typeof browser.shieldUtils === "object"); + callback(browser && typeof browser.study === "object"); }, ); assert(hasAccessToShieldUtilsWebExtensionApi); diff --git a/package.json b/package.json index 3c09054..538ba04 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "url": "git://github.com/mozilla/shield-studies-addon-utils.git" }, "scripts": { - "build": "cd webExtensionApis/shieldUtils && webpack", + "build": "cd webExtensionApis/study && webpack", "docformat": "doctoc --title '**Contents**' docs/*.md && prettier '**/*.md' --write", "eslint": "eslint src --ext jsm --ext js --ext json", "eslint-fix": "npm run eslint -- --fix", diff --git a/webExtensionApis/shieldUtils/.gitignore b/webExtensionApis/study/.gitignore similarity index 100% rename from webExtensionApis/shieldUtils/.gitignore rename to webExtensionApis/study/.gitignore diff --git a/webExtensionApis/shieldUtils/schema.json b/webExtensionApis/study/schema.json similarity index 93% rename from webExtensionApis/shieldUtils/schema.json rename to webExtensionApis/study/schema.json index a7df523..2149c00 100644 --- a/webExtensionApis/shieldUtils/schema.json +++ b/webExtensionApis/study/schema.json @@ -1,7 +1,7 @@ [ { - "namespace": "shieldUtils", - "description": "shieldUtils", + "namespace": "study", + "description": "study", "functions": [ { "name": "bootstrapStudy", diff --git a/webExtensionApis/shieldUtils/src/index.js b/webExtensionApis/study/src/index.js similarity index 96% rename from webExtensionApis/shieldUtils/src/index.js rename to webExtensionApis/study/src/index.js index 8098222..4a5b4cf 100644 --- a/webExtensionApis/shieldUtils/src/index.js +++ b/webExtensionApis/study/src/index.js @@ -2,7 +2,7 @@ /* global ExtensionAPI */ -this.shieldUtils = class extends ExtensionAPI { +this.study = class extends ExtensionAPI { /** * We don't need to override the constructor for other * reasons than to clarify the class member "extension" @@ -39,9 +39,9 @@ this.shieldUtils = class extends ExtensionAPI { const { extension } = this; return { - shieldUtils: { + study: { /** - * ensure we have configured shieldUtils + * ensure we have configured study * and are supposed to run our feature * @returns {Promise} */ diff --git a/webExtensionApis/shieldUtils/src/jsonschema.js b/webExtensionApis/study/src/jsonschema.js similarity index 100% rename from webExtensionApis/shieldUtils/src/jsonschema.js rename to webExtensionApis/study/src/jsonschema.js diff --git a/webExtensionApis/shieldUtils/src/sampling.js b/webExtensionApis/study/src/sampling.js similarity index 100% rename from webExtensionApis/shieldUtils/src/sampling.js rename to webExtensionApis/study/src/sampling.js diff --git a/webExtensionApis/shieldUtils/src/schemas/index.js b/webExtensionApis/study/src/schemas/index.js similarity index 100% rename from webExtensionApis/shieldUtils/src/schemas/index.js rename to webExtensionApis/study/src/schemas/index.js diff --git a/webExtensionApis/shieldUtils/src/schemas/schema.studySetup.json b/webExtensionApis/study/src/schemas/schema.studySetup.json similarity index 100% rename from webExtensionApis/shieldUtils/src/schemas/schema.studySetup.json rename to webExtensionApis/study/src/schemas/schema.studySetup.json diff --git a/webExtensionApis/shieldUtils/src/schemas/schema.webExtensionMsg.json b/webExtensionApis/study/src/schemas/schema.webExtensionMsg.json similarity index 100% rename from webExtensionApis/shieldUtils/src/schemas/schema.webExtensionMsg.json rename to webExtensionApis/study/src/schemas/schema.webExtensionMsg.json diff --git a/webExtensionApis/shieldUtils/src/schemas/schema.weightedVariations.json b/webExtensionApis/study/src/schemas/schema.weightedVariations.json similarity index 100% rename from webExtensionApis/shieldUtils/src/schemas/schema.weightedVariations.json rename to webExtensionApis/study/src/schemas/schema.weightedVariations.json diff --git a/webExtensionApis/shieldUtils/src/studyUtils.js b/webExtensionApis/study/src/studyUtils.js similarity index 100% rename from webExtensionApis/shieldUtils/src/studyUtils.js rename to webExtensionApis/study/src/studyUtils.js diff --git a/webExtensionApis/shieldUtils/src/studyUtilsBootstrap.js b/webExtensionApis/study/src/studyUtilsBootstrap.js similarity index 100% rename from webExtensionApis/shieldUtils/src/studyUtilsBootstrap.js rename to webExtensionApis/study/src/studyUtilsBootstrap.js diff --git a/webExtensionApis/shieldUtils/webpack.config.js b/webExtensionApis/study/webpack.config.js similarity index 100% rename from webExtensionApis/shieldUtils/webpack.config.js rename to webExtensionApis/study/webpack.config.js