Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Tue, 24 Jul 2012 16:32:08 -0700
changeset 106581 50e28df7ff8fa9d0fcbac8ade290afce87a601ed
parent 106580 b82fb4d04f6025775b8faffb0a9cd46cb7e222bf (current diff)
parent 100246 5598b8c4f271ce3109b234581774788f3c7846c2 (diff)
child 106582 7f0f1fdfa5e24a40b57edd615314423f31714eb9
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-esr52@2704e441363f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone17.0a1
Merge from mozilla-central.
accessible/src/atk/nsMaiInterfaceTable.cpp
accessible/src/generic/Accessible.cpp
accessible/src/generic/ApplicationAccessible.h
accessible/src/generic/HyperTextAccessible.cpp
browser/base/content/test/browser_sanitizeDialog.js
browser/components/shell/src/nsGNOMEShellService.h
build/mobile/devicemanagerSUT.py
build/virtualenv/Makefile.in
caps/include/nsPrincipal.h
chrome/src/nsChromeRegistry.h
chrome/src/nsChromeRegistryChrome.h
chrome/src/nsChromeRegistryContent.h
config/autoconf.mk.in
config/nsinstall.exe.manifest
configure.in
content/base/public/nsIContent.h
content/base/public/nsINode.h
content/base/src/nsAttrAndChildArray.cpp
content/base/src/nsFrameLoader.cpp
content/base/src/nsGenericElement.h
content/events/src/nsDOMContactChangeEvent.cpp
content/events/src/nsDOMContactChangeEvent.h
content/events/src/nsDOMEventTargetHelper.h
content/events/src/nsEventListenerManager.cpp
content/events/src/nsEventStateManager.cpp
content/html/content/src/nsDOMStringMap.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/content/src/nsHTMLAnchorElement.cpp
content/html/content/src/nsHTMLAreaElement.cpp
content/html/content/src/nsHTMLButtonElement.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLInputElement.h
content/html/content/src/nsHTMLLabelElement.h
content/html/content/src/nsHTMLLegendElement.h
content/html/content/src/nsHTMLObjectElement.cpp
content/html/content/src/nsHTMLScriptElement.cpp
content/html/content/src/nsHTMLSelectElement.h
content/html/content/src/nsHTMLSharedObjectElement.cpp
content/html/content/src/nsHTMLStyleElement.cpp
content/html/content/src/nsHTMLTextAreaElement.cpp
content/media/ogg/nsOggReader.cpp
content/smil/nsSMILCSSValueType.h
content/smil/nsSMILSetAnimationFunction.h
content/svg/content/src/SVGMotionSMILAnimationFunction.h
content/xbl/src/nsXBLPrototypeHandler.cpp
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsDOMWindowUtils.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsGlobalWindowCommands.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsPIDOMWindow.h
dom/indexedDB/IndexedDatabaseManager.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.h
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.h
dom/plugins/base/PluginPRLibrary.h
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginInstanceOwner.h
dom/plugins/ipc/PluginInstanceChild.h
dom/plugins/ipc/PluginInstanceParent.h
dom/plugins/ipc/PluginModuleChild.h
dom/plugins/ipc/PluginModuleParent.h
dom/plugins/ipc/PluginProcessChild.h
dom/src/geolocation/nsGeolocation.cpp
dom/src/json/nsJSON.cpp
dom/src/jsurl/nsJSProtocolHandler.cpp
dom/wifi/WifiWorker.js
editor/libeditor/text/nsPlaintextDataTransfer.cpp
embedding/android/GeckoAppShell.java
embedding/browser/webBrowser/nsWebBrowser.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.h
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
gfx/layers/ImageLayers.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/basic/BasicCanvasLayer.cpp
gfx/layers/basic/BasicImageLayer.cpp
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
gfx/layers/ipc/ShadowLayerUtilsX11.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/opengl/CanvasLayerOGL.cpp
gfx/layers/opengl/ImageLayerOGL.cpp
gfx/layers/opengl/ImageLayerOGL.h
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/layers/opengl/ThebesLayerOGL.cpp
gfx/layers/opengl/ThebesLayerOGL.h
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/gfxImageSurface.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/nsCoreAnimationSupport.mm
image/decoders/nsBMPDecoder.cpp
image/decoders/nsBMPDecoder.h
image/decoders/nsPNGDecoder.cpp
image/src/Image.h
image/src/RasterImage.h
image/src/VectorImage.h
js/src/builtin/Eval.cpp
js/src/config/nsinstall.exe.manifest
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/SemanticAnalysis.cpp
js/src/gc/Root.h
js/src/jscntxt.h
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jspubtd.h
js/src/jsscript.cpp
js/src/jswrapper.cpp
js/src/jswrapper.h
js/xpconnect/idl/xpccomponents.idl
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcpublic.h
js/xpconnect/tests/components/native/xpctest_params.cpp
js/xpconnect/wrappers/WrapperFactory.cpp
js/xpconnect/wrappers/WrapperFactory.h
js/xpconnect/wrappers/XrayWrapper.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/generic/TextOverflow.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsIFrame.h
layout/generic/nsObjectFrame.cpp
layout/generic/nsTextFrameThebes.cpp
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
layout/printing/nsPrintData.cpp
layout/printing/nsPrintEngine.cpp
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsCSSRules.cpp
layout/style/nsCSSRules.h
layout/style/nsStyleAnimation.cpp
layout/style/nsStyleAnimation.h
layout/style/nsStyleTransformMatrix.cpp
layout/style/nsStyleTransformMatrix.h
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
layout/svg/base/src/nsISVGChildFrame.h
layout/svg/base/src/nsSVGClipPathFrame.cpp
layout/svg/base/src/nsSVGContainerFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.h
layout/svg/base/src/nsSVGGeometryFrame.h
layout/svg/base/src/nsSVGGlyphFrame.cpp
layout/svg/base/src/nsSVGImageFrame.cpp
layout/svg/base/src/nsSVGInnerSVGFrame.cpp
layout/svg/base/src/nsSVGMarkerFrame.cpp
layout/svg/base/src/nsSVGMaskFrame.cpp
layout/svg/base/src/nsSVGPathGeometryFrame.cpp
layout/svg/base/src/nsSVGPatternFrame.cpp
layout/svg/base/src/nsSVGTextFrame.cpp
layout/xul/base/src/nsDocElementBoxFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsXULTooltipListener.cpp
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/Makefile.in
mobile/android/base/gfx/SurfaceTextureLayer.java
mobile/android/base/resources/drawable-xlarge-hdpi/address_bar_back_button_bg.png
mobile/android/base/resources/drawable-xlarge-hdpi/address_bar_back_button_pressed_bg.png
mobile/android/base/resources/drawable-xlarge-hdpi/address_bar_texture_tablet.png
mobile/android/base/resources/drawable-xlarge-hdpi/address_bar_url_default.9.png
mobile/android/base/resources/drawable-xlarge-hdpi/address_bar_url_pressed.9.png
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_center.9.png
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_left.9.png
mobile/android/base/resources/drawable-xlarge-hdpi/awesomebar_tab_right.9.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_awesomebar_go.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_awesomebar_search.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_menu_bookmark_add.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_menu_bookmark_remove.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_menu_forward.png
mobile/android/base/resources/drawable-xlarge-hdpi/ic_menu_reload.png
mobile/android/base/resources/drawable-xlarge-hdpi/menu.png
mobile/android/base/resources/drawable-xlarge-hdpi/reader.png
mobile/android/base/resources/drawable-xlarge-hdpi/remote_tabs_off.png
mobile/android/base/resources/drawable-xlarge-hdpi/remote_tabs_on.png
mobile/android/base/resources/drawable-xlarge-hdpi/site_security_identified.png
mobile/android/base/resources/drawable-xlarge-hdpi/site_security_verified.png
mobile/android/base/resources/drawable-xlarge-hdpi/tab_new.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_carat_contracted.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_carat_expanded.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_crop_expanded_normal.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_crop_expanded_pressed.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_crop_normal.png
mobile/android/base/resources/drawable-xlarge-hdpi/tabs_crop_pressed.png
mobile/android/base/resources/drawable-xlarge-hdpi/urlbar_stop.png
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_back_button_bg.png
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_back_button_pressed_bg.png
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_bg.xml
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_texture_tablet.png
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_url_default.9.png
mobile/android/base/resources/drawable-xlarge-mdpi/address_bar_url_pressed.9.png
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_center.9.png
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_left.9.png
mobile/android/base/resources/drawable-xlarge-mdpi/awesomebar_tab_right.9.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_awesomebar_go.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_awesomebar_search.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_menu_bookmark_add.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_menu_bookmark_remove.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_menu_forward.png
mobile/android/base/resources/drawable-xlarge-mdpi/ic_menu_reload.png
mobile/android/base/resources/drawable-xlarge-mdpi/menu.png
mobile/android/base/resources/drawable-xlarge-mdpi/reader.png
mobile/android/base/resources/drawable-xlarge-mdpi/remote_tabs_off.png
mobile/android/base/resources/drawable-xlarge-mdpi/remote_tabs_on.png
mobile/android/base/resources/drawable-xlarge-mdpi/site_security_identified.png
mobile/android/base/resources/drawable-xlarge-mdpi/site_security_verified.png
mobile/android/base/resources/drawable-xlarge-mdpi/tab_new.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_carat_contracted.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_carat_expanded.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_crop_button.xml
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_crop_expanded_normal.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_crop_expanded_pressed.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_crop_normal.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_crop_pressed.png
mobile/android/base/resources/drawable-xlarge-mdpi/tabs_level.xml
mobile/android/base/resources/drawable-xlarge-mdpi/urlbar_stop.png
mobile/android/base/resources/drawable-xlarge-xhdpi/address_bar_back_button_bg.png
mobile/android/base/resources/drawable-xlarge-xhdpi/address_bar_back_button_pressed_bg.png
mobile/android/base/resources/drawable-xlarge-xhdpi/address_bar_texture_tablet.png
mobile/android/base/resources/drawable-xlarge-xhdpi/address_bar_url_default.9.png
mobile/android/base/resources/drawable-xlarge-xhdpi/address_bar_url_pressed.9.png
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_center.9.png
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_left.9.png
mobile/android/base/resources/drawable-xlarge-xhdpi/awesomebar_tab_right.9.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_awesomebar_go.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_awesomebar_search.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_menu_bookmark_add.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_menu_bookmark_remove.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_menu_forward.png
mobile/android/base/resources/drawable-xlarge-xhdpi/ic_menu_reload.png
mobile/android/base/resources/drawable-xlarge-xhdpi/menu.png
mobile/android/base/resources/drawable-xlarge-xhdpi/reader.png
mobile/android/base/resources/drawable-xlarge-xhdpi/remote_tabs_off.png
mobile/android/base/resources/drawable-xlarge-xhdpi/remote_tabs_on.png
mobile/android/base/resources/drawable-xlarge-xhdpi/site_security_identified.png
mobile/android/base/resources/drawable-xlarge-xhdpi/site_security_verified.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tab_new.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_carat_contracted.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_carat_expanded.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_crop_expanded_normal.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_crop_expanded_pressed.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_crop_normal.png
mobile/android/base/resources/drawable-xlarge-xhdpi/tabs_crop_pressed.png
mobile/android/base/resources/drawable-xlarge-xhdpi/urlbar_stop.png
mobile/android/base/resources/layout-xlarge/awesomebar_search.xml
mobile/android/base/resources/layout-xlarge/browser_toolbar.xml
mobile/android/base/resources/layout-xlarge/browser_toolbar_menu.xml
mobile/android/base/resources/layout-xlarge/doorhangerpopup.xml
mobile/android/base/resources/layout-xlarge/gecko_app.xml
mobile/android/base/resources/layout-xlarge/remote_tabs_child.xml
mobile/android/base/resources/layout-xlarge/remote_tabs_group.xml
mobile/android/base/resources/layout-xlarge/site_identity_popup.xml
mobile/android/base/resources/layout-xlarge/tabs_panel_toolbar.xml
mobile/android/base/resources/layout-xlarge/tabs_panel_toolbar_menu.xml
mobile/android/base/resources/layout-xlarge/tabs_row.xml
mobile/android/base/resources/layout/gecko_app.xml
mobile/android/base/resources/values-xlarge-v14/dimens.xml
mobile/android/base/resources/values-xlarge/dimens.xml
mobile/android/base/resources/values-xlarge/styles.xml
mobile/android/chrome/content/browser.js
mobile/android/themes/core/aboutReader.css
modules/libjar/nsZipArchive.h
modules/libpref/src/init/all.js
mozglue/android/APKOpen.cpp
netwerk/base/public/nsNetUtil.h
netwerk/base/src/RedirectChannelRegistrar.cpp
netwerk/base/src/nsBaseChannel.h
netwerk/base/src/nsPreloadedStream.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsTransportUtils.cpp
netwerk/protocol/ftp/FTPChannelChild.cpp
netwerk/protocol/ftp/FTPChannelChild.h
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/PHttpChannel.ipdl
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/websocket/BaseWebSocketChannel.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/wifi/nsWifiAccessPoint.cpp
parser/html/nsHtml5HtmlAttributes.cpp
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.cpp
parser/htmlparser/src/CNavDTD.cpp
security/manager/boot/src/nsStrictTransportSecurityService.cpp
security/manager/ssl/src/nsNSSIOLayer.cpp
services/crypto/component/nsSyncJPAKE.cpp
storage/src/mozStorageAsyncStatement.cpp
storage/src/mozStorageStatement.cpp
storage/test/test_AsXXX_helpers.cpp
toolkit/components/filepicker/nsFileView.cpp
toolkit/components/places/nsNavBookmarks.cpp
toolkit/crashreporter/nsExceptionHandler.h
toolkit/mozapps/extensions/AddonRepository.jsm
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/system/gnome/nsGnomeVFSService.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
uriloader/prefetch/OfflineCacheUpdateGlue.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidJNI.cpp
widget/android/AndroidMediaLayer.cpp
widget/android/AndroidMediaLayer.h
widget/android/GfxInfo.h
widget/android/nsClipboard.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/GfxInfo.h
widget/cocoa/TextInputHandler.mm
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
widget/nsIWidget.h
widget/os2/nsWindow.cpp
widget/os2/nsWindow.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/GfxInfo.h
widget/windows/nsNativeDragTarget.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/xpwidgets/GfxInfoX11.h
widget/xpwidgets/PuppetWidget.cpp
widget/xpwidgets/PuppetWidget.h
xpcom/ds/TimeStamp.h
xpcom/ds/nsISupportsArray.idl
xpcom/ds/nsStringEnumerator.cpp
xpcom/ds/nsVariant.cpp
xpcom/ds/nsVariant.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsCycleCollectionParticipant.h
xpcom/glue/nsInterfaceHashtable.h
xpcom/glue/nsStringAPI.cpp
xpcom/glue/nsTArray.h
xpcom/glue/standalone/nsGlueLinking.h
xpcom/string/public/nsReadableUtils.h
xpcom/tests/static-checker/e1.cpp
xpcom/tests/static-checker/e10.cpp
xpcom/tests/static-checker/e11.cpp
xpcom/tests/static-checker/e12.cpp
xpcom/tests/static-checker/e13.cpp
xpcom/tests/static-checker/e2.cpp
xpcom/tests/static-checker/e4.cpp
xpcom/tests/static-checker/e5.cpp
xpcom/tests/static-checker/e6.cpp
xpcom/tests/static-checker/e7.cpp
xpcom/tests/static-checker/e8.cpp
xpcom/tests/static-checker/e9.cpp
xpcom/tests/static-checker/o1.cpp
xpcom/tests/static-checker/o10.cpp
xpcom/tests/static-checker/o11.cpp
xpcom/tests/static-checker/o12.cpp
xpcom/tests/static-checker/o13.cpp
xpcom/tests/static-checker/o14.cpp
xpcom/tests/static-checker/o15.cpp
xpcom/tests/static-checker/o16.cpp
xpcom/tests/static-checker/o2.cpp
xpcom/tests/static-checker/o3.cpp
xpcom/tests/static-checker/o4.cpp
xpcom/tests/static-checker/o5.cpp
xpcom/tests/static-checker/o6.cpp
xpcom/tests/static-checker/o7.cpp
xpcom/tests/static-checker/o8.cpp
xpcom/tests/static-checker/o9.cpp
xpcom/tests/static-checker/onull.cpp
xpcom/tests/static-checker/onull2.cpp
xpcom/tests/static-checker/opmember.cpp
xpcom/tests/static-checker/override-global.cpp
xpcom/tests/static-checker/override-namespace-typedef.cpp
xpcom/tests/static-checker/override-pass.cpp
xpcom/tests/static-checker/override-signature.cpp
xpcom/tests/static-checker/override-static.cpp
xpcom/tests/static-checker/override-virtual.cpp
xpfe/appshell/src/nsWebShellWindow.cpp
xpfe/appshell/src/nsWebShellWindow.h
xpfe/appshell/src/nsXULWindow.cpp
--- a/accessible/src/atk/nsMaiInterfaceTable.cpp
+++ b/accessible/src/atk/nsMaiInterfaceTable.cpp
@@ -334,17 +334,17 @@ getSelectedColumnsCB(AtkTable *aTable, g
     if (NS_FAILED(rv) || (size == 0) || !columns) {
         *aSelected = nsnull;
         return 0;
     }
 
     gint *atkColumns = g_new(gint, size);
     if (!atkColumns) {
         NS_WARNING("OUT OF MEMORY");
-        return nsnull;
+        return 0;
     }
 
     //copy
     for (PRUint32 index = 0; index < size; ++index)
         atkColumns[index] = static_cast<gint>(columns[index]);
     nsMemory::Free(columns);
 
     *aSelected = atkColumns;
@@ -369,17 +369,17 @@ getSelectedRowsCB(AtkTable *aTable, gint
     if (NS_FAILED(rv) || (size == 0) || !rows) {
         *aSelected = nsnull;
         return 0;
     }
 
     gint *atkRows = g_new(gint, size);
     if (!atkRows) {
         NS_WARNING("OUT OF MEMORY");
-        return nsnull;
+        return 0;
     }
 
     //copy
     for (PRUint32 index = 0; index < size; ++index)
         atkRows[index] = static_cast<gint>(rows[index]);
     nsMemory::Free(rows);
 
     *aSelected = atkRows;
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -344,22 +344,22 @@ getOffsetAtPointCB(AtkText *aText,
     return static_cast<gint>(offset);
 }
 
 static gint
 getTextSelectionCountCB(AtkText *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return 0;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, 0);
 
     PRInt32 selectionCount;
     nsresult rv = accText->GetSelectionCount(&selectionCount);
  
     return NS_FAILED(rv) ? 0 : selectionCount;
 }
 
 static gchar*
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -671,33 +671,38 @@ Accessible::NativeState()
     if (FocusMgr()->IsFocused(this))
       state |= states::FOCUSED;
   }
 
   // Gather states::INVISIBLE and states::OFFSCREEN flags for this object.
   state |= VisibilityState();
 
   nsIFrame *frame = GetFrame();
-  if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
-    state |= states::FLOATING;
+  if (frame) {
+    if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
+      state |= states::FLOATING;
+
+    // XXX we should look at layout for non XUL box frames, but need to decide
+    // how that interacts with ARIA.
+    if (mContent->IsXUL() && frame->IsBoxFrame()) {
+      const nsStyleXUL* xulStyle = frame->GetStyleXUL();
+      if (xulStyle && frame->IsBoxFrame()) {
+        // In XUL all boxes are either vertical or horizontal
+        if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
+          state |= states::VERTICAL;
+        else
+          state |= states::HORIZONTAL;
+      }
+    }
+  }
 
   // Check if a XUL element has the popup attribute (an attached popup menu).
-  if (mContent->IsXUL()) {
-    if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
-      state |= states::HASPOPUP;
-
-    const nsStyleXUL *xulStyle = frame->GetStyleXUL();
-    if (xulStyle && frame->IsBoxFrame()) {
-      // In XUL all boxes are either vertical or horizontal
-      if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
-        state |= states::VERTICAL;
-      else
-        state |= states::HORIZONTAL;
-    }
-  }
+      if (mContent->IsXUL() && mContent->HasAttr(kNameSpaceID_None,
+                                                 nsGkAtoms::popup))
+        state |= states::HASPOPUP;
 
   // Bypass the link states specialization for non links.
   if (!mRoleMapEntry || mRoleMapEntry->roleRule == kUseNativeRole ||
       mRoleMapEntry->role == roles::LINK)
     state |= NativeLinkState();
 
   return state;
 }
--- a/accessible/src/generic/ApplicationAccessible.h
+++ b/accessible/src/generic/ApplicationAccessible.h
@@ -33,22 +33,22 @@ class ApplicationAccessible : public Acc
 public:
 
   ApplicationAccessible();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode);
