| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 |
| 7 import sys, os, re, json, struct | 7 import sys, os, re, json, struct |
| 8 from StringIO import StringIO | 8 from StringIO import StringIO |
| 9 | 9 |
| 10 import packager | 10 import packager |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if metadata.has_section('contentScripts'): | 99 if metadata.has_section('contentScripts'): |
| 100 contentScripts = [] | 100 contentScripts = [] |
| 101 for run_at, scripts in metadata.items('contentScripts'): | 101 for run_at, scripts in metadata.items('contentScripts'): |
| 102 if scripts == '': | 102 if scripts == '': |
| 103 continue | 103 continue |
| 104 contentScripts.append({ | 104 contentScripts.append({ |
| 105 'matches': ['http://*/*', 'https://*/*'], | 105 'matches': ['http://*/*', 'https://*/*'], |
| 106 'js': re.split(r'\s+', scripts), | 106 'js': re.split(r'\s+', scripts), |
| 107 'run_at': run_at, | 107 'run_at': run_at, |
| 108 'all_frames': True, | 108 'all_frames': True, |
| 109 'match_about_blank': True, | |
| 110 }) | 109 }) |
| 111 templateData['contentScripts'] = contentScripts | 110 templateData['contentScripts'] = contentScripts |
| 112 | 111 |
| 113 manifest = template.render(templateData) | 112 manifest = template.render(templateData) |
| 114 | 113 |
| 115 # Normalize JSON structure | 114 # Normalize JSON structure |
| 116 licenseComment = re.compile(r'/\*.*?\*/', re.S) | 115 licenseComment = re.compile(r'/\*.*?\*/', re.S) |
| 117 data = json.loads(re.sub(licenseComment, '', manifest, 1)) | 116 data = json.loads(re.sub(licenseComment, '', manifest, 1)) |
| 118 if '_dummy' in data: | 117 if '_dummy' in data: |
| 119 del data['_dummy'] | 118 del data['_dummy'] |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 'lib/info.js' not in files): | 389 'lib/info.js' not in files): |
| 391 files['lib/info.js'] = createInfoModule(params) | 390 files['lib/info.js'] = createInfoModule(params) |
| 392 | 391 |
| 393 zipdata = files.zipToString() | 392 zipdata = files.zipToString() |
| 394 signature = None | 393 signature = None |
| 395 pubkey = None | 394 pubkey = None |
| 396 if keyFile != None: | 395 if keyFile != None: |
| 397 signature = signBinary(zipdata, keyFile) | 396 signature = signBinary(zipdata, keyFile) |
| 398 pubkey = getPublicKey(keyFile) | 397 pubkey = getPublicKey(keyFile) |
| 399 writePackage(outFile, pubkey, signature, zipdata) | 398 writePackage(outFile, pubkey, signature, zipdata) |
| OLD | NEW |