Skip to content

Commit

Permalink
Merge branch 'feature/weapi-storage-and-privacy-apis' into develop
Browse files Browse the repository at this point in the history
See #893
  • Loading branch information
myrdd committed Apr 26, 2018
2 parents eb56f09 + c94da43 commit 38993b1
Show file tree
Hide file tree
Showing 145 changed files with 2,872 additions and 1,953 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,14 @@ pycodestyle: python-packages
@$(PY_PYCODESTYLE) tests/marionette/
ts: node-packages
@echo $@
@$(TSC)
@$(TSC) --noEmit
@#$(TSC) --noEmit -p tests/mocha # failing
@#$(TSC) --noEmit -p tests/xpcshell # failing
tslint: node-packages
@echo $@
@$(TSLINT) --project tsconfig.json \
--exclude '**/third-party/**/*' \
--exclude '**/*.d.ts' \
'src/**/*.ts' \
| $(_remove_leading_empty_lines)

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"ts-node": "^4.1.0",
"tslint": "^5.5.0",
"typescript": "^2.4.2",
"web-ext-types": "github:myrdd/web-ext-types#d5a9541ab27d13c41e877ce70dcc1248c54a0b2c"
"web-ext-types": "github:myrdd/web-ext-types#8d773c8"
},
"dependencies": {
"jquery": "^3.3.1",
"mozilla-version-comparator": "github:myrdd/mozilla-version-comparator"
"mozilla-version-comparator": "github:myrdd/mozilla-version-comparator#3b77635"
}
}

This file was deleted.

16 changes: 12 additions & 4 deletions src/conditional/legacy/content/bootstrap/api/api.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,25 @@
* ***** END LICENSE BLOCK *****
*/

import { Common } from "common/interfaces";
import { Module } from "lib/classes/module";
import { API } from "./interfaces";
import { API, JSMs } from "./interfaces";

export class Api extends Module {
constructor(
log: API.ILog,
log: Common.ILog,
public readonly extension: API.extension.IExtension,
public readonly i18n: API.i18n.II18n,
public readonly management: API.management.IManagement,
public readonly manifest: API.IManifest,
public readonly privacy: API.privacy.IPrivacy,
public readonly runtime: API.runtime.IRuntime,
public readonly storage: API.storage.IStorage,
private readonly prefsService: JSMs.Services["prefs"],
private readonly miscInfos: API.IMiscInfos,
private readonly prefs: API.storage.IPrefs,
private readonly rpPrefBranch: API.storage.IPrefBranch,
private readonly prefObserverFactory: API.storage.PrefObserverFactory,
private readonly tryCatchUtils: API.ITryCatchUtils,
) {
super("API", log);
}
Expand All @@ -45,6 +49,7 @@ export class Api extends Module {
i18n: this.i18n,
management: this.management,
manifest: this.manifest,
privacy: this.privacy,
runtime: this.runtime,
storage: this.storage,
};
Expand All @@ -55,6 +60,7 @@ export class Api extends Module {
extension: this.extension.backgroundApi,
i18n: this.i18n.backgroundApi,
management: this.management.backgroundApi,
privacy: this.privacy.backgroundApi,
runtime: this.runtime.backgroundApi,
storage: this.storage.backgroundApi,
};
Expand All @@ -74,8 +80,10 @@ export class Api extends Module {
createPrefObserver: this.prefObserverFactory,
i18n: this.i18n.legacyApi,
miscInfos: this.miscInfos,
prefs: this.prefs,
prefsService: this.prefsService,
rpPrefBranch: this.rpPrefBranch,
storage: {},
tryCatchUtils: this.tryCatchUtils,
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/conditional/legacy/content/bootstrap/api/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
* ***** END LICENSE BLOCK *****
*/

import { API } from "bootstrap/api/interfaces";
import { Common } from "common/interfaces";
import {Module} from "lib/classes/module";

export class Extension extends Module {
private backgroundPage: any;

constructor(log: API.ILog) {
constructor(log: Common.ILog) {
super("browser.extension", log);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
* ***** END LICENSE BLOCK *****
*/

import { API } from "bootstrap/api/interfaces";
import { API, JSMs } from "bootstrap/api/interfaces";
import { IModule } from "lib/classes/module";
import {defer} from "lib/utils/js-utils";
import * as I18nUtils from "./i18n-utils";
import {LocaleData} from "./locale-data";

/**
* This object manages loading locales for i18n support.
*/
export class AsyncLocaleData extends LocaleData {
export class AsyncLocaleData extends LocaleData implements IModule {
private dReady = defer();

constructor(
private tryCatchUtils: API.ITryCatchUtils,
private chromeFileService: API.services.IChromeFileService,
private mozServices: JSMs.Services,
) {
super();
}
Expand All @@ -48,7 +50,10 @@ export class AsyncLocaleData extends LocaleData {
* @return {String}
*/
public getAppLocale() {
const appLocale = this.tryCatchUtils.getAppLocale();
const appLocale = this.tryCatchUtils.getAppLocale(
this.mozServices.prefs,
this.mozServices.locale,
);
return I18nUtils.normalizeToBCP47(appLocale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function normalizeToBCP47(tag) {
*
* @param {Array} availableLocales list of BCP 47 tags of available locales
* @param {String} locale canonicalized BCP 47 tag of requested locale
* @return {String} Best match BCP 47 tag
* @return {String|undefined} Best match BCP 47 tag
*/
export function getBestAvailableLocale(availableLocales, locale) {
let lcAvailable = availableLocales.map((l) => l.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
*/

import { API } from "bootstrap/api/interfaces";
import { Common } from "common/interfaces";
import {Module} from "lib/classes/module";
import * as L10nUtils from "./l10n-utils";

export class I18n extends Module {
constructor(
log: API.ILog,
log: Common.ILog,
protected localeData: API.i18n.IAsyncLocaleData,
) {
super("browser.i18n", log);
Expand Down
Loading

0 comments on commit 38993b1

Please sign in to comment.