Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
firefox / usr / lib / firefox / browser / features / webcompat-reporter@mozilla.org.xpi
Size: Mime:
PK
!<˧‰Ichrome.manifestPK
!<ù¸÷=22¤bootstrap.jsPK
!<Ë’0ÉÉ$¤bchrome/content/WebCompatReporter.jsmPK
!<âOì¿22¤m"chrome/content/tab-frame.jsPK
!<½¤¾höö¤Ø'chrome/content/wc-frame.jsPK
!<®"•ºº¤,chrome/skin/lightbulb.svgPK
!<UºotBB'¤÷.en-US/locale/en-US/webcompat.propertiesPK
!<76q‚øø¤~1install.rdfPK/PK
!<˧‰chrome.manifestcontent webcompat-reporter chrome/content/
skin webcompat-reporter classic/1.0 chrome/skin/
locale webcompat-reporter en-US en-US/locale/en-US/
PK
!<ù¸÷=22bootstrap.js/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global APP_SHUTDOWN:false */

ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

const WEBCOMPATREPORTER_JSM = "chrome://webcompat-reporter/content/WebCompatReporter.jsm";
const DELAYED_STARTUP_FINISHED = "browser-delayed-startup-finished";

ChromeUtils.defineModuleGetter(this, "WebCompatReporter",
  WEBCOMPATREPORTER_JSM);

const PREF_WC_REPORTER_ENABLED = "extensions.webcompat-reporter.enabled";

function requestReporterInit() {
  Services.tm.idleDispatchToMainThread(function() {
    WebCompatReporter.init();
  });
}

function prefObserver(subject, topic, data) {
  let enabled = Services.prefs.getBoolPref(PREF_WC_REPORTER_ENABLED);
  if (enabled) {
    WebCompatReporter.init();
  } else {
    WebCompatReporter.uninit();
  }
}

function onDelayedStartupFinished(subject, topic, data) {
  requestReporterInit();
  Services.obs.removeObserver(onDelayedStartupFinished,
    DELAYED_STARTUP_FINISHED);
}

function startup(aData, aReason) {
  // Observe pref changes and enable/disable as necessary.
  Services.prefs.addObserver(PREF_WC_REPORTER_ENABLED, prefObserver);

  // Only initialize if pref is enabled, after the delayed startup notification.
  let enabled = Services.prefs.getBoolPref(PREF_WC_REPORTER_ENABLED);
  if (enabled) {
    let win = Services.wm.getMostRecentWindow("navigator:browser");
    if (win && win.gBrowserInit &&
        win.gBrowserInit.delayedStartupFinished) {
      requestReporterInit();
    } else {
      Services.obs.addObserver(onDelayedStartupFinished,
        DELAYED_STARTUP_FINISHED);
    }
  }
}

function shutdown(aData, aReason) {
  if (aReason === APP_SHUTDOWN) {
    return;
  }

  Cu.unload(WEBCOMPATREPORTER_JSM);
  Services.prefs.removeObserver(PREF_WC_REPORTER_ENABLED, prefObserver);
}

function install(aData, aReason) {}
function uninstall(aData, aReason) {}
PK
!<Ë’0ÉÉ$chrome/content/WebCompatReporter.jsm/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["WebCompatReporter"];

ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

ChromeUtils.defineModuleGetter(this, "PageActions",
  "resource:///modules/PageActions.jsm");

XPCOMUtils.defineLazyGetter(this, "wcStrings", function() {
  return Services.strings.createBundle(
    "chrome://webcompat-reporter/locale/webcompat.properties");
});

// Gather values for interesting details we want to appear in reports.
let details = {};
XPCOMUtils.defineLazyPreferenceGetter(details, "gfx.webrender.all", "gfx.webrender.all", false);
XPCOMUtils.defineLazyPreferenceGetter(details, "gfx.webrender.blob-images", "gfx.webrender.blob-images", true);
XPCOMUtils.defineLazyPreferenceGetter(details, "gfx.webrender.enabled", "gfx.webrender.enabled", false);
XPCOMUtils.defineLazyPreferenceGetter(details, "image.mem.shared", "image.mem.shared", true);
details.buildID = Services.appinfo.appBuildID;
details.channel = AppConstants.MOZ_UPDATE_CHANNEL;

if (AppConstants.platform == "linux") {
  XPCOMUtils.defineLazyPreferenceGetter(details, "layers.acceleration.force-enabled", "layers.acceleration.force-enabled", false);
}

