How to call function in certain time interval Ask Question

I need to run a certain API function, in a certain time period once the access token is granted, and check the status and inform the user if there any changes.

So far i did it by clicking a button on popup window of the firefox addon and calling the functions background js files, so i can receive the info from the API and notify the user. But i need to automate this process in background js files.

Are there any firefox inbuild JS API or any other way to achieve this auto API request calling from addon background files?

custom codec/mime-type in Firefox Ask Question

I’m trying to abuse Firefox/Quantum as an application environment for a video application. The source content is likely going to be a single frame rendered from an FPGA – presumably thru a file descriptor (/dev/something). Ideally I can create a local html page (file, not server based) and use a video element with an appropriate source/mime type to display the feed. All this will be static on a given computer/device – the video content is local, and will not be encoded for IP transmission.

I started down the NPAPI path, but that’s been deprecated. I’ve looked at the WebAPI, but I’m skeptical that provides sufficient access to system resources. I have a hard time believing javascript is going to be sufficient for this exercise.

I’m thumbing thru the openh264 codec provided by Cisco/Firefox to get some ideas, but that isn’t really going as well as expected.

The Media Source Extension seems promising, but experimental.

Media Stream API also seems interesting, if there is a way to use a source other than the camera.

Is there an overview of how one might grab data from a local pipe and render data to a canvas/video element? In my mind’s eye, its very similar to the existing video codecs without the magic of compression or overhead of a container, but I realize that’s likely oversimplified.

To give a similar idea of the use case, picture a photobooth kiosk w/ multiple cameras/specialized inputs, and Firefox presenting options to the user of which feed to use, filters, etc… Firefox is merely the UI.

Benefits of jspdf/pdfmake to create a PDF vs printing the page as a PDF? Ask Question

I want to create a PDF report within a browser extension tab. I want to be able to add graphs, text, UTF-8 support, images, position text but nothing overly crazy in terms of styling and layout apart from that.

I’ve been reading about the limitations of jspdf (no UTF8 support) and pdfmake. It seems like they’ll be complicated to work with lots of gotchas.

One idea I have is this:

  • Put directly on the page the HTML needed for my report.

  • Use CSS to hide everything but the report HTML and use “@media print” styles to style the report.

  • Trigger “window.print()” to print the page in JavaScript. Chrome shows a preview and lets you save to PDF in a click. Firefox’s print preview shows a preview and the interface is a bit more messy but you can save to PDF in a few clicks.

Am I missing something? Are there any major downsides to my approach? Maybe OS specific issues? Why would you use jspdf or pdfmake over this?

I don’t see this approach being suggested anywhere which I find strange. The only downside I see is the user may be confused about why they’re being asked to print something when they weren’t expecting a PDF but as the reports aren’t generated often it’s not a big deal here.

Firefox won't load script tag of type “module” Ask Question

I am trying to run ES6 JavaScript in Firefox using a local server. Because of this, I need to use a script tag of type "module" rather than "text/javascript". The following works in Chrome but not Firefox. Help?


<!DOCTYPE html>
<script type="module" src="main.js"></script>


console.log("Hello World");

Check if browser notifications are temporary disabled in firefox Ask Question

The permission of browser notifications can be checked with the Notification.permission property.

In firefox the user has the possibility to disabled the browser notifications temporary. This means the browser will ask for the permission to show notifications again when a new tab or window is opened.

When the user denied the permission temporary and I check the Notification.permission property it returns default.

When I run the following script I get browser notifications where allowed as output in the console.