-  NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument);
-  NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
-  NS_SCRIPTABLE NS_IMETHOD ScrollTo(PRUint32 aScrollType);
-  NS_SCRIPTABLE NS_IMETHOD ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY);
-  NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage);
+  NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode);
+  NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument);
+  NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
+  NS_IMETHOD ScrollTo(PRUint32 aScrollType);
+  NS_IMETHOD ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY);
+  NS_IMETHOD GetLanguage(nsAString& aLanguage);
   NS_IMETHOD GetParent(nsIAccessible **aParent);
   NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
   NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
   NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
   NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
                        PRInt32 *aWidth, PRInt32 *aHeight);
   NS_IMETHOD SetSelected(bool aIsSelected);
   NS_IMETHOD TakeSelection();
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -477,17 +477,17 @@ HyperTextAccessible::GetCharacterCount(P
 
 /*
  * Gets the specified character.
  */
 NS_IMETHODIMP
 HyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar* aCharacter)
 {
   NS_ENSURE_ARG_POINTER(aCharacter);
-  *aCharacter = nsnull;
+  *aCharacter = L'\0';
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAutoString character;
   if (GetCharAt(aOffset, eGetAt, character)) {
     *aCharacter = character.First();
     return NS_OK;
--- a/allmakefiles.sh
+++ b/allmakefiles.sh
@@ -25,17 +25,16 @@ fi
 
 # Common makefiles used by everyone
 add_makefiles "
 Makefile
 build/Makefile
 build/pgo/Makefile
 build/pgo/blueprint/Makefile
 build/pgo/js-input/Makefile
-build/virtualenv/Makefile
 config/Makefile
 config/autoconf.mk
 config/nspr/Makefile
 config/doxygen.cfg
 config/expandlibs_config.py
 mfbt/Makefile
 probes/Makefile
 extensions/Makefile
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -240,16 +240,18 @@ pref("editor.singleLine.pasteNewlines", 
 // threshold where a tap becomes a drag, in 1/240" reference pixels
 // The names of the preferences are to be in sync with nsEventStateManager.cpp
 pref("ui.dragThresholdX", 25);
 pref("ui.dragThresholdY", 25);
 
 // Layers Acceleration
 pref("layers.acceleration.disabled", false);
 pref("layers.offmainthreadcomposition.enabled", true);
+pref("layers.offmainthreadcomposition.animate-opacity", true);
+pref("layers.offmainthreadcomposition.animate-transform", true);
 pref("layers.async-video.enabled", true);
 pref("layers.async-pan-zoom.enabled", true);
 
 // Web Notifications
 pref("notification.feature.enabled", true);
 
 // IndexedDB
 pref("indexedDB.feature.enabled", true);
--- a/browser/base/content/test/browser_sanitizeDialog.js
+++ b/browser/base/content/test/browser_sanitizeDialog.js
@@ -446,18 +446,18 @@ var gAllTests = [
 
     var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
              .getService(Ci.nsIScriptSecurityManager);
     var principal = sm.getNoAppCodebasePrincipal(URI);
 
     // Give www.example.com privileges to store offline data
     var pm = Cc["@mozilla.org/permissionmanager;1"]
              .getService(Ci.nsIPermissionManager);
-    pm.add(URI, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
-    pm.add(URI, "offline-app", Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
+    pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
+    pm.addFromPrincipal(principal, "offline-app", Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
 
     // Store some user data to localStorage
     var dsm = Cc["@mozilla.org/dom/storagemanager;1"]
              .getService(Ci.nsIDOMStorageManager);
     var localStorage = dsm.getLocalStorageForPrincipal(principal, URL);
     localStorage.setItem("test", "value");
 
     // Store something to the offline cache
@@ -520,31 +520,35 @@ var gAllTests = [
 
     // Prepare stuff, we will work with www.example.com
     var URL = "http://www.example.com";
 
     var ios = Cc["@mozilla.org/network/io-service;1"]
               .getService(Ci.nsIIOService);
     var URI = ios.newURI(URL, null, null);
 
+    var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
+             .getService(Ci.nsIScriptSecurityManager);
+    var principal = sm.getNoAppCodebasePrincipal(URI);
+
     // Open the dialog
     let wh = new WindowHelper();
     wh.onload = function () {
       this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
       // Show details
       this.toggleDetails();
       // Clear only offlineApps
       this.uncheckAllCheckboxes();
       this.checkPrefCheckbox("siteSettings", true);
       this.acceptDialog();
 
       // Check all has been deleted (privileges, data, cache)
       var pm = Cc["@mozilla.org/permissionmanager;1"]
                .getService(Ci.nsIPermissionManager);
-      is(pm.testPermission(URI, "offline-app"), 0, "offline-app permissions removed");
+      is(pm.testPermissionFromPrincipal(principal, "offline-app"), 0, "offline-app permissions removed");
     };
     wh.open();
   }
 ];
 
 // Used as the download database ID for a new download.  Incremented for each
 // new download.  See addDownloadWithMinutesAgo().
 var gDownloadId = 5555551;
--- a/browser/base/content/test/test_offlineNotification.html
+++ b/browser/base/content/test/test_offlineNotification.html
@@ -32,19 +32,30 @@ var numFinished = 0;
 window.addEventListener("message", function(event) {
     is(event.data, "success", "Child was successfully cached.");
 
     if (++numFinished == 3) {
       // Clean up after ourself
       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
       var pm = Components.classes["@mozilla.org/permissionmanager;1"].
                getService(Components.interfaces.nsIPermissionManager);
+      var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                        .getService(Components.interfaces.nsIIOService);
+      var uri1 = ioService.newURI(frames.testFrame.location, null, null);
+      var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
 
-      pm.remove(frames.testFrame.location.hostname, "offline-app");
-      pm.remove(frames.testFrame3.location.hostname, "offline-app");
+      var principal1 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                        .getService(Components.interfaces.nsIScriptSecurityManager)
+                        .getNoAppCodebasePrincipal(uri1);
+      var principal2 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                        .getService(Components.interfaces.nsIScriptSecurityManager)
+                        .getNoAppCodebasePrincipal(uri2);
+
+      pm.removeFromPrincipal(principal1, "offline-app");
+      pm.removeFromPrincipal(principal2, "offline-app");
 
       SimpleTest.finish();
     }
   }, false);
 
 var count = 0;
 var expectedEvent = "";
 function eventHandler(evt) {
--- a/browser/base/content/test/test_offline_gzip.html
+++ b/browser/base/content/test/test_offline_gzip.html
@@ -32,18 +32,25 @@ SimpleTest.waitForExplicitFinish();
 
 function finishTest() {
   // Clean up after ourselves.
   netscape.security.PrivilegeManager
           .enablePrivilege("UniversalXPConnect");
   var pm = Components.classes["@mozilla.org/permissionmanager;1"].
            getService(Components.interfaces.nsIPermissionManager);
 
-  pm.remove("mochi.test", "offline-app");
-  
+  var uri = Components.classes["@mozilla.org/network/io-service;1"]
+              .getService(Components.interfaces.nsIIOService)
+              .newURI(window.frames[0].location, null, null);
+  var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                   .getService(Components.interfaces.nsIScriptSecurityManager)
+                   .getNoAppCodebasePrincipal(uri);
+
+  pm.removeFromPrincipal(principal, "offline-app");
+
   window.removeEventListener("message", handleMessageEvents, false);
 
   SimpleTest.finish();  
 }
 
 ////
 // Handle "message" events which are posted from the iframe upon
 // offline cache events.
--- a/browser/components/migration/src/nsIEHistoryEnumerator.cpp
+++ b/browser/components/migration/src/nsIEHistoryEnumerator.cpp
@@ -68,17 +68,17 @@ nsIEHistoryEnumerator::EnsureInitialized
     return;
 
   hr = mIEHistory->EnumUrls(getter_AddRefs(mURLEnumerator));
   if (FAILED(hr))
     return;
 }
 
 NS_IMETHODIMP
-nsIEHistoryEnumerator::HasMoreElements(bool* _retval NS_OUTPARAM)
+nsIEHistoryEnumerator::HasMoreElements(bool* _retval)
 {
   *_retval = false;
 
   EnsureInitialized();
   MOZ_ASSERT(mURLEnumerator, "Should have instanced an IE History URLEnumerator");
   if (!mURLEnumerator)
     return NS_OK;
 
@@ -119,17 +119,17 @@ nsIEHistoryEnumerator::HasMoreElements(b
 
   if (statURL.pwcsTitle)
     ::CoTaskMemFree(statURL.pwcsTitle);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIEHistoryEnumerator::GetNext(nsISupports** _retval NS_OUTPARAM)
+nsIEHistoryEnumerator::GetNext(nsISupports** _retval)
 {
   *_retval = nsnull;
 
   if (!mCachedNextEntry)
     return NS_ERROR_FAILURE;
 
   NS_ADDREF(*_retval = mCachedNextEntry);
   // Release the cached entry, so it can't be returned twice.
--- a/browser/components/preferences/tests/browser_permissions.js
+++ b/browser/components/preferences/tests/browser_permissions.js
@@ -4,16 +4,19 @@
 Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
 Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
 const ABOUT_PERMISSIONS_SPEC = "about:permissions";
 
 const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
 const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
 
+const TEST_PRINCIPAL_1 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_1);
+const TEST_PRINCIPAL_2 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_2);
+
 // values from DefaultPermissions object
 const PERM_UNKNOWN = 0;
 const PERM_ALLOW = 1;
 const PERM_DENY = 2;
 const PERM_SESION = 8;
 
 // used to set permissions on test sites
 const TEST_PERMS = {
@@ -45,35 +48,35 @@ function test() {
 
   // set permissions ourselves to avoid problems with different defaults
   // from test harness configuration
   for (let type in TEST_PERMS) {
     if (type == "password") {
       Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
     } else {
       // set permissions on a site without history visits to test enumerateServices
-      Services.perms.add(TEST_URI_2, type, TEST_PERMS[type]);
+      Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, type, TEST_PERMS[type]);
     }
   }
 
   function observer() {
     Services.obs.removeObserver(observer, "browser-permissions-initialized", false);
     runNextTest();
   }
   Services.obs.addObserver(observer, "browser-permissions-initialized", false);
 
   // open about:permissions
   gBrowser.selectedTab = gBrowser.addTab("about:permissions");
 }
 
 function cleanUp() {
   for (let type in TEST_PERMS) {
     if (type != "password") {
-      Services.perms.remove(TEST_URI_1.host, type);
-      Services.perms.remove(TEST_URI_2.host, type);
+      Services.perms.removeFromPrincipal(TEST_PRINCIPAL_1, type);
+      Services.perms.removeFromPrincipal(TEST_PRINCIPAL_2, type);
     }
   }
 
   gBrowser.removeTab(gBrowser.selectedTab);
 }
 
 function runNextTest() {
   if (gTestIndex == tests.length) {
@@ -233,26 +236,26 @@ var tests = [
     runNextTest();
   },
 
   function test_permission_change() {
     let geoMenulist = getPermissionMenulist("geo");
     is(geoMenulist.value, PERM_UNKNOWN, "menulist correctly shows that geolocation permission is unspecified");
 
     // change a permission programatically
-    Services.perms.add(TEST_URI_2, "geo", PERM_DENY);
+    Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, "geo", PERM_DENY);
     // check to make sure this change is reflected in the UI
     is(geoMenulist.value, PERM_DENY, "menulist shows that geolocation is blocked");
 
     // change a permisssion in the UI
     let geoAllowItem = gBrowser.contentDocument.getElementById("geo-" + PERM_ALLOW);
     geoMenulist.selectedItem = geoAllowItem;
     geoMenulist.doCommand();
     // check to make sure this change is reflected in the permission manager
-    is(Services.perms.testPermission(TEST_URI_2, "geo"), PERM_ALLOW,
+    is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "geo"), PERM_ALLOW,
        "permission manager shows that geolocation is allowed");
 
     runNextTest();
   },
 
   function test_forget_site() {
     // click "Forget About This Site" button
     gBrowser.contentDocument.getElementById("forget-site-button").doCommand();
@@ -268,17 +271,17 @@ var tests = [
     ok(!testSiteItem, "site removed from sites list");
 
     // check to make sure we forgot all permissions corresponding to site
     for (let type in TEST_PERMS) {
       if (type == "password") {
         ok(Services.logins.getLoginSavingEnabled(TEST_URI_2.prePath),
            "password saving should be enabled by default");
       } else {
-        is(Services.perms.testPermission(TEST_URI_2, type), PERM_UNKNOWN,
+        is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, type), PERM_UNKNOWN,
            type + " permission should not be set for test site 2");
       }
     }
 
     runNextTest();
   }
 ];
 
--- a/browser/components/privatebrowsing/test/unit/do_test_removeDataFromDomain.js
+++ b/browser/components/privatebrowsing/test/unit/do_test_removeDataFromDomain.js
@@ -244,33 +244,41 @@ function check_login_exists(aHost, aExis
  * @param aURI
  *        The URI to add the test permission for.
  */
 function add_permission(aURI)
 {
   check_permission_exists(aURI, false);
   let pm = Cc["@mozilla.org/permissionmanager;1"].
            getService(Ci.nsIPermissionManager);
-  pm.add(aURI, PERMISSION_TYPE, PERMISSION_VALUE);
+  let principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
+                    .getService(Ci.nsIScriptSecurityManager)
+                    .getNoAppCodebasePrincipal(aURI);
+
+  pm.addFromPrincipal(principal, PERMISSION_TYPE, PERMISSION_VALUE);
   check_permission_exists(aURI, true);
 }
 
 /**
  * Checks to see if a permission exists for the given URI.
  *
  * @param aURI
  *        The URI to check if a permission exists.
  * @param aExists
  *        True if the permission should exist, false otherwise.
  */
 function check_permission_exists(aURI, aExists)
 {
   let pm = Cc["@mozilla.org/permissionmanager;1"].
            getService(Ci.nsIPermissionManager);
-  let perm = pm.testExactPermission(aURI, PERMISSION_TYPE);
+  let principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
+                    .getService(Ci.nsIScriptSecurityManager)
+                    .getNoAppCodebasePrincipal(aURI);
+
+  let perm = pm.testExactPermissionFromPrincipal(principal, PERMISSION_TYPE);
   let checker = aExists ? do_check_eq : do_check_neq;
   checker(perm, PERMISSION_VALUE);
 }
 
 /**
  * Adds a content preference for the specified URI.
  *
  * @param aURI
--- a/browser/components/shell/src/nsGNOMEShellService.h
+++ b/browser/components/shell/src/nsGNOMEShellService.h
@@ -3,18 +3,19 @@
  * 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/. */
 
 #ifndef nsgnomeshellservice_h____
 #define nsgnomeshellservice_h____
 
 #include "nsIShellService.h"
 #include "nsStringAPI.h"
+#include "mozilla/Attributes.h"
 
-class nsGNOMEShellService : public nsIShellService
+class nsGNOMEShellService MOZ_FINAL : public nsIShellService
 {
 public:
   nsGNOMEShellService() : mCheckedThisSession(false), mAppIsInPath(false) { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISHELLSERVICE
 
   nsresult Init() NS_HIDDEN;
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js
+++ b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js
@@ -9,16 +9,19 @@ let doc;
 
 const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/" +
                  "test/browser_bug705707_is_content_stylesheet.html";
 const TEST_URI2 = "http://example.com/browser/browser/devtools/styleinspector/" +
                  "test/browser_bug705707_is_content_stylesheet.xul";
 const XUL_URI = Cc["@mozilla.org/network/io-service;1"]
                 .getService(Ci.nsIIOService)
                 .newURI(TEST_URI2, null, null);
+const XUL_PRINCIPAL =  Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                                 .getService(Ci.nsIScriptSecurityManager)
+                                 .getNoAppCodebasePrincipal(XUL_URI);
 
 let tempScope = {};
 Cu.import("resource:///modules/devtools/CssLogic.jsm", tempScope);
 let CssLogic = tempScope.CssLogic;
 
 function test()
 {
   waitForExplicitFinish();
@@ -42,17 +45,17 @@ function testFromHTML()
     gBrowser.removeCurrentTab();
     openXUL();
   });
 }
 
 function openXUL()
 {
   Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
-    .add(XUL_URI, 'allowXULXBL', Ci.nsIPermissionManager.ALLOW_ACTION);
+    .addFromPrincipal(XUL_PRINCIPAL, 'allowXULXBL', Ci.nsIPermissionManager.ALLOW_ACTION);
   addTab(TEST_URI2);
   browser.addEventListener("load", xulLoaded, true);
 }
 
 function xulLoaded()
 {
   browser.removeEventListener("load", xulLoaded, true);
   doc = content.document;
@@ -88,13 +91,13 @@ function checkSheets(aTarget)
     }
   }
 }
 
 function finishUp()
 {
   info("finishing up");
   Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
-    .add(XUL_URI, 'allowXULXBL', Ci.nsIPermissionManager.DENY_ACTION);
+    .addFromPrincipal(XUL_PRINCIPAL, 'allowXULXBL', Ci.nsIPermissionManager.DENY_ACTION);
   doc = null;
   gBrowser.removeCurrentTab();
   finish();
 }
--- a/browser/themes/gnomestripe/tabview/tabview.css
+++ b/browser/themes/gnomestripe/tabview/tabview.css
@@ -549,16 +549,18 @@ html[dir=rtl] .iq-resizable-se {
 
 #search{
   width: 100%;
   height: 100%;
 }
 
 #searchbox{
   width: 270px;
+  max-width: -moz-available;
+  -moz-margin-start: 20px;
   height: 30px;
   box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
   color: white;
   border: none;
   background-color: #272727;
   border-radius: 0.4em;
   -moz-padding-start: 5px;
   -moz-padding-end: 5px;
--- a/browser/themes/pinstripe/tabview/tabview.css
+++ b/browser/themes/pinstripe/tabview/tabview.css
@@ -545,16 +545,18 @@ html[dir=rtl] .iq-resizable-se {
 
 #search{
   width: 100%;
   height: 100%;
 }
 
 #searchbox {
   width: 270px;
+  max-width: -moz-available;
+  -moz-margin-start: 20px;
   height: 30px;
   box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 13px rgba(0,0,0,.8);
   color: white;
   border: none;
   background-color: #272727;
   border-radius: 0.4em;
   -moz-padding-start: 5px;
   -moz-padding-end: 5px;
--- a/browser/themes/winstripe/tabview/tabview.css
+++ b/browser/themes/winstripe/tabview/tabview.css
@@ -564,16 +564,18 @@ html[dir=rtl] .iq-resizable-se {
 
 #search{
   width: 100%;
   height: 100%;
 }
 
 #searchbox{
   width: 270px;
+  max-width: -moz-available;
+  -moz-margin-start: 20px;
   height: 30px;
   box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
   color: white;
   border: none;
   background-color: #272727;
   border-radius: 0.4em;
   -moz-padding-start: 5px;
   -moz-padding-end: 5px;
--- a/build/mobile/devicemanagerSUT.py
+++ b/build/mobile/devicemanagerSUT.py
@@ -97,23 +97,21 @@ class DeviceManagerSUT(DeviceManager):
       # prompt (those are basically "prompts")
       if not foundPrompt or line:
         retVal.append(line)
 
     return '\n'.join(retVal)
 
   def _shouldCmdCloseSocket(self, cmd):
     """ Some commands need to close the socket after they are sent:
-    * push
     * rebt
     * uninst
     * quit
     """
-    socketClosingCmds = [re.compile('^push .*$'),
-                         re.compile('^quit.*'),
+    socketClosingCmds = [re.compile('^quit.*'),
                          re.compile('^rebt.*'),
                          re.compile('^uninst .*$')]
 
     for c in socketClosingCmds:
       if (c.match(cmd)):
         return True
 
     return False
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -13,16 +13,17 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintWriter;
+import java.io.RandomAccessFile;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -101,17 +102,17 @@ public class DoCommand {
 
     String    currentDir = "/";
     String    sErrorPrefix = "##AGENT-WARNING## ";
     boolean bTraceOn = false;
 
     String ffxProvider = "org.mozilla.ffxcp";
     String fenProvider = "org.mozilla.fencp";
 
-    private final String prgVersion = "SUTAgentAndroid Version 1.09";
+    private final String prgVersion = "SUTAgentAndroid Version 1.10";
 
     public enum Command
         {
         RUN ("run"),
         EXEC ("exec"),
         EXECCWD ("execcwd"),
         ENVRUN ("envrun"),
         KILL ("kill"),
@@ -2566,30 +2567,57 @@ private void CancelNotification()
 
         sRet = "total:     " + (nBlockCount * nBlockSize) + "\nfree:      " + (nBlocksFree * nBlockSize) + "\navailable: " + (nBlocksAvail * nBlockSize);
 
         return (sRet);
         }
 
     public String GetMemoryInfo()
         {
-        String sRet = "PA:" + GetMemoryConfig();
+        String sRet = "PA:" + GetMemoryConfig() + ", FREE: " + GetMemoryUsage();
         return (sRet);
         }
 
     public long GetMemoryConfig()
         {
         ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
         ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
         aMgr.getMemoryInfo(outInfo);
         long lMem = outInfo.availMem;
 
         return (lMem);
         }
 
+    public long GetMemoryUsage()
+        {
+
+        String load = "";
+        try {
+            RandomAccessFile reader = new RandomAccessFile("/proc/meminfo", "r");
+            load = reader.readLine(); // Read in the MemTotal
+            load = reader.readLine(); // Read in the MemFree
+        } catch (IOException ex) {
+            return (0);
+        }
+
+        String[] toks = load.split(" ");
+        int i = 1;
+        for (i=1; i < toks.length; i++) {
+            String val = toks[i].trim();
+            if (!val.equals("")) {
+                break;
+            }
+        }
+        if (i <= toks.length) {
+            long lMem = Long.parseLong(toks[i].trim());
+            return (lMem * 1024);
+        }
+        return (0);
+        }
+
     public String UpdateCallBack(String sFileName)
         {
         String sRet = sErrorPrefix + "No file specified";
         String sIP = "";
         String sPort = "";
         int nEnd = 0;
         int nStart = 0;
 
--- a/build/unix/stdc++compat/Makefile.in
+++ b/build/unix/stdc++compat/Makefile.in
@@ -21,8 +21,9 @@ CPPSRCS = \
   stdc++compat.cpp
   $(NULL)
 
 HOST_CPPSRCS = $(CPPSRCS)
 
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
+HOST_CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
deleted file mode 100644
--- a/build/virtualenv/Makefile.in
+++ /dev/null
@@ -1,35 +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/.
-
-DEPTH     = ../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-# Paths here are topsrcdir-relative, and
-# must be in dependency-order.
-setuptools_packages := \
-  other-licenses/simplejson-2.1.1 \
-  testing/mozbase/manifestdestiny \
-  testing/mozbase/mozinfo \
-  testing/mozbase/mozinstall \
-  testing/mozbase/mozlog \
-  testing/mozbase/mozprocess \
-  testing/mozbase/mozprofile \
-  testing/mozbase/mozrunner \
-  build/pylib/blessings \
-  $(NULL)
-
-
-define install_setuptools_package
-cd $(topsrcdir)/$(1)/; CFLAGS="$(HOST_CFLAGS)" LDFLAGS="$(HOST_LDFLAGS)" CXXFLAGS="$(HOST_CXXFLAGS)" $(PYTHON) setup.py develop
-
-endef
-
-default::
-	$(foreach package,$(setuptools_packages),$(call install_setuptools_package,$(package)))
-
-include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/build/virtualenv/packages.txt
@@ -0,0 +1,9 @@
+setup.py:other-licenses/simplejson-2.1.1:develop
+setup.py:testing/mozbase/manifestdestiny:develop
+setup.py:testing/mozbase/mozinfo:develop
+setup.py:testing/mozbase/mozinstall:develop
+setup.py:testing/mozbase/mozlog:develop
+setup.py:testing/mozbase/mozprocess:develop
+setup.py:testing/mozbase/mozprofile:develop
+setup.py:testing/mozbase/mozrunner:develop
+setup.py:build/pylib/blessings:develop
new file mode 100755
--- /dev/null
+++ b/build/virtualenv/populate_virtualenv.py
@@ -0,0 +1,63 @@
+# 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/.
+
+# This file contains code for populating the virtualenv environment for
+# Mozilla's build system. It is typically called as part of configure.
+
+import os.path
+import subprocess
+import sys
+
+def populate_virtualenv(top_source_directory, manifest_filename):
+    """Populate the virtualenv from the contents of a manifest.
+
+    The manifest file consists of colon-delimited fields. The first field
+    specifies the action. The remaining fields are arguments to that action.
+    The following actions are supported:
+
+      setup.py -- Invoke setup.py for a package. Expects the arguments:
+        1. relative path directory containing setup.py.
+        2. argument(s) to setup.py. e.g. "develop". Each program argument is
+           delimited by a colon. Arguments with colons are not yet supported.
+
+    Note that the Python interpreter running this function should be the one
+    from the virtualenv. If it is the system Python or if the environment is
+    not configured properly, packages could be installed into the wrong place.
+    This is how virtualenv's work.
+    """
+    packages = []
+    fh = open(manifest_filename, 'rU')
+    for line in fh:
+        packages.append(line.rstrip().split(':'))
+    fh.close()
+
+    for package in packages:
+        if package[0] == 'setup.py':
+            assert len(package) >= 2
+
+            call_setup(os.path.join(top_source_directory, package[1]),
+                package[2:])
+
+def call_setup(directory, arguments):
+    """Calls setup.py in a directory."""
+    setup = os.path.join(directory, 'setup.py')
+
+    program = [sys.executable, setup]
+    program.extend(arguments)
+
+    # We probably could call the contents of this file inside the context of
+    # this interpreter using execfile() or similar. However, if global
+    # variables like sys.path are adjusted, this could cause all kinds of
+    # havoc. While this may work, invoking a new process is safer.
+    result = subprocess.call(program, cwd=directory)
+
+    if result != 0:
+        raise Exception('Error installing package: %s' % directory)
+
+# configure invokes us with /path/to/topsrcdir and /path/to/manifest
+if __name__ == '__main__':
+    assert len(sys.argv) == 3
+
+    populate_virtualenv(sys.argv[1], sys.argv[2])
+    sys.exit(0)
--- a/caps/include/nsPrincipal.h
+++ b/caps/include/nsPrincipal.h
@@ -24,22 +24,22 @@ public:
   nsBasePrincipal();
 
 protected:
   virtual ~nsBasePrincipal();
 
 public:
   NS_IMETHOD_(nsrefcnt) AddRef(void);
   NS_IMETHOD_(nsrefcnt) Release(void);
-  NS_SCRIPTABLE NS_IMETHOD GetPreferences(char** prefBranch NS_OUTPARAM, char** id NS_OUTPARAM, char** subjectName NS_OUTPARAM, char** grantedList NS_OUTPARAM, char** deniedList NS_OUTPARAM, bool* isTrusted NS_OUTPARAM);
+  NS_IMETHOD GetPreferences(char** prefBranch, char** id, char** subjectName, char** grantedList, char** deniedList, bool* isTrusted);
   NS_IMETHOD GetSecurityPolicy(void** aSecurityPolicy);
   NS_IMETHOD SetSecurityPolicy(void* aSecurityPolicy);
-  NS_IMETHOD CanEnableCapability(const char* capability, PRInt16* _retval NS_OUTPARAM);
-  NS_IMETHOD IsCapabilityEnabled(const char* capability, void* annotation, bool* _retval NS_OUTPARAM);
-  NS_IMETHOD EnableCapability(const char* capability, void** annotation NS_INOUTPARAM);
+  NS_IMETHOD CanEnableCapability(const char* capability, PRInt16* _retval);
+  NS_IMETHOD IsCapabilityEnabled(const char* capability, void* annotation, bool* _retval);
+  NS_IMETHOD EnableCapability(const char* capability, void** annotation);
   NS_IMETHOD GetHasCertificate(bool* aHasCertificate);
   NS_IMETHOD GetFingerprint(nsACString& aFingerprint);
   NS_IMETHOD GetPrettyName(nsACString& aPrettyName);
   NS_IMETHOD GetSubjectName(nsACString& aSubjectName);
   NS_IMETHOD GetCertificate(nsISupports** aCertificate);
   NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp);
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp);
 public:
@@ -109,25 +109,25 @@ protected:
   bool mTrusted;
 };
 
 class nsPrincipal : public nsBasePrincipal
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSISERIALIZABLE
-  NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
-  NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
+  NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
+  NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
   NS_IMETHOD GetHashValue(PRUint32* aHashValue);
   NS_IMETHOD GetURI(nsIURI** aURI);
   NS_IMETHOD GetDomain(nsIURI** aDomain);
   NS_IMETHOD SetDomain(nsIURI* aDomain);
   NS_IMETHOD GetOrigin(char** aOrigin);
-  NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
-  NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
+  NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
+  NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report);
   NS_IMETHOD GetExtendedOrigin(nsACString& aExtendedOrigin);
   NS_IMETHOD GetAppStatus(PRUint16* aAppStatus);
   NS_IMETHOD GetAppId(PRUint32* aAppStatus);
 #ifdef DEBUG
   virtual void dumpImpl();
 #endif
 
@@ -187,25 +187,25 @@ public:
 
 protected:
   virtual ~nsExpandedPrincipal();
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIEXPANDEDPRINCIPAL
   NS_DECL_NSISERIALIZABLE
-  NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
-  NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
+  NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
+  NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
   NS_IMETHOD GetHashValue(PRUint32* aHashValue);
   NS_IMETHOD GetURI(nsIURI** aURI);
   NS_IMETHOD GetDomain(nsIURI** aDomain);
   NS_IMETHOD SetDomain(nsIURI* aDomain);
   NS_IMETHOD GetOrigin(char** aOrigin);
-  NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
-  NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval NS_OUTPARAM);
+  NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
+  NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
   NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report);
   NS_IMETHOD GetExtendedOrigin(nsACString& aExtendedOrigin);
   NS_IMETHOD GetAppStatus(PRUint16* aAppStatus);
   NS_IMETHOD GetAppId(PRUint32* aAppStatus);
 #ifdef DEBUG
   virtual void dumpImpl();
 #endif
   
--- a/chrome/src/nsChromeRegistry.h
+++ b/chrome/src/nsChromeRegistry.h
@@ -52,19 +52,19 @@ class nsChromeRegistry : public nsIToolk
 {
 public:
   NS_DECL_ISUPPORTS
 
   // nsIXULChromeRegistry methods:
   NS_IMETHOD ReloadChrome();
   NS_IMETHOD RefreshSkins();
   NS_IMETHOD AllowScriptsForPackage(nsIURI* url,
-                                    bool* _retval NS_OUTPARAM);
+                                    bool* _retval);
   NS_IMETHOD AllowContentToAccess(nsIURI* url,
-                                  bool* _retval NS_OUTPARAM);
+                                  bool* _retval);
 
   // nsIChromeRegistry methods:
   NS_IMETHOD_(bool) WrappersEnabled(nsIURI *aURI);
   NS_IMETHOD ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult);
 
   // nsChromeRegistry methods:
   nsChromeRegistry() : mInitialized(false) { }
   virtual ~nsChromeRegistry();
--- a/chrome/src/nsChromeRegistryChrome.h
+++ b/chrome/src/nsChromeRegistryChrome.h
@@ -17,50 +17,50 @@ class PContentParent;
 class nsIPrefBranch;
 
 class nsChromeRegistryChrome : public nsChromeRegistry
 {
  public:
   nsChromeRegistryChrome();
   ~nsChromeRegistryChrome();
 
-  NS_OVERRIDE nsresult Init();
+  nsresult Init() MOZ_OVERRIDE;
 
-  NS_OVERRIDE NS_IMETHOD CheckForNewChrome();
-  NS_OVERRIDE NS_IMETHOD CheckForOSAccessibility();
-  NS_OVERRIDE NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
-                                              nsIUTF8StringEnumerator* *aResult);
-  NS_OVERRIDE NS_IMETHOD IsLocaleRTL(const nsACString& package,
-                                     bool *aResult);
-  NS_OVERRIDE NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,
-                                           nsACString& aLocale);
-  NS_OVERRIDE NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic,
-                                 const PRUnichar *someData);
+  NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE;
+  NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE;
+  NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
+                                  nsIUTF8StringEnumerator* *aResult) MOZ_OVERRIDE;
+  NS_IMETHOD IsLocaleRTL(const nsACString& package,
+                         bool *aResult) MOZ_OVERRIDE;
+  NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,
+                               nsACString& aLocale) MOZ_OVERRIDE;
+  NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic,
+                     const PRUnichar *someData) MOZ_OVERRIDE;
 
 #ifdef MOZ_XUL
-  NS_OVERRIDE NS_IMETHOD GetXULOverlays(nsIURI *aURI,
-                                        nsISimpleEnumerator **_retval);
-  NS_OVERRIDE NS_IMETHOD GetStyleOverlays(nsIURI *aURI,
-                                          nsISimpleEnumerator **_retval);
+  NS_IMETHOD GetXULOverlays(nsIURI *aURI,
+                            nsISimpleEnumerator **_retval) MOZ_OVERRIDE;
+  NS_IMETHOD GetStyleOverlays(nsIURI *aURI,
+                              nsISimpleEnumerator **_retval) MOZ_OVERRIDE;
 #endif
   
   void SendRegisteredChrome(mozilla::dom::PContentParent* aChild);
 
  private:
   static PLDHashOperator CollectPackages(PLDHashTable *table,
                                          PLDHashEntryHdr *entry,
                                          PRUint32 number, void *arg);
 
   nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
-  NS_OVERRIDE nsresult UpdateSelectedLocale();
-  NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
-                                             const nsCString& aProvider,
-                                             const nsCString& aPath);
-  NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage,
-                                           PRUint32* aFlags);
+  nsresult UpdateSelectedLocale() MOZ_OVERRIDE;
+  nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
+                                 const nsCString& aProvider,
+                                 const nsCString& aPath) MOZ_OVERRIDE;
+  nsresult GetFlagsFromPackage(const nsCString& aPackage,
+                               PRUint32* aFlags) MOZ_OVERRIDE;
 
   static const PLDHashTableOps kTableOps;
   static PLDHashNumber HashKey(PLDHashTable *table, const void *key);
   static bool          MatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
                                 const void *key);
   static void          ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry);
   static bool          InitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
                                  const void *key);
--- a/chrome/src/nsChromeRegistryContent.h
+++ b/chrome/src/nsChromeRegistryContent.h
@@ -20,30 +20,30 @@ class nsChromeRegistryContent : public n
  public:
   nsChromeRegistryContent();
   
   void RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
                             const nsTArray<ResourceMapping>& aResources,
                             const nsTArray<OverrideMapping>& aOverrides,
                             const nsACString& aLocale);
 
-  NS_OVERRIDE NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
-                                              nsIUTF8StringEnumerator* *aResult);
-  NS_OVERRIDE NS_IMETHOD CheckForNewChrome();
-  NS_OVERRIDE NS_IMETHOD CheckForOSAccessibility();
-  NS_OVERRIDE NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
-                                 const PRUnichar* aData);
-  NS_OVERRIDE NS_IMETHOD IsLocaleRTL(const nsACString& package,
-                                     bool *aResult);
-  NS_OVERRIDE NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,
-                                           nsACString& aLocale);
-  NS_OVERRIDE NS_IMETHOD GetStyleOverlays(nsIURI *aChromeURL,
-                                          nsISimpleEnumerator **aResult);
-  NS_OVERRIDE NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL,
-                                        nsISimpleEnumerator **aResult);
+  NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
+                                  nsIUTF8StringEnumerator* *aResult) MOZ_OVERRIDE;
+  NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE;
+  NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE;
+  NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
+                     const PRUnichar* aData) MOZ_OVERRIDE;
+  NS_IMETHOD IsLocaleRTL(const nsACString& package,
+                         bool *aResult) MOZ_OVERRIDE;
+  NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,
+                               nsACString& aLocale) MOZ_OVERRIDE;
+  NS_IMETHOD GetStyleOverlays(nsIURI *aChromeURL,
+                              nsISimpleEnumerator **aResult) MOZ_OVERRIDE;
+  NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL,
+                            nsISimpleEnumerator **aResult) MOZ_OVERRIDE;
 
  private:
   struct PackageEntry
   {
     PackageEntry() : flags(0) { }
     ~PackageEntry() { }
 
     nsCOMPtr<nsIURI> contentBaseURI;
@@ -51,21 +51,21 @@ class nsChromeRegistryContent : public n
     nsCOMPtr<nsIURI> skinBaseURI;
     PRUint32         flags;
   };
   
   void RegisterPackage(const ChromePackage& aPackage);
   void RegisterResource(const ResourceMapping& aResource);
   void RegisterOverride(const OverrideMapping& aOverride);
 
-  NS_OVERRIDE nsresult UpdateSelectedLocale();
-  NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
-                                 const nsCString& aProvider,
-                                 const nsCString& aPath);
-  NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage, PRUint32* aFlags);
+  nsresult UpdateSelectedLocale() MOZ_OVERRIDE;
+  nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
+                     const nsCString& aProvider,
+                     const nsCString& aPath) MOZ_OVERRIDE;
+  nsresult GetFlagsFromPackage(const nsCString& aPackage, PRUint32* aFlags) MOZ_OVERRIDE;
 
   nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
   nsCString mLocale;
 
   virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, bool platform,
                                bool contentaccessible);
   virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
--- a/client.mk
+++ b/client.mk
@@ -249,37 +249,37 @@ else
 ####################################
 # Configure
 
 MAKEFILE      = $(wildcard $(OBJDIR)/Makefile)
 CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)
 CONFIG_CACHE  = $(wildcard $(OBJDIR)/config.cache)
 
 EXTRA_CONFIG_DEPS := \
