Skip to content

Commit

Permalink
Merge pull request #38 from keithclark/bug-37-firefox-51-l10n
Browse files Browse the repository at this point in the history
Hotfix for breaking changes in Firefox 51
  • Loading branch information
keithclark authored Feb 15, 2017
2 parents 7ec3502 + 521b7e5 commit 53c97b5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gadebugger",
"description": "A browser extension for debugging Google Analytics tracking code",
"version": "2.1.3",
"version": "2.1.4",
"homepage": "http://github.com/keithclark/gadebugger",
"author": {
"name": "Keith Clark",
Expand Down
2 changes: 1 addition & 1 deletion src/firefox/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;

Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource:///modules/devtools/gDevTools.jsm');
Cu.import('resource://devtools/client/framework/gDevTools.jsm');

XPCOMUtils.defineLazyGetter(this, 'osString', () => Cc['@mozilla.org/xre/app-info;1'].getService(Ci.nsIXULRuntime).OS);
XPCOMUtils.defineLazyGetter(this, 'toolStrings', () => Services.strings.createBundle('chrome://gadebugger/locale/strings.properties'));
Expand Down
9 changes: 1 addition & 8 deletions src/firefox/chrome/resourceLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ if (appMajorVer >= 48) {

ResourceLoader.require = function (url) {

if (url === 'devtools/client/shared/l10n') {
// Prior to v48, the localization helpers were in ViewHelpers.jsm
if (appMajorVer < 48) {
return {
LocalizationHelper: ResourceLoader.require('devtools/client/shared/widgets/view-helpers').ViewHelpers.L10N
}
}
} else if (url === 'devtools/client/shared/widgets/view-helpers') {
if (url === 'devtools/client/shared/widgets/view-helpers') {
if (appMajorVer < 44) {
// Prior to v44, ViewHelpers was in a different directory. (see: https://bugzil.la/912121)
url = 'resource:///modules/devtools/ViewHelpers.jsm';
Expand Down
12 changes: 8 additions & 4 deletions src/firefox/chrome/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;

const STRINGS_URI = 'chrome://gadebugger/locale/strings.properties';

const EVENTS = {
NETWORK_EVENT: 'networkEvent',
NETWORK_EVENT_UPDATE: 'networkEventUpdate',
Expand All @@ -21,7 +19,6 @@ const appVersion = ResourceLoader.getAppMajorVersion();
const {Heritage, WidgetMethods, ViewHelpers} = ResourceLoader.require('devtools/client/shared/widgets/view-helpers');
const {SideMenuWidget} = ResourceLoader.require('resource://devtools/client/shared/widgets/SideMenuWidget.jsm');
const {VariablesView} = ResourceLoader.require('resource://devtools/client/shared/widgets/VariablesView.jsm');
const {LocalizationHelper} = ResourceLoader.require('devtools/client/shared/l10n');
const EventEmitter = ResourceLoader.require('devtools/shared/event-emitter');
const promise = ResourceLoader.require('promise');

Expand Down Expand Up @@ -575,7 +572,14 @@ let BeaconPropertiesView = {
/**
* Localization convenience methods.
*/
let L10N = new LocalizationHelper(STRINGS_URI);
let L10N = function() {
const stringsBundle = document.getElementById("string-bundle");
return {
getStr: function(x) {
return stringsBundle.getString(x)
}
}
}

/**
* Convenient way of emitting events from the panel window.
Expand Down
4 changes: 4 additions & 0 deletions src/firefox/chrome/tool.xul
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<?xml-stylesheet href="chrome://gadebugger/skin/style.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">

<stringbundleset id="stringbundleset">
<stringbundle id="string-bundle" src="chrome://gadebugger/locale/strings.properties"/>
</stringbundleset>

<script type="application/javascript;version=1.8" src="chrome://devtools/content/shared/theme-switching.js" /><!-- Firefox 44+ -->
<script type="application/javascript;version=1.8" src="chrome://browser/content/devtools/theme-switching.js" /><!-- Firefox <44 -->
<script src="tool.js" />
Expand Down

0 comments on commit 53c97b5

Please sign in to comment.