Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 0c46836

Browse files
committed
Fix option intializtion order
1 parent 6950ee9 commit 0c46836

File tree

6 files changed

+72
-441
lines changed

6 files changed

+72
-441
lines changed

build/UserALEWebExtension/background.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function _typeof(o) {
2929
}, _typeof(o);
3030
}
3131

32-
var version = "2.4.0";
32+
var version$1 = "2.4.0";
3333

3434
/*
3535
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1019,7 +1019,7 @@ var started = false;
10191019

10201020
// Start up Userale
10211021
config.on = false;
1022-
config.useraleVersion = version;
1022+
config.useraleVersion = version$1;
10231023
configure(config, getInitialSettings());
10241024
initPackager(logs, config);
10251025
if (config.autostart) {
@@ -1052,6 +1052,9 @@ function setup(config) {
10521052
}
10531053
}
10541054

1055+
// Export the Userale API
1056+
var version = version$1;
1057+
10551058
/**
10561059
* Updates the current configuration
10571060
* object with the provided values.
@@ -1119,8 +1122,18 @@ var browser = browser || chrome;
11191122
* limitations under the License.
11201123
*/
11211124

1122-
browser.storage.local.get("useraleConfig", function (res) {
1123-
options(res.config);
1125+
1126+
// Initalize userale plugin options
1127+
var defaultConfig = {
1128+
useraleConfig: {
1129+
url: 'http://localhost:8000',
1130+
userId: 'pluginUser',
1131+
toolName: 'useralePlugin',
1132+
version: version
1133+
}
1134+
};
1135+
browser.storage.local.get(defaultConfig, function (res) {
1136+
options(res.useraleConfig);
11241137
});
11251138
function dispatchTabMessage(message) {
11261139
browser.tabs.query({}, function (tabs) {
@@ -1135,6 +1148,8 @@ browser.runtime.onMessage.addListener(function (message) {
11351148
options(message.payload);
11361149
dispatchTabMessage(message);
11371150
break;
1151+
1152+
// Handles logs rerouted from content and option scripts
11381153
case ADD_LOG:
11391154
log(message.payload);
11401155
break;
@@ -1151,7 +1166,7 @@ function packageTabLog(tabId, data, type) {
11511166
}
11521167
function packageDetailedTabLog(tab, data, type) {
11531168
Object.assign(data, {
1154-
'type': type
1169+
'tabEvent': type
11551170
});
11561171
packageCustomLog(data, function () {
11571172
return tab;

build/UserALEWebExtension/content.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ function options(newConfig) {
11001100
// browser is defined in firefox, but chrome uses the 'chrome' global.
11011101
var browser = browser || chrome;
11021102
function rerouteLog(log) {
1103+
console.log(log);
11031104
browser.runtime.sendMessage({
11041105
type: ADD_LOG,
11051106
payload: log
@@ -1127,7 +1128,7 @@ function rerouteLog(log) {
11271128
*/
11281129

11291130
browser.storage.local.get("useraleConfig", function (res) {
1130-
options(res.config);
1131+
options(res.useraleConfig);
11311132
addCallbacks({
11321133
reroute: rerouteLog
11331134
});

0 commit comments

Comments
 (0)