-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from tilfin/feature/firefox-compat
Firefox compatible
- Loading branch information
Showing
10 changed files
with
159 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"version": "0.5.3", | ||
"applications": { | ||
"gecko": { | ||
"id": "[email protected]", | ||
"strict_min_version": "55.0", | ||
"strict_max_version": "55.*" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(function(){ | ||
setTimeout(function(){ | ||
var csrf = AWSC.Auth.getMbtc(); | ||
var forms = document.querySelectorAll('#awsc-username-menu-recent-roles form'); | ||
for (var i = 0, len = forms.length; i < len; i++) { | ||
forms[i].csrf.value = csrf; | ||
} | ||
})(); | ||
}, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* globals define, module */ | ||
|
||
/** | ||
* A simple library to help you escape HTML using template strings. | ||
* | ||
* It's the counterpart to our eslint "no-unsafe-innerhtml" plugin that helps us | ||
* avoid unsafe coding practices. | ||
* A full write-up of the Hows and Whys are documented | ||
* for developers at | ||
* https://developer.mozilla.org/en-US/Firefox_OS/Security/Security_Automation | ||
* with additional background information and design docs at | ||
* https://wiki.mozilla.org/User:Fbraun/Gaia/SafeinnerHTMLRoadmap | ||
* | ||
*/ | ||
(function (root, factory) { | ||
'use strict'; | ||
if (typeof define === 'function' && define.amd) { | ||
define(factory); | ||
} else if (typeof exports === 'object') { | ||
module.exports = factory(); | ||
} else { | ||
root.Sanitizer = factory(); | ||
} | ||
}(this, function () { | ||
'use strict'; | ||
|
||
var Sanitizer = { | ||
_entity: /[&<>"'/]/g, | ||
|
||
_entities: { | ||
'&': '&', | ||
'<': '<', | ||
'>': '>', | ||
'"': '"', | ||
'\'': ''', | ||
'/': '/' | ||
}, | ||
|
||
getEntity: function (s) { | ||
return Sanitizer._entities[s]; | ||
}, | ||
|
||
/** | ||
* Escapes HTML for all values in a tagged template string. | ||
*/ | ||
escapeHTML: function (strings, ...values) { | ||
var result = ''; | ||
|
||
for (var i = 0; i < strings.length; i++) { | ||
result += strings[i]; | ||
if (i < values.length) { | ||
result += String(values[i]).replace(Sanitizer._entity, | ||
Sanitizer.getEntity); | ||
} | ||
} | ||
|
||
return result; | ||
}, | ||
/** | ||
* Escapes HTML and returns a wrapped object to be used during DOM insertion | ||
*/ | ||
createSafeHTML: function (strings, ...values) { | ||
var escaped = Sanitizer.escapeHTML(strings, ...values); | ||
return { | ||
__html: escaped, | ||
toString: function () { | ||
return '[object WrappedHTMLObject]'; | ||
}, | ||
info: 'This is a wrapped HTML object. See https://developer.mozilla.or'+ | ||
'g/en-US/Firefox_OS/Security/Security_Automation for more.' | ||
}; | ||
}, | ||
/** | ||
* Unwrap safe HTML created by createSafeHTML or a custom replacement that | ||
* underwent security review. | ||
*/ | ||
unwrapSafeHTML: function (...htmlObjects) { | ||
var markupList = htmlObjects.map(function(obj) { | ||
return obj.__html; | ||
}); | ||
return markupList.join(''); | ||
} | ||
}; | ||
|
||
return Sanitizer; | ||
|
||
})); |