Bug 1353329 - Remove remains of SecureElement API. r?bz draft
authorAdrian Wielgosik <adrian.wielgosik@gmail.com>
Wed, 31 Jan 2018 22:07:30 +0100
changeset 749681 db3de74246603e719952d8e5c082c9dee4efd979
parent 749604 3804441e575c9f46fcb03894de3c780eeae7197f
push id97468
push userbmo:adrian.wielgosik@gmail.com
push dateWed, 31 Jan 2018 21:13:25 +0000
reviewersbz
bugs1353329
milestone60.0a1
Bug 1353329 - Remove remains of SecureElement API. r?bz MozReview-Commit-ID: 5D1VriUJ8UP
dom/moz.build
dom/secureelement/DOMSecureElement.js
dom/secureelement/DOMSecureElement.manifest
dom/secureelement/moz.build
dom/webidl/SecureElement.webidl
dom/webidl/SecureElementManager.webidl
dom/webidl/moz.build
layout/build/moz.build
modules/libpref/init/all.js
old-configure.in
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -107,19 +107,16 @@ DIRS += [
     'payments',
     'websocket',
     'serviceworkers',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['plugins/ipc/hangui']
 
-if CONFIG['MOZ_SECUREELEMENT']:
-    DIRS += ['secureelement']
-
 DIRS += ['presentation']
 
 TEST_DIRS += [
     'tests',
     'imptests',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'cocoa', 'windows'):
deleted file mode 100644
--- a/dom/secureelement/DOMSecureElement.js
+++ /dev/null
@@ -1,612 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Copyright © 2014, Deutsche Telekom, Inc. */
-
-"use strict";
-
-/* globals dump, Components, XPCOMUtils, DOMRequestIpcHelper, cpmm, SE  */
-
-const DEBUG = false;
-function debug(s) {
-  if (DEBUG) {
-    dump("-*- SecureElement DOM: " + s + "\n");
-  }
-}
-
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/DOMRequestHelper.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
-                                   "@mozilla.org/childprocessmessagemanager;1",
-                                   "nsISyncMessageSender");
-
-XPCOMUtils.defineLazyGetter(this, "SE", function() {
-  let obj = {};
-  ChromeUtils.import("resource://gre/modules/se_consts.js", obj);
-  return obj;
-});
-
-// Extend / Inherit from Error object
-function SEError(name, message) {
-  this.name = name || SE.ERROR_GENERIC;
-  this.message = message || "";
-}
-
-SEError.prototype = {
-  __proto__: Error.prototype,
-};
-
-function PromiseHelpersSubclass(win) {
-  this._window = win;
-}
-
-PromiseHelpersSubclass.prototype = {
-  __proto__: DOMRequestIpcHelper.prototype,
-
-  _window: null,
-
-  _context: [],
-
-  createSEPromise: function createSEPromise(callback, /* optional */ ctx) {
-    let ctxCallback = (resolverId) => {
-      if (ctx) {
-        this._context[resolverId] = ctx;
-      }
-
-      callback(resolverId);
-    };
-
-    return this.createPromiseWithId((aResolverId) => {
-      ctxCallback(aResolverId);
-    });
-  },
-
-  takePromise: function takePromise(resolverId) {
-    let resolver = this.takePromiseResolver(resolverId);
-    if (!resolver) {
-      return;
-    }
-
-    // Get the context associated with this resolverId
-    let context = this._context[resolverId];
-    delete this._context[resolverId];
-
-    return {resolver: resolver, context: context};
-  },
-
-  rejectWithSEError: function rejectWithSEError(name, message) {
-    let error = new SEError(name, message);
-    debug("rejectWithSEError - " + error.toString());
-
-    return this._window.Promise.reject(Cu.cloneInto(error, this._window));
-  }
-};
-
-// Helper wrapper class to do promises related chores
-var PromiseHelpers;
-
-/**
- * Instance of 'SEReaderImpl' class is the connector to a secure element.
- * A reader may or may not have a secure element present, since some
- * secure elements are removable in nature (eg:- 'uicc'). These
- * Readers can be physical devices or virtual devices.
- */
-function SEReaderImpl() {}
-
-SEReaderImpl.prototype = {
-  _window: null,
-
-  _sessions: [],
-
-  type: null,
-  _isSEPresent: false,
-
-  classID: Components.ID("{1c7bdba3-cd35-4f8b-a546-55b3232457d5}"),
-  contractID: "@mozilla.org/secureelement/reader;1",
-  QueryInterface: XPCOMUtils.generateQI([]),
-
-  // Chrome-only function
-  onSessionClose: function onSessionClose(sessionCtx) {
-    let index = this._sessions.indexOf(sessionCtx);
-    if (index != -1) {
-      this._sessions.splice(index, 1);
-    }
-  },
-
-  initialize: function initialize(win, type, isPresent) {
-    this._window = win;
-    this.type = type;
-    this._isSEPresent = isPresent;
-  },
-
-  _checkPresence: function _checkPresence() {
-    if (!this._isSEPresent) {
-      throw new Error(SE.ERROR_NOTPRESENT);
-    }
-  },
-
-  openSession: function openSession() {
-    this._checkPresence();
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      let sessionImpl = new SESessionImpl();
-      sessionImpl.initialize(this._window, this);
-      this._window.SESession._create(this._window, sessionImpl);
-      this._sessions.push(sessionImpl);
-      PromiseHelpers.takePromiseResolver(resolverId)
-                    .resolve(sessionImpl.__DOM_IMPL__);
-    });
-  },
-
-  closeAll: function closeAll() {
-    this._checkPresence();
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      let promises = [];
-      for (let session of this._sessions) {
-        if (!session.isClosed) {
-          promises.push(session.closeAll());
-        }
-      }
-
-      let resolver = PromiseHelpers.takePromiseResolver(resolverId);
-      // Wait till all the promises are resolved
-      Promise.all(promises).then(() => {
-        this._sessions = [];
-        resolver.resolve();
-      }, (reason) => {
-        let error = new SEError(SE.ERROR_BADSTATE,
-          "Unable to close all channels associated with this reader");
-        resolver.reject(Cu.cloneInto(error, this._window));
-      });
-    });
-  },
-
-  updateSEPresence: function updateSEPresence(isSEPresent) {
-    if (!isSEPresent) {
-      this.invalidate();
-      return;
-    }
-
-    this._isSEPresent = isSEPresent;
-  },
-
-  invalidate: function invalidate() {
-    debug("Invalidating SE reader: " + this.type);
-    this._isSEPresent = false;
-    this._sessions.forEach(s => s.invalidate());
-    this._sessions = [];
-  },
-
-  get isSEPresent() {
-    return this._isSEPresent;
-  }
-};
-
-/**
- * Instance of 'SESessionImpl' object represent a connection session
- * to one of the secure elements available on the device.
- * These objects can be used to get a communication channel with an application
- * hosted by the Secure Element.
- */
-function SESessionImpl() {}
-
-SESessionImpl.prototype = {
-  _window: null,
-
-  _channels: [],
-
-  _isClosed: false,
-
-  _reader: null,
-
-  classID: Components.ID("{2b1809f8-17bd-4947-abd7-bdef1498561c}"),
-  contractID: "@mozilla.org/secureelement/session;1",
-  QueryInterface: XPCOMUtils.generateQI([]),
-
-  // Chrome-only function
-  onChannelOpen: function onChannelOpen(channelCtx) {
-    this._channels.push(channelCtx);
-  },
-
-  // Chrome-only function
-  onChannelClose: function onChannelClose(channelCtx) {
-    let index = this._channels.indexOf(channelCtx);
-    if (index != -1) {
-      this._channels.splice(index, 1);
-    }
-  },
-
-  initialize: function initialize(win, readerCtx) {
-    this._window = win;
-    this._reader = readerCtx;
-  },
-
-  openLogicalChannel: function openLogicalChannel(aid) {
-    if (this._isClosed) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
-             "Session Already Closed!");
-    }
-
-    let aidLen = aid ? aid.length : 0;
-    if (aidLen < SE.MIN_AID_LEN || aidLen > SE.MAX_AID_LEN) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
-             "Invalid AID length - " + aidLen);
-    }
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      /**
-       * @params for 'SE:OpenChannel'
-       *
-       * resolverId  : ID that identifies this IPC request.
-       * aid         : AID that identifies the applet on SecureElement
-       * type        : Reader type ('uicc' / 'eSE')
-       * appId       : Current appId obtained from 'Principal' obj
-       */
-      cpmm.sendAsyncMessage("SE:OpenChannel", {
-        resolverId: resolverId,
-        aid: aid,
-        type: this.reader.type,
-        appId: this._window.document.nodePrincipal.appId
-      });
-    }, this);
-  },
-
-  closeAll: function closeAll() {
-    if (this._isClosed) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
-             "Session Already Closed!");
-    }
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      let promises = [];
-      for (let channel of this._channels) {
-        if (!channel.isClosed) {
-          promises.push(channel.close());
-        }
-      }
-
-      let resolver = PromiseHelpers.takePromiseResolver(resolverId);
-      Promise.all(promises).then(() => {
-        this._isClosed = true;
-        this._channels = [];
-        // Notify parent of this session instance's closure, so that its
-        // instance entry can be removed from the parent as well.
-        this._reader.onSessionClose(this.__DOM_IMPL__);
-        resolver.resolve();
-      }, (reason) => {
-        resolver.reject(new Error(SE.ERROR_BADSTATE +
-          "Unable to close all channels associated with this session"));
-      });
-    });
-  },
-
-  invalidate: function invlidate() {
-    this._isClosed = true;
-    this._channels.forEach(ch => ch.invalidate());
-    this._channels = [];
-  },
-
-  get reader() {
-    return this._reader.__DOM_IMPL__;
-  },
-
-  get isClosed() {
-    return this._isClosed;
-  },
-};
-
-/**
- * Instance of 'SEChannelImpl' object represent an ISO/IEC 7816-4 specification
- * channel opened to a secure element. It can be either a logical channel
- * or basic channel.
- */
-function SEChannelImpl() {}
-
-SEChannelImpl.prototype = {
-  _window: null,
-
-  _channelToken: null,
-
-  _isClosed: false,
-
-  _session: null,
-
-  openResponse: [],
-
-  type: null,
-
-  classID: Components.ID("{181ebcf4-5164-4e28-99f2-877ec6fa83b9}"),
-  contractID: "@mozilla.org/secureelement/channel;1",
-  QueryInterface: XPCOMUtils.generateQI([]),
-
-  // Chrome-only function
-  onClose: function onClose() {
-    this._isClosed = true;
-    // Notify the parent
-    this._session.onChannelClose(this.__DOM_IMPL__);
-  },
-
-  initialize: function initialize(win, channelToken, isBasicChannel,
-                                  openResponse, sessionCtx) {
-    this._window = win;
-    // Update the 'channel token' that identifies and represents this
-    // instance of the object
-    this._channelToken = channelToken;
-    // Update 'session' obj
-    this._session = sessionCtx;
-    this.openResponse = Cu.cloneInto(new Uint8Array(openResponse), win);
-    this.type = isBasicChannel ? "basic" : "logical";
-  },
-
-  transmit: function transmit(command) {
-    // TODO remove this once it will be possible to have a non-optional dict
-    // in the WebIDL
-    if (!command) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
-             "SECommand dict must be defined");
-    }
-
-    if (this._isClosed) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
-             "Channel Already Closed!");
-    }
-
-    let dataLen = command.data ? command.data.length : 0;
-    if (dataLen > SE.MAX_APDU_LEN) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER,
-             " Command data length exceeds max limit - 255. " +
-             " Extended APDU is not supported!");
-    }
-
-    if ((command.cla & 0x80 === 0) && ((command.cla & 0x60) !== 0x20)) {
-      if (command.ins === SE.INS_MANAGE_CHANNEL) {
-        return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY,
-               "MANAGE CHANNEL command not permitted");
-      }
-      if ((command.ins === SE.INS_SELECT) && (command.p1 == 0x04)) {
-        // SELECT by DF Name (p1=04) is not allowed
-        return PromiseHelpers.rejectWithSEError(SE.ERROR_SECURITY,
-               "SELECT command not permitted");
-      }
-      debug("Attempting to transmit an ISO command");
-    } else {
-      debug("Attempting to transmit GlobalPlatform command");
-    }
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      /**
-       * @params for 'SE:TransmitAPDU'
-       *
-       * resolverId  : Id that identifies this IPC request.
-       * apdu        : Object containing APDU data
-       * channelToken: Token that identifies the current channel over which
-                       'c-apdu' is being sent.
-       * appId       : Current appId obtained from 'Principal' obj
-       */
-      cpmm.sendAsyncMessage("SE:TransmitAPDU", {
-        resolverId: resolverId,
-        apdu: command,
-        channelToken: this._channelToken,
-        appId: this._window.document.nodePrincipal.appId
-      });
-    }, this);
-  },
-
-  close: function close() {
-    if (this._isClosed) {
-      return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE,
-             "Channel Already Closed!");
-    }
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      /**
-       * @params for 'SE:CloseChannel'
-       *
-       * resolverId  : Id that identifies this IPC request.
-       * channelToken: Token that identifies the current channel over which
-                       'c-apdu' is being sent.
-       * appId       : Current appId obtained from 'Principal' obj
-       */
-      cpmm.sendAsyncMessage("SE:CloseChannel", {
-        resolverId: resolverId,
-        channelToken: this._channelToken,
-        appId: this._window.document.nodePrincipal.appId
-      });
-    }, this);
-  },
-
-  invalidate: function invalidate() {
-    this._isClosed = true;
-  },
-
-  get session() {
-    return this._session.__DOM_IMPL__;
-  },
-
-  get isClosed() {
-    return this._isClosed;
-  },
-};
-
-function SEResponseImpl() {}
-
-SEResponseImpl.prototype = {
-  sw1: 0x00,
-
-  sw2: 0x00,
-
-  data: null,
-
-  _channel: null,
-
-  classID: Components.ID("{58bc6c7b-686c-47cc-8867-578a6ed23f4e}"),
-  contractID: "@mozilla.org/secureelement/response;1",
-  QueryInterface: XPCOMUtils.generateQI([]),
-
-  initialize: function initialize(sw1, sw2, response, channelCtx) {
-    // Update the status bytes
-    this.sw1 = sw1;
-    this.sw2 = sw2;
-    this.data = response ? response.slice(0) : null;
-    // Update the channel obj
-    this._channel = channelCtx;
-  },
-
-  get channel() {
-    return this._channel.__DOM_IMPL__;
-  }
-};
-
-/**
- * SEManagerImpl
- */
-function SEManagerImpl() {}
-
-SEManagerImpl.prototype = {
-  __proto__: DOMRequestIpcHelper.prototype,
-
-  _window: null,
-
-  classID: Components.ID("{4a8b6ec0-4674-11e4-916c-0800200c9a66}"),
-  contractID: "@mozilla.org/secureelement/manager;1",
-  QueryInterface: XPCOMUtils.generateQI([
-    Ci.nsIDOMGlobalPropertyInitializer,
-    Ci.nsISupportsWeakReference,
-    Ci.nsIObserver
-  ]),
-
-  _readers: [],
-
-  init: function init(win) {
-    this._window = win;
-    PromiseHelpers = new PromiseHelpersSubclass(this._window);
-
-    // Add the messages to be listened to.
-    const messages = ["SE:GetSEReadersResolved",
-                      "SE:OpenChannelResolved",
-                      "SE:CloseChannelResolved",
-                      "SE:TransmitAPDUResolved",
-                      "SE:GetSEReadersRejected",
-                      "SE:OpenChannelRejected",
-                      "SE:CloseChannelRejected",
-                      "SE:TransmitAPDURejected",
-                      "SE:ReaderPresenceChanged"];
-
-    this.initDOMRequestHelper(win, messages);
-  },
-
-  // This function will be called from DOMRequestIPCHelper.
-  uninit: function uninit() {
-    // All requests that are still pending need to be invalidated
-    // because the context is no longer valid.
-    this.forEachPromiseResolver((k) => {
-      this.takePromiseResolver(k).reject("Window Context got destroyed!");
-    });
-    PromiseHelpers = null;
-    this._window = null;
-  },
-
-  getSEReaders: function getSEReaders() {
-    // invalidate previous readers on new request
-    if (this._readers.length) {
-      this._readers.forEach(r => r.invalidate());
-      this._readers = [];
-    }
-
-    return PromiseHelpers.createSEPromise((resolverId) => {
-      cpmm.sendAsyncMessage("SE:GetSEReaders", {
-        resolverId: resolverId,
-        appId: this._window.document.nodePrincipal.appId
-      });
-    });
-  },
-
-  receiveMessage: function receiveMessage(message) {
-    DEBUG && debug("Message received: " + JSON.stringify(message));
-
-    let result = message.data.result;
-    let resolver = null;
-    let context = null;
-
-    let promiseResolver = PromiseHelpers.takePromise(result.resolverId);
-    if (promiseResolver) {
-      resolver = promiseResolver.resolver;
-      // This 'context' is the instance that originated this IPC message.
-      context = promiseResolver.context;
-    }
-
-    switch (message.name) {
-      case "SE:GetSEReadersResolved":
-        let readers = new this._window.Array();
-        result.readers.forEach(reader => {
-          let readerImpl = new SEReaderImpl();
-          readerImpl.initialize(this._window, reader.type, reader.isPresent);
-          this._window.SEReader._create(this._window, readerImpl);
-
-          this._readers.push(readerImpl);
-          readers.push(readerImpl.__DOM_IMPL__);
-        });
-        resolver.resolve(readers);
-        break;
-      case "SE:OpenChannelResolved":
-        let channelImpl = new SEChannelImpl();
-        channelImpl.initialize(this._window,
-                               result.channelToken,
-                               result.isBasicChannel,
-                               result.openResponse,
-                               context);
-        this._window.SEChannel._create(this._window, channelImpl);
-        if (context) {
-          // Notify context's handler with SEChannel instance
-          context.onChannelOpen(channelImpl);
-        }
-        resolver.resolve(channelImpl.__DOM_IMPL__);
-        break;
-      case "SE:TransmitAPDUResolved":
-        let responseImpl = new SEResponseImpl();
-        responseImpl.initialize(result.sw1,
-                                result.sw2,
-                                result.response,
-                                context);
-        this._window.SEResponse._create(this._window, responseImpl);
-        resolver.resolve(responseImpl.__DOM_IMPL__);
-        break;
-      case "SE:CloseChannelResolved":
-        if (context) {
-          // Notify context's onClose handler
-          context.onClose();
-        }
-        resolver.resolve();
-        break;
-      case "SE:GetSEReadersRejected":
-      case "SE:OpenChannelRejected":
-      case "SE:CloseChannelRejected":
-      case "SE:TransmitAPDURejected":
-        let error = new SEError(result.error, result.reason);
-        resolver.reject(Cu.cloneInto(error, this._window));
-        break;
-      case "SE:ReaderPresenceChanged":
-        debug("Reader " + result.type + " present: " + result.isPresent);
-        let reader = this._readers.find(r => r.type === result.type);
-        if (reader) {
-          reader.updateSEPresence(result.isPresent);
-        }
-        break;
-      default:
-        debug("Could not find a handler for " + message.name);
-        resolver.reject(Cu.cloneInto(new SEError(), this._window));
-        break;
-    }
-  }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
-  SEResponseImpl, SEChannelImpl, SESessionImpl, SEReaderImpl, SEManagerImpl
-]);
deleted file mode 100644
--- a/dom/secureelement/DOMSecureElement.manifest
+++ /dev/null
@@ -1,14 +0,0 @@
-component {4a8b6ec0-4674-11e4-916c-0800200c9a66} DOMSecureElement.js
-contract @mozilla.org/secureelement/manager;1 {4a8b6ec0-4674-11e4-916c-0800200c9a66}
-
-component {1c7bdba3-cd35-4f8b-a546-55b3232457d5} DOMSecureElement.js
-contract @mozilla.org/secureelement/reader;1 {1c7bdba3-cd35-4f8b-a546-55b3232457d5}
-
-component {2b1809f8-17bd-4947-abd7-bdef1498561c} DOMSecureElement.js
-contract @mozilla.org/secureelement/session;1 {2b1809f8-17bd-4947-abd7-bdef1498561c}
-
-component {181ebcf4-5164-4e28-99f2-877ec6fa83b9} DOMSecureElement.js
-contract @mozilla.org/secureelement/channel;1 {181ebcf4-5164-4e28-99f2-877ec6fa83b9}
-
-component {58bc6c7b-686c-47cc-8867-578a6ed23f4e} DOMSecureElement.js
-contract @mozilla.org/secureelement/response;1 {58bc6c7b-686c-47cc-8867-578a6ed23f4e}
deleted file mode 100644
--- a/dom/secureelement/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# Copyright © 2014 Deutsche Telekom, Inc.
-
-# All of this seems to be FirefoxOS::NFC
-with Files("**"):
-    BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
-
-if CONFIG['MOZ_SECUREELEMENT']:
-    EXTRA_COMPONENTS += [
-        'DOMSecureElement.js',
-        'DOMSecureElement.manifest',
-    ]
deleted file mode 100644
--- a/dom/webidl/SecureElement.webidl
+++ /dev/null
@@ -1,158 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- /* Copyright © 2014 Deutsche Telekom, Inc. */
-
-enum SEType {
-  "uicc",
-  "eSE"
-};
-
-enum SEError {
-  "SESecurityError",            // Requested operation does not match the access control rules of the application.
-  "SEIoError",                  // I/O Error while communicating with the secure element.
-  "SEBadStateError",            // Error occuring as a result of bad state.
-  "SEInvalidChannelError",      // Opening a channel failed because no channel is available.
-  "SEInvalidApplicationError",  // The requested application was not found on the secure element.
-  "SENotPresentError",          // Secure Element is not present
-  "SEIllegalParameterError",    // Request operation does not have valid parameters.
-  "SEGenericError"              // Generic failures.
-};
-
-enum SEChannelType {
-  "basic",
-  "logical"
-};
-
-// Dictionary that represents an APDU command to be sent to a secure element.
-dictionary SECommand {
-  required octet cla;            // Class Byte
-  required octet ins;            // Instruction Byte
-  required octet p1;             // First Octet of Parameters Byte
-  required octet p2;             // Second Octet of Parameters Byte
-  sequence<octet>? data = null;  // Sequence of octets
-  short le = -1;                 // The length of the expected
-                                 // response data or -1 if none is expected
-};
-
-[Pref="dom.secureelement.enabled",
- ChromeOnly,
- JSImplementation="@mozilla.org/secureelement/reader;1"]
-interface SEReader {
-
-  // 'true' if a secure element is present
-  readonly attribute boolean isSEPresent;
-
-  // Type of SecureElement
-  readonly attribute SEType type;
-
-  /**
-   * Opens a session with the Secure Element.
-   * Note that a reader may have several opened sessions.
-   *
-   * @return If the operation is successful the promise is resolved with an instance of SESession.
-   */
-  [Throws]
-  Promise<SESession> openSession();
-
-  /**
-   * Closes all sessions associated with this Reader and its associated channels.
-   *
-   */
-  [Throws]
-  Promise<void> closeAll();
-};
-
-[Pref="dom.secureelement.enabled",
- ChromeOnly,
- JSImplementation="@mozilla.org/secureelement/session;1"]
-interface SESession {
-
-  // 'reader' that provides this session
-  readonly attribute SEReader reader;
-
-  // Status of current session
-  readonly attribute boolean isClosed;
-
-  /**
-   * Opens a communication logical channel to an application on Secure Element identified by the AID.
-   * The 'aid' can be null for some secure elements.
-   *
-   * @param aid
-   *     Application Identifier of the Card Applet on the secure element.
-   *     If the 'aid' is null :
-   *       For secure element type 'eSE', the default applet is selected.
-   *       For secure element type 'uicc', the request will be immediately rejected.
-   *     Note that the length of 'aid should be between 5 and 16.
-   *
-   * @return If the operation is successful the promise is resolved with an instance of SEChannel.
-   */
-  [Throws]
-  Promise<SEChannel> openLogicalChannel(Uint8Array? aid);
-
-  /**
-   * Close all active channels associated with this session.
-   *
-   */
-  [Throws]
-  Promise<void> closeAll();
-};
-
-[Pref="dom.secureelement.enabled",
- ChromeOnly,
- JSImplementation="@mozilla.org/secureelement/channel;1"]
-interface SEChannel {
-
-  // 'session' obj this channel is bound to
-  readonly attribute SESession session;
-
-  // response to openBasicChannel / openLogicalChannel operation
-  [Constant, Cached] readonly  attribute Uint8Array? openResponse;
-
-  // Status of channel
-  readonly attribute boolean isClosed;
-
-  // Type of channel
-  readonly attribute SEChannelType type;
-
-  /**
-   * Transmits the APDU command to the secure element. This is an atomic operation that transmits
-   * an APDU command (as per ISO7816-4) to the secure element (UICC / eSE). Upon receiving response
-   * to the transmit apdu command, it is propogated to the applications using SEResponse object.
-   *
-   * @param command
-   *     SECommand to be sent to secure element
-   *
-   * @return If success, the promise is resolved with the new created
-   * SEResponse object. Otherwise, rejected with the error of type 'SEError'.
-   */
-  [Throws]
-  Promise<SEResponse> transmit(optional SECommand command);
-
-  /**
-   * Closes the active channel.
-   *
-   */
-  [Throws]
-  Promise<void> close();
-};
-
-[Pref="dom.secureelement.enabled",
- ChromeOnly,
- JSImplementation="@mozilla.org/secureelement/response;1"]
-interface SEResponse {
-  // Response received on this 'channel' object.
-  [Constant] readonly attribute SEChannel channel;
-
-  // First octet of response's status word
-  [Constant] readonly attribute octet        sw1;
-
-  // Second octet of response's status word
-  [Constant] readonly attribute octet        sw2;
-
-  // The response's data field bytes
-  [Cached, Pure] readonly attribute sequence<octet>?  data;
-
-};
-
deleted file mode 100644
--- a/dom/webidl/SecureElementManager.webidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- /* Copyright © 2014 Deutsche Telekom, Inc. */
-
-[Pref="dom.secureelement.enabled",
- ChromeOnly,
- JSImplementation="@mozilla.org/secureelement/manager;1",
- NavigatorProperty="seManager",
- NoInterfaceObject]
-interface SEManager {
-
-  /**
-   * Retrieves all the readers available on the device.
-   *
-   * @return If success, the promise is resolved to  a sequence
-   *        of SEReaders Otherwise, rejected with an error.
-   */
-  [Throws]
-  Promise<sequence<SEReader>> getSEReaders();
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -260,17 +260,17 @@ with Files("RTC*"):
     BUG_COMPONENT = ("Core", "WebRTC")
 
 with Files("SVG*"):
     BUG_COMPONENT = ("Core", "SVG")
 
 with Files("ScriptProcessorNode.webidl"):
     BUG_COMPONENT = ("Core", "Web Audio")
 
-# TODO: SecureElement*, SettingChangeNotification
+# TODO: SettingChangeNotification
 # are FirefoxOS::*, leaving as Core::DOM
 
 with Files("Selection.webidl"):
     BUG_COMPONENT = ("Core", "Selection")
 
 with Files("ServiceWorker*"):
     BUG_COMPONENT = ("Core", "DOM: Service Workers")
 
@@ -1029,22 +1029,16 @@ WEBIDL_FILES += [
 # We only expose our prefable test interfaces in debug builds, just to be on
 # the safe side.
 if CONFIG['MOZ_DEBUG']:
     WEBIDL_FILES += ['TestFunctions.webidl',
                      'TestInterfaceJS.webidl',
                      'TestInterfaceJSDictionaries.webidl',
                      'TestInterfaceJSMaplikeSetlikeIterable.webidl']
 
-if CONFIG['MOZ_SECUREELEMENT']:
-    WEBIDL_FILES += [
-         'SecureElement.webidl',
-         'SecureElementManager.webidl',
-    ]
-
 WEBIDL_FILES += [
     'InstallTrigger.webidl',
 ]
 
 if CONFIG['FUZZING']:
     WEBIDL_FILES += [
         'FuzzingFunctions.webidl',
     ]
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -73,17 +73,12 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
     ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     LOCAL_INCLUDES += [
         '/dom/media/webspeech/recognition',
         '/dom/media/webspeech/synth',
     ]
 
-if CONFIG['MOZ_SECUREELEMENT']:
-    LOCAL_INCLUDES += [
-        '/dom/secureelement',
-    ]
-
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5738,21 +5738,16 @@ pref("narrate.filter-voices", true);
 // features, loading Gecko Media Plugins unsandboxed.  However, EME CDMs will not be
 // loaded without sandboxing even if this pref is changed.
 pref("media.gmp.insecure.allow", false);
 #endif
 
 // HTML <dialog> element
 pref("dom.dialog_element.enabled", false);
 
-// Secure Element API
-#ifdef MOZ_SECUREELEMENT
-pref("dom.secureelement.enabled", false);
-#endif
-
 // Allow control characters appear in composition string.
 // When this is false, control characters except
 // CHARACTER TABULATION (horizontal tab) are removed from
 // both composition string and data attribute of compositionupdate
 // and compositionend events.
 pref("dom.compositionevent.allow_control_characters", false);
 
 pref("memory.report_concurrency", 10);
--- a/old-configure.in
+++ b/old-configure.in
@@ -3792,25 +3792,16 @@ MOZ_ARG_DISABLE_BOOL(startupcache,
     MOZ_DISABLE_STARTUPCACHE=)
 
 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
 fi
 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
 
 dnl ========================================================
-dnl = Enable Support for Secure Element API
-dnl ========================================================
-   MOZ_SECUREELEMENT=1,
-if test -n "$MOZ_SECUREELEMENT"; then
-   AC_DEFINE(MOZ_SECUREELEMENT)
-fi
- AC_SUBST(MOZ_SECUREELEMENT)
-
-dnl ========================================================
 dnl = Support for demangling undefined symbols
 dnl ========================================================
 if test -z "$SKIP_LIBRARY_CHECKS"; then
     AC_LANG_SAVE
     AC_LANG_CPLUSPLUS
     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
     AC_LANG_RESTORE
 fi