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

Side by Side Diff: packagerGecko.py

Issue 11237002: Provide an XMLHttpRequest constructor if used in JS modules (Closed)
Patch Set: Created July 25, 2013, 3:43 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 | « bootstrap.js.tmpl ('k') | 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 file is part of the Adblock Plus build tools, 3 # This file is part of the Adblock Plus build tools,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if not key in data: 185 if not key in data:
186 files[path] += localeTools.generateStringEntry(key, value, path).enc ode('utf-8') 186 files[path] += localeTools.generateStringEntry(key, value, path).enc ode('utf-8')
187 else: 187 else:
188 files[path] = reference[file]['_origData'].encode('utf-8') 188 files[path] = reference[file]['_origData'].encode('utf-8')
189 189
190 def addMissingFiles(params, files): 190 def addMissingFiles(params, files):
191 templateData = { 191 templateData = {
192 'hasChrome': False, 192 'hasChrome': False,
193 'hasChromeRequires': False, 193 'hasChromeRequires': False,
194 'hasShutdownHandlers': False, 194 'hasShutdownHandlers': False,
195 'hasXMLHttpRequest': False,
195 'hasVersionPref': False, 196 'hasVersionPref': False,
196 'chromeWindows': [], 197 'chromeWindows': [],
197 'requires': {}, 198 'requires': {},
198 'metadata': params['metadata'], 199 'metadata': params['metadata'],
199 'multicompartment': params['multicompartment'], 200 'multicompartment': params['multicompartment'],
200 'applications': dict((v, k) for k, v in KNOWN_APPS.iteritems()), 201 'applications': dict((v, k) for k, v in KNOWN_APPS.iteritems()),
201 } 202 }
202 203
203 def checkScript(name): 204 def checkScript(name):
204 content = files[name] 205 content = files[name]
205 for match in re.finditer(r'(?:^|\s)require\(\s*"([\w\-]+)"\s*\)', content): 206 for match in re.finditer(r'(?:^|\s)require\(\s*"([\w\-]+)"\s*\)', content):
206 templateData['requires'][match.group(1)] = True 207 templateData['requires'][match.group(1)] = True
207 if name.startswith('chrome/content/'): 208 if name.startswith('chrome/content/'):
208 templateData['hasChromeRequires'] = True 209 templateData['hasChromeRequires'] = True
210 if name.startswith('lib/') and re.search(r'\bXMLHttpRequest\b', content):
211 templateData['hasXMLHttpRequest'] = True
209 if name == 'defaults/prefs.js': 212 if name == 'defaults/prefs.js':
210 if re.search(r'\.currentVersion"', content): 213 if re.search(r'\.currentVersion"', content):
211 templateData['hasVersionPref'] = True 214 templateData['hasVersionPref'] = True
212 if not '/' in name or name.startswith('lib/'): 215 if not '/' in name or name.startswith('lib/'):
213 if re.search(r'(?:^|\s)onShutdown\.', content): 216 if re.search(r'(?:^|\s)onShutdown\.', content):
214 templateData['hasShutdownHandlers'] = True 217 templateData['hasShutdownHandlers'] = True
215 218
216 for name, content in files.iteritems(): 219 for name, content in files.iteritems():
217 if name == 'chrome.manifest': 220 if name == 'chrome.manifest':
218 templateData['hasChrome'] = True 221 templateData['hasChrome'] = True
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if not 'bootstrap.js' in files: 330 if not 'bootstrap.js' in files:
328 addMissingFiles(params, files) 331 addMissingFiles(params, files)
329 if keyFile: 332 if keyFile:
330 signFiles(files, keyFile) 333 signFiles(files, keyFile)
331 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x ) 334 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x )
332 335
333 def autoInstall(baseDir, type, host, port, multicompartment=False): 336 def autoInstall(baseDir, type, host, port, multicompartment=False):
334 fileBuffer = StringIO() 337 fileBuffer = StringIO()
335 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multicomp artment) 338 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multicomp artment)
336 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) 339 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue())
OLDNEW
« no previous file with comments | « bootstrap.js.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld