diff options
author | Florrie <towerofnix@gmail.com> | 2019-03-24 10:41:25 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-03-24 10:41:25 -0300 |
commit | 895619545e629b8c03d09f8685e2aa71f84aa92a (patch) | |
tree | 64418f317b7d512b8f8f725c4e0f6471344f3d94 /extension | |
parent | 6f5e2d9b568504b681bcfaf3405d059b900bb4b1 (diff) |
Disallow creating rules on no-hostname pages
Diffstat (limited to 'extension')
-rw-r--r-- | extension/popup/main.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extension/popup/main.js b/extension/popup/main.js index 1bf653a..1dc39f4 100644 --- a/extension/popup/main.js +++ b/extension/popup/main.js @@ -332,6 +332,11 @@ function loadRuleList({tab, siteSettings, selectRule}) { createRuleButton.appendChild(document.createTextNode('Create Rule')); + if (!new URL(tab.url).hostname) { + createRuleButton.disabled = true; + createRuleButton.title = `Sorry, this page doesn't appear to have a hostname. We can't create a rule here.`; + } + createRuleButton.addEventListener('click', () => { const {hostnameParts} = getURLParts(tab.url); const rule = { |