Skip to content

Commit

Permalink
[fix] Add-on compatibility: NewsFox, click on news title
Browse files Browse the repository at this point in the history
NewsFox showed a redirection notification when clicking on a
news' title. Fixes #707.
  • Loading branch information
myrdd committed Oct 4, 2016
1 parent 10f73e0 commit aa41a52
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Note: ChangeLogs for the source code and unit tests, both not relevant for
* view-source CSS file (#788)
* NoScript icon for blocked flash content (#788)
* pluginproblem URI (#797, #788)
* Add-on compatibility:
* NewsFox showed a redirection notification when clicking on a
news' title (#707)
* Browser compatibility:
* Firefox Accounts (#687)
* updated translations
Expand Down
10 changes: 10 additions & 0 deletions src/content/lib/request-processor.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let {Logger} = importModule("lib/logger");
RequestProcessor = (function(self) {
let conflictingExtensions = [];
let compatibilityRules = [];
let whitelistedBaseURIs = new Map();
let topLevelDocTranslationRules = {};

// TODO: update compatibility rules etc. when addons are enabled/disabled
Expand Down Expand Up @@ -121,6 +122,11 @@ RequestProcessor = (function(self) {
Logger.info(Logger.TYPE_INTERNAL, "Conflicting extension: " + ext.name);
compatibilityRules.push(
["resource://brief-content/", null, ext.name]);
if (ext.id === "{899DF1F8-2F43-4394-8315-37F6744E6319}") {
// NewsFox
whitelistedBaseURIs.set("chrome://newsfox/content/newsfox.xul",
ext.name);
}
conflictingExtensions.push({
"id": ext.id,
"name": ext.name,
Expand Down Expand Up @@ -365,6 +371,10 @@ RequestProcessor = (function(self) {
return compatibilityRules;
};

self.getWhitelistedBaseURIs = function() {
return whitelistedBaseURIs;
};

self.getConflictingExtensions = function() {
return conflictingExtensions;
};
Expand Down
13 changes: 13 additions & 0 deletions src/content/lib/request-processor.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,19 @@ var RequestProcessor = (function() {
}
}

if (request.aContext) {
let whitelistedBaseURIs = self.getWhitelistedBaseURIs();
let baseURI = request.aContext.baseURI;
if (whitelistedBaseURIs.has(baseURI)) {
request.requestResult = new RequestResult(true,
REQUEST_REASON_COMPATIBILITY);
let extName = whitelistedBaseURIs.get(baseURI);
return accept(
"Extension/application compatibility rule matched [" + extName +
"]", request, true);
}
}

// If the destination has a mapping (i.e. it was originally a different
// destination but was changed into the current one), accept this
// request if the original destination would have been accepted.
Expand Down

0 comments on commit aa41a52

Please sign in to comment.