-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,054 additions
and
1,910 deletions.
There are no files selected for viewing
68 changes: 31 additions & 37 deletions
68
floorp/browser/extensions/webextensions/floorp-system/shared/API/BrowserInfo.js
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,37 +1,31 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
/* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */ | ||
|
||
const { AppConstants } = ChromeUtils.import( | ||
"resource://gre/modules/AppConstants.jsm" | ||
); | ||
|
||
this.BrowserInfo = class extends ExtensionAPI { | ||
getAPI(context) { | ||
const EventManager = ExtensionCommon.EventManager; | ||
|
||
return { | ||
BrowserInfo: { | ||
async getDisplayVersion() { | ||
return AppConstants.MOZ_APP_VERSION_DISPLAY; | ||
}, | ||
async getAppExecutablePath() { | ||
return Services.dirsvc.get( | ||
"XREExeF", | ||
Ci.nsIFile | ||
).path; | ||
}, | ||
async getAppExecutableDirPath() { | ||
return Services.dirsvc.get( | ||
"XREExeF", | ||
Ci.nsIFile | ||
).parent.path; | ||
}, | ||
}, | ||
}; | ||
} | ||
}; | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
/* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */ | ||
|
||
const { AppConstants } = ChromeUtils.import( | ||
"resource://gre/modules/AppConstants.jsm", | ||
); | ||
|
||
this.BrowserInfo = class extends ExtensionAPI { | ||
getAPI(context) { | ||
const EventManager = ExtensionCommon.EventManager; | ||
|
||
return { | ||
BrowserInfo: { | ||
async getDisplayVersion() { | ||
return AppConstants.MOZ_APP_VERSION_DISPLAY; | ||
}, | ||
async getAppExecutablePath() { | ||
return Services.dirsvc.get("XREExeF", Ci.nsIFile).path; | ||
}, | ||
async getAppExecutableDirPath() { | ||
return Services.dirsvc.get("XREExeF", Ci.nsIFile).parent.path; | ||
}, | ||
}, | ||
}; | ||
} | ||
}; |
58 changes: 29 additions & 29 deletions
58
floorp/browser/extensions/webextensions/floorp-system/shared/API/BrowserInfo.json
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,29 +1,29 @@ | ||
[ | ||
{ | ||
"namespace": "BrowserInfo", | ||
"description": "Get browser info", | ||
"functions": [ | ||
{ | ||
"name": "getDisplayVersion", | ||
"type": "function", | ||
"description": "Get display version", | ||
"parameters": [], | ||
"async": true | ||
}, | ||
{ | ||
"name": "getAppExecutablePath", | ||
"type": "function", | ||
"description": "Get app executable path", | ||
"parameters": [], | ||
"async": true | ||
}, | ||
{ | ||
"name": "getAppExecutableDirPath", | ||
"type": "function", | ||
"description": "Get app executable directory path", | ||
"parameters": [], | ||
"async": true | ||
} | ||
] | ||
} | ||
] | ||
[ | ||
{ | ||
"namespace": "BrowserInfo", | ||
"description": "Get browser info", | ||
"functions": [ | ||
{ | ||
"name": "getDisplayVersion", | ||
"type": "function", | ||
"description": "Get display version", | ||
"parameters": [], | ||
"async": true | ||
}, | ||
{ | ||
"name": "getAppExecutablePath", | ||
"type": "function", | ||
"description": "Get app executable path", | ||
"parameters": [], | ||
"async": true | ||
}, | ||
{ | ||
"name": "getAppExecutableDirPath", | ||
"type": "function", | ||
"description": "Get app executable directory path", | ||
"parameters": [], | ||
"async": true | ||
} | ||
] | ||
} | ||
] |
88 changes: 44 additions & 44 deletions
88
floorp/browser/extensions/webextensions/floorp-system/shared/API/IOFile.js
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,44 +1,44 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
/* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */ | ||
|
||
this.IOFile = class extends ExtensionAPI { | ||
getAPI(context) { | ||
const EventManager = ExtensionCommon.EventManager; | ||
|
||
Cu.importGlobalProperties(["IOUtils"]); | ||
|
||
return { | ||
IOFile: { | ||
async createEmptyFile(path) { | ||
await IOUtils.writeUTF8(path, ""); | ||
}, | ||
async createDir(path) { | ||
return IOUtils.makeDirectory(path); | ||
}, | ||
async exists(path) { | ||
return IOUtils.exists(path); | ||
}, | ||
async copyFile(srcPath, destPath) { | ||
return IOUtils.copy(srcPath, destPath); | ||
}, | ||
async copyDir(srcPath, destPath) { | ||
return IOUtils.copy(srcPath, destPath, { recursive: true }); | ||
}, | ||
async move(srcPath, destPath) { | ||
return IOUtils.move(srcPath, destPath); | ||
}, | ||
async removeFile(path) { | ||
return IOUtils.remove(path); | ||
}, | ||
async removeDir(path) { | ||
return IOUtils.remove(path, { recursive: true }); | ||
}, | ||
}, | ||
}; | ||
} | ||
}; | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
/* global ExtensionAPI, ExtensionCommon, Services, XPCOMUtils */ | ||
|
||
this.IOFile = class extends ExtensionAPI { | ||
getAPI(context) { | ||
const EventManager = ExtensionCommon.EventManager; | ||
|
||
Cu.importGlobalProperties(["IOUtils"]); | ||
|
||
return { | ||
IOFile: { | ||
async createEmptyFile(path) { | ||
await IOUtils.writeUTF8(path, ""); | ||
}, | ||
async createDir(path) { | ||
return IOUtils.makeDirectory(path); | ||
}, | ||
async exists(path) { | ||
return IOUtils.exists(path); | ||
}, | ||
async copyFile(srcPath, destPath) { | ||
return IOUtils.copy(srcPath, destPath); | ||
}, | ||
async copyDir(srcPath, destPath) { | ||
return IOUtils.copy(srcPath, destPath, { recursive: true }); | ||
}, | ||
async move(srcPath, destPath) { | ||
return IOUtils.move(srcPath, destPath); | ||
}, | ||
async removeFile(path) { | ||
return IOUtils.remove(path); | ||
}, | ||
async removeDir(path) { | ||
return IOUtils.remove(path, { recursive: true }); | ||
}, | ||
}, | ||
}; | ||
} | ||
}; |
Oops, something went wrong.