aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extension/background.js32
-rwxr-xr-xtest.c2
2 files changed, 17 insertions, 17 deletions
diff --git a/extension/background.js b/extension/background.js
index ecba875..8c09ff9 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -213,20 +213,20 @@ router["/tabs/by-id"] = {
return (await browser.tabs.executeScript(tabId, {code}))[0];
});
- router["/tabs/by-id/*/url"] = withTab(tab => tab.url + "\n", buf => ({ url: buf }));
- router["/tabs/by-id/*/title"] = withTab(tab => tab.title + "\n");
- router["/tabs/by-id/*/text"] = fromScript(`document.body.innerText`);
- router["/tabs/by-id/*/console"] = {
- open() {
- // inject the console
- },
- read() {
-
- },
- write() {
- // what does this even do?
- }
- }
+ router["/tabs/by-id/*/url.txt"] = withTab(tab => tab.url + "\n", buf => ({ url: buf }));
+ router["/tabs/by-id/*/title.txt"] = withTab(tab => tab.title + "\n");
+ router["/tabs/by-id/*/text.txt"] = fromScript(`document.body.innerText`);
+ // router["/tabs/by-id/*/console"] = {
+ // open() {
+ // // inject the console
+ // },
+ // read() {
+ //
+ // },
+ // write() {
+ // // what does this even do?
+ // }
+ // }
})();
router["/tabs/by-id/*/screenshot.png"] = defineFile(async path => {
const tabId = parseInt(pathComponent(path, -2));
@@ -389,11 +389,11 @@ for (let i = 10; i >= 0; i--) {
if (TESTING) { // I wish I could color this section with... a pink background, or something.
const assert = require('assert');
(async () => {
- assert.deepEqual(await router['/tabs/by-id/*'].readdir(), { entries: ['.', '..', 'url', 'title', 'text', 'screenshot.png', 'resources', 'scripts', 'control'] });
+ assert.deepEqual(await router['/tabs/by-id/*'].readdir(), { entries: ['.', '..', 'url.txt', 'title.txt', 'text.txt', 'screenshot.png', 'resources', 'scripts', 'control'] });
assert.deepEqual(await router['/'].readdir(), { entries: ['.', '..', 'extensions', 'tabs', 'runtime'] });
assert.deepEqual(await router['/tabs'].readdir(), { entries: ['.', '..', 'create', 'by-id', 'by-title', 'last-focused'] });
- assert.deepEqual(findRoute('/tabs/by-id/TABID/url'), router['/tabs/by-id/*/url']);
+ assert.deepEqual(findRoute('/tabs/by-id/TABID/url.txt'), router['/tabs/by-id/*/url.txt']);
})()
}
diff --git a/test.c b/test.c
index 9f6c14b..cb1580a 100755
--- a/test.c
+++ b/test.c
@@ -23,7 +23,7 @@ char* expand(char* phrase) {
// integration tests
int main() {
assert(system("echo about:blank > fs/mnt/tabs/create") == 0);
- assert(file_contents_equal("fs/mnt/tabs/last-focused/url", "about:blank"));
+ assert(file_contents_equal("fs/mnt/tabs/last-focused/url.txt", "about:blank"));
assert(system("file fs/mnt/tabs/last-focused/screenshot.png") == 0); // slow
assert(system("echo remove > fs/mnt/tabs/last-focused/control") == 0);