Notification.requestPermission().then((result) => {

But then when I try to show notifications nothing happens (because they are temporary disabled).

How can I check if browser notifications has been temporary disabled in firefox?

I could use the following script but it’s an ugly workaround and it will trigger the dialog where the browser ask for permission. Can I do something else?

var calculateBrowserNotificationPermission = () => {
    return new Promise(function(resolve, reject) {
        var permission = Notification.permission;
        if(permission !== 'default') {

        Notification.requestPermission().then((result) => {
            if(result === 'default') {
            } else {

Where would the best place be to ask for such a feature if it doesn’t exist yet?

EDIT 1: I’ve opened an issue on the notification repository of WHATWG.

EDIT 2: I’ve closed the github issue and will persist if I’ve allready asked the user for permissions as suggested by @jib.

URL not restored when using history.replaceState on Firefox when going back Ask Question

I’m using Firefox 59.0.1 and I am looking to store a query in the URL so I can restore the state of a page when going back. Right now when the query is updated an event fires and makes a call to history.replaceState. However, when I leave the page and return via the back button the URL is not restored. The URL is restored on both Chrome and IE.

Additionally, if I decide to use history.pushState instead the URL is restored upon hitting back. However, I don’t want to add extra entries into the history.

function updateURLQuery() {
  var querystring;
  //create querystring

  window.history.replaceState({path: '/packages?' + queryString}, 'Packages', '/packages?' + queryString);

Upon hitting back I check window.history.state and the object is returned to me but the URL isn’t updated. What is going differently in Firefox?

Firefox: Service Worker: SecurityError: DOMException: The Operation is insecure Ask Question

In app.js,
I am checking the serviceWorker existence in navigator object and if available then registering the SW.

if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('./service-worker.js', { scope: './' })
        .then(function(registration) {
            console.log("Service Worker Registered!");
        }).catch(function(err) {
            console.log("Service Worker not registered!", err);

When trying to register SW, I receive the below error in Firefox. I also made sure the service-worker.js file is under src directory.

enter image description here

Checking my about:config in Firefox (version 59.0.2) I had service worker and storage api enabled. So that shouldn’t be an issue.

enter image description hereenter image description here

PS: The same code works fine on Chrome.

Firebase quickstart-js/messaging : Issue with Firefox push notification Ask Question

I’m using the Firebase firebase-messaging-sw.js of quickstart-js/messaging as service-worker.

I’m correctly receiving web push notifications on Chrome and Opera, however I’m encountering some problems with Firefox.

This is the payload I’m sending via Firebase:

'Authorization': 'Bearer ' + accessToken,
'Content-type' : 'application/json'

    "message": {
        "webpush": {
            "headers": {
                "TTL": "50"
            "data": {               
                "message": "Custom body Message...",                
                "title": "Custom Title Optional"
            "notification": {
                "icon": "https://...",
                "title": "Title...",
                "body": "body Message...",

        "token": "dSW3uSbvRZQ:APA91..."

However, this is the payload that I receive on Firefox:

    from: "392777123950",
    priority: "normal"

The JSON post request is identical for the three browsers.
Moreover, I’m correctly receiving web push notifications on Firefox with this type of request:

     "message": {
       "token": "eym-3hyWckA:APA91bESbzQ2s3...",
       "notification": {         
         "title": "Portugal vs. Denmark",
         "body": "Great match!",

I’ve read that Firefox uses Mozilla Auto-Push, could it be the reason of the different behaviour? Is there an issue with the HTTP v1 API?

Thanks. works in chrome but not in firefox Ask Question

Hello Everybody!

I have a SPA made with vuejs, and also using webpack. To make http calls, i am using axios, but something really strange is happening …

When i use the spa on CHROME everything works fine, but ANY other browser (safari, firefox, iosSafari) gives me the following error:

Error: Network Error
Stack trace:

Error shown in console (more details)

The code that makes this call is:

  const rep = localStorage.getItem('rep')
  const token = localStorage.getItem('token')
  const config = {
    headers: {
      'Content-Type': 'application/json',
      'x-access-token': token
  }'localhost:1234/statusproducao', { representante: rep }, config)
    .then((response) => {
      this.statusPinos =
    .catch((error) => {

Looking at devtools –> network, i can see that the browser didn’t make the post request, and the error shown before, comes from the .catch(error) from

The const rep, and token are both strings.

What am i missing ?

Web RTC Video streaming not working in Firefox Ask Question

I am using one way broadcasting in Dot Net MVC web site for video streaming. I am using following example to complete the task . Its working fine in Google chrome but not working in Mozilla Firefox and internet explorer also.

Can anyone please help me what i have to do make it working in Mozilla Firefox and internet explorer or please suggest me another way to broadcast in my website.

Thanks in advance.