let WebCompatReporter = {
  get endpoint() {
    return Services.urlFormatter.formatURLPref(
      "extensions.webcompat-reporter.newIssueEndpoint");
  },

  init() {
    PageActions.addAction(new PageActions.Action({
      id: "webcompat-reporter-button",
      title: wcStrings.GetStringFromName("wc-reporter.label2"),
      iconURL: "chrome://webcompat-reporter/skin/lightbulb.svg",
      labelForHistogram: "webcompat",
      onCommand: (e) => this.reportIssue(e.target.ownerGlobal),
      onLocationChange: (window) => this.onLocationChange(window)
    }));
  },

  uninit() {
    let action = PageActions.actionForID("webcompat-reporter-button");
    action.remove();
  },

  onLocationChange(window) {
    let action = PageActions.actionForID("webcompat-reporter-button");
    let scheme = window.gBrowser.currentURI.scheme;
    let isReportable = ["http", "https"].includes(scheme);
    action.setDisabled(!isReportable, window);
  },

  // This method injects a framescript that should send back a screenshot blob
  // of the top-level window of the currently selected tab, resolved as a
  // Promise.
  getScreenshot(gBrowser) {
    const FRAMESCRIPT = "chrome://webcompat-reporter/content/tab-frame.js";
    const TABDATA_MESSAGE = "WebCompat:SendTabData";

    return new Promise((resolve) => {
      let mm = gBrowser.selectedBrowser.messageManager;
      mm.loadFrameScript(FRAMESCRIPT, false);

      mm.addMessageListener(TABDATA_MESSAGE, function receiveFn(message) {
        mm.removeMessageListener(TABDATA_MESSAGE, receiveFn);
        resolve([gBrowser, message.json]);
      });
    });
  },

  // This should work like so:
  // 1) set up listeners for a new webcompat.com tab, and open it, passing
  //    along the current URI
  // 2) if we successfully got a screenshot from getScreenshot,
  //    inject a frame script that will postMessage it to webcompat.com
  //    so it can show a preview to the user and include it in FormData
  // Note: openWebCompatTab arguments are passed in as an array because they
  // are the result of a promise resolution.
  openWebCompatTab([gBrowser, tabData]) {
    const SCREENSHOT_MESSAGE = "WebCompat:SendScreenshot";
    const FRAMESCRIPT = "chrome://webcompat-reporter/content/wc-frame.js";
    let win = Services.wm.getMostRecentWindow("navigator:browser");
    const WEBCOMPAT_ORIGIN = new win.URL(WebCompatReporter.endpoint).origin;

    let params = new URLSearchParams();
    params.append("url", `${tabData.url}`);
    params.append("src", "desktop-reporter");
    params.append("details", JSON.stringify(details));

    if (details["gfx.webrender.all"] || details["gfx.webrender.enabled"]) {
      params.append("label", "type-webrender-enabled");
    }

    let tab = gBrowser.loadOneTab(
      `${WebCompatReporter.endpoint}?${params}`,
      {inBackground: false, triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()});

    // If we successfully got a screenshot blob, add a listener to know when
    // the new tab is loaded before sending it over.
    if (tabData && tabData.blob) {
      let browser = gBrowser.getBrowserForTab(tab);
      let loadedListener = {
        QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
          "nsISupportsWeakReference"]),
        onStateChange(webProgress, request, flags, status) {
          let isStopped = flags & Ci.nsIWebProgressListener.STATE_STOP;
          let isNetwork = flags & Ci.nsIWebProgressListener.STATE_IS_NETWORK;
          if (isStopped && isNetwork && webProgress.isTopLevel) {
            let location;
            try {
              location = request.QueryInterface(Ci.nsIChannel).URI;
            } catch (ex) {}

            if (location && location.prePath === WEBCOMPAT_ORIGIN) {
              let mm = gBrowser.selectedBrowser.messageManager;
              mm.loadFrameScript(FRAMESCRIPT, false);
              mm.sendAsyncMessage(SCREENSHOT_MESSAGE, {
                screenshot: tabData.blob,
                origin: WEBCOMPAT_ORIGIN
              });

              browser.removeProgressListener(this);
            }
          }
        }
      };

      browser.addProgressListener(loadedListener);
    }
  },

  reportIssue(global) {
    this.getScreenshot(global.gBrowser).then(this.openWebCompatTab)
                                       .catch(Cu.reportError);
  }
};
PK
!<âOì¿22chrome/content/tab-frame.js/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* eslint-env mozilla/frame-script */

