Merge m-c to inbound, a=merge
authorWes Kocher <wkocher@mozilla.com>
Thu, 28 Jul 2016 17:04:59 -0700
changeset 349299 5aeb092868f81a1a2ed987dfcae509ec89b818d5
parent 349298 c2211a92bce2048fb6b541a85fd306225d4f32f3 (current diff)
parent 349147 ddeb0295df692695b36295177d6790e5393e1f9a (diff)
child 349300 56e69ffed4a9c21cc9472a567878ea2a0040fc3b
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to inbound, a=merge
widget/gonk/hwchal/HwcICS.cpp
widget/gonk/hwchal/HwcICS.h
widget/gonk/libdisplay/GonkDisplayICS.cpp
widget/gonk/libdisplay/GonkDisplayICS.h
widget/gonk/nativewindow/GonkNativeWindowICS.cpp
widget/gonk/nativewindow/GonkNativeWindowICS.h
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -3410,19 +3410,19 @@ ElementEditor.prototype = {
         } else if (isModifiedOrder) {
           // The attribute was renamed, reordering the existing attributes.
           // So let's go to the beginning of the attribute list for consistency.
           activeEditor = visibleAttrs[0];
         } else {
           let newAttributeIndex;
           if (isDeletedAttribute) {
             newAttributeIndex = attributeIndex;
-          } else if (direction == Ci.nsIFocusManager.MOVEFOCUS_FORWARD) {
+          } else if (direction == Services.focus.MOVEFOCUS_FORWARD) {
             newAttributeIndex = attributeIndex + 1;
-          } else if (direction == Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
+          } else if (direction == Services.focus.MOVEFOCUS_BACKWARD) {
             newAttributeIndex = attributeIndex - 1;
           }
 
           // The number of attributes changed (deleted), or we moved through
           // the array so check we're still within bounds.
           if (newAttributeIndex >= 0 &&
               newAttributeIndex <= visibleAttrs.length - 1) {
             activeEditor = visibleAttrs[newAttributeIndex];
--- a/devtools/client/inspector/rules/models/rule.js
+++ b/devtools/client/inspector/rules/models/rule.js
@@ -1,19 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
-/* eslint-disable mozilla/reject-some-requires */
-const {Ci} = require("chrome");
-/* eslint-enable mozilla/reject-some-requires */
 const promise = require("promise");
 const CssLogic = require("devtools/shared/inspector/css-logic");
 const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
 const {TextProperty} =
       require("devtools/client/inspector/rules/models/text-property");
 const {promiseWarn} = require("devtools/client/inspector/shared/utils");
 const {parseDeclarations} = require("devtools/shared/css-parsing-utils");
 const Services = require("Services");
@@ -622,28 +619,28 @@ Rule.prototype = {
    * @param {TextProperty} textProperty
    *        The text property that will be left to focus on a sibling.
    * @param {Number} direction
    *        The move focus direction number.
    */
   editClosestTextProperty: function (textProperty, direction) {
     let index = this.textProps.indexOf(textProperty);
 
-    if (direction === Ci.nsIFocusManager.MOVEFOCUS_FORWARD) {
+    if (direction === Services.focus.MOVEFOCUS_FORWARD) {
       for (++index; index < this.textProps.length; ++index) {
         if (!this.textProps[index].invisible) {
           break;
         }
       }
       if (index === this.textProps.length) {
         textProperty.rule.editor.closeBrace.click();
       } else {
         this.textProps[index].editor.nameSpan.click();
       }
-    } else if (direction === Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
+    } else if (direction === Services.focus.MOVEFOCUS_BACKWARD) {
       for (--index; index >= 0; --index) {
         if (!this.textProps[index].invisible) {
           break;
         }
       }
       if (index < 0) {
         textProperty.editor.ruleEditor.selectorText.click();
       } else {
--- a/devtools/client/inspector/rules/views/rule-editor.js
+++ b/devtools/client/inspector/rules/views/rule-editor.js
@@ -1,18 +1,15 @@
 /* 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/. */
 
 "use strict";
 
 /* eslint-disable mozilla/reject-some-requires */
-const {Ci} = require("chrome");
-/* eslint-enable mozilla/reject-some-requires */
-/* eslint-disable mozilla/reject-some-requires */
 const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
 /* eslint-enable mozilla/reject-some-requires */
 const {l10n} = require("devtools/shared/inspector/css-logic");
 const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
 const {PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
 const {Rule} = require("devtools/client/inspector/rules/models/rule");
 const {InplaceEditor, editableField, editableItem} =
       require("devtools/client/shared/inplace-editor");
@@ -579,17 +576,17 @@ RuleEditor.prototype = {
   /**
    * Handle moving the focus change after a tab or return keypress in the
    * selector inplace editor.
    *
    * @param {Number} direction
    *        The move focus direction number.
    */
   _moveSelectorFocus: function (direction) {
-    if (!direction || direction === Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
+    if (!direction || direction === Services.focus.MOVEFOCUS_BACKWARD) {
       return;
     }
 
     if (this.rule.textProps.length > 0) {
       this.rule.textProps[0].editor.nameSpan.click();
     } else {
       this.propertyList.click();
     }
--- a/devtools/client/inspector/rules/views/text-property-editor.js
+++ b/devtools/client/inspector/rules/views/text-property-editor.js
@@ -1,32 +1,30 @@
 /* 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/. */
 
 "use strict";
 
-/* eslint-disable mozilla/reject-some-requires */
-const {Ci} = require("chrome");
-/* eslint-enable mozilla/reject-some-requires */
 const {l10n} = require("devtools/shared/inspector/css-logic");
 const {getCssProperties} = require("devtools/shared/fronts/css-properties");
 const {InplaceEditor, editableField} =
       require("devtools/client/shared/inplace-editor");
 const {
   createChild,
   appendText,
   advanceValidate,
   blurOnMultipleProperties,
   throttle
 } = require("devtools/client/inspector/shared/utils");
 const {
   parseDeclarations,
   parseSingleValue,
 } = require("devtools/shared/css-parsing-utils");
+const Services = require("Services");
 
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
 const SHARED_SWATCH_CLASS = "ruleview-swatch";
 const COLOR_SWATCH_CLASS = "ruleview-colorswatch";
 const BEZIER_SWATCH_CLASS = "ruleview-bezierswatch";
 const FILTER_SWATCH_CLASS = "ruleview-filterswatch";
 const ANGLE_SWATCH_CLASS = "ruleview-angleswatch";
@@ -637,17 +635,17 @@ TextPropertyEditor.prototype = {
     if (!value.trim()) {
       this.remove(direction);
       return;
     }
 
     // Remove a property if the property value is empty and the property
     // value is not about to be focused
     if (!this.prop.value &&
-        direction !== Ci.nsIFocusManager.MOVEFOCUS_FORWARD) {
+        direction !== Services.focus.MOVEFOCUS_FORWARD) {
       this.remove(direction);
       return;
     }
 
     // Adding multiple rules inside of name field overwrites the current
     // property with the first, then adds any more onto the property list.
     let properties = parseDeclarations(this.cssProperties.isKnown, value);
 
@@ -736,17 +734,17 @@ TextPropertyEditor.prototype = {
     // If needed, add any new properties after this.prop.
     this.ruleEditor.addProperties(parsedProperties.propertiesToAdd, this.prop);
 
     // If the input value is empty and the focus is moving forward to the next
     // editable field, then remove the whole property.
     // A timeout is used here to accurately check the state, since the inplace
     // editor `done` and `destroy` events fire before the next editor
     // is focused.
-    if (!value.trim() && direction !== Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
+    if (!value.trim() && direction !== Services.focus.MOVEFOCUS_BACKWARD) {
       setTimeout(() => {
         if (!this.editing) {
           this.remove(direction);
         }
       }, 0);
     }
   },
 
--- a/devtools/client/netmonitor/netmonitor.xul
+++ b/devtools/client/netmonitor/netmonitor.xul
@@ -295,17 +295,17 @@
                       standalone="true"
                       label="&netmonitorUI.reloadNotice2;"/>
               <label value="&netmonitorUI.reloadNotice3;"/>
             </hbox>
             <hbox id="notice-perf-message" align="center">
               <label value="&netmonitorUI.perfNotice1;"/>
               <button id="requests-menu-perf-notice-button"
                       standalone="true"
-                      label="&netmonitorUI.perfNotice3;"
+                      tooltiptext="&netmonitorUI.perfNotice3;"
                       class="devtools-toolbarbutton"/>
               <label value="&netmonitorUI.perfNotice2;"/>
             </hbox>
           </vbox>
 
           <vbox id="requests-menu-contents" flex="1" context="network-request-popup">
             <hbox id="requests-menu-item-template" hidden="true">
               <hbox class="requests-menu-subitem requests-menu-status"
--- a/devtools/client/shared/inplace-editor.js
+++ b/devtools/client/shared/inplace-editor.js
@@ -20,31 +20,32 @@
  *
  * See editableField() for more options.
  */
 
 "use strict";
 
 const {Ci, Cc} = require("chrome");
 const Services = require("Services");
+const focusManager = Services.focus;
 
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 const CONTENT_TYPES = {
   PLAIN_TEXT: 0,
   CSS_VALUE: 1,
   CSS_MIXED: 2,
   CSS_PROPERTY: 3,
 };
 
 // The limit of 500 autocomplete suggestions should not be reached but is kept
 // for safety.
 const MAX_POPUP_ENTRIES = 500;
 
-const FOCUS_FORWARD = Ci.nsIFocusManager.MOVEFOCUS_FORWARD;
-const FOCUS_BACKWARD = Ci.nsIFocusManager.MOVEFOCUS_BACKWARD;
+const FOCUS_FORWARD = focusManager.MOVEFOCUS_FORWARD;
+const FOCUS_BACKWARD = focusManager.MOVEFOCUS_BACKWARD;
 
 const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
 const EventEmitter = require("devtools/shared/event-emitter");
 const { findMostRelevantCssPropertyIndex } = require("./suggestion-picker");
 
 /**
  * Helper to check if the provided key matches one of the expected keys.
  * Keys will be prefixed with DOM_VK_ and should match a key in nsIDOMKeyEvent.
@@ -78,18 +79,18 @@ function isKeyIn(key, ...keys) {
  *       Will be called when the inplace editor is initialized.
  *    {Function} change:
  *       Will be called when the text input changes.  Will be called
  *       with the current value of the text input.
  *    {Function} done:
  *       Called when input is committed or blurred.  Called with
  *       current value, a boolean telling the caller whether to
  *       commit the change, and the direction of the next element to be
- *       selected. Direction may be one of nsIFocusManager.MOVEFOCUS_FORWARD,
- *       nsIFocusManager.MOVEFOCUS_BACKWARD, or null (no movement).
+ *       selected. Direction may be one of Services.focus.MOVEFOCUS_FORWARD,
+ *       Services.focus.MOVEFOCUS_BACKWARD, or null (no movement).
  *       This function is called before the editor has been torn down.
  *    {Function} destroy:
  *       Called when the editor is destroyed and has been torn down.
  *    {Object} advanceChars:
  *       This can be either a string or a function.
  *       If it is a string, then if any characters in it are typed,
  *       focus will advance to the next element.
  *       Otherwise, if it is a function, then the function will
@@ -1549,19 +1550,15 @@ function copyBoxModelStyles(from, to) {
 
 /**
  * Trigger a focus change similar to pressing tab/shift-tab.
  */
 function moveFocus(win, direction) {
   return focusManager.moveFocus(win, null, direction, 0);
 }
 
-XPCOMUtils.defineLazyGetter(this, "focusManager", function () {
-  return Services.focus;
-});
-
 XPCOMUtils.defineLazyGetter(this, "CSSPropertyList", function () {
   return domUtils.getCSSPropertyNames(domUtils.INCLUDE_ALIASES).sort();
 });
 
 XPCOMUtils.defineLazyGetter(this, "domUtils", function () {
   return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
 });
--- a/devtools/client/shared/shim/Services.js
+++ b/devtools/client/shared/shim/Services.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
-/* globals localStorage, window */
+/* globals localStorage, window, document, NodeFilter */
 
 // Some constants from nsIPrefBranch.idl.
 const PREF_INVALID = 0;
 const PREF_STRING = 32;
 const PREF_INT = 64;
 const PREF_BOOL = 128;
 const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
 
@@ -514,16 +514,73 @@ const Services = {
     },
 
     getKeyedHistogramById: function (name) {
       return {
         add: () => {}
       };
     },
   },
+
+  /**
+   * An implementation of Services.focus that holds just the
+   * properties and methods needed by devtools.
+   * @see nsIFocusManager.idl for details.
+   */
+  focus: {
+    // These values match nsIFocusManager in order to make testing a
+    // bit simpler.
+    MOVEFOCUS_FORWARD: 1,
+    MOVEFOCUS_BACKWARD: 2,
+
+    get focusedElement() {
+      if (!document.hasFocus()) {
+        return null;
+      }
+      return document.activeElement;
+    },
+
+    moveFocus: function (window, startElement, type, flags) {
+      if (flags !== 0) {
+        throw new Error("shim Services.focus.moveFocus only accepts flags===0");
+      }
+      if (type !== Services.focus.MOVEFOCUS_FORWARD
+          && type !== Services.focus.MOVEFOCUS_BACKWARD) {
+        throw new Error("shim Services.focus.moveFocus only supports " +
+                        " MOVEFOCUS_FORWARD and MOVEFOCUS_BACKWARD");
+      }
+
+      if (!startElement) {
+        startElement = document.activeElement || document;
+      }
+
+      let iter = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, {
+        acceptNode: function (node) {
+          let tabIndex = node.getAttribute("tabindex");
+          if (tabIndex === "-1") {
+            return NodeFilter.FILTER_SKIP;
+          }
+          node.focus();
+          if (document.activeElement == node) {
+            return NodeFilter.FILTER_ACCEPT;
+          }
+          return NodeFilter.FILTER_SKIP;
+        }
+      });
+
+      iter.currentNode = startElement;
+
+      // Sets the focus via side effect in the filter.
+      if (type === Services.focus.MOVEFOCUS_FORWARD) {
+        iter.nextNode();
+      } else {
+        iter.previousNode();
+      }
+    },
+  },
 };
 
 /**
  * Create a new preference.  This is used during startup (see
  * devtools/client/preferences/devtools.js) to install the
  * default preferences.
  *
  * @param {String} name the name of the preference
--- a/devtools/client/shared/shim/test/mochitest.ini
+++ b/devtools/client/shared/shim/test/mochitest.ini
@@ -1,6 +1,7 @@
 [DEFAULT]
 support-files =
   prefs-wrapper.js
 
 [test_service_appinfo.html]
+[test_service_focus.html]
 [test_service_prefs.html]
new file mode 100644
--- /dev/null
+++ b/devtools/client/shared/shim/test/test_service_focus.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1278473
+-->
+<head>
+  <title>Test for Bug 1278473 - replace Services.focus</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css"
+        href="chrome://mochikit/content/tests/SimpleTest/test.css">
+
+  <script type="application/javascript;version=1.8">
+  "use strict";
+  var exports = {};
+  </script>
+
+  <script type="application/javascript;version=1.8"
+	  src="resource://devtools/client/shared/shim/Services.js"></script>
+</head>
+<body>
+  <span>
+    <span id="start" testvalue="0" tabindex="0"> </span>
+    <label>
+      <input testvalue="1" type="radio">Hi</input>
+    </label>
+    <label>
+      <input type="radio" tabindex="-1">Bye</input>
+    </label>
+    <label style="display: none">
+      <input id="button3" type="radio" tabindex="-1">Invisible</input>
+    </label>
+    <input id="button4" type="radio" disabled="true">Disabled</input>
+    <span testvalue="2" tabindex="0"> </span>
+  </span>
+
+<script type="application/javascript;version=1.8">
+  "use strict";
+
+  // The test assumes these are identical, so assert it here.
+  is(Services.focus.MOVEFOCUS_BACKWARD, SpecialPowers.Services.focus.MOVEFOCUS_BACKWARD,
+     "check MOVEFOCUS_BACKWARD");
+  is(Services.focus.MOVEFOCUS_FORWARD, SpecialPowers.Services.focus.MOVEFOCUS_FORWARD,
+     "check MOVEFOCUS_FORWARD");
+
+  function moveFocus(element, type, expect) {
+    let current = document.activeElement;
+    const suffix = "(type=" + type + ", to=" + expect + ")";
+
+    // First try with the platform implementation.
+    SpecialPowers.Services.focus.moveFocus(window, element, type, 0);
+    is(document.activeElement.getAttribute("testvalue"), expect,
+       "platform moveFocus " + suffix);
+
+    // Reset the focus and try again with the shim.
+    current.focus();
+    is(document.activeElement, current, "reset " + suffix);
+
+    Services.focus.moveFocus(window, element, type, 0);
+    is(document.activeElement.getAttribute("testvalue"), expect,
+       "shim moveFocus " + suffix);
+  }
+
+  let start = document.querySelector("#start");
+  start.focus();
+  is(document.activeElement.getAttribute("testvalue"), "0", "initial focus");
+
+  moveFocus(null, Services.focus.MOVEFOCUS_FORWARD, "1");
+  moveFocus(null, Services.focus.MOVEFOCUS_FORWARD, "2");
+  let end = document.activeElement;
+  moveFocus(null, Services.focus.MOVEFOCUS_BACKWARD, "1");
+  moveFocus(null, Services.focus.MOVEFOCUS_BACKWARD, "0");
+
+  moveFocus(start, Services.focus.MOVEFOCUS_FORWARD, "1");
+  moveFocus(end, Services.focus.MOVEFOCUS_BACKWARD, "1");
+</script>
+</body>
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -79,28 +79,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
     LOCAL_INCLUDES += [
         '/dom/system',
         '/dom/system/android',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     LOCAL_INCLUDES += [
         '/dom/system/gonk',
     ]
-    if CONFIG['ANDROID_VERSION'] == '15':
-        LOCAL_INCLUDES += [
-            '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
-                'dalvik/libnativehelper/include/nativehelper',
-                'frameworks/base/include',
-                'frameworks/base/include/binder',
-                'frameworks/base/include/media',
-                'frameworks/base/include/media/stagefright/openmax',
-                'frameworks/base/include/utils',
-                'frameworks/base/media/libstagefright/include',
-            ]
-        ]
 
 if CONFIG['MOZ_B2G_FM']:
     LOCAL_INCLUDES += [
         '/dom/fmradio',
     ]
 
 if CONFIG['MOZ_B2G_BT']:
     LOCAL_INCLUDES += [
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -67,16 +67,17 @@ typedef union {
 /**
  * Class that hold a single size specification used by the style
  * system.  The size specification consists of two parts -- a number
  * and a unit.  The number is an integer, a floating point value, an
  * nscoord, or undefined, and the unit is an nsStyleUnit.  Checking
  * the unit is a must before asking for the value in any particular
  * form.
  */
+ /** <div rustbindgen private accessor="unsafe"></div> */
 class nsStyleCoord {
 public:
   // Non-reference counted calc() value.  See nsStyleStruct.h for some uses
   // of this.
   struct CalcValue {
     // Every calc() expression evaluates to a length plus a percentage.
     nscoord mLength;
     float mPercent;
@@ -257,16 +258,17 @@ private:
   nsStyleUnion  mValue;
 };
 
 /**
  * Class that represents a set of top/right/bottom/left nsStyleCoords.
  * This is commonly used to hold the widths of the borders, margins,
  * or paddings of a box.
  */
+ /** <div rustbindgen private accessor="unsafe"></div> */
 class nsStyleSides {
 public:
   nsStyleSides();
   nsStyleSides(const nsStyleSides&);
   ~nsStyleSides();
 
   nsStyleSides&  operator=(const nsStyleSides& aCopy);
   bool           operator==(const nsStyleSides& aOther) const;
@@ -335,16 +337,17 @@ protected:
   nsStyleUnion  mValues[4];
 };
 
 /**
  * Class that represents a set of top-left/top-right/bottom-left/bottom-right
  * nsStyleCoord pairs.  This is used to hold the dimensions of the
  * corners of a box (for, e.g., border-radius and outline-radius).
  */
+ /** <div rustbindgen private accessor="unsafe"></div> */
 class nsStyleCorners {
 public:
   nsStyleCorners();
   nsStyleCorners(const nsStyleCorners&);
   ~nsStyleCorners();
 
   // use compiler's version
   nsStyleCorners& operator=(const nsStyleCorners& aCopy);
--- a/media/omx-plugin/moz.build
+++ b/media/omx-plugin/moz.build
@@ -31,32 +31,16 @@ else:
 if CONFIG['GNU_CXX']:
     # Stagefright header files define many multichar constants.
     CXXFLAGS += [
         '-Wno-multichar',
         '-Wno-shadow',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    if CONFIG['ANDROID_VERSION'] == '15':
-        LOCAL_INCLUDES += [
-             '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
-                 'dalvik/libnativehelper/include/nativehelper',
-                 'frameworks/base/include/',
-                 'frameworks/base/include/binder/',
-                 'frameworks/base/include/media/',
-                 'frameworks/base/include/media/stagefright/openmax',
-                 'frameworks/base/include/utils/',
-                 'frameworks/base/media/libstagefright/include',
-                 'frameworks/base/native/include',
-                 'hardware/libhardware/include',
-                 'system/core/include',
-             ]
-        ]
-
     EXTRA_DSO_LDOPTS += [
         '-lutils',
         '-lstagefright',
         '-lmedia',
         '-lstagefright_omx',
         '-lbinder',
         '-lui',
         '-lhardware',
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -8,16 +8,20 @@ this.EXPORTED_SYMBOLS = ["FinderHighligh
 
 const { interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Color", "resource://gre/modules/Color.jsm");
+XPCOMUtils.defineLazyGetter(this, "kDebug", () => {
+  const kDebugPref = "findbar.modalHighlight.debug";
+  return Services.prefs.getPrefType(kDebugPref) && Services.prefs.getBoolPref(kDebugPref);
+});
 
 const kModalHighlightRepaintFreqMs = 10;
 const kModalHighlightPref = "findbar.modalHighlight";
 const kFontPropsCSS = ["color", "font-family", "font-kerning", "font-size",
   "font-size-adjust", "font-stretch", "font-variant", "font-weight", "letter-spacing",
   "text-emphasis", "text-orientation", "text-transform", "word-spacing"];
 const kFontPropsCamelCase = kFontPropsCSS.map(prop => {
   let parts = prop.split("-");
@@ -45,16 +49,20 @@ const kModalStyle = `
   padding-top: 2px;
   padding-inline-end: 2px;
   padding-bottom: 0;
   padding-inline-start: 4px;
   pointer-events: none;
   z-index: 2;
 }
 
+.findbar-modalHighlight-outline.findbar-debug {
+  z-index: 2147483647;
+}
+
 .findbar-modalHighlight-outline[grow] {
   transform: scaleX(1.5) scaleY(1.5)
 }
 
 .findbar-modalHighlight-outline[hidden] {
   opacity: 0;
   display: -moz-box;
 }
@@ -68,31 +76,65 @@ const kModalStyle = `
 .findbar-modalHighlight-outlineMask {
   background: #000;
   mix-blend-mode: multiply;
   opacity: .2;
   position: absolute;
   z-index: 1;
 }
 
+.findbar-modalHighlight-outlineMask.findbar-debug {
+  z-index: 2147483646;
+  top: 0;
+  left: 0;
+}
+
 .findbar-modalHighlight-outlineMask[brighttext] {
   background: #fff;
 }
 
 .findbar-modalHighlight-rect {
   background: #fff;
   border: 1px solid #666;
   position: absolute;
 }
 
 .findbar-modalHighlight-outlineMask[brighttext] > .findbar-modalHighlight-rect {
   background: #000;
 }`;
 const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
+function mockAnonymousContentNode(domNode) {
+  return {
+    setTextContentForElement(id, text) {
+      (domNode.querySelector("#" + id) || domNode).textContent = text;
+    },
+    getAttributeForElement(id, attrName) {
+      let node = domNode.querySelector("#" + id) || domNode;
+      if (!node.hasAttribute(attrName))
+        return undefined;
+      return node.getAttribute(attrName);
+    },
+    setAttributeForElement(id, attrName, attrValue) {
+      (domNode.querySelector("#" + id) || domNode).setAttribute(attrName, attrValue);
+    },
+    removeAttributeForElement(id, attrName) {
+      let node = domNode.querySelector("#" + id) || domNode;
+      if (!node.hasAttribute(attrName))
+        return;
+      node.removeAttribute(attrName);
+    },
+    remove() {
+      try {
+        domNode.parentNode.removeChild(domNode);
+      } catch (ex) {}
+    }
+  };
+}
+
 /**
  * FinderHighlighter class that is used by Finder.jsm to take care of the
  * 'Highlight All' feature, which can highlight all find occurrences in a page.
  *
  * @param {Finder} finder Finder.jsm instance
  */
 function FinderHighlighter(finder) {
   this.finder = finder;
@@ -362,16 +404,18 @@ FinderHighlighter.prototype = {
    * contents is not valid anymore, i.e. all anonymous content is destroyed.
    * We need to clear the references we keep, which'll make sure we redraw
    * everything when the user starts to find in page again.
    */
   onLocationChange() {
     if (!this._modalHighlightOutline)
       return;
 
+    if (kDebug)
+      this._modalHighlightOutline.remove();
     try {
       this.finder._getWindow().document
         .removeAnonymousContent(this._modalHighlightOutline);
     } catch(ex) {}
 
     this._modalHighlightOutline = null;
   },
 
@@ -573,26 +617,28 @@ FinderHighlighter.prototype = {
 
     // The outline needs to be sitting inside a container, otherwise the anonymous
     // content API won't find it by its ID later...
     let container = document.createElement("div");
 
     // Create the main (yellow) highlight outline box.
     let outlineBox = document.createElement("div");
     outlineBox.setAttribute("id", kModalOutlineId);
-    outlineBox.className = kModalOutlineId;
+    outlineBox.className = kModalOutlineId + (kDebug ? ` ${kModalIdPrefix}-findbar-debug` : "");
     let outlineBoxText = document.createElement("span");
     outlineBoxText.setAttribute("id", kModalOutlineId + "-text");
     outlineBox.appendChild(outlineBoxText);
 
     container.appendChild(outlineBox);
 
     this._repaintHighlightAllMask(window);
 
-    this._modalHighlightOutline = document.insertAnonymousContent(container);
+    this._modalHighlightOutline = kDebug ?
+      mockAnonymousContentNode(document.body.appendChild(container.firstChild)) :
+      document.insertAnonymousContent(container);
     return this._modalHighlightOutline;
   },
 
   /**
    * Build and draw the mask that takes care of the dimmed background that
    * overlays the current page and the mask that cuts out all the rectangles of
    * the ranges that were found.
    *
@@ -602,17 +648,17 @@ FinderHighlighter.prototype = {
     let document = window.document;
 
     const kMaskId = kModalIdPrefix + "-findbar-modalHighlight-outlineMask";
     let maskNode = document.createElement("div");
 
     // Make sure the dimmed mask node takes the full width and height that's available.
     let {width, height} = this._getWindowDimensions(window);
     maskNode.setAttribute("id", kMaskId);
-    maskNode.setAttribute("class", kMaskId);
+    maskNode.setAttribute("class", kMaskId + (kDebug ? ` ${kModalIdPrefix}-findbar-debug` : ""));
     maskNode.setAttribute("style", `width: ${width}px; height: ${height}px;`);
     if (this._brightText)
       maskNode.setAttribute("brighttext", "true");
 
     // Create a DOM node for each rectangle representing the ranges we found.
     let maskContent = [];
     const kRectClassName = kModalIdPrefix + "-findbar-modalHighlight-rect";
     if (this._modalHighlightRectsMap) {
@@ -624,28 +670,32 @@ FinderHighlighter.prototype = {
       }
     }
     maskNode.innerHTML = maskContent.join("");
 
     // Always remove the current mask and insert it a-fresh, because we're not
     // free to alter DOM nodes inside the CanvasFrame.
     this._removeHighlightAllMask(window);
 
-    this._modalHighlightAllMask = document.insertAnonymousContent(maskNode);
+    this._modalHighlightAllMask = kDebug ?
+      mockAnonymousContentNode(document.body.appendChild(maskNode)) :
+      document.insertAnonymousContent(maskNode);
   },
 
   /**
    * Safely remove the mask AnoymousContent node from the CanvasFrame.
    *
    * @param {nsIDOMWindow} window
    */
   _removeHighlightAllMask(window) {
     if (this._modalHighlightAllMask) {
       // If the current window isn't the one the content was inserted into, this
       // will fail, but that's fine.
+      if (kDebug)
+        this._modalHighlightAllMask.remove();
       try {
         window.document.removeAnonymousContent(this._modalHighlightAllMask);
       } catch(ex) {}
       this._modalHighlightAllMask = null;
     }
   },
 
   /**
deleted file mode 100644
--- a/widget/gonk/hwchal/HwcICS.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 sts=4 et: */
-/*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "HwcICS.h"
-#include "cutils/properties.h"
-#include "libdisplay/GonkDisplay.h"
-
-namespace mozilla {
-
-HwcICS::HwcICS()
-    : HwcHALBase()
-{
-    mHwc = (HwcDevice*)GetGonkDisplay()->GetHWCDevice();
-    if (!mHwc) {
-        printf_stderr("HwcHAL Error: Cannot load hwcomposer");
-    }
-}
-
-HwcICS::~HwcICS()
-{
-    mHwc = nullptr;
-    mEGLDisplay = nullptr;
-    mEGLSurface = nullptr;
-}
-
-void
-HwcICS::SetEGLInfo(hwc_display_t aEGLDisplay,
-                   hwc_surface_t aEGLSurface)
-{
-    mEGLDisplay = aEGLDisplay;
-    mEGLSurface = aEGLSurface;
-}
-
-bool
-HwcICS::Query(QueryType aType)
-{
-    bool value = false;
-    switch (aType) {
-        case QueryType::COLOR_FILL: {
-            char propValue[PROPERTY_VALUE_MAX];
-            property_get("ro.display.colorfill", propValue, "0");
-            value = (atoi(propValue) == 1) ? true : false;
-            break;
-        }
-        case QueryType::RB_SWAP:
-            value = true;
-            break;
-
-        default:
-            value = false;
-    }
-    return value;
-}
-
-int
-HwcICS::Set(HwcList* aList,
-            uint32_t aDisp)
-{
-    if (!mHwc) {
-        return -1;
-    }
-    return mHwc->set(mHwc, mEGLDisplay, mEGLSurface, aList);
-}
-
-int
-HwcICS::ResetHwc()
-{
-    return -1;
-}
-
-int
-HwcICS::Prepare(HwcList *aList,
-                uint32_t aDisp,
-                hwc_rect_t aDispRect,
-                buffer_handle_t aHandle,
-                int aFenceFd)
-{
-    return mHwc->prepare(mHwc, aList);
-}
-
-bool
-HwcICS::SupportTransparency() const
-{
-    return false;
-}
-
-uint32_t
-HwcICS::GetGeometryChangedFlag(bool aGeometryChanged) const
-{
-    return HWC_GEOMETRY_CHANGED;
-}
-
-void
-HwcICS::SetCrop(HwcLayer& aLayer,
-                const hwc_rect_t &aSrcCrop) const
-{
-    aLayer.sourceCrop = aSrcCrop;
-}
-
-bool
-HwcICS::EnableVsync(bool aEnable)
-{
-    return false;
-}
-
-bool
-HwcICS::RegisterHwcEventCallback(const HwcHALProcs_t &aProcs)
-{
-    return false;
-}
-
-// Create HwcICS
-UniquePtr<HwcHALBase>
-HwcHALBase::CreateHwcHAL()
-{
-    return Move(MakeUnique<HwcICS>());
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/widget/gonk/hwchal/HwcICS.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 sts=4 et: */
-/*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef mozilla_HwcICS
-#define mozilla_HwcICS
-
-#include "HwcHALBase.h"
-
-namespace mozilla {
-
-class HwcICS final : public HwcHALBase {
-public:
-    explicit HwcICS();
-
-    virtual ~HwcICS();
-
-    virtual bool HasHwc() const override { return static_cast<bool>(mHwc); }
-
-    virtual void SetEGLInfo(hwc_display_t aEGLDisplay,
-                            hwc_surface_t aEGLSurface) override;
-
-    virtual bool Query(QueryType aType) override;
-
-    virtual int Set(HwcList *aList,
-                    uint32_t aDisp) override;
-
-    virtual int ResetHwc() override;
-
-    virtual int Prepare(HwcList *aList,
-                        uint32_t aDisp,
-                        hwc_rect_t aDispRect,
-                        buffer_handle_t aHandle,
-                        int aFenceFd) override;
-
-    virtual bool SupportTransparency() const override;
-
-    virtual uint32_t GetGeometryChangedFlag(bool aGeometryChanged) const override;
-
-    virtual void SetCrop(HwcLayer &aLayer,
-                         const hwc_rect_t &aSrcCrop) const override;
-
-    virtual bool EnableVsync(bool aEnable) override;
-
-    virtual bool RegisterHwcEventCallback(const HwcHALProcs_t &aProcs) override;
-
-private:
-    HwcDevice      *mHwc = nullptr;
-    hwc_display_t   mEGLDisplay = nullptr;
-    hwc_surface_t   mEGLSurface = nullptr;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_HwcICS
deleted file mode 100644
--- a/widget/gonk/libdisplay/GonkDisplayICS.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/* Copyright 2013 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "GonkDisplayICS.h"
-#include <ui/FramebufferNativeWindow.h>
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-#include <hardware/hwcomposer.h>
-#include <hardware_legacy/power.h>
-#include <cutils/log.h>
-#include <fcntl.h>
-
-#include "mozilla/Assertions.h"
-#include "mozilla/FileUtils.h"
-#include "mozilla/FileUtils.h"
-
-using namespace android;
-
-
-namespace {
-static const char* kSleepFile = "/sys/power/wait_for_fb_sleep";
-static const char* kWakeFile = "/sys/power/wait_for_fb_wake";
-static mozilla::GonkDisplay::OnEnabledCallbackType sEnabledCallback;
-static pthread_t sFramebufferWatchThread;
-
-static void *
-frameBufferWatcher(void *)
-{
-    int len = 0;
-    char buf;
-
-    while (true) {
-        // Cannot use epoll here because kSleepFile and kWakeFile are
-        // always ready to read and blocking.
-        {
-            mozilla::ScopedClose fd(open(kSleepFile, O_RDONLY, 0));
-            do {
-                len = read(fd.get(), &buf, 1);
-            } while (len < 0 && errno == EINTR);
-            NS_WARN_IF_FALSE(len >= 0, "WAIT_FOR_FB_SLEEP failed");
-        }
-        sEnabledCallback(false);
-
-        {
-            mozilla::ScopedClose fd(open(kWakeFile, O_RDONLY, 0));
-            do {
-                len = read(fd.get(), &buf, 1);
-            } while (len < 0 && errno == EINTR);
-            NS_WARN_IF_FALSE(len >= 0, "WAIT_FOR_FB_WAKE failed");
-        }
-        sEnabledCallback(true);
-    }
-
-    return nullptr;
-}
-
-} // namespace
-
-
-namespace mozilla {
-
-static GonkDisplayICS* sGonkDisplay = nullptr;
-
-static int
-FramebufferNativeWindowCancelBufferNoop(ANativeWindow* aWindow,
-    android_native_buffer_t* aBuffer)
-{
-    return 0;
-}
-
-GonkDisplayICS::GonkDisplayICS()
-    : mModule(nullptr)
-    , mHwc(nullptr)
-{
-    // Some gralloc HALs need this in order to open the
-    // framebuffer device after we restart with the screen off.
-    //
-    // this *must* run BEFORE allocating the
-    // FramebufferNativeWindow.
-    set_screen_state(1);
-
-    // For some devices, it takes a while for the framebuffer to become
-    // usable. So we wait until the framebuffer has woken up before we
-    // try to open it.
-    {
-        char buf;
-        int len = 0;
-        ScopedClose fd(open("/sys/power/wait_for_fb_wake", O_RDONLY, 0));
-        do {
-            len = read(fd.get(), &buf, 1);
-        } while (len < 0 && errno == EINTR);
-        if (len < 0) {
-            LOGE("wait_for_fb_sleep failed errno: %d", errno);
-        }
-    }
-
-    mFBSurface = new FramebufferNativeWindow();
-
-    // ICS FramebufferNativeWindow doesn't set the |cancelBuffer|
-    // function pointer.
-    // It will crash when deleting the EGL window surface.
-    if (!mFBSurface->cancelBuffer) {
-        mFBSurface->cancelBuffer = FramebufferNativeWindowCancelBufferNoop;
-    }
-
-    int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule);
-    LOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID);
-    if (!err) {
-        err = hwc_open(mModule, &mHwc);
-        LOGE_IF(err, "%s device failed to initialize (%s)",
-                 HWC_HARDWARE_COMPOSER, strerror(-err));
-    }
-
-    xdpi = mFBSurface->xdpi;
-
-    const framebuffer_device_t *fbdev = mFBSurface->getDevice();
-    surfaceformat = fbdev->format;
-}
-
-GonkDisplayICS::~GonkDisplayICS()
-{
-    if (mHwc)
-        hwc_close(mHwc);
-}
-
-void
-GonkDisplayICS::SetEnabled(bool enabled)
-{
-    set_screen_state(enabled);
-}
-
-void
-GonkDisplayICS::OnEnabled(OnEnabledCallbackType callback)
-{
-    if (sEnabledCallback)
-        return;
-    sEnabledCallback = callback;
-
-    // Watching screen on/off state by using a pthread
-    // which implicitly calls exit() when the main thread ends
-    if (pthread_create(&sFramebufferWatchThread, NULL, frameBufferWatcher, NULL)) {
-        NS_RUNTIMEABORT("Failed to create framebufferWatcherThread, aborting...");
-    }
-}
-
-
-void*
-GonkDisplayICS::GetHWCDevice()
-{
-    return mHwc;
-}
-
-bool
-GonkDisplayICS::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
-{
-    // Should be called when composition rendering is complete for a frame.
-    // Only HWC v1.0 needs this call. ICS gonk always needs the call.
-    mFBSurface->compositionComplete();
-
-    if (!mHwc) {
-        if (sur != EGL_NO_SURFACE) {
-            return eglSwapBuffers(dpy, sur);
-        }
-        return true;
-    }
-
-    mHwc->prepare(mHwc, nullptr);
-    return !mHwc->set(mHwc, dpy, sur, 0);
-}
-
-ANativeWindowBuffer*
-GonkDisplayICS::DequeueBuffer()
-{
-    ANativeWindow *window = static_cast<ANativeWindow *>(mFBSurface.get());
-    ANativeWindowBuffer *buf = nullptr;
-    window->dequeueBuffer(window, &buf);
-    return buf;
-}
-
-bool
-GonkDisplayICS::QueueBuffer(ANativeWindowBuffer *buf)
-{
-    ANativeWindow *window = static_cast<ANativeWindow *>(mFBSurface.get());
-    return !window->queueBuffer(window, buf);
-}
-
-void
-GonkDisplayICS::UpdateDispSurface(EGLDisplay dpy, EGLSurface sur)
-{
-}
-
-void
-GonkDisplayICS::SetDispReleaseFd(int fd)
-{
-}
-
-GonkDisplay::NativeData
-GonkDisplayICS::GetNativeData(GonkDisplay::DisplayType aDisplayType,
-                              android::IGraphicBufferProducer* aSink)
-{
-    MOZ_ASSERT(aDisplayType == DISPLAY_PRIMARY, "ICS gonk supports primary display only.");
-
-    NativeData data;
-    data.mNativeWindow = static_cast<ANativeWindow *>(mFBSurface.get());
-    data.mXdpi = xdpi;
-
-    return data;
-}
-
-__attribute__ ((visibility ("default")))
-GonkDisplay*
-GetGonkDisplay()
-{
-    if (!sGonkDisplay)
-        sGonkDisplay = new GonkDisplayICS();
-    return sGonkDisplay;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/widget/gonk/libdisplay/GonkDisplayICS.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright 2013 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef GONKDISPLAYICS_H
-#define GONKDISPLAYICS_H
-
-#include <string.h>
-
-#include "GonkDisplay.h"
-#include "ui/FramebufferNativeWindow.h"
-#include "hardware/hwcomposer.h"
-#include "utils/RefBase.h"
-
-namespace android {
-class IGraphicBufferProducer;
-}
-
-namespace mozilla {
-
-class MOZ_EXPORT GonkDisplayICS : public GonkDisplay {
-public:
-    GonkDisplayICS();
-    ~GonkDisplayICS();
-
-    virtual void SetEnabled(bool enabled);
-
-    virtual void OnEnabled(OnEnabledCallbackType callback);
-
-    virtual void* GetHWCDevice();
-
-    virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur);
-
-    virtual ANativeWindowBuffer* DequeueBuffer();
-
-    virtual bool QueueBuffer(ANativeWindowBuffer* handle);
-
-    virtual void UpdateDispSurface(EGLDisplay dpy, EGLSurface sur);
-
-    virtual void SetDispReleaseFd(int fd);
-
-    virtual int GetPrevDispAcquireFd()
-    {
-        return -1;
-    }
-
-    virtual NativeData GetNativeData(
-        GonkDisplay::DisplayType aDisplayType,
-        android::IGraphicBufferProducer* aSink = nullptr);
-
-    virtual void NotifyBootAnimationStopped() {}
-
-private:
-    hw_module_t const*        mModule;
-    hwc_composer_device_t*    mHwc;
-    android::sp<android::FramebufferNativeWindow> mFBSurface;
-};
-
-}
-
-#endif /* GONKDISPLAYICS_H */
--- a/widget/gonk/libdisplay/moz.build
+++ b/widget/gonk/libdisplay/moz.build
@@ -30,40 +30,30 @@ elif CONFIG['ANDROID_VERSION'] == '18':
         'GonkDisplayJB.cpp',
     ]
 elif CONFIG['ANDROID_VERSION'] == '17':
     SOURCES += [
         'FramebufferSurface.cpp',
         'GonkDisplayJB.cpp',
         'GraphicBufferAlloc.cpp',
     ]
-elif CONFIG['ANDROID_VERSION'] == '15':
-    SOURCES += [
-        'GonkDisplayICS.cpp'
-    ]
 elif CONFIG['ANDROID_VERSION'] and CONFIG['COMPILE_ENVIRONMENT']:
     error('Unsupported platform version: %s' % (CONFIG['ANDROID_VERSION']))
 
 Library('display')
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FORCE_STATIC_LIB = True
 
 DEFINES['XPCOM_GLUE'] = True
 
 DISABLE_STL_WRAPPING = True
 
-if CONFIG['ANDROID_VERSION'] > '15':
-    LOCAL_INCLUDES += [
-        '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
-            'frameworks/native/include/gui',
-            'frameworks/native/opengl/include',
-            'system/core/libsuspend/include',
-        ]
-    ]
-
 LOCAL_INCLUDES += [
     '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
+        'frameworks/native/include/gui',
+        'frameworks/native/opengl/include',
         'hardware/libhardware/include',
         'hardware/libhardware_legacy/include',
+        'system/core/libsuspend/include',
     ]
 ]
--- a/widget/gonk/moz.build
+++ b/widget/gonk/moz.build
@@ -45,20 +45,16 @@ SOURCES += ['libui/' + src for src in [
     'VirtualKeyMap.cpp',
 ]]
 
 # HwcHAL files
 if CONFIG['ANDROID_VERSION'] >= '17':
     SOURCES += [
         'hwchal/HwcHAL.cpp',
     ]
-elif CONFIG['ANDROID_VERSION'] == '15':
-    SOURCES += [
-        'hwchal/HwcICS.cpp',
-    ]
 
 SOURCES += [
     'GeckoTouchDispatcher.cpp',
     'GfxInfo.cpp',
     'GonkClipboardData.cpp',
     'GonkMemoryPressureMonitoring.cpp',
     'GonkPermission.cpp',
     'HwcComposer2D.cpp',
@@ -84,26 +80,20 @@ LOCAL_INCLUDES += [
     '/gfx/skia/skia/include/config',
     '/gfx/skia/skia/include/core',
     '/image',
     '/widget',
 ]
 
 DEFINES['HAVE_OFF64_T'] = True
 DEFINES['SK_BUILD_FOR_ANDROID_NDK'] = True
-
-if CONFIG['ANDROID_VERSION'] != '15':
-    DEFINES['HAVE_POSIX_CLOCKS'] = True
+DEFINES['HAVE_POSIX_CLOCKS'] = True
 
 if CONFIG['MOZ_OMX_DECODER']:
     DEFINES['MOZ_OMX_DECODER'] = True
 
-if CONFIG['ANDROID_VERSION'] > '15':
-    LOCAL_INCLUDES += [
-        '%' + '%s/frameworks/native/opengl/include' % CONFIG['ANDROID_SOURCE'],
-    ]
-
 LOCAL_INCLUDES += [
     '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
+	'frameworks/native/opengl/include',
         'hardware/libhardware/include',
         'hardware/libhardware_legacy/include',
     ]
 ]
--- a/widget/gonk/nativewindow/GonkNativeWindow.h
+++ b/widget/gonk/nativewindow/GonkNativeWindow.h
@@ -14,11 +14,9 @@
  */
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
 # include "GonkNativeWindowLL.h"
 #elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 19
 # include "GonkNativeWindowKK.h"
 #elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
 # include "GonkNativeWindowJB.h"
-#elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION == 15
-# include "GonkNativeWindowICS.h"
 #endif
deleted file mode 100644
--- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
+++ /dev/null
@@ -1,673 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * Copyright (C) 2012-2013 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "base/basictypes.h"
-#include "mozilla/layers/GrallocTextureClient.h"
-#include "mozilla/layers/ImageBridgeChild.h"
-#include "mozilla/layers/ShadowLayers.h"
-#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
-#include "GonkNativeWindow.h"
-#include "nsDebug.h"
-
-/**
- * DOM_CAMERA_LOGI() is enabled in debug builds, and turned on by setting
- * MOZ_LOG=Camera:N environment variable, where N >= 3.
- *
- * CNW_LOGE() is always enabled.
- */
-#define CNW_LOGD(...)   DOM_CAMERA_LOGI(__VA_ARGS__)
-#define CNW_LOGE(...)   {(void)printf_stderr(__VA_ARGS__);}
-
-using namespace android;
-using namespace mozilla;
-using namespace mozilla::gfx;
-using namespace mozilla::layers;
-
-GonkNativeWindow::GonkNativeWindow() :
-    mAbandoned(false),
-    mDefaultWidth(1),
-    mDefaultHeight(1),
-    mPixelFormat(PIXEL_FORMAT_RGBA_8888),
-    mBufferCount(MIN_BUFFER_SLOTS + 1),
-    mConnectedApi(NO_CONNECTED_API),
-    mFrameCounter(0),
-    mNewFrameCallback(nullptr) {
-}
-
-GonkNativeWindow::~GonkNativeWindow() {
-    freeAllBuffersLocked();
-}
-
-void GonkNativeWindow::abandon()
-{
-    CNW_LOGD("abandon");
-    Mutex::Autolock lock(mMutex);
-    mQueue.clear();
-    mAbandoned = true;
-    freeAllBuffersLocked();
-    mDequeueCondition.signal();
-}
-
-void GonkNativeWindow::freeAllBuffersLocked()
-{
-    CNW_LOGD("freeAllBuffersLocked");
-
-    for (int i = 0; i < NUM_BUFFER_SLOTS; ++i) {
-        if (mSlots[i].mGraphicBuffer != NULL) {
-            if (mSlots[i].mTextureClient) {
-              mSlots[i].mTextureClient->ClearRecycleCallback();
-              // release TextureClient in ImageBridge thread
-              RefPtr<TextureClientReleaseTask> task =
-                MakeAndAddRef<TextureClientReleaseTask>(mSlots[i].mTextureClient);
-              mSlots[i].mTextureClient = NULL;
-              ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(task.forget());
-            }
-            mSlots[i].mGraphicBuffer = NULL;
-            mSlots[i].mBufferState = BufferSlot::FREE;
-            mSlots[i].mFrameNumber = 0;
-        }
-    }
-}
-
-void GonkNativeWindow::clearRenderingStateBuffersLocked()
-{
-    CNW_LOGD("clearRenderingStateBuffersLocked");
-
-    for (int i = 0; i < NUM_BUFFER_SLOTS; ++i) {
-        if (mSlots[i].mGraphicBuffer != NULL) {
-            // Clear RENDERING state buffer
-            if (mSlots[i].mBufferState == BufferSlot::RENDERING) {
-                if (mSlots[i].mTextureClient) {
-                  mSlots[i].mTextureClient->ClearRecycleCallback();
-                  // release TextureClient in ImageBridge thread
-                  RefPtr<TextureClientReleaseTask> task =
-                    MakeAndAddRef<TextureClientReleaseTask>(mSlots[i].mTextureClient);
-                  mSlots[i].mTextureClient = NULL;
-                  ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(task.forget());
-                }
-                mSlots[i].mGraphicBuffer = NULL;
-                mSlots[i].mBufferState = BufferSlot::FREE;
-                mSlots[i].mFrameNumber = 0;
-            }
-        }
-    }
-}
-
-status_t GonkNativeWindow::setBufferCount(int bufferCount)
-{
-    CNW_LOGD("setBufferCount: count=%d", bufferCount);
-    Mutex::Autolock lock(mMutex);
-
-    if (mAbandoned) {
-        CNW_LOGE("setBufferCount: GonkNativeWindow has been abandoned!");
-        return NO_INIT;
-    }
-
-    if (bufferCount > NUM_BUFFER_SLOTS) {
-        CNW_LOGE("setBufferCount: bufferCount larger than slots available");
-        return BAD_VALUE;
-    }
-
-    if (bufferCount < MIN_BUFFER_SLOTS) {
-        CNW_LOGE("setBufferCount: requested buffer count (%d) is less than "
-                "minimum (%d)", bufferCount, MIN_BUFFER_SLOTS);
-        return BAD_VALUE;
-    }
-
-    // Error out if the user has dequeued buffers.
-    for (int i=0 ; i<mBufferCount ; i++) {
-        if (mSlots[i].mBufferState == BufferSlot::DEQUEUED) {
-            CNW_LOGE("setBufferCount: client owns some buffers");
-            return -EINVAL;
-        }
-    }
-
-    if (bufferCount >= mBufferCount) {
-        mBufferCount = bufferCount;
-        //clear only buffers in RENDERING state.
-        clearRenderingStateBuffersLocked();
-        mQueue.clear();
-        mDequeueCondition.signal();
-        return OK;
-    }
-
-    // here we're guaranteed that the client doesn't have dequeued buffers
-    // and will release all of its buffer references.
-    freeAllBuffersLocked();
-    mBufferCount = bufferCount;
-    mQueue.clear();
-    mDequeueCondition.signal();
-    return OK;
-}
-
-status_t GonkNativeWindow::setDefaultBufferSize(uint32_t w, uint32_t h)
-{
-    CNW_LOGD("setDefaultBufferSize: w=%d, h=%d", w, h);
-    if (!w || !h) {
-        CNW_LOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)",
-                w, h);
-        return BAD_VALUE;
-    }
-
-    Mutex::Autolock lock(mMutex);
-    mDefaultWidth = w;
-    mDefaultHeight = h;
-    return OK;
-}
-
-status_t GonkNativeWindow::requestBuffer(int slot, sp<GraphicBuffer>* buf)
-{
-    CNW_LOGD("requestBuffer: slot=%d", slot);
-    Mutex::Autolock lock(mMutex);
-    if (mAbandoned) {
-        CNW_LOGE("requestBuffer: GonkNativeWindow has been abandoned!");
-        return NO_INIT;
-    }
-    if (slot < 0 || mBufferCount <= slot) {
-        CNW_LOGE("requestBuffer: slot index out of range [0, %d]: %d",
-                mBufferCount, slot);
-        return BAD_VALUE;
-    }
-    mSlots[slot].mRequestBufferCalled = true;
-    *buf = mSlots[slot].mGraphicBuffer;
-    return NO_ERROR;
-}
-
-status_t GonkNativeWindow::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
-        uint32_t format, uint32_t usage)
-{
-    if ((w && !h) || (!w && h)) {
-        CNW_LOGE("dequeueBuffer: invalid size: w=%u, h=%u", w, h);
-        return BAD_VALUE;
-    }
-
-    status_t returnFlags(OK);
-    bool updateFormat = false;
-    bool alloc = false;
-    int buf = INVALID_BUFFER_SLOT;
-
-    {
-        Mutex::Autolock lock(mMutex);
-
-        int found = -1;
-        int dequeuedCount = 0;
-        int renderingCount = 0;
-        bool tryAgain = true;
-
-        CNW_LOGD("dequeueBuffer: E");
-        while (tryAgain) {
-            if (mAbandoned) {
-                CNW_LOGE("dequeueBuffer: GonkNativeWindow has been abandoned!");
-                return NO_INIT;
-            }
-            // look for a free buffer to give to the client
-            found = INVALID_BUFFER_SLOT;
-            dequeuedCount = 0;
-            renderingCount = 0;
-            for (int i = 0; i < mBufferCount; i++) {
-                const int state = mSlots[i].mBufferState;
-                switch (state) {
-                    case BufferSlot::DEQUEUED:
-                        CNW_LOGD("dequeueBuffer: slot %d is DEQUEUED\n", i);
-                        dequeuedCount++;
-                        break;
-
-                    case BufferSlot::RENDERING:
-                        CNW_LOGD("dequeueBuffer: slot %d is RENDERING\n", i);
-                        renderingCount++;
-                        break;
-
-                    case BufferSlot::FREE:
-                        CNW_LOGD("dequeueBuffer: slot %d is FREE\n", i);
-                        /* We return the oldest of the free buffers to avoid
-                         * stalling the producer if possible.  This is because
-                         * the consumer may still have pending reads of the
-                         * buffers in flight.
-                         */
-                        if (found < 0 ||
-                            mSlots[i].mFrameNumber < mSlots[found].mFrameNumber) {
-                            found = i;
-                        }
-                        break;
-
-                    default:
-                        CNW_LOGD("dequeueBuffer: slot %d is %d\n", i, state);
-                        break;
-                }
-            }
-
-            // See whether a buffer has been in RENDERING state since the last
-            // setBufferCount so we know whether to perform the
-            // MIN_UNDEQUEUED_BUFFERS check below.
-            if (renderingCount > 0) {
-                // make sure the client is not trying to dequeue more buffers
-                // than allowed.
-                const int avail = mBufferCount - (dequeuedCount + 1);
-                if (avail < MIN_UNDEQUEUED_BUFFERS) {
-                    CNW_LOGE("dequeueBuffer: MIN_UNDEQUEUED_BUFFERS=%d exceeded "
-                            "(dequeued=%d)",
-                            MIN_UNDEQUEUED_BUFFERS,
-                            dequeuedCount);
-                    return -EBUSY;
-                }
-            }
-
-            // we're in synchronous mode and didn't find a buffer, we need to
-            // wait for some buffers to be consumed
-            tryAgain = (found == INVALID_BUFFER_SLOT);
-            if (tryAgain) {
-                CNW_LOGD("dequeueBuffer: Try again");
-                mDequeueCondition.wait(mMutex);
-                CNW_LOGD("dequeueBuffer: Now");
-            }
-        }
-
-        if (found == INVALID_BUFFER_SLOT) {
-            // This should not happen.
-            CNW_LOGE("dequeueBuffer: no available buffer slots");
-            return -EBUSY;
-        }
-
-        buf = found;
-        *outBuf = found;
-
-        const bool useDefaultSize = !w && !h;
-        if (useDefaultSize) {
-            // use the default size
-            w = mDefaultWidth;
-            h = mDefaultHeight;
-        }
-
-        updateFormat = (format != 0);
-        if (!updateFormat) {
-            // keep the current (or default) format
-            format = mPixelFormat;
-        }
-
-        mSlots[buf].mBufferState = BufferSlot::DEQUEUED;
-
-        const sp<GraphicBuffer>& gbuf(mSlots[buf].mGraphicBuffer);
-        if ((gbuf == NULL) ||
-           ((uint32_t(gbuf->width)  != w) ||
-            (uint32_t(gbuf->height) != h) ||
-            (uint32_t(gbuf->format) != format) ||
-            ((uint32_t(gbuf->usage) & usage) != usage))) {
-            mSlots[buf].mGraphicBuffer = NULL;
-            mSlots[buf].mRequestBufferCalled = false;
-            if (mSlots[buf].mTextureClient) {
-                mSlots[buf].mTextureClient->ClearRecycleCallback();
-                // release TextureClient in ImageBridge thread
-                RefPtr<TextureClientReleaseTask> task =
-                  MakeAndAddRef<TextureClientReleaseTask>(mSlots[buf].mTextureClient);
-                mSlots[buf].mTextureClient = NULL;
-                ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(task.forget());
-            }
-            alloc = true;
-        }
-    }  // end lock scope
-
-    if (alloc) {
-        ClientIPCAllocator* allocator = ImageBridgeChild::GetSingleton();
-        usage |= GraphicBuffer::USAGE_HW_TEXTURE;
-        GrallocTextureData* texData = GrallocTextureData::Create(IntSize(w, h), format,
-                                                                 gfx::BackendType::NONE, usage,
-                                                                 allocator);
-        if (!texData) {
-            return -ENOMEM;
-        }
-
-        RefPtr<TextureClient> textureClient = new TextureClient(texData, TextureFlags::RECYCLE | TextureFlags::DEALLOCATE_CLIENT, allocator);
-
-        { // Scope for the lock
-            Mutex::Autolock lock(mMutex);
-
-            if (mAbandoned) {
-                CNW_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
-                return NO_INIT;
-            }
-
-            if (updateFormat) {
-                mPixelFormat = format;
-            }
-            mSlots[buf].mGraphicBuffer = texData->GetGraphicBuffer();
-            mSlots[buf].mTextureClient = textureClient;
-
-            returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
-
-            CNW_LOGD("dequeueBuffer: returning slot=%d buf=%p ", buf,
-                    mSlots[buf].mGraphicBuffer->handle);
-        }
-    }
-
-    CNW_LOGD("dequeueBuffer: returning slot=%d buf=%p ", buf,
-            mSlots[buf].mGraphicBuffer->handle );
-
-    CNW_LOGD("dequeueBuffer: X");
-    return returnFlags;
-}
-
-status_t GonkNativeWindow::setSynchronousMode(bool enabled)
-{
-    return NO_ERROR;
-}
-
-int GonkNativeWindow::getSlotFromBufferLocked(
-        android_native_buffer_t* buffer) const
-{
-    if (buffer == NULL) {
-        CNW_LOGE("getSlotFromBufferLocked: encountered NULL buffer");
-        return BAD_VALUE;
-    }
-
-    for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
-        if (mSlots[i].mGraphicBuffer != NULL && mSlots[i].mGraphicBuffer->handle == buffer->handle) {
-            return i;
-        }
-    }
-    CNW_LOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
-    return BAD_VALUE;
-}
-
-int GonkNativeWindow::getSlotFromTextureClientLocked(
-        TextureClient* client) const
-{
-    if (client == NULL) {
-        CNW_LOGE("getSlotFromBufferLocked: encountered NULL buffer");
-        return BAD_VALUE;
-    }
-
-    for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
-        if (mSlots[i].mTextureClient == client) {
-            return i;
-        }
-    }
-    CNW_LOGE("getSlotFromBufferLocked: unknown TextureClient: %p", client);
-    return BAD_VALUE;
-}
-
-already_AddRefed<TextureClient>
-GonkNativeWindow::getTextureClientFromBuffer(ANativeWindowBuffer* buffer)
-{
-  int buf = getSlotFromBufferLocked(buffer);
-  if (buf < 0 || buf >= mBufferCount ||
-      mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
-    return nullptr;
-  }
-
-  RefPtr<TextureClient> client(mSlots[buf].mTextureClient);
-  return client.forget();
-}
-
-status_t GonkNativeWindow::queueBuffer(int buf, int64_t timestamp,
-        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform)
-{
-    {
-        Mutex::Autolock lock(mMutex);
-        CNW_LOGD("queueBuffer: E");
-        CNW_LOGD("queueBuffer: buf=%d", buf);
-
-        if (mAbandoned) {
-            CNW_LOGE("queueBuffer: GonkNativeWindow has been abandoned!");
-            return NO_INIT;
-        }
-        if (buf < 0 || buf >= mBufferCount) {
-            CNW_LOGE("queueBuffer: slot index out of range [0, %d]: %d",
-                     mBufferCount, buf);
-            return -EINVAL;
-        } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
-            CNW_LOGE("queueBuffer: slot %d is not owned by the client "
-                     "(state=%d)", buf, mSlots[buf].mBufferState);
-            return -EINVAL;
-        } else if (!mSlots[buf].mRequestBufferCalled) {
-            CNW_LOGE("queueBuffer: slot %d was enqueued without requesting a "
-                    "buffer", buf);
-            return -EINVAL;
-        }
-
-        mQueue.push_back(buf);
-
-        mSlots[buf].mBufferState = BufferSlot::QUEUED;
-        mSlots[buf].mTimestamp = timestamp;
-        mFrameCounter++;
-        mSlots[buf].mFrameNumber = mFrameCounter;
-
-        mDequeueCondition.signal();
-
-        *outWidth = mDefaultWidth;
-        *outHeight = mDefaultHeight;
-        *outTransform = 0;
-    }
-
-    // OnNewFrame might call lockCurrentBuffer so we must release the
-    // mutex first.
-    if (mNewFrameCallback) {
-      mNewFrameCallback->OnNewFrame();
-    }
-    CNW_LOGD("queueBuffer: X");
-    return OK;
-}
-
-
-already_AddRefed<TextureClient>
-GonkNativeWindow::getCurrentBuffer() {
-  CNW_LOGD("GonkNativeWindow::getCurrentBuffer");
-  Mutex::Autolock lock(mMutex);
-
-  if (mAbandoned) {
-    CNW_LOGE("getCurrentBuffer: GonkNativeWindow has been abandoned!");
-    return NULL;
-  }
-
-  if(mQueue.empty()) {
-    mDequeueCondition.signal();
-    return nullptr;
-  }
-
-  Fifo::iterator front(mQueue.begin());
-  int buf = *front;
-  CNW_LOGD("getCurrentBuffer: buf=%d", buf);
-
-  mSlots[buf].mBufferState = BufferSlot::RENDERING;
-
-  mQueue.erase(front);
-  mDequeueCondition.signal();
-
-  mSlots[buf].mTextureClient->SetRecycleCallback(GonkNativeWindow::RecycleCallback, this);
-  RefPtr<TextureClient> client(mSlots[buf].mTextureClient);
-  return client.forget();
-}
-
-
-/* static */ void
-GonkNativeWindow::RecycleCallback(TextureClient* client, void* closure) {
-  GonkNativeWindow* nativeWindow =
-    static_cast<GonkNativeWindow*>(closure);
-
-  MOZ_ASSERT(client && !client->IsDead());
-  client->ClearRecycleCallback();
-  nativeWindow->returnBuffer(client);
-}
-
-void GonkNativeWindow::returnBuffer(TextureClient* client) {
-  CNW_LOGD("GonkNativeWindow::returnBuffer");
-  Mutex::Autolock lock(mMutex);
-
-  if (mAbandoned) {
-    CNW_LOGD("returnBuffer: GonkNativeWindow has been abandoned!");
-    return;
-  }
-
-  int index = getSlotFromTextureClientLocked(client);
-  if (index < 0 || index >= mBufferCount) {
-    CNW_LOGE("returnBuffer: slot index out of range [0, %d]: %d",
-             mBufferCount, index);
-    return;
-  }
-
-  if (mSlots[index].mBufferState != BufferSlot::RENDERING) {
-    CNW_LOGE("returnBuffer: slot %d is not owned by the compositor (state=%d)",
-                  index, mSlots[index].mBufferState);
-    return;
-  }
-
-  mSlots[index].mBufferState = BufferSlot::FREE;
-  mDequeueCondition.signal();
-  return;
-}
-
-void GonkNativeWindow::cancelBuffer(int buf) {
-    CNW_LOGD("cancelBuffer: slot=%d", buf);
-    Mutex::Autolock lock(mMutex);
-
-    if (mAbandoned) {
-        CNW_LOGD("cancelBuffer: GonkNativeWindow has been abandoned!");
-        return;
-    }
-
-    if (buf < 0 || buf >= mBufferCount) {
-        CNW_LOGE("cancelBuffer: slot index out of range [0, %d]: %d",
-                mBufferCount, buf);
-        return;
-    } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
-        CNW_LOGE("cancelBuffer: slot %d is not owned by the client (state=%d)",
-                buf, mSlots[buf].mBufferState);
-        return;
-    }
-    mSlots[buf].mBufferState = BufferSlot::FREE;
-    mSlots[buf].mFrameNumber = 0;
-    mDequeueCondition.signal();
-}
-
-status_t GonkNativeWindow::setCrop(const Rect& crop) {
-    return OK;
-}
-
-status_t GonkNativeWindow::setTransform(uint32_t transform) {
-    return OK;
-}
-
-status_t GonkNativeWindow::connect(int api,
-        uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-    CNW_LOGD("connect: api=%d", api);
-    Mutex::Autolock lock(mMutex);
-
-    if (mAbandoned) {
-        CNW_LOGE("connect: GonkNativeWindow has been abandoned!");
-        return NO_INIT;
-    }
-
-    int err = NO_ERROR;
-    switch (api) {
-        case NATIVE_WINDOW_API_EGL:
-        case NATIVE_WINDOW_API_CPU:
-        case NATIVE_WINDOW_API_MEDIA:
-        case NATIVE_WINDOW_API_CAMERA:
-            if (mConnectedApi != NO_CONNECTED_API) {
-                CNW_LOGE("connect: already connected (cur=%d, req=%d)",
-                        mConnectedApi, api);
-                err = -EINVAL;
-            } else {
-                mConnectedApi = api;
-                *outWidth = mDefaultWidth;
-                *outHeight = mDefaultHeight;
-                *outTransform = 0;
-            }
-            break;
-        default:
-            err = -EINVAL;
-            break;
-    }
-    return err;
-}
-
-status_t GonkNativeWindow::disconnect(int api) {
-    CNW_LOGD("disconnect: api=%d", api);
-
-    int err = NO_ERROR;
-    Mutex::Autolock lock(mMutex);
-
-    if (mAbandoned) {
-        // it is not really an error to disconnect after the surface
-        // has been abandoned, it should just be a no-op.
-        return NO_ERROR;
-    }
-
-    switch (api) {
-        case NATIVE_WINDOW_API_EGL:
-        case NATIVE_WINDOW_API_CPU:
-        case NATIVE_WINDOW_API_MEDIA:
-        case NATIVE_WINDOW_API_CAMERA:
-            if (mConnectedApi == api) {
-                mQueue.clear();
-                freeAllBuffersLocked();
-                mConnectedApi = NO_CONNECTED_API;
-                mDequeueCondition.signal();
-            } else {
-                CNW_LOGE("disconnect: connected to another api (cur=%d, req=%d)",
-                        mConnectedApi, api);
-                err = -EINVAL;
-            }
-            break;
-        default:
-            CNW_LOGE("disconnect: unknown API %d", api);
-            err = -EINVAL;
-            break;
-    }
-    return err;
-}
-
-status_t GonkNativeWindow::setScalingMode(int mode) {
-    return OK;
-}
-
-void GonkNativeWindow::setNewFrameCallback(
-        GonkNativeWindowNewFrameCallback* aCallback) {
-    CNW_LOGD("setNewFrameCallback");
-    Mutex::Autolock lock(mMutex);
-    mNewFrameCallback = aCallback;
-}
-
-int GonkNativeWindow::query(int what, int* outValue)
-{
-    Mutex::Autolock lock(mMutex);
-
-    if (mAbandoned) {
-        CNW_LOGE("query: GonkNativeWindow has been abandoned!");
-        return NO_INIT;
-    }
-
-    int value;
-    switch (what) {
-    case NATIVE_WINDOW_WIDTH:
-        value = mDefaultWidth;
-        break;
-    case NATIVE_WINDOW_HEIGHT:
-        value = mDefaultHeight;
-        break;
-    case NATIVE_WINDOW_FORMAT:
-        value = mPixelFormat;
-        break;
-    case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
-        value = MIN_UNDEQUEUED_BUFFERS;
-        break;
-    default:
-        return BAD_VALUE;
-    }
-    outValue[0] = value;
-    return NO_ERROR;
-}
deleted file mode 100644
--- a/widget/gonk/nativewindow/GonkNativeWindowICS.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * Copyright (C) 2012 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
-#define NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <gui/ISurfaceTexture.h>
-#include <ui/egl/android_natives.h>
-#include <ui/GraphicBuffer.h>
-#include <ui/Rect.h>
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-#include <utils/String8.h>
-#include <utils/threads.h>
-
-#include "CameraCommon.h"
-#include "GrallocImages.h"
-#include "mozilla/layers/LayersSurfaces.h"
-#include "mozilla/layers/TextureClient.h"
-
-namespace android {
-
-// The user of GonkNativeWindow who wants to receive notification of
-// new frames should implement this interface.
-class GonkNativeWindowNewFrameCallback {
-public:
-    virtual void OnNewFrame() = 0;
-};
-
-class GonkNativeWindow : public BnSurfaceTexture
-{
-    friend class GonkNativeWindowClient;
-
-    typedef mozilla::layers::TextureClient TextureClient;
-
-public:
-    enum { MIN_UNDEQUEUED_BUFFERS = 2 };
-    enum { MIN_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS };
-    enum { NUM_BUFFER_SLOTS = 32 };
-    enum { NO_CONNECTED_API = 0 };
-    enum { NATIVE_WINDOW_SET_BUFFERS_SIZE = 0x10000000 };
-
-    GonkNativeWindow();
-    ~GonkNativeWindow(); // this class cannot be overloaded
-
-    // Get next frame from the queue and mark it as RENDERING, caller
-    // owns the returned buffer.
-    already_AddRefed<TextureClient> getCurrentBuffer();
-
-    // Return the buffer to the queue and mark it as FREE. After that
-    // the buffer is useable again for the decoder.
-    void returnBuffer(TextureClient* client);
-
-    // setBufferCount updates the number of available buffer slots.  After
-    // calling this all buffer slots are owned by the GonkNativeWindow object
-    // (i.e. they are not owned by the client).
-    virtual status_t setBufferCount(int bufferCount);
-
-    // requestBuffer requests a new buffer for the given index.
-    virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf);
-
-    // dequeueBuffer gets the next buffer slot index for the client to use. If a
-    // buffer slot is available then that slot index is written to the location
-    // pointed to by the buf argument and a status of OK is returned.  If no
-    // slot is available then a status of -EBUSY is returned and buf is
-    // unmodified.
-    virtual status_t dequeueBuffer(int *buf, uint32_t width, uint32_t height,
-            uint32_t format, uint32_t usage);
-
-    // queueBuffer returns a filled buffer to the GonkNativeWindow. In addition,
-    // a timestamp must be provided for the buffer. The timestamp is in
-    // nanoseconds, and must be monotonically increasing. Its other semantics
-    // (zero point, etc) are client-dependent and should be documented by the
-    // client.
-    virtual status_t queueBuffer(int buf, int64_t timestamp,
-            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-    virtual void cancelBuffer(int buf);
-    virtual status_t setCrop(const Rect& reg);
-    virtual status_t setTransform(uint32_t transform);
-    virtual status_t setScalingMode(int mode);
-
-    virtual int query(int what, int* value);
-
-    // Qcom specific function
-    virtual int performQcomOperation(int operation, int arg1, int arg2, int arg3) {
-        return OK;
-    }
-
-    // GonkNativeWindow do not implement the function and always works in
-    // synchronous mode.
-    virtual status_t setSynchronousMode(bool enabled);
-
-    // connect attempts to connect a client API to the GonkNativeWindow.
-    //
-    // This method will fail if the connect was previously called on the
-    // GonkNativeWindow and no corresponding disconnect call was made.
-    virtual status_t connect(int api,
-            uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform);
-
-    // disconnect attempts to disconnect a client API from the GonkNativeWindow.
-    // This method will fail if the the GonkNativeWindow is not currently
-    // connected to the specified client API.
-    virtual status_t disconnect(int api);
-
-    void setNewFrameCallback(GonkNativeWindowNewFrameCallback* aCallback);
-
-    // setDefaultBufferSize is used to set the size of buffers returned by
-    // requestBuffers when a with and height of zero is requested.
-    // A call to setDefaultBufferSize() may trigger requestBuffers() to
-    // be called from the client.
-    status_t setDefaultBufferSize(uint32_t width, uint32_t height);
-
-    // abandon frees all the buffers and puts the GonkNativeWindow into the
-    // 'abandoned' state.  Once put in this state the GonkNativeWindow can never
-    // leave it.  When in the 'abandoned' state, all methods of the
-    // ISurfaceTexture interface will fail with the NO_INIT error.
-    //
-    // Note that while calling this method causes all the buffers to be freed
-    // from the perspective of the the GonkNativeWindow, if there are additional
-    // references on the buffers (e.g. if a buffer is referenced by a client)
-    // then those buffer will remain allocated.
-    void abandon();
-
-    already_AddRefed<TextureClient> getTextureClientFromBuffer(ANativeWindowBuffer* buffer);
-
-    static void RecycleCallback(TextureClient* client, void* closure);
-
-protected:
-
-    // freeAllBuffersLocked frees the resources (both GraphicBuffer and
-    // EGLImage) for all slots by removing them from the slots and appending
-    // then to the freeList.  This must be called with mMutex locked.
-    void freeAllBuffersLocked();
-
-    // clearRenderingStateBuffersLocked clear the resources in RENDERING state;
-    // But do not destroy the gralloc buffer. It is still in the video stream
-    // awaiting rendering.
-    // this must be called with mMutex locked.
-    void clearRenderingStateBuffersLocked();
-
-private:
-    void init();
-
-    int getSlotFromBufferLocked(android_native_buffer_t* buffer) const;
-
-    int getSlotFromTextureClientLocked(TextureClient* client) const;
-
-    enum { INVALID_BUFFER_SLOT = -1 };
-
-    struct BufferSlot {
-
-        BufferSlot()
-            : mBufferState(BufferSlot::FREE),
-              mTimestamp(0),
-              mFrameNumber(0){
-        }
-
-        // mGraphicBuffer points to the buffer allocated for this slot or is NULL
-        // if no buffer has been allocated.
-        sp<GraphicBuffer> mGraphicBuffer;
-
-        // mTextureClient is a thin abstraction over remotely allocated GraphicBuffer.
-        RefPtr<TextureClient> mTextureClient;
-
-        // BufferState represents the different states in which a buffer slot
-        // can be.
-        enum BufferState {
-            // FREE indicates that the buffer is not currently being used and
-            // will not be used in the future until it gets dequeued and
-            // subsequently queued by the client.
-            FREE = 0,
-
-            // DEQUEUED indicates that the buffer has been dequeued by the
-            // client, but has not yet been queued or canceled. The buffer is
-            // considered 'owned' by the client, and the server should not use
-            // it for anything.
-            //
-            // Note that when in synchronous-mode (mSynchronousMode == true),
-            // the buffer that's currently attached to the texture may be
-            // dequeued by the client.  That means that the current buffer can
-            // be in either the DEQUEUED or QUEUED state.  In asynchronous mode,
-            // however, the current buffer is always in the QUEUED state.
-            DEQUEUED = 1,
-
-            // QUEUED indicates that the buffer has been queued by the client,
-            // and has not since been made available for the client to dequeue.
-            // Attaching the buffer to the texture does NOT transition the
-            // buffer away from the QUEUED state. However, in Synchronous mode
-            // the current buffer may be dequeued by the client under some
-            // circumstances. See the note about the current buffer in the
-            // documentation for DEQUEUED.
-            QUEUED = 2,
-
-            // RENDERING indicates that the buffer has been sent to
-            // the compositor, and has not yet available for the
-            // client to dequeue. When the compositor has finished its
-            // job, the buffer will be returned to FREE state.
-            RENDERING = 3,
-        };
-
-        // mBufferState is the current state of this buffer slot.
-        BufferState mBufferState;
-
-        // mRequestBufferCalled is used for validating that the client did
-        // call requestBuffer() when told to do so. Technically this is not
-        // needed but useful for debugging and catching client bugs.
-        bool mRequestBufferCalled;
-
-        // mTimestamp is the current timestamp for this buffer slot. This gets
-        // to set by queueBuffer each time this slot is queued.
-        int64_t mTimestamp;
-
-        // mFrameNumber is the number of the queued frame for this slot.
-        uint64_t mFrameNumber;
-    };
-
-    // mSlots is the array of buffer slots that must be mirrored on the client
-    // side. This allows buffer ownership to be transferred between the client
-    // and server without sending a GraphicBuffer over binder. The entire array
-    // is initialized to NULL at construction time, and buffers are allocated
-    // for a slot when requestBuffer is called with that slot's index.
-    BufferSlot mSlots[NUM_BUFFER_SLOTS];
-
-    // mDequeueCondition condition used for dequeueBuffer in synchronous mode
-    mutable Condition mDequeueCondition;
-
-    // mAbandoned indicates that the GonkNativeWindow will no longer be used to
-    // consume buffers pushed to it.
-    // It is initialized to false, and set to true in the abandon method.  A
-    // GonkNativeWindow that has been abandoned will return the NO_INIT error
-    // from all control methods capable of returning an error.
-    bool mAbandoned;
-
-    // mTimestamp is the timestamp that will be used for the next buffer queue
-    // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
-    // a timestamp is auto-generated when queueBuffer is called.
-    int64_t mTimestamp;
-
-    // mDefaultWidth holds the default width of allocated buffers. It is used
-    // in requestBuffers() if a width and height of zero is specified.
-    uint32_t mDefaultWidth;
-
-    // mDefaultHeight holds the default height of allocated buffers. It is used
-    // in requestBuffers() if a width and height of zero is specified.
-    uint32_t mDefaultHeight;
-
-    // mPixelFormat holds the pixel format of allocated buffers. It is used
-    // in requestBuffers() if a format of zero is specified.
-    uint32_t mPixelFormat;
-
-    // mBufferCount is the number of buffer slots that the client and server
-    // must maintain. It defaults to MIN_BUFFER_SLOTS + 1 and can be changed
-    // by calling setBufferCount or setBufferCountServer
-    int mBufferCount;
-
-    // mConnectedApi indicates the API that is currently connected to this
-    // GonkNativeWindow.  It defaults to NO_CONNECTED_API (= 0), and gets updated
-    // by the connect and disconnect methods.
-    int mConnectedApi;
-
-    // mQueue is a FIFO of queued buffers used in synchronous mode
-    // GonkNativeWindow always works in synchronous mode
-    typedef Vector<int> Fifo;
-    Fifo mQueue;
-
-    // mMutex is the mutex used to prevent concurrent access to the member
-    // variables of GonkNativeWindow objects. It must be locked whenever the
-    // member variables are accessed.
-    mutable Mutex mMutex;
-
-    // mFrameCounter is the free running counter, incremented for every buffer queued
-    uint64_t mFrameCounter;
-
-    GonkNativeWindowNewFrameCallback* mNewFrameCallback;
-};
-
-}; // namespace android
-
-#endif // NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
--- a/widget/gonk/nativewindow/moz.build
+++ b/widget/gonk/nativewindow/moz.build
@@ -42,20 +42,16 @@ elif CONFIG['ANDROID_VERSION'] >= '19':
         'IGonkGraphicBufferConsumerKK.h',
     ]
 elif CONFIG['ANDROID_VERSION'] in ('17', '18'):
     EXPORTS += [
         'GonkBufferQueueJB.h',
         'GonkConsumerBaseJB.h',
         'GonkNativeWindowJB.h',
     ]
-elif CONFIG['ANDROID_VERSION'] == '15':
-    EXPORTS += [
-        'GonkNativeWindowICS.h',
-    ]
 
 if CONFIG['MOZ_B2G_CAMERA'] or CONFIG['MOZ_OMX_DECODER'] or CONFIG['MOZ_WEBRTC']:
     if CONFIG['ANDROID_VERSION'] >= '21':
         SOURCES += [
             'GonkBufferQueueLL/GonkBufferItem.cpp',
             'GonkBufferQueueLL/GonkBufferQueueConsumer.cpp',
             'GonkBufferQueueLL/GonkBufferQueueCore.cpp',
             'GonkBufferQueueLL/GonkBufferQueueLL.cpp',
@@ -73,20 +69,16 @@ if CONFIG['MOZ_B2G_CAMERA'] or CONFIG['M
             'IGonkGraphicBufferConsumerKK.cpp',
         ]
     elif CONFIG['ANDROID_VERSION'] in ('17', '18'):
         SOURCES += [
             'GonkBufferQueueJB.cpp',
             'GonkConsumerBaseJB.cpp',
             'GonkNativeWindowJB.cpp',
         ]
-    elif CONFIG['ANDROID_VERSION'] == '15':
-        SOURCES += [
-            'GonkNativeWindowICS.cpp',
-        ]
 
 if CONFIG['ANDROID_VERSION'] >= '18':
     SOURCES += [
         'FakeSurfaceComposer.cpp',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')