Skip to content

Commit

Permalink
scriptがjavascriptスキームから始まる場合に、javascriptスキーム部分を取り除きデコードしたうえで実行するよう変更
Browse files Browse the repository at this point in the history
  • Loading branch information
onozaty committed Sep 22, 2019
1 parent cac8769 commit 5c9ea30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ class Handler {

_executeScript(script) {
if (script && script.trim() != '') {

if (script.startsWith('javascript:')) {
const scriptRemovedScheme = script.substring('javascript:'.length);
try {
script = decodeURIComponent(scriptRemovedScheme);
} catch (e) {
console.log(e);
script = scriptRemovedScheme;
}
}

chrome.tabs.executeScript(null, {code: script});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.1.0",
"version": "1.2.0",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/onozaty/chrome-shortcutkey2url",
"icons": {
Expand Down

0 comments on commit 5c9ea30

Please sign in to comment.