-	$(TOPSRCDIR)/aclocal.m4 \
-	$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
-	$(TOPSRCDIR)/js/src/aclocal.m4 \
-	$(NULL)
+  $(TOPSRCDIR)/aclocal.m4 \
+  $(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
+  $(TOPSRCDIR)/js/src/aclocal.m4 \
+  $(NULL)
 
 $(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
 	@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/build $(TOPSRCDIR)/build
 	@echo Generating $@ using autoconf
 	cd $(@D); $(AUTOCONF)
 
 CONFIG_STATUS_DEPS := \
-	$(wildcard \
-        $(CONFIGURES) \
-        $(TOPSRCDIR)/allmakefiles.sh \
-        $(TOPSRCDIR)/nsprpub/configure \
-        $(TOPSRCDIR)/config/milestone.txt \
-        $(TOPSRCDIR)/js/src/config/milestone.txt \
-        $(TOPSRCDIR)/browser/config/version.txt \
-        $(TOPSRCDIR)/*/confvars.sh \
-	) \
-	$(NULL)
+  $(wildcard $(TOPSRCDIR)/*/confvars.sh) \
+  $(CONFIGURES) \
+  $(TOPSRCDIR)/allmakefiles.sh \
+  $(TOPSRCDIR)/nsprpub/configure \
+  $(TOPSRCDIR)/config/milestone.txt \
+  $(TOPSRCDIR)/js/src/config/milestone.txt \
+  $(TOPSRCDIR)/browser/config/version.txt \
+  $(TOPSRCDIR)/build/virtualenv/packages.txt \
+  $(TOPSRCDIR)/build/virtualenv/populate_virtualenv.py \
+  $(NULL)
 
 CONFIGURE_ENV_ARGS += \
   MAKE="$(MAKE)" \
   $(NULL)
 
 # configure uses the program name to determine @srcdir@. Calling it without
 #   $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
 #   path of $(TOPSRCDIR).
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -232,17 +232,16 @@ MOZ_NATIVE_JPEG	= @MOZ_NATIVE_JPEG@
 MOZ_NATIVE_PNG	= @MOZ_NATIVE_PNG@
 MOZ_TREE_CAIRO = @MOZ_TREE_CAIRO@
 MOZ_TREE_PIXMAN = @MOZ_TREE_PIXMAN@
 
 MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@
 MOZ_PERMISSIONS = @MOZ_PERMISSIONS@
 MOZ_XTF = @MOZ_XTF@
 MOZ_FLEXBOX = @MOZ_FLEXBOX@
-MOZ_SVG_DLISTS = @MOZ_SVG_DLISTS@
 MOZ_CAIRO_CFLAGS = @MOZ_CAIRO_CFLAGS@
 MOZ_PIXMAN_CFLAGS = @MOZ_PIXMAN_CFLAGS@
 
 MOZ_PREF_EXTENSIONS = @MOZ_PREF_EXTENSIONS@
 
 MOZ_CAIRO_LIBS = @MOZ_CAIRO_LIBS@
 MOZ_CAIRO_OSLIBS = @MOZ_CAIRO_OSLIBS@
 MOZ_PIXMAN_LIBS = @MOZ_PIXMAN_LIBS@
--- a/config/config.mk
+++ b/config/config.mk
@@ -679,20 +679,16 @@ endif # WINNT/OS2
 # The default for install_cmd is simply INSTALL
 install_cmd ?= $(INSTALL) $(1)
 
 # Use nsinstall in copy mode to install files on the system
 SYSINSTALL	= $(NSINSTALL) -t
 # This isn't necessarily true, just here
 sysinstall_cmd = install_cmd
 
-# Directory nsinstall.
-DIR_INSTALL = $(INSTALL)
-dir_install_cmd = install_cmd
-
 #
 # Localization build automation
 #
 
 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
 # overridden by the command line. (Besides, AB_CD is prettier).
 AB_CD = $(MOZ_UI_LOCALE)
--- a/config/makefiles/xpcshell.mk
+++ b/config/makefiles/xpcshell.mk
@@ -10,17 +10,17 @@ ifndef INCLUDED_TESTS_XPCSHELL_MK #{
 
 ifdef XPCSHELL_TESTS #{
 
 ifndef relativesrcdir
 $(error Must define relativesrcdir when defining XPCSHELL_TESTS.)
 endif
 
 define _INSTALL_TESTS
-$(DIR_INSTALL) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir)
+$(call install_cmd, $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 endef # do not remove the blank line!
 
 SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
 
 testxpcsrcdir = $(topsrcdir)/testing/xpcshell
 
 libs:: libs-xpcshell-tests
deleted file mode 100644
--- a/config/nsinstall.exe.manifest
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-<assemblyIdentity
-        version="1.0.0.0"
-        processorArchitecture="*"
-        name="nsinstall"
-        type="win32"
-/>
-<description>nsinstall</description>
-<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
-  <ms_asmv3:security>
-    <ms_asmv3:requestedPrivileges>
-      <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
-    </ms_asmv3:requestedPrivileges>
-  </ms_asmv3:security>
-</ms_asmv3:trustInfo>
-  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
-    <application>
-      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
-    </application>
-  </compatibility>
-</assembly>
--- a/configure.in
+++ b/configure.in
@@ -333,38 +333,38 @@ else
     AC_PROG_CXX
     AC_PROG_RANLIB
     MOZ_PATH_PROGS(AS, $AS as, $CC)
     AC_CHECK_PROGS(AR, ar, :)
     AC_CHECK_PROGS(LD, ld, :)
     AC_CHECK_PROGS(STRIP, strip, :)
     AC_CHECK_PROGS(WINDRES, windres, :)
     if test -z "$HOST_CC"; then
-        HOST_CC='$(CC)'
+        HOST_CC="$CC"
     fi
     if test -z "$HOST_CFLAGS"; then
-        HOST_CFLAGS='$(CFLAGS)'
+        HOST_CFLAGS="$CFLAGS"
     fi
     if test -z "$HOST_CXX"; then
-        HOST_CXX='$(CXX)'
+        HOST_CXX="$CXX"
     fi
     if test -z "$HOST_CXXFLAGS"; then
-        HOST_CXXFLAGS='$(CXXFLAGS)'
+        HOST_CXXFLAGS="$CXXFLAGS"
     fi
     if test -z "$HOST_LDFLAGS"; then
-        HOST_LDFLAGS='$(LDFLAGS)'
+        HOST_LDFLAGS="$LDFLAGS"
     fi
     if test -z "$HOST_RANLIB"; then
-        HOST_RANLIB='$(RANLIB)'
+        HOST_RANLIB="$RANLIB"
     fi
     if test -z "$HOST_AR"; then
-        HOST_AR='$(AR)'
+        HOST_AR="$AR"
     fi
     if test -z "$HOST_AR_FLAGS"; then
-        HOST_AR_FLAGS='$(AR_FLAGS)'
+        HOST_AR_FLAGS="$AR_FLAGS"
     fi
 fi
 
 MOZ_TOOL_VARIABLES
 
 dnl ========================================================
 dnl Special win32 checks
 dnl ========================================================
@@ -2766,16 +2766,31 @@ dnl Note that we assume that mac & win32
         else
             WCHAR_CFLAGS="-fshort-wchar"
         fi
     else
         CXXFLAGS=$_SAVE_CXXFLAGS
     fi
 fi
 
+dnl Check for nullptr (bug 626472)
+AC_LANG_CPLUSPLUS
+AC_MSG_CHECKING(for nullptr)
+AC_CACHE_VAL(ac_cv_nullptr,
+ [AC_TRY_COMPILE([],
+                 [int* foo = nullptr;],
+                 [ac_cv_nullptr=true],
+                 [ac_cv_nullptr=false])])
+if test "$ac_cv_nullptr" = true ; then
+  AC_DEFINE(HAVE_NULLPTR)
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_LANG_C
 
 dnl Check for .hidden assembler directive and visibility attribute.
 dnl Borrowed from glibc configure.in
 dnl ===============================================================
 if test "$GNU_CC"; then
   AC_CACHE_CHECK(for visibility(hidden) attribute,
                  ac_cv_visibility_hidden,
@@ -3637,17 +3652,17 @@ dnl __cxa_finalize when the library does
 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
 dnl link crtbegin and crtend at all.
 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
   AC_CACHE_CHECK([whether the CRT objects have text relocations],
     ac_cv_crt_has_text_relocations,
     [echo 'int foo() { return 0; }' > conftest.cpp
      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
         test -s conftest${DLL_SUFFIX}; then
-       if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
+       if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
          ac_cv_crt_has_text_relocations=yes
        else
          ac_cv_crt_has_text_relocations=no
        fi
      else
        AC_ERROR([couldn't compile a simple C file])
      fi
      rm -rf conftest*])
@@ -4165,17 +4180,16 @@ MOZ_PREF_EXTENSIONS=1
 MOZ_PROFILELOCKING=1
 MOZ_PSM=1
 MOZ_REFLOW_PERF=
 MOZ_SAFE_BROWSING=
 MOZ_HELP_VIEWER=
 MOZ_SPELLCHECK=1
 MOZ_JAVA_COMPOSITOR=
 MOZ_ONLY_TOUCH_EVENTS=
-MOZ_SVG_DLISTS=
 MOZ_TOOLKIT_SEARCH=1
 MOZ_UI_LOCALE=en-US
 MOZ_UNIVERSALCHARDET=1
 MOZ_URL_CLASSIFIER=
 MOZ_XTF=1
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 NS_PRINTING=1
@@ -5791,17 +5805,17 @@ if test -n "$MOZ_CRASHREPORTER"; then
 
     MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
   fi
 
   if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
     AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
   fi
 
-  if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
+  if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
     MOZ_CRASHREPORTER_INJECTOR=1
     AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
   fi
 fi
 
 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
 [  --with-crashreporter-enable-percent=NN
                           Enable sending crash reports by default on NN% of users. (default=100)],
@@ -5997,23 +6011,16 @@ fi
 dnl ========================================================
 dnl CSS3 Flexbox Support
 dnl ========================================================
 if test -n "$MOZ_FLEXBOX"; then
   AC_DEFINE(MOZ_FLEXBOX)
 fi
 
 dnl ========================================================
-dnl SVG Display Lists
-dnl ========================================================
-if test -n "$MOZ_SVG_DLISTS"; then
-  AC_DEFINE(MOZ_SVG_DLISTS)
-fi
-
-dnl ========================================================
 dnl Build Freetype in the tree
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(tree-freetype,
 [  --enable-tree-freetype  Enable Tree FreeType],
     MOZ_TREE_FREETYPE=1,
     MOZ_TREE_FREETYPE= )
 if test -n "$MOZ_TREE_FREETYPE"; then
    if test -n "$_WIN32_MSVC"; then
@@ -7203,17 +7210,17 @@ if test "$USE_ELF_HACK" = 1; then
     dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
     dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
     dnl the linker creates PT_GNU_RELRO segments.
     AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
         LINK_WITH_PT_GNU_RELRO,
         [echo "int main() {return 0;}" > conftest.${ac_ext}
          if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
             test -s conftest${ac_exeext}; then
-            if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
+            if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
                 LINK_WITH_PT_GNU_RELRO=yes
             else
                 LINK_WITH_PT_GNU_RELRO=no
             fi
          else
              dnl We really don't expect to get here, but just in case
              AC_ERROR([couldn't compile a simple C file])
          fi
@@ -8775,16 +8782,25 @@ mingw*)
     ;;
 *)
     PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
     ;;
 esac
 
 AC_SUBST(PYTHON)
 
+# Populate the virtualenv
+AC_MSG_RESULT([Populating Python virtualenv])
+MACOSX_DEPLOYMENT_TARGET= LDFLAGS="${HOST_LDFLAGS}" \
+  CC="${HOST_CC}" CXX="${HOST_CXX}" \
+  CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
+  $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
+    $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
+  || exit 1
+
 dnl Load the list of Makefiles to generate.
 dnl   To add new Makefiles, edit allmakefiles.sh.
 dnl   allmakefiles.sh sets the variable, MAKEFILES.
 . ${srcdir}/allmakefiles.sh
 dnl
 dnl Run a perl script to quickly create the makefiles.
 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
 dnl   for the files it cannot handle correctly. This way, config.status
@@ -8848,20 +8864,16 @@ if test -n "$MOZ_WEBRTC"; then
      $GYP_WEBRTC_OPTIONS \
      --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
      ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
    if test "$?" != 0; then
       AC_MSG_ERROR([failed to generate gtest Makefiles])
    fi
 fi
 
-# Populate the virtualenv
-AC_MSG_RESULT([Populating Python virtualenv])
-$MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET=  || exit 1
-
 # Generate a JSON config file for unittest harnesses etc to read
 # build configuration details from in a standardized way.
 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
   $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
   rm ./mozinfo.json.tmp
 else
--- a/content/base/src/nsAttrAndChildArray.cpp
+++ b/content/base/src/nsAttrAndChildArray.cpp
@@ -457,17 +457,17 @@ nsAttrAndChildArray::RemoveAttrAt(PRUint
   aPos -= mapped;
   ATTRS(mImpl)[aPos].mValue.SwapValueWith(aValue);
   ATTRS(mImpl)[aPos].~InternalAttr();
 
   PRUint32 slotCount = AttrSlotCount();
   memmove(&ATTRS(mImpl)[aPos],
           &ATTRS(mImpl)[aPos + 1],
           (slotCount - aPos - 1) * sizeof(InternalAttr));
-  memset(&ATTRS(mImpl)[slotCount - 1], nsnull, sizeof(InternalAttr));
+  memset(&ATTRS(mImpl)[slotCount - 1], 0, sizeof(InternalAttr));
 
   return NS_OK;
 }
 
 const nsAttrName*
 nsAttrAndChildArray::AttrNameAt(PRUint32 aPos) const
 {
   NS_ASSERTION(aPos < AttrCount(),
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -1979,17 +1979,17 @@ nsFrameLoader::TryRemoteBrowser()
 
     if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) {
       nsAutoString manifest;
       mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest);
 
       nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
       if (!appsService) {
         NS_ERROR("Apps Service is not available!");
-        return NS_ERROR_FAILURE;
+        return false;
       }
 
       appsService->GetAppLocalIdByManifestURL(manifest, &appId);
 
       // If the frame is actually an app, we should not mark it as a browser.
       if (appId != nsIScriptSecurityManager::NO_APP_ID) {
         isBrowserElement = false;
       }
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -457,17 +457,17 @@ public:
   static void FireNodeInserted(nsIDocument* aDoc,
                                nsINode* aParent,
                                nsTArray<nsCOMPtr<nsIContent> >& aNodes);
 
   /**
    * Helper methods for implementing querySelector/querySelectorAll
    */
   static nsIContent* doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
-                                     nsresult *aResult NS_OUTPARAM);
+                                     nsresult *aResult);
   static nsresult doQuerySelectorAll(nsINode* aRoot,
                                      const nsAString& aSelector,
                                      nsIDOMNodeList **aReturn);
 
   /**
    * Method to create and dispatch a left-click event loosely based on
    * aSourceEvent. If aFullDispatch is true, the event will be dispatched
    * through the full dispatching of the presshell of the aPresContext; if it's
--- a/content/events/src/Makefile.in
+++ b/content/events/src/Makefile.in
@@ -58,17 +58,16 @@ CPPSRCS		= \
 		nsDOMNotifyAudioAvailableEvent.cpp \
 		nsDOMSimpleGestureEvent.cpp \
 		nsDOMMozTouchEvent.cpp \
 		nsDOMEventTargetHelper.cpp \
 		nsDOMScrollAreaEvent.cpp \
 		nsDOMTransitionEvent.cpp \
 		nsDOMAnimationEvent.cpp \
 		nsDOMSettingsEvent.cpp \
-		nsDOMContactChangeEvent.cpp \
 		nsDOMTouchEvent.cpp \
 		nsDOMCompositionEvent.cpp \
 		nsDOMApplicationEvent.cpp \
 		$(NULL)
 
 ifdef MOZ_B2G_RIL
 CPPSRCS += \
     nsDOMWifiEvent.cpp \
@@ -84,17 +83,16 @@ include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES	+= \
              -I$(srcdir)/../../base/src \
              -I$(srcdir)/../../html/content/src \
              -I$(srcdir)/../../xul/content/src \
              -I$(srcdir)/../../xml/content/src \
              -I$(srcdir)/../../../dom/base \
              -I$(srcdir)/../../../dom/settings \
-             -I$(srcdir)/../../../dom/contacts \
              -I$(srcdir)/../../../dom/src/storage \
              -I$(srcdir)/../../../layout/generic \
              -I$(srcdir)/../../../layout/xul/base/src \
              -I$(srcdir)/../../../layout/xul/base/src/tree/src \
              $(NULL)
 
 ifdef MOZ_B2G_RIL
 LOCAL_INCLUDES += \
deleted file mode 100644
--- a/content/events/src/nsDOMContactChangeEvent.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "nsDOMContactChangeEvent.h"
-#include "nsContentUtils.h"
-#include "DictionaryHelpers.h"
-#include "nsDOMClassInfoID.h"
-
-DOMCI_DATA(MozContactChangeEvent, nsDOMMozContactChangeEvent)
-
-NS_INTERFACE_MAP_BEGIN(nsDOMMozContactChangeEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMozContactChangeEvent)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozContactChangeEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
-
-NS_IMPL_ADDREF_INHERITED(nsDOMMozContactChangeEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMMozContactChangeEvent, nsDOMEvent)
-
-NS_IMETHODIMP
-nsDOMMozContactChangeEvent::GetContactID(nsAString& aContactID)
-{
-  aContactID = mContactID;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMMozContactChangeEvent::GetReason(nsAString& aReason)
-{
-  aReason = mReason;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMMozContactChangeEvent::InitMozContactChangeEvent(const nsAString& aType,
-                                                      bool aCanBubble,
-                                                      bool aCancelable,
-                                                      const nsAString& aContactID,
-                                                      const nsAString& aReason)
-{
-  nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mContactID = aContactID;
-  mReason = aReason;
-
-  return NS_OK;
-}
-
-nsresult
-nsDOMMozContactChangeEvent::InitFromCtor(const nsAString& aType,
-                                         JSContext* aCx, jsval* aVal)
-{
-  mozilla::dom::MozContactChangeEventInit d;
-  nsresult rv = d.Init(aCx, aVal);
-  NS_ENSURE_SUCCESS(rv, rv);
-  return InitMozContactChangeEvent(aType, d.bubbles, d.cancelable, d.contactID, d.reason);
-}
-
-nsresult
-NS_NewDOMMozContactChangeEvent(nsIDOMEvent** aInstancePtrResult,
-                               nsPresContext* aPresContext,
-                               nsEvent* aEvent) 
-{
-  nsDOMMozContactChangeEvent* e = new nsDOMMozContactChangeEvent(aPresContext, aEvent);
-  return CallQueryInterface(e, aInstancePtrResult);
-}
deleted file mode 100644
--- a/content/events/src/nsDOMContactChangeEvent.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef nsDOMContactChangeEvent_h__
-#define nsDOMContactChangeEvent_h__
-
-#include "nsIDOMContactManager.h"
-#include "nsDOMEvent.h"
-
-class nsDOMMozContactChangeEvent : public nsDOMEvent,
-                                   public nsIDOMMozContactChangeEvent
-{
-public:
-  nsDOMMozContactChangeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
-    : nsDOMEvent(aPresContext, aEvent) {}
-                     
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMMozContactChangeEvent, nsDOMEvent)
-  // Forward to base class
-  NS_FORWARD_TO_NSDOMEVENT
-
-  NS_DECL_NSIDOMMOZCONTACTCHANGEEVENT
-
-  virtual nsresult InitFromCtor(const nsAString& aType,
-                                JSContext* aCx, jsval* aVal);
-private:
-  nsString mContactID;
-  nsString mReason;
-};
-
-#endif // nsDOMContactChangeEvent_h__
--- a/content/events/src/nsDOMEventTargetHelper.h
+++ b/content/events/src/nsDOMEventTargetHelper.h
@@ -195,29 +195,29 @@ private:
   }
 
 /* Use this macro to declare functions that forward the behavior of this
  * interface to another object.
  * This macro doesn't forward PreHandleEvent because sometimes subclasses
  * want to override it.
  */
 #define NS_FORWARD_NSIDOMEVENTTARGET_NOPREHANDLEEVENT(_to) \
-  NS_SCRIPTABLE NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture, bool wantsUntrusted, PRUint8 _argc) { \
+  NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture, bool wantsUntrusted, PRUint8 _argc) { \
     return _to AddEventListener(type, listener, useCapture, wantsUntrusted, _argc); \
   } \
   NS_IMETHOD AddSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture, bool aWantsUntrusted, PRUint8 _argc) { \
     return _to AddSystemEventListener(type, listener, aUseCapture, aWantsUntrusted, _argc); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture) { \
+  NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture) { \
     return _to RemoveEventListener(type, listener, useCapture); \
   } \
   NS_IMETHOD RemoveSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture) { \
     return _to RemoveSystemEventListener(type, listener, aUseCapture); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval NS_OUTPARAM) { \
+  NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval) { \
     return _to DispatchEvent(evt, _retval); \
   } \
   virtual nsIDOMEventTarget * GetTargetForDOMEvent(void) { \
     return _to GetTargetForDOMEvent(); \
   } \
   virtual nsIDOMEventTarget * GetTargetForEventTargetChain(void) { \
     return _to GetTargetForEventTargetChain(); \
   } \
@@ -228,16 +228,16 @@ private:
     return _to PostHandleEvent(aVisitor); \
   } \
   virtual nsresult DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEvent, nsPresContext *aPresContext, nsEventStatus *aEventStatus) { \
     return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); \
   } \
   virtual nsEventListenerManager * GetListenerManager(bool aMayCreate) { \
     return _to GetListenerManager(aMayCreate); \
   } \
-  virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv NS_OUTPARAM) { \
+  virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv) { \
     return _to GetContextForEventHandlers(aRv); \
   } \
   virtual JSContext * GetJSContextForEventHandlers(void) { \
     return _to GetJSContextForEventHandlers(); \
   } 
 
 #endif // nsDOMEventTargetHelper_h_
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -597,17 +597,17 @@ nsEventListenerManager::AddScriptEventLi
         // build a "script sample" based on what we know about this element
         scriptSample.Assign(attr);
         scriptSample.AppendLiteral(" attribute on ");
         scriptSample.Append(tagName);
         scriptSample.AppendLiteral(" element");
         csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_SCRIPT,
                                  NS_ConvertUTF8toUTF16(asciiSpec),
                                  scriptSample,
