~extension-hackers/globalmenu-extension/3.5

« back to all changes in this revision

Viewing changes to build/automation.py.in

  • Committer: Chris Coulson
  • Date: 2011-08-05 17:37:02 UTC
  • Revision ID: chrisccoulson@ubuntu.com-20110805173702-n11ykbt0tdp5u07q
Refresh build system from FIREFOX_6_0b5_BUILD1

Show diffs side-by-side

added added

removed removed

Lines of Context:
354
354
user_pref("javascript.options.tracejit.content", true);
355
355
user_pref("javascript.options.methodjit.content", true);
356
356
user_pref("javascript.options.jitprofiling.content", true);
 
357
user_pref("javascript.options.methodjit_always", false);
357
358
user_pref("gfx.color_management.force_srgb", true);
358
359
user_pref("network.manage-offline-status", false);
359
360
user_pref("test.mousescroll", true);
363
364
user_pref("security.warn_viewing_mixed", false);
364
365
user_pref("app.update.enabled", false);
365
366
user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
 
367
user_pref("dom.w3c_touch_events.enabled", true);
366
368
 
367
369
// Only load extensions from the application and user profile
368
370
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
439
441
  var isHttp = matches[1] == 'http';
440
442
  var isHttps = matches[1] == 'https';
441
443
  var isWebSocket = matches[1] == 'ws';
 
444
  var isWebSocketSSL = matches[1] == 'wss';
442
445
  if (!matches[3])
443
446
  {
444
447
    if (isHttp | isWebSocket) matches[3] = '80';
445
 
    if (isHttps) matches[3] = '443';
 
448
    if (isHttps | isWebSocketSSL) matches[3] = '443';
446
449
  }
447
450
  if (isWebSocket)
448
451
    matches[1] = 'http';
 
452
  if (isWebSocketSSL)
 
453
    matches[1] = 'https';
449
454
 
450
455
  var origin = matches[1] + '://' + matches[2] + ':' + matches[3];
451
456
  if (origins.indexOf(origin) < 0)
452
457
    return 'DIRECT';
453
458
  if (isHttp)
454
459
    return 'PROXY %(remote)s:%(httpport)s';
455
 
  if (isHttps || isWebSocket)
 
460
  if (isHttps || isWebSocket || isWebSocketSSL)
456
461
    return 'PROXY %(remote)s:%(sslport)s';
457
462
  return 'DIRECT';
458
463
}""" % { "origins": origins,
633
638
      pExitCode = ctypes.wintypes.DWORD()
634
639
      ctypes.windll.kernel32.GetExitCodeProcess(pHandle, ctypes.byref(pExitCode))
635
640
      ctypes.windll.kernel32.CloseHandle(pHandle)
636
 
      if (pExitCode.value == STILL_ACTIVE):
637
 
        return True
638
 
      else:
639
 
        return False
 
641
      return pExitCode.value == STILL_ACTIVE
640
642
 
641
643
    def killPid(self, pid):
642
644
      PROCESS_TERMINATE = 0x0001
667
669
        # Wait on it to see if it's a zombie. This can throw OSError.ECHILD if
668
670
        # the process terminates before we get to this point.
669
671
        wpid, wstatus = os.waitpid(pid, os.WNOHANG)
670
 
        if wpid == 0:
671
 
          return True
672
 
 
673
 
        return False
 
672
        return wpid == 0
674
673
      except OSError, err:
675
674
        # Catch the errors we might expect from os.kill/os.waitpid, 
676
675
        # and re-raise any others
916
915
 
917
916
    return status
918
917
 
919
 
  """ 
920
 
   Copies an "installed" extension into the extensions directory of the given profile
921
 
   extensionSource - the source location of the extension files.  This can be either 
 
918
  """
 
919
   Copies an extension into the extensions directory of the given profile.
 
920
   extensionSource - the source location of the extension files.  This can be either
922
921
                     a directory or a path to an xpi file.
923
922
   profileDir      - the profile directory we are copying into.  We will create the
924
 
                     "extensions" directory there if it doesn't exist
 
923
                     "extensions" directory there if it doesn't exist.
925
924
   extensionID     - the id of the extension to be used as the containing directory for the
926
 
                     extension, i.e.
 
925
                     extension, if extensionSource is a directory, i.e.
927
926
                 this is the name of the folder in the <profileDir>/extensions/<extensionID>
928
927
  """
929
 
  def installExtension(self, extensionSource, profileDir, extensionID):
930
 
    if (not os.path.exists(extensionSource)):
931
 
      self.log.info("INFO | automation.py | Cannot install extension no source at: %s", extensionSource) 
932
 
      return
933
 
      
934
 
    if (not os.path.exists(profileDir)):
935
 
      self.log.info("INFO | automation.py | Cannot install extension invalid profileDir at: %s", profileDir)
 
928
  def installExtension(self, extensionSource, profileDir, extensionID = None):
 
929
    if not os.path.isdir(profileDir):
 
930
      self.log.info("INFO | automation.py | Cannot install extension, invalid profileDir at: %s", profileDir)
936
931
      return
937
932
 
938
 
    # See if we have an XPI or a directory
939
 
    if (os.path.isfile(extensionSource)):
940
 
      tmpd = tempfile.mkdtemp()
941
 
      extrootdir = self.extractZip(extensionSource, tmpd)
942
 
    else:
943
 
      extrootdir = extensionSource 
944
933
    extnsdir = os.path.join(profileDir, "extensions")
945
 
    extnshome = os.path.join(extnsdir, extensionID)
946
 
 
947
 
    # Now we copy the extension source into the extnshome
948
 
    shutil.copytree(extrootdir, extnshome)
949
 
 
950
 
  def extractZip(self, filename, dest):
951
 
    z = zipfile.ZipFile(filename, 'r')
952
 
    for n in z.namelist():
953
 
      fullpath = os.path.join(dest, n)
954
 
      parentdir = os.path.dirname(fullpath)
955
 
      if not os.path.isdir(parentdir):
956
 
        os.makedirs(parentdir)
957
 
      if (not n.endswith(os.sep)):
958
 
        data = z.read(n)
959
 
        f = open(fullpath, 'w')
960
 
        f.write(data)
961
 
        f.close()
962
 
    z.close()
963
 
    return dest
964
 
 
 
934
 
 
935
    if os.path.isfile(extensionSource):
 
936
      # Copy extension xpi directly.
 
937
      # "destination file is created or overwritten".
 
938
      shutil.copy2(extensionSource, extnsdir)
 
939
    elif os.path.isdir(extensionSource):
 
940
      if extensionID == None:
 
941
        self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
 
942
        return
 
943
 
 
944
      # Copy extension tree into its own directory.
 
945
      # "destination directory must not already exist".
 
946
      shutil.copytree(extensionSource, os.path.join(extnsdir, extensionID))
 
947
    else:
 
948
      self.log.info("INFO | automation.py | Cannot install extension, invalid extensionSource at: %s", extensionSource)
 
949
      return