From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- devtools/shared/node-properties/UPGRADING.md | 12 + devtools/shared/node-properties/moz.build | 9 + devtools/shared/node-properties/node-properties.js | 776 +++++++++++++++++++++ 3 files changed, 797 insertions(+) create mode 100644 devtools/shared/node-properties/UPGRADING.md create mode 100644 devtools/shared/node-properties/moz.build create mode 100644 devtools/shared/node-properties/node-properties.js (limited to 'devtools/shared/node-properties') diff --git a/devtools/shared/node-properties/UPGRADING.md b/devtools/shared/node-properties/UPGRADING.md new file mode 100644 index 000000000..086621f2b --- /dev/null +++ b/devtools/shared/node-properties/UPGRADING.md @@ -0,0 +1,12 @@ +NODE PROPERTIES UPGRADING + +Original library at https://github.com/gagle/node-properties +The original library is intended for node and not for the browser. Most files are not +needed here. + +To update +- copy https://github.com/gagle/node-properties/blob/master/lib/parse.js +- update the initial "module.exports" to "var parse" in parse.js +- copy https://github.com/gagle/node-properties/blob/master/lib/read.js +- remove the require statements at the beginning +- merge the two files, parse.js first, read.js second \ No newline at end of file diff --git a/devtools/shared/node-properties/moz.build b/devtools/shared/node-properties/moz.build new file mode 100644 index 000000000..e58b1fdb6 --- /dev/null +++ b/devtools/shared/node-properties/moz.build @@ -0,0 +1,9 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +DevToolsModules( + 'node-properties.js' +) diff --git a/devtools/shared/node-properties/node-properties.js b/devtools/shared/node-properties/node-properties.js new file mode 100644 index 000000000..05feba857 --- /dev/null +++ b/devtools/shared/node-properties/node-properties.js @@ -0,0 +1,776 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2014 Gabriel Llamas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +"use strict"; + +var hex = function (c){ + switch (c){ + case "0": return 0; + case "1": return 1; + case "2": return 2; + case "3": return 3; + case "4": return 4; + case "5": return 5; + case "6": return 6; + case "7": return 7; + case "8": return 8; + case "9": return 9; + case "a": case "A": return 10; + case "b": case "B": return 11; + case "c": case "C": return 12; + case "d": case "D": return 13; + case "e": case "E": return 14; + case "f": case "F": return 15; + } +}; + +var parse = function (data, options, handlers, control){ + var c; + var code; + var escape; + var skipSpace = true; + var isCommentLine; + var isSectionLine; + var newLine = true; + var multiLine; + var isKey = true; + var key = ""; + var value = ""; + var section; + var unicode; + var unicodeRemaining; + var escapingUnicode; + var keySpace; + var sep; + var ignoreLine; + + var line = function (){ + if (key || value || sep){ + handlers.line (key, value); + key = ""; + value = ""; + sep = false; + } + }; + + var escapeString = function (key, c, code){ + if (escapingUnicode && unicodeRemaining){ + unicode = (unicode << 4) + hex (c); + if (--unicodeRemaining) return key; + escape = false; + escapingUnicode = false; + return key + String.fromCharCode (unicode); + } + + //code 117: u + if (code === 117){ + unicode = 0; + escapingUnicode = true; + unicodeRemaining = 4; + return key; + } + + escape = false; + + //code 116: t + //code 114: r + //code 110: n + //code 102: f + if (code === 116) return key + "\t"; + else if (code === 114) return key + "\r"; + else if (code === 110) return key + "\n"; + else if (code === 102) return key + "\f"; + + return key + c; + }; + + var isComment; + var isSeparator; + + if (options._strict){ + isComment = function (c, code, options){ + return options._comments[c]; + }; + + isSeparator = function (c, code, options){ + return options._separators[c]; + }; + }else{ + isComment = function (c, code, options){ + //code 35: # + //code 33: ! + return code === 35 || code === 33 || options._comments[c]; + }; + + isSeparator = function (c, code, options){ + //code 61: = + //code 58: : + return code === 61 || code === 58 || options._separators[c]; + }; + } + + for (var i=~~control.resume; i 1 || code < 33 || code > 126){ + throw new Error ("The comment token must be a single printable ASCII " + + "character"); + } + c[comment] = true; + }); + options._comments = c; + + var separators = options.separators || []; + if (!Array.isArray (separators)) separators = [separators]; + var s = {}; + separators.forEach (function (separator){ + code = separator.charCodeAt (0); + if (separator.length > 1 || code < 33 || code > 126){ + throw new Error ("The separator token must be a single printable ASCII " + + "character"); + } + s[separator] = true; + }); + options._separators = s; + + if (options.path){ + if (!cb) throw new Error ("A callback must be passed if the 'path' " + + "option is enabled"); + if (options.include){ + read (data, options, cb); + }else{ + fs.readFile (data, { encoding: "utf8" }, function (error, data){ + if (error) return cb (error); + build (data, options, ".", cb); + }); + } + }else{ + return build (data, options, ".", cb); + } +}; -- cgit v1.2.3