-                                 nsnull);
+                                 0);
         return NS_OK;
       }
     }
   }
 
   // This might be the first reference to this language in the global
   // We must init the language before we attempt to fetch its context.
   if (NS_FAILED(global->EnsureScriptEnvironment())) {
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -4489,22 +4489,18 @@ nsEventStateManager::CheckForAndDispatch
   nsresult ret = NS_OK;
   PRInt32 flags = NS_EVENT_FLAG_NONE;
 
   //If mouse is still over same element, clickcount will be > 1.
   //If it has moved it will be zero, so no click.
   if (0 != aEvent->clickCount) {
     //Check that the window isn't disabled before firing a click
     //(see bug 366544).
-    if (aEvent->widget) {
-      bool enabled;
-      aEvent->widget->IsEnabled(&enabled);
-      if (!enabled) {
-        return ret;
-      }
+    if (aEvent->widget && !aEvent->widget->IsEnabled()) {
+      return ret;
     }
     //fire click
     if (aEvent->button == nsMouseEvent::eMiddleButton ||
         aEvent->button == nsMouseEvent::eRightButton) {
       flags |=
         sLeftClickOnly ? NS_EVENT_FLAG_NO_CONTENT_DISPATCH : NS_EVENT_FLAG_NONE;
     }
 
--- a/content/events/test/test_bug448602.html
+++ b/content/events/test/test_bug448602.html
@@ -35,17 +35,17 @@ function runTests() {
   var root = document.getElementById("testroot");
   var infos = els.getListenerInfoFor(root, {});
   is(infos.length, 0, "Element shouldn't have listeners (1)");
 
   var listenerSource = 'alert(event);';
   root.setAttribute("onclick", listenerSource);
   infos = els.getListenerInfoFor(root, {});
   is(infos.length, 1, "Element should have listeners (1)");
-  is(infos[0].toSource(), 'function onclick(event) { ' + listenerSource + ' }',
+  is(infos[0].toSource(), 'function onclick(event) {\n' + listenerSource + '\n}',
      "Unexpected serialization (1)");
   is(infos[0].type, "click", "Wrong type (1)");
   is(infos[0].capturing, false, "Wrong phase (1)");
   is(infos[0].allowsUntrusted, true, "Should allow untrusted events (1)");
 
 /*
   var jsdOn = jsd.isOn;
   if (!jsdOn) {
--- a/content/events/test/test_bug659350.html
+++ b/content/events/test/test_bug659350.html
@@ -40,20 +40,20 @@ testIn("onopen", div, "div", false);
 function f() {}
 function g() {}
 
 // Basic sanity of interaction between the IDL and content attributes
 div.onload = f;
 is(div.onload, f, "Should have 'f' as div's onload");
 div.setAttribute("onload", "");
 isnot(div.onload, f, "Should not longer have 'f' as div's onload");
-is(div.onload.toString(), "function onload(event) {  }",
+is(div.onload.toString(), "function onload(event) {\n\n}",
    "Should have wrapped empty string in a function");
 div.setAttribute("onload", "foopy();");
-is(div.onload.toString(), "function onload(event) { foopy(); }",
+is(div.onload.toString(), "function onload(event) {\nfoopy();\n}",
    "Should have wrapped call in a function");
 div.removeAttribute("onload");
 is(div.onload, null, "Should have null onload now");
 
 // Test forwarding to window for both events that are window-specific and that
 // exist on all elements
 function testPropagationToWindow(eventName) {
   is(window["on"+eventName], null, "Shouldn't have " + eventName + " stuff yet");
@@ -64,21 +64,21 @@ function testPropagationToWindow(eventNa
   is(window["on"+eventName], g,
      "Setting on"+eventName+" on body not in document should propagate to window");
   document.createElement("frameset")["on"+eventName] = f;
   is(window["on"+eventName], f,
      "Setting on"+eventName+" on frameset not in document should propagate to window");
 
   document.body.setAttribute("on"+eventName, eventName);
   is(window["on"+eventName].toString(),
-            "function on"+eventName+"(event) { "+eventName+" }",
+            "function on"+eventName+"(event) {\n"+eventName+"\n}",
             "Setting on"+eventName+"attribute on body should propagate to window");
   document.createElement("body").setAttribute("on"+eventName, eventName+"2");
   is(window["on"+eventName].toString(),
-            "function on"+eventName+"(event) { "+eventName+"2 }",
+            "function on"+eventName+"(event) {\n"+eventName+"2\n}",
             "Setting on"+eventName+"attribute on body outside the document should propagate to window");
 }
 
 testPropagationToWindow("popstate");
 testPropagationToWindow("scroll");
 
 // Test |this| and scoping
 var called;
--- a/content/events/test/test_bug689564.html
+++ b/content/events/test/test_bug689564.html
@@ -16,50 +16,50 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 689564 **/
 var div = document.createElement("div");
 div.setAttribute("onclick", "div");
 is(window.onclick, null, "div should not forward onclick");
-is(div.onclick.toString(), "function onclick(event) { div }",
+is(div.onclick.toString(), "function onclick(event) {\ndiv\n}",
    "div should have an onclick handler");
 
 div.setAttribute("onscroll", "div");
 is(window.onscroll, null, "div should not forward onscroll");
-is(div.onscroll.toString(), "function onscroll(event) { div }",
+is(div.onscroll.toString(), "function onscroll(event) {\ndiv\n}",
    "div should have an onscroll handler");
 
 div.setAttribute("onpopstate", "div");
 is(window.onpopstate, null, "div should not forward onpopstate");
 is(div.onpopstate, null, "div should not have onpopstate handler");
 
 var body = document.createElement("body");
 body.setAttribute("onclick", "body");
 is(window.onclick, null, "body should not forward onclick");
-is(body.onclick.toString(), "function onclick(event) { body }",
+is(body.onclick.toString(), "function onclick(event) {\nbody\n}",
    "body should have an onclick handler");
 body.setAttribute("onscroll", "body");
-is(window.onscroll.toString(), "function onscroll(event) { body }",
+is(window.onscroll.toString(), "function onscroll(event) {\nbody\n}",
    "body should forward onscroll");
 body.setAttribute("onpopstate", "body");
-is(window.onpopstate.toString(), "function onpopstate(event) { body }",
+is(window.onpopstate.toString(), "function onpopstate(event) {\nbody\n}",
    "body should forward onpopstate");
 
 var frameset = document.createElement("frameset");
 frameset.setAttribute("onclick", "frameset");
 is(window.onclick, null, "frameset should not forward onclick");
-is(frameset.onclick.toString(), "function onclick(event) { frameset }",
+is(frameset.onclick.toString(), "function onclick(event) {\nframeset\n}",
    "frameset should have an onclick handler");
 frameset.setAttribute("onscroll", "frameset");
-is(window.onscroll.toString(), "function onscroll(event) { frameset }",
+is(window.onscroll.toString(), "function onscroll(event) {\nframeset\n}",
    "frameset should forward onscroll");
 frameset.setAttribute("onpopstate", "frameset");
-is(window.onpopstate.toString(), "function onpopstate(event) { frameset }",
+is(window.onpopstate.toString(), "function onpopstate(event) {\nframeset\n}",
    "frameset should forward onpopstate");
 
 
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/html/content/src/nsDOMStringMap.cpp
+++ b/content/html/content/src/nsDOMStringMap.cpp
@@ -84,17 +84,17 @@ NS_IMETHODIMP_(bool) nsDOMStringMap::Has
     return false;
   }
 
   return mElement->HasAttr(kNameSpaceID_None, attrAtom);
 }
 
 /* [noscript] DOMString getDataAttr (in DOMString prop); */
 NS_IMETHODIMP nsDOMStringMap::GetDataAttr(const nsAString& aProp,
-                                          nsAString& aResult NS_OUTPARAM)
+                                          nsAString& aResult)
 {
   nsAutoString attr;
 
   if (!DataPropToAttr(aProp, attr)) {
     aResult.SetIsVoid(true);
     return NS_OK;
   }
 
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -1332,152 +1332,152 @@ PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_B
  * - SetTabIndex
  * - Focus
  * - GetDraggable
  * - GetInnerHTML
  * - SetInnerHTML
  * because sometimes elements want to override them.
  */
 #define NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(_to) \
-  NS_SCRIPTABLE NS_IMETHOD GetId(nsAString& aId) { \
+  NS_IMETHOD GetId(nsAString& aId) { \
     return _to GetId(aId); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetId(const nsAString& aId) { \
+  NS_IMETHOD SetId(const nsAString& aId) { \
     return _to SetId(aId); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetTitle(nsAString& aTitle) { \
+  NS_IMETHOD GetTitle(nsAString& aTitle) { \
     return _to GetTitle(aTitle); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetTitle(const nsAString& aTitle) { \
+  NS_IMETHOD SetTitle(const nsAString& aTitle) { \
     return _to SetTitle(aTitle); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetLang(nsAString& aLang) { \
+  NS_IMETHOD GetLang(nsAString& aLang) { \
     return _to GetLang(aLang); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetLang(const nsAString& aLang) { \
+  NS_IMETHOD SetLang(const nsAString& aLang) { \
     return _to SetLang(aLang); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetDir(nsAString& aDir) { \
+  NS_IMETHOD GetDir(nsAString& aDir) { \
     return _to GetDir(aDir); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetDir(const nsAString& aDir) { \
+  NS_IMETHOD SetDir(const nsAString& aDir) { \
     return _to SetDir(aDir); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetClassName(nsAString& aClassName) { \
+  NS_IMETHOD GetClassName(nsAString& aClassName) { \
     return _to GetClassName(aClassName); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetClassName(const nsAString& aClassName) { \
+  NS_IMETHOD SetClassName(const nsAString& aClassName) { \
     return _to SetClassName(aClassName); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetDataset(nsIDOMDOMStringMap** aDataset) { \
+  NS_IMETHOD GetDataset(nsIDOMDOMStringMap** aDataset) { \
     return _to GetDataset(aDataset); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetHidden(bool* aHidden) { \
+  NS_IMETHOD GetHidden(bool* aHidden) { \
     return _to GetHidden(aHidden); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetHidden(bool aHidden) { \
+  NS_IMETHOD SetHidden(bool aHidden) { \
     return _to SetHidden(aHidden); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD Blur() { \
+  NS_IMETHOD Blur() { \
     return _to Blur(); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemScope(bool* aItemScope) { \
+  NS_IMETHOD GetItemScope(bool* aItemScope) { \
     return _to GetItemScope(aItemScope); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemScope(bool aItemScope) { \
+  NS_IMETHOD SetItemScope(bool aItemScope) { \
     return _to SetItemScope(aItemScope); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemType(nsIVariant** aType) { \
+  NS_IMETHOD GetItemType(nsIVariant** aType) { \
     return _to GetItemType(aType); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemType(nsIVariant* aType) { \
+  NS_IMETHOD SetItemType(nsIVariant* aType) { \
     return _to SetItemType(aType); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemId(nsAString& aId) { \
+  NS_IMETHOD GetItemId(nsAString& aId) { \
     return _to GetItemId(aId); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemId(const nsAString& aId) { \
+  NS_IMETHOD SetItemId(const nsAString& aId) { \
     return _to SetItemId(aId); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetProperties(nsIDOMHTMLPropertiesCollection** aReturn) { \
+  NS_IMETHOD GetProperties(nsIDOMHTMLPropertiesCollection** aReturn) { \
     return _to GetProperties(aReturn); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemValue(nsIVariant** aValue) { \
+  NS_IMETHOD GetItemValue(nsIVariant** aValue) { \
     return _to GetItemValue(aValue); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemValue(nsIVariant* aValue) { \
+  NS_IMETHOD SetItemValue(nsIVariant* aValue) { \
     return _to SetItemValue(aValue); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemRef(nsIVariant** aRef) { \
+  NS_IMETHOD GetItemRef(nsIVariant** aRef) { \
     return _to GetItemRef(aRef); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemRef(nsIVariant* aRef) { \
+  NS_IMETHOD SetItemRef(nsIVariant* aRef) { \
     return _to SetItemRef(aRef); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetItemProp(nsIVariant** aProp) { \
+  NS_IMETHOD GetItemProp(nsIVariant** aProp) { \
     return _to GetItemProp(aProp); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetItemProp(nsIVariant* aProp) { \
+  NS_IMETHOD SetItemProp(nsIVariant* aProp) { \
     return _to SetItemProp(aProp); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetAccessKey(nsAString& aAccessKey) { \
+  NS_IMETHOD GetAccessKey(nsAString& aAccessKey) { \
     return _to GetAccessKey(aAccessKey); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) { \
+  NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) { \
     return _to SetAccessKey(aAccessKey); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) { \
+  NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) { \
     return _to GetAccessKeyLabel(aAccessKeyLabel); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetDraggable(bool aDraggable) { \
+  NS_IMETHOD SetDraggable(bool aDraggable) { \
     return _to SetDraggable(aDraggable); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetContentEditable(nsAString& aContentEditable) { \
+  NS_IMETHOD GetContentEditable(nsAString& aContentEditable) { \
     return _to GetContentEditable(aContentEditable); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) { \
+  NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) { \
     return _to SetContentEditable(aContentEditable); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) { \
+  NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) { \
     return _to GetIsContentEditable(aIsContentEditable); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) { \
+  NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) { \
     return _to GetContextMenu(aContextMenu); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetSpellcheck(bool* aSpellcheck) { \
+  NS_IMETHOD GetSpellcheck(bool* aSpellcheck) { \
     return _to GetSpellcheck(aSpellcheck); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetSpellcheck(bool aSpellcheck) { \
+  NS_IMETHOD SetSpellcheck(bool aSpellcheck) { \
     return _to SetSpellcheck(aSpellcheck); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) { \
+  NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) { \
     return _to GetOuterHTML(aOuterHTML); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) { \
+  NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) { \
     return _to SetOuterHTML(aOuterHTML); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD InsertAdjacentHTML(const nsAString& position, const nsAString& text) { \
+  NS_IMETHOD InsertAdjacentHTML(const nsAString& position, const nsAString& text) { \
     return _to InsertAdjacentHTML(position, text); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD ScrollIntoView(bool top, PRUint8 _argc) { \
+  NS_IMETHOD ScrollIntoView(bool top, PRUint8 _argc) { \
     return _to ScrollIntoView(top, _argc); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \
+  NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \
     return _to GetOffsetParent(aOffsetParent); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOffsetTop(PRInt32* aOffsetTop) { \
+  NS_IMETHOD GetOffsetTop(PRInt32* aOffsetTop) { \
     return _to GetOffsetTop(aOffsetTop); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOffsetLeft(PRInt32* aOffsetLeft) { \
+  NS_IMETHOD GetOffsetLeft(PRInt32* aOffsetLeft) { \
     return _to GetOffsetLeft(aOffsetLeft); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOffsetWidth(PRInt32* aOffsetWidth) { \
+  NS_IMETHOD GetOffsetWidth(PRInt32* aOffsetWidth) { \
     return _to GetOffsetWidth(aOffsetWidth); \
   } \
-  NS_SCRIPTABLE NS_IMETHOD GetOffsetHeight(PRInt32* aOffsetHeight) { \
+  NS_IMETHOD GetOffsetHeight(PRInt32* aOffsetHeight) { \
     return _to GetOffsetHeight(aOffsetHeight); \
   }
 
 /**
  * A macro to declare the NS_NewHTMLXXXElement() functions.
  */
 #define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName)                       \
 nsGenericHTMLElement*                                                      \
--- a/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/content/html/content/src/nsHTMLAnchorElement.cpp
@@ -37,29 +37,29 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable);
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetDraggable(bool* aDraggable);
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLAnchorElement
   NS_DECL_NSIDOMHTMLANCHORELEMENT  
 
   // DOM memory reporter participant
   NS_DECL_SIZEOF_EXCLUDING_THIS
--- a/content/html/content/src/nsHTMLAreaElement.cpp
+++ b/content/html/content/src/nsHTMLAreaElement.cpp
@@ -31,31 +31,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLAreaElement
   NS_DECL_NSIDOMHTMLAREAELEMENT
 
   // nsILink
   NS_IMETHOD LinkAdded() { return NS_OK; }
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -64,31 +64,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLFormElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLFormElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLButtonElement
   NS_DECL_NSIDOMHTMLBUTTONELEMENT
 
   // overriden nsIFormControl methods
   NS_IMETHOD_(PRUint32) GetType() const { return mType; }
--- a/content/html/content/src/nsHTMLElement.cpp
+++ b/content/html/content/src/nsHTMLElement.cpp
@@ -23,33 +23,33 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -986,17 +986,17 @@ nsHTMLFormElement::WalkFormElements(nsFo
   return NS_OK;
 }
 
 // nsIForm
 
 NS_IMETHODIMP_(PRUint32)
 nsHTMLFormElement::GetElementCount() const 
 {
-  PRUint32 count = nsnull;
+  PRUint32 count = 0;
   mControls->GetLength(&count); 
   return count;
 }
 
 NS_IMETHODIMP_(nsIFormControl*)
 nsHTMLFormElement::GetElementAt(PRInt32 aIndex) const
 {
   return mControls->mElements.SafeElementAt(aIndex, nsnull);
@@ -1847,18 +1847,18 @@ nsHTMLFormElement::OnSecurityChange(nsIW
 {
   NS_NOTREACHED("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
  
 NS_IMETHODIMP_(PRInt32)
 nsHTMLFormElement::IndexOfControl(nsIFormControl* aControl)
 {
-  PRInt32 index = nsnull;
-  return mControls->IndexOfControl(aControl, &index) == NS_OK ? index : nsnull;
+  PRInt32 index = 0;
+  return mControls->IndexOfControl(aControl, &index) == NS_OK ? index : 0;
 }
 
 NS_IMETHODIMP
 nsHTMLFormElement::SetCurrentRadioButton(const nsAString& aName,
                                          nsIDOMHTMLInputElement* aRadio)
 {
   mSelectedRadioButtons.Put(aName, aRadio);
 
--- a/content/html/content/src/nsHTMLImageElement.h
+++ b/content/html/content/src/nsHTMLImageElement.h
@@ -26,33 +26,33 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable);
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetDraggable(bool* aDraggable);
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLImageElement
   NS_DECL_NSIDOMHTMLIMAGEELEMENT
 
   // override from nsImageLoadingContent
   mozilla::CORSMode GetCORSMode();
--- a/content/html/content/src/nsHTMLInputElement.h
+++ b/content/html/content/src/nsHTMLInputElement.h
@@ -70,27 +70,27 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click();
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus();
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD Click();
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus();
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLInputElement
   NS_DECL_NSIDOMHTMLINPUTELEMENT
 
   // nsIPhonetic
   NS_DECL_NSIPHONETIC
--- a/content/html/content/src/nsHTMLLabelElement.h
+++ b/content/html/content/src/nsHTMLLabelElement.h
@@ -37,33 +37,33 @@ public:
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLLabelElement
   NS_DECL_NSIDOMHTMLLABELELEMENT
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLFormElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLFormElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLFormElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus();
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD Focus();
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIFormControl
   NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_LABEL; }
   NS_IMETHOD Reset();
   NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
 
--- a/content/html/content/src/nsHTMLLegendElement.h
+++ b/content/html/content/src/nsHTMLLegendElement.h
@@ -32,33 +32,33 @@ public:
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLLegendElement
   NS_DECL_NSIDOMHTMLLEGENDELEMENT
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus();
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD Focus();
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   virtual void PerformAccesskey(bool aKeyCausesActivation,
                                 bool aIsTrustedEvent);
 
   // nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
--- a/content/html/content/src/nsHTMLObjectElement.cpp
+++ b/content/html/content/src/nsHTMLObjectElement.cpp
@@ -44,31 +44,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLFormElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLFormElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLObjectElement
   NS_DECL_NSIDOMHTMLOBJECTELEMENT
 
   // nsIDOMGetSVGDocument
   NS_DECL_NSIDOMGETSVGDOCUMENT
--- a/content/html/content/src/nsHTMLScriptElement.cpp
+++ b/content/html/content/src/nsHTMLScriptElement.cpp
@@ -45,33 +45,33 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
 
   // nsIDOMHTMLScriptElement
   NS_DECL_NSIDOMHTMLSCRIPTELEMENT
 
   // nsIScriptElement
   virtual void GetScriptType(nsAString& type);
   virtual void GetScriptText(nsAString& text);
   virtual void GetScriptCharset(nsAString& charset);
--- a/content/html/content/src/nsHTMLSelectElement.h
+++ b/content/html/content/src/nsHTMLSelectElement.h
@@ -228,31 +228,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLFormElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLFormElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLSelectElement
   NS_DECL_NSIDOMHTMLSELECTELEMENT
 
   // nsIContent
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
@@ -303,17 +303,17 @@ public:
 
   /**
    * Checks whether an option is disabled (even if it's part of an optgroup)
    *
    * @param aIndex the index of the option to check
    * @return whether the option is disabled
    */
   NS_IMETHOD IsOptionDisabled(PRInt32 aIndex,
-                              bool *aIsDisabled NS_OUTPARAM);
+                              bool *aIsDisabled);
 
   /**
    * Sets multiple options (or just sets startIndex if select is single)
    * and handles notifications and cleanup and everything under the sun.
    * When this method exits, the select will be in a consistent state.  i.e.
    * if you set the last option to false, it will select an option anyway.
    *
    * @param aStartIndex the first index to set
@@ -328,30 +328,30 @@ public:
    * @return whether any options were actually changed
    */
   NS_IMETHOD SetOptionsSelectedByIndex(PRInt32 aStartIndex,
                                        PRInt32 aEndIndex,
                                        bool aIsSelected,
                                        bool aClearAll,
                                        bool aSetDisabled,
                                        bool aNotify,
-                                       bool* aChangedSomething NS_OUTPARAM);
+                                       bool* aChangedSomething);
 
   /**
    * Finds the index of a given option element
    *
    * @param aOption the option to get the index of
    * @param aStartIndex the index to start looking at
    * @param aForward TRUE to look forward, FALSE to look backward
    * @return the option index
    */
   NS_IMETHOD GetOptionIndex(nsIDOMHTMLOptionElement* aOption,
                             PRInt32 aStartIndex,
                             bool aForward,
-                            PRInt32* aIndex NS_OUTPARAM);
+                            PRInt32* aIndex);
 
   /**
    * Called when an attribute is about to be changed
    */
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                                nsIContent* aBindingParent,
                                bool aCompileEventHandlers);
   virtual void UnbindFromTree(bool aDeep, bool aNullParent);
--- a/content/html/content/src/nsHTMLSharedObjectElement.cpp
+++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp
@@ -40,31 +40,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLAppletElement
   NS_DECL_NSIDOMHTMLAPPLETELEMENT
 
   // Can't use macro for nsIDOMHTMLEmbedElement because it has conflicts with
   // NS_DECL_NSIDOMHTMLAPPLETELEMENT.
--- a/content/html/content/src/nsHTMLStyleElement.cpp
+++ b/content/html/content/src/nsHTMLStyleElement.cpp
@@ -32,33 +32,33 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex) {
     return nsGenericHTMLElement::GetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex) {
     return nsGenericHTMLElement::SetTabIndex(aTabIndex);
   }
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD Focus() {
     return nsGenericHTMLElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML);
 
   // nsIDOMHTMLStyleElement
   NS_DECL_NSIDOMHTMLSTYLEELEMENT
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers);
   virtual void UnbindFromTree(bool aDeep = true,
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -73,31 +73,31 @@ public:
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
-  NS_SCRIPTABLE NS_IMETHOD Click() {
+  NS_IMETHOD Click() {
     return nsGenericHTMLFormElement::Click();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
-  NS_SCRIPTABLE NS_IMETHOD Focus() {
+  NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
+  NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
+  NS_IMETHOD Focus() {
     return nsGenericHTMLFormElement::Focus();
   }
-  NS_SCRIPTABLE NS_IMETHOD GetDraggable(bool* aDraggable) {
+  NS_IMETHOD GetDraggable(bool* aDraggable) {
     return nsGenericHTMLFormElement::GetDraggable(aDraggable);
   }
-  NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
+  NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
   }
-  NS_SCRIPTABLE NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
+  NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
     return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
   }
 
   // nsIDOMHTMLTextAreaElement
   NS_DECL_NSIDOMHTMLTEXTAREAELEMENT
 
   // nsIDOMNSEditableElement
   NS_IMETHOD GetEditor(nsIEditor** aEditor)
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -729,19 +729,19 @@ GetChecksum(ogg_page* page)
                (p[3] << 24);
   return c;
 }
 
 PRInt64 nsOggReader::RangeStartTime(PRInt64 aOffset)
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
   MediaResource* resource = mDecoder->GetResource();
-  NS_ENSURE_TRUE(resource != nsnull, nsnull);
+  NS_ENSURE_TRUE(resource != nsnull, 0);
   nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
-  NS_ENSURE_SUCCESS(res, nsnull);
+  NS_ENSURE_SUCCESS(res, 0);
   PRInt64 startTime = 0;
   nsBuiltinDecoderReader::FindStartTime(startTime);
   return startTime;
 }
 
 struct nsAutoOggSyncState {
   nsAutoOggSyncState() {
     ogg_sync_init(&mState);
--- a/content/smil/nsSMILCSSValueType.h
+++ b/content/smil/nsSMILCSSValueType.h
@@ -5,17 +5,17 @@
 
 /* representation of a value for a SMIL-animated CSS property */
 
 #ifndef NS_SMILCSSVALUETYPE_H_
 #define NS_SMILCSSVALUETYPE_H_
 
 #include "nsISMILType.h"
 #include "nsCSSProperty.h"
-#include "nscore.h" // For NS_OVERRIDE
+#include "mozilla/Attributes.h"
 
 class nsAString;
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
@@ -29,32 +29,32 @@ public:
   typedef mozilla::dom::Element Element;
 
   // Singleton for nsSMILValue objects to hold onto.
   static nsSMILCSSValueType sSingleton;
 
 protected:
   // nsISMILType Methods
   // -------------------
-  NS_OVERRIDE virtual void     Init(nsSMILValue& aValue) const;
-  NS_OVERRIDE virtual void     Destroy(nsSMILValue&) const;
-  NS_OVERRIDE virtual nsresult Assign(nsSMILValue& aDest,
-                                      const nsSMILValue& aSrc) const;
-  NS_OVERRIDE virtual bool     IsEqual(const nsSMILValue& aLeft,
-                                       const nsSMILValue& aRight) const;
-  NS_OVERRIDE virtual nsresult Add(nsSMILValue& aDest,
-                                   const nsSMILValue& aValueToAdd,
-                                   PRUint32 aCount) const;
-  NS_OVERRIDE virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
-                                               const nsSMILValue& aTo,
-                                               double& aDistance) const;
-  NS_OVERRIDE virtual nsresult Interpolate(const nsSMILValue& aStartVal,
-                                           const nsSMILValue& aEndVal,
-                                           double aUnitDistance,
-                                           nsSMILValue& aResult) const;
+  virtual void     Init(nsSMILValue& aValue) const MOZ_OVERRIDE;
+  virtual void     Destroy(nsSMILValue&) const MOZ_OVERRIDE;
+  virtual nsresult Assign(nsSMILValue& aDest,
+                          const nsSMILValue& aSrc) const MOZ_OVERRIDE;
+  virtual bool     IsEqual(const nsSMILValue& aLeft,
+                           const nsSMILValue& aRight) const MOZ_OVERRIDE;
+  virtual nsresult Add(nsSMILValue& aDest,
+                       const nsSMILValue& aValueToAdd,
+                       PRUint32 aCount) const MOZ_OVERRIDE;
+  virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
+                                   const nsSMILValue& aTo,
+                                   double& aDistance) const MOZ_OVERRIDE;
+  virtual nsresult Interpolate(const nsSMILValue& aStartVal,
+                               const nsSMILValue& aEndVal,
+                               double aUnitDistance,
+                               nsSMILValue& aResult) const MOZ_OVERRIDE;
 
 public:
   // Helper Methods
   // --------------
   /**
    * Sets up the given nsSMILValue to represent the given string value.  The
    * string is interpreted as a value for the given property on the given
    * element.
--- a/content/smil/nsSMILSetAnimationFunction.h
+++ b/content/smil/nsSMILSetAnimationFunction.h
@@ -34,33 +34,33 @@ public:
                          nsAttrValue& aResult, nsresult* aParseResult = nsnull);
 
   /*
    * Unsets the given attribute.
    *
    * @returns true if aAttribute is a recognized animation-related
    *          attribute; false otherwise.
    */
-  NS_OVERRIDE virtual bool UnsetAttr(nsIAtom* aAttribute);
+  virtual bool UnsetAttr(nsIAtom* aAttribute) MOZ_OVERRIDE;
 
 protected:
   // Although <set> animation might look like to-animation, unlike to-animation,
   // it never interpolates values.
   // Returning false here will mean this animation function gets treated as
   // a single-valued function and no interpolation will be attempted.
-  NS_OVERRIDE virtual bool IsToAnimation() const {
+  virtual bool IsToAnimation() const MOZ_OVERRIDE {
     return false;
   }
 
   // <set> applies the exact same value across the simple duration.
-  NS_OVERRIDE virtual bool IsValueFixedForSimpleDuration() const {
+  virtual bool IsValueFixedForSimpleDuration() const MOZ_OVERRIDE {
     return true;
   }
-  NS_OVERRIDE virtual bool               HasAttr(nsIAtom* aAttName) const;
-  NS_OVERRIDE virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const;
-  NS_OVERRIDE virtual bool               GetAttr(nsIAtom* aAttName,
-                                                 nsAString& aResult) const;
-  NS_OVERRIDE virtual bool WillReplace() const;
+  virtual bool               HasAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
+  virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
+  virtual bool               GetAttr(nsIAtom* aAttName,
+                                     nsAString& aResult) const MOZ_OVERRIDE;
+  virtual bool WillReplace() const MOZ_OVERRIDE;
 
   bool IsDisallowedAttribute(const nsIAtom* aAttribute) const;
 };
 
 #endif // NS_SMILSETANIMATIONFUNCTION_H_
--- a/content/svg/content/src/SVGMotionSMILAnimationFunction.h
+++ b/content/svg/content/src/SVGMotionSMILAnimationFunction.h
@@ -26,21 +26,21 @@ namespace mozilla {
 //
 // Subclass of nsSMILAnimationFunction to support a few extra features offered
 // by the <animateMotion> element.
 //
 class SVGMotionSMILAnimationFunction : public nsSMILAnimationFunction
 {
 public:
   SVGMotionSMILAnimationFunction();
-  NS_OVERRIDE virtual bool SetAttr(nsIAtom* aAttribute,
-                                     const nsAString& aValue,
-                                     nsAttrValue& aResult,
-                                     nsresult* aParseResult = nsnull);
-  NS_OVERRIDE virtual bool UnsetAttr(nsIAtom* aAttribute);
+  virtual bool SetAttr(nsIAtom* aAttribute,
+                       const nsAString& aValue,
+                       nsAttrValue& aResult,
+                       nsresult* aParseResult = nsnull) MOZ_OVERRIDE;
+  virtual bool UnsetAttr(nsIAtom* aAttribute) MOZ_OVERRIDE;
 
   // Method to allow our owner-element to signal us when our <mpath>
   // has changed or been added/removed.  When that happens, we need to
   // mark ourselves as changed so we'll get recomposed, and mark our path data
   // as stale so it'll get regenerated (regardless of mPathSourceType, since
   // <mpath> trumps all the other sources of path data)
   void MpathChanged() { mIsPathStale = mHasChanged = true; }
 
@@ -51,22 +51,22 @@ protected:
     ePathSourceType_None,      // uninitialized or not applicable
     ePathSourceType_ByAttr,    // by or from-by animation
     ePathSourceType_ToAttr,    // to or from-to animation
     ePathSourceType_ValuesAttr,
     ePathSourceType_PathAttr,
     ePathSourceType_Mpath
   };
 
-  NS_OVERRIDE virtual nsSMILCalcMode GetCalcMode() const;
-  NS_OVERRIDE virtual nsresult GetValues(const nsISMILAttr& aSMILAttr,
-                                         nsSMILValueArray& aResult);
-  NS_OVERRIDE virtual void CheckValueListDependentAttrs(PRUint32 aNumValues);
+  virtual nsSMILCalcMode GetCalcMode() const MOZ_OVERRIDE;
+  virtual nsresult GetValues(const nsISMILAttr& aSMILAttr,
+                             nsSMILValueArray& aResult) MOZ_OVERRIDE;
+  virtual void CheckValueListDependentAttrs(PRUint32 aNumValues) MOZ_OVERRIDE;
 
-  NS_OVERRIDE virtual bool IsToAnimation() const;
+  virtual bool IsToAnimation() const MOZ_OVERRIDE;
 
   void     CheckKeyPoints();
   nsresult SetKeyPoints(const nsAString& aKeyPoints, nsAttrValue& aResult);
   void     UnsetKeyPoints();
   nsresult SetRotate(const nsAString& aRotate, nsAttrValue& aResult);
   void     UnsetRotate();
 
   // Helpers for GetValues
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -107,17 +107,17 @@ nsXBLPrototypeHandler::nsXBLPrototypeHan
   Init();
 
   // Make sure our prototype is initialized.
   ConstructPrototype(aHandlerElement);
 }
 
 nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding)
   : mHandlerText(nsnull),
-    mLineNumber(nsnull),
+    mLineNumber(0),
     mNextHandler(nsnull),
     mPrototypeBinding(aBinding)
 {
   Init();
 }
 
 nsXBLPrototypeHandler::~nsXBLPrototypeHandler()
 {
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -2742,31 +2742,56 @@ nsDocShell::SetDocLoaderParent(nsDocLoad
 }
 
 NS_IMETHODIMP
 nsDocShell::GetSameTypeParent(nsIDocShellTreeItem ** aParent)
 {
     NS_ENSURE_ARG_POINTER(aParent);
     *aParent = nsnull;
 
+    if (mIsBrowserFrame) {
+        return NS_OK;
+    }
+
     nsCOMPtr<nsIDocShellTreeItem> parent =
         do_QueryInterface(GetAsSupports(mParent));
     if (!parent)
         return NS_OK;
 
     PRInt32 parentType;
     NS_ENSURE_SUCCESS(parent->GetItemType(&parentType), NS_ERROR_FAILURE);
 
     if (parentType == mItemType) {
         parent.swap(*aParent);
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
+nsDocShell::GetParentIgnoreBrowserFrame(nsIDocShell** aParent)
+{
+    NS_ENSURE_ARG_POINTER(aParent);
+    *aParent = nsnull;
+
+    nsCOMPtr<nsIDocShellTreeItem> parent =
+        do_QueryInterface(GetAsSupports(mParent));
+    if (!parent)
+        return NS_OK;
+
+    PRInt32 parentType;
+    NS_ENSURE_SUCCESS(parent->GetItemType(&parentType), NS_ERROR_FAILURE);
+
+    if (parentType == mItemType) {
+        nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parent);
+        parentDS.forget(aParent);
+    }
+    return NS_OK;
+}
+
+NS_IMETHODIMP
 nsDocShell::GetRootTreeItem(nsIDocShellTreeItem ** aRootTreeItem)
 {
     NS_ENSURE_ARG_POINTER(aRootTreeItem);
     *aRootTreeItem = static_cast<nsIDocShellTreeItem *>(this);
 
     nsCOMPtr<nsIDocShellTreeItem> parent;
     NS_ENSURE_SUCCESS(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
     while (parent) {
@@ -4987,22 +5012,30 @@ nsDocShell::SetIsActive(bool aIsActive)
   if (win) {
       win->SetIsBackground(!aIsActive);
       nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());
       if (doc) {
           doc->PostVisibilityUpdateEvent();
       }
   }
 
-  // Recursively tell all of our children
+  // Recursively tell all of our children, but don't tell <iframe mozbrowser>
+  // children; they handle their state separately.
   PRInt32 n = mChildList.Count();
   for (PRInt32 i = 0; i < n; ++i) {
       nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(ChildAt(i));
-      if (docshell)
-        docshell->SetIsActive(aIsActive);
+      if (!docshell) {
+          continue;
+      }
+
+      bool isContentBoundary = false;
+      docshell->GetIsContentBoundary(&isContentBoundary);
+      if (!isContentBoundary) {
+          docshell->SetIsActive(aIsActive);
+      }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetIsActive(bool *aIsActive)
 {
@@ -11085,26 +11118,19 @@ NS_IMETHODIMP nsDocShell::EnsureFind()
     if (NS_FAILED(rv)) return rv;
     
     return NS_OK;
 }
 
 bool
 nsDocShell::IsFrame()
 {
-    nsCOMPtr<nsIDocShellTreeItem> parent =
-        do_QueryInterface(GetAsSupports(mParent));
-    if (parent) {
-        PRInt32 parentType = ~mItemType;        // Not us
-        parent->GetItemType(&parentType);
-        if (parentType == mItemType)    // This is a frame
-            return true;
-    }
-
-    return false;
+    nsCOMPtr<nsIDocShellTreeItem> parent;
+    GetSameTypeParent(getter_AddRefs(parent));
+    return !!parent;
 }
 
 /* boolean IsBeingDestroyed (); */
 NS_IMETHODIMP 
 nsDocShell::IsBeingDestroyed(bool *aDoomed)
 {
   NS_ENSURE_ARG(aDoomed);
   *aDoomed = mIsBeingDestroyed;
@@ -11330,16 +11356,30 @@ nsDocShell::IsAppOfType(PRUint32 aAppTyp
 
 NS_IMETHODIMP
 nsDocShell::GetIsContent(bool *aIsContent)
 {
     *aIsContent = (mItemType == typeContent);
     return NS_OK;
 }
 
+NS_IMETHODIMP
+nsDocShell::GetExtendedOrigin(nsIURI *aUri, nsACString &aResult)
+{
+    bool isInBrowserElement;
+    GetIsInBrowserElement(&isInBrowserElement);
+
+    nsCOMPtr<nsIScriptSecurityManager> ssmgr =
+      do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
+    NS_ENSURE_TRUE(ssmgr, false);
+
+    return ssmgr->GetExtendedOrigin(aUri, mAppId, isInBrowserElement, aResult);
+}
+
+
 bool
 nsDocShell::IsOKToLoadURI(nsIURI* aURI)
 {
     NS_PRECONDITION(aURI, "Must have a URI!");
     
     if (!mFiredUnloadEvent) {
         return true;
     }
@@ -12118,20 +12158,19 @@ nsDocShell::GetAppId(PRUint32* aAppId)
         MOZ_ASSERT(GetFrameType() == eFrameTypeApp);
 
         *aAppId = mAppId;
         return NS_OK;
     }
 
     MOZ_ASSERT(GetFrameType() != eFrameTypeApp);
 
-    nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
-    GetSameTypeParent(getter_AddRefs(parentAsItem));
-
-    nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentAsItem);
+    nsCOMPtr<nsIDocShell> parent;
+    GetParentIgnoreBrowserFrame(getter_AddRefs(parent));
+
     if (!parent) {
         *aAppId = nsIScriptSecurityManager::NO_APP_ID;
         return NS_OK;
     }
 
     return parent->GetAppId(aAppId);
 }
 
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -223,16 +223,17 @@ public:
     // Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
     // are shared with nsIDocShell (appID, etc.) and can't be declared twice.
     NS_IMETHOD GetAssociatedWindow(nsIDOMWindow**);
     NS_IMETHOD GetTopWindow(nsIDOMWindow**);
     NS_IMETHOD IsAppOfType(PRUint32, bool*);
     NS_IMETHOD GetIsContent(bool*);
     NS_IMETHOD GetUsePrivateBrowsing(bool*);
     NS_IMETHOD SetUsePrivateBrowsing(bool);
+    NS_IMETHOD GetExtendedOrigin(nsIURI *uri, nsACString & retval);
 
     // Restores a cached presentation from history (mLSHE).
     // This method swaps out the content viewer and simulates loads for
     // subframes.  It then simulates the completion of the toplevel load.
     nsresult RestoreFromHistory();
 
     // Perform a URI load from a refresh timer.  This is just like the
     // ForceRefreshURI method on nsIRefreshURI, but makes sure to take
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -34,17 +34,17 @@ interface nsISHEntry;
 interface nsILayoutHistoryState;
 interface nsISecureBrowserUI;
 interface nsIDOMStorage;
 interface nsIPrincipal;
 interface nsIWebBrowserPrint;
 interface nsIVariant;
 interface nsIPrivacyTransitionObserver;
 
-[scriptable, builtinclass, uuid(be5a675b-b675-4443-af75-510530eab5fa)]
+[scriptable, builtinclass, uuid(51f2b7f0-6435-40ec-b315-588f52be7eea)]
 interface nsIDocShell : nsISupports
 {
   /**
    * Loads a given URI.  This will give priority to loading the requested URI
    * in the object implementing	this interface.  If it can't be loaded here
    * however, the URL dispatcher will go through its normal process of content
    * loading.
    *
@@ -639,9 +639,15 @@ interface nsIDocShell : nsISupports
    */
   readonly attribute unsigned long appId;
 
   /** 
    * True iff asynchronous panning and zooming is enabled for this
    * docshell.
    */
   readonly attribute bool asyncPanZoomEnabled;
+
+  /**
+   * Like GetSameTypeParent, except this ignores <iframe mozbrowser>
+   * boundaries.
+   */
+  nsIDocShell getParentIgnoreBrowserFrame();
 };
--- a/docshell/base/nsILoadContext.idl
+++ b/docshell/base/nsILoadContext.idl
@@ -2,16 +2,17 @@
  * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
  * 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/. */
 
 #include "nsISupports.idl"
 
 interface nsIDOMWindow;
+interface nsIURI;
 
 /**
  * An nsILoadContext represents the context of a load.  This interface
  * can be queried for various information about where the load is
  * happening.
  */
 [scriptable, uuid(386806c3-c4cb-4b3d-b05d-c08ea10f5585)]
 interface nsILoadContext : nsISupports
@@ -73,9 +74,24 @@ interface nsILoadContext : nsISupports
   readonly attribute boolean isInBrowserElement;
 
   /**
    * Returns the app id of the app the load is occurring is in. Returns
    * nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
    */
   readonly attribute unsigned long appId;
 
+  /**
+   * Get the extended origin of a channel in this load context.
+   * The extended origin is a string that has more information than the origin
+   * and can be used to isolate data or permissions between different
+   * principals while taking into account parameters like the app id or the
+   * fact that the load is taking place in a mozbrowser.
+   *
+   * In some cases this function will simply return the origin for the
+   * channel's URI.
+   *
+   * The extendedOrigin is intended to be an opaque identifier. It is
+   * currently "human-readable" but no callers should assume it will stay
+   * as-is and it might be crypto-hashed at some point.
+   */
+  AUTF8String GetExtendedOrigin(in nsIURI channel);
 };
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1636,18 +1636,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(MediaQueryList, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MutationObserver, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MutationRecord, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozSettingsEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(MozContactChangeEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozApplicationEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_CLASSINFO_DATA(MozWifiStatusChangeEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozWifiConnectionInfoEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -1724,17 +1722,16 @@ static const nsContractIDMapData kConstr
     nsIDOMEvent* e = nsnull;                                \
     nsresult rv = NS_NewDOM##_class(&e, nsnull, nsnull);    \
     *aInstancePtrResult = e;                                \
     return rv;                                              \
   }
 
 NS_DEFINE_EVENT_CTOR(Event)
 NS_DEFINE_EVENT_CTOR(MozSettingsEvent)
-NS_DEFINE_EVENT_CTOR(MozContactChangeEvent)
 NS_DEFINE_EVENT_CTOR(MozApplicationEvent)
 NS_DEFINE_EVENT_CTOR(UIEvent)
 NS_DEFINE_EVENT_CTOR(MouseEvent)
 NS_DEFINE_EVENT_CTOR(DeviceLightEvent)
 #ifdef MOZ_B2G_RIL
 NS_DEFINE_EVENT_CTOR(MozWifiStatusChangeEvent)
 NS_DEFINE_EVENT_CTOR(MozWifiConnectionInfoEvent)
 #endif
@@ -1773,17 +1770,16 @@ struct nsConstructorFuncMapData
 
 static const nsConstructorFuncMapData kConstructorFuncMap[] =
 {
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Blob, nsDOMMultipartFile::NewBlob)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(File, nsDOMFileFile::NewFile)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozBlobBuilder, NS_NewBlobBuilder)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozSettingsEvent)
-  NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozContactChangeEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozApplicationEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(DeviceLightEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent)
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiStatusChangeEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiConnectionInfoEvent)
@@ -4408,21 +4404,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMutationRecord)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozSettingsEvent, nsIDOMMozSettingsEvent)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSettingsEvent)
      DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(MozContactChangeEvent, nsIDOMMozContactChangeEvent)
-     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozContactChangeEvent)
-     DOM_CLASSINFO_EVENT_MAP_ENTRIES
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(MozApplicationEvent, nsIDOMMozApplicationEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozApplicationEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
 #ifdef MOZ_B2G_RIL
   DOM_CLASSINFO_MAP_BEGIN(MozWifiStatusChangeEvent, nsIDOMMozWifiStatusChangeEvent)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiStatusChangeEvent)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -503,17 +503,16 @@ DOMCI_CLASS(MozCSSKeyframeRule)
 DOMCI_CLASS(MozCSSKeyframesRule)
 
 DOMCI_CLASS(MediaQueryList)
 
 DOMCI_CLASS(MutationObserver)
 DOMCI_CLASS(MutationRecord)
 
 DOMCI_CLASS(MozSettingsEvent)
-DOMCI_CLASS(MozContactChangeEvent)
 
 DOMCI_CLASS(MozApplicationEvent)
 
 #ifdef MOZ_B2G_RIL
 DOMCI_CLASS(MozWifiStatusChangeEvent)
 DOMCI_CLASS(MozWifiConnectionInfoEvent)
 DOMCI_CLASS(Telephony)
 DOMCI_CLASS(TelephonyCall)
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1925,17 +1925,17 @@ nsDOMWindowUtils::StartFrameTimeRecordin
     return NS_ERROR_FAILURE;
 
   mgr->StartFrameTimeRecording();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::StopFrameTimeRecording(PRUint32 *frameCount NS_OUTPARAM, float **frames NS_OUTPARAM)
+nsDOMWindowUtils::StopFrameTimeRecording(PRUint32 *frameCount, float **frames)
 {
   NS_ENSURE_ARG_POINTER(frameCount);
   NS_ENSURE_ARG_POINTER(frames);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return NS_ERROR_FAILURE;
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1971,17 +1971,17 @@ nsGlobalWindow::SetNewDocument(nsIDocume
       JSObject *outerObject = NewOuterWindowProxy(cx, xpc_UnmarkGrayObject(newInnerWindow->mJSObject));
       if (!outerObject) {
         NS_ERROR("out of memory");
         return NS_ERROR_FAILURE;
       }
 
       js::SetProxyExtra(mJSObject, 0, js::PrivateValue(NULL));
 
-      outerObject = JS_TransplantObject(cx, mJSObject, outerObject);
+      outerObject = xpc::TransplantObject(cx, mJSObject, outerObject);
       if (!outerObject) {
         NS_ERROR("unable to transplant wrappers, probably OOM");
         return NS_ERROR_FAILURE;
       }
 
       nsIScriptGlobalObject *global = static_cast<nsIScriptGlobalObject*>(this);
       js::SetProxyExtra(outerObject, 0, js::PrivateValue(global));
 
@@ -2985,21 +2985,18 @@ nsGlobalWindow::GetRealParent(nsIDOMWind
 {
   FORWARD_TO_OUTER(GetRealParent, (aParent), NS_ERROR_NOT_INITIALIZED);
 
   *aParent = nsnull;
   if (!mDocShell) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
-  NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
-
-  nsCOMPtr<nsIDocShellTreeItem> parent;
-  docShellAsItem->GetSameTypeParent(getter_AddRefs(parent));
+  nsCOMPtr<nsIDocShell> parent;
+  mDocShell->GetParentIgnoreBrowserFrame(getter_AddRefs(parent));
 
   if (parent) {
     nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(parent));
     NS_ENSURE_SUCCESS(CallQueryInterface(globalObject.get(), aParent),
                       NS_ERROR_FAILURE);
   }
   else {
     *aParent = static_cast<nsIDOMWindow*>(this);
@@ -3068,35 +3065,42 @@ nsGlobalWindow::GetTopImpl(nsIDOMWindow*
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
 {
   FORWARD_TO_OUTER(GetContent, (aContent), NS_ERROR_NOT_INITIALIZED);
-
   *aContent = nsnull;
 
+  // If we're contained in <iframe mozbrowser>, then GetContent is the same as
+  // window.top.
+  if (mDocShell) {
+    bool belowContentBoundary = false;
+    mDocShell->GetIsBelowContentBoundary(&belowContentBoundary);
+    if (belowContentBoundary) {
+      return GetScriptableTop(aContent);
+    }
+  }
+
   nsCOMPtr<nsIDocShellTreeItem> primaryContent;
-
   if (!nsContentUtils::IsCallerChrome()) {
     // If we're called by non-chrome code, make sure we don't return
     // the primary content window if the calling tab is hidden. In
     // such a case we return the same-type root in the hidden tab,
     // which is "good enough", for now.
     nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(mDocShell));
 
     if (baseWin) {
       bool visible = false;
       baseWin->GetVisibility(&visible);
 
       if (!visible) {
         nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mDocShell));
-
         treeItem->GetSameTypeRootTreeItem(getter_AddRefs(primaryContent));
       }
     }
   }
 
   if (!primaryContent) {
     nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
     GetTreeOwner(getter_AddRefs(treeOwner));
@@ -3106,16 +3110,17 @@ nsGlobalWindow::GetContent(nsIDOMWindow*
   }
 
   nsCOMPtr<nsIDOMWindow> domWindow(do_GetInterface(primaryContent));
   NS_IF_ADDREF(*aContent = domWindow);
 
   return NS_OK;
 }
 
+
 NS_IMETHODIMP
 nsGlobalWindow::GetPrompter(nsIPrompt** aPrompt)
 {
   FORWARD_TO_OUTER(GetPrompter, (aPrompt), NS_ERROR_NOT_INITIALIZED);
 
   if (!mDocShell)
     return NS_ERROR_FAILURE;
 
@@ -7001,29 +7006,26 @@ nsGlobalWindow::GetScriptableFrameElemen
  */
 NS_IMETHODIMP
 nsGlobalWindow::GetRealFrameElement(nsIDOMElement** aFrameElement)
 {
   FORWARD_TO_OUTER(GetRealFrameElement, (aFrameElement), NS_ERROR_NOT_INITIALIZED);
 
   *aFrameElement = NULL;
 
-  nsCOMPtr<nsIDocShellTreeItem> docShellTI(do_QueryInterface(mDocShell));
-
-  if (!docShellTI) {
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIDocShellTreeItem> parent;
-  docShellTI->GetSameTypeParent(getter_AddRefs(parent));
-
-  if (!parent || parent == docShellTI) {
+  if (!mDocShell) {
+    return NS_OK;
+  }
+
+  nsCOMPtr<nsIDocShell> parent;
+  mDocShell->GetParentIgnoreBrowserFrame(getter_AddRefs(parent));
+
+  if (!parent || parent == mDocShell) {
     // We're at a chrome boundary, don't expose the chrome iframe
     // element to content code.
-
     return NS_OK;
   }
 
   *aFrameElement = mFrameElement;
   NS_IF_ADDREF(*aFrameElement);
 
   return NS_OK;
 }
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -89,17 +89,17 @@ const char * const sSelectBottomString =
 
 // a base class for selection-related commands, for code sharing
 class nsSelectionCommandsBase : public nsIControllerCommand
 {
 public:
   virtual ~nsSelectionCommandsBase() {}
 
   NS_DECL_ISUPPORTS
-  NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandContext, bool *_retval NS_OUTPARAM);
+  NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandContext, bool *_retval);
   NS_IMETHOD GetCommandStateParams(const char * aCommandName, nsICommandParams *aParams, nsISupports *aCommandContext);
   NS_IMETHOD DoCommandParams(const char * aCommandName, nsICommandParams *aParams, nsISupports *aCommandContext);
 
 protected:
 
   static nsresult  GetPresShellFromWindow(nsPIDOMWindow *aWindow, nsIPresShell **aPresShell);
   static nsresult  GetSelectionControllerFromWindow(nsPIDOMWindow *aWindow, nsISelectionController **aSelCon);
 
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -3876,18 +3876,18 @@ NS_DOMStructuredCloneError(JSContext* cx
 
 static nsresult
 ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, PRUint32 *len)
 {
   nsresult rv;
 
   // mozJSSubScriptLoader prefixes the filenames of the scripts it loads with
   // the filename of its caller. Axe that if present.
-  const char *arrow = strstr(filename, " -> ");
-  if (arrow)
+  const char *arrow;
+  while ((arrow = strstr(filename, " -> ")))
     filename = arrow + strlen(" -> ");
 
   // Get the URI.
   nsCOMPtr<nsIURI> uri;
   rv = NS_NewURI(getter_AddRefs(uri), filename);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIChannel> scriptChannel;
--- a/dom/browser-element/BrowserElementChild.js
+++ b/dom/browser-element/BrowserElementChild.js
@@ -44,32 +44,45 @@ function sendSyncMsg(msg, data) {
  */
 
 var global = this;
 
 function BrowserElementChild() {
   // Maps outer window id --> weak ref to window.  Used by modal dialog code.
   this._windowIDDict = {};
 
+  // _forcedVisible corresponds to the visibility state our owner has set on us
+  // (via iframe.setVisible).  ownerVisible corresponds to whether the docShell
+  // whose window owns this element is visible.
+  //
+  // Our docShell is visible iff _forcedVisible and _ownerVisible are both
+  // true.
+  this._forcedVisible = true;
+  this._ownerVisible = true;
+
   this._init();
 };
 
 BrowserElementChild.prototype = {
   _init: function() {
     debug("Starting up.");
     sendAsyncMsg("hello");
 
     BrowserElementPromptService.mapWindowToBrowserElementChild(content, this);
 
     docShell.QueryInterface(Ci.nsIWebProgress)
             .addProgressListener(this._progressListener,
                                  Ci.nsIWebProgress.NOTIFY_LOCATION |
                                  Ci.nsIWebProgress.NOTIFY_SECURITY |
                                  Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
 
+    docShell.QueryInterface(Ci.nsIWebNavigation)
+            .sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
+                                .createInstance(Ci.nsISHistory);
+
     // This is necessary to get security web progress notifications.
     var securityUI = Cc['@mozilla.org/secure_browser_ui;1']
                        .createInstance(Ci.nsISecureBrowserUI);
     securityUI.init(content);
 
     // A mozbrowser iframe contained inside a mozapp iframe should return false
     // for nsWindowUtils::IsPartOfApp (unless the mozbrowser iframe is itself
     // also mozapp).  That is, mozapp is transitive down to its children, but
@@ -118,16 +131,17 @@ BrowserElementChild.prototype = {
     addMsgListener("get-can-go-back", this._recvCanGoBack);
     addMsgListener("get-can-go-forward", this._recvCanGoForward);
     addMsgListener("go-back", this._recvGoBack);
     addMsgListener("go-forward", this._recvGoForward);
     addMsgListener("reload", this._recvReload);
     addMsgListener("stop", this._recvStop);
     addMsgListener("unblock-modal-prompt", this._recvStopWaiting);
     addMsgListener("fire-ctx-callback", this._recvFireCtxCallback);
+    addMsgListener("owner-visibility-change", this._recvOwnerVisibilityChange);
 
     let els = Cc["@mozilla.org/eventlistenerservice;1"]
                 .getService(Ci.nsIEventListenerService);
 
     // We are using the system group for those events so if something in the
     // content called .stopPropagation() this will still be called.
     els.addSystemEventListener(global, 'keydown',
                                this._keyEventHandler.bind(this),
@@ -439,18 +453,34 @@ BrowserElementChild.prototype = {
         menuObj.items.push(menuitem);
       }
     }
     return menuObj;
   },
 
   _recvSetVisible: function(data) {
     debug("Received setVisible message: (" + data.json.visible + ")");
-    if (docShell.isActive !== data.json.visible) {
-      docShell.isActive = data.json.visible;
+    this._forcedVisible = data.json.visible;
+    this._updateDocShellVisibility();
+  },
+
+  /**
+   * Called when the window which contains this iframe becomes hidden or
+   * visible.
+   */
+  _recvOwnerVisibilityChange: function(data) {
+    debug("Received ownerVisibilityChange: (" + data.json.visible + ")");
+    this._ownerVisible = data.json.visible;
+    this._updateDocShellVisibility();
+  },
+
+  _updateDocShellVisibility: function() {
+    var visible = this._forcedVisible && this._ownerVisible;
+    if (docShell.isActive !== visible) {
+      docShell.isActive = visible;
     }
   },
 
   _recvSendMouseEvent: function(data) {
     let json = data.json;
     let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIDOMWindowUtils);
     utils.sendMouseEvent(json.type, json.x, json.y, json.button,
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -187,16 +187,23 @@ function BrowserElementParent(frameLoade
   }
   defineMethod('goBack', this._goBack);
   defineMethod('goForward', this._goForward);
   defineMethod('reload', this._reload);
   defineMethod('stop', this._stop);
   defineDOMRequestMethod('getScreenshot', 'get-screenshot');
   defineDOMRequestMethod('getCanGoBack', 'get-can-go-back');
   defineDOMRequestMethod('getCanGoForward', 'get-can-go-forward');
+
+  // Listen to mozvisibilitychange on the iframe's owner window, and forward it
+  // down to the child.
+  this._window.addEventListener('mozvisibilitychange',
+                                this._ownerVisibilityChange.bind(this),
+                                /* useCapture = */ false,
+                                /* wantsUntrusted = */ false);
 }
 
 BrowserElementParent.prototype = {
   /**
    * You shouldn't touch this._frameElement or this._window if _isAlive is
    * false.  (You'll likely get an exception if you do.)
    */
   _isAlive: function() {
@@ -213,16 +220,24 @@ BrowserElementParent.prototype = {
     this._frameElement.QueryInterface(Ci.nsIFrameLoaderOwner)
                       .frameLoader
                       .messageManager
                       .sendAsyncMessage('browser-element-api:' + msg, data);
   },
 
   _recvHello: function(data) {
     debug("recvHello");
+
+    // Inform our child if our owner element's document is invisible.  Note
+    // that we must do so here, rather than in the BrowserElementParent
+    // constructor, because the BrowserElementChild may not be initialized when
+    // we run our constructor.
+    if (this._window.document.mozHidden) {
+      this._ownerVisibilityChange();
+    }
   },
 
   _fireCtxMenuEvent: function(data) {
     let evtName = data.name.substring('browser-element-api:'.length);
     let detail = data.json;
 
     debug('fireCtxMenuEventFromMsg: ' + evtName + ' ' + detail);
     let evt = this._createEvent(evtName, detail);
@@ -407,11 +422,19 @@ BrowserElementParent.prototype = {
     let evt = this._window.document.createEvent("KeyboardEvent");
     evt.initKeyEvent(data.json.type, true, true, this._window,
                      false, false, false, false, // modifiers
                      data.json.keyCode,
                      data.json.charCode);
 
     this._frameElement.dispatchEvent(evt);
   },
+
+  /**
+   * Called when the visibility of the window which owns this iframe changes.
+   */
+  _ownerVisibilityChange: function() {
+    this._sendAsyncMsg('owner-visibility-change',
+                       {visible: !this._window.document.mozHidden});
+  },
 };
 
 var NSGetFactory = XPCOMUtils.generateNSGetFactory([BrowserElementParentFactory]);
--- a/dom/browser-element/mochitest/Makefile.in
+++ b/dom/browser-element/mochitest/Makefile.in
@@ -34,16 +34,23 @@ MOCHITEST_FILES = \
 		browserElement_TopBarrier.js \
 		test_browserElement_inproc_TopBarrier.html \
 		browserElement_Iconchange.js \
 		test_browserElement_inproc_Iconchange.html \
 		browserElement_GetScreenshot.js \
 		test_browserElement_inproc_GetScreenshot.html \
 		browserElement_SetVisible.js \
 		test_browserElement_inproc_SetVisible.html \
+		browserElement_SetVisibleFrames.js \
+		test_browserElement_inproc_SetVisibleFrames.html \
+		file_browserElement_SetVisibleFrames_Outer.html \
+		file_browserElement_SetVisibleFrames_Inner.html \
+		browserElement_SetVisibleFrames2.js \
+		test_browserElement_inproc_SetVisibleFrames2.html \
+		file_browserElement_SetVisibleFrames2_Outer.html \
 		browserElement_KeyEvents.js \
 		test_browserElement_inproc_KeyEvents.html \
 		browserElement_XFrameOptions.js \
 		test_browserElement_inproc_XFrameOptions.html \
 		file_browserElement_XFrameOptions.sjs \
 		browserElement_XFrameOptionsDeny.js \
 		test_browserElement_inproc_XFrameOptionsDeny.html \
 		file_browserElement_XFrameOptionsDeny.html \
@@ -51,16 +58,19 @@ MOCHITEST_FILES = \
 		test_browserElement_inproc_XFrameOptionsSameOrigin.html \
 		file_browserElement_XFrameOptionsSameOrigin.html \
 		browserElement_Alert.js \
 		test_browserElement_inproc_Alert.html \
 		browserElement_AlertInFrame.js \
 		test_browserElement_inproc_AlertInFrame.html \
 		file_browserElement_AlertInFrame.html \
 		file_browserElement_AlertInFrame_Inner.html \
+		browserElement_TargetTop.js \
+		test_browserElement_inproc_TargetTop.html \
+		file_browserElement_TargetTop.html \
 		browserElement_PromptCheck.js \
 		test_browserElement_inproc_PromptCheck.html \
 		browserElement_PromptConfirm.js \
 		test_browserElement_inproc_PromptConfirm.html \
 		browserElement_Close.js \
 		test_browserElement_inproc_Close.html \
 		browserElement_CloseFromOpener.js \
 		test_browserElement_inproc_CloseFromOpener.html \
@@ -70,20 +80,24 @@ MOCHITEST_FILES = \
 		file_browserElement_Open1.html \
 		file_browserElement_Open2.html \
 		browserElement_OpenWindowInFrame.js \
 		test_browserElement_inproc_OpenWindowInFrame.html \
 		file_browserElement_OpenWindowInFrame.html \
 		browserElement_OpenWindowRejected.js \
 		test_browserElement_inproc_OpenWindowRejected.html \
 		file_browserElement_OpenWindowRejected.html \
+		browserElement_OpenWindowDifferentOrigin.js \
+		test_browserElement_inproc_OpenWindowDifferentOrigin.html \
+		file_browserElement_OpenWindowDifferentOrigin.html \
 		browserElement_SecurityChange.js \
 		test_browserElement_inproc_SecurityChange.html \
 		file_browserElement_SecurityChange.html \
 		browserElement_BackForward.js \
+		test_browserElement_inproc_BackForward.html \
 	        file_bug741717.sjs \
 		browserElement_Reload.js \
 	        file_bug709759.sjs \
 		browserElement_Stop.js \
                 test_browserElement_inproc_Stop.html \
                 browserElement_ContextmenuEvents.js \
                 test_browserElement_inproc_ContextmenuEvents.html \
 		browserElement_SendEvent.js \
@@ -92,42 +106,44 @@ MOCHITEST_FILES = \
 		test_browserElement_inproc_ScrollEvent.html \
 		$(NULL)
 
 # Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
 #		test_browserElement_inproc_Reload.html \
 
 # OOP tests don't work on Windows (bug 763081) or native-fennec (bug
 # 774939).
-#
-# Note that there's no inproc equivalent of BackForward; that's intentional.
 ifneq ($(OS_ARCH),WINNT) #{
 ifndef MOZ_JAVA_COMPOSITOR #{
 MOCHITEST_FILES += \
 		test_browserElement_oop_LoadEvents.html \
 		test_browserElement_oop_DataURI.html \
 		test_browserElement_oop_ErrorSecurity.html \
 		test_browserElement_oop_Titlechange.html \
 		test_browserElement_oop_TopBarrier.html \
 		test_browserElement_oop_Iconchange.html \
 		test_browserElement_oop_GetScreenshot.html \
 		test_browserElement_oop_SetVisible.html \
+		test_browserElement_oop_SetVisibleFrames.html \
+		test_browserElement_oop_SetVisibleFrames2.html \
 		test_browserElement_oop_KeyEvents.html \
 		test_browserElement_oop_XFrameOptions.html \
 		test_browserElement_oop_XFrameOptionsDeny.html \
 		test_browserElement_oop_XFrameOptionsSameOrigin.html \
 		test_browserElement_oop_Alert.html \
 		test_browserElement_oop_AlertInFrame.html \
+		test_browserElement_oop_TargetTop.html \
 		test_browserElement_oop_PromptCheck.html \
 		test_browserElement_oop_PromptConfirm.html \
 		test_browserElement_oop_Close.html \
 		test_browserElement_oop_CloseFromOpener.html \
 		test_browserElement_oop_OpenWindow.html \
 		test_browserElement_oop_OpenWindowInFrame.html \
 		test_browserElement_oop_OpenWindowRejected.html \
+		test_browserElement_oop_OpenWindowDifferentOrigin.html \
 		test_browserElement_oop_SecurityChange.html \
 		test_browserElement_oop_BackForward.html \
 		test_browserElement_oop_Reload.html \
 		test_browserElement_oop_Stop.html \
                 test_browserElement_oop_ContextmenuEvents.html \
 		test_browserElement_oop_SendEvent.html \
 		test_browserElement_oop_ScrollEvent.html \
 		$(NULL)
--- a/dom/browser-element/mochitest/browserElement_BackForward.js
+++ b/dom/browser-element/mochitest/browserElement_BackForward.js
@@ -13,28 +13,16 @@ function addOneShotIframeEventListener(e
     iframe.removeEventListener(event, wrapper);
     fn(e);
   };
 
   iframe.addEventListener(event, wrapper);
 }
 
 function runTest() {
-  // At the moment, this isn't going to work unless we're actually out of
-  // process.
-  //
-  // With in-process mozbrowser, the root SHistory for an <iframe mozbrowser>
-  // crosses the mozbrowser boundary.  It's like the mozbrowser wasn't there;
-  // canGoBack reflects whether the top-level frame can go back, not whether the
-  // iframe itself can go back.
-  if (!browserElementTestHelpers.getOOPByDefaultPref()) {
-    ok(false, "This test only works OOP.");
-    return;
-  }
-
   browserElementTestHelpers.setEnabledPref(true);
   browserElementTestHelpers.addToWhitelist();
 
   iframe = document.createElement('iframe');
   iframe.mozbrowser = true;
 
   addOneShotIframeEventListener('mozbrowserloadend', function() {
     SimpleTest.executeSoon(test2);
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_OpenWindowDifferentOrigin.js
@@ -0,0 +1,42 @@
+/* Any copyright is dedicated to the public domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 769182 - window.open to a different origin should load the page.
+
+"use strict";
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+  browserElementTestHelpers.setEnabledPref(true);
+  browserElementTestHelpers.addToWhitelist();
+
+  var iframe = document.createElement('iframe');
+  iframe.mozbrowser = true;
+
+  iframe.addEventListener('mozbrowseropenwindow', function(e) {
+    ok(true, 'Got first window.open call');
+
+    e.detail.frameElement.addEventListener('mozbrowseropenwindow', function(e) {
+      ok(true, 'Got second window.open call');
+      document.body.appendChild(e.detail.frameElement);
+    });
+
+    e.detail.frameElement.addEventListener('mozbrowsershowmodalprompt', function(e) {
+      ok(true, 'Got alert from second window.');
+      SimpleTest.finish();
+    });
+
+    document.body.appendChild(e.detail.frameElement);
+  });
+
+  // DifferentOrigin.html?1 calls
+  //
+  //   window.open('http://example.com/.../DifferentOrigin.html?2'),
+  //
+  // which calls alert().
+
+  iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_OpenWindowDifferentOrigin.html?1';
+  document.body.appendChild(iframe);
+}
+
+runTest();
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames.js
@@ -0,0 +1,77 @@
+/* Any copyright is dedicated to the public domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 762939 - Test that visibility propagates down properly through
+// hierarchies of <iframe mozbrowser>.
+//
+// In this test, we modify the parent's visibility and check that the child's
+// visibility is changed as appopriate.  We test modifying the child's
+// visibility in a separate testcase.
+
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+var iframe;
+
+function runTest() {
+  browserElementTestHelpers.setEnabledPref(true);
+  browserElementTestHelpers.addToWhitelist();
+
+  iframe = document.createElement('iframe');
+  iframe.mozbrowser = true;
+
+  // Our test involves three <iframe mozbrowser>'s, parent, child1, and child2.
+  // child1 and child2 are contained inside parent.  child1 is visibile, and
+  // child2 is not.
+  //
+  // For the purposes of this test, we want there to be a process barrier
+  // between child{1,2} and parent.  Therefore parent must be a non-remote
+  // <iframe mozbrowser>, until bug 761935 is resolved and we can have nested
+  // content processes.
+  iframe.remote = false;
+
+  iframe.addEventListener('mozbrowsershowmodalprompt', checkMessage);
+  expectMessage('parent:ready', test1);
+
+  document.body.appendChild(iframe);
+  iframe.src = 'file_browserElement_SetVisibleFrames_Outer.html';
+}
+
+function test1() {
+  expectMessage('child1:hidden', test2);
+  iframe.setVisible(false);
+}
+
+function test2() {
+  expectMessage('child1:visible', finish);
+  iframe.setVisible(true);
+}
+
+function finish() {
+  // We need to remove this listener because when this test finishes and the
+  // iframe containing this document is navigated, we'll fire a
+  // visibilitychange(false) event on all child iframes.  That's OK and
+  // expected, but if we don't remove our listener, then we'll end up causing
+  // the /next/ test to fail!
+  iframe.removeEventListener('mozbrowsershowmodalprompt', checkMessage);
+  SimpleTest.finish();
+}
+
+var expectedMsg = null;
+var expectedMsgCallback = null;
+function expectMessage(msg, next) {
+  expectedMsg = msg;
+  expectedMsgCallback = next;
+}
+
+function checkMessage(e) {
+  var msg = e.detail.message;
+  is(msg, expectedMsg);
+  if (msg == expectedMsg) {
+    expectedMsg = null;
+    SimpleTest.executeSoon(function() { expectedMsgCallback() });
+  }
+}
+
+runTest();
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_SetVisibleFrames2.js
@@ -0,0 +1,53 @@
+/* Any copyright is dedicated to the public domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 762939 - Test that setting a <iframe mozbrowser> to invisible / visible
+// inside an invisible <iframe mozbrowser> doesn't trigger any events.
+
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+  browserElementTestHelpers.setEnabledPref(true);
+  browserElementTestHelpers.addToWhitelist();
+
+  var iframe = document.createElement('iframe');
+  iframe.mozbrowser = true;
+
+  // We need remote = false here until bug 761935 is fixed; see
+  // SetVisibleFrames.js for an explanation.
+  iframe.remote = false;
+
+  iframe.addEventListener('mozbrowserloadend', function loadEnd(e) {
+    iframe.removeEventListener('mozbrowserloadend', loadEnd);
+    iframe.setVisible(false);
+    iframe.src = 'file_browserElement_SetVisibleFrames2_Outer.html';
+  });
+
+  iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
+    if (e.detail.message == 'parent:finish') {
+      ok(true, "Got parent:finish");
+
+      // Give any extra events a chance to fire, then end the test.
+      SimpleTest.executeSoon(function() {
+        SimpleTest.executeSoon(function() {
+          SimpleTest.executeSoon(function() {
+            SimpleTest.executeSoon(function() {
+              SimpleTest.executeSoon(function() {
+                SimpleTest.finish();
+              });
+            });
+          });
+        });
+      });
+    }
+    else {
+      ok(false, "Got unexpected message: " + e.detail.message);
+    }
+  });
+
+  document.body.appendChild(iframe);
+}
+
+runTest();
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_TargetTop.js
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the public domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 771273 - Check that window.open(url, '_top') works properly with <iframe
+// mozbrowser>.
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+function runTest() {
+  browserElementTestHelpers.setEnabledPref(true);
+  browserElementTestHelpers.addToWhitelist();
+
+  var iframe = document.createElement('iframe');
+  iframe.mozbrowser = true;
+
+  iframe.addEventListener('mozbrowseropenwindow', function(e) {
+    ok(false, 'Not expecting an openwindow event.');
+  });
+
+  iframe.addEventListener('mozbrowserlocationchange', function(e) {
+    if (/file_browserElement_TargetTop.html\?2$/.test(e.detail)) {
+      ok(true, 'Got the locationchange we were looking for.');
+      SimpleTest.finish();
+    }
+  });
+
+  document.body.appendChild(iframe);
+  iframe.src = 'file_browserElement_TargetTop.html';
+}
+
+runTest();
--- a/dom/browser-element/mochitest/browserElement_TopBarrier.js
+++ b/dom/browser-element/mochitest/browserElement_TopBarrier.js
@@ -33,21 +33,23 @@ function outerIframeLoaded() {
     "data:,function is(a, b, desc) {                                     \
       if (a == b) {                                                      \
         sendAsyncMessage('test:test-pass', desc);                        \
       } else {                                                           \
         sendAsyncMessage('test:test-fail', desc + ' ' + a + ' != ' + b); \
       }                                                                  \
     }                                                                    \
     is(content.window.top, content.window, 'top');                       \
+    is(content.window.content, content.window, 'content');               \
     is(content.window.parent, content.window, 'parent');                 \
     is(content.window.frameElement, null, 'frameElement');               \
     var innerIframe = content.document.getElementById('inner-iframe');   \
     var innerWindow = innerIframe.contentWindow;                         \
     is(innerWindow.top, content.window, 'inner top');                    \
+    is(innerWindow.content, content.window, 'inner content');            \
     is(innerWindow.parent, content.window, 'inner parent');              \
     is(innerWindow.frameElement, innerIframe, 'inner frameElement');"
 
   var mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
 
   function onRecvTestPass(msg) {
     numMsgReceived++;
     ok(true, msg.json);
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_OpenWindowDifferentOrigin.html
@@ -0,0 +1,18 @@
+<html>
+<body>
+
+<div id='name'></div>
+
+<script>
+if (location.search == "?1") {
+  open("http://example.com/tests/dom/browser-element/mochitest/file_browserElement_OpenWindowDifferentOrigin.html?2");
+}
+else if (location.search == "?2") {
+  alert("finish");
+}
+
+document.getElementById('name').innerHTML = location.search;
+</script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames2_Outer.html
@@ -0,0 +1,29 @@
+<html>
+<body>
+<script>
+
+var iframe = document.createElement('iframe');
+iframe.mozbrowser = true;
+
+iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
+  if (e.detail.message == 'child:ready') {
+    setTimeout(function() {
+      iframe.setVisible(false);
+      iframe.setVisible(true);
+      setTimeout(function() {
+        alert('parent:finish');
+      }, 0);
+    }, 0);
+  }
+  else {
+    // Pass the message up to our parent.
+    alert(e.detail.message);
+  }
+});
+
+document.body.appendChild(iframe);
+iframe.src = 'file_browserElement_SetVisibleFrames_Inner.html?child';
+
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Inner.html
@@ -0,0 +1,18 @@
+<html>
+<body>
+<script>
+
+var name = location.search.substring(1);
+addEventListener('load', function() {
+  setTimeout(function() {
+    alert(name + ':ready');
+  }, 0);
+});
+
+addEventListener('mozvisibilitychange', function() {
+  alert(name + ':' + (document.mozHidden ? 'hidden' : 'visible'));
+});
+
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames_Outer.html
@@ -0,0 +1,45 @@
+<html>
+<body>
+
+<script>
+
+var numPrompts = 0;
+function handlePrompt(e) {
+  numPrompts++;
+
+  // The first two prompts should be "child1:ready" and "child2:ready".  Once
+  // we get both of these, forward the child's prompt up to our parent.
+  if (numPrompts == 2) {
+    // This has to happen here, because setVisibile doesn't exist on the iframe
+    // until BrowserElementChild.js is loaded in it.  (That's pretty broken...)
+    iframe2.setVisible(false);
+  }
+  else if (numPrompts == 3) {
+    if (e.detail.message != 'child2:hidden') {
+      alert("parent:fail Didn't get expected 'child2:hidden'.");
+    }
+
+    alert('parent:ready');
+  }
+  else if (numPrompts > 3) {
+    alert(e.detail.message);
+  }
+}
+
+var iframe1 = document.createElement('iframe');
+iframe1.mozbrowser = true;
+iframe1.addEventListener('mozbrowsershowmodalprompt', handlePrompt);
+
+var iframe2 = document.createElement('iframe');
+iframe2.mozbrowser = true;
+iframe2.addEventListener('mozbrowsershowmodalprompt', handlePrompt);
+
+iframe1.src = 'file_browserElement_SetVisibleFrames_Inner.html?child1';
+iframe2.src = 'file_browserElement_SetVisibleFrames_Inner.html?child2';
+document.body.appendChild(iframe1);
+document.body.appendChild(iframe2);
+
+</script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/file_browserElement_TargetTop.html
@@ -0,0 +1,12 @@
+<html>
+<body>
+<div id='url'></div>
+
+<script>
+if (location.search == '') {
+  window.open('file_browserElement_TargetTop.html?2', '_top');
+}
+document.getElementById('url').innerHTML = document.location.href;
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_BackForward.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test of browser element.</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_BackForward.js">
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_OpenWindowDifferentOrigin.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test of browser element.</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_OpenWindowDifferentOrigin.js">
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 762939</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames.js">
+</script>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_SetVisibleFrames2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 762939</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames2.js">
+</script>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_inproc_TargetTop.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 771273</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_TargetTop.js">
+</script>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_oop_OpenWindowDifferentOrigin.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test of browser element.</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_OpenWindowDifferentOrigin.js">
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_oop_SetVisibleFrames.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 762939</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames.js">
+</script>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_oop_SetVisibleFrames2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 762939</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_SetVisibleFrames2.js">
+</script>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/browser-element/mochitest/test_browserElement_oop_TargetTop.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 771273</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7" src="browserElement_TargetTop.js">
+</script>
+</body>
+</html>
\ No newline at end of file
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -1225,32 +1225,32 @@ nsDOMDeviceStorage::GetType(nsAString & 
     default:
       aType.AssignLiteral("default");
       break;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMDeviceStorage::Add(nsIDOMBlob *aBlob, nsIDOMDOMRequest * *_retval NS_OUTPARAM)
+nsDOMDeviceStorage::Add(nsIDOMBlob *aBlob, nsIDOMDOMRequest * *_retval)
 {
   // possible race here w/ unique filename
   char buffer[128];
   NS_MakeRandomString(buffer, 128);
 
   nsString path;
   path.AssignWithConversion(nsDependentCString(buffer));
 
   return AddNamed(aBlob, path, _retval);
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::AddNamed(nsIDOMBlob *aBlob,
                              const nsAString & aPath,
-                             nsIDOMDOMRequest * *_retval NS_OUTPARAM)
+                             nsIDOMDOMRequest * *_retval)
 {
   // if the blob is null here, bail
   if (aBlob == nsnull)
     return NS_OK;
 
   nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mOwner);
   if (!win) {
     return NS_ERROR_UNEXPECTED;
@@ -1272,33 +1272,33 @@ nsDOMDeviceStorage::AddNamed(nsIDOMBlob 
   }
   NS_DispatchToMainThread(r);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Get(const JS::Value & aPath,
                         JSContext* aCx,
-                        nsIDOMDOMRequest * *_retval NS_OUTPARAM)
+                        nsIDOMDOMRequest * *_retval)
 {
   return GetInternal(aPath, aCx, _retval, false);
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::GetEditable(const JS::Value & aPath,
                                 JSContext* aCx,
-                                nsIDOMDOMRequest * *_retval NS_OUTPARAM)
+                                nsIDOMDOMRequest * *_retval)
 {
   return GetInternal(aPath, aCx, _retval, true);
 }
 
 nsresult
 nsDOMDeviceStorage::GetInternal(const JS::Value & aPath,
                                 JSContext* aCx,
-                                nsIDOMDOMRequest * *_retval NS_OUTPARAM,
+                                nsIDOMDOMRequest * *_retval,
                                 bool aEditable)
 {
   nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mOwner);
   if (!win) {
     return NS_ERROR_UNEXPECTED;
   }
 
   nsRefPtr<DOMRequest> request = new DOMRequest(win);
@@ -1326,17 +1326,17 @@ nsDOMDeviceStorage::GetInternal(const JS
     r = new DeviceStorageRequest(DeviceStorageRequest::DEVICE_STORAGE_REQUEST_READ,
                                  win, mURI, dsf, request);
   }
   NS_DispatchToMainThread(r);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMDeviceStorage::Delete(const JS::Value & aPath, JSContext* aCx, nsIDOMDOMRequest * *_retval NS_OUTPARAM)
+nsDOMDeviceStorage::Delete(const JS::Value & aPath, JSContext* aCx, nsIDOMDOMRequest * *_retval)
 {
   nsCOMPtr<nsIRunnable> r;
 
   nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mOwner);
   if (!win) {
     return NS_ERROR_UNEXPECTED;
   }
 
--- a/dom/devicestorage/nsDeviceStorage.h
+++ b/dom/devicestorage/nsDeviceStorage.h
@@ -78,17 +78,17 @@ public:
 
   PRInt32 SetRootFileForType(const nsAString& aType, const PRInt32 aIndex);
 
   static void CreateDeviceStoragesFor(nsPIDOMWindow* aWin, const nsAString &aType, nsIVariant** _retval);
 
 private:
   ~nsDOMDeviceStorage();
 
-  nsresult GetInternal(const JS::Value & aName, JSContext* aCx, nsIDOMDOMRequest * *_retval NS_OUTPARAM, bool aEditable);
+  nsresult GetInternal(const JS::Value & aName, JSContext* aCx, nsIDOMDOMRequest * *_retval, bool aEditable);
 
   nsresult EnumerateInternal(const JS::Value & aName, const JS::Value & aOptions, JSContext* aCx, PRUint8 aArgc, bool aEditable, nsIDOMDeviceStorageCursor** aRetval);
 
   PRInt32 mStorageType;
   nsCOMPtr<nsIFile> mFile;
 
   nsWeakPtr mOwner;
   nsCOMPtr<nsIURI> mURI;
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -380,17 +380,17 @@ IndexedDatabaseManager::FireWindowOnErro
   // Log an error to the error console.
   nsCOMPtr<nsIScriptError> scriptError =
     do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (NS_FAILED(scriptError->InitWithWindowID(event.errorMsg,
                                               event.fileName,
                                               nsnull, event.lineNr,
-                                              nsnull, 0,
+                                              0, 0,
                                               "IndexedDB",
                                               aOwner->WindowID()))) {
     NS_WARNING("Failed to init script error!");
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIConsoleService> consoleService =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
--- a/dom/indexedDB/ipc/Makefile.in
+++ b/dom/indexedDB/ipc/Makefile.in
@@ -40,12 +40,12 @@ MOCHITEST_FILES = test_ipc.html
 #NO_XPCSHELL_MANIFEST_CHECK = 1
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 # Copy all the normal xpcshell tests from the regular unit directory.
 copy-xpcshell-tests:
-	$(DIR_INSTALL) $(wildcard $(topsrcdir)/dom/indexedDB/test/unit/test_*.js) \
-    $(testxpcobjdir)/$(relativesrcdir)/$(XPCSHELL_TESTS)
+	$(call install_cmd,$(wildcard $(topsrcdir)/dom/indexedDB/test/unit/test_*.js) \
+		$(testxpcobjdir)/$(relativesrcdir)/$(XPCSHELL_TESTS))
 
 libs-xpcshell-tests: copy-xpcshell-tests
--- a/dom/indexedDB/test/head.js
+++ b/dom/indexedDB/test/head.js
@@ -122,32 +122,44 @@ function setPermission(url, permission, 
       break;
     default:
       throw new Error("No idea what to set here!");
   }
 
   let uri = Components.classes["@mozilla.org/network/io-service;1"]
                       .getService(Components.interfaces.nsIIOService)
                       .newURI(url, null, null);
+  let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                    .getService(Ci.nsIScriptSecurityManager)
+                    .getNoAppCodebasePrincipal(uri);
+
   Components.classes["@mozilla.org/permissionmanager;1"]
             .getService(Components.interfaces.nsIPermissionManager)
-            .add(uri, permission, value);
+            .addFromPrincipal(principal, permission, value);
 }
 
 function removePermission(url, permission)
 {
   let uri = Components.classes["@mozilla.org/network/io-service;1"]
                       .getService(Components.interfaces.nsIIOService)
                       .newURI(url, null, null);
+  let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                    .getService(Ci.nsIScriptSecurityManager)
+                    .getNoAppCodebasePrincipal(uri);
+
   Components.classes["@mozilla.org/permissionmanager;1"]
             .getService(Components.interfaces.nsIPermissionManager)
-            .remove(uri.asciiHost, permission);
+            .removeFromPrincipal(principal, permission);
 }
 
 function getPermission(url, permission)
 {
   let uri = Components.classes["@mozilla.org/network/io-service;1"]
                       .getService(Components.interfaces.nsIIOService)
                       .newURI(url, null, null);
+  let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
+                    .getService(Ci.nsIScriptSecurityManager)
+                    .getNoAppCodebasePrincipal(uri);
+
   return Components.classes["@mozilla.org/permissionmanager;1"]
                    .getService(Components.interfaces.nsIPermissionManager)
-                   .testPermission(uri, permission);
+                   .testPermissionFromPrincipal(principal, permission);
 }
--- a/dom/interfaces/contacts/Makefile.in
+++ b/dom/interfaces/contacts/Makefile.in
@@ -11,11 +11,12 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE         = dom
 XPIDL_MODULE   = dom_contacts
 GRE_MODULE     = 1
 
 XPIDLSRCS =                             \
             nsIDOMContactProperties.idl \
             nsIDOMContactManager.idl    \
+            nsIDOMMozContactChangeEvent.idl \
             $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/interfaces/contacts/nsIDOMContactManager.idl
+++ b/dom/interfaces/contacts/nsIDOMContactManager.idl
@@ -1,51 +1,31 @@
 /* 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/. */
 
 #include "domstubs.idl"
 #include "nsIDOMContactProperties.idl"
 #include "nsIDOMEventTarget.idl"
-#include "nsIDOMEvent.idl"
 
 interface nsIArray;
 interface nsIDOMContactFindOptions;
 interface nsIDOMContactProperties;
 interface nsIDOMDOMRequest;
 
 [scriptable, uuid(da0f7040-388b-11e1-b86c-0800200c9a66)]
 interface nsIDOMContact : nsIDOMContactProperties
 {
   attribute DOMString id;
   readonly attribute jsval     published;
   readonly attribute jsval     updated;
 
   void init(in nsIDOMContactProperties properties);  // Workaround BUG 723206
 };
 
-[scriptable, builtinclass, uuid(6ed26570-b640-11e1-afa6-0800200c9a66)]
-interface nsIDOMMozContactChangeEvent : nsIDOMEvent
-{
-  readonly attribute DOMString contactID;
-  readonly attribute DOMString reason;
-
-  [noscript] void initMozContactChangeEvent(in DOMString aType,
-                                            in boolean aCanBubble,
-                                            in boolean aCancelable,
-                                            in DOMString aContactID,
-                                            in DOMString aReason);
-};
-
-dictionary MozContactChangeEventInit : EventInit
-{
-  DOMString contactID;
-  DOMString reason;
-};
-
 [scriptable, uuid(d88af7e0-a45f-11e1-b3dd-0800200c9a66)]
 interface nsIDOMContactManager : nsISupports
 {
   nsIDOMDOMRequest find(in nsIDOMContactFindOptions options);
 
   nsIDOMDOMRequest clear();
 
   nsIDOMDOMRequest save(in nsIDOMContact contact);
new file mode 100644
--- /dev/null
+++ b/dom/interfaces/contacts/nsIDOMMozContactChangeEvent.idl
@@ -0,0 +1,24 @@
+/* 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/. */
+
+#include "nsIDOMEvent.idl"
+
+[scriptable, builtinclass, uuid(6ed26570-b640-11e1-afa6-0800200c9a66)]
+interface nsIDOMMozContactChangeEvent : nsIDOMEvent
+{
+  readonly attribute DOMString contactID;
+  readonly attribute DOMString reason;
+
+  [noscript] void initMozContactChangeEvent(in DOMString aType,
+                                            in boolean aCanBubble,
+                                            in boolean aCancelable,
+                                            in DOMString aContactID,
+                                            in DOMString aReason);
+};
+
+dictionary MozContactChangeEventInit : EventInit
+{
+  DOMString contactID;
+  DOMString reason;
+};
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -195,17 +195,17 @@ nsresult
 NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
 nsresult
 NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsDragEvent *aEvent);
 nsresult
 NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsKeyEvent *aEvent);
 nsresult
 NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsCompositionEvent *aEvent);
 nsresult
-NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
+NS_NewDOMMutationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
 nsresult
 NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMDeviceOrientationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMDeviceLightEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
@@ -252,16 +252,14 @@ nsresult
 NS_NewDOMMozTouchEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsMozTouchEvent* aEvent);
 nsresult
 NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsTouchEvent *aEvent);
 nsresult
 NS_NewDOMSmsEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
-NS_NewDOMMozContactChangeEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
-nsresult
 NS_NewDOMMozWifiStatusChangeEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMMozWifiConnectionInfoEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
 nsresult
 NS_NewDOMMozApplicationEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent* aEvent);
 %}
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -71,18 +71,18 @@ public:
     virtual bool DeallocPDeviceStorageRequest(PDeviceStorageRequestChild*);
 
     virtual PCrashReporterChild*
     AllocPCrashReporter(const mozilla::dom::NativeThreadId& id,
                         const PRUint32& processType);
     virtual bool
     DeallocPCrashReporter(PCrashReporterChild*);
 
-    NS_OVERRIDE virtual PHalChild* AllocPHal();
-    NS_OVERRIDE virtual bool DeallocPHal(PHalChild*);
+    virtual PHalChild* AllocPHal() MOZ_OVERRIDE;
+    virtual bool DeallocPHal(PHalChild*) MOZ_OVERRIDE;
 
     virtual PIndexedDBChild* AllocPIndexedDB();
     virtual bool DeallocPIndexedDB(PIndexedDBChild* aActor);
 
     virtual PMemoryReportRequestChild*
     AllocPMemoryReportRequest();
 
     virtual bool
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -141,18 +141,18 @@ private:
 
     virtual PCrashReporterParent* AllocPCrashReporter(const NativeThreadId& tid,
                                                       const PRUint32& processType);
     virtual bool DeallocPCrashReporter(PCrashReporterParent* crashreporter);
     virtual bool RecvPCrashReporterConstructor(PCrashReporterParent* actor,
                                                const NativeThreadId& tid,
                                                const PRUint32& processType);
 
-    NS_OVERRIDE virtual PHalParent* AllocPHal();
-    NS_OVERRIDE virtual bool DeallocPHal(PHalParent*);
+    virtual PHalParent* AllocPHal() MOZ_OVERRIDE;
+    virtual bool DeallocPHal(PHalParent*) MOZ_OVERRIDE;
 
     virtual PIndexedDBParent* AllocPIndexedDB();
 
     virtual bool DeallocPIndexedDB(PIndexedDBParent* aActor);
 
     virtual bool
     RecvPIndexedDBConstructor(PIndexedDBParent* aActor);
 
--- a/dom/ipc/ContentProcess.h
+++ b/dom/ipc/ContentProcess.h
@@ -28,20 +28,18 @@ class ContentProcess : public mozilla::i
 public:
     ContentProcess(ProcessHandle mParentHandle)
         : ProcessChild(mParentHandle)
     { }
 
     ~ContentProcess()
     { }
 
-    NS_OVERRIDE
-    virtual bool Init();
-    NS_OVERRIDE
-    virtual void CleanUp();
+    virtual bool Init() MOZ_OVERRIDE;
+    virtual void CleanUp() MOZ_OVERRIDE;
 
 private:
     ContentChild mContent;
     mozilla::ipc::ScopedXREEmbed mXREEmbed;
 
     DISALLOW_EVIL_CONSTRUCTORS(ContentProcess);
 };
 
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -254,25 +254,22 @@ public:
 
     void SetBackgroundColor(const nscolor& aColor);
 
     void NotifyPainted();
 
     bool IsAsyncPanZoomEnabled();
 
 protected:
-    NS_OVERRIDE
     virtual PRenderFrameChild* AllocPRenderFrame(ScrollingBehavior* aScrolling,
                                                  LayersBackend* aBackend,
                                                  int32_t* aMaxTextureSize,
-                                                 uint64_t* aLayersId);
-    NS_OVERRIDE
-    virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame);
-    NS_OVERRIDE
-    virtual bool RecvDestroy();
+                                                 uint64_t* aLayersId) MOZ_OVERRIDE;
+    virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
+    virtual bool RecvDestroy() MOZ_OVERRIDE;
 
     nsEventStatus DispatchWidgetEvent(nsGUIEvent& event);
 
     virtual PIndexedDBChild* AllocPIndexedDB(const nsCString& aASCIIOrigin,
                                              bool* /* aAllowed */);
 
     virtual bool DeallocPIndexedDB(PIndexedDBChild* aActor);
 
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -207,23 +207,21 @@ protected:
       nsCString mFeatures;
       nsCOMPtr<nsIDialogParamBlock> mParams;
     };
     InfallibleTArray<DelayedDialogData*> mDelayedDialogs;
 
     bool ShouldDelayDialogs();
     bool AllowContentIME();
 
-    NS_OVERRIDE
     virtual PRenderFrameParent* AllocPRenderFrame(ScrollingBehavior* aScrolling,
                                                   LayersBackend* aBackend,
                                                   int32_t* aMaxTextureSize,
-                                                  uint64_t* aLayersId);
-    NS_OVERRIDE
-    virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame);
+                                                  uint64_t* aLayersId) MOZ_OVERRIDE;
+    virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame) MOZ_OVERRIDE;
 
     // IME
     static TabParent *mIMETabParent;
     nsString mIMECacheText;
     PRUint32 mIMESelectionAnchor;
     PRUint32 mIMESelectionFocus;
     bool mIMEComposing;
     bool mIMECompositionEnding;
--- a/dom/plugins/base/PluginPRLibrary.h
+++ b/dom/plugins/base/PluginPRLibrary.h
@@ -107,28 +107,25 @@ public:
 
     virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
                                        uint64_t maxAge);
     virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
 
     virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
     virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer);
     virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
-    NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
+    virtual bool UseAsyncPainting() MOZ_OVERRIDE { return false; }
 #if defined(XP_MACOSX)
     virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing);
 #endif
-    NS_OVERRIDE
-    virtual nsresult SetBackgroundUnknown(NPP instance);
-    NS_OVERRIDE
+    virtual nsresult SetBackgroundUnknown(NPP instance) MOZ_OVERRIDE;
     virtual nsresult BeginUpdateBackground(NPP instance,
-                                           const nsIntRect&, gfxContext** aCtx);
-    NS_OVERRIDE
+                                           const nsIntRect&, gfxContext** aCtx) MOZ_OVERRIDE;
     virtual nsresult EndUpdateBackground(NPP instance,
-                                         gfxContext* aCtx, const nsIntRect&);
+                                         gfxContext* aCtx, const nsIntRect&) MOZ_OVERRIDE;
 #if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
     virtual nsresult HandleGUIEvent(NPP instance,
                                     const nsGUIEvent& anEvent, bool* handled);
 #endif
 
     virtual void GetLibraryPath(nsACString& aPath) { aPath.Assign(mFilePath); }
 
 private:
--- a/dom/plugins/base/android/ANPNativeWindow.cpp
+++ b/dom/plugins/base/android/ANPNativeWindow.cpp
@@ -1,51 +1,35 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 // must include config.h first for webkit to fiddle with new/delete
 #include <android/log.h>
 #include "AndroidBridge.h"
-#include "AndroidMediaLayer.h"
 #include "ANPBase.h"
 #include "nsIPluginInstanceOwner.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsNPAPIPluginInstance.h"
 #include "gfxRect.h"
 
 using namespace mozilla;
 using namespace mozilla;
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_native_window_##name
 
-static nsresult GetOwner(NPP instance, nsPluginInstanceOwner** owner) {
+static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) {
   nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
-
-  return pinst->GetOwner((nsIPluginInstanceOwner**)owner);
-}
-
-static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) {  
-  nsRefPtr<nsPluginInstanceOwner> owner;
-  if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner))))
-    return NULL;
-
-  ANPNativeWindow window = owner->Layer()->GetNativeWindowForContent();
-  owner->Invalidate();
-
-  return window;
+  return pinst->AcquireContentWindow();
 }
 
 static void anp_native_window_invertPluginContent(NPP instance, bool isContentInverted) {
-  nsRefPtr<nsPluginInstanceOwner> owner;
-  if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner))))
-    return;
-
-  owner->Layer()->SetInverted(isContentInverted);
+  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+  pinst->SetInverted(isContentInverted);
 }
 
 
 void InitNativeWindowInterface(ANPNativeWindowInterfaceV0* i) {
     ASSIGN(i, acquireNativeWindow);
     ASSIGN(i, invertPluginContent);
 }
--- a/dom/plugins/base/android/ANPOpenGL.cpp
+++ b/dom/plugins/base/android/ANPOpenGL.cpp
@@ -3,41 +3,72 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <dlfcn.h>
 #include <android/log.h>
 #include "AndroidBridge.h"
 #include "ANPBase.h"
 #include "GLContextProvider.h"
 #include "nsNPAPIPluginInstance.h"
+#include "nsPluginInstanceOwner.h"
+#include "GLContextProvider.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_opengl_##name
 
 using namespace mozilla;
 using namespace mozilla::gl;
 
-static ANPEGLContext anp_opengl_acquireContext(NPP inst) {
-    // Bug 687267
-    NOT_IMPLEMENTED();
-    return NULL;
+typedef nsNPAPIPluginInstance::TextureInfo TextureInfo;
+
+static ANPEGLContext anp_opengl_acquireContext(NPP instance) {
+    nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+
+    GLContext* context = pinst->GLContext();
+    if (!context)
+        return NULL;
+
+    context->MakeCurrent();
+    return context->GetNativeData(GLContext::NativeGLContext);
 }
 
 static ANPTextureInfo anp_opengl_lockTexture(NPP instance) {
-    ANPTextureInfo info = { 0, 0, 0, 0 };
-    NOT_IMPLEMENTED();
+    nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+
+    TextureInfo pluginInfo = pinst->LockContentTexture();
+
+    ANPTextureInfo info;
+    info.textureId = pluginInfo.mTexture;
+    info.width = pluginInfo.mWidth;
+    info.height = pluginInfo.mHeight;
+
+    // It looks like we should be passing whatever
+    // internal format Flash told us it used previously
+    // (e.g., the value of pluginInfo.mInternalFormat),
+    // but if we do that it doesn't upload to the texture
+    // for some reason.
+    info.internalFormat = 0;
+
     return info;
 }
 
 static void anp_opengl_releaseTexture(NPP instance, const ANPTextureInfo* info) {
-    NOT_IMPLEMENTED();
+    nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+
+    TextureInfo pluginInfo(info->textureId, info->width, info->height, info->internalFormat);
+    pinst->ReleaseContentTexture(pluginInfo);
+    pinst->RedrawPlugin();
 }
 
 static void anp_opengl_invertPluginContent(NPP instance, bool isContentInverted) {
-    NOT_IMPLEMENTED();
+    nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+
+    // Our definition of inverted is the opposite of the plugin's
+    pinst->SetInverted(!isContentInverted);
+    pinst->RedrawPlugin();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 void InitOpenGLInterface(ANPOpenGLInterfaceV0* i) {
     ASSIGN(i, acquireContext);
     ASSIGN(i, lockTexture);
     ASSIGN(i, releaseTexture);
--- a/dom/plugins/base/android/ANPVideo.cpp
+++ b/dom/plugins/base/android/ANPVideo.cpp
@@ -1,77 +1,49 @@
 /* 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/. */
 
 #include <android/log.h>
+#include "AndroidBridge.h"
 #include "ANPBase.h"
-#include "AndroidMediaLayer.h"
 #include "nsIPluginInstanceOwner.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsNPAPIPluginInstance.h"
 #include "gfxRect.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_video_##name
 
 using namespace mozilla;
 
-static nsresult GetOwner(NPP instance, nsPluginInstanceOwner** owner) {
+typedef nsNPAPIPluginInstance::VideoInfo VideoInfo;
+
+static ANPNativeWindow anp_video_acquireNativeWindow(NPP instance) {
   nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
 
-  return pinst->GetOwner((nsIPluginInstanceOwner**)owner);
-}
-
-static AndroidMediaLayer* GetLayerForInstance(NPP instance) {
-  nsRefPtr<nsPluginInstanceOwner> owner;
-  if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner))))
-    return NULL;
-  
-  return owner->Layer();
-}
-
-static void Invalidate(NPP instance) {
-  nsRefPtr<nsPluginInstanceOwner> owner;
-  if (NS_FAILED(GetOwner(instance, getter_AddRefs(owner))))
-    return;
-
-  owner->Invalidate();
-}
-
-static ANPNativeWindow anp_video_acquireNativeWindow(NPP instance) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return NULL;
-
-  return layer->RequestNativeWindowForVideo();
+  return pinst->AcquireVideoWindow();
 }
 
 static void anp_video_setWindowDimensions(NPP instance, const ANPNativeWindow window,
-        const ANPRectF* dimensions) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return;
+                                          const ANPRectF* dimensions) {
+  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
 
   gfxRect rect(dimensions->left, dimensions->top,
                dimensions->right - dimensions->left,
                dimensions->bottom - dimensions->top);
 
-  layer->SetNativeWindowDimensions(window, rect);
-  Invalidate(instance);
+  pinst->SetVideoDimensions(window, rect);
+  pinst->RedrawPlugin();
 }
 
-
 static void anp_video_releaseNativeWindow(NPP instance, ANPNativeWindow window) {
-  AndroidMediaLayer* layer = GetLayerForInstance(instance);
-  if (!layer)
-    return;
-
-  layer->ReleaseNativeWindowForVideo(window);
-  Invalidate(instance);
+  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
+  pinst->ReleaseVideoWindow(window);
+  pinst->RedrawPlugin();
 }
 
 static void anp_video_setFramerateCallback(NPP instance, const ANPNativeWindow window, ANPVideoFrameCallbackProc callback) {
   // Bug 722682
   NOT_IMPLEMENTED();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1994,17 +1994,17 @@ NPError NP_CALLBACK
   case NPNVnetscapeWindow: {
     if (!npp || !npp->ndata)
       return NPERR_INVALID_INSTANCE_ERROR;
 
     nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
 
     nsCOMPtr<nsIPluginInstanceOwner> owner;
     inst->GetOwner(getter_AddRefs(owner));
-    NS_ENSURE_TRUE(owner, nsnull);
+    NS_ENSURE_TRUE(owner, NPERR_NO_ERROR);
 
     if (NS_SUCCEEDED(owner->GetNetscapeWindow(result))) {
       return NPERR_NO_ERROR;
     }
     return NPERR_GENERIC_ERROR;
   }
 #endif
 
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -37,16 +37,24 @@
 #include "ANPBase.h"
 #include <android/log.h>
 #include "android_npapi.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/CondVar.h"
 #include "AndroidBridge.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/Hal.h"
+#include "GLContextProvider.h"
+#include "TexturePoolOGL.h"
+
+using namespace mozilla;
+using namespace mozilla::gl;
+
+typedef nsNPAPIPluginInstance::TextureInfo TextureInfo;
+typedef nsNPAPIPluginInstance::VideoInfo VideoInfo;
 
 class PluginEventRunnable : public nsRunnable
 {
 public:
   PluginEventRunnable(nsNPAPIPluginInstance* instance, ANPEvent* event)
     : mInstance(instance), mEvent(*event), mCanceled(false) {}
 
   virtual nsresult Run() {
@@ -60,35 +68,118 @@ public:
 
   void Cancel() { mCanceled = true; }
 private:
   nsNPAPIPluginInstance* mInstance;
   ANPEvent mEvent;
   bool mCanceled;
 };
 
+static nsRefPtr<GLContext> sPluginContext = nsnull;
+
+static bool EnsureGLContext()
+{
+  if (!sPluginContext) {
+    sPluginContext = GLContextProvider::CreateOffscreen(gfxIntSize(16, 16));
+  }
+
+  return sPluginContext != nsnull;
+}
+
+class SharedPluginTexture {
+public:
+  NS_INLINE_DECL_REFCOUNTING(SharedPluginTexture)
+
+  SharedPluginTexture() :
+    mCurrentHandle(0), mNeedNewImage(false), mLock("SharedPluginTexture.mLock")
+  {
+  }
+
+  ~SharedPluginTexture()
+  {
+    // This will be destroyed in the compositor (as it normally is)
+    mCurrentHandle = nsnull;
+  }
+
+  TextureInfo Lock()
+  {
+    if (!EnsureGLContext()) {
+      mTextureInfo.mTexture = 0;
+      return mTextureInfo;
+    }
+
+    if (!mTextureInfo.mTexture && sPluginContext->MakeCurrent()) {
+      sPluginContext->fGenTextures(1, &mTextureInfo.mTexture);
+    }
+
+    mLock.Lock();
+    return mTextureInfo;
+  }
+
+  void Release(TextureInfo& aTextureInfo)
+  {
+    mNeedNewImage = true;
+ 
+    mTextureInfo = aTextureInfo;
+    mLock.Unlock();
+  } 
+
+  SharedTextureHandle CreateSharedHandle()
+  {
+    MutexAutoLock lock(mLock);
+
+    if (!mNeedNewImage)
+      return mCurrentHandle;
+
+    if (!EnsureGLContext())
+      return nsnull;
+
+    mNeedNewImage = false;
+
+    if (mTextureInfo.mWidth == 0 || mTextureInfo.mHeight == 0)
+      return nsnull;
+
+    mCurrentHandle = sPluginContext->CreateSharedHandle(TextureImage::ThreadShared, (void*)mTextureInfo.mTexture, GLContext::TextureID);
+
+    // We want forget about this now, so delete the texture. Assigning it to zero
+    // ensures that we create a new one in Lock()
+    sPluginContext->fDeleteTextures(1, &mTextureInfo.mTexture);
+    mTextureInfo.mTexture = 0;
+    
+    return mCurrentHandle;
+  }
+
+private:
+  TextureInfo mTextureInfo;
+  SharedTextureHandle mCurrentHandle;
+ 
+  bool mNeedNewImage;
+
+  Mutex mLock;
+};
+
 #endif
 
 using namespace mozilla;
 using namespace mozilla::plugins::parent;
 
 static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
 
 NS_IMPL_THREADSAFE_ISUPPORTS0(nsNPAPIPluginInstance)
 
 nsNPAPIPluginInstance::nsNPAPIPluginInstance()
   :
     mDrawingModel(kDefaultDrawingModel),
 #ifdef MOZ_WIDGET_ANDROID
-    mSurface(nsnull),
     mANPDrawingModel(0),
     mOnScreen(true),
     mFullScreenOrientation(dom::eScreenOrientation_LandscapePrimary),
     mWakeLocked(false),
     mFullScreen(false),
+    mInverted(false),
 #endif
     mRunning(NOT_STARTED),
     mWindowless(false),
     mTransparent(false),
     mCached(false),
     mUsesDOMForCursor(false),
     mInPluginInitCall(false),
     mPlugin(nsnull),
@@ -113,27 +204,35 @@ nsNPAPIPluginInstance::nsNPAPIPluginInst
 nsNPAPIPluginInstance::~nsNPAPIPluginInstance()
 {
   PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance dtor: this=%p\n",this));
 
   if (mMIMEType) {
     PR_Free((void *)mMIMEType);
     mMIMEType = nsnull;
   }
-
-#if MOZ_WIDGET_ANDROID
-  SetWakeLock(false);
-#endif
 }
 
 void
 nsNPAPIPluginInstance::Destroy()
 {
   Stop();
   mPlugin = nsnull;
+
+#if MOZ_WIDGET_ANDROID
+  mContentTexture = nsnull;
+  mContentSurface = nsnull;
+
+  std::map<void*, VideoInfo*>::iterator it;
+  for (it = mVideos.begin(); it != mVideos.end(); it++) {
+    delete it->second;
+  }
+  mVideos.clear();
+  SetWakeLock(false);
+#endif
 }
 
 TimeStamp
 nsNPAPIPluginInstance::StopTime()
 {
   return mStopTime;
 }
 
@@ -767,16 +866,34 @@ void nsNPAPIPluginInstance::NotifyFullSc
   mFullScreen = aFullScreen;
   SendLifecycleEvent(this, mFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
 
   if (mFullScreen && mFullScreenOrientation != dom::eScreenOrientation_None) {
     AndroidBridge::Bridge()->LockScreenOrientation(mFullScreenOrientation);
   }
 }
 
+void nsNPAPIPluginInstance::NotifySize(nsIntSize size)
+{
+  if (kOpenGL_ANPDrawingModel != GetANPDrawingModel() ||
+      size == mCurrentSize)
+    return;
+
+  mCurrentSize = size;
+
+  ANPEvent event;
+  event.inSize = sizeof(ANPEvent);
+  event.eventType = kDraw_ANPEventType;
+  event.data.draw.model = kOpenGL_ANPDrawingModel;
+  event.data.draw.data.surfaceSize.width = size.width;
+  event.data.draw.data.surfaceSize.height = size.height;
+
+  HandleEvent(&event, nsnull);
+}
+
 void nsNPAPIPluginInstance::SetANPDrawingModel(PRUint32 aModel)
 {
   mANPDrawingModel = aModel;
 }
 
 void* nsNPAPIPluginInstance::GetJavaSurface()
 {
   void* surface = nsnull; 
@@ -827,16 +944,132 @@ void nsNPAPIPluginInstance::SetWakeLock(
     return;
 
   mWakeLocked = aLocked;
   hal::ModifyWakeLock(NS_LITERAL_STRING("nsNPAPIPluginInstance"),
                       mWakeLocked ? hal::WAKE_LOCK_ADD_ONE : hal::WAKE_LOCK_REMOVE_ONE,
                       hal::WAKE_LOCK_NO_CHANGE);
 }
 
+void nsNPAPIPluginInstance::EnsureSharedTexture()
+{
+  if (!mContentTexture)
+    mContentTexture = new SharedPluginTexture();
+}
+
+GLContext* nsNPAPIPluginInstance::GLContext()
+{
+  if (!EnsureGLContext())
+    return nsnull;
+
+  return sPluginContext;
+}
+
+TextureInfo nsNPAPIPluginInstance::LockContentTexture()
+{
+  EnsureSharedTexture();
+  return mContentTexture->Lock();
+}
+
+void nsNPAPIPluginInstance::ReleaseContentTexture(TextureInfo& aTextureInfo)
+{
+  EnsureSharedTexture();
+  mContentTexture->Release(aTextureInfo);
+}
+
+nsSurfaceTexture* nsNPAPIPluginInstance::CreateSurfaceTexture()
+{
+  if (!EnsureGLContext())
+    return nsnull;
+
+  GLuint texture = TexturePoolOGL::AcquireTexture();
+  if (!texture)
+    return nsnull;
+
+  nsSurfaceTexture* surface = nsSurfaceTexture::Create(texture);
+  if (!surface)
+    return nsnull;
+
+  nsCOMPtr<nsIRunnable> frameCallback = NS_NewRunnableMethod(this, &nsNPAPIPluginInstance::RedrawPlugin);
+  surface->SetFrameAvailableCallback(frameCallback);
+  return surface;
+}
+
+void* nsNPAPIPluginInstance::AcquireContentWindow()
+{
+  if (!mContentSurface) {
+    mContentSurface = CreateSurfaceTexture();
+
+    if (!mContentSurface)
+      return nsnull;
+  }
+
+  return mContentSurface->GetNativeWindow();
+}
+
+SharedTextureHandle nsNPAPIPluginInstance::CreateSharedHandle()
+{
+  if (mContentTexture) {
+    return mContentTexture->CreateSharedHandle();
+  } else if (mContentSurface) {
+    EnsureGLContext();
+    return sPluginContext->CreateSharedHandle(TextureImage::ThreadShared, mContentSurface, GLContext::SurfaceTexture);
+  } else return nsnull;
+}
+
+void* nsNPAPIPluginInstance::AcquireVideoWindow()
+{
+  nsSurfaceTexture* surface = CreateSurfaceTexture();
+  if (!surface)
+    return nsnull;
+
+  VideoInfo* info = new VideoInfo(surface);
+
+  void* window = info->mSurfaceTexture->GetNativeWindow();
+  mVideos.insert(std::pair<void*, VideoInfo*>(window, info));
+
+  return window;
+}
+
+void nsNPAPIPluginInstance::ReleaseVideoWindow(void* window)
+{
+  std::map<void*, VideoInfo*>::iterator it = mVideos.find(window);
+  if (it == mVideos.end())
+    return;
+
+  delete it->second;
+  mVideos.erase(window);
+}
+
+void nsNPAPIPluginInstance::SetVideoDimensions(void* window, gfxRect aDimensions)
+{
+  std::map<void*, VideoInfo*>::iterator it;
+
+  it = mVideos.find(window);
+  if (it == mVideos.end())
+    return;
+
+  it->second->mDimensions = aDimensions;
+}
+
+void nsNPAPIPluginInstance::GetVideos(nsTArray<VideoInfo*>& aVideos)
+{
+  std::map<void*, VideoInfo*>::iterator it;
+  for (it = mVideos.begin(); it != mVideos.end(); it++)
+    aVideos.AppendElement(it->second);
+}
+
+void nsNPAPIPluginInstance::SetInverted(bool aInverted)
+{
+  if (aInverted == mInverted)
+    return;
+
+  mInverted = aInverted;
+}
+
 #endif
 
 nsresult nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
 {
 #if defined(XP_MACOSX)
   *aModel = (PRInt32)mDrawingModel;
   return NS_OK;
 #else
--- a/dom/plugins/base/nsNPAPIPluginInstance.h
+++ b/dom/plugins/base/nsNPAPIPluginInstance.h
@@ -11,18 +11,23 @@
 #include "nsPIDOMWindow.h"
 #include "nsITimer.h"
 #include "nsIPluginTagInfo.h"
 #include "nsIURI.h"
 #include "nsIChannel.h"
 #include "nsInterfaceHashtable.h"
 #include "nsHashKeys.h"
 #ifdef MOZ_WIDGET_ANDROID
+#include "nsAutoPtr.h"
 #include "nsIRunnable.h"
+#include "GLContext.h"
+#include "nsSurfaceTexture.h"
+#include <map>
 class PluginEventRunnable;
+class SharedPluginTexture;
 #endif
 
 #include "mozilla/TimeStamp.h"
 #include "mozilla/PluginLibrary.h"
 
 struct JSObject;
 
 class nsPluginStreamListenerPeer; // browser-initiated stream class
@@ -119,16 +124,17 @@ public:
   void SetEventModel(NPEventModel aModel);
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
   void NotifyForeground(bool aForeground);
   void NotifyOnScreen(bool aOnScreen);
   void MemoryPressure();
   void NotifyFullScreen(bool aFullScreen);
+  void NotifySize(nsIntSize size);
 
   bool IsOnScreen() {
     return mOnScreen;
   }
 
   PRUint32 GetANPDrawingModel() { return mANPDrawingModel; }
   void SetANPDrawingModel(PRUint32 aModel);
 
@@ -137,16 +143,71 @@ public:
   void PostEvent(void* event);
 
   // These are really mozilla::dom::ScreenOrientation, but it's
   // difficult to include that here
   PRUint32 FullScreenOrientation() { return mFullScreenOrientation; }
   void SetFullScreenOrientation(PRUint32 orientation);
 
   void SetWakeLock(bool aLock);
+
+  mozilla::gl::GLContext* GLContext();
+  
+  // For ANPOpenGL
+  class TextureInfo {
+  public:
+    TextureInfo() :
+      mTexture(0), mWidth(0), mHeight(0), mInternalFormat(0)
+    {
+    }
+
+    TextureInfo(GLuint aTexture, PRInt32 aWidth, PRInt32 aHeight, GLuint aInternalFormat) :
+      mTexture(aTexture), mWidth(aWidth), mHeight(aHeight), mInternalFormat(aInternalFormat)
+    {
+    }
+
+    GLuint mTexture;
+    PRInt32 mWidth;
+    PRInt32 mHeight;
+    GLuint mInternalFormat;
+  };
+
+  TextureInfo LockContentTexture();
+  void ReleaseContentTexture(TextureInfo& aTextureInfo);
+
+  // For ANPNativeWindow
+  void* AcquireContentWindow();
+
+  mozilla::gl::SharedTextureHandle CreateSharedHandle();
+
+  // For ANPVideo
+  class VideoInfo {
+  public:
+    VideoInfo(nsSurfaceTexture* aSurfaceTexture) :
+      mSurfaceTexture(aSurfaceTexture)
+    {
+    }
+
+    ~VideoInfo()
+    {
+      mSurfaceTexture = nsnull;
+    }
+
+    nsRefPtr<nsSurfaceTexture> mSurfaceTexture;
+    gfxRect mDimensions;
+  };
+
+  void* AcquireVideoWindow();
+  void ReleaseVideoWindow(void* aWindow);
+  void SetVideoDimensions(void* aWindow, gfxRect aDimensions);
+
+  void GetVideos(nsTArray<VideoInfo*>& aVideos);
+
+  void SetInverted(bool aInverted);
+  bool Inverted() { return mInverted; }
 #endif
 
   nsresult NewStreamListener(const char* aURL, void* notifyData,
                              nsNPAPIPluginStreamListener** listener);
 
   nsNPAPIPluginInstance();
   virtual ~nsNPAPIPluginInstance();
 
@@ -215,26 +276,29 @@ protected:
   // The structure used to communicate between the plugin instance and
   // the browser.
   NPP_t mNPP;
 
   NPDrawingModel mDrawingModel;
 
 #ifdef MOZ_WIDGET_ANDROID
   PRUint32 mANPDrawingModel;
-  nsCOMPtr<nsIRunnable> mSurfaceGetter;
 
   friend class PluginEventRunnable;
 
   nsTArray<nsCOMPtr<PluginEventRunnable>> mPostedEvents;
   void PopPostedEvent(PluginEventRunnable* r);
 
   PRUint32 mFullScreenOrientation;
   bool mWakeLocked;
   bool mFullScreen;
+  bool mInverted;
+
+  nsRefPtr<SharedPluginTexture> mContentTexture;
+  nsRefPtr<nsSurfaceTexture> mContentSurface;
 #endif
 
   enum {
     NOT_STARTED,
     RUNNING,
     DESTROYING,
     DESTROYED
   } mRunning;
@@ -273,14 +337,19 @@ private:
   void* mCurrentPluginEvent;
 
   // Timestamp for the last time this plugin was stopped.
   // This is only valid when the plugin is actually stopped!
   mozilla::TimeStamp mStopTime;
 
   bool mUsePluginLayersPref;
 #ifdef MOZ_WIDGET_ANDROID
-  void* mSurface;
+  void EnsureSharedTexture();
+  nsSurfaceTexture* CreateSurfaceTexture();
+
+  std::map<void*, VideoInfo*> mVideos;
   bool mOnScreen;
+
+  nsIntSize mCurrentSize;
 #endif
 };
 
 #endif // nsNPAPIPluginInstance_h_
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -584,17 +584,17 @@ nsresult nsPluginHost::GetURL(nsISupport
                               const char* target,
                               nsNPAPIPluginStreamListener* streamListener,
                               const char* altHost,
                               const char* referrer,
                               bool forceJSEnabled)
 {
   return GetURLWithHeaders(static_cast<nsNPAPIPluginInstance*>(pluginInst),
                            url, target, streamListener, altHost, referrer,
-                           forceJSEnabled, nsnull, nsnull);
+                           forceJSEnabled, 0, nsnull);
 }
 
 nsresult nsPluginHost::GetURLWithHeaders(nsNPAPIPluginInstance* pluginInst,
                                          const char* url,
                                          const char* target,
                                          nsNPAPIPluginStreamListener* streamListener,
                                          const char* altHost,
                                          const char* referrer,
@@ -3864,23 +3864,22 @@ CheckForDisabledWindows()
     windowList->HasMoreElements(&haveWindows);
     if (!haveWindows)
       return;
 
     nsCOMPtr<nsISupports> supportsWindow;
     windowList->GetNext(getter_AddRefs(supportsWindow));
     nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(supportsWindow));
     if (baseWin) {
-      bool aFlag;
       nsCOMPtr<nsIWidget> widget;
       baseWin->GetMainWidget(getter_AddRefs(widget));
       if (widget && !widget->GetParent() &&
           widget->IsVisible() &&
-          NS_SUCCEEDED(widget->IsEnabled(&aFlag)) && aFlag == false) {
-        nsIWidget * child = widget->GetFirstChild();
+          !widget->IsEnabled()) {
+        nsIWidget* child = widget->GetFirstChild();
         bool enable = true;
         while (child)  {
           nsWindowType aType;
           if (NS_SUCCEEDED(child->GetWindowType(aType)) &&
               aType == eWindowType_dialog) {
             enable = false;
             break;
           }
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -31,16 +31,17 @@ using mozilla::DefaultXDisplay;
 
 #include "nsPluginInstanceOwner.h"
 #include "nsIRunnable.h"
 #include "nsContentUtils.h"
 #include "nsRect.h"
 #include "nsSize.h"
 #include "nsDisplayList.h"
 #include "ImageLayers.h"
+#include "SharedTextureImage.h"
 #include "nsIDOMEventTarget.h"
 #include "nsObjectFrame.h"
 #include "nsIPluginDocument.h"
 #include "nsIStringStream.h"
 #include "nsNetUtil.h"
 #include "mozilla/Preferences.h"
 #include "nsILinkHandler.h"
 #include "nsIDocShellTreeItem.h"
@@ -79,17 +80,16 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "ANPBase.h"
 #include "AndroidBridge.h"
-#include "AndroidMediaLayer.h"
 #include "nsWindow.h"
 
 static nsPluginInstanceOwner* sFullScreenInstance = nsnull;
 
 using namespace mozilla::dom;
 
 #include <android/log.h>
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
@@ -165,16 +165,48 @@ static void OnDestroyImage(void* aPlugin
   nsPluginInstanceOwner* owner = static_cast<nsPluginInstanceOwner*>(aPluginInstanceOwner);
   NS_IF_RELEASE(owner);
 }
 #endif // XP_MACOSX
 
 already_AddRefed<ImageContainer>
 nsPluginInstanceOwner::GetImageContainer()
 {
+#if MOZ_WIDGET_ANDROID
+  // Right now we only draw with Gecko layers on Honeycomb and higher. See Paint()
+  // for what we do on other versions.
+  if (AndroidBridge::Bridge()->GetAPIVersion() < 11)
+    return NULL;
+  
+  nsRefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
+
+  Image::Format format = Image::SHARED_TEXTURE;
+  nsRefPtr<Image> img = container->CreateImage(&format, 1);
+
+  SharedTextureImage::Data data;
+  data.mHandle = mInstance->CreateSharedHandle();
+  data.mShareType = mozilla::gl::TextureImage::ThreadShared;
+  data.mInverted = mInstance->Inverted();
+
+  gfxRect r = GetPluginRect();
+  data.mSize = gfxIntSize(r.width, r.height);
+
+  SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
+  pluginImage->SetData(data);
+
+  container->SetCurrentImage(img);
+
+  float xResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetXResolution();
+  float yResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetYResolution();
+  r.Scale(xResolution, yResolution);
+  mInstance->NotifySize(nsIntSize(r.width, r.height));
+
+  return container.forget();
+#endif
+
   if (mInstance) {
     nsRefPtr<ImageContainer> container;
     // Every call to nsIPluginInstance::GetImage() creates
     // a new image.  See nsIPluginInstance.idl.
     mInstance->GetImageContainer(getter_AddRefs(container));
     if (container) {
 #ifdef XP_MACOSX
       AutoLockImage autoLock(container);
@@ -301,19 +333,17 @@ nsPluginInstanceOwner::nsPluginInstanceO
   mEventModel = NPEventModelCocoa;
 #endif
   mUseAsyncRendering = false;
 #endif
 
   mWaitingForPaint = false;
 
 #ifdef MOZ_WIDGET_ANDROID
-  mInverted = false;
   mFullScreen = false;
-  mLayer = nsnull;
   mJavaView = nsnull;
 #endif
 }
 
 nsPluginInstanceOwner::~nsPluginInstanceOwner()
 {
   PRInt32 cnt;
 
@@ -1719,36 +1749,16 @@ gfxRect nsPluginInstanceOwner::GetPlugin
 {
   // Get the offset of the content relative to the page
   nsRect bounds = mObjectFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mObjectFrame);
   nsIntRect intBounds = bounds.ToNearestPixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel());
 
   return gfxRect(intBounds);
 }
 
-void nsPluginInstanceOwner::SendSize(int width, int height)
-{
-  if (!mInstance)
-    return;
-
-  PRInt32 model = mInstance->GetANPDrawingModel();
-
-  if (model != kOpenGL_ANPDrawingModel)
-    return;
-
-  ANPEvent event;
-  event.inSize = sizeof(ANPEvent);
-  event.eventType = kDraw_ANPEventType;
-  event.data.draw.model = kOpenGL_ANPDrawingModel;
-  event.data.draw.data.surfaceSize.width = width;
-  event.data.draw.data.surfaceSize.height = height;
-
-  mInstance->HandleEvent(&event, nsnull);
-}
-
 bool nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect /* = gfxRect(0, 0, 0, 0) */)
 {
   if (!mJavaView) {
     mJavaView = mInstance->GetJavaSurface();
   
     if (!mJavaView)
       return false;
 
@@ -1774,16 +1784,56 @@ void nsPluginInstanceOwner::RemovePlugin
 
   AndroidBridge::GetJNIEnv()->DeleteGlobalRef((jobject)mJavaView);
   mJavaView = nsnull;
 
   if (mFullScreen)
     sFullScreenInstance = nsnull;
 }
 
+void nsPluginInstanceOwner::GetVideos(nsTArray<nsNPAPIPluginInstance::VideoInfo*>& aVideos)
+{
+  if (!mInstance)
+    return;
+
+  mInstance->GetVideos(aVideos);
+}
+
+already_AddRefed<ImageContainer> nsPluginInstanceOwner::GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInfo* aVideoInfo)
+{
+  nsRefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
+
+  Image::Format format = Image::SHARED_TEXTURE;
+  nsRefPtr<Image> img = container->CreateImage(&format, 1);
+
+  SharedTextureImage::Data data;
+
+  data.mHandle = mInstance->GLContext()->CreateSharedHandle(gl::TextureImage::ThreadShared, aVideoInfo->mSurfaceTexture, gl::GLContext::SurfaceTexture);
+  data.mShareType = mozilla::gl::TextureImage::ThreadShared;
+  data.mInverted = mInstance->Inverted();
+  data.mSize = gfxIntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
+
+  SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
+  pluginImage->SetData(data);
+  container->SetCurrentImage(img);
+
+  return container.forget();
+}
+
+nsIntRect nsPluginInstanceOwner::GetVisibleRect()
+{
+  gfxRect r = nsIntRect(0, 0, mPluginWindow->width, mPluginWindow->height);
+
+  float xResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetXResolution();
+  float yResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetYResolution();
+  r.Scale(xResolution, yResolution);
+
+  return nsIntRect(r.x, r.y, r.width, r.height);
+}
+
 void nsPluginInstanceOwner::Invalidate() {
   NPRect rect;
   rect.left = rect.top = 0;
   rect.right = mPluginWindow->width;
   rect.bottom = mPluginWindow->height;
   InvalidateRect(&rect);
 }
 
@@ -2751,20 +2801,16 @@ nsPluginInstanceOwner::Destroy()
   mContent->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, true);
   mContent->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, true);
 #if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
   mContent->RemoveEventListener(NS_LITERAL_STRING("text"), this, true);
 #endif
 
 #if MOZ_WIDGET_ANDROID
   RemovePluginView();
-
-  if (mLayer)
-    mLayer->SetVisible(false);
-
 #endif
 
   if (mWidget) {
     if (mPluginWindow) {
       mPluginWindow->SetPluginWidget(nsnull);
     }
 
     nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
@@ -2870,39 +2916,23 @@ void nsPluginInstanceOwner::Paint(gfxCon
                                   const gfxRect& aFrameRect,
                                   const gfxRect& aDirtyRect)
 {
   if (!mInstance || !mObjectFrame || !mPluginDocumentActiveState || mFullScreen)
     return;
 
   PRInt32 model = mInstance->GetANPDrawingModel();
 
-  gfxRect pluginRect = GetPluginRect();
-
   if (model == kSurface_ANPDrawingModel) {
-    if (!AddPluginView(pluginRect)) {
+    if (!AddPluginView(GetPluginRect())) {
       Invalidate();
     }
     return;
   }
 
-  if (model == kOpenGL_ANPDrawingModel) {
-    if (!mLayer)
-      mLayer = new AndroidMediaLayer();
-
-    mLayer->UpdatePosition(pluginRect);
-
-    float xResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetXResolution();
-    float yResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetYResolution();
-    pluginRect.Scale(xResolution, yResolution);
-
-    SendSize((int)pluginRect.width, (int)pluginRect.height);
-    return;
-  }
-
   if (model != kBitmap_ANPDrawingModel)
     return;
 
 #ifdef ANP_BITMAP_DRAWING_MODEL
   static nsRefPtr<gfxImageSurface> pluginSurface;
 
   if (pluginSurface == nsnull ||
       aFrameRect.width  != pluginSurface->Width() ||
@@ -3629,19 +3659,16 @@ nsPluginInstanceOwner::UpdateWindowVisib
 void
 nsPluginInstanceOwner::UpdateDocumentActiveState(bool aIsActive)
 {
   mPluginDocumentActiveState = aIsActive;
   UpdateWindowPositionAndClipRect(true);
 
 #ifdef MOZ_WIDGET_ANDROID
   if (mInstance) {
-    if (mLayer)
-      mLayer->SetVisible(mPluginDocumentActiveState);
-
     if (!mPluginDocumentActiveState)
       RemovePluginView();
 
     mInstance->NotifyOnScreen(mPluginDocumentActiveState);
 
     // This is, perhaps, incorrect. It is supposed to be sent
     // when "the webview has paused or resumed". The side effect
     // is that Flash video players pause or resume (if they were
--- a/dom/plugins/base/nsPluginInstanceOwner.h
+++ b/dom/plugins/base/nsPluginInstanceOwner.h
@@ -46,22 +46,16 @@ class gfxXlibSurface;
 #endif
 
 #ifdef XP_OS2
 #define INCL_PM
 #define INCL_GPI
 #include <os2.h>
 #endif
 
-#ifdef MOZ_WIDGET_ANDROID
-namespace mozilla {
-  class AndroidMediaLayer;
-}
-#endif
-
 // X.h defines KeyPress
 #ifdef KeyPress
 #undef KeyPress
 #endif
 
 class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
                               public nsIPluginTagInfo,
                               public nsIDOMEventListener,
@@ -255,31 +249,21 @@ public:
   // but it takes several hops to get there.
   void SetBackgroundUnknown();
   already_AddRefed<gfxContext> BeginUpdateBackground(const nsIntRect& aRect);
   void EndUpdateBackground(gfxContext* aContext, const nsIntRect& aRect);
   
   bool UseAsyncRendering();
 
 #ifdef MOZ_WIDGET_ANDROID
-  nsIntRect GetVisibleRect() {
-    return nsIntRect(0, 0, mPluginWindow->width, mPluginWindow->height);
-  }
-
-  void SetInverted(bool aInverted) {
-    mInverted = aInverted;
-  }
+  // Returns the image container for the specified VideoInfo
+  void GetVideos(nsTArray<nsNPAPIPluginInstance::VideoInfo*>& aVideos);
+  already_AddRefed<ImageContainer> GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInfo* aVideoInfo);
 
-  bool Inverted() {
-    return mInverted;
-  }
-
-  mozilla::AndroidMediaLayer* Layer() {
-    return mLayer;
-  }
+  nsIntRect GetVisibleRect();
 
   void Invalidate();
 
   void RequestFullScreen();
   void ExitFullScreen();
 
   // Called from AndroidJNI when we removed the fullscreen view.
   static void ExitFullScreen(jobject view);
@@ -292,29 +276,22 @@ private:
   {
     nsIntSize size;
     return NS_SUCCEEDED(mInstance->GetImageSize(&size)) &&
     size == nsIntSize(mPluginWindow->width, mPluginWindow->height);
   }
   
   void FixUpURLS(const nsString &name, nsAString &value);
 #ifdef MOZ_WIDGET_ANDROID
-  void SendSize(int width, int height);
-
   gfxRect GetPluginRect();
   bool AddPluginView(const gfxRect& aRect = gfxRect(0, 0, 0, 0));
   void RemovePluginView();
 
-  bool mInverted;
   bool mFullScreen;
-
   void* mJavaView;
-
-  // For kOpenGL_ANPDrawingModel
-  nsRefPtr<mozilla::AndroidMediaLayer> mLayer;
 #endif 
  
   nsPluginNativeWindow       *mPluginWindow;
   nsRefPtr<nsNPAPIPluginInstance> mInstance;
   nsObjectFrame              *mObjectFrame;
   nsIContent                 *mContent; // WEAK, content owns us
   nsCString                   mDocumentBase;
   char                       *mTagText;
--- a/dom/plugins/ipc/BrowserStreamChild.h
+++ b/dom/plugins/ipc/BrowserStreamChild.h
@@ -25,17 +25,17 @@ public:
                      StreamNotifyChild* notifyData,
                      const nsCString& headers,
                      const nsCString& mimeType,
                      const bool& seekable,
                      NPError* rv,
                      uint16_t* stype);
   virtual ~BrowserStreamChild();
 
-  NS_OVERRIDE virtual bool IsBrowserStream() { return true; }
+  virtual bool IsBrowserStream() MOZ_OVERRIDE { return true; }
 
   NPError StreamConstructed(
             const nsCString& mimeType,
             const bool& seekable,
             uint16_t* stype);
 
   virtual bool RecvWrite(const int32_t& offset,
                          const Buffer& data,
--- a/dom/plugins/ipc/BrowserStreamParent.h
+++ b/dom/plugins/ipc/BrowserStreamParent.h
@@ -19,17 +19,17 @@ class BrowserStreamParent : public PBrow
   friend class PluginModuleParent;
   friend class PluginInstanceParent;
 
 public:
   BrowserStreamParent(PluginInstanceParent* npp,
                       NPStream* stream);
   virtual ~BrowserStreamParent();
 
-  NS_OVERRIDE virtual bool IsBrowserStream() { return true; }
+  virtual bool IsBrowserStream() MOZ_OVERRIDE { return true; }
 
   virtual bool AnswerNPN_RequestRead(const IPCByteRanges& ranges,
                                      NPError* result);
 
   virtual bool RecvNPN_DestroyStream(const NPReason& reason);
 
   virtual bool RecvStreamDestroyed();
 
--- a/dom/plugins/ipc/ChildAsyncCall.h
+++ b/dom/plugins/ipc/ChildAsyncCall.h
@@ -19,18 +19,18 @@ typedef void (*PluginThreadCallback)(voi
 class PluginInstanceChild;
 
 class ChildAsyncCall : public CancelableTask
 {
 public:
   ChildAsyncCall(PluginInstanceChild* instance,
                  PluginThreadCallback aFunc, void* aUserData);
 
-  NS_OVERRIDE void Run();
-  NS_OVERRIDE void Cancel();
+  void Run() MOZ_OVERRIDE;
+  void Cancel() MOZ_OVERRIDE;
   
 protected:
   PluginInstanceChild* mInstance;
   PluginThreadCallback mFunc;
   void* mData;
 
   void RemoveFromAsyncList();
 };
--- a/dom/plugins/ipc/PluginBackgroundDestroyer.h
+++ b/dom/plugins/ipc/PluginBackgroundDestroyer.h
@@ -26,18 +26,17 @@ class PluginBackgroundDestroyerParent : 
 public:
     PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground)
       : mDyingBackground(aDyingBackground)
     { }
 
     virtual ~PluginBackgroundDestroyerParent() { }
 
 private:
-    NS_OVERRIDE
-    virtual void ActorDestroy(ActorDestroyReason why)
+    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
     {
         switch(why) {
         case Deletion:
         case AncestorDeletion:
             if (gfxSharedImageSurface::IsSharedImage(mDyingBackground)) {
                 gfxSharedImageSurface* s =
                     static_cast<gfxSharedImageSurface*>(mDyingBackground.get());
                 DeallocShmem(s->GetShmem());
@@ -59,17 +58,16 @@ private:
  */
 class PluginBackgroundDestroyerChild : public PPluginBackgroundDestroyerChild {
 public:
     PluginBackgroundDestroyerChild() { }
     virtual ~PluginBackgroundDestroyerChild() { }
 
 private:
     // Implementing this for good hygiene.
-    NS_OVERRIDE
-    virtual void ActorDestroy(ActorDestroyReason why)
+    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
     { }
 };
 
 } // namespace plugins
 } // namespace mozilla
 
 #endif  // dom_plugins_PluginBackgroundDestroyer
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
@@ -107,39 +107,37 @@ protected:
         return new PPluginSurfaceChild();
     }
 
     virtual bool DeallocPPluginSurface(PPluginSurfaceChild* s) {
         delete s;
         return true;
     }
 
-    NS_OVERRIDE
     virtual bool
-    AnswerPaint(const NPRemoteEvent& event, int16_t* handled)
+    AnswerPaint(const NPRemoteEvent& event, int16_t* handled) MOZ_OVERRIDE
     {
         PaintTracker pt;
         return AnswerNPP_HandleEvent(event, handled);
     }
 
-    NS_OVERRIDE
     virtual bool
-    RecvWindowPosChanged(const NPRemoteEvent& event);
+    RecvWindowPosChanged(const NPRemoteEvent& event) MOZ_OVERRIDE;
 
     virtual bool
     AnswerNPP_Destroy(NPError* result);
 
     virtual PPluginScriptableObjectChild*
     AllocPPluginScriptableObject();
 
     virtual bool
     DeallocPPluginScriptableObject(PPluginScriptableObjectChild* aObject);
 
-    NS_OVERRIDE virtual bool
-    RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor);
+    virtual bool
+    RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectChild* aActor) MOZ_OVERRIDE;
 
     virtual PBrowserStreamChild*
     AllocPBrowserStream(const nsCString& url,
                         const uint32_t& length,
                         const uint32_t& lastmodified,
                         PStreamNotifyChild* notifyData,
                         const nsCString& headers,
                         const nsCString& mimeType,
@@ -172,18 +170,18 @@ protected:
     DeallocPPluginStream(PPluginStreamChild* stream);
 
     virtual PStreamNotifyChild*
     AllocPStreamNotify(const nsCString& url, const nsCString& target,
                        const bool& post, const nsCString& buffer,
                        const bool& file,
                        NPError* result);
 
-    NS_OVERRIDE virtual bool
-    DeallocPStreamNotify(PStreamNotifyChild* notifyData);
+    virtual bool
+    DeallocPStreamNotify(PStreamNotifyChild* notifyData) MOZ_OVERRIDE;
 
     virtual bool
     AnswerSetPluginFocus();
 
     virtual bool
     AnswerUpdateWindow();
 
     virtual bool
@@ -242,31 +240,27 @@ private:
     NPError
     InternalGetNPObjectForValue(NPNVariable aValue,
                                 NPObject** aObject);
 
     bool IsAsyncDrawing();
 
     NPError DeallocateAsyncBitmapSurface(NPAsyncSurface *aSurface);
 
-    NS_OVERRIDE
     virtual bool RecvUpdateBackground(const SurfaceDescriptor& aBackground,
-                                      const nsIntRect& aRect);
+                                      const nsIntRect& aRect) MOZ_OVERRIDE;
 
-    NS_OVERRIDE
     virtual PPluginBackgroundDestroyerChild*
-    AllocPPluginBackgroundDestroyer();
+    AllocPPluginBackgroundDestroyer() MOZ_OVERRIDE;
 
-    NS_OVERRIDE
     virtual bool
-    RecvPPluginBackgroundDestroyerConstructor(PPluginBackgroundDestroyerChild* aActor);
+    RecvPPluginBackgroundDestroyerConstructor(PPluginBackgroundDestroyerChild* aActor) MOZ_OVERRIDE;
 
-    NS_OVERRIDE
     virtual bool
-    DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerChild* aActor);
+    DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerChild* aActor) MOZ_OVERRIDE;
 
 #if defined(OS_WIN)
     static bool RegisterWindowClass();
     bool CreatePluginWindow();
     void DestroyPluginWindow();
     void ReparentPluginWindow(HWND hWndParent);
     void SizePluginWindow(int width, int height);
     int16_t WinlessHandleEvent(NPEvent& event);
@@ -329,17 +323,17 @@ private:
           : ChildAsyncCall(aInst, nsnull, nsnull),
           mWnd(aWnd),
           mMsg(aMsg),
           mWParam(aWParam),
           mLParam(aLParam),
           mWindowed(isWindowed)
         {}
 
-        NS_OVERRIDE void Run();
+        void Run() MOZ_OVERRIDE;
 
         WNDPROC GetProc();
         HWND GetWnd() { return mWnd; }
         UINT GetMsg() { return mMsg; }
         WPARAM GetWParam() { return mWParam; }
         LPARAM GetLParam() { return mLParam; }
 
       private:
--- a/dom/plugins/ipc/PluginInstanceParent.h
+++ b/dom/plugins/ipc/PluginInstanceParent.h
@@ -48,23 +48,23 @@ public:
                          const nsCString& mimeType,
                          const NPNetscapeFuncs* npniface);
 
     virtual ~PluginInstanceParent();
 
     bool Init();
     NPError Destroy();
 
-    NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
+    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
     virtual PPluginScriptableObjectParent*
     AllocPPluginScriptableObject();
 
-    NS_OVERRIDE virtual bool
-    RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectParent* aActor);
+    virtual bool
+    RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectParent* aActor) MOZ_OVERRIDE;
 
     virtual bool
     DeallocPPluginScriptableObject(PPluginScriptableObjectParent* aObject);
     virtual PBrowserStreamParent*
     AllocPBrowserStream(const nsCString& url,
                         const uint32_t& length,
                         const uint32_t& lastmodified,
                         PStreamNotifyParent* notifyData,
@@ -134,23 +134,23 @@ public:
                       NPError* result);
 
     virtual PStreamNotifyParent*
     AllocPStreamNotify(const nsCString& url, const nsCString& target,
                        const bool& post, const nsCString& buffer,
                        const bool& file,
                        NPError* result);
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
                                    const nsCString& url,
                                    const nsCString& target,
                                    const bool& post, const nsCString& buffer,
                                    const bool& file,
-                                   NPError* result);
+                                   NPError* result) MOZ_OVERRIDE;
 
     virtual bool
     DeallocPStreamNotify(PStreamNotifyParent* notifyData);
 
     virtual bool
     RecvNPN_InvalidateRect(const NPRect& rect);
 
     // Async rendering
@@ -168,58 +168,58 @@ public:
     DeallocPPluginSurface(PPluginSurfaceParent* s);
 
     virtual bool
     AnswerNPN_PushPopupsEnabledState(const bool& aState);
 
     virtual bool
     AnswerNPN_PopPopupsEnabledState();
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     AnswerNPN_GetValueForURL(const NPNURLVariable& variable,
                              const nsCString& url,
-                             nsCString* value, NPError* result);
+                             nsCString* value, NPError* result) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     AnswerNPN_SetValueForURL(const NPNURLVariable& variable,
                              const nsCString& url,
-                             const nsCString& value, NPError* result);
+                             const nsCString& value, NPError* result) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     AnswerNPN_GetAuthenticationInfo(const nsCString& protocol,
                                     const nsCString& host,
                                     const int32_t& port,
                                     const nsCString& scheme,
                                     const nsCString& realm,
                                     nsCString* username,
                                     nsCString* password,
-                                    NPError* result);
+                                    NPError* result) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     AnswerNPN_ConvertPoint(const double& sourceX,
                            const bool&   ignoreDestX,
                            const double& sourceY,
                            const bool&   ignoreDestY,
                            const NPCoordinateSpace& sourceSpace,
                            const NPCoordinateSpace& destSpace,
                            double *destX,
                            double *destY,
-                           bool *result);
+                           bool *result) MOZ_OVERRIDE;
 
     virtual bool
     AnswerNPN_InitAsyncSurface(const gfxIntSize& size,
                                const NPImageFormat& format,
                                NPRemoteAsyncSurface* surfData,
                                bool* result);
 
     virtual bool
     RecvRedrawPlugin();
 
-    NS_OVERRIDE virtual bool
-    RecvNegotiatedCarbon();
+    virtual bool
+    RecvNegotiatedCarbon() MOZ_OVERRIDE;
 
     virtual bool RecvReleaseDXGISharedSurface(const DXGISharedSurfaceHandle &aHandle);
 
     NPError NPP_SetWindow(const NPWindow* aWindow);
 
     NPError NPP_GetValue(NPPVariable variable, void* retval);
     NPError NPP_SetValue(NPNVariable variable, void* value);
 
@@ -287,23 +287,21 @@ private:
     // |aSize|.  Return true if successful.
     bool CreateBackground(const nsIntSize& aSize);
     void DestroyBackground();
     SurfaceDescriptor BackgroundDescriptor() /*const*/;
 
     typedef mozilla::layers::ImageContainer ImageContainer;
     ImageContainer *GetImageContainer();
 
-    NS_OVERRIDE
     virtual PPluginBackgroundDestroyerParent*
-    AllocPPluginBackgroundDestroyer();
+    AllocPPluginBackgroundDestroyer() MOZ_OVERRIDE;
 
-    NS_OVERRIDE
     virtual bool
-    DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerParent* aActor);
+    DeallocPPluginBackgroundDestroyer(PPluginBackgroundDestroyerParent* aActor) MOZ_OVERRIDE;
 
     bool InternalGetValueForNPObject(NPNVariable aVariable,
                                      PPluginScriptableObjectParent** aValue,
                                      NPError* aResult);
 
     bool IsAsyncDrawing();
 
 private:
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -73,25 +73,23 @@ static const int kNestedLoopDetectorInte
 
 class PluginScriptableObjectChild;
 class PluginInstanceChild;
 
 class PluginModuleChild : public PPluginModuleChild
 {
     typedef mozilla::dom::PCrashReporterChild PCrashReporterChild;
 protected:
-    NS_OVERRIDE
     virtual mozilla::ipc::RPCChannel::RacyRPCPolicy
-    MediateRPCRace(const Message& parent, const Message& child)
+    MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
     {
         return MediateRace(parent, child);
     }
 
-    NS_OVERRIDE
-    virtual bool ShouldContinueFromReplyTimeout();
+    virtual bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
 
     // Implement the PPluginModuleChild interface
     virtual bool AnswerNP_GetEntryPoints(NPError* rv);
     virtual bool AnswerNP_Initialize(const uint32_t& aFlags, NPError* rv);
 
     virtual PPluginIdentifierChild*
     AllocPPluginIdentifier(const nsCString& aString,
                            const int32_t& aInt,
@@ -158,18 +156,18 @@ protected:
                                     mozilla::dom::NativeThreadId* id,
                                     PRUint32* processType);
 
     virtual void
     ActorDestroy(ActorDestroyReason why);
 
     MOZ_NORETURN void QuickExit();
 
-    NS_OVERRIDE virtual bool
-    RecvProcessNativeEventsInRPCCall();
+    virtual bool
+    RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE;
 
 public:
     PluginModuleChild();
     virtual ~PluginModuleChild();
 
     // aPluginFilename is UTF8, not native-charset!
     bool Init(const std::string& aPluginFilename,
               base::ProcessHandle aParentProcessHandle,
@@ -305,26 +303,22 @@ private:
     }
     void InitQuirksModes(const nsCString& aMimeType);
     bool InitGraphics();
     void DeinitGraphics();
 #if defined(MOZ_WIDGET_GTK)
     static gboolean DetectNestedEventLoop(gpointer data);
     static gboolean ProcessBrowserEvents(gpointer data);
 
-    NS_OVERRIDE
-    virtual void EnteredCxxStack();
-    NS_OVERRIDE
-    virtual void ExitedCxxStack();
+    virtual void EnteredCxxStack() MOZ_OVERRIDE;
+    virtual void ExitedCxxStack() MOZ_OVERRIDE;
 #elif defined(MOZ_WIDGET_QT)
 
-    NS_OVERRIDE
-    virtual void EnteredCxxStack();
-    NS_OVERRIDE
-    virtual void ExitedCxxStack();
+    virtual void EnteredCxxStack() MOZ_OVERRIDE;
+    virtual void ExitedCxxStack() MOZ_OVERRIDE;
 #endif
 
     PRLibrary* mLibrary;
     nsCString mPluginFilename; // UTF8
     nsCString mUserAgent;
     int mQuirks;
     bool mAsyncDrawingAllowed;
 
@@ -424,20 +418,18 @@ public: // called by PluginInstanceChild
      * associated with that instance.
      */
     void FindNPObjectsForInstance(PluginInstanceChild* instance);
 
 private:
     static PLDHashOperator CollectForInstance(NPObjectData* d, void* userArg);
 
 #if defined(OS_WIN)
-    NS_OVERRIDE
-    virtual void EnteredCall();
-    NS_OVERRIDE
-    virtual void ExitedCall();
+    virtual void EnteredCall() MOZ_OVERRIDE;
+    virtual void ExitedCall() MOZ_OVERRIDE;
 
     // Entered/ExitedCall notifications keep track of whether the plugin has
     // entered a nested event loop within this RPC call.
     struct IncallFrame
     {
         IncallFrame()
             : _spinning(false)
             , _savedNestableTasksAllowed(false)
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -88,22 +88,22 @@ protected:
     virtual bool
     DeallocPPluginInstance(PPluginInstanceParent* aActor);
 
 public:
     // aFilePath is UTF8, not native!
     PluginModuleParent(const char* aFilePath);
     virtual ~PluginModuleParent();
 
-    NS_OVERRIDE virtual void SetPlugin(nsNPAPIPlugin* plugin)
+    virtual void SetPlugin(nsNPAPIPlugin* plugin) MOZ_OVERRIDE
     {
         mPlugin = plugin;
     }
 
-    NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
+    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
     /**
      * LoadModule
      *
      * This may or may not launch a plugin child process,
      * and may or may not be very expensive.
      */
     static PluginLibrary* LoadModule(const char* aFilePath);
@@ -126,81 +126,77 @@ public:
      * Enumerate hook.
      */
     PluginIdentifierParent*
     GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier);
 
     void ProcessRemoteNativeEventsInRPCCall();
 
 protected:
-    NS_OVERRIDE
     virtual mozilla::ipc::RPCChannel::RacyRPCPolicy
-    MediateRPCRace(const Message& parent, const Message& child)
+    MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
     {
         return MediateRace(parent, child);
     }
 
     virtual bool RecvXXX_HACK_FIXME_cjones(Shmem& mem) { NS_RUNTIMEABORT("not reached"); return false; }
 
-    NS_OVERRIDE
-    virtual bool ShouldContinueFromReplyTimeout();
+    virtual bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
 
-    NS_OVERRIDE
     virtual bool
-    RecvBackUpXResources(const FileDescriptor& aXSocketFd);
+    RecvBackUpXResources(const FileDescriptor& aXSocketFd) MOZ_OVERRIDE;
 
     virtual bool
     AnswerNPN_UserAgent(nsCString* userAgent);
 
     virtual bool
     AnswerNPN_GetValue_WithBoolReturn(const NPNVariable& aVariable,
                                       NPError* aError,
                                       bool* aBoolVal);
 
-    NS_OVERRIDE
-    virtual bool AnswerProcessSomeEvents();
+    virtual bool AnswerProcessSomeEvents() MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvProcessNativeEventsInRPCCall();
+    virtual bool
+    RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     RecvPluginShowWindow(const uint32_t& aWindowId, const bool& aModal,
                          const int32_t& aX, const int32_t& aY,
-                         const size_t& aWidth, const size_t& aHeight);
+                         const size_t& aWidth, const size_t& aHeight) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvPluginHideWindow(const uint32_t& aWindowId);
+    virtual bool
+    RecvPluginHideWindow(const uint32_t& aWindowId) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual PCrashReporterParent*
+    virtual PCrashReporterParent*
     AllocPCrashReporter(mozilla::dom::NativeThreadId* id,
-                        PRUint32* processType);
-    NS_OVERRIDE virtual bool
-    DeallocPCrashReporter(PCrashReporterParent* actor);
+                        PRUint32* processType) MOZ_OVERRIDE;
+    virtual bool
+    DeallocPCrashReporter(PCrashReporterParent* actor) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvSetCursor(const NSCursorInfo& aCursorInfo);
+    virtual bool
+    RecvSetCursor(const NSCursorInfo& aCursorInfo) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvShowCursor(const bool& aShow);
+    virtual bool
+    RecvShowCursor(const bool& aShow) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvPushCursor(const NSCursorInfo& aCursorInfo);
+    virtual bool
+    RecvPushCursor(const NSCursorInfo& aCursorInfo) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvPopCursor();
+    virtual bool
+    RecvPopCursor() MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvGetNativeCursorsSupported(bool* supported);
+    virtual bool
+    RecvGetNativeCursorsSupported(bool* supported) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
+    virtual bool
     RecvNPN_SetException(PPluginScriptableObjectParent* aActor,
-                         const nsCString& aMessage);
+                         const nsCString& aMessage) MOZ_OVERRIDE;
 
-    NS_OVERRIDE virtual bool
-    RecvNPN_ReloadPlugins(const bool& aReloadPages);
+    virtual bool
+    RecvNPN_ReloadPlugins(const bool& aReloadPages) MOZ_OVERRIDE;
 
     static PluginInstanceParent* InstCast(NPP instance);
     static BrowserStreamParent* StreamCast(NPP instance, NPStream* s);
 
 private:
     void SetPluginFuncs(NPPluginFuncs* aFuncs);
 
     // Implement the module-level functions from NPAPI; these are
@@ -239,27 +235,24 @@ private:
                                 void *value);
     static void NPP_URLRedirectNotify(NPP instance, const char* url,
                                       int32_t status, void* notifyData);
 
     virtual bool HasRequiredFunctions();
     virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
     virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer);
     virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
-    NS_OVERRIDE virtual bool UseAsyncPainting() { return true; }
-    NS_OVERRIDE
-    virtual nsresult SetBackgroundUnknown(NPP instance);
-    NS_OVERRIDE
+    virtual bool UseAsyncPainting() MOZ_OVERRIDE { return true; }
+    virtual nsresult SetBackgroundUnknown(NPP instance) MOZ_OVERRIDE;
     virtual nsresult BeginUpdateBackground(NPP instance,
                                            const nsIntRect& aRect,
-                                           gfxContext** aCtx);
-    NS_OVERRIDE
+                                           gfxContext** aCtx) MOZ_OVERRIDE;
     virtual nsresult EndUpdateBackground(NPP instance,
                                          gfxContext* aCtx,
-                                         const nsIntRect& aRect);
+                                         const nsIntRect& aRect) MOZ_OVERRIDE;
 
 #if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error);
 #else
     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error);
 #endif
     virtual nsresult NP_Shutdown(NPError* error);
     virtual nsresult NP_GetMIMEDescription(const char** mimeDesc);
@@ -315,17 +308,17 @@ private:
     ScopedClose mPluginXSocketFdDup;
 #endif
 
     friend class mozilla::dom::CrashReporterParent;
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
     void InitializeInjector();
     
-    NS_OVERRIDE void OnCrash(DWORD processID);
+    void OnCrash(DWORD processID) MOZ_OVERRIDE;
 
     DWORD mFlashProcess1;
     DWORD mFlashProcess2;
 #endif
 };
 
 } // namespace plugins
 } // namespace mozilla
--- a/dom/plugins/ipc/PluginProcessChild.h
+++ b/dom/plugins/ipc/PluginProcessChild.h
@@ -20,18 +20,18 @@ protected:
 
 public:
     PluginProcessChild(ProcessHandle parentHandle) : ProcessChild(parentHandle)
     { }
 
     virtual ~PluginProcessChild()
     { }
 
-    NS_OVERRIDE virtual bool Init();
-    NS_OVERRIDE virtual void CleanUp();
+    virtual bool Init() MOZ_OVERRIDE;
+    virtual void CleanUp() MOZ_OVERRIDE;
 
 protected:
     static PluginProcessChild* current() {
         return static_cast<PluginProcessChild*>(ProcessChild::current());
     }
 
 private:
     PluginModuleChild mPlugin;
--- a/dom/plugins/ipc/PluginStreamChild.h
+++ b/dom/plugins/ipc/PluginStreamChild.h
@@ -17,17 +17,17 @@ class PluginInstanceChild;
 class PluginStreamChild : public PPluginStreamChild, public AStream
 {
   friend class PluginInstanceChild;
 
 public:
   PluginStreamChild();
   virtual ~PluginStreamChild() { }
 
-  NS_OVERRIDE virtual bool IsBrowserStream() { return false; }
+  virtual bool IsBrowserStream() MOZ_OVERRIDE { return false; }
 
   virtual bool Answer__delete__(const NPReason& reason,
                                 const bool& artificial);
 
   int32_t NPN_Write(int32_t length, void* buffer);
   void NPP_DestroyStream(NPError reason);
 
   void EnsureCorrectInstance(PluginInstanceChild* i)
--- a/dom/plugins/ipc/PluginStreamParent.h
+++ b/dom/plugins/ipc/PluginStreamParent.h
@@ -19,17 +19,17 @@ class PluginStreamParent : public PPlugi
   friend class PluginModuleParent;
   friend class PluginInstanceParent;
 
 public:
   PluginStreamParent(PluginInstanceParent* npp, const nsCString& mimeType,
                      const nsCString& target, NPError* result);
   virtual ~PluginStreamParent() { }
 
-  NS_OVERRIDE virtual bool IsBrowserStream() { return false; }
+  virtual bool IsBrowserStream() MOZ_OVERRIDE { return false; }
 
   virtual bool AnswerNPN_Write(const Buffer& data, int32_t* written);
 
   virtual bool Answer__delete__(const NPError& reason, const bool& artificial);
 
 private:
   void NPN_DestroyStream(NPReason reason);
 
--- a/dom/plugins/ipc/StreamNotifyChild.h
+++ b/dom/plugins/ipc/StreamNotifyChild.h
@@ -21,26 +21,26 @@ class StreamNotifyChild : public PStream
 
 public:
   StreamNotifyChild(const nsCString& aURL)
     : mURL(aURL)
     , mClosure(NULL)
     , mBrowserStream(NULL)
   { }
 
-  NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
+  virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   void SetValid(void* aClosure) {
     mClosure = aClosure;
   }
 
   void NPP_URLNotify(NPReason reason);
 
 private:
-  NS_OVERRIDE virtual bool Recv__delete__(const NPReason& reason);
+  virtual bool Recv__delete__(const NPReason& reason) MOZ_OVERRIDE;
 
   bool RecvRedirectNotify(const nsCString& url, const int32_t& status);
 
   /**
    * If a stream is created for this this URLNotify, we associate the objects
    * so that the NPP_URLNotify call is not fired before the stream data is
    * completely delivered. The BrowserStreamChild takes responsibility for
    * calling NPP_URLNotify and deleting this object.
--- a/dom/sms/src/ipc/SmsChild.h
+++ b/dom/sms/src/ipc/SmsChild.h
@@ -10,30 +10,30 @@
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
 class SmsChild : public PSmsChild
 {
 public:
-  NS_OVERRIDE virtual bool RecvNotifyReceivedMessage(const SmsMessageData& aMessage);
-  NS_OVERRIDE virtual bool RecvNotifySentMessage(const SmsMessageData& aMessage);
-  NS_OVERRIDE virtual bool RecvNotifyDeliveredMessage(const SmsMessageData& aMessage);
-  NS_OVERRIDE virtual bool RecvNotifyRequestSmsSent(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestSmsSendFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestGotSms(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestGetSmsFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestSmsDeleted(const bool& aDeleted, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestSmsDeleteFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestNoMessageInList(const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestCreateMessageList(const PRInt32& aListId, const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestGotNextMessage(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestReadListFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestMarkedMessageRead(const bool& aRead, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvNotifyRequestMarkMessageReadFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId);
+  virtual bool RecvNotifyReceivedMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
+  virtual bool RecvNotifySentMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
+  virtual bool RecvNotifyDeliveredMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestSmsSent(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestSmsSendFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestGotSms(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestGetSmsFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestSmsDeleted(const bool& aDeleted, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestSmsDeleteFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestNoMessageInList(const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestCreateMessageList(const PRInt32& aListId, const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestGotNextMessage(const SmsMessageData& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestReadListFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestMarkedMessageRead(const bool& aRead, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvNotifyRequestMarkMessageReadFailed(const PRInt32& aError, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
 };
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_sms_SmsChild_h
--- a/dom/sms/src/ipc/SmsParent.h
+++ b/dom/sms/src/ipc/SmsParent.h
@@ -19,27 +19,27 @@ class SmsParent : public PSmsParent
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   static void GetAll(nsTArray<SmsParent*>& aArray);
 
   SmsParent();
 
-  NS_OVERRIDE virtual bool RecvHasSupport(bool* aHasSupport);
-  NS_OVERRIDE virtual bool RecvGetNumberOfMessagesForText(const nsString& aText, PRUint16* aResult);
-  NS_OVERRIDE virtual bool RecvSendMessage(const nsString& aNumber, const nsString& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvSaveReceivedMessage(const nsString& aSender, const nsString& aBody, const PRUint64& aDate, PRInt32* aId);
-  NS_OVERRIDE virtual bool RecvSaveSentMessage(const nsString& aRecipient, const nsString& aBody, const PRUint64& aDate, PRInt32* aId);
-  NS_OVERRIDE virtual bool RecvGetMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvDeleteMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvCreateMessageList(const SmsFilterData& aFilter, const bool& aReverse, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvGetNextMessageInList(const PRInt32& aListId, const PRInt32& aRequestId, const PRUint64& aProcessId);
-  NS_OVERRIDE virtual bool RecvClearMessageList(const PRInt32& aListId);
-  NS_OVERRIDE virtual bool RecvMarkMessageRead(const PRInt32& aMessageId, const bool& aValue, const PRInt32& aRequestId, const PRUint64& aProcessId);
+  virtual bool RecvHasSupport(bool* aHasSupport) MOZ_OVERRIDE;
+  virtual bool RecvGetNumberOfMessagesForText(const nsString& aText, PRUint16* aResult) MOZ_OVERRIDE;
+  virtual bool RecvSendMessage(const nsString& aNumber, const nsString& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvSaveReceivedMessage(const nsString& aSender, const nsString& aBody, const PRUint64& aDate, PRInt32* aId) MOZ_OVERRIDE;
+  virtual bool RecvSaveSentMessage(const nsString& aRecipient, const nsString& aBody, const PRUint64& aDate, PRInt32* aId) MOZ_OVERRIDE;
+  virtual bool RecvGetMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvDeleteMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvCreateMessageList(const SmsFilterData& aFilter, const bool& aReverse, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvGetNextMessageInList(const PRInt32& aListId, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
+  virtual bool RecvClearMessageList(const PRInt32& aListId) MOZ_OVERRIDE;
+  virtual bool RecvMarkMessageRead(const PRInt32& aMessageId, const bool& aValue, const PRInt32& aRequestId, const PRUint64& aProcessId) MOZ_OVERRIDE;
 
 protected: