Пример #1
0

CATEGORY_MANAGER = {
    u"addCategoryEntry": {
        "dangerous": lambda a, t, e: e.get_resource("em:bootstrap")
        and (
            "Bootstrapped add-ons may not create persistent category " "entries."
            if len(a) > 3 and t(a[3]).is_literal()
            else "Authors of bootstrapped add-ons must take care to clean up " "any added category entries at shutdown."
        )
    }
}


INTERFACES = {
    u"imIUserStatusInfo": {"value": {u"setUserIcon": entity("imIUserStatusInfo.setUserIcon")}},
    u"nsICategoryManager": {"value": CATEGORY_MANAGER},
    u"nsIAbLDAPDirectory": {
        "value": {
            u"replicationFile": entity("nsIAbLDAPDirectory.replicationFile"),
            u"databaseFile": entity("nsIAbLDAPDirectory.databaseFile"),
        }
    },
    u"nsIAbManager": {"value": {u"userProfileDirectory": entity("nsIAbManager.userProfileDirectory")}},
    u"nsIAccessibleRetrieval": {
        "dangerous": "Using the nsIAccessibleRetrieval interface causes significant "
        "performance degradation in Gecko. It should only be used in "
        "accessibility-related add-ons."
    },
    u"nsIBrowserSearchService": {"value": {u"currentEngine": {"readonly": True}, u"defaultEngine": {"readonly": True}}},
    u"nsIComm4xProfile": {"return": call_definitions.nsIComm4xProfile_removed},
    u"mozFMRadio": feature("FM"),
    # XXX: The "SMS" API's capitalization seems to be inconsistent at the moment.
    u"SMS": feature("SMS"),
    u"mozSMS": feature("SMS"),
    u"mozSms": feature("SMS"),
    u"mozNotification": feature("NOTIFICATION"),
    u"mozAlarms": feature("ALARM"),
    u"getGamepad": feature("GAMEPAD"),
    u"mozGetGamepad": feature("GAMEPAD"),
    u"webkitGetGamepad": feature("GAMEPAD"),
    u"mozTCPSocket": feature("TCPSOCKET"),
    u"mozTCPServerSocket": feature("TCPSOCKET"),
    u"mozInputMethod": feature("THIRDPARTY_KEYBOARD_SUPPORT"),
    u"mozMobileConnections": feature("NETWORK_INFO_MULTIPLE"),

    u"getUserMedia": entity("getUserMedia"),
}


