Find file History
Latest commit 255bce9 Nov 14, 2016 @Rob--W Rob--W committed on GitHub Limit content script to owned websites only
The existing content script injects anywhere, even though the functionality is
only useful to a limited set of websites. Replaced wildcard '*' with a specific
list of domains to prevent conflicts between add-ons that are based on the same
code.

Also removed the obsolete comment about adding domains, this is no longer
possible.

README.md

Firefox Extensions

Enable screen capturing in Firefox for both localhost/127.0.0.1 and https://www.webrtc-experiment.com pages.

You have to deploy this addon on Firefox addons-store, yourselves.

Install from Firefox Addons Store

Check if screen capturing is enabled for your domains:

// ask addon to check if screen capturing enabled for specific domains
window.postMessage({
    checkIfScreenCapturingEnabled: true
}, "*");

// watch addon's response
// addon will return "isScreenCapturingEnabled=true|false"
window.addEventListener("message", function(event) {
    if (event.source !== window) return;

    var addonMessage = event.data;

    if(!addonMessage || typeof addonMessage.isScreenCapturingEnabled === 'undefined') return;

    if(addonMessage.isScreenCapturingEnabled === true) {
        alert(JSON.stringify(addonMessage.domains) + '\n are enabled for screen capturing.');
    }
    else {
        alert(JSON.stringify(addonMessage.domains) + '\n are NOT enabled for screen capturing.');
    }
}, false);

Insights:

Your requests to addon: checkIfScreenCapturingEnabled: ask addon to check if screen is already enabled for specific domains.

Addon responses:

  1. isScreenCapturingEnabled - Here true means domain is already enabled for specific domains.
  2. domains - list of same domains that are enabled for screen capturing.

Simplest Demo

Try this demo after installing above addon:

Wanna Deploy it Yourself?

  1. Open index.js
  2. Go to line 7
  3. Replace arrayOfMyOwnDomains array with your own list of domains
// replace your own domains with below array
var arrayOfMyOwnDomains = ['webrtc-experiment.com', 'www.webrtc-experiment.com', 'localhost', '127.0.0.1'];

How to Deploy?

1) Signup here:

2) Use unique-addon-name here:

3) Add your own domains here:

4) Make XPI of the directory.

[sudo] npm install jpm --global

jpm run -b nightly      # test in Firefox Nightly without making the XPI

jpm xpi                 # it will create xpi file

5) Submit the XPI here:

Follow all steps. Read them carefully. This is hard/tough step to follow. Select valid browsers. E.g. Firefox 38 to Firefox 45. And submit your addon for "review".

It will take 2-3 hours for a Mozilla AMO reviewer to review your addon. Then it will be available to public.

License

Firefox-Extensions are released under MIT licence . Copyright (c) Muaz Khan.