-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create embedded webextension to support settings migration
- Loading branch information
1 parent
fd6560c
commit 485a925
Showing
20 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Ignore .DS_Store files created by mac | ||
.* | ||
\#* | ||
*~ | ||
|
||
# Ignore any zip or xpi files | ||
*.zip | ||
*.xpi | ||
|
||
/Makefile | ||
/build.json | ||
/demo/ | ||
/legacy/ | ||
/output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
build: | ||
mkdir -p output | ||
zip -r -FS output/bugzillajs.xpi js css icon.png icon64.png manifest.json | ||
jpm xpi --dest-dir output/ | ||
|
||
lint: | ||
jshint . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"title": "BugzillaJS", | ||
"description": "Add features to Bugzilla.", | ||
"author": "Gregory Koberger / Matthew Noorenberghe", | ||
"version": "4.0.0", | ||
"main": "./sdk.js", | ||
"id": "jid0-NgMDcEu2B88AbzZ6ulHodW9sJzA@jetpack", | ||
"engines": { | ||
"firefox": ">= 52.0a1", | ||
"fennec": ">= 52.0a1" | ||
}, | ||
"permissions": { | ||
"multiprocess": true | ||
}, | ||
"hasEmbeddedWebExtension": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const webext = require("sdk/webextension"); | ||
const ss = require("sdk/simple-storage"); | ||
|
||
function setSyncLegacyDataPort(port) { | ||
// Send the initial data dump. | ||
port.postMessage({ | ||
storage: ss.storage, | ||
}); | ||
}; | ||
|
||
webext.startup().then(({browser}) => { | ||
browser.runtime.onConnect.addListener(port => { | ||
if (port.name === "sync-legacy-addon-data") { | ||
setSyncLegacyDataPort(port); | ||
} | ||
}); | ||
}); |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
|
||
|
||
function getSDKData() { | ||
// Ask to the legacy part to dump the needed data and send it back | ||
// to the background page... | ||
var port = browser.runtime.connect({name: "sync-legacy-addon-data"}); | ||
port.onMessage.addListener((msg) => { | ||
if (msg) { | ||
// Where it can be saved using the WebExtensions storage API. | ||
browser.storage.sync.set(msg.storage); | ||
} | ||
}); | ||
} | ||
|
||
browser.storage.sync.get(null).then(stored => { | ||
// If we don't have any data stored then import from the SDK. | ||
if (Object.keys(stored).length === 0) { | ||
getSDKData(); | ||
} | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,10 @@ | |
} | ||
}, | ||
|
||
"background": { | ||
"scripts": ["js/background.js"] | ||
}, | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
|