# GLOBAL_ENTITIES is also representative of the `window` object.
GLOBAL_ENTITIES = {
    u"window": global_identity,
    u"null": {"literal": None},

    u"document":
        {"value":
            {u"defaultView": global_identity,

             u"cancelFullScreen": feature("FULLSCREEN"),
             u"mozCancelFullScreen": feature("FULLSCREEN"),
             u"webkitCancelFullScreen": feature("FULLSCREEN"),
def registry_key(write=False):
    """Represents a function which returns a registry key object."""
    res = {
        'return':
        lambda wrapper, arguments, traverser: (build_quick_xpcom(
            'createInstance', 'nsIWindowMediator', traverser, wrapper=True))
    }
    if write:
        res.update(REGISTRY_WRITE)

    return res


NSIX509CERT_METHODS = {
    'getUsagesArray': entity('nsIX509Cert.getUsagesArray'),
    'requestUsagesArrayAsync': entity('nsIX509Cert.requestUsagesArrayAsync'),
    'getUsagesString': entity('nsIX509Cert.getUsagesString'),
}

INTERFACES = {
    u'nsISupports': {
        'value': {}
    },
    u'mozIStorageBaseStatement': {
        'value': {
            u'execute': {
                'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION
            },
            u'executeStep': {
                'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION
Пример #4
0
         u"execute": {
             "dangerous": instanceactions.SYNCHRONOUS_SQL_DESCRIPTION
         },
         u"executeStep": {
             "dangerous": instanceactions.SYNCHRONOUS_SQL_DESCRIPTION
         }
     }
 },
 u"nsIExtensionManager": OBSOLETE_EXTENSION_MANAGER,
 u"nsIUpdateItem": OBSOLETE_EXTENSION_MANAGER,
 u"nsIInstallLocation": OBSOLETE_EXTENSION_MANAGER,
 u"nsIAddonInstallListener": OBSOLETE_EXTENSION_MANAGER,
 u"nsIAddonUpdateCheckListener": OBSOLETE_EXTENSION_MANAGER,
 u"imIUserStatusInfo": {
     "value": {
         u"setUserIcon": entity("imIUserStatusInfo.setUserIcon")
     }
 },
 u"nsICategoryManager": {
     "value": CATEGORY_MANAGER
 },
 u"nsIAbLDAPDirectory": {
     "value": {
         u"replicationFile": entity("nsIAbLDAPDirectory.replicationFile"),
         u"databaseFile": entity("nsIAbLDAPDirectory.databaseFile")
     }
 },
 u"nsIAbManager": {
     "value": {
         u"userProfileDirectory":
         entity("nsIAbManager.userProfileDirectory")
    'editors_only': True}}


def registry_key(write=False):
    """Represents a function which returns a registry key object."""
    res = {'return': lambda wrapper, arguments, traverser: (
        build_quick_xpcom('createInstance', 'nsIWindowMediator',
                          traverser, wrapper=True))}
    if write:
        res.update(REGISTRY_WRITE)

    return res


NSIX509CERT_METHODS = {
    'getUsagesArray': entity('nsIX509Cert.getUsagesArray'),
    'requestUsagesArrayAsync': entity('nsIX509Cert.requestUsagesArrayAsync'),
    'getUsagesString': entity('nsIX509Cert.getUsagesString'),
}


INTERFACES = {
    u'nsISupports': {'value': {}},
    u'mozIStorageBaseStatement':
        {'value':
            {u'execute':
                {'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION},
             u'executeStep':
                {'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION}}},
    u'nsIExtensionManager': OBSOLETE_EXTENSION_MANAGER,
    u'nsIUpdateItem': OBSOLETE_EXTENSION_MANAGER,
Пример #6
0
 u"nsIComponentRegistrar":
     {"value":
         {u"autoRegister":
             {"dangerous":
                 lambda a, t, e:
                     e.get_resource("em:bootstrap") and \
                     "Bootstrapped add-ons may not register "
                     "chrome manifest files"},
          u"registerFactory":
             {"dangerous":
                 lambda a, t, e:
                     e.get_resource("em:bootstrap") and \
                     "Authors of bootstrapped add-ons must take care "
                     "to cleanup any component registrations "
                     "at shutdown"}}},
 u"nsIDOMNSHTMLElement": entity("nsIDOMNSHTMLElement"),
 u"nsIDOMNSHTMLFrameElement": entity("nsIDOMNSHTMLFrameElement"),
 u"nsIImapIncomingServer":
     {"value":
         {u"GetImapConnectionAndLoadUrl":
             {"return": call_definitions.TB12_nsIImapProtocol_changed}}},
 u"nsIImapMailFolderSink":
     {"value":
         {u"setUrlState":
             {"return": call_definitions.nsIImapMailFolderSink_changed}}},
 u"nsIImapProtocol":
     {"value":
         {u"NotifyHdrsToDownload":
             {"return": call_definitions.nsIImapProtocol_removed},
          u"Initialize":
             {"return": call_definitions.TB12_nsIImapProtocol_changed}}},
Пример #7
0
    u'nsIComponentRegistrar':
        {'value':
            {u'autoRegister':
                {'dangerous':
                    lambda a, t, e:
                        e.get_resource('em:bootstrap') and
                        'Bootstrapped add-ons may not register chrome '
                        'manifest files.'},
             u'registerFactory':
                {'dangerous':
                    lambda a, t, e:
                        e.get_resource('em:bootstrap') and
                        'Authors of bootstrapped add-ons must take care to '
                        'clean up any component registrations at shutdown.'}}},
    u'nsIDNSService': {'value': {u'resolve': entity('nsIDNSService.resolve')}},
    u'nsIJSON':
        {'value':
            {u'encode':
                {'return': call_definitions.nsIJSON_deprec},
             u'decode':
                {'return': call_definitions.nsIJSON_deprec}}},
    u'nsIObserverService':
        {'value':
            {u'addObserver': entity('nsIObserverService.addObserver')},
         'dangerous': lambda a, t, e:
            lambda t, e: (
                e.metadata.get('is_jetpack') and
                'The observer service should not be used directly in SDK '
                "add-ons. Please use the 'sdk/system/events' module "
                'instead.')},
Пример #8
0
    u'nsIComponentRegistrar':
        {'value':
            {u'autoRegister':
                {'dangerous':
                    lambda a, t, e:
                        e.get_resource('em:bootstrap') and
                        'Bootstrapped add-ons may not register chrome '
                        'manifest files.'},
             u'registerFactory':
                {'dangerous':
                    lambda a, t, e:
                        e.get_resource('em:bootstrap') and
                        'Authors of bootstrapped add-ons must take care to '
                        'clean up any component registrations at shutdown.'}}},
    u'nsIDNSService': {'value': {u'resolve': entity('nsIDNSService.resolve')}},
    u'nsIJSON':
        {'value':
            {u'encode':
                {'return': call_definitions.nsIJSON_deprec},
             u'decode':
                {'return': call_definitions.nsIJSON_deprec}}},
    u'nsIMsgDatabase':
        {'value':
            {u'forceFolderDBClosed': entity('nsIMsgDatabase.forceFolderDBClosed')}},
    u'nsIObserverService':
        {'value':
            {u'addObserver':
                {'dangerous':
                    lambda a, t, e:
                        e.get_resource('em:bootstrap') and
Пример #9
0
    u"mozFM": feature("FM"),
    u"mozFMRadio": feature("FM"),
    # XXX: The "SMS" API's capitalization seems to be inconsistent at the moment.
    u"SMS": feature("SMS"),
    u"mozSMS": feature("SMS"),
    u"mozSms": feature("SMS"),
    u"mozNotification": feature("NOTIFICATION"),
    u"mozAlarms": feature("ALARM"),
    u"getGamepad": feature("GAMEPAD"),
    u"mozGetGamepad": feature("GAMEPAD"),
    u"webkitGetGamepad": feature("GAMEPAD"),
    u"mozTCPSocket": feature("TCPSOCKET"),
    u"mozTCPServerSocket": feature("TCPSOCKET"),
    u"mozInputMethod": feature("THIRDPARTY_KEYBOARD_SUPPORT"),
    u"mozMobileConnections": feature("NETWORK_INFO_MULTIPLE"),
    u"getUserMedia": entity("getUserMedia"),
}

# GLOBAL_ENTITIES is also representative of the `window` object.
GLOBAL_ENTITIES = {
    u"window": global_identity,
    u"null": {
        "literal": None
    },
    u"document": {
        "value": {
            u"defaultView": global_identity,
            u"cancelFullScreen": feature("FULLSCREEN"),
            u"mozCancelFullScreen": feature("FULLSCREEN"),
            u"webkitCancelFullScreen": feature("FULLSCREEN"),
            u"fullScreenElement": feature("FULLSCREEN"),
Пример #10
0
CATEGORY_MANAGER = {
    u"addCategoryEntry":
        {"dangerous":
            lambda a, t, e:
                e.get_resource("em:bootstrap") and
                ("Bootstrapped add-ons may not create persistent category "
                 "entries." if len(a) > 3 and t(a[3]).is_literal() else
                 "Authors of bootstrapped add-ons must take care to clean up "
                 "any added category entries at shutdown.")}}


INTERFACES = {
    u"imIUserStatusInfo":
        {"value":
            {u"setUserIcon": entity("imIUserStatusInfo.setUserIcon")}},
    u"nsICategoryManager":
        {"value": CATEGORY_MANAGER},
    u"nsIAbLDAPDirectory":
        {"value":
            {u"replicationFile": entity("nsIAbLDAPDirectory.replicationFile"),
             u"databaseFile": entity("nsIAbLDAPDirectory.databaseFile")}},
    u"nsIAbManager":
        {"value":
            {u"userProfileDirectory":
                entity("nsIAbManager.userProfileDirectory")}},
    u"nsIAccessibleRetrieval":
        {"dangerous":
            "Using the nsIAccessibleRetrieval interface causes significant "
            "performance degradation in Gecko. It should only be used in "
            "accessibility-related add-ons."},
Пример #11
0
             'dangerous':
             lambda a, t, e: e.get_resource('em:bootstrap') and
             'Bootstrapped add-ons may not register chrome '
             'manifest files.'
         },
         u'registerFactory': {
             'dangerous':
             lambda a, t, e: e.get_resource('em:bootstrap') and
             'Authors of bootstrapped add-ons must take care to '
             'clean up any component registrations at shutdown.'
         }
     }
 },
 u'nsIDNSService': {
     'value': {
         u'resolve': entity('nsIDNSService.resolve')
     }
 },
 u'nsIJSON': {
     'value': {
         u'encode': {
             'return': call_definitions.nsIJSON_deprec
         },
         u'decode': {
             'return': call_definitions.nsIJSON_deprec
         }
     }
 },
 u'nsIMsgDatabase': {
     'value': {
         u'forceFolderDBClosed':
Пример #12
0
 u"nsIComponentRegistrar":
     {"value":
         {u"autoRegister":
             {"dangerous":
                 lambda a, t, e:
                     e.get_resource("em:bootstrap") and \
                     "Bootstrapped add-ons may not register "
                     "chrome manifest files"},
          u"registerFactory":
             {"dangerous":
                 lambda a, t, e:
                     e.get_resource("em:bootstrap") and \
                     "Authors of bootstrapped add-ons must take care "
                     "to cleanup any component registrations "
                     "at shutdown"}}},
 u"nsIDOMNSHTMLElement": entity("nsIDOMNSHTMLElement"),
 u"nsIDOMNSHTMLFrameElement": entity("nsIDOMNSHTMLFrameElement"),
 u"nsIImapIncomingServer":
     {"value":
         {u"GetImapConnectionAndLoadUrl":
             {"return": call_definitions.TB12_nsIImapProtocol_changed}}},
 u"nsIImapMailFolderSink":
     {"value":
         {u"setUrlState":
             {"return": call_definitions.nsIImapMailFolderSink_changed}}},
 u"nsIImapProtocol":
     {"value":
         {u"NotifyHdrsToDownload":
             {"return": call_definitions.nsIImapProtocol_removed},
          u"Initialize":
             {"return": call_definitions.TB12_nsIImapProtocol_changed}}},
Пример #13
0
    return lambda t: {"value": GLOBAL_ENTITIES}


MUTABLE = {"overwriteable": True, "readonly": False}


# GLOBAL_ENTITIES is also representative of the `window` object.
GLOBAL_ENTITIES = {
    u"window": {"value": global_identity()},
    u"null": {"literal": get_constant(None)},

    u"document":
        {"value":
             {u"title": MUTABLE,
              u"defaultView": {"value": global_identity()},
              u"createElement": entity("createElement"),
              u"createElementNS": entity("createElementNS")}},

    # The nefariuos timeout brothers!
    u"setTimeout": entity("setTimeout"),
    u"setInterval": entity("setInterval"),

    u"encodeURI": {"readonly": True},
    u"decodeURI": {"readonly": True},
    u"encodeURIComponent": {"readonly": True},
    u"decodeURIComponent": {"readonly": True},
    u"escape": {"readonly": True},
    u"unescape": {"readonly": True},
    u"isFinite": {"readonly": True},
    u"isNaN": {"readonly": True},
    u"parseFloat": {"readonly": True},
Пример #14
0
    'editors_only': True}}


def registry_key(write=False):
    """Represents a function which returns a registry key object."""
    res = {'return': lambda wrapper, arguments, traverser: (
        build_quick_xpcom('createInstance', 'nsIWindowMediator',
                          traverser, wrapper=True))}
    if write:
        res.update(REGISTRY_WRITE)

    return res


NSIX509CERT_METHODS = {
    'getUsagesArray': entity('nsIX509Cert.getUsagesArray'),
    'requestUsagesArrayAsync': entity('nsIX509Cert.requestUsagesArrayAsync'),
    'getUsagesString': entity('nsIX509Cert.getUsagesString'),
}


INTERFACES = {
    u'nsISupports': {'value': {}},
    u'mozIStorageBaseStatement':
        {'value':
            {u'execute':
                {'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION},
             u'executeStep':
                {'dangerous': instanceactions.SYNCHRONOUS_SQL_DESCRIPTION}}},
    u'nsIExtensionManager': OBSOLETE_EXTENSION_MANAGER,
    u'nsIUpdateItem': OBSOLETE_EXTENSION_MANAGER,
CATEGORY_MANAGER = {
    u"addCategoryEntry":
        {"dangerous":
            lambda a, t, e:
                e.get_resource("em:bootstrap") and
                ("Bootstrapped add-ons may not create persistent category "
                 "entries." if len(a) > 3 and t(a[3]).is_literal() else
                 "Authors of bootstrapped add-ons must take care to clean up "
                 "any added category entries at shutdown.")}}


INTERFACES = {
    u"imIUserStatusInfo":
        {"value":
            {u"setUserIcon": entity("imIUserStatusInfo.setUserIcon")}},
    u"nsICategoryManager":
        {"value": CATEGORY_MANAGER},
    u"nsIAbLDAPDirectory":
        {"value":
            {u"replicationFile": entity("nsIAbLDAPDirectory.replicationFile"),
             u"databaseFile": entity("nsIAbLDAPDirectory.databaseFile")}},
    u"nsIAbManager":
        {"value":
            {u"userProfileDirectory":
                entity("nsIAbManager.userProfileDirectory")}},
    u"nsIAccessibleRetrieval":
        {"dangerous":
            "Using the nsIAccessibleRetrieval interface causes significant "
            "performance degradation in Gecko. It should only be used in "
            "accessibility-related add-ons."},
Пример #16
0
# GLOBAL_ENTITIES is also representative of the `window` object.
GLOBAL_ENTITIES = {
    u"window": {
        "value": global_identity()
    },
    u"null": {
        "literal": get_constant(None)
    },
    u"document": {
        "value": {
            u"title": MUTABLE,
            u"defaultView": {
                "value": global_identity()
            },
            u"createElement": entity("createElement"),
            u"createElementNS": entity("createElementNS")
        }
    },

    # The nefariuos timeout brothers!
    u"setTimeout": entity("setTimeout"),
    u"setInterval": entity("setInterval"),
    u"encodeURI": {
        "readonly": True
    },
    u"decodeURI": {
        "readonly": True
    },
    u"encodeURIComponent": {
        "readonly": True