From 760512deba46ae60d4abab6e7983d80342f20379 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Wed, 12 Jul 2023 09:39:57 +0000 Subject: [PATCH] Bug 1838408 - Lint paths referred in toolkit/content/license.html r=sylvestre,glandium,ochameau,Standard8 Paths mentioned between tags are looked up in the repo, and an error is emitted if they don't exist. This should make license.html more resilient to code removal / move. Idea inspired by a discussion with glandium. This patch contains both the linter extension and the normalisation of license.html to pass the linting. Differential Revision: https://phabricator.services.mozilla.com/D180933 --- .prettierignore | 1 - .../mozbuild/mozbuild/vendor/vendor_rust.py | 2 - toolkit/content/license.html | 265 ++++-------------- tools/lint/license/__init__.py | 70 ++++- tools/rewriting/ThirdPartyPaths.txt | 1 - 5 files changed, 121 insertions(+), 218 deletions(-) diff --git a/.prettierignore b/.prettierignore index 48763c584891..1eb8ce23de7f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1251,7 +1251,6 @@ browser/components/storybook/node_modules/ browser/extensions/formautofill/content/third-party/ browser/extensions/formautofill/test/fixtures/third_party/ browser/extensions/formautofill/test/unit/heuristics/ -browser/extensions/screenshots/build/raven.js devtools/client/inspector/markup/test/lib_* devtools/client/jsonview/lib/require.js devtools/client/shared/build/babel.js diff --git a/python/mozbuild/mozbuild/vendor/vendor_rust.py b/python/mozbuild/mozbuild/vendor/vendor_rust.py index b2238e74ffec..a794c576e962 100644 --- a/python/mozbuild/mozbuild/vendor/vendor_rust.py +++ b/python/mozbuild/mozbuild/vendor/vendor_rust.py @@ -312,8 +312,6 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore- RUNTIME_LICENSE_PACKAGE_WHITELIST = { "BSD-2-Clause": [ "arrayref", - "cloudabi", - "Inflector", "mach", "qlog", ], diff --git a/toolkit/content/license.html b/toolkit/content/license.html index 1d2c93c152cc..02fbd3ac2e4d 100644 --- a/toolkit/content/license.html +++ b/toolkit/content/license.html @@ -56,7 +56,6 @@
  • GNU Lesser General Public License 3.0

  • -
  • ACE License
  • acorn License
  • #ifdef MOZ_INSTALL_TRACKING
  • Adjust SDK License
  • @@ -66,11 +65,8 @@
  • Apache License 2.0
  • Apache License 2.0 with LLVM exception
  • Apple License
  • -
  • Apple/Mozilla NPRuntime License
  • Apple Password Rules Parser License
  • ARM License
  • -
  • Babel License
  • -
  • Babylon License
  • boost License
  • BSD 2-Clause License
  • BSD 3-Clause License
  • @@ -85,7 +81,6 @@
  • diff License
  • Disconnect.Me License
  • dtoa License
  • -
  • fuzz-aldrin License
  • Dutch Spellchecking Dictionary License
  • #if defined(XP_WIN) || defined(XP_LINUX)
  • Twemoji License
  • @@ -139,12 +134,10 @@
  • praton and inet_ntop License
  • qcms License
  • QR Code Generator License
  • -
  • Raven.js License
  • React License
  • React-Redux License
  • Red Hat xdg_user_dir_lookup License
  • Redux License
  • -
  • Ring License
  • Russian Spellchecking Dictionary License
  • SCTP Licenses
  • Skia License
  • @@ -1382,29 +1375,6 @@ permanent authorization for you to choose that version for the Library.

    -
    - -

    ACE License

    - -

    This license applies to the file - media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable_event_win.cc.

    - -
    -ACE(TM), TAO(TM), CIAO(TM), DAnCE(TM), and CoSMIC(TM)
    -(henceforth referred to as "DOC software") are copyrighted by
    -Douglas C. Schmidt and his research group at Washington University,
    -University of California, Irvine, and Vanderbilt University,
    -Copyright (c) 1993-2009, all rights reserved.
    -Since DOC software is open-source, freely available software,
    -you are free to use, modify, copy, and distribute--perpetually and
    -irrevocably--the DOC software source code and object code produced
    -from the source, as well as copy and distribute modified versions of
    -this software. You must, however, include this copyright statement
    -along with any code built using DOC software that you release. No
    -copyright statement needs to be provided if you just ship binary
    -executables of your software products.
    -
    -

    Android Open Source License

    @@ -1485,8 +1455,8 @@ POSSIBILITY OF SUCH DAMAGE.

    acorn License

    -

    This license applies to all files in - devtools/shared/acorn. +

    This license applies to part of the + devtools/shared/jsbeautify/src/beautify-js.js file.

     Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com>
    @@ -1743,45 +1713,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     
    -
    - -

    Apple/Mozilla NPRuntime License

    - -

    This license applies to the file - dom/plugins/base/npruntime.h.

    - -
    -Copyright © 2004, Apple Computer, Inc. and The Mozilla Foundation.
    -All rights reserved.
    -
    -Redistribution and use in source and binary forms, with or without
    -modification, are permitted provided that the following conditions are
    -met:
    -
    -1. Redistributions of source code must retain the above copyright
    -notice, this list of conditions and the following disclaimer.
    -2. Redistributions in binary form must reproduce the above copyright
    -notice, this list of conditions and the following disclaimer in the
    -documentation and/or other materials provided with the distribution.
    -3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
    -Foundation ("Mozilla") nor the names of their contributors may be used
    -to endorse or promote products derived from this software without
    -specific prior written permission.
    -
    -THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
    -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
    -THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
    -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    -
    - -

    ARM License

    @@ -1816,14 +1747,13 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -

    Babel License

    -

    This license applies to this file in the directory - devtools/client/debugger/debugger.js/. -

    +

    This license applies to file bundled in + devtools/client/debugger/dist. +

     Copyright (c) 2014-2017 Sebastian McKenzie 
    @@ -1848,13 +1778,13 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     
    - +

    Babylon License

    -

    This license applies to this file in the directory - devtools/client/debugger/debugger.js/. -

    +

    This license applies to file bundled in + devtools/client/debugger/dist. +

     Copyright (C) 2012-2014 by various contributors (see AUTHORS)
    @@ -1923,8 +1853,6 @@ DEALINGS IN THE SOFTWARE.
         

    This license applies to files in the following directories:

    • third_party/rust/arrayref
    • -
    • third_party/rust/cloudabi
    • -
    • third_party/rust/Inflector
    • third_party/rust/mach
    • third_party/rust/qlog
    @@ -2097,13 +2025,12 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

    This license applies to parts of the code in:

      -
    • browser/extensions/formautofill/content/heuristicsRegexp.js
    • -
    • toolkit/components/formautofill/FormAutofillHeuristics.jsm
    • -
    • toolkit/components/formautofill/FormAutofillNameUtils.jsm
    • +
    • browser/extensions/formautofill
    • +
    • toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs
    • +
    • toolkit/components/formautofill/shared/FormAutofillNameUtils.sys.mjs
    • editor/libeditor/EditorEventListener.cpp
    • -
    • mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/StrictModeContext.java
    • security/sandbox/
    • -
    • toolkit/components/passwordmgr/PasswordGenerator.jsm
    • +
    • toolkit/components/passwordmgr/PasswordGenerator.sys.mjs
    • widget/cocoa/GfxInfo.mm
    • widget/windows/nsWindow.cpp
    @@ -2115,7 +2042,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  • gfx/ycbcr/
  • ipc/chromium/
  • media/openmax_dl/
  • -
  • toolkit/components/downloads/chromium/
  • +
  • toolkit/components/reputationservice/
  • toolkit/components/url-classifier/chromium/
  • tools/profiler/
  • @@ -2157,18 +2084,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    This license applies to all files in devtools/client/shared/sourceeditor/codemirror and - to specified files in the devtools/client/shared/sourceeditor/test/: + to the following files:

      -
    • cm_comment_test.js
    • -
    • cm_driver.js
    • -
    • cm_mode_javascript_test.js
    • -
    • cm_mode_test.css
    • -
    • cm_mode_test.js
    • -
    • cm_test.js
    • +
    • devtools/client/shared/sourceeditor/test/cm_mode_ruby.js
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/mode/javascript/test.js
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/comment_test.js
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/driver.js
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/mode_test.css
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/mode_test.js
    • +
    • devtools/client/shared/sourceeditor/test/codemirror/test.js
    -Copyright (C) 2013 by Marijn Haverbeke 
    +Copyright (C) 2013 by Marijn Haverbeke <marijnh@gmail.com>
     
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
    @@ -2204,7 +2132,7 @@ licences.
           security/nss/lib/freebl/sha512-p8.s.
         

    -Copyright (c) 2006, CRYPTOGAMS by 
    +Copyright (c) 2006, CRYPTOGAMS by <appro@openssl.org>
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
    @@ -2404,38 +2332,6 @@ OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
     
     
    -

    fuzz-aldrin License

    - -

    This license applies to some of the code in - devtools/client/debugger/debugger.js.

    - -
    -Copyright (c) 2015 Jean Christophe Roy
    -
    -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.
    -
    -
    - - -
    -

    Dutch Spellchecking Dictionary License

    This license applies to the Dutch Spellchecking Dictionary. (This @@ -2608,7 +2504,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Firebug License

    This license applies to the code - devtools/shared/webconsole/network-helper.js.

    + devtools/shared/network-observer/NetworkHelper.sys.mjs.

     Copyright (c) 2007, Parakey Inc.
    @@ -2691,7 +2587,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         

    This license applies to files in the directories toolkit/crashreporter/google-breakpad/, toolkit/components/protobuf/ and - devtools/client/netmonitor/src/utils/filter-text-utils.js.

    + devtools/client/netmonitor/src/utils/filter-text-utils.js.

     Copyright (c) 2006, Google Inc.
    @@ -2787,7 +2683,7 @@ shall terminate as of the date such litigation is filed.
         

    Google Gears/iStumbler License

    This license applies to the file - netwerk/wifi/osx_wifi.h.

    + netwerk/wifi/mac/Wifi.h.

     Copyright 2008, Google Inc.
    @@ -2854,7 +2750,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         

    gyp License

    This license applies to certain files in the directory - media/webrtc/trunk/tools/gyp.

    + third_party/python/gyp.

     Copyright (c) 2009 Google Inc. All rights reserved.
     
    @@ -3228,8 +3124,8 @@ SUCH DAMAGE.
         

    This license applies to the following files:

      -
    • openmax_dl/dl/api/omxtypes.h
    • -
    • openmax_dl/dl/sp/api/omxSP.h
    • +
    • media/openmax_dl/dl/api/omxtypes.h
    • +
    • media/openmax_dl/dl/sp/api/omxSP.h
    @@ -3557,8 +3453,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
         

    libyuv License

    This license applies to files in the directory - media/libyuv except - for the file media/libyuv/source/x86inc.asm. + media/libyuv.

    @@ -3634,13 +3529,13 @@ SUCH DAMAGE.
         

    License - lodash

    This license applies to some of the code in - devtools/client/shared/vendor/lodash.js.

    + node_modules/lodash/lodash.js.

    -Copyright JS Foundation and other contributors 
    +Copyright JS Foundation and other contributors <https://js.foundation/>
     
     Based on Underscore.js, copyright Jeremy Ashkenas,
    -DocumentCloud and Investigative Reporters & Editors 
    +DocumentCloud and Investigative Reporters & Editors 
     
     This software consists of voluntary contributions made by many
     individuals. For exact contribution history, see the revision history
    @@ -3728,7 +3623,7 @@ DEALINGS IN THE SOFTWARE.
         

    Apple Password Rules Parser License

    This license applies to the file - toolkit/component/passwordmgr/PasswordRulesParser.jsm.

    + toolkit/components/passwordmgr/PasswordRulesParser.sys.mjs.

     Copyright 2020 Apple Inc.
    @@ -4049,7 +3944,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         

    node-md5 License

    This license applies to some of the code in - devtools/client/debugger/debugger.js.

    + devtools/client/shared/vendor.

     Copyright © 2011-2012, Paul Vorbach.
    @@ -4158,7 +4053,7 @@ Copyright (C) 1999-2003 RTFM, Inc.
     All Rights Reserved
     
     This package is a SSLv3/TLS protocol analyzer written by Eric Rescorla
    - and licensed by RTFM, Inc.
    +<ekr@rtfm.com> and licensed by RTFM, Inc.
     
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
    @@ -4232,7 +4127,7 @@ SUCH DAMAGE.
       dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c.

    -Copyright (c) 1998 Todd C. Miller 
    +Copyright (c) 1998 Todd C. Miller >Todd.Miller@courtesan.com<
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
    @@ -4400,38 +4295,6 @@ THE SOFTWARE.
     
         
    -

    Raven.js License

    - -

    This license applies to the file - browser/extensions/screenshots/webextension/build/raven.js.

    -
    -Copyright (c) 2014 Matt Robenolt and other contributors
    -All rights reserved.
    -
    -Redistribution and use in source and binary forms, with or without modification,
    -are permitted provided that the following conditions are met:
    -
    -* Redistributions of source code must retain the above copyright notice, this
    -  list of conditions and the following disclaimer.
    -
    -* Redistributions in binary form must reproduce the above copyright notice, this
    -  list of conditions and the following disclaimer in the documentation and/or
    -  other materials provided with the distribution.
    -
    -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
    -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    -
    - -
    -

    React License

    This license applies to various files in the Mozilla codebase.

    @@ -4500,7 +4363,7 @@ SOFTWARE.

    Red Hat xdg_user_dir_lookup License

    This license applies to the - xdg_user_dir_lookup function in + xdg_user_dir_lookup function in xpcom/io/SpecialSystemDirectory.cpp.

    @@ -4559,29 +4422,6 @@ SOFTWARE.
     
     
    -

    Ring License

    - -

    This license applies to certain files in the directory - third_party/rust/rc_crypto/ -

    -
    -Copyright 2015-2017 Brian Smith.
    -
    -Permission to use, copy, modify, and/or distribute this software for any
    -purpose with or without fee is hereby granted, provided that the above
    -copyright notice and this permission notice appear in all copies.
    -
    -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
    -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
    -SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    -OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    -
    - -
    -

    Russian Spellchecking Dictionary License

    This license applies to the Russian Spellchecking Dictionary. (This @@ -4803,7 +4643,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    SunSoft License

    This license applies to the - ICC_H block in + ICC_H block in gfx/qcms/qcms.h.

    @@ -5309,8 +5149,7 @@ Database section 7.
         directories, certain files in those directories:

      -
    • dbm/
    • -
    • db/mork/src/morkQuickSort.cpp
    • +
    • security/nss/lib/dbm
    • xpcom/ds/nsQuickSort.cpp
    • nsprpub/pr/src/misc/praton.c
    • dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c
    • @@ -5453,7 +5292,7 @@ Additional Contributors: js/src/irregexp, js/src/builtin, js/src/jit/arm, - js/src/jit/mips and + js/src/jit/mips* and js/src/jit/riscv64.

      @@ -5490,11 +5329,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       

      Validator License

      This license applies to certain files in the directory - devtools/shared/stringvalidator/, + devtools/shared/storage/vendor/stringvalidator/,

       
      -Copyright (c) 2016 Chris O"Hara 
      +Copyright (c) 2016 Chris O"Hara <cohara87@gmail.com>
       
       Permission is hereby granted, free of charge, to any person obtaining
       a copy of this software and associated documentation files (the
      @@ -5560,7 +5399,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           

      WebRTC License

      This license applies to certain files in the directory - media/webrtc/trunk.

      + third_party/libwebrtc/.

       Copyright (c) 2011, The WebRTC project authors. All rights reserved.
       
      @@ -5598,16 +5437,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           

      x264 License

      This license applies to the file - media/webrtc/trunk/third_party/libyuv/source/x86inc.asm. + third_party/aom/third_party/libyuv/source/x86inc.asm.

       Copyright (C) 2005-2012 x264 project
       
      -Authors: Loren Merritt 
      -         Anton Mitrofanov 
      -         Jason Garrett-Glaser 
      -         Henrik Gramner 
      +Authors: Loren Merritt <lorenm@u.washington.edu>
      +         Anton Mitrofanov <BugMaster@narod.ru>
      +         Jason Garrett-Glaser <darkshikari@gmail.com>
      +         Henrik Gramner <hengar-6@student.ltu.se>
       
       Permission to use, copy, modify, and/or distribute this software for any
       purpose with or without fee is hereby granted, provided that the above
      @@ -5727,8 +5566,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           

      These terms apply to the following files; they are referred to below as "Distributable Code":

        -
      • d3d*.dll (Direct3D libraries)
      • -
      • msvc*.dll (C and C++ runtime libraries)
      • +
      • d3d*.dll (Direct3D libraries)
      • +
      • msvc*.dll (C and C++ runtime libraries)

      diff --git a/tools/lint/license/__init__.py b/tools/lint/license/__init__.py index 25139b49c59d..d25d6ac6ee97 100644 --- a/tools/lint/license/__init__.py +++ b/tools/lint/license/__init__.py @@ -3,11 +3,14 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os +from glob import glob +from html.parser import HTMLParser from mozlint import result from mozlint.pathutils import expand_exclusions here = os.path.abspath(os.path.dirname(__file__)) +topsrcdir = os.path.join(here, "..", "..", "..") results = [] @@ -162,7 +165,7 @@ def fix_me(log, filename): # Last line, we end by --> end = " -->" license.append(start + l.strip() + end) - if ext != ".svg" or end == "": + if ext != ".svg" or not end: # When dealing with an svg, we should not have a space between # the license and the content license.append("\n") @@ -170,6 +173,50 @@ def fix_me(log, filename): return +class HTMLParseError(Exception): + def __init__(self, msg, pos): + super().__init__(msg, *pos) + + +class LicenseHTMLParser(HTMLParser): + def __init__(self): + super().__init__() + self.in_code = False + self.invalid_paths = [] + + def handle_starttag(self, tag, attrs): + if tag == "code": + if self.in_code: + raise HTMLParseError("nested code tag", self.getpos()) + self.in_code = True + + def handle_endtag(self, tag): + if tag == "code": + if not self.in_code: + raise HTMLParseError("not started code tag", self.getpos()) + self.in_code = False + + def handle_data(self, data): + if self.in_code: + path = data.strip() + abspath = os.path.join(topsrcdir, path) + if not glob(abspath): + self.invalid_paths.append((path, self.getpos())) + + +def lint_license_html(path): + parser = LicenseHTMLParser() + with open(path) as fd: + content = fd.read() + parser.feed(content) + return parser.invalid_paths + + +def is_html_licence_summary(path): + license_html = os.path.join(topsrcdir, "toolkit", "content", "license.html") + return os.path.samefile(path, license_html) + + def lint(paths, config, fix=None, **lintargs): log = lintargs["log"] files = list(expand_exclusions(paths, config, lintargs["root"])) @@ -192,4 +239,25 @@ def lint(paths, config, fix=None, **lintargs): fix_me(log, f) fixed += 1 + if is_html_licence_summary(f): + try: + for invalid_path, (lineno, column) in lint_license_html(f): + res = { + "path": f, + "message": "references unknown path {}".format(invalid_path), + "level": "error", + "lineno": lineno, + "column": column, + } + results.append(result.from_config(config, **res)) + except HTMLParseError as err: + res = { + "path": f, + "message": err.args[0], + "level": "error", + "lineno": err.args[1], + "column": err.args[2], + } + results.append(result.from_config(config, **res)) + return {"results": results, "fixed": fixed} diff --git a/tools/rewriting/ThirdPartyPaths.txt b/tools/rewriting/ThirdPartyPaths.txt index 992094ee5d11..f24235c57039 100644 --- a/tools/rewriting/ThirdPartyPaths.txt +++ b/tools/rewriting/ThirdPartyPaths.txt @@ -4,7 +4,6 @@ browser/components/pocket/content/panels/js/vendor/ browser/components/storybook/node_modules/ browser/extensions/formautofill/content/third-party/ browser/extensions/formautofill/test/fixtures/third_party/ -browser/extensions/screenshots/build/raven.js devtools/client/inspector/markup/test/lib_* devtools/client/jsonview/lib/require.js devtools/client/shared/build/babel.js