const TABDATA_MESSAGE = "WebCompat:SendTabData";

let getScreenshot = function(win) {
  return new Promise(resolve => {
    let url = win.location.href;
    try {
      let dpr = win.devicePixelRatio;
      let canvas = win.document.createElement("canvas");
      let ctx = canvas.getContext("2d");
      let x = win.document.documentElement.scrollLeft;
      let y = win.document.documentElement.scrollTop;
      let w = win.innerWidth;
      let h = win.innerHeight;
      canvas.width = dpr * w;
      canvas.height = dpr * h;
      ctx.scale(dpr, dpr);
      ctx.drawWindow(win, x, y, w, h, "#fff");
      canvas.toBlob(blob => {
        resolve({url, blob});
      });
    } catch (ex) {
      // CanvasRenderingContext2D.drawWindow can fail depending on memory or
      // surface size. Rather than reject, resolve the URL so the user can
      // file an issue without a screenshot.
      Cu.reportError(`WebCompatReporter: getting a screenshot failed: ${ex}`);
      resolve({url});
    }
  });
};

getScreenshot(content).then(data => sendAsyncMessage(TABDATA_MESSAGE, data));
PK
!<½¤¾hööchrome/content/wc-frame.js/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

 /* eslint-env mozilla/frame-script */

const SCREENSHOT_MESSAGE = "WebCompat:SendScreenshot";

addMessageListener(SCREENSHOT_MESSAGE, function handleMessage(message) {
  removeMessageListener(SCREENSHOT_MESSAGE, handleMessage);
  // postMessage the screenshot blob from a content Sandbox so message event.origin
  // is what we expect on the client-side (i.e., https://webcompat.com)
  try {
    let sb = new Cu.Sandbox(content.document.nodePrincipal);
    sb.win = content;
    sb.screenshotBlob = Cu.cloneInto(message.data.screenshot, content);
    sb.wcOrigin = Cu.cloneInto(message.data.origin, content);
    Cu.evalInSandbox("win.postMessage(screenshotBlob, wcOrigin);", sb);
    Cu.nukeSandbox(sb);
  } catch (ex) {
    Cu.reportError(`WebCompatReporter: sending a screenshot failed: ${ex}`);
  }
});
PK
!<®"•ººchrome/skin/lightbulb.svg<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="context-fill" fill-opacity="context-fill-opacity">
  <path d="M8 0C4.3 0 2 2.107 2 5.5c0 2.372 2.065 4.268 3 5V14c0 1.476 1.616 2 3 2s3-.524 3-2v-3.5c.935-.736 3-2.632 3-5C14 2.107 11.7 0 8 0zm1 12H7v-1h2zm-1 2a3.086 3.086 0 0 1-1-.172V13h2v.828A3.047 3.047 0 0 1 8 14zm1.445-4.832A1 1 0 0 0 9 10H7a1 1 0 0 0-.444-.831C5.845 8.691 4 7.1 4 5.5 4 2.607 6.175 2 8 2s4 .607 4 3.5c0 1.6-1.845 3.191-2.555 3.668z"/>
</svg>
PK
!<UºotBB'en-US/locale/en-US/webcompat.properties# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# LOCALIZATION NOTE(wc-reporter.label2): This string will be used in the
# Firefox page actions menu. Localized length should be considered.
wc-reporter.label2=Report Site Issue…
# LOCALIZATION NOTE(wc-reporter.tooltip): A site compatibility issue is
# a website bug that exists in one browser (Firefox), but not another.
wc-reporter.tooltip=Report a site compatibility issue
PK
!<76q‚øøinstall.rdf<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->


<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
  <Description about="urn:mozilla:install-manifest">
    <em:id>webcompat-reporter@mozilla.org</em:id>
    <em:type>2</em:type>
    <em:bootstrap>true</em:bootstrap>
    <em:multiprocessCompatible>true</em:multiprocessCompatible>

    <em:name>WebCompat Reporter</em:name>
    <em:description>Report site compatibility issues on webcompat.com.</em:description>

    <em:version>1.0.0</em:version>

    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>61.0.1</em:minVersion>
        <em:maxVersion>61.*</em:maxVersion>
      </Description>
    </em:targetApplication>
  </Description>
</RDF>
PK/