731a5afa4ad31a0a038e5742b5e98dd7.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ace.define("ace/mode/csp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/*
  2. EXPLANATION
  3. This highlight rules were created to help developer spot typos when working
  4. with Content-Security-Policy (CSP). See:
  5. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/
  6. */
  7. "use strict";
  8. var oop = require("../lib/oop");
  9. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  10. var CspHighlightRules = function () {
  11. var keywordMapper = this.createKeywordMapper({
  12. "constant.language": "child-src|connect-src|default-src|font-src|frame-src|img-src|manifest-src|media-src|object-src"
  13. + "|script-src|style-src|worker-src|base-uri|plugin-types|sandbox|disown-opener|form-action|frame-ancestors|report-uri"
  14. + "|report-to|upgrade-insecure-requests|block-all-mixed-content|require-sri-for|reflected-xss|referrer|policy-uri",
  15. "variable": "'none'|'self'|'unsafe-inline'|'unsafe-eval'|'strict-dynamic'|'unsafe-hashed-attributes'"
  16. }, "identifier", true);
  17. this.$rules = {
  18. start: [{
  19. token: "string.link",
  20. regex: /https?:[^;\s]*/
  21. }, {
  22. token: "operator.punctuation",
  23. regex: /;/
  24. }, {
  25. token: keywordMapper,
  26. regex: /[^\s;]+/
  27. }]
  28. };
  29. };
  30. oop.inherits(CspHighlightRules, TextHighlightRules);
  31. exports.CspHighlightRules = CspHighlightRules;
  32. });
  33. ace.define("ace/mode/csp",["require","exports","module","ace/mode/text","ace/mode/csp_highlight_rules","ace/lib/oop"], function(require, exports, module){/*
  34. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  35. */
  36. "use strict";
  37. var TextMode = require("./text").Mode;
  38. var CspHighlightRules = require("./csp_highlight_rules").CspHighlightRules;
  39. var oop = require("../lib/oop");
  40. var Mode = function () {
  41. this.HighlightRules = CspHighlightRules;
  42. };
  43. oop.inherits(Mode, TextMode);
  44. (function () {
  45. this.$id = "ace/mode/csp";
  46. }).call(Mode.prototype);
  47. exports.Mode = Mode;
  48. }); (function() {
  49. ace.require(["ace/mode/csp"], function(m) {
  50. if (typeof module == "object" && typeof exports == "object" && module) {
  51. module.exports = m;
  52. }
  53. });
  54. })();