Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: packagerChrome.py

Issue 5407608865292288: Issue 2216 - Run content scripts again in about:blank frames (Closed)
Patch Set: Created March 25, 2015, 3:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7 import sys
8 import os 8 import os
9 import re 9 import re
10 import json 10 import json
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if metadata.has_section('contentScripts'): 104 if metadata.has_section('contentScripts'):
105 contentScripts = [] 105 contentScripts = []
106 for run_at, scripts in metadata.items('contentScripts'): 106 for run_at, scripts in metadata.items('contentScripts'):
107 if scripts == '': 107 if scripts == '':
108 continue 108 continue
109 contentScripts.append({ 109 contentScripts.append({
110 'matches': ['http://*/*', 'https://*/*'], 110 'matches': ['http://*/*', 'https://*/*'],
111 'js': re.split(r'\s+', scripts), 111 'js': re.split(r'\s+', scripts),
112 'run_at': run_at, 112 'run_at': run_at,
113 'all_frames': True, 113 'all_frames': True,
114 'match_about_blank': True,
114 }) 115 })
115 templateData['contentScripts'] = contentScripts 116 templateData['contentScripts'] = contentScripts
116 117
117 manifest = template.render(templateData) 118 manifest = template.render(templateData)
118 119
119 # Normalize JSON structure 120 # Normalize JSON structure
120 licenseComment = re.compile(r'/\*.*?\*/', re.S) 121 licenseComment = re.compile(r'/\*.*?\*/', re.S)
121 data = json.loads(re.sub(licenseComment, '', manifest, 1)) 122 data = json.loads(re.sub(licenseComment, '', manifest, 1))
122 if '_dummy' in data: 123 if '_dummy' in data:
123 del data['_dummy'] 124 del data['_dummy']
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 'lib/info.js' not in files): 372 'lib/info.js' not in files):
372 files['lib/info.js'] = createInfoModule(params) 373 files['lib/info.js'] = createInfoModule(params)
373 374
374 zipdata = files.zipToString() 375 zipdata = files.zipToString()
375 signature = None 376 signature = None
376 pubkey = None 377 pubkey = None
377 if keyFile != None: 378 if keyFile != None:
378 signature = signBinary(zipdata, keyFile) 379 signature = signBinary(zipdata, keyFile)
379 pubkey = getPublicKey(keyFile) 380 pubkey = getPublicKey(keyFile)
380 writePackage(outFile, pubkey, signature, zipdata) 381 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld