firefox-webextensions

webextension: Why does the browser add a trailing slash to the requested URL?

流过昼夜 提交于 2019-12-06 06:18:22
When I make a request to http://www.example.com , why does I see http://www.example.com/ in the webRequest.onBeforeRequestListener ? For example: chrome.webRequest.onBeforeRequest.addListener( details => console.log('Sending request to', details.url), { urls: ['<all_urls>'] }); fetch('http://www.example.com'); will print Sending request to http://www.example.com/ That is consistent with the request URL shown in the network request monitor. For example, if I take it and convert it to a curl command, the request looks like this: curl 'http://www.example.com/' -H 'Accept: */*' -H 'Connection:

“Error: Missing host permission for the tab” on view-source: URLs

隐身守侯 提交于 2019-12-06 05:00:36
问题 I rewrote my extension to WebExtensions for Firefox and Google Chrome, and it works fine for HTTP/HTTPS. However, it no longer works on URLs with the view-source: scheme. (These URLs are the HTML source code of web pages shown by CTRL+U.) Firefox 57 gives this error Error: Missing host permission for the tab Google Chrome 62 does apparently nothing. There is no documentation about the view-source scheme. Is there a way to enable the extension for view-source? 回答1: I haven't dabbled too much

How to access add-on content script in Firefox console?

馋奶兔 提交于 2019-12-05 22:54:13
问题 I have developed an add-on for Firefox and Chrome. It has content scripts. I want to access them in the browser tab's console (on Firefox the Web Console). For example, I want to enter a global variable defined in the content script(s) in the console, and it will output its value. In Chrome, I can open the console by pressing F12 , then navigate to the Console tab in the developer tools. It has a dropbox, right after the filter button, to select which context I am in (page/content script): In

Firefox Extension API - permissions.request may only be called from a user input handler?

て烟熏妆下的殇ゞ 提交于 2019-12-04 19:25:03
I'm using the Firefox permissions API documented HERE I'm having a problem with the request method, wherein all of my permissions requests result in: Error: permissions.request may only be called from a user input handler You can produce this in firefox by debugging any addon or extension and entering browser.permissions.request({origins: ["https://google.com/*"]}) into the console. I find it hard to swallow that a permissions request must always have a user input event callback in the parent stack trace. I'm using Vue.js, and my Permissions are due to user interaction, but my user

Mozilla WebExtension API storage - Debugging with and without breakpoints leads to different output

回眸只為那壹抹淺笑 提交于 2019-12-04 18:44:41
Hello guys, i am trying to implement an add-on for the Mozilla-Firefox Browser. The following script shows one backgorund script I already successfully integrated. It uses the Mozilla WebExtension API storage. It gets executed but the log on the browser console suprises me. I get alternating logged nothing and: bla bla bla If and only if I set breakpoints on significant lines (especially the last 5 lines) of my code in Debugging-Mode I get always the expected result: bla How is it that the output depends on setting breakpoints. I have no idea what is happening and can not find any similar

OnBeforeRequest URL redirect in Firefox Addon (Conversion from Chrome Extension)

邮差的信 提交于 2019-12-04 14:21:28
I want to convert a Chrome extension of mine to Firefox. So far so good, except I had an url redirect in webRequest.onBeforeRequest in the Chrome extension, which is not allowed in Firefox WebExtensions . Now I am unsure how to implement this in Firefox. In the Chrome background.js it looked something like this: chrome.webRequest.onBeforeRequest.addListener( function(details) { console.log('onBeforeRequest'); var returnuri; returnuri = details.url; if ((details.url.indexOf("/malicious/") > -1) || (details.url.indexOf("/bad/") > -1)){ //I want to redirect to safe content returnuri = details.url

“Error: Missing host permission for the tab” on view-source: URLs

北城以北 提交于 2019-12-04 07:15:22
I rewrote my extension to WebExtensions for Firefox and Google Chrome, and it works fine for HTTP/HTTPS. However, it no longer works on URLs with the view-source: scheme. (These URLs are the HTML source code of web pages shown by CTRL+U.) Firefox 57 gives this error Error: Missing host permission for the tab Google Chrome 62 does apparently nothing. There is no documentation about the view-source scheme. Is there a way to enable the extension for view-source? I haven't dabbled too much in extensions but since the error involves Host permissions in firefox, check the Host permissions : In

Injecting into navigation error page gets: Error: No window matching {“matchesHost”:[“<all_urls>”]}

限于喜欢 提交于 2019-12-04 06:32:10
问题 I am trying to execute a script that shows a green border on the specified tab (by ID). The script should execute when the response for the requested URL is an error. The problem is that, when I load the extension from about:debugging , I get the following error (in the browser console in FF 53): Error: No window matching {“matchesHost”:[“<all_urls>”]} I searched for hours and hours and looked at several posts for similar problems but none of them have helped me. For example, this post

Extract cookie from chrome.webRequest.onBeforeSendHeaders

白昼怎懂夜的黑 提交于 2019-12-04 06:26:52
问题 I'm working on a Firefox add-on to intercept HTTP requests and extract the cookie. I was able to extract 'User-agent' from the header but was unable to extract the cookie. The code I used is below. chrome.webRequest.onBeforeSendHeaders.addListener(function(details){ var headers = details.requestHeaders, blockingResponse = {}; for( var i = 0, l = headers.length; i < l; ++i ) { window.alert("Checking headers"); if( headers[i].name == 'Cookie' ) { headers[i].value = 'twid=notsecret'; window

How to access add-on content script in Firefox console?

孤者浪人 提交于 2019-12-04 04:59:09
I have developed an add-on for Firefox and Chrome. It has content scripts. I want to access them in the browser tab's console (on Firefox the Web Console ). For example, I want to enter a global variable defined in the content script(s) in the console, and it will output its value. In Chrome, I can open the console by pressing F12 , then navigate to the Console tab in the developer tools. It has a dropbox, right after the filter button, to select which context I am in (page/content script): In Firefox, how to do the same thing? Makyen The ability to change the context/scope of the Web Console