forked from OctoLinker/OctoLinker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch links in background script (OctoLinker#546)
Chrome 73 changed to cross-origin requests in chrome extension content scripts see https://www.chromestatus.com/feature/5629709824032768
- Loading branch information
1 parent
00a1d3a
commit a179ffe
Showing
3 changed files
with
35 additions
and
18 deletions.
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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import * as storage from '@octolinker/helper-settings'; | ||
import newTab from './newTab'; | ||
import fetchUrls from '../utils/fetch'; | ||
|
||
storage.load().then(() => { | ||
newTab(); | ||
}); | ||
|
||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { | ||
if (request.type !== 'fetch') { | ||
return; | ||
} | ||
|
||
fetchUrls(request.urls) | ||
.then(res => { | ||
sendResponse(res); | ||
}) | ||
.catch(() => { | ||
sendResponse(); | ||
}); | ||
|
||
return 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
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