Merge last green PGO build from mozilla-inbound to mozilla-central
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 04 Jan 2012 13:25:07 +0100
changeset 84955 0eec6ba6a87aa3149854bb7680eff9ac0cb924f4
parent 84897 200a8d1fb4520c923c2b979b201a0a3f31c5f344 (current diff)
parent 84954 06de54d7d7b47bb5bc22ce97d1fbe2da2429f891 (diff)
child 84960 58326f271ab78de6d77d6f08ca6806d6a0b5f84b
child 84978 ebe9f8508d67567f5bd6f1df664b8738421a8d0c
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone12.0a1
Merge last green PGO build from mozilla-inbound to mozilla-central
gfx/thebes/cairo-gdk-utils.c
gfx/thebes/cairo-gdk-utils.h
gfx/thebes/gfxDirectFBSurface.cpp
gfx/thebes/gfxDirectFBSurface.h
gfx/thebes/gfxGlitzSurface.h
gfx/thebes/gfxQuartzPDFSurface.cpp
gfx/thebes/gfxQuartzPDFSurface.h
image/test/reftest/bmp/bmp-8bpp/os2bmp-size-32x32-8bpp.bmp
js/src/analysis-tests/Makefile.in
js/src/analysis-tests/green-accessred.cpp
js/src/analysis-tests/green-callred.cpp
js/src/analysis-tests/green-callredptr.cpp
js/src/analysis-tests/green-tored-badpath.cpp
js/src/analysis-tests/green-tored.cpp
js/src/analysis-tests/green-toredptr.cpp
js/src/analysis-tests/misdeclared-red-funcptr.cpp
js/src/analysis-tests/misdeclared-red-funcptr2.cpp
js/src/analysis-tests/red-accessred.cpp
js/src/analysis-tests/red-callgreen.cpp
js/src/analysis-tests/red-callred.cpp
js/src/analysis-tests/red-togreenptr-arg.cpp
js/src/analysis-tests/red-togreenptr-field.cpp
js/src/analysis-tests/red-togreenptr-initializer-array.cpp
js/src/analysis-tests/red-togreenptr-initializer-cast.cpp
js/src/analysis-tests/red-togreenptr-initializer-nested.cpp
js/src/analysis-tests/red-togreenptr-initializer-struct.cpp
js/src/analysis-tests/red-togreenptr-initializer.cpp
js/src/analysis-tests/red-togreenptr-return.cpp
js/src/analysis-tests/red-togreenptr.cpp
toolkit/components/aboutmemory/tests/test_asyncClose_leak.xul
widget/public/LookAndFeel.h
widget/public/Makefile.in
widget/public/WidgetTraceEvent.h
widget/public/nsEvent.h
widget/public/nsGUIEvent.h
widget/public/nsGUIEventIPC.h
widget/public/nsIAppShell.idl
widget/public/nsIBaseWindow.idl
widget/public/nsIBidiKeyboard.idl
widget/public/nsIClipboard.idl
widget/public/nsIClipboardDragDropHookList.idl
widget/public/nsIClipboardDragDropHooks.idl
widget/public/nsIClipboardHelper.idl
widget/public/nsIClipboardOwner.idl
widget/public/nsIDeviceContextSpec.h
widget/public/nsIDragService.idl
widget/public/nsIDragSession.idl
widget/public/nsIDragSessionGTK.h
widget/public/nsIDragSessionOS2.h
widget/public/nsIFilePicker.idl
widget/public/nsIFormatConverter.idl
widget/public/nsIGfxInfo.idl
widget/public/nsIGfxInfoDebug.idl
widget/public/nsIIMEPicker.idl
widget/public/nsIIdleService.idl
widget/public/nsIJumpListBuilder.idl
widget/public/nsIJumpListItem.idl
widget/public/nsIMacDockSupport.idl
widget/public/nsINativeKeyBindings.h
widget/public/nsINativeMenuService.h
widget/public/nsIPluginWidget.h
widget/public/nsIPrintDialogService.h
widget/public/nsIPrintOptions.idl
widget/public/nsIPrintSession.idl
widget/public/nsIPrintSettings.idl
widget/public/nsIPrintSettingsService.idl
widget/public/nsIPrintSettingsWin.idl
widget/public/nsIRollupListener.h
widget/public/nsIRwsService.idl
widget/public/nsIScreen.idl
widget/public/nsIScreenManager.idl
widget/public/nsISound.idl
widget/public/nsIStandaloneNativeMenu.idl
widget/public/nsITaskbarOverlayIconController.idl
widget/public/nsITaskbarPreview.idl
widget/public/nsITaskbarPreviewButton.idl
widget/public/nsITaskbarPreviewController.idl
widget/public/nsITaskbarProgress.idl
widget/public/nsITaskbarTabPreview.idl
widget/public/nsITaskbarWindowPreview.idl
widget/public/nsITransferable.idl
widget/public/nsIWidget.h
widget/public/nsIWinTaskbar.idl
widget/public/nsNativeWidget.h
widget/public/nsWidgetInitData.h
widget/public/nsWidgetsCID.h
widget/src/Makefile.in
widget/src/android/AndroidBridge.cpp
widget/src/android/AndroidBridge.h
widget/src/android/AndroidDirectTexture.cpp
widget/src/android/AndroidDirectTexture.h
widget/src/android/AndroidGraphicBuffer.cpp
widget/src/android/AndroidGraphicBuffer.h
widget/src/android/AndroidJNI.cpp
widget/src/android/AndroidJavaWrappers.cpp
widget/src/android/AndroidJavaWrappers.h
widget/src/android/GfxInfo.cpp
widget/src/android/GfxInfo.h
widget/src/android/Makefile.in
widget/src/android/nsAppShell.cpp
widget/src/android/nsAppShell.h
widget/src/android/nsClipboard.cpp
widget/src/android/nsClipboard.h
widget/src/android/nsDeviceContextAndroid.cpp
widget/src/android/nsDeviceContextAndroid.h
widget/src/android/nsFilePicker.cpp
widget/src/android/nsFilePicker.h
widget/src/android/nsIAndroidBridge.idl
widget/src/android/nsIMEPicker.cpp
widget/src/android/nsIMEPicker.h
widget/src/android/nsIdleServiceAndroid.cpp
widget/src/android/nsIdleServiceAndroid.h
widget/src/android/nsLookAndFeel.cpp
widget/src/android/nsLookAndFeel.h
widget/src/android/nsPrintOptionsAndroid.cpp
widget/src/android/nsPrintOptionsAndroid.h
widget/src/android/nsScreenManagerAndroid.cpp
widget/src/android/nsScreenManagerAndroid.h
widget/src/android/nsWidgetFactory.cpp
widget/src/android/nsWindow.cpp
widget/src/android/nsWindow.h
widget/src/build/Makefile.in
widget/src/build/nsWinWidgetFactory.cpp
widget/src/build/res/aliasb.cur
widget/src/build/res/cell.cur
widget/src/build/res/col_resize.cur
widget/src/build/res/copy.cur
widget/src/build/res/grab.cur
widget/src/build/res/grabbing.cur
widget/src/build/res/none.cur
widget/src/build/res/row_resize.cur
widget/src/build/res/select.cur
widget/src/build/res/vertical_text.cur
widget/src/build/res/zoom_in.cur
widget/src/build/res/zoom_out.cur
widget/src/build/widget.rc
widget/src/cocoa/ComplexTextInputPanel.h
widget/src/cocoa/ComplexTextInputPanel.mm
widget/src/cocoa/CustomCocoaEvents.h
widget/src/cocoa/GfxInfo.h
widget/src/cocoa/GfxInfo.mm
widget/src/cocoa/Makefile.in
widget/src/cocoa/TextInputHandler.h
widget/src/cocoa/TextInputHandler.mm
widget/src/cocoa/WidgetTraceEvent.mm
widget/src/cocoa/crashtests/373122-1-inner.html
widget/src/cocoa/crashtests/373122-1.html
widget/src/cocoa/crashtests/397209-1.html
widget/src/cocoa/crashtests/403296-1.xhtml
widget/src/cocoa/crashtests/419737-1.html
widget/src/cocoa/crashtests/435223-1.html
widget/src/cocoa/crashtests/444260-1.xul
widget/src/cocoa/crashtests/444864-1.html
widget/src/cocoa/crashtests/449111-1.html
widget/src/cocoa/crashtests/460349-1.xhtml
widget/src/cocoa/crashtests/460387-1.html
widget/src/cocoa/crashtests/464589-1.html
widget/src/cocoa/crashtests/crashtests.list
widget/src/cocoa/cursors/arrowN.tiff
widget/src/cocoa/cursors/arrowS.tiff
widget/src/cocoa/cursors/colResize.tiff
widget/src/cocoa/cursors/help.tiff
widget/src/cocoa/cursors/rowResize.tiff
widget/src/cocoa/cursors/sizeNE.tiff
widget/src/cocoa/cursors/sizeNESW.tiff
widget/src/cocoa/cursors/sizeNS.tiff
widget/src/cocoa/cursors/sizeNW.tiff
widget/src/cocoa/cursors/sizeNWSE.tiff
widget/src/cocoa/cursors/sizeSE.tiff
widget/src/cocoa/cursors/sizeSW.tiff
widget/src/cocoa/cursors/spin1.tiff
widget/src/cocoa/cursors/spin2.tiff
widget/src/cocoa/cursors/spin3.tiff
widget/src/cocoa/cursors/spin4.tiff
widget/src/cocoa/cursors/vtIBeam.tiff
widget/src/cocoa/cursors/zoomIn.tiff
widget/src/cocoa/cursors/zoomOut.tiff
widget/src/cocoa/mozView.h
widget/src/cocoa/nsAppShell.h
widget/src/cocoa/nsAppShell.mm
widget/src/cocoa/nsBidiKeyboard.h
widget/src/cocoa/nsBidiKeyboard.mm
widget/src/cocoa/nsChangeObserver.h
widget/src/cocoa/nsChildView.h
widget/src/cocoa/nsChildView.mm
widget/src/cocoa/nsClipboard.h
widget/src/cocoa/nsClipboard.mm
widget/src/cocoa/nsCocoaFeatures.h
widget/src/cocoa/nsCocoaFeatures.mm
widget/src/cocoa/nsCocoaUtils.h
widget/src/cocoa/nsCocoaUtils.mm
widget/src/cocoa/nsCocoaWindow.h
widget/src/cocoa/nsCocoaWindow.mm
widget/src/cocoa/nsCursorManager.h
widget/src/cocoa/nsCursorManager.mm
widget/src/cocoa/nsDeviceContextSpecX.h
widget/src/cocoa/nsDeviceContextSpecX.mm
widget/src/cocoa/nsDragService.h
widget/src/cocoa/nsDragService.mm
widget/src/cocoa/nsFilePicker.h
widget/src/cocoa/nsFilePicker.mm
widget/src/cocoa/nsIdleServiceX.h
widget/src/cocoa/nsIdleServiceX.mm
widget/src/cocoa/nsLookAndFeel.h
widget/src/cocoa/nsLookAndFeel.mm
widget/src/cocoa/nsMacCursor.h
widget/src/cocoa/nsMacCursor.mm
widget/src/cocoa/nsMacDockSupport.h
widget/src/cocoa/nsMacDockSupport.mm
widget/src/cocoa/nsMenuBarX.h
widget/src/cocoa/nsMenuBarX.mm
widget/src/cocoa/nsMenuBaseX.h
widget/src/cocoa/nsMenuGroupOwnerX.h
widget/src/cocoa/nsMenuGroupOwnerX.mm
widget/src/cocoa/nsMenuItemIconX.h
widget/src/cocoa/nsMenuItemIconX.mm
widget/src/cocoa/nsMenuItemX.h
widget/src/cocoa/nsMenuItemX.mm
widget/src/cocoa/nsMenuUtilsX.h
widget/src/cocoa/nsMenuUtilsX.mm
widget/src/cocoa/nsMenuX.h
widget/src/cocoa/nsMenuX.mm
widget/src/cocoa/nsNativeThemeCocoa.h
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/cocoa/nsNativeThemeColors.h
widget/src/cocoa/nsPIWidgetCocoa.idl
widget/src/cocoa/nsPrintDialogX.h
widget/src/cocoa/nsPrintDialogX.mm
widget/src/cocoa/nsPrintOptionsX.h
widget/src/cocoa/nsPrintOptionsX.mm
widget/src/cocoa/nsPrintSettingsX.h
widget/src/cocoa/nsPrintSettingsX.mm
widget/src/cocoa/nsScreenCocoa.h
widget/src/cocoa/nsScreenCocoa.mm
widget/src/cocoa/nsScreenManagerCocoa.h
widget/src/cocoa/nsScreenManagerCocoa.mm
widget/src/cocoa/nsSound.h
widget/src/cocoa/nsSound.mm
widget/src/cocoa/nsStandaloneNativeMenu.h
widget/src/cocoa/nsStandaloneNativeMenu.mm
widget/src/cocoa/nsToolkit.h
widget/src/cocoa/nsToolkit.mm
widget/src/cocoa/nsWidgetFactory.mm
widget/src/cocoa/nsWindowMap.h
widget/src/cocoa/nsWindowMap.mm
widget/src/cocoa/resources/MainMenu.nib/classes.nib
widget/src/cocoa/resources/MainMenu.nib/info.nib
widget/src/cocoa/resources/MainMenu.nib/keyedobjects.nib
widget/src/crashtests/303901-1.html
widget/src/crashtests/303901-2.html
widget/src/crashtests/380359-1.xhtml
widget/src/crashtests/crashtests.list
widget/src/gonk/Framebuffer.cpp
widget/src/gonk/Framebuffer.h
widget/src/gonk/Makefile.in
widget/src/gonk/nsAppShell.cpp
widget/src/gonk/nsAppShell.h
widget/src/gonk/nsLookAndFeel.cpp
widget/src/gonk/nsLookAndFeel.h
widget/src/gonk/nsScreenManagerGonk.cpp
widget/src/gonk/nsScreenManagerGonk.h
widget/src/gonk/nsWidgetFactory.cpp
widget/src/gonk/nsWindow.cpp
widget/src/gonk/nsWindow.h
widget/src/gtk2/Makefile.in
widget/src/gtk2/WidgetTraceEvent.cpp
widget/src/gtk2/crashtests/673390-1.html
widget/src/gtk2/crashtests/crashtests.list
widget/src/gtk2/gtk2compat.h
widget/src/gtk2/gtk2drawing.c
widget/src/gtk2/gtkdrawing.h
widget/src/gtk2/maiRedundantObjectFactory.c
widget/src/gtk2/maiRedundantObjectFactory.h
widget/src/gtk2/mozcontainer.c
widget/src/gtk2/mozcontainer.h
widget/src/gtk2/nsAppShell.cpp
widget/src/gtk2/nsAppShell.h
widget/src/gtk2/nsBidiKeyboard.cpp
widget/src/gtk2/nsBidiKeyboard.h
widget/src/gtk2/nsCUPSShim.cpp
widget/src/gtk2/nsCUPSShim.h
widget/src/gtk2/nsClipboard.cpp
widget/src/gtk2/nsClipboard.h
widget/src/gtk2/nsDeviceContextSpecG.cpp
widget/src/gtk2/nsDeviceContextSpecG.h
widget/src/gtk2/nsDragService.cpp
widget/src/gtk2/nsDragService.h
widget/src/gtk2/nsFilePicker.cpp
widget/src/gtk2/nsFilePicker.h
widget/src/gtk2/nsGTKToolkit.h
widget/src/gtk2/nsGtkCursors.h
widget/src/gtk2/nsGtkIMModule.cpp
widget/src/gtk2/nsGtkIMModule.h
widget/src/gtk2/nsGtkKeyUtils.cpp
widget/src/gtk2/nsGtkKeyUtils.h
widget/src/gtk2/nsIImageToPixbuf.h
widget/src/gtk2/nsIdleServiceGTK.cpp
widget/src/gtk2/nsIdleServiceGTK.h
widget/src/gtk2/nsImageToPixbuf.cpp
widget/src/gtk2/nsImageToPixbuf.h
widget/src/gtk2/nsLookAndFeel.cpp
widget/src/gtk2/nsLookAndFeel.h
widget/src/gtk2/nsNativeKeyBindings.cpp
widget/src/gtk2/nsNativeKeyBindings.h
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/gtk2/nsNativeThemeGTK.h
widget/src/gtk2/nsPSPrinters.cpp
widget/src/gtk2/nsPSPrinters.h
widget/src/gtk2/nsPaperPS.cpp
widget/src/gtk2/nsPaperPS.h
widget/src/gtk2/nsPrintDialogGTK.cpp
widget/src/gtk2/nsPrintDialogGTK.h
widget/src/gtk2/nsPrintOptionsGTK.cpp
widget/src/gtk2/nsPrintOptionsGTK.h
widget/src/gtk2/nsPrintSettingsGTK.cpp
widget/src/gtk2/nsPrintSettingsGTK.h
widget/src/gtk2/nsScreenGtk.cpp
widget/src/gtk2/nsScreenGtk.h
widget/src/gtk2/nsScreenManagerGtk.cpp
widget/src/gtk2/nsScreenManagerGtk.h
widget/src/gtk2/nsSound.cpp
widget/src/gtk2/nsSound.h
widget/src/gtk2/nsToolkit.cpp
widget/src/gtk2/nsWidgetFactory.cpp
widget/src/gtk2/nsWindow.cpp
widget/src/gtk2/nsWindow.h
widget/src/gtkxtbin/Makefile.in
widget/src/gtkxtbin/gtk2xtbin.c
widget/src/gtkxtbin/gtk2xtbin.h
widget/src/gtkxtbin/xembed.h
widget/src/os2/Makefile.in
widget/src/os2/MozSounds.cmd
widget/src/os2/README.firefox
widget/src/os2/README.seamonkey
widget/src/os2/README.thunderbird
widget/src/os2/nsAppShell.cpp
widget/src/os2/nsAppShell.h
widget/src/os2/nsBidiKeyboard.cpp
widget/src/os2/nsBidiKeyboard.h
widget/src/os2/nsClipboard.cpp
widget/src/os2/nsClipboard.h
widget/src/os2/nsDeviceContextSpecOS2.cpp
widget/src/os2/nsDeviceContextSpecOS2.h
widget/src/os2/nsDragService.cpp
widget/src/os2/nsDragService.h
widget/src/os2/nsFilePicker.cpp
widget/src/os2/nsFilePicker.h
widget/src/os2/nsGfxDefs.h
widget/src/os2/nsIdleServiceOS2.cpp
widget/src/os2/nsIdleServiceOS2.h
widget/src/os2/nsLookAndFeel.cpp
widget/src/os2/nsLookAndFeel.h
widget/src/os2/nsOS2Uni.cpp
widget/src/os2/nsOS2Uni.h
widget/src/os2/nsPrintOS2.cpp
widget/src/os2/nsPrintOS2.h
widget/src/os2/nsPrintOptionsOS2.cpp
widget/src/os2/nsPrintOptionsOS2.h
widget/src/os2/nsPrintdOS2.h
widget/src/os2/nsRwsService.cpp
widget/src/os2/nsRwsService.h
widget/src/os2/nsScreenManagerOS2.cpp
widget/src/os2/nsScreenManagerOS2.h
widget/src/os2/nsScreenOS2.cpp
widget/src/os2/nsScreenOS2.h
widget/src/os2/nsSound.cpp
widget/src/os2/nsSound.h
widget/src/os2/nsWidgetFactory.cpp
widget/src/os2/nsWindow.cpp
widget/src/os2/nsWindow.h
widget/src/os2/os2FrameWindow.cpp
widget/src/os2/os2FrameWindow.h
widget/src/os2/res/aliasb.ptr
widget/src/os2/res/arrow_wait.ptr
widget/src/os2/res/cell.ptr
widget/src/os2/res/col_resize.ptr
widget/src/os2/res/copy.ptr
widget/src/os2/res/crosshair.ptr
widget/src/os2/res/dndtext.ico
widget/src/os2/res/dndurl.ico
widget/src/os2/res/grab.ptr
widget/src/os2/res/grabbing.ptr
widget/src/os2/res/help.ptr
widget/src/os2/res/none.ptr
widget/src/os2/res/row_resize.ptr
widget/src/os2/res/select.ptr
widget/src/os2/res/vertical_text.ptr
widget/src/os2/res/zoom_in.ptr
widget/src/os2/res/zoom_out.ptr
widget/src/os2/rws.h
widget/src/os2/rwserr.h
widget/src/os2/wdgtos2rc.h
widget/src/os2/widget.rc
widget/src/qt/Makefile.in
widget/src/qt/faststartupqt/Makefile.in
widget/src/qt/faststartupqt/mozqwidgetfast.cpp
widget/src/qt/faststartupqt/mozqwidgetfast.h
widget/src/qt/faststartupqt/nsFastStartupQt.cpp
widget/src/qt/faststartupqt/nsFastStartupQt.h
widget/src/qt/mozSwipeGesture.cpp
widget/src/qt/mozSwipeGesture.h
widget/src/qt/moziqwidget.h
widget/src/qt/mozqorientationsensorfilter.cpp
widget/src/qt/mozqorientationsensorfilter.h
widget/src/qt/mozqwidget.cpp
widget/src/qt/mozqwidget.h
widget/src/qt/nsAppShell.cpp
widget/src/qt/nsAppShell.h
widget/src/qt/nsBidiKeyboard.cpp
widget/src/qt/nsBidiKeyboard.h
widget/src/qt/nsClipboard.cpp
widget/src/qt/nsClipboard.h
widget/src/qt/nsCommonWidget.cpp
widget/src/qt/nsCommonWidget.h
widget/src/qt/nsDeviceContextSpecQt.cpp
widget/src/qt/nsDeviceContextSpecQt.h
widget/src/qt/nsDragService.cpp
widget/src/qt/nsDragService.h
widget/src/qt/nsFilePicker.cpp
widget/src/qt/nsFilePicker.h
widget/src/qt/nsIdleServiceQt.cpp
widget/src/qt/nsIdleServiceQt.h
widget/src/qt/nsLookAndFeel.cpp
widget/src/qt/nsLookAndFeel.h
widget/src/qt/nsMFilePicker.cpp
widget/src/qt/nsMFilePicker.h
widget/src/qt/nsNativeThemeQt.cpp
widget/src/qt/nsNativeThemeQt.h
widget/src/qt/nsPrintDialogQt.cpp
widget/src/qt/nsPrintDialogQt.h
widget/src/qt/nsPrintOptionsQt.cpp
widget/src/qt/nsPrintOptionsQt.h
widget/src/qt/nsPrintSettingsQt.cpp
widget/src/qt/nsPrintSettingsQt.h
widget/src/qt/nsQtKeyUtils.cpp
widget/src/qt/nsQtKeyUtils.h
widget/src/qt/nsScreenManagerQt.cpp
widget/src/qt/nsScreenManagerQt.h
widget/src/qt/nsScreenQt.cpp
widget/src/qt/nsScreenQt.h
widget/src/qt/nsSound.cpp
widget/src/qt/nsSound.h
widget/src/qt/nsWidgetFactory.cpp
widget/src/qt/nsWindow.cpp
widget/src/qt/nsWindow.h
widget/src/shared/Makefile.in
widget/src/shared/WidgetUtils.cpp
widget/src/shared/WidgetUtils.h
widget/src/shared/nsShmImage.cpp
widget/src/shared/nsShmImage.h
widget/src/shared/x11/Makefile.in
widget/src/shared/x11/keysym2ucs.c
widget/src/shared/x11/keysym2ucs.h
widget/src/windows/AudioSession.cpp
widget/src/windows/AudioSession.h
widget/src/windows/GfxInfo.cpp
widget/src/windows/GfxInfo.h
widget/src/windows/IEnumFE.cpp
widget/src/windows/IEnumFE.h
widget/src/windows/JumpListBuilder.cpp
widget/src/windows/JumpListBuilder.h
widget/src/windows/JumpListItem.cpp
widget/src/windows/JumpListItem.h
widget/src/windows/KeyboardLayout.cpp
widget/src/windows/KeyboardLayout.h
widget/src/windows/LSPAnnotator.cpp
widget/src/windows/Makefile.in
widget/src/windows/TaskbarPreview.cpp
widget/src/windows/TaskbarPreview.h
widget/src/windows/TaskbarPreviewButton.cpp
widget/src/windows/TaskbarPreviewButton.h
widget/src/windows/TaskbarTabPreview.cpp
widget/src/windows/TaskbarTabPreview.h
widget/src/windows/TaskbarWindowPreview.cpp
widget/src/windows/TaskbarWindowPreview.h
widget/src/windows/WidgetTraceEvent.cpp
widget/src/windows/WinTaskbar.cpp
widget/src/windows/WinTaskbar.h
widget/src/windows/WindowHook.cpp
widget/src/windows/WindowHook.h
widget/src/windows/nsAppShell.cpp
widget/src/windows/nsAppShell.h
widget/src/windows/nsBidiKeyboard.cpp
widget/src/windows/nsBidiKeyboard.h
widget/src/windows/nsClipboard.cpp
widget/src/windows/nsClipboard.h
widget/src/windows/nsDataObj.cpp
widget/src/windows/nsDataObj.h
widget/src/windows/nsDataObjCollection.cpp
widget/src/windows/nsDataObjCollection.h
widget/src/windows/nsDeviceContextSpecWin.cpp
widget/src/windows/nsDeviceContextSpecWin.h
widget/src/windows/nsDragService.cpp
widget/src/windows/nsDragService.h
widget/src/windows/nsFilePicker.cpp
widget/src/windows/nsFilePicker.h
widget/src/windows/nsIMM32Handler.cpp
widget/src/windows/nsIMM32Handler.h
widget/src/windows/nsIdleServiceWin.cpp
widget/src/windows/nsIdleServiceWin.h
widget/src/windows/nsImageClipboard.cpp
widget/src/windows/nsImageClipboard.h
widget/src/windows/nsLookAndFeel.cpp
widget/src/windows/nsLookAndFeel.h
widget/src/windows/nsNativeDragSource.cpp
widget/src/windows/nsNativeDragSource.h
widget/src/windows/nsNativeDragTarget.cpp
widget/src/windows/nsNativeDragTarget.h
widget/src/windows/nsNativeThemeWin.cpp
widget/src/windows/nsNativeThemeWin.h
widget/src/windows/nsPrintOptionsWin.cpp
widget/src/windows/nsPrintOptionsWin.h
widget/src/windows/nsPrintSettingsWin.cpp
widget/src/windows/nsPrintSettingsWin.h
widget/src/windows/nsScreenManagerWin.cpp
widget/src/windows/nsScreenManagerWin.h
widget/src/windows/nsScreenWin.cpp
widget/src/windows/nsScreenWin.h
widget/src/windows/nsSound.cpp
widget/src/windows/nsSound.h
widget/src/windows/nsTextStore.cpp
widget/src/windows/nsTextStore.h
widget/src/windows/nsToolkit.cpp
widget/src/windows/nsToolkit.h
widget/src/windows/nsUXThemeConstants.h
widget/src/windows/nsUXThemeData.cpp
widget/src/windows/nsUXThemeData.h
widget/src/windows/nsWinGesture.cpp
widget/src/windows/nsWinGesture.h
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
widget/src/windows/nsWindowDbg.cpp
widget/src/windows/nsWindowDbg.h
widget/src/windows/nsWindowDefs.h
widget/src/windows/nsWindowGfx.cpp
widget/src/windows/nsWindowGfx.h
widget/src/windows/nsdefs.h
widget/src/windows/resource.h
widget/src/windows/tests/Makefile.in
widget/src/windows/tests/TestWinDND.cpp
widget/src/xpwidgets/GfxDriverInfo.cpp
widget/src/xpwidgets/GfxDriverInfo.h
widget/src/xpwidgets/GfxInfoBase.cpp
widget/src/xpwidgets/GfxInfoBase.h
widget/src/xpwidgets/GfxInfoCollector.h
widget/src/xpwidgets/GfxInfoWebGL.cpp
widget/src/xpwidgets/GfxInfoWebGL.h
widget/src/xpwidgets/GfxInfoX11.cpp
widget/src/xpwidgets/GfxInfoX11.h
widget/src/xpwidgets/Makefile.in
widget/src/xpwidgets/PuppetWidget.cpp
widget/src/xpwidgets/PuppetWidget.h
widget/src/xpwidgets/nsAppShellSingleton.h
widget/src/xpwidgets/nsBaseAppShell.cpp
widget/src/xpwidgets/nsBaseAppShell.h
widget/src/xpwidgets/nsBaseClipboard.cpp
widget/src/xpwidgets/nsBaseClipboard.h
widget/src/xpwidgets/nsBaseDragService.cpp
widget/src/xpwidgets/nsBaseDragService.h
widget/src/xpwidgets/nsBaseFilePicker.cpp
widget/src/xpwidgets/nsBaseFilePicker.h
widget/src/xpwidgets/nsBaseWidget.cpp
widget/src/xpwidgets/nsBaseWidget.h
widget/src/xpwidgets/nsClipboardHelper.cpp
widget/src/xpwidgets/nsClipboardHelper.h
widget/src/xpwidgets/nsClipboardPrivacyHandler.cpp
widget/src/xpwidgets/nsClipboardPrivacyHandler.h
widget/src/xpwidgets/nsFilePickerProxy.cpp
widget/src/xpwidgets/nsFilePickerProxy.h
widget/src/xpwidgets/nsHTMLFormatConverter.cpp
widget/src/xpwidgets/nsHTMLFormatConverter.h
widget/src/xpwidgets/nsIdleService.cpp
widget/src/xpwidgets/nsIdleService.h
widget/src/xpwidgets/nsNativeTheme.cpp
widget/src/xpwidgets/nsNativeTheme.h
widget/src/xpwidgets/nsPrimitiveHelpers.cpp
widget/src/xpwidgets/nsPrimitiveHelpers.h
widget/src/xpwidgets/nsPrintOptionsImpl.cpp
widget/src/xpwidgets/nsPrintOptionsImpl.h
widget/src/xpwidgets/nsPrintSession.cpp
widget/src/xpwidgets/nsPrintSession.h
widget/src/xpwidgets/nsPrintSettingsImpl.cpp
widget/src/xpwidgets/nsPrintSettingsImpl.h
widget/src/xpwidgets/nsTransferable.cpp
widget/src/xpwidgets/nsTransferable.h
widget/src/xpwidgets/nsXPLookAndFeel.cpp
widget/src/xpwidgets/nsXPLookAndFeel.h
widget/src/xremoteclient/Makefile.in
widget/src/xremoteclient/XRemoteClient.cpp
widget/src/xremoteclient/XRemoteClient.h
widget/src/xremoteclient/XRemoteClientFactory.cpp
widget/src/xremoteclient/mozilla-xremote-client.cpp
widget/src/xremoteclient/nsRemoteClient.h
--- a/accessible/accessible-docs.html
+++ b/accessible/accessible-docs.html
@@ -814,17 +814,17 @@ watch our application is that calls the 
 AccessibleObjectFromWindow(). This usually happens right after a window
 gets focused.<br>
   </p>
   <p>When the WIN32 API function AccessibleObjectFromWindow() is
 called, Windows sends the window in question a <a
  href="http://lxr.mozilla.org/seamonkey/search?string=WM_GETOBJECT">WM_GETOBJECT</a>
 message requesting an IAccessible for your root object in the window. In
 our case, this event is received in <a
- href="http://lxr.mozilla.org/seamonkey/source/widget/src/windows/nsWindow.cpp#4370">mozilla/widget/src/windows/nsWindow.cpp</a>.
+ href="http://lxr.mozilla.org/mozilla-central/source/widget/windows/nsWindow.cpp#4370">mozilla/widget/windows/nsWindow.cpp</a>.
 We send back an IAccessible pointer which can be used by the client to
 get information about this root object. The assistive technology will
 use that root IAccessible to traverse the rest of the object tree, by
 navigating to children and then siblings, etc. Every navigation function
 such as accNavigate(), get_accChild() and get_accParent() returns an
 IAccessible pointer. <br>
   </p>
   <p>To create the root IAccessible for a window the first time it gets
--- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp
@@ -609,17 +609,17 @@ toplevel_event_watcher(GSignalInvocation
   }
 
   return TRUE;
 }
 
 bool
 nsApplicationAccessibleWrap::Init()
 {
-    // XXX following code is copied from widget/src/gtk2/nsWindow.cpp
+    // XXX following code is copied from widget/gtk2/nsWindow.cpp
     // we should put it to somewhere that can be used from both modules
     // see bug 390761
 
     // check if accessibility enabled/disabled by environment variable
     bool isGnomeATEnabled = false;
     const char *envValue = PR_GetEnv(sAccEnv);
     if (envValue) {
         isGnomeATEnabled = !!atoi(envValue);
--- a/accessible/src/mac/mozAccessibleProtocol.h
+++ b/accessible/src/mac/mozAccessibleProtocol.h
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #import <Cocoa/Cocoa.h>
 
 #import "mozView.h"
 
-/* This protocol's primary use is so widget/src/cocoa can talk back to us
+/* This protocol's primary use is so widget/cocoa can talk back to us
    properly.
    
    ChildView owns the topmost mozRootAccessible, and needs to take care of setting up 
    that parent/child relationship.
    
    This protocol is thus used to make sure it knows it's talking to us, and not
    just some random |id|.
 */
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -379,17 +379,17 @@ pref("browser.dom.window.dump.enabled", 
 
 // Temporarily relax file:// origin checks so that we can use <img>s
 // from other dirs as webgl textures and more.  Remove me when we have
 // installable apps or wifi support.
 pref("security.fileuri.strict_origin_policy", false);
 
 // Temporarily force-enable GL compositing.  This is default-disabled
 // deep within the bowels of the widgetry system.  Remove me when GL
-// compositing isn't default disabled in widget/src/android.
+// compositing isn't default disabled in widget/android.
 pref("layers.acceleration.force-enabled", true);
 
 // screen.enabled and screen.brightness properties.
 pref("dom.screenEnabledProperty.enabled", true);
 pref("dom.screenBrightnessProperty.enabled", true);
 
 // Ignore X-Frame-Options headers.
 pref("b2g.ignoreXFrameOptions", true);
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -135,17 +135,17 @@
                 label="&viewVideoCmd.label;"
                 accesskey="&viewVideoCmd.accesskey;"
                 oncommand="gContextMenu.viewMedia(event);"
                 onclick="checkForMiddleClick(this, event);"/>
 #ifdef CONTEXT_COPY_IMAGE_CONTENTS
       <menuitem id="context-copyimage-contents"
                 label="&copyImageContentsCmd.label;"
                 accesskey="&copyImageContentsCmd.accesskey;"
-                oncommand="goDoCommand('cmd_copyImageContents');"/>
+                oncommand="goDoCommand('cmd_copyImage');"/>
 #endif
       <menuitem id="context-copyimage"
                 label="&copyImageCmd.label;"
                 accesskey="&copyImageCmd.accesskey;"
                 oncommand="gContextMenu.copyMediaLocation();"/>
       <menuitem id="context-copyvideourl"
                 label="&copyVideoURLCmd.label;"
                 accesskey="&copyVideoURLCmd.accesskey;"
--- a/browser/themes/gnomestripe/devtools/common.css
+++ b/browser/themes/gnomestripe/devtools/common.css
@@ -78,19 +78,19 @@
   background-color: hsla(210,8%,5%,.2) !important;
 }
 
 /* Search input */
 
 .devtools-searchinput {
   -moz-appearance: none;
   margin: 0 3px;
+  border: 1px solid hsla(210,8%,5%,.6);
+  border-radius: 2px;
   background-color: transparent;
-  border: 1px solid hsla(210,8%,5%,.6);
-  border-radius: 20px;
   background-image: url(magnifying-glass.png), -moz-linear-gradient(hsla(210,16%,76%,.15), hsla(210,16%,76%,.35));
   background-repeat: no-repeat;
   background-position: 4px 3px, top left, top left;
   padding-top: 0;
   padding-bottom: 0;
   -moz-padding-start: 18px;
   -moz-padding-end: 12px;
   box-shadow: 0 1px 1px hsla(210,8%,5%,.3) inset,
--- a/build/mobile/devicemanager.py
+++ b/build/mobile/devicemanager.py
@@ -495,17 +495,20 @@ class NetworkTools:
                               s.fileno(),
                               0x8915,  # SIOCGIFADDR
                               struct.pack('256s', ifname[:15])
                               )[20:24])
     else:
       return None
 
   def getLanIp(self):
-    ip = socket.gethostbyname(socket.gethostname())
+    try:
+      ip = socket.gethostbyname(socket.gethostname())
+    except socket.gaierror:
+      ip = socket.gethostbyname(socket.gethostname() + ".local") # for Mac OS X
     if ip.startswith("127.") and os.name != "nt":
       interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"]
       for ifname in interfaces:
         try:
           ip = self.getInterfaceIp(ifname)
           break;
         except IOError:
           pass
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -89,17 +89,16 @@ XULRUNNER_STUB_NAME = @XULRUNNER_STUB_NA
 
 MOZ_CHROME_FILE_FORMAT	= @MOZ_CHROME_FILE_FORMAT@
 MOZ_OMNIJAR		= @MOZ_OMNIJAR@
 OMNIJAR_NAME		= @OMNIJAR_NAME@
 
 MOZ_WIDGET_TOOLKIT	= @MOZ_WIDGET_TOOLKIT@
 MOZ_GFX_OPTIMIZE_MOBILE = @MOZ_GFX_OPTIMIZE_MOBILE@
 
-MOZ_DFB			= @MOZ_DFB@
 MOZ_X11			= @MOZ_X11@
 
 MOZ_PANGO = @MOZ_PANGO@
 
 MOZ_JS_LIBS		   = @MOZ_JS_LIBS@
 
 MOZ_DEBUG	= @MOZ_DEBUG@
 MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
--- a/config/system-headers
+++ b/config/system-headers
@@ -108,21 +108,16 @@ fusion/lock.h
 fusion/types.h
 fusion/vector.h
 fusion/call.h
 fusion/shmalloc.h
 fusion/protocol.h
 fusion/fusion.h
 fusion/arena.h
 fusion/object.h
-directfbgl.h
-directfb_version.h
-directfb.h
-directfb_util.h
-directfb_keynames.h
 dgiff.h
 direct/util.h
 direct/memcpy.h
 direct/interface.h
 direct/conf.h
 direct/tree.h
 direct/signals.h
 direct/build.h
--- a/configure.in
+++ b/configure.in
@@ -4794,25 +4794,23 @@ MOZ_ARG_HEADER(Toolkit Options)
     dnl ========================================================
 	MOZ_ARG_ENABLE_STRING(default-toolkit,
 	[  --enable-default-toolkit=TK
                           Select default toolkit
                           Platform specific defaults:
                             Mac OS X - cairo-cocoa
                             OS/2 - cairo-os2
                             Win32 - cairo-windows
-                            Gtk2 with DirectFB - cairo-gtk2-dfb
                             * - cairo-gtk2
                             * - cairo-qt],
     [ _DEFAULT_TOOLKIT=$enableval ],
     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
 
     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
-        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
     then
@@ -4849,34 +4847,16 @@ cairo-gtk2|cairo-gtk2-x11)
 
     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
     TK_LIBS='$(MOZ_GTK2_LIBS)'
     AC_DEFINE(MOZ_WIDGET_GTK2)
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
-cairo-gtk2-dfb)
-    MOZ_WIDGET_TOOLKIT=gtk2
-    MOZ_ENABLE_GTK2=1
-    MOZ_WEBGL=
-
-    AC_DEFINE(MOZ_DFB)
-    MOZ_DFB=1
-
-    TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
-    TK_LIBS='$(MOZ_GTK2_LIBS)'
-    AC_DEFINE(MOZ_WIDGET_GTK2)
-    if test "$no_x" != "yes"; then
-        AC_MSG_WARN([Disabling X when DirectFB is specified.])
-        no_x=yes
-    fi
-    MOZ_PDF_PRINTING=1
-    ;;
-
 cairo-qt)
     MOZ_WIDGET_TOOLKIT=qt
     MOZ_ENABLE_QT=1
     MOZ_ENABLE_XREMOTE=1
     MOZ_WEBGL=1
     MOZ_WEBGL_GLX=1
     USE_ELF_DYNSTR_GC=
 
@@ -4962,19 +4942,16 @@ fi
 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
   if test "$MOZ_ENABLE_GTK2"; then
     if test "$MOZ_X11"; then
       GDK_PACKAGES=gdk-x11-2.0
-    elif test "$MOZ_DFB"; then
-      PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
-      GDK_PACKAGES=directfb
     fi
 
     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
   fi
 
 fi # COMPILE_ENVIRONMENT
 
 AC_SUBST(MOZ_FS_LAYOUT)
@@ -5122,17 +5099,16 @@ AC_SUBST(MOZ_ENABLE_XREMOTE)
 AC_SUBST(MOZ_GTK2_CFLAGS)
 AC_SUBST(MOZ_GTK2_LIBS)
 AC_SUBST(MOZ_QT_CFLAGS)
 AC_SUBST(MOZ_QT_LIBS)
 
 AC_SUBST(MOC)
 AC_SUBST(RCC)
 
-AC_SUBST(MOZ_DFB)
 AC_SUBST(MOZ_X11)
 
 dnl ========================================================
 dnl =
 dnl = Components & Features
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Components and Features)
--- a/content/canvas/test/webgl/README.mozilla
+++ b/content/canvas/test/webgl/README.mozilla
@@ -1,9 +1,9 @@
-This is a local copy of the WebGL conformance suite, SVN revision 16237
+This is a local copy of the WebGL conformance suite, SVN revision 16456
 
 The canonical location for this testsuite is:
 
   https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests
 
 All files and directories in this directory, with the exceptions listed below, come from
 upstream and should not be modified without corresponding upstream fixes and/or a
 patch file in this directory. The exceptions (the Mozilla-specific files) are:
--- a/content/canvas/test/webgl/conformance/context/context-lost-restored.html
+++ b/content/canvas/test/webgl/conformance/context/context-lost-restored.html
@@ -6,17 +6,20 @@
 <script src="../../resources/js-test-pre.js"></script>
 <script src="../resources/webgl-test.js"></script>
 <script src="../resources/webgl-test-utils.js"></script>
 <script>
 var wtu = WebGLTestUtils;
 var canvas;
 var gl;
 var shouldGenerateGLError;
-var extension_name = "WEBGL_EXT_lose_context";
+var extensionNames = [
+    "WEBKIT_WEBGL_lose_context",
+    "MOZ_WEBGL_lose_context",
+];
 var extension;
 var bufferObjects;
 var program;
 var texture;
 var texColor = [255, 10, 20, 255];
 var allowRestore;
 var contextLostEventFired;
 var contextRestoredEventFired;
@@ -28,89 +31,86 @@ function init()
     }
 
     description("Tests behavior under a restored context.");
 
     shouldGenerateGLError = wtu.shouldGenerateGLError;
     testLosingContext();
 }
 
-function runTest1()
-{
-    testLosingAndRestoringContext();
-
-    finishTest();
-}
-
 function setupTest()
 {
     canvas = document.createElement("canvas");
     canvas.width = 1;
     canvas.height = 1;
     gl = wtu.create3DContext(canvas);
-    extension = gl.getExtension(extension_name);
+    for (var ii = 0; ii < extensionNames.length; ++ii) {
+        extension = gl.getExtension(extensionNames[ii]);
+        if (extension)
+            break;
+    }
     if (!extension) {
-        debug(extension_name + " extension not found.");
+        debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
         return false;
     }
     return true;
 }
 
 function testLosingContext()
 {
     if (!setupTest())
         finishTest();
 
     debug("Test losing a context and inability to restore it.");
 
-    canvas.addEventListener("webglcontextlost", function() {
-       testLostContext();
+    canvas.addEventListener("webglcontextlost", function(e) {
+       testLostContext(e);
        // restore the context after this event has exited.
        setTimeout(function() {
          // we didn't call prevent default so we should not be able to restore the context
          shouldGenerateGLError(gl, gl.INVALID_OPERATION, "extension.restoreContext()");
-         testLosingAndRetoreingContext();
+         testLosingAndRestoringContext();
        }, 1);
     });
     canvas.addEventListener("webglcontextrestored", testShouldNotRestoreContext);
     allowRestore = false;
     contextLostEventFired = false;
     contextRestoredEventFired = false;
 
     testOriginalContext();
     extension.loseContext();
     // The context should be lost immediately.
     shouldBeTrue("gl.isContextLost()");
     shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
     shouldBe("gl.getError()", "gl.NO_ERROR");
     // gl methods should be no-ops
-    shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
+    shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
     // but the event should not have been fired.
     shouldBeFalse("contextLostEventFired");
 }
 
 function testLosingAndRestoringContext()
 {
     if (!setupTest())
         finishTest();
 
     debug("");
     debug("Test losing and restoring a context.");
 
-    canvas.addEventListener("webglcontextlost", function() {
-      testLostContext();
+    canvas.addEventListener("webglcontextlost", function(e) {
+      testLostContext(e);
       // restore the context after this event has exited.
       setTimeout(function() {
         shouldGenerateGLError(gl, gl.NO_ERROR, "extension.restoreContext()");
         // The context should still be lost. It will not get restored until the 
         // webglrestorecontext event is fired.
         shouldBeTrue("gl.isContextLost()");
         shouldBe("gl.getError()", "gl.NO_ERROR");
         // gl methods should still be no-ops
-        shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
+        shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
       }, 1);
     });
     canvas.addEventListener("webglcontextrestored", function() {
       testRestoredContext();
       finishTest();
     });
     allowRestore = true;
     contextLostEventFired = false;
@@ -118,17 +118,17 @@ function testLosingAndRestoringContext()
 
     testOriginalContext();
     extension.loseContext();
     // The context should be lost immediately.
     shouldBeTrue("gl.isContextLost()");
     shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
     shouldBe("gl.getError()", "gl.NO_ERROR");
     // gl methods should be no-ops
-    shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
+    shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
     // but the event should not have been fired.
     shouldBeFalse("contextLostEventFired");
 }
 
 function testRendering()
 {
     gl.clearColor(0, 0, 0, 255);
     gl.colorMask(1, 1, 1, 0);
--- a/content/canvas/test/webgl/conformance/context/context-lost.html
+++ b/content/canvas/test/webgl/conformance/context/context-lost.html
@@ -6,17 +6,21 @@
 <script src="../../resources/js-test-pre.js"></script>
 <script src="../resources/webgl-test.js"></script>
 <script src="../resources/webgl-test-utils.js"></script>
 <script>
 var wtu;
 var canvas;
 var gl;
 var shouldGenerateGLError;
-var extension_name = "WEBGL_EXT_lose_context";
+var extensionNames = [
+    "WEBKIT_WEBGL_lose_context",
+    "MOZ_WEBGL_lose_context",
+];
+var extensionName;
 var extension;
 
 var buffer;
 var framebuffer;
 var program;
 var renderbuffer;
 var shader;
 var texture;
@@ -43,36 +47,42 @@ function init()
     if (window.initNonKhronosFramework) {
         window.initNonKhronosFramework(true);
     }
 
     // call testValidContext() before checking for the extension, because this is where we check
     // for the isContextLost() method, which we want to do regardless of the extension's presence.
     testValidContext();
 
-    extension = gl.getExtension(extension_name);
+    for (var ii = 0; ii < extensionNames.length; ++ii) {
+        extension = gl.getExtension(extensionNames[ii]);
+        if (extension) {
+            extensionName = extensionNames[ii];
+            break;
+        }
+    }
     if (!extension) {
-        debug(extension_name + " extension not found.");
+        debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
         finishTest();
-        return;
+        return false;
     }
 
     canvas.addEventListener("webglcontextlost", testLostContext, false);
 
     loseContext();
 }
 
 function loseContext()
 {
     debug("");
     debug("Lose context");
 
     // Note: this will cause the context to be lost, but the
     // webglcontextlost event listener to be queued.
-    shouldGenerateGLError(gl, gl.NO_ERROR, "extension.loseContext()");
+    extension.loseContext();
     debug("");
 }
 
 function testValidContext()
 {
     debug("Test valid context");
 
     shouldBeFalse("gl.isContextLost()");
@@ -278,17 +288,17 @@ function testLostContext()
         "gl.getShaderInfoLog(shader)",
         "gl.getShaderParameter(shader, gl.SHADER_TYPE)",
         "gl.getShaderSource(shader)",
         "gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S)",
         "gl.getUniform(program, uniformLocation)",
         "gl.getUniformLocation(program, 'vPosition')",
         "gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)",
         "gl.getSupportedExtensions()",
-        "gl.getExtension('" + extension_name + "')",
+        "gl.getExtension('" + extensionName + "')",
     ];
     for (var i = 0; i < nullTests.length; ++i) {
         shouldBeNull(nullTests[i]);
     }
 
     // "Is" queries should all return false.
     shouldBeFalse("gl.isBuffer(buffer)");
     shouldBeFalse("gl.isEnabled(gl.BLEND)");
--- a/content/canvas/test/webgl/conformance/glsl/00_test_list.txt
+++ b/content/canvas/test/webgl/conformance/glsl/00_test_list.txt
@@ -1,8 +1,10 @@
 functions/00_test_list.txt
 implicit/00_test_list.txt
+# commented out for version 1.0.1 of the conforamnce tests.
+#matrices/00_test_list.txt
 misc/00_test_list.txt
 reserved/00_test_list.txt
 # commented out for version 1.0.1 of the conforamnce tests.
 #samplers/00_test_list.txt
 variables/00_test_list.txt
 
--- a/content/canvas/test/webgl/conformance/misc/00_test_list.txt
+++ b/content/canvas/test/webgl/conformance/misc/00_test_list.txt
@@ -1,11 +1,11 @@
 bad-arguments-test.html
 error-reporting.html
 instanceof-test.html
 invalid-passed-params.html
 is-object.html
 null-object-behaviour.html
 object-deletion-behaviour.html
+#shader-precision-format.html
 type-conversion-test.html
 uninitialized-test.html
 webgl-specific.html
-
--- a/content/canvas/test/webgl/conformance/misc/instanceof-test.html
+++ b/content/canvas/test/webgl/conformance/misc/instanceof-test.html
@@ -76,16 +76,17 @@ shouldThrowWithNew(WebGLRenderingContext
 shouldThrowWithNew(WebGLActiveInfo, 'WebGLActiveInfo');
 shouldThrowWithNew(WebGLBuffer, 'WebGLBuffer');
 shouldThrowWithNew(WebGLFramebuffer, 'WebGLFramebuffer');
 shouldThrowWithNew(WebGLProgram, 'WebGLProgram');
 shouldThrowWithNew(WebGLRenderbuffer, 'WebGLRenderbuffer');
 shouldThrowWithNew(WebGLShader, 'WebGLShader');
 shouldThrowWithNew(WebGLTexture, 'WebGLTexture');
 shouldThrowWithNew(WebGLUniformLocation, 'WebGLUniformLocation');
+shouldThrowWithNew(WebGLShaderPrecisionFormat, 'WebGLShaderPrecisionFormat');
 
 successfullyParsed = true;
 </script>
 <script src="../../resources/js-test-post.js"></script>
 
 </body>
 </html>
 
--- a/content/canvas/test/webgl/conformance/misc/object-deletion-behaviour.html
+++ b/content/canvas/test/webgl/conformance/misc/object-deletion-behaviour.html
@@ -1,10 +1,13 @@
 <!--
-Copyright (c) 2011 The Chromium Authors. All rights reserved.
+Copyright (c) 2011 The Chromium Authors.
+Copyright (c) 2011 Mozilla Foundation.
+
+All rights reserved.
 Use of this source code is governed by a BSD-style license that can be
 found in the LICENSE file.
  -->
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="utf-8">
 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
@@ -27,17 +30,17 @@ debug("");
 debug("shader and program deletion");
 
 var vertexShader = wtu.loadStandardVertexShader(gl);
 assertMsg(vertexShader, "vertex shader loaded");
 var fragmentShader = wtu.loadStandardFragmentShader(gl);
 assertMsg(fragmentShader, "fragment shader loaded");
 
 var program = gl.createProgram();
-shouldBeTrue("program != null");
+shouldBeNonNull("program");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.attachShader(program, vertexShader)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.attachShader(program, fragmentShader)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.linkProgram(program)");
 shouldBeTrue("gl.getProgramParameter(program, gl.LINK_STATUS)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.useProgram(program)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteShader(vertexShader)");
 shouldBeTrue("gl.isShader(vertexShader)");
 shouldBeTrue("gl.getShaderParameter(vertexShader, gl.DELETE_STATUS)");
@@ -52,76 +55,76 @@ shouldBeTrue("gl.getProgramParameter(pro
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.useProgram(null)");
 shouldBeFalse("gl.isProgram(program)");
 shouldBeFalse("gl.isShader(fragmentShader)");
 
 debug("");
 debug("texture deletion");
 
 var fbo = gl.createFramebuffer(), fbo2 = gl.createFramebuffer(), fbo3 = gl.createFramebuffer();
-shouldBeTrue("fbo != null");
-shouldBeTrue("fbo2 != null");
-shouldBeTrue("fbo3 != null");
+shouldBeNonNull("fbo");
+shouldBeNonNull("fbo2");
+shouldBeNonNull("fbo3");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
 
 var tex = gl.createTexture();
-shouldBeTrue("tex != null");
+shouldBeNonNull("tex");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
 shouldBe("gl.getParameter(gl.TEXTURE_BINDING_2D)", "tex");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0)");
 shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "tex");
 shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.TEXTURE");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(tex)");
 // Deleting a texture bound to the currently-bound fbo is the same as
 // detaching the textue from fbo first, then delete the texture.
 shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)");
 shouldBeFalse("gl.isTexture(tex)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
 
 var texCubeMap = gl.createTexture();
-shouldBeTrue("texCubeMap != null");
+shouldBeNonNull("texCubeMap");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)");
 shouldBe("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)", "texCubeMap");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(texCubeMap)");
 shouldBeFalse("gl.isTexture(texCubeMap)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)");
 
 var t = gl.createTexture();
-shouldBeTrue("t != null");
+shouldBeNonNull("t");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(t)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
 
 var t2 = gl.createTexture();
-shouldBeTrue("t2 != null");
+shouldBeNonNull("t2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.activeTexture(gl.TEXTURE0)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t2)");
 shouldBe("gl.getParameter(gl.TEXTURE_BINDING_2D)", "t2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.activeTexture(gl.TEXTURE1)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t2)");
 shouldBe("gl.getParameter(gl.TEXTURE_BINDING_2D)", "t2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(t2)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.activeTexture(gl.TEXTURE0)");
 shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
 
 debug("");
 debug("renderbuffer deletion");
 
 var rbo = gl.createRenderbuffer(), rbo2 = gl.createRenderbuffer(), rbo3 = gl.createRenderbuffer();
-shouldBeTrue("rbo != null");
-shouldBeTrue("rbo2 != null");
-shouldBeTrue("rbo3 != null");
+shouldBeNonNull("rbo");
+shouldBeNonNull("rbo2");
+shouldBeNonNull("rbo3");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
 shouldBe("gl.getParameter(gl.RENDERBUFFER_BINDING)", "rbo");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
 shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo)");
 // Deleting a renderbuffer bound to the currently-bound fbo is the same as
 // detaching the renderbuffer from fbo first, then delete the renderbuffer.
 shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
@@ -170,33 +173,33 @@ if (gl.checkFramebufferStatus(gl.FRAMEBU
 debug("");
 debug("renderbuffer attached twice to same framebuffer");
 rbo = gl.createRenderbuffer();
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
-  var rbo2 = gl.createRenderbuffer();
+  rbo2 = gl.createRenderbuffer();
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo2)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
   // attach rbo2 at two attachment points incompatible with it
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rbo2)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, rbo2)");
-  shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo2");
-  shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo2");
+  shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo2");
+  shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo2");
   // fbo can't be complete as rbo2 is attached at incompatible attachment points
-  shouldBeFalse("gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE");
+  shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   // now we delete rbo2, which detaches it from the two attachment points where it currently is attached
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo2)");
   shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
   shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
   // we should now be in the same state as before with only rbo attached, so fbo should be complete again
   shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
-  shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo");
+  shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo");
 }
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
 
 
 
 debug("");
 debug("using deleted texture");
@@ -224,17 +227,17 @@ if (gl.checkFramebufferStatus(gl.FRAMEBU
   // Bind backbuffer.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [255,0,0,255], "backbuffer should be red")');
 }
 
 debug("");
 debug("using deleted renderbuffer");
 rbo = gl.createRenderbuffer();
-shouldBeTrue("rbo != null");
+shouldBeNonNull("rbo");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
   shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
@@ -244,119 +247,119 @@ if (gl.checkFramebufferStatus(gl.FRAMEBU
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
   // make fbo green
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,1,0,1)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
   // delete renderbuffer. It should still be attached to fbo2 though.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo)");
   // fbo has no attachments
-  shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
+  shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   // Use fbo2 that has deleted rbo.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [0,255,0,255], "fbo should be green")');
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,0,1,1)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [0,0,255,255], "fbo should be blue")');
-  shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo");
+  shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo");
 
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
   shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)");
   shouldGenerateGLError(gl, gl.NONE, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)");
-  shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
+  shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   // Bind backbuffer.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [255,0,0,255], "backbuffer should be red")');
 }
 
 debug("");
 debug("using deleted texture");
 tex = gl.createTexture();
-shouldBeTrue("tex != null");
+shouldBeNonNull("tex");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null)");
 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0)");
   // make fbo green
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,1,0,1)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
   // delete texture. It should still be attached to fbo2 though.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(tex)");
   // fbo has no attachments
-  shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
+  shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   // Use fbo that has deleted texture.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
-  shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE");
+  shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0,255,0,255], "fbo should be green")');
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,0,1,1)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0,0,255,255], "fbo should be blue")');
-  shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == tex");
+  shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "tex");
 
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
   shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)");
-  shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
+  shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
   // Bind backbuffer.
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
   shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [255,0,0,255], "backbuffer should be red")');
 }
 
 debug("");
 debug("buffer deletion");
 
 var buffer = gl.createBuffer();
-shouldBeTrue("buffer != null");
+shouldBeNonNull("buffer");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
 shouldBe("gl.getParameter(gl.ARRAY_BUFFER_BINDING)", "buffer");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(buffer)");
 shouldBeFalse("gl.isBuffer(buffer)");
 shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
 shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
 
 var buffer2 = gl.createBuffer();
-shouldBeTrue("buffer2 != null");
+shouldBeNonNull("buffer2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)");
 shouldBe("gl.getParameter(gl.ARRAY_BUFFER_BINDING)", "buffer2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, null)");
 shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(buffer2)");
 shouldBeFalse("gl.isBuffer(buffer2)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)");
 shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
 
 var bufferElement = gl.createBuffer();
-shouldBeTrue("bufferElement != null");
+shouldBeNonNull("bufferElement");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferElement)");
 shouldBe("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)", "bufferElement");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(bufferElement)");
 shouldBeFalse("gl.isBuffer(bufferElement)");
 shouldBeNull("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferElement)");
 shouldBeNull("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)");
 
 var b = gl.createBuffer();
-shouldBeTrue("b != null");
+shouldBeNonNull("b");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(b)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
 shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
 
 var b1 = gl.createBuffer();
-shouldBeTrue("b1 != null");
+shouldBeNonNull("b1");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b1);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enableVertexAttribArray(1);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.vertexAttribPointer(1, 4, gl.FLOAT, false, 0, 0);");
 var b2 = gl.createBuffer();
-shouldBeTrue("b2 != null");
+shouldBeNonNull("b2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b2);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enableVertexAttribArray(2);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.vertexAttribPointer(2, 4, gl.FLOAT, false, 0, 0);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enableVertexAttribArray(3);");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.vertexAttribPointer(3, 4, gl.FLOAT, false, 0, 0);");
 shouldBe("gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)", "b1");
 shouldBe("gl.getVertexAttrib(2, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)", "b2");
 shouldBe("gl.getVertexAttrib(3, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)", "b2");
@@ -379,18 +382,18 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "
 shouldBeNull("gl.getParameter(gl.FRAMEBUFFER_BINDING)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
 shouldBe("gl.getParameter(gl.FRAMEBUFFER_BINDING)", "fbo2");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteFramebuffer(fbo3)");
 shouldBe("gl.getParameter(gl.FRAMEBUFFER_BINDING)", "fbo2");
 
 fbo = gl.createFramebuffer();
 rbo = gl.createRenderbuffer();
-shouldBeTrue("fbo != null");
-shouldBeTrue("rbo != null");
+shouldBeNonNull("fbo");
+shouldBeNonNull("rbo");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
 shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
   // set backbuffer to red
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
   shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(1,0,0,1)");
--- a/content/canvas/test/webgl/conformance/renderbuffers/framebuffer-object-attachment.html
+++ b/content/canvas/test/webgl/conformance/renderbuffers/framebuffer-object-attachment.html
@@ -1,10 +1,13 @@
 <!--
-Copyright (c) 2011 The Chromium Authors. All rights reserved.
+Copyright (c) 2011 The Chromium Authors.
+Copyright (c) 2011 Mozilla Foundation.
+
+All rights reserved.
 Use of this source code is governed by a BSD-style license that can be
 found in the LICENSE file.
  -->
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="utf-8">
 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
@@ -26,17 +29,17 @@ var depthStencilBuffer;
 var colorBuffer;
 var width;
 var height;
 
 const ALLOW_COMPLETE              = 0x01;
 const ALLOW_UNSUPPORTED           = 0x02;
 const ALLOW_INCOMPLETE_ATTACHMENT = 0x04;
 
-function CheckFramebufferForAllowedStatuses(allowedStatuses)
+function checkFramebufferForAllowedStatuses(allowedStatuses)
 {
     // If the framebuffer is in an error state for multiple reasons,
     // we can't guarantee which one will be reported.
     var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
     var statusAllowed = ((allowedStatuses & ALLOW_COMPLETE) && (status == gl.FRAMEBUFFER_COMPLETE)) ||
                         ((allowedStatuses & ALLOW_UNSUPPORTED) && (status == gl.FRAMEBUFFER_UNSUPPORTED)) ||
                         ((allowedStatuses & ALLOW_INCOMPLETE_ATTACHMENT) && (status == gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT));
     var msg = "gl.checkFramebufferStatus(gl.FRAMEBUFFER) returned " + status;
@@ -48,17 +51,17 @@ function CheckFramebufferForAllowedStatu
 
 function testAttachment(attachment, buffer, allowedStatuses)
 {
     shouldBeNonNull("fbo = gl.createFramebuffer()");
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
     gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
     gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, buffer);
     glErrorShouldBe(gl, gl.NO_ERROR);
-    CheckFramebufferForAllowedStatuses(allowedStatuses);
+    checkFramebufferForAllowedStatuses(allowedStatuses);
     if ((allowedStatuses & ALLOW_COMPLETE) == 0) {
         gl.clear(gl.COLOR_BUFFER_BIT);
         glErrorShouldBe(gl, gl.INVALID_FRAMEBUFFER_OPERATION);
         gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(width * height * 4));
         glErrorShouldBe(gl, gl.INVALID_FRAMEBUFFER_OPERATION);
     }
     gl.deleteFramebuffer(fbo);
 }
@@ -67,17 +70,17 @@ function testAttachments(attachment0, bu
 {
     shouldBeNonNull("fbo = gl.createFramebuffer()");
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
     gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
     gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment0, gl.RENDERBUFFER, buffer0);
     glErrorShouldBe(gl, gl.NO_ERROR);
     gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, buffer1);
     glErrorShouldBe(gl, gl.NO_ERROR);
-    CheckFramebufferForAllowedStatuses(allowedStatuses);
+    checkFramebufferForAllowedStatuses(allowedStatuses);
     gl.deleteFramebuffer(fbo);
 }
 
 function testColorRenderbuffer(internalformat, allowedStatuses)
 {
     shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, internalformat, width, height);
@@ -233,17 +236,17 @@ function checkValidColorDepthCombination
 
 if (checkValidColorDepthCombination()) {
     testFramebufferIncompleteDimensions();
     testFramebufferIncompleteAttachment();
     testFramebufferIncompleteMissingAttachment();
     testUsingIncompleteFramebuffer();
 }
 
-function CheckFramebuffer(expected) {
+function checkFramebuffer(expected) {
     var actual = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
     var msg = "gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be " + wtu.glEnumToString(gl, expected) + " was " + wtu.glEnumToString(gl, actual);
     if (expected != gl.FRAMEBUFFER_COMPLETE) {
         msg += " or FRAMEBUFFER_UNSUPPORTED";
     }
     if (actual == expected ||
         (expected != gl.FRAMEBUFFER_COMPLETE &&
          actual == gl.FRAMBUFFER_UNSUPPORTED)) {
@@ -269,28 +272,28 @@ function testUsingIncompleteFramebuffer(
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
 
     shouldBeNonNull("depthBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, depthBuffer);
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, depthAttachment, gl.RENDERBUFFER, depthBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
     glErrorShouldBe(gl, gl.NO_ERROR);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     // We pick this combination because it works on desktop OpenGL but should not work on OpenGL ES 2.0
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 32, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
     debug("");
     debug("Drawing or reading from an incomplete framebuffer should generate INVALID_FRAMEBUFFER_OPERATION");
     testRenderingAndReading();
 
     shouldBeNonNull("fbo2 = gl.createFramebuffer()");
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
     debug("");
     debug("Drawing or reading from an incomplete framebuffer should generate INVALID_FRAMEBUFFER_OPERATION");
     testRenderingAndReading();
 
     shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
@@ -320,51 +323,51 @@ function testUsingIncompleteFramebuffer(
 function testFramebufferIncompleteAttachment() {
     shouldBeNonNull("fbo = gl.createFramebuffer()");
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
     shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     debug("");
     debug("Wrong storage type for type of attachment be FRAMEBUFFER_INCOMPLETE_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
 
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     debug("");
     debug("0 size attachment should be FRAMEBUFFER_INCOMPLETE_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 0, 0);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
 
     glErrorShouldBe(gl, gl.NO_ERROR);
 }
 
 function testFramebufferIncompleteMissingAttachment() {
     debug("");
     debug("No attachments should be INCOMPLETE_FRAMEBUFFER_MISSING_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
     shouldBeNonNull("fbo = gl.createFramebuffer()");
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
 
     shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, null);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
 
     glErrorShouldBe(gl, gl.NO_ERROR);
 }
 
 function testFramebufferIncompleteDimensions() {
     debug("");
     debug("Attachments of different sizes should be FRAMEBUFFER_INCOMPLETE_DIMENSIONS (OpenGL ES 2.0 4.4.5)");
 
@@ -377,42 +380,42 @@ function testFramebufferIncompleteDimens
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
 
     shouldBeNonNull("depthBuffer = gl.createRenderbuffer()");
     gl.bindRenderbuffer(gl.RENDERBUFFER, depthBuffer);
     gl.framebufferRenderbuffer(
         gl.FRAMEBUFFER, depthAttachment, gl.RENDERBUFFER, depthBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
     glErrorShouldBe(gl, gl.NO_ERROR);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 32, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
     gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 32);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
     gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
     glErrorShouldBe(gl, gl.NO_ERROR);
 
     var tex = gl.createTexture();
     gl.bindTexture(gl.TEXTURE_2D, tex);
     gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
     gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
     glErrorShouldBe(gl, gl.NO_ERROR);
     if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE) {
         return;
     }
 
     gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
-    CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
+    checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
     gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
-    CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
+    checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
 
     glErrorShouldBe(gl, gl.NO_ERROR);
 }
 
 successfullyParsed = true;
 </script>
 
 <script src="../../resources/js-test-post.js"></script>
--- a/content/canvas/test/webgl/conformance/resources/glsl-generator.js
+++ b/content/canvas/test/webgl/conformance/resources/glsl-generator.js
@@ -127,22 +127,25 @@ var bvecTypes = [
       "      $(func)_base($(baseArgsZ)),",
       "      $(func)_base($(baseArgsW)));",
       "}"].join("\n")
   }
 ];
 
 var replaceRE = /\$\((\w+)\)/g;
 
-var replaceParams = function(str, params) {
+var replaceParams = function(str) {
+  var args = arguments;
   return str.replace(replaceRE, function(str, p1, offset, s) {
-    if (params[p1] === undefined) {
-      throw "unknown string param '" + p1 + "'";
+    for (var ii = 1; ii < args.length; ++ii) {
+      if (args[ii][p1] !== undefined) {
+        return args[ii][p1];
+      }
     }
-    return params[p1];
+    throw "unknown string param '" + p1 + "'";
   });
 };
 
 var generateReferenceShader = function(
     shaderInfo, template, params, typeInfo, test) {
   var input = shaderInfo.input;
   var output = shaderInfo.output;
   var feature = params.feature;
@@ -438,16 +441,243 @@ var runFeatureTest = function(params) {
 
     var img = new Uint8Array(width * height * 4);
     gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
     return img;
   }
 
 };
 
+var runBasicTest = function(params) {
+  if (window.initNonKhronosFramework) {
+    window.initNonKhronosFramework(false);
+  }
+
+  var wtu = WebGLTestUtils;
+  var gridRes = params.gridRes;
+  var vertexTolerance = params.tolerance || 0;
+  var fragmentTolerance = vertexTolerance;
+  if ('fragmentTolerance' in params)
+    fragmentTolerance = params.fragmentTolerance || 0;
+
+  description("Testing : " + document.getElementsByTagName("title")[0].innerText);
+
+  var width = 32;
+  var height = 32;
+
+  var console = document.getElementById("console");
+  var canvas = document.createElement('canvas');
+  canvas.width = width;
+  canvas.height = height;
+  var gl = wtu.create3DContext(canvas);
+  if (!gl) {
+    testFailed("context does not exist");
+    finishTest();
+    return;
+  }
+
+  var canvas2d = document.createElement('canvas');
+  canvas2d.width = width;
+  canvas2d.height = height;
+  var ctx = canvas2d.getContext("2d");
+  var imgData = ctx.getImageData(0, 0, width, height);
+
+  var shaderInfos = [
+    { type: "vertex",
+      input: "color",
+      output: "vColor",
+      vertexShaderTemplate: vertexShaderTemplate,
+      fragmentShaderTemplate: baseFragmentShader,
+      tolerance: vertexTolerance
+    },
+    { type: "fragment",
+      input: "vColor",
+      output: "gl_FragColor",
+      vertexShaderTemplate: baseVertexShader,
+      fragmentShaderTemplate: fragmentShaderTemplate,
+      tolerance: fragmentTolerance
+    }
+  ];
+  for (var ss = 0; ss < shaderInfos.length; ++ss) {
+    var shaderInfo = shaderInfos[ss];
+    var tests = params.tests;
+//    var testTypes = params.emuFuncs || (params.bvecTest ? bvecTypes : types);
+    // Test vertex shaders
+    for (var ii = 0; ii < tests.length; ++ii) {
+      var test = tests[ii];
+      debug("");
+      debug("Testing: " + test.name + " in " + shaderInfo.type + " shader");
+
+      function genShader(shaderInfo, template, shader, subs) {
+        shader = replaceParams(shader, subs, {
+            input: shaderInfo.input,
+            output: shaderInfo.output
+          });
+        shader = replaceParams(template, subs, {
+            test: shader,
+            emu: "",
+            extra: ""
+          });
+        return shader;
+      }
+
+      var referenceVertexShaderSource = genShader(
+          shaderInfo,
+          shaderInfo.vertexShaderTemplate,
+          test.reference.shader,
+          test.reference.subs);
+      var referenceFragmentShaderSource = genShader(
+          shaderInfo,
+          shaderInfo.fragmentShaderTemplate,
+          test.reference.shader,
+          test.reference.subs);
+      var testVertexShaderSource = genShader(
+          shaderInfo,
+          shaderInfo.vertexShaderTemplate,
+          test.test.shader,
+          test.test.subs);
+      var testFragmentShaderSource = genShader(
+          shaderInfo,
+          shaderInfo.fragmentShaderTemplate,
+          test.test.shader,
+          test.test.subs);
+
+      debug("");
+      addShaderSource(
+          "reference vertex shader", referenceVertexShaderSource);
+      addShaderSource(
+          "reference fragment shader", referenceFragmentShaderSource);
+      addShaderSource(
+          "test vertex shader", testVertexShaderSource);
+      addShaderSource(
+          "test fragment shader", testFragmentShaderSource);
+      debug("");
+
+      var refData = draw(
+          canvas, referenceVertexShaderSource, referenceFragmentShaderSource);
+      var refImg = makeImage(canvas);
+      if (ss == 0) {
+        var testData = draw(
+            canvas, testVertexShaderSource, referenceFragmentShaderSource);
+      } else {
+        var testData = draw(
+            canvas, referenceVertexShaderSource, testFragmentShaderSource);
+      }
+      var testImg = makeImage(canvas);
+
+      reportResults(refData, refImg, testData, testImg, shaderInfo.tolerance);
+    }
+  }
+
+  finishTest();
+
+  function addShaderSource(label, source) {
+    var div = document.createElement("div");
+    var s = document.createElement("pre");
+    s.className = "shader-source";
+    s.style.display = "none";
+    var ol = document.createElement("ol");
+    //s.appendChild(document.createTextNode(source));
+    var lines = source.split("\n");
+    for (var ii = 0; ii < lines.length; ++ii) {
+      var line = lines[ii];
+      var li = document.createElement("li");
+      li.appendChild(document.createTextNode(line));
+      ol.appendChild(li);
+    }
+    s.appendChild(ol);
+    var l = document.createElement("a");
+    l.href = "show-shader-source";
+    l.appendChild(document.createTextNode(label));
+    l.addEventListener('click', function(event) {
+        if (event.preventDefault) {
+          event.preventDefault();
+        }
+        s.style.display = (s.style.display == 'none') ? 'block' : 'none';
+        return false;
+      }, false);
+    div.appendChild(l);
+    div.appendChild(s);
+    console.appendChild(div);
+  }
+
+  function reportResults(refData, refImage, testData, testImage, tolerance) {
+    var same = true;
+    for (var yy = 0; yy < height; ++yy) {
+      for (var xx = 0; xx < width; ++xx) {
+        var offset = (yy * width + xx) * 4;
+        var imgOffset = ((height - yy - 1) * width + xx) * 4;
+        imgData.data[imgOffset + 0] = 0;
+        imgData.data[imgOffset + 1] = 0;
+        imgData.data[imgOffset + 2] = 0;
+        imgData.data[imgOffset + 3] = 255;
+        if (Math.abs(refData[offset + 0] - testData[offset + 0]) > tolerance ||
+            Math.abs(refData[offset + 1] - testData[offset + 1]) > tolerance ||
+            Math.abs(refData[offset + 2] - testData[offset + 2]) > tolerance ||
+            Math.abs(refData[offset + 3] - testData[offset + 3]) > tolerance) {
+          imgData.data[imgOffset] = 255;
+          same = false;
+        }
+      }
+    }
+
+    var diffImg = null;
+    if (!same) {
+      ctx.putImageData(imgData, 0, 0);
+      diffImg = makeImage(canvas2d);
+    }
+
+    var div = document.createElement("div");
+    div.className = "testimages";
+    insertImg(div, "ref", refImg);
+    insertImg(div, "test", testImg);
+    if (diffImg) {
+      insertImg(div, "diff", diffImg);
+    }
+    div.appendChild(document.createElement('br'));
+
+    function insertImg(element, caption, img) {
+      var div = document.createElement("div");
+      div.appendChild(img);
+      var label = document.createElement("div");
+      label.appendChild(document.createTextNode(caption));
+      div.appendChild(label);
+      element.appendChild(div);
+    }
+
+    console.appendChild(div);
+
+    if (!same) {
+      testFailed("images are different");
+    } else {
+      testPassed("images are the same");
+    }
+
+    console.appendChild(document.createElement('hr'));
+  }
+
+  function draw(canvas, vsSource, fsSource) {
+    var program = wtu.loadProgram(gl, vsSource, fsSource, testFailed);
+
+    var posLoc = gl.getAttribLocation(program, "aPosition");
+    WebGLTestUtils.setupQuad(gl, gridRes, posLoc);
+
+    gl.useProgram(program);
+    gl.clearColor(0, 0, 1, 1);
+    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+    gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+    var img = new Uint8Array(width * height * 4);
+    gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+    return img;
+  }
+
+};
+
 return {
   /**
    * runs a bunch of GLSL tests using the passed in parameters
    * The parameters are:
    *
    * feature:
    *    the name of the function being tested (eg, sin, dot,
    *    normalize)
@@ -502,13 +732,89 @@ return {
    *    Specify a tolerance which only applies to fragment shaders. The 
    *    fragment-only tolerance will override the shared tolerance for 
    *    fragment shaders if both are specified. Fragment shaders usually
    *    use mediump float precision so they sometimes require higher tolerance
    *    than vertex shaders which use highp.
    */
   runFeatureTest: runFeatureTest,
 
+  /*
+   * Runs a bunch of GLSL tests using the passed in parameters
+   *
+   * The parameters are:
+   *
+   * tests:
+   *    Array of tests. For each test the following parameters are expected
+   *
+   *    name:
+   *       some description of the test
+   *    reference:
+   *       parameters for the reference shader (see below)
+   *    test:
+   *       parameters for the test shader (see below)
+   *
+   *    The parameter for the reference and test shaders are
+   *
+   *    shader: the GLSL for the shader
+   *    subs: any substitutions you wish to define for the shader.
+   *
+   *    Each shader is created from a basic template that
+   *    defines an input and an output. You can see the
+   *    templates at the top of this file. The input and output
+   *    change depending on whether or not we are generating
+   *    a vertex or fragment shader.
+   *
+   *    All this code function does is a bunch of string substitutions.
+   *    A substitution is defined by $(name). If name is found in
+   *    the 'subs' parameter it is replaced. 4 special names exist.
+   *
+   *    'input' the input to your GLSL. Always a vec4. All change
+   *    from 0 to 1 over the quad to be drawn.
+   *
+   *    'output' the output color. Also a vec4
+   *
+   *    'emu' a place to insert extra stuff
+   *    'extra' a place to insert extra stuff.
+   *
+   *    You can think of the templates like this
+   *
+   *       $(extra)
+   *       $(emu)
+   *
+   *       void main() {
+   *          // do math to calculate input
+   *          ...
+   *
+   *          $(shader)
+   *       }
+   *
+   *    Your shader first has any subs you provided applied as well
+   *    as 'input' and 'output'
+   *
+   *    It is then inserted into the template which is also provided
+   *    with your subs.
+   *
+   * gridRes: (optional)
+   *    The resolution of the mesh to generate. The default is a
+   *    1x1 grid but many vertex shaders need a higher resolution
+   *    otherwise the only values passed in are the 4 corners
+   *    which often have the same value.
+   *
+   * tolerance: (optional)
+   *    Allow some tolerance in the comparisons. The tolerance is applied to
+   *    both vertex and fragment shaders. The default tolerance is 0, meaning
+   *    the values have to be identical.
+   *
+   * fragmentTolerance: (optional)
+   *    Specify a tolerance which only applies to fragment shaders. The
+   *    fragment-only tolerance will override the shared tolerance for
+   *    fragment shaders if both are specified. Fragment shaders usually
+   *    use mediump float precision so they sometimes require higher tolerance
+   *    than vertex shaders which use highp.
+   */
+  runBasicTest: runBasicTest,
+
   none: false
 };
 
 }());
 
--- a/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js
+++ b/content/canvas/test/webgl/conformance/resources/webgl-test-utils.js
@@ -901,16 +901,27 @@ var loadShader = function(gl, shaderSour
  * @return {!WebGLShader} The created shader.
  */
 var loadShaderFromFile = function(gl, file, type, opt_errorCallback) {
   var shaderSource = readFile(file);
   return loadShader(gl, shaderSource, type, opt_errorCallback);
 };
 
 /**
+ * Gets the content of script.
+ */
+var getScript = function(scriptId) {
+  var shaderScript = document.getElementById(scriptId);
+  if (!shaderScript) {
+    throw("*** Error: unknown script element" + scriptId);
+  }
+  return shaderScript.text;
+};
+
+/**
  * Loads a shader from a script tag.
  * @param {!WebGLContext} gl The WebGLContext to use.
  * @param {string} scriptId The id of the script tag.
  * @param {number} opt_shaderType The type of shader. If not passed in it will
  *     be derived from the type of the script tag.
  * @param {function(string): void) opt_errorCallback callback for errors. 
  * @return {!WebGLShader} The created shader.
  */
@@ -1118,16 +1129,17 @@ return {
     create3DContextWithWrapperThatThrowsOnGLError,
   checkCanvas: checkCanvas,
   checkCanvasRect: checkCanvasRect,
   createColoredTexture: createColoredTexture,
   drawQuad: drawQuad,
   endsWith: endsWith,
   getFileListAsync: getFileListAsync,
   getLastError: getLastError,
+  getScript: getScript,
   getUrlArguments: getUrlArguments,
   glEnumToString: glEnumToString,
   glErrorShouldBe: glErrorShouldBe,
   fillTexture: fillTexture,
   loadImageAsync: loadImageAsync,
   loadImagesAsync: loadImagesAsync,
   loadProgram: loadProgram,
   loadProgramFromFile: loadProgramFromFile,
--- a/content/canvas/test/webgl/conformance/textures/gl-teximage.html
+++ b/content/canvas/test/webgl/conformance/textures/gl-teximage.html
@@ -394,16 +394,28 @@ function runTests(imgs) {
   gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE,
                 imgs['../resources/red-indexed.png']);
   glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup");
   wtu.drawQuad(gl);
   gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
   // The image should be red.
   checkPixelRange(buf, middle, center, [ 255, 0, 0, 255 ], 10);
 
+  debug("")
+  debug("check calling texImage2D with NULL clears the texture");
+  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB,
+                imgs['../resources/red-indexed.png'].width,
+                imgs['../resources/red-indexed.png'].height,
+				0, gl.RGB, gl.UNSIGNED_BYTE, null);
+  glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup");
+  wtu.drawQuad(gl);
+  gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+  // The image should be white.
+  checkPixelRange(buf, middle, center, [ 0, 0, 0, 255 ], 10);
+
   debug("");
   successfullyParsed = true;
   shouldBeTrue("successfullyParsed");
   debug('<br /><span class="pass">TEST COMPLETE</span>');
   notifyFinishedToHarness();
 }
 </script>
 </body>
--- a/content/canvas/test/webgl/dont-load-image-from-internet.patch
+++ b/content/canvas/test/webgl/dont-load-image-from-internet.patch
@@ -1,10 +1,10 @@
 # HG changeset patch
-# Parent 9c1a90f789e3d43455cb18a9a911627c80c0d9ac
+# Parent 07fbbfde4173da7d8e513bb2d52ae07e333dbf43
 diff --git a/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html
 --- a/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html
 +++ b/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html
 @@ -110,10 +110,10 @@ Tests.testReadPixelsSOPCanvas = function
  
  Tests.endUnit = function(gl) {
  }
  
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/webgl/extra/out-of-bounds-uniform-array-access.html
@@ -0,0 +1,109 @@
+<!--
+Copyright (c) 2011 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+  "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL ouf of bounds uniform array access.</title>
+<link rel="stylesheet" href="../resources/js-test-style.css"/>
+<script src="../resources/js-test-pre.js"></script>
+<script src="../conformance/resources/webgl-test-utils.js"> </script>
+</head>
+<body style="background: #666;">
+<div id="description"></div>
+<div id="console"></div>
+<div>elem mult: <span id="elemMultDisplay"></span></div>
+<input type="range" id="elemMult" value="4" min="0" max="2048" style="width: 100%;"/>
+<div>line width: <span id="lineWidthDisplay"></span></div>
+<input type="range" id="lineWidth" value="512" min="0" max="2540" style="width: 100%;"/>
+<canvas id="example" width="256" height="256" style="background: black;">
+</canvas>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 vPosition;
+varying vec4 v_color;
+uniform float lineWidth;
+uniform int elemMult;
+uniform vec4 someArray[2];
+void main()
+{
+    vec2 texcoord = vec2(vPosition.xy * 0.5 + vec2(0.5, 0.5));
+    int index = int(texcoord.x + texcoord.y * lineWidth) * elemMult;
+    v_color = someArray[index];
+    gl_Position = vPosition;
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+varying vec4 v_color;
+void main()
+{
+  gl_FragColor = v_color * vec4(1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0) + vec4(0,0,0,0.5);
+}
+</script>
+<script>
+window.onload = main;
+debug("Tests a WebGL program that accesses out of bounds uniform array elements");
+
+function main() {
+  var wtu = WebGLTestUtils;
+  var canvas = document.getElementById("example");
+
+  var gl = wtu.create3DContext(canvas);
+  var program = wtu.setupProgram(
+      gl,
+      [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
+       wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
+      ['vPosition'], [0]);
+  var gridRes = 255;
+  wtu.setupQuad(gl, gridRes, 0);
+  var lineWidthLoc = gl.getUniformLocation(program, "lineWidth");
+  var elemMultLoc = gl.getUniformLocation(program, "elemMult");
+  assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
+
+  var lineWidth = 512;
+  var lineWidthElem = document.getElementById("lineWidth");
+  var lineWidthDisplayElem = document.getElementById("lineWidthDisplay");
+
+  lineWidthElem.value = lineWidth;
+
+  lineWidthElem.addEventListener('change', function(event) {
+      //console.log(event.target.value);
+      lineWidth = event.target.value;
+      draw();
+    }, false);
+
+  var elemMult = 4;
+  var elemMultElem = document.getElementById("elemMult");
+  var elemMultDisplayElem = document.getElementById("elemMultDisplay");
+
+  elemMultElem.value = elemMult;
+
+  elemMultElem.addEventListener('change', function(event) {
+      //console.log(event.target.value);
+      elemMult = event.target.value;
+      draw();
+    }, false);
+
+  draw();
+
+  function draw() {
+    lineWidthDisplayElem.innerText = lineWidth;
+    elemMultDisplayElem.innerText = elemMult;
+    gl.uniform1f(lineWidthLoc, lineWidth);
+    gl.uniform1i(elemMultLoc, elemMult);
+    gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
+  }
+
+  successfullyParsed = true;
+}
+
+</script>
+</body>
+</html>
+
+
--- a/content/canvas/test/webgl/failing_tests_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -1,9 +1,8 @@
-conformance/context/context-lost-restored.html
 conformance/context/premultiplyalpha-test.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/misc/uninitialized-test.html
 conformance/programs/gl-get-active-attribute.html
 conformance/textures/texture-mips.html
 conformance/uniforms/gl-uniform-bool.html
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -1,9 +1,8 @@
-conformance/context/context-lost-restored.html
 conformance/context/premultiplyalpha-test.html
 conformance/glsl/misc/glsl-function-nodes.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfBadArgs.html
 conformance/more/functions/uniformiBadArgs.html
--- a/content/canvas/test/webgl/failing_tests_windows.txt
+++ b/content/canvas/test/webgl/failing_tests_windows.txt
@@ -1,9 +1,8 @@
-conformance/context/context-lost-restored.html
 conformance/context/premultiplyalpha-test.html
 conformance/glsl/functions/glsl-function-atan.html
 conformance/glsl/functions/glsl-function-atan-xy.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfArrayLen1.html
--- a/content/canvas/test/webgl/log-more-info-about-test-failures.patch
+++ b/content/canvas/test/webgl/log-more-info-about-test-failures.patch
@@ -1,10 +1,10 @@
 # HG changeset patch
-# Parent 4ed0bad4933ba69927ee5f75cf67093d3e99566a
+# Parent 1910ae60536dce7272cb0478089bf40806666de8
 diff --git a/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html b/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
 --- a/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
 +++ b/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
 @@ -117,17 +117,18 @@ function init()
      var bufFunction = new Uint8Array(width * height * 4);
      var bufMacro = new Uint8Array(width * height * 4);
  
      if (drawAndRead("canvasFunction", "vshaderFunction", bufFunction) == false ||
--- a/content/canvas/test/webgl/remove-uniqueObjectTest.patch
+++ b/content/canvas/test/webgl/remove-uniqueObjectTest.patch
@@ -1,10 +1,10 @@
 # HG changeset patch
-# Parent bf9d7872738cdb7cf425e6dd060ae62882487e1a
+# Parent a41d853e5110aca4f2c77c63db502f670d0e50a1
 diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
 --- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
 +++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
 @@ -107,17 +107,18 @@ if (!gl) {
      } else {
          testPassed("Successfully enabled OES_standard_derivatives extension");
  
          runSupportedTest(true);
--- a/content/canvas/test/webgl/resources/js-test-pre.js
+++ b/content/canvas/test/webgl/resources/js-test-pre.js
@@ -212,37 +212,62 @@ function evalAndLog(_a)
   try {
      _av = eval(_a);
   } catch (e) {
     testFailed(_a + " threw exception " + e);
   }
   return _av;
 }
 
-function shouldBe(_a, _b)
+function shouldBe(_a, _b, quiet)
 {
-  if (typeof _a != "string" || typeof _b != "string")
-    debug("WARN: shouldBe() expects string arguments");
-  var exception;
-  var _av;
-  try {
-     _av = eval(_a);
-  } catch (e) {
-     exception = e;
-  }
-  var _bv = eval(_b);
+    if (typeof _a != "string" || typeof _b != "string")
+        debug("WARN: shouldBe() expects string arguments");
+    var exception;
+    var _av;
+    try {
+        _av = eval(_a);
+    } catch (e) {
+        exception = e;
+    }
+    var _bv = eval(_b);
 
-  if (exception)
-    testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
-  else if (isResultCorrect(_av, _bv))
-    testPassed(_a + " is " + _b);
-  else if (typeof(_av) == typeof(_bv))
-    testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
-  else
-    testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+    if (exception)
+        testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+    else if (isResultCorrect(_av, _bv)) {
+        if (!quiet) {
+            testPassed(_a + " is " + _b);
+        }
+    } else if (typeof(_av) == typeof(_bv))
+        testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+    else
+        testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+}
+
+function shouldNotBe(_a, _b, quiet)
+{
+    if (typeof _a != "string" || typeof _b != "string")
+        debug("WARN: shouldNotBe() expects string arguments");
+    var exception;
+    var _av;
+    try {
+        _av = eval(_a);
+    } catch (e) {
+        exception = e;
+    }
+    var _bv = eval(_b);
+
+    if (exception)
+        testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
+    else if (!isResultCorrect(_av, _bv)) {
+        if (!quiet) {
+            testPassed(_a + " is not " + _b);
+        }
+    } else
+        testFailed(_a + " should not be " + _bv + ".");
 }
 
 function shouldBeTrue(_a) { shouldBe(_a, "true"); }
 function shouldBeFalse(_a) { shouldBe(_a, "false"); }
 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
 function shouldBeNull(_a) { shouldBe(_a, "null"); }
 
 function shouldBeEqualToString(a, b)
--- a/content/canvas/test/webgl/undo-r15330-async-test-list-loading.patch
+++ b/content/canvas/test/webgl/undo-r15330-async-test-list-loading.patch
@@ -1,11 +1,10 @@
 # HG changeset patch
-# Parent 41137626edf2a358f2be1b7ed3f83211230ab4f5
-
+# Parent fb36d18f04ef9b01ca87d3fde539d50c204f9bba
 diff --git a/content/canvas/test/webgl/resources/webgl-test-harness.js b/content/canvas/test/webgl/resources/webgl-test-harness.js
 --- a/content/canvas/test/webgl/resources/webgl-test-harness.js
 +++ b/content/canvas/test/webgl/resources/webgl-test-harness.js
 @@ -90,190 +90,105 @@ var log = function(msg) {
    if (window.console && window.console.log) {
      window.console.log(msg);
    }
  };
--- a/content/html/content/src/nsTextEditorState.cpp
+++ b/content/html/content/src/nsTextEditorState.cpp
@@ -1165,17 +1165,17 @@ nsTextEditorState::PrepareEditor(const n
   editorFlags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask;
   
   // Spell check is diabled at creation time. It is enabled once
   // the editor comes into focus.
   editorFlags |= nsIPlaintextEditor::eEditorSkipSpellCheck;
 
   bool shouldInitializeEditor = false;
   nsCOMPtr<nsIEditor> newEditor; // the editor that we might create
-  nsresult rv;
+  nsresult rv = NS_OK;
   if (!mEditor) {
     shouldInitializeEditor = true;
 
     // Create an editor
     newEditor = do_CreateInstance(kTextEditorCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Make sure we clear out the non-breaking space before we initialize the editor
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2258,17 +2258,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
           (::GetKeyState(VK_RBUTTON) ? MK_RBUTTON : 0) |
           (::GetKeyState(VK_XBUTTON1) ? MK_XBUTTON1 : 0) |
           (::GetKeyState(VK_XBUTTON2) ? MK_XBUTTON2 : 0);
       }
     }
     if (pPluginEvent) {
       // Make event coordinates relative to our enclosing widget,
       // not the widget they were received on.
-      // See use of NPEvent in widget/src/windows/nsWindow.cpp
+      // See use of NPEvent in widget/windows/nsWindow.cpp
       // for why this assert should be safe
       NS_ASSERTION(anEvent.message == NS_MOUSE_BUTTON_DOWN ||
                    anEvent.message == NS_MOUSE_BUTTON_UP ||
                    anEvent.message == NS_MOUSE_DOUBLECLICK ||
                    anEvent.message == NS_MOUSE_ENTER_SYNTH ||
                    anEvent.message == NS_MOUSE_EXIT_SYNTH ||
                    anEvent.message == NS_MOUSE_MOVE,
                    "Incorrect event type for coordinate translation");
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -1617,17 +1617,17 @@ PluginInstanceParent::RecvNegotiatedCarb
 
   focus from dom -> child:
     Focus manager calls on widget to set the focus on the window.
     We pick up the resulting wm_setfocus event here, and forward
     that over ipc to the child which calls set focus on itself. 
 
   focus from child -> focus manager:
     Child picks up the local wm_setfocus and sends it via ipc over
-    here. We then post a custom event to widget/src/windows/nswindow
+    here. We then post a custom event to widget/windows/nswindow
     which fires off a gui event letting the browser know.
 */
 
 static const PRUnichar kPluginInstanceParentProperty[] =
                          L"PluginInstanceParentProperty";
 
 // static
 LRESULT CALLBACK
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -579,19 +579,16 @@ PluginModuleChild::InitGraphics()
 
 #elif defined(MOZ_WIDGET_QT)
     nsQAppInstance::AddRef();
     // Work around plugins that don't interact well without gtk initialized
     // see bug 566845
 #if defined(MOZ_X11)
     if (!sGtkLib)
          sGtkLib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
-#elif defined(MOZ_DFB)
-    if (!sGtkLib)
-         sGtkLib = PR_LoadLibrary("libgtk-directfb-2.0.so.0");
 #endif
     if (sGtkLib) {
          s_gtk_init = (_gtk_init_fn)PR_FindFunctionSymbol(sGtkLib, "gtk_init");
          if (s_gtk_init)
              s_gtk_init(0, 0);
     }
 #else
     // may not be necessary on all platforms
--- a/dom/telephony/ril_worker.js
+++ b/dom/telephony/ril_worker.js
@@ -59,17 +59,17 @@
  * terms of object allocations. As a result, it may look more like C than
  * JavaScript, and that's intended.
  */
 
 "use strict";
 
 importScripts("ril_consts.js");
 
-const DEBUG = true;
+let DEBUG = false;
 
 const INT32_MAX   = 2147483647;
 const UINT8_SIZE  = 1;
 const UINT16_SIZE = 2;
 const UINT32_SIZE = 4;
 const PARCEL_SIZE_SIZE = UINT32_SIZE;
 
 /**
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -688,17 +688,16 @@ abstract public class GeckoApp
         outFile.setLastModified(fileEntry.getTime());
         return true;
     }
 
     public void addEnvToIntent(Intent intent) {
         Map<String,String> envMap = System.getenv();
         Set<Map.Entry<String,String>> envSet = envMap.entrySet();
         Iterator<Map.Entry<String,String>> envIter = envSet.iterator();
-        StringBuffer envstr = new StringBuffer();
         int c = 0;
         while (envIter.hasNext()) {
             Map.Entry<String,String> entry = envIter.next();
             intent.putExtra("env" + c, entry.getKey() + "="
                             + entry.getValue());
             c++;
         }
     }
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -140,16 +140,23 @@ PROCESSEDJAVAFILES += CrashReporter.java
 MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/crash_reporter.png
 RES_LAYOUT += res/layout/crash_reporter.xml
 endif
 
 MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/desktop_notification.png
 
 MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' ';  fi)
 
+RESOURCES=$(RES_LAYOUT) $(RES_VALUES)
+
+RES_DIRS= \
+	res/layout   \
+	res/values   \
+	$(NULL)
+
 include $(topsrcdir)/config/rules.mk
 
 # Override the Java settings with some specific android settings
 include $(topsrcdir)/config/android-common.mk
 
 # Note that we're going to set up a dependency directly between embed_android.dex and the java files
 # Instead of on the .class files, since more than one .class file might be produced per .java file
 classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
@@ -164,29 +171,30 @@ AndroidManifest.xml $(PROCESSEDJAVAFILES
 res/drawable/icon.png: $(MOZ_APP_ICON)
 	$(NSINSTALL) -D res/drawable
 	cp $(ICON_PATH) $@
 
 res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
 	$(NSINSTALL) -D res/drawable-hdpi
 	cp $(ICON_PATH_HDPI) $@
 
+$(RES_DIRS):
+	rm -rf $@
+	$(NSINSTALL) -D $@
+
 RES_DRAWABLE = $(addprefix res/drawable/,$(notdir $(MOZ_ANDROID_DRAWABLES)))
 
 $(RES_DRAWABLE): $(addprefix $(topsrcdir)/,$(MOZ_ANDROID_DRAWABLES))
 	$(NSINSTALL) -D res/drawable
 	$(NSINSTALL) $^ res/drawable/
 
-$(RES_LAYOUT): $(subst res/,$(srcdir)/resources/,$(RES_LAYOUT))
-	$(NSINSTALL) -D res/layout
-	$(NSINSTALL) $(srcdir)/resources/layout/* res/layout/
+$(RESOURCES): $(RES_DIRS) $(subst res/,$(srcdir)/resources/,$(RESOURCES))
+	@echo "creating $@"
+	$(NSINSTALL) $(subst res/,$(srcdir)/resources/,$@) $(dir $@)
 
-$(RES_VALUES): $(subst res/,$(srcdir)/resources/,$(RES_VALUES))
-	$(NSINSTALL) -D res/values
-	$(NSINSTALL) $(srcdir)/resources/values/* res/values/
 
 R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
 
 gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/values/strings.xml FORCE
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar  -S res -F $@
 
 libs:: classes.dex
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -1,11 +1,11 @@
 This is the ANGLE project, from http://code.google.com/p/angleproject/
 
-Current revision: r924
+Current revision: r930
 
 == Applied local patches ==
 
 In this order:
   angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
   angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
   angle-limit-identifiers-to-250-chars.patch - see bug 675625
   angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
--- a/gfx/angle/src/common/version.h
+++ b/gfx/angle/src/common/version.h
@@ -1,10 +1,10 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 924
+#define BUILD_REVISION 930
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
 
 #define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
 #define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
--- a/gfx/angle/src/compiler/OutputHLSL.cpp
+++ b/gfx/angle/src/compiler/OutputHLSL.cpp
@@ -183,17 +183,17 @@ void OutputHLSL::header()
         {
             out << "static bool gl_FrontFacing = false;\n";
         }
 
         out << "\n";
 
         if (mUsesFragCoord)
         {
-            out << "uniform float4 dx_Viewport;\n"
+            out << "uniform float4 dx_Coord;\n"
                    "uniform float2 dx_Depth;\n";
         }
 
         if (mUsesFrontFacing)
         {
             out << "uniform bool dx_PointsOrLines;\n"
                    "uniform bool dx_FrontCCW;\n";
         }
--- a/gfx/angle/src/libGLESv2/Context.cpp
+++ b/gfx/angle/src/libGLESv2/Context.cpp
@@ -1793,21 +1793,23 @@ bool Context::applyRenderTarget(bool ign
     if (mState.currentProgram && mDxUniformsDirty)
     {
         Program *programObject = getCurrentProgram();
 
         GLint halfPixelSize = programObject->getDxHalfPixelSizeLocation();
         GLfloat xy[2] = {1.0f / viewport.Width, -1.0f / viewport.Height};
         programObject->setUniform2fv(halfPixelSize, 1, xy);
 
-        GLint viewport = programObject->getDxViewportLocation();
-        GLfloat whxy[4] = {mState.viewportWidth / 2.0f, mState.viewportHeight / 2.0f, 
+        // These values are used for computing gl_FragCoord in Program::linkVaryings(). The approach depends on Shader Model 3.0 support.
+        GLint coord = programObject->getDxCoordLocation();
+        float h = mSupportsShaderModel3 ? mRenderTargetDesc.Height : mState.viewportHeight / 2.0f;
+        GLfloat whxy[4] = {mState.viewportWidth / 2.0f, h, 
                           (float)mState.viewportX + mState.viewportWidth / 2.0f, 
                           (float)mState.viewportY + mState.viewportHeight / 2.0f};
-        programObject->setUniform4fv(viewport, 1, whxy);
+        programObject->setUniform4fv(coord, 1, whxy);
 
         GLint depth = programObject->getDxDepthLocation();
         GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
         programObject->setUniform2fv(depth, 1, dz);
 
         GLint depthRange = programObject->getDxDepthRangeLocation();
         GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
         programObject->setUniform3fv(depthRange, 1, nearFarDiff);
@@ -2591,28 +2593,17 @@ void Context::clear(GLbitfield mask)
 
     D3DCOLOR color = D3DCOLOR_ARGB(unorm<8>(mState.colorClearValue.alpha), 
                                    unorm<8>(mState.colorClearValue.red), 
                                    unorm<8>(mState.colorClearValue.green), 
                                    unorm<8>(mState.colorClearValue.blue));
     float depth = clamp01(mState.depthClearValue);
     int stencil = mState.stencilClearValue & 0x000000FF;
 
-    IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
-    if (!renderTarget)
-    {
-        return;   // Context must be lost, return silently
-    }
-
-    D3DSURFACE_DESC desc;
-    renderTarget->GetDesc(&desc);
-    renderTarget->Release();
-    renderTarget = NULL;
-
-    bool alphaUnmasked = (dx2es::GetAlphaSize(desc.Format) == 0) || mState.colorMaskAlpha;
+    bool alphaUnmasked = (dx2es::GetAlphaSize(mRenderTargetDesc.Format) == 0) || mState.colorMaskAlpha;
 
     const bool needMaskedStencilClear = (flags & D3DCLEAR_STENCIL) &&
                                         (mState.stencilWritemask & stencilUnmasked) != stencilUnmasked;
     const bool needMaskedColorClear = (flags & D3DCLEAR_TARGET) &&
                                       !(mState.colorMaskRed && mState.colorMaskGreen &&
                                         mState.colorMaskBlue && alphaUnmasked);
 
     if (needMaskedColorClear || needMaskedStencilClear)
@@ -2703,31 +2694,31 @@ void Context::clear(GLbitfield mask)
         mDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
         mDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
         mDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
         mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
         mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
 
         float quad[4][4];   // A quadrilateral covering the target, aligned to match the edges
         quad[0][0] = -0.5f;
-        quad[0][1] = desc.Height - 0.5f;
+        quad[0][1] = mRenderTargetDesc.Height - 0.5f;
         quad[0][2] = 0.0f;
         quad[0][3] = 1.0f;
 
-        quad[1][0] = desc.Width - 0.5f;
-        quad[1][1] = desc.Height - 0.5f;
+        quad[1][0] = mRenderTargetDesc.Width - 0.5f;
+        quad[1][1] = mRenderTargetDesc.Height - 0.5f;
         quad[1][2] = 0.0f;
         quad[1][3] = 1.0f;
 
         quad[2][0] = -0.5f;
         quad[2][1] = -0.5f;
         quad[2][2] = 0.0f;
         quad[2][3] = 1.0f;
 
-        quad[3][0] = desc.Width - 0.5f;
+        quad[3][0] = mRenderTargetDesc.Width - 0.5f;
         quad[3][1] = -0.5f;
         quad[3][2] = 0.0f;
         quad[3][3] = 1.0f;
 
         mDisplay->startScene();
         mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
 
         if (flags & D3DCLEAR_ZBUFFER)
--- a/gfx/angle/src/libGLESv2/Context.h
+++ b/gfx/angle/src/libGLESv2/Context.h
@@ -60,17 +60,17 @@ enum
 {
     MAX_VERTEX_ATTRIBS = 16,
     MAX_VERTEX_UNIFORM_VECTORS = 256 - 2,   // 256 is the minimum for SM2, and in practice the maximum for DX9. Reserve space for dx_HalfPixelSize and dx_DepthRange.
     MAX_VARYING_VECTORS_SM2 = 8,
     MAX_VARYING_VECTORS_SM3 = 10,
     MAX_TEXTURE_IMAGE_UNITS = 16,
     MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4,   // For devices supporting vertex texture fetch
     MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,    
-    MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3,    // Reserve space for dx_Viewport, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
+    MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3,    // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
     MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
     MAX_DRAW_BUFFERS = 1,
 
     IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,
     IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
 };
 
 const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
--- a/gfx/angle/src/libGLESv2/Program.cpp
+++ b/gfx/angle/src/libGLESv2/Program.cpp
@@ -1595,23 +1595,30 @@ bool Program::linkVaryings()
                   "};\n"
                   "\n"
                   "PS_OUTPUT main(PS_INPUT input)\n"
                   "{\n";
 
     if (mFragmentShader->mUsesFragCoord)
     {
         mPixelHLSL += "    float rhw = 1.0 / input.gl_FragCoord.w;\n";
-        if (sm3) {
+        
+        if (sm3)
+        {
+            // dx_Coord.y contains the render target height. See Context::applyRenderTarget()
             mPixelHLSL += "    gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
-                          "    gl_FragCoord.y = 2.0 * dx_Viewport.y - input.dx_VPos.y - 0.5;\n";
-        } else {
-            mPixelHLSL += "    gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Viewport.x + dx_Viewport.z;\n"
-                          "    gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Viewport.y + dx_Viewport.w;\n";
+                          "    gl_FragCoord.y = dx_Coord.y - input.dx_VPos.y - 0.5;\n";
         }
+        else
+        {
+            // dx_Coord contains the viewport width/2, height/2, center.x and center.y. See Context::applyRenderTarget()
+            mPixelHLSL += "    gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Coord.x + dx_Coord.z;\n"
+                          "    gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Coord.y + dx_Coord.w;\n";
+        }
+        
         mPixelHLSL += "    gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_Depth.x + dx_Depth.y;\n"
                       "    gl_FragCoord.w = rhw;\n";
     }
 
     if (mFragmentShader->mUsesPointCoord && sm3)
     {
         mPixelHLSL += "    gl_PointCoord = input.gl_PointCoord;\n";
     }
@@ -1727,17 +1734,17 @@ void Program::link()
             {
                 return;
             }
 
             // these uniforms are searched as already-decorated because gl_ and dx_
             // are reserved prefixes, and do not receive additional decoration
             mDxDepthRangeLocation = getUniformLocation("dx_DepthRange");
             mDxDepthLocation = getUniformLocation("dx_Depth");
-            mDxViewportLocation = getUniformLocation("dx_Viewport");
+            mDxCoordLocation = getUniformLocation("dx_Coord");
             mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize");
             mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW");
             mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines");
 
             mLinked = true;   // Success
         }
     }
 }
@@ -2415,17 +2422,17 @@ void Program::unlink(bool destroy)
     while (!mUniforms.empty())
     {
         delete mUniforms.back();
         mUniforms.pop_back();
     }
 
     mDxDepthRangeLocation = -1;
     mDxDepthLocation = -1;
-    mDxViewportLocation = -1;
+    mDxCoordLocation = -1;
     mDxHalfPixelSizeLocation = -1;
     mDxFrontCCWLocation = -1;
     mDxPointsOrLinesLocation = -1;
 
     mUniformIndex.clear();
 
     mPixelHLSL.clear();
     mVertexHLSL.clear();
@@ -2836,19 +2843,19 @@ GLint Program::getDxDepthRangeLocation()
     return mDxDepthRangeLocation;
 }
 
 GLint Program::getDxDepthLocation() const
 {
     return mDxDepthLocation;
 }
 
-GLint Program::getDxViewportLocation() const
+GLint Program::getDxCoordLocation() const
 {
-    return mDxViewportLocation;
+    return mDxCoordLocation;
 }
 
 GLint Program::getDxHalfPixelSizeLocation() const
 {
     return mDxHalfPixelSizeLocation;
 }
 
 GLint Program::getDxFrontCCWLocation() const
--- a/gfx/angle/src/libGLESv2/Program.h
+++ b/gfx/angle/src/libGLESv2/Program.h
@@ -98,17 +98,17 @@ class Program
     bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
     bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
 
     bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
     bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
 
     GLint getDxDepthRangeLocation() const;
     GLint getDxDepthLocation() const;
-    GLint getDxViewportLocation() const;
+    GLint getDxCoordLocation() const;
     GLint getDxHalfPixelSizeLocation() const;
     GLint getDxFrontCCWLocation() const;
     GLint getDxPointsOrLinesLocation() const;
 
     void dirtyAllUniforms();
     void applyUniforms();
 
     void link();
@@ -202,17 +202,17 @@ class Program
 
     typedef std::vector<Uniform*> UniformArray;
     UniformArray mUniforms;
     typedef std::vector<UniformLocation> UniformIndex;
     UniformIndex mUniformIndex;
 
     GLint mDxDepthRangeLocation;
     GLint mDxDepthLocation;
-    GLint mDxViewportLocation;
+    GLint mDxCoordLocation;
     GLint mDxHalfPixelSizeLocation;
     GLint mDxFrontCCWLocation;
     GLint mDxPointsOrLinesLocation;
 
     bool mLinked;
     bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
     char *mInfoLog;
     bool mValidated;
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp
@@ -74,16 +74,38 @@ static D3DFORMAT ConvertTextureFormatTyp
         }
 
         return D3DFMT_A8R8G8B8;
     }
 
     return D3DFMT_A8R8G8B8;
 }
 
+static bool IsTextureFormatRenderable(D3DFORMAT format)
+{
+    switch(format)
+    {
+      case D3DFMT_L8:
+      case D3DFMT_A8L8:
+      case D3DFMT_DXT1:
+      case D3DFMT_DXT3:
+      case D3DFMT_DXT5:
+        return false;
+      case D3DFMT_A8R8G8B8:
+      case D3DFMT_X8R8G8B8:
+      case D3DFMT_A16B16G16R16F:
+      case D3DFMT_A32B32G32R32F:
+        return true;
+      default:
+        UNREACHABLE();
+    }
+
+    return false;
+}
+
 Image::Image()
 {
     mWidth = 0; 
     mHeight = 0;
     mFormat = GL_NONE;
     mType = GL_UNSIGNED_BYTE;
 
     mSurface = NULL;
@@ -202,36 +224,19 @@ void Image::unlock()
 {
     if (mSurface)
     {
         HRESULT result = mSurface->UnlockRect();
         ASSERT(SUCCEEDED(result));
     }
 }
 
-bool Image::isRenderable() const
+bool Image::isRenderableFormat() const
 {    
-    switch(getD3DFormat())
-    {
-      case D3DFMT_L8:
-      case D3DFMT_A8L8:
-      case D3DFMT_DXT1:
-      case D3DFMT_DXT3:
-      case D3DFMT_DXT5:
-        return false;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-      case D3DFMT_A16B16G16R16F:
-      case D3DFMT_A32B32G32R32F:
-        return true;
-      default:
-        UNREACHABLE();
-    }
-
-    return false;
+    return IsTextureFormatRenderable(getD3DFormat());
 }
 
 D3DFORMAT Image::getD3DFormat() const
 {
     // this should only happen if the image hasn't been redefined first
     // which would be a bug by the caller
     ASSERT(mD3DFormat != D3DFMT_UNKNOWN);
 
@@ -1121,17 +1126,17 @@ void Image::copy(GLint xoffset, GLint yo
         renderTargetData->Release();
         return error(GL_OUT_OF_MEMORY);
     }
 
     RECT sourceRect = transformPixelRect(x, y, width, height, description.Height);
     int destYOffset = transformPixelYOffset(yoffset, height, mHeight);
     RECT destRect = {xoffset, destYOffset, xoffset + width, destYOffset + height};
 
-    if (isRenderable())
+    if (isRenderableFormat())
     {
         result = D3DXLoadSurfaceFromSurface(getSurface(), NULL, &destRect, renderTargetData, NULL, &sourceRect, D3DX_FILTER_BOX, 0);
         
         if (FAILED(result))
         {
             ERR("Copying surfaces unexpectedly failed.");
             renderTargetData->Release();
             return error(GL_OUT_OF_MEMORY);
@@ -1263,30 +1268,30 @@ void Image::copy(GLint xoffset, GLint yo
         renderTargetData->UnlockRect();
     }
 
     renderTargetData->Release();
 
     mDirty = true;
 }
 
-TextureStorage::TextureStorage(bool renderable)
-    : mRenderable(renderable),
-      mD3DPool(getDisplay()->getTexturePool(renderable)),
+TextureStorage::TextureStorage(bool renderTarget)
+    : mRenderTarget(renderTarget),
+      mD3DPool(getDisplay()->getTexturePool(mRenderTarget)),
       mTextureSerial(issueTextureSerial())
 {
 }
 
 TextureStorage::~TextureStorage()
 {
 }
 
-bool TextureStorage::isRenderable() const
+bool TextureStorage::isRenderTarget() const
 {
-    return mRenderable;
+    return mRenderTarget;
 }
 
 bool TextureStorage::isManaged() const
 {
     return (mD3DPool == D3DPOOL_MANAGED);
 }
 
 D3DPOOL TextureStorage::getPool() const
@@ -1561,19 +1566,20 @@ bool Texture::subImageCompressed(GLint x
 
 IDirect3DBaseTexture9 *Texture::getTexture()
 {
     if (!isSamplerComplete())
     {
         return NULL;
     }
 
-    if (!getBaseTexture())
+    // ensure the underlying texture is created
+    if (getStorage(false) == NULL)
     {
-        createTexture();
+        return NULL;
     }
 
     updateTexture();
 
     return getBaseTexture();
 }
 
 bool Texture::hasDirtyParameters() const
@@ -1587,25 +1593,25 @@ bool Texture::hasDirtyImages() const
 }
 
 void Texture::resetDirty()
 {
     mDirtyParameters = false;
     mDirtyImages = false;
 }
 
-unsigned int Texture::getTextureSerial() const
+unsigned int Texture::getTextureSerial()
 {
-    TextureStorage *texture = getStorage();
+    TextureStorage *texture = getStorage(false);
     return texture ? texture->getTextureSerial() : 0;
 }
 
-unsigned int Texture::getRenderTargetSerial(GLenum target) const
+unsigned int Texture::getRenderTargetSerial(GLenum target)
 {
-    TextureStorage *texture = getStorage();
+    TextureStorage *texture = getStorage(true);
     return texture ? texture->getRenderTargetSerial(target) : 0;
 }
 
 bool Texture::isImmutable() const
 {
     return mImmutable;
 }
 
@@ -1667,22 +1673,23 @@ bool Texture::copyToRenderTarget(IDirect
     return true;
 }
 
 TextureStorage2D::TextureStorage2D(IDirect3DTexture9 *surfaceTexture) : TextureStorage(true), mRenderTargetSerial(RenderbufferStorage::issueSerial())
 {
     mTexture = surfaceTexture;
 }
 
-TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable) : TextureStorage(renderable), mRenderTargetSerial(RenderbufferStorage::issueSerial())
+TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget)
+    : TextureStorage(renderTarget), mRenderTargetSerial(RenderbufferStorage::issueSerial())
 {
     IDirect3DDevice9 *device = getDevice();
 
     mTexture = NULL;
-    HRESULT result = device->CreateTexture(width, height, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
+    HRESULT result = device->CreateTexture(width, height, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
 
     if (FAILED(result))
     {
         ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
         error(GL_OUT_OF_MEMORY);
     }
 }
 
@@ -1897,24 +1904,24 @@ void Texture2D::copyImage(GLint level, G
     if (!renderTarget)
     {
         ERR("Failed to retrieve the render target.");
         return error(GL_OUT_OF_MEMORY);
     }
 
     redefineImage(level, format, width, height, GL_UNSIGNED_BYTE);
    
-    if (!mImageArray[level].isRenderable())
+    if (!mImageArray[level].isRenderableFormat())
     {
         mImageArray[level].copy(0, 0, x, y, width, height, renderTarget);
         mDirtyImages = true;
     }
     else
     {
-        if (!mTexStorage || !mTexStorage->isRenderable())
+        if (!mTexStorage || !mTexStorage->isRenderTarget())
         {
             convertToRenderTarget();
         }
         
         mImageArray[level].markClean();
 
         if (width != 0 && height != 0 && level < levelCount())
         {
@@ -1949,24 +1956,24 @@ void Texture2D::copySubImage(GLenum targ
     IDirect3DSurface9 *renderTarget = source->getRenderTarget();
 
     if (!renderTarget)
     {
         ERR("Failed to retrieve the render target.");
         return error(GL_OUT_OF_MEMORY);
     }
 
-    if (!mImageArray[level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
+    if (!mImageArray[level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
     {
         mImageArray[level].copy(xoffset, yoffset, x, y, width, height, renderTarget);
         mDirtyImages = true;
     }
     else
     {
-        if (!mTexStorage || !mTexStorage->isRenderable())
+        if (!mTexStorage || !mTexStorage->isRenderTarget())
         {
             convertToRenderTarget();
         }
         
         updateTexture();
 
         if (level < levelCount())
         {
@@ -1991,20 +1998,20 @@ void Texture2D::copySubImage(GLenum targ
     renderTarget->Release();
 }
 
 void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
 {
     GLenum format = gl::ExtractFormat(internalformat);
     GLenum type = gl::ExtractType(internalformat);
     D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
-    const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+    const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
 
     delete mTexStorage;
-    mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderable);
+    mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderTarget);
     mImmutable = true;
 
     for (int level = 0; level < levels; level++)
     {
         mImageArray[level].redefine(format, width, height, type, true);
         width = std::max(1, width >> 1);
         height = std::max(1, height >> 1);
     }
@@ -2149,20 +2156,20 @@ IDirect3DBaseTexture9 *Texture2D::getBas
 
 // Constructs a Direct3D 9 texture resource from the texture images
 void Texture2D::createTexture()
 {
     GLsizei width = mImageArray[0].getWidth();
     GLsizei height = mImageArray[0].getHeight();
     GLint levels = creationLevels(width, height);
     D3DFORMAT format = mImageArray[0].getD3DFormat();
-    const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+    const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
 
     delete mTexStorage;
-    mTexStorage = new TextureStorage2D(levels, format, width, height, renderable);
+    mTexStorage = new TextureStorage2D(levels, format, width, height, renderTarget);
     
     if (mTexStorage->isManaged())
     {
         int levels = levelCount();
 
         for (int level = 0; level < levels; level++)
         {
             IDirect3DSurface9 *surface = mTexStorage->getSurfaceLevel(level);
@@ -2244,17 +2251,17 @@ void Texture2D::generateMipmaps()
     for (unsigned int i = 1; i <= q; i++)
     {
         redefineImage(i, mImageArray[0].getFormat(), 
                          std::max(mImageArray[0].getWidth() >> i, 1),
                          std::max(mImageArray[0].getHeight() >> i, 1),
                          mImageArray[0].getType());
     }
 
-    if (mTexStorage && mTexStorage->isRenderable())
+    if (mTexStorage && mTexStorage->isRenderTarget())
     {
         for (unsigned int i = 1; i <= q; i++)
         {
             IDirect3DSurface9 *upper = mTexStorage->getSurfaceLevel(i - 1);
             IDirect3DSurface9 *lower = mTexStorage->getSurfaceLevel(i);
 
             if (upper != NULL && lower != NULL)
             {
@@ -2300,42 +2307,51 @@ Renderbuffer *Texture2D::getRenderbuffer
 
     return mColorbufferProxy.get();
 }
 
 IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
 {
     ASSERT(target == GL_TEXTURE_2D);
 
-    if (!mTexStorage || !mTexStorage->isRenderable())
-    {
-        convertToRenderTarget();
-    }
-
-    if (mTexStorage == NULL)
+    // ensure the underlying texture is created
+    if (getStorage(true) == NULL)
     {
         return NULL;
     }
 
     updateTexture();
     
     return mTexStorage->getSurfaceLevel(0);
 }
 
-TextureStorage *Texture2D::getStorage() const
+TextureStorage *Texture2D::getStorage(bool renderTarget)
 {
+    if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
+    {
+        if (renderTarget)
+        {
+            convertToRenderTarget();
+        }
+        else
+        {
+            createTexture();
+        }
+    }
+
     return mTexStorage;
 }
 
-TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable) : TextureStorage(renderable), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
+TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget)
+    : TextureStorage(renderTarget), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
 {
     IDirect3DDevice9 *device = getDevice();
 
     mTexture = NULL;
-    HRESULT result = device->CreateCubeTexture(size, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
+    HRESULT result = device->CreateCubeTexture(size, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
 
     if (FAILED(result))
     {
         ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
         error(GL_OUT_OF_MEMORY);
     }
 }
 
@@ -2625,20 +2641,20 @@ IDirect3DBaseTexture9 *TextureCubeMap::g
 }
 
 // Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
 void TextureCubeMap::createTexture()
 {
     GLsizei size = mImageArray[0][0].getWidth();
     GLint levels = creationLevels(size, 0);
     D3DFORMAT format = mImageArray[0][0].getD3DFormat();
-    const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+    const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
 
     delete mTexStorage;
-    mTexStorage = new TextureStorageCubeMap(levels, format, size, renderable);
+    mTexStorage = new TextureStorageCubeMap(levels, format, size, renderTarget);
 
     if (mTexStorage->isManaged())
     {
         int levels = levelCount();
 
         for (int face = 0; face < 6; face++)
         {
             for (int level = 0; level < levels; level++)
@@ -2762,24 +2778,24 @@ void TextureCubeMap::copyImage(GLenum ta
     {
         ERR("Failed to retrieve the render target.");
         return error(GL_OUT_OF_MEMORY);
     }
 
     unsigned int faceindex = faceIndex(target);
     redefineImage(faceindex, level, format, width, height, GL_UNSIGNED_BYTE);
 
-    if (!mImageArray[faceindex][level].isRenderable())
+    if (!mImageArray[faceindex][level].isRenderableFormat())
     {
         mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
         mDirtyImages = true;
     }
     else
     {
-        if (!mTexStorage || !mTexStorage->isRenderable())
+        if (!mTexStorage || !mTexStorage->isRenderTarget())
         {
             convertToRenderTarget();
         }
         
         mImageArray[faceindex][level].markClean();
 
         ASSERT(width == height);
 
@@ -2820,24 +2836,24 @@ void TextureCubeMap::copySubImage(GLenum
     if (!renderTarget)
     {
         ERR("Failed to retrieve the render target.");
         return error(GL_OUT_OF_MEMORY);
     }
 
     unsigned int faceindex = faceIndex(target);
 
-    if (!mImageArray[faceindex][level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
+    if (!mImageArray[faceindex][level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
     {
         mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
         mDirtyImages = true;
     }
     else
     {
-        if (!mTexStorage || !mTexStorage->isRenderable())
+        if (!mTexStorage || !mTexStorage->isRenderTarget())
         {
             convertToRenderTarget();
         }
         
         updateTexture();
 
         if (level < levelCount())
         {
@@ -2862,20 +2878,20 @@ void TextureCubeMap::copySubImage(GLenum
     renderTarget->Release();
 }
 
 void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
 {
     GLenum format = gl::ExtractFormat(internalformat);
     GLenum type = gl::ExtractType(internalformat);
     D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
-    const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+    const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
 
     delete mTexStorage;
-    mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderable);
+    mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderTarget);
     mImmutable = true;
 
     for (int level = 0; level < levels; level++)
     {
         for (int face = 0; face < 6; face++)
         {
             mImageArray[face][level].redefine(format, size, size, type, true);
             size = std::max(1, size >> 1);
@@ -2928,17 +2944,17 @@ void TextureCubeMap::generateMipmaps()
         {
             redefineImage(f, i, mImageArray[f][0].getFormat(),
                                 std::max(mImageArray[f][0].getWidth() >> i, 1),
                                 std::max(mImageArray[f][0].getWidth() >> i, 1),
                                 mImageArray[f][0].getType());
         }
     }
 
-    if (mTexStorage && mTexStorage->isRenderable())
+    if (mTexStorage && mTexStorage->isRenderTarget())
     {
         for (unsigned int f = 0; f < 6; f++)
         {
             for (unsigned int i = 1; i <= q; i++)
             {
                 IDirect3DSurface9 *upper = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i-1);
                 IDirect3DSurface9 *lower = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
 
@@ -2992,29 +3008,37 @@ Renderbuffer *TextureCubeMap::getRenderb
 
     return mFaceProxies[face].get();
 }
 
 IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
 {
     ASSERT(IsCubemapTextureTarget(target));
 
-    if (!mTexStorage || !mTexStorage->isRenderable())
-    {
-        convertToRenderTarget();
-    }
-
-    if (mTexStorage == NULL)
+    // ensure the underlying texture is created
+    if (getStorage(true) == NULL)
     {
         return NULL;
     }
 
     updateTexture();
     
     return mTexStorage->getCubeMapSurface(target, 0);
 }
 
-TextureStorage *TextureCubeMap::getStorage() const
+TextureStorage *TextureCubeMap::getStorage(bool renderTarget)
 {
+    if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
+    {
+        if (renderTarget)
+        {
+            convertToRenderTarget();
+        }
+        else
+        {
+            createTexture();
+        }
+    }
+
     return mTexStorage;
 }
 
 }
\ No newline at end of file
--- a/gfx/angle/src/libGLESv2/Texture.h
+++ b/gfx/angle/src/libGLESv2/Texture.h
@@ -51,17 +51,17 @@ class Image
 
     bool redefine(GLenum format, GLsizei width, GLsizei height, GLenum type, bool forceRelease);
     void markDirty() {mDirty = true;}
     void markClean() {mDirty = false;}
 
     HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
     void unlock();
 
-    bool isRenderable() const;
+    bool isRenderableFormat() const;
     D3DFORMAT getD3DFormat() const;
 
     GLsizei getWidth() const {return mWidth;}
     GLsizei getHeight() const {return mHeight;}
     GLenum getFormat() const {return mFormat;}
     GLenum getType() const {return mType;}
     bool isDirty() const {return mSurface && mDirty;}
     IDirect3DSurface9 *getSurface();
@@ -139,30 +139,30 @@ class Image
     D3DFORMAT mD3DFormat;
 
     IDirect3DSurface9 *mSurface;
 };
 
 class TextureStorage
 {
   public:
-    explicit TextureStorage(bool renderable);
+    explicit TextureStorage(bool renderTarget);
 
     virtual ~TextureStorage();
 
-    bool isRenderable() const;
+    bool isRenderTarget() const;
     bool isManaged() const;
     D3DPOOL getPool() const;
     unsigned int getTextureSerial() const;
     virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(TextureStorage);
 
-    const bool mRenderable;
+    const bool mRenderTarget;
     const D3DPOOL mD3DPool;
 
     const unsigned int mTextureSerial;
     static unsigned int issueTextureSerial();
 
     static unsigned int mCurrentTextureSerial;
 };
 
@@ -200,18 +200,18 @@ class Texture : public RefCountObject
     virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
 
     virtual void generateMipmaps() = 0;
     virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
 
     bool hasDirtyParameters() const;
     bool hasDirtyImages() const;
     void resetDirty();
-    unsigned int getTextureSerial() const;
-    unsigned int getRenderTargetSerial(GLenum target) const;
+    unsigned int getTextureSerial();
+    unsigned int getRenderTargetSerial(GLenum target);
 
     bool isImmutable() const;
 
     static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1);   // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
 
   protected:
     friend class RenderbufferTexture;
 
@@ -243,24 +243,24 @@ class Texture : public RefCountObject
 
     bool mDirtyImages;
 
     bool mImmutable;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(Texture);
 
-    virtual TextureStorage *getStorage() const = 0;
+    virtual TextureStorage *getStorage(bool renderTarget) = 0;
 };
 
 class TextureStorage2D : public TextureStorage
 {
   public:
     explicit TextureStorage2D(IDirect3DTexture9 *surfaceTexture);
-    TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable);
+    TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget);
 
     virtual ~TextureStorage2D();
 
     IDirect3DSurface9 *getSurfaceLevel(int level);
     IDirect3DBaseTexture9 *getBaseTexture() const;
 
     virtual unsigned int getRenderTargetSerial(GLenum target) const;
 
@@ -306,17 +306,17 @@ class Texture2D : public Texture
   private:
     DISALLOW_COPY_AND_ASSIGN(Texture2D);
 
     virtual IDirect3DBaseTexture9 *getBaseTexture() const;
     virtual void createTexture();
     virtual void updateTexture();
     virtual void convertToRenderTarget();
     virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
-    virtual TextureStorage *getStorage() const;
+    virtual TextureStorage *getStorage(bool renderTarget);
 
     bool isMipmapComplete() const;
 
     void redefineImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type);
     void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
 
     Image mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
@@ -324,17 +324,17 @@ class Texture2D : public Texture
     egl::Surface *mSurface;
 
     BindingPointer<Renderbuffer> mColorbufferProxy;
 };
 
 class TextureStorageCubeMap : public TextureStorage
 {
   public:
-    TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable);
+    TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget);
 
     virtual ~TextureStorageCubeMap();
 
     IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level);
     IDirect3DBaseTexture9 *getBaseTexture() const;
 
     virtual unsigned int getRenderTargetSerial(GLenum target) const;
 
@@ -387,17 +387,17 @@ class TextureCubeMap : public Texture
   private:
     DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
 
     virtual IDirect3DBaseTexture9 *getBaseTexture() const;
     virtual void createTexture();
     virtual void updateTexture();
     virtual void convertToRenderTarget();
     virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
-    virtual TextureStorage *getStorage() const;
+    virtual TextureStorage *getStorage(bool renderTarget);
 
     bool isCubeComplete() const;
     bool isMipmapCubeComplete() const;
 
     void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
     void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
     void redefineImage(int faceIndex, GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type);
 
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -123,18 +123,18 @@ CPPSRCS += \
         LayerManagerD3D10.cpp \
         ReadbackManagerD3D10.cpp \
 	ShadowLayerUtilsD3D10.cpp \
         ThebesLayerD3D10.cpp \
         $(NULL)
 endif
 endif
 
-EXPORTS_NAMESPACES = IPC mozilla/layers
-EXPORTS_IPC = ShadowLayerUtils.h
+EXPORTS_NAMESPACES = gfxipc mozilla/layers
+EXPORTS_gfxipc = ShadowLayerUtils.h
 EXPORTS_mozilla/layers =\
         ShadowLayers.h \
         ShadowLayersChild.h \
         ShadowLayersParent.h \
         $(NULL)
 
 CPPSRCS += \
         ShadowLayers.cpp \
--- a/gfx/layers/ipc/PLayers.ipdl
+++ b/gfx/layers/ipc/PLayers.ipdl
@@ -37,17 +37,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 //include protocol PCompositor;
 include protocol PLayer;
 include protocol PRenderFrame;
 
-include "IPC/ShadowLayerUtils.h";
+include "gfxipc/ShadowLayerUtils.h";
 
 using gfx3DMatrix;
 using gfxRGBA;
 using nsIntPoint;
 using nsIntRect;
 using nsIntRegion;
 using nsIntSize;
 using mozilla::GraphicsFilterType;
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -44,17 +44,17 @@
 #include "gfxSharedImageSurface.h"
 
 #include "mozilla/ipc/SharedMemorySysV.h"
 #include "mozilla/layers/PLayerChild.h"
 #include "mozilla/layers/PLayersChild.h"
 #include "mozilla/layers/PLayersParent.h"
 #include "ShadowLayers.h"
 #include "ShadowLayerChild.h"
-#include "ShadowLayerUtils.h"
+#include "gfxipc/ShadowLayerUtils.h"
 
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace layers {
 
 typedef nsTArray<SurfaceDescriptor> BufferArray; 
 typedef std::vector<Edit> EditVector;
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -100,17 +100,16 @@ EXPORTS += \
 	$(NULL)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 EXPORTS += \
 	gfxPlatformMac.h \
 	gfxQuartzSurface.h \
 	gfxQuartzImageSurface.h \
-	gfxQuartzPDFSurface.h \
 	gfxQuartzNativeDrawing.h \
 	$(NULL)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 EXPORTS += \
 	gfxFT2FontBase.h \
 	gfxGdkNativeRenderer.h \
@@ -127,19 +126,16 @@ EXPORTS += \
 endif
 
 ifdef MOZ_PANGO
 EXPORTS += gfxPangoFonts.h
 else
 EXPORTS += gfxFT2Fonts.h
 endif
 
-ifdef MOZ_DFB
-EXPORTS += gfxDirectFBSurface.h
-endif
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
 EXPORTS	+= \
 	gfxOS2Fonts.h \
 	gfxOS2Platform.h \
 	gfxOS2Surface.h \
 	gfxPDFSurface.h \
@@ -323,24 +319,16 @@ endif
 
 CPPSRCS +=  gfxPlatformGtk.cpp gfxGdkNativeRenderer.cpp
 CPPSRCS +=	gfxPDFSurface.cpp gfxPSSurface.cpp
 CPPSRCS +=	gfxFontconfigUtils.cpp
 CPPSRCS +=	gfxFT2FontBase.cpp
 CPPSRCS +=	gfxFT2Utils.cpp
 CPPSRCS +=	nsUnicodeRange.cpp
 
-ifdef MOZ_DFB
-CSRCS = cairo-gdk-utils.c
-endif
-
-endif
-
-ifdef MOZ_DFB
-CPPSRCS += gfxDirectFBSurface.cpp
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
 CPPSRCS += gfxQtPlatform.cpp gfxQPainterSurface.cpp
 ifdef MOZ_X11
 CPPSRCS += gfxXlibSurface.cpp gfxQtNativeRenderer.cpp
 endif
 ifdef MOZ_PANGO
@@ -354,17 +342,16 @@ CPPSRCS +=	gfxFontconfigUtils.cpp
 CPPSRCS +=	nsUnicodeRange.cpp
 CPPSRCS +=	gfxPDFSurface.cpp
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CPPSRCS	+= \
 	gfxQuartzSurface.cpp \
 	gfxQuartzImageSurface.cpp \
-	gfxQuartzPDFSurface.cpp \
 	gfxPlatformMac.cpp \
 	gfxMacFont.cpp \
 	gfxCoreTextShaper.cpp \
 	$(NULL)
 #CPPSRCS +=	gfxPDFSurface.cpp
 CPPSRCS +=      nsUnicodeRange.cpp
 CPPSRCS +=      gfxQuartzNativeDrawing.cpp
 
deleted file mode 100644
--- a/gfx/thebes/cairo-gdk-utils.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Novell code.
- *
- * The Initial Developer of the Original Code is Novell.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   rocallahan@novell.com
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "cairo-gdk-utils.h"
-
-#include <stdlib.h>
-
-#if   HAVE_STDINT_H
-#include <stdint.h>
-#elif HAVE_INTTYPES_H
-#include <inttypes.h>
-#elif HAVE_SYS_INT_TYPES_H
-#include <sys/int_types.h>
-#endif
-
-
-/* We have three basic strategies available:
-   1) 'direct': cr targets a native surface, and other conditions are met: we can
-      pass the underlying drawable directly to the callback
-   2) 'opaque': the image is opaque: we can create a temporary cairo native surface,
-      pass its underlying drawable to the callback, and paint the result
-      using cairo
-   3) 'default': create a temporary cairo native surface, fill with black, pass its
-      underlying drawable to the callback, copy the results to a cairo
-      image surface, repeat with a white background, update the on-black
-      image alpha values by comparing the two images, then paint the on-black
-      image using cairo
-   Sure would be nice to have an X extension to do 3 for us on the server...
-*/
-
-static cairo_bool_t
-_convert_coord_to_short (double coord, short *v)
-{
-    *v = (short)coord;
-    /* XXX allow some tolerance here? */
-    return *v == coord;
-}
-
-static cairo_bool_t
-_convert_coord_to_unsigned_short (double coord, unsigned short *v)
-{
-    *v = (unsigned short)coord;
-    /* XXX allow some tolerance here? */
-    return *v == coord;
-}
-
-
-void cairo_draw_with_gdk (cairo_t *cr,
-                           cairo_gdk_drawing_callback callback,
-                           void * closure,
-                           unsigned int width, unsigned int height,
-                           cairo_gdk_drawing_opacity_t is_opaque,
-                           cairo_gdk_drawing_support_t capabilities,
-                           cairo_gdk_drawing_result_t *result)
-{
-    double device_offset_x, device_offset_y;
-    short offset_x = 0, offset_y = 0;
-    //cairo_surface_t * target = cairo_get_group_target (cr);
-    cairo_surface_t * target = cairo_get_target (cr);
-    cairo_matrix_t matrix;
-
-    cairo_surface_get_device_offset (target, &device_offset_x, &device_offset_y);
-    cairo_get_matrix (cr, &matrix);
-
-    _convert_coord_to_short (matrix.x0 + device_offset_x, &offset_x);
-    _convert_coord_to_short (matrix.y0 + device_offset_y, &offset_y);
-
-    cairo_surface_flush (target);
-    callback (closure, target, offset_x, offset_y, NULL, 0);
-    cairo_surface_mark_dirty (target);
-}
-
-
deleted file mode 100644
--- a/gfx/thebes/cairo-gdk-utils.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Novell code.
- *
- * The Initial Developer of the Original Code is Novell.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   rocallahan@novell.com
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef CAIROGDKUTILS_H_
-#define CAIROGDKUTILS_H_
-
-#include "cairo.h"
-#include <gdk/gdk.h>
-
-CAIRO_BEGIN_DECLS
-
-/**
- * This callback encapsulates GDK-based rendering. We assume that the
- * execution of the callback is equivalent to compositing some RGBA image of
- * size (bounds_width, bounds_height) onto the drawable at offset (offset_x,
- * offset_y), clipped to the union of the clip_rects if num_rects is greater
- * than zero. This includes the assumption that the same RGBA image
- * is composited if you call the callback multiple times with the same closure,
- * display and visual during a single cairo_draw_with_gdk call.
- * 
- * @return True when able to draw, False otherwise
- */
-typedef cairo_bool_t (* cairo_gdk_drawing_callback)
-    (void *closure,
-     cairo_surface_t *surface,
-     short offset_x, short offset_y,
-     GdkRectangle * clip_rects, unsigned int num_rects);
-
-/**
- * This type specifies whether the native drawing callback draws all pixels
- * in its bounds opaquely, independent of the contents of the target drawable,
- * or whether it leaves pixels transparent/translucent or depends on the
- * existing contents of the target drawable in some way.
- */
-typedef enum _cairo_gdk_drawing_opacity {
-    CAIRO_GDK_DRAWING_OPAQUE,
-    CAIRO_GDK_DRAWING_TRANSPARENT
-} cairo_gdk_drawing_opacity_t;
-
-/**
- * This type encodes the capabilities of the native drawing callback.
- * 
- * If CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT is set, then 'num_rects' can be
- * zero or one in the call to the callback. Otherwise 'num_rects' will be
- * zero.
- */
-typedef enum {
-    CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT = 0x02,
-} cairo_gdk_drawing_support_t;
-
-/**
- * Draw GDK output into any cairo context. All cairo transforms and effects
- * are honored, including the current operator. This is equivalent to a
- * cairo_set_source_surface and then cairo_paint.
- * @param cr the context to draw into
- * @param drawable a GDK Drawable that we're targetting
- * @param callback the code to perform GDK rendering
- * @param closure associated data
- * @param width the width of the putative image drawn by the callback
- * @param height the height of the putative image drawn by the callback
- * @param is_opaque set to CAIRO_GDK_DRAWING_IS_OPAQUE to indicate
- * that all alpha values of the putative image will be 1.0; the pixels drawn into
- * the Drawable must not depend on the prior contents of the Drawable
- * in any way
- * @param capabilities the capabilities of the callback as described above.
- * @param result if non-NULL, we *may* fill in the struct with information about
- * the rendered image. 'surface' may be filled in with a surface representing
- * the image, similar to the target of 'cr'. If 'uniform_alpha' is True then
- * every pixel of the image has the same alpha value 'alpha'. If
- * 'uniform_color' is True then every pixel of the image has the same RGB
- * color (r, g, b). If the image has uniform color and alpha (or alpha is zero,
- * in which case the color is always uniform) then we won't bother returning
- * a surface for it.
- */
-void cairo_draw_with_gdk (cairo_t *cr,
-                          cairo_gdk_drawing_callback callback,
-                          void * closure,
-                          unsigned int width, unsigned int height,
-                          cairo_gdk_drawing_opacity_t is_opaque,
-                          cairo_gdk_drawing_support_t capabilities,
-                          cairo_gdk_drawing_result_t *result);
-
-CAIRO_END_DECLS
-
-#endif /*CAIROGDKUTILS_H_*/
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -59,20 +59,16 @@
 #include "gfxXlibSurface.h"
 #endif
 
 #ifdef CAIRO_HAS_QUARTZ_SURFACE
 #include "gfxQuartzSurface.h"
 #include "gfxQuartzImageSurface.h"
 #endif
 
-#ifdef MOZ_DFB
-#include "gfxDirectFBSurface.h"
-#endif
-
 #if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
 #include "gfxQPainterSurface.h"
 #endif
 
 #include <stdio.h>
 #include <limits.h>
 
 #include "imgIEncoder.h"
@@ -198,21 +194,16 @@ gfxASurface::Wrap (cairo_surface_t *csur
 #ifdef CAIRO_HAS_QUARTZ_SURFACE
     else if (stype == CAIRO_SURFACE_TYPE_QUARTZ) {
         result = new gfxQuartzSurface(csurf);
     }
     else if (stype == CAIRO_SURFACE_TYPE_QUARTZ_IMAGE) {
         result = new gfxQuartzImageSurface(csurf);
     }
 #endif
-#ifdef MOZ_DFB
-    else if (stype == CAIRO_SURFACE_TYPE_DIRECTFB) {
-        result = new gfxDirectFBSurface(csurf);
-    }
-#endif
 #if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
     else if (stype == CAIRO_SURFACE_TYPE_QT) {
         result = new gfxQPainterSurface(csurf);
     }
 #endif
     else {
         result = new gfxUnknownSurface(csurf);
     }
@@ -574,21 +565,21 @@ static const SurfaceMemoryReporterAttrs 
     {"gfx-surface-pdf", nsnull},
     {"gfx-surface-ps", nsnull},
     {"gfx-surface-xlib",
      "Memory used by xlib surfaces to store pixmaps. This memory lives in "
      "the X server's process rather than in this application, so the bytes "
      "accounted for here aren't counted in vsize, resident, explicit, or any of "
      "the other measurements on this page."},
     {"gfx-surface-xcb", nsnull},
-    {"gfx-surface-glitz", nsnull},
+    {"gfx-surface-glitz???", nsnull},       // should never be used
     {"gfx-surface-quartz", nsnull},
     {"gfx-surface-win32", nsnull},
     {"gfx-surface-beos", nsnull},
-    {"gfx-surface-directfb", nsnull},
+    {"gfx-surface-directfb???", nsnull},    // should never be used
     {"gfx-surface-svg", nsnull},
     {"gfx-surface-os2", nsnull},
     {"gfx-surface-win32printing", nsnull},
     {"gfx-surface-quartzimage", nsnull},
     {"gfx-surface-script", nsnull},
     {"gfx-surface-qpainter", nsnull},
     {"gfx-surface-recording", nsnull},
     {"gfx-surface-vg", nsnull},
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -75,21 +75,21 @@ public:
     } gfxImageFormat;
 
     typedef enum {
         SurfaceTypeImage,
         SurfaceTypePDF,
         SurfaceTypePS,
         SurfaceTypeXlib,
         SurfaceTypeXcb,
-        SurfaceTypeGlitz,
+        SurfaceTypeGlitz,           // unused, but needed for cairo parity
         SurfaceTypeQuartz,
         SurfaceTypeWin32,
         SurfaceTypeBeOS,
-        SurfaceTypeDirectFB,
+        SurfaceTypeDirectFB,        // unused, but needed for cairo parity
         SurfaceTypeSVG,
         SurfaceTypeOS2,
         SurfaceTypeWin32Printing,
         SurfaceTypeQuartzImage,
         SurfaceTypeScript,
         SurfaceTypeQPainter,
         SurfaceTypeRecording,
         SurfaceTypeVG,
deleted file mode 100644
--- a/gfx/thebes/gfxDirectFBSurface.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Vladimir Vukicevic <vladimir@pobox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "gfxDirectFBSurface.h"
-
-#include "cairo-directfb.h"
-
-gfxDirectFBSurface::gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *dfbs)
-    : mDFB(nsnull), mDFBSurface(nsnull)
-{
-    dfb->AddRef( dfb );
-    dfbs->AddRef( dfbs );
-
-    cairo_surface_t *surf = cairo_directfb_surface_create(dfb, dfbs);
-
-    mDFB = dfb;
-    mDFBSurface = dfbs;
-
-    Init(surf);
-}
-
-gfxDirectFBSurface::gfxDirectFBSurface(IDirectFBSurface *dfbs)
-    : mDFB(nsnull), mDFBSurface(nsnull)
-{
-    DFBResult ret;
-
-    dfbs->AddRef( dfbs );
-
-    /* Lightweight, getting singleton */
-    ret = DirectFBCreate( &mDFB );
-    if (ret) {
-         D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
-         return;
-    }
-
-    cairo_surface_t *surf = cairo_directfb_surface_create(mDFB, dfbs);
-
-    mDFBSurface = dfbs;
-
-    Init(surf);
-}
-
-gfxDirectFBSurface::gfxDirectFBSurface(cairo_surface_t *csurf)
-{
-    mDFB = nsnull;
-    mDFBSurface = nsnull;
-
-    Init(csurf, true);
-}
-
-gfxDirectFBSurface::gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format) :
-    mDFB(nsnull), mDFBSurface(nsnull)
-{
-     DFBResult             ret;
-     DFBSurfaceDescription desc;
-
-     if (!CheckSurfaceSize(size) || size.width <= 0 || size.height <= 0)
-          return;
-
-     /* Lightweight, getting singleton */
-     ret = DirectFBCreate( &mDFB );
-     if (ret) {
-          D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
-          return;
-     }
-
-     desc.flags  = (DFBSurfaceDescriptionFlags)( DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT );
-     desc.width  = size.width;
-     desc.height = size.height;
-
-     switch (format) {
-          case gfxASurface::ImageFormatARGB32:
-               desc.pixelformat = DSPF_ARGB;
-               break;
-
-          case gfxASurface::ImageFormatRGB24:
-               desc.pixelformat = DSPF_RGB32;
-               break;
-
-          case gfxASurface::ImageFormatA8:
-               desc.pixelformat = DSPF_A8;
-               break;
-
-          case gfxASurface::ImageFormatA1:
-               desc.pixelformat = DSPF_A1;
-               break;
-
-          default:
-               D_BUG( "unknown format" );
-               return;
-     }
-
-     ret = mDFB->CreateSurface( mDFB, &desc, &mDFBSurface );
-     if (ret) {
-          D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: "
-                                        "IDirectFB::CreateSurface( %dx%d ) failed!\n", desc.width, desc.height );
-          return;
-     }
-
-     cairo_surface_t *surface = cairo_directfb_surface_create(mDFB, mDFBSurface);
-
-     Init(surface);
-}
-
-gfxDirectFBSurface::~gfxDirectFBSurface()
-{
-     if (mDFBSurface)
-          mDFBSurface->Release( mDFBSurface );
-
-     if (mDFB)
-          mDFB->Release( mDFB );
-}
-
deleted file mode 100644
--- a/gfx/thebes/gfxDirectFBSurface.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is DirectFB Thebes code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Vladimir Vukicevic <vladimir@pobox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef GFX_DIRECTFBSURFACE_H
-#define GFX_DIRECTFBSURFACE_H
-
-#include "gfxASurface.h"
-
-extern "C" {
-#include "direct/messages.h"
-
-typedef struct _IDirectFB IDirectFB;
-typedef struct _IDirectFBSurface IDirectFBSurface;
-
-}
-
-class THEBES_API gfxDirectFBSurface : public gfxASurface {
-public:
-    gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *surface);
-    gfxDirectFBSurface(IDirectFBSurface *surface);
-    gfxDirectFBSurface(cairo_surface_t *csurf);
-
-    gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format);
-
-    virtual ~gfxDirectFBSurface();
-
-    IDirectFB* DirectFB() { return mDFB; }
-    IDirectFBSurface* DirectFBSurface() { return mDFBSurface; }
-
-protected:
-    IDirectFB *mDFB;
-    IDirectFBSurface *mDFBSurface;
-};
-
-#endif /* GFX_DIRECTFBSURFACE_H */
--- a/gfx/thebes/gfxGdkNativeRenderer.cpp
+++ b/gfx/thebes/gfxGdkNativeRenderer.cpp
@@ -88,61 +88,8 @@ gfxGdkNativeRenderer::Draw(gfxContext* c
         gdk_x11_visual_get_xvisual(gdk_colormap_get_visual(colormap));
     Screen* screen =
         gdk_x11_screen_get_xscreen(gdk_colormap_get_screen(colormap));
 
     gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual, nsnull);
 }
 
 #endif
-#ifdef MOZ_DFB
-
-#include "cairo-gdk-utils.h"
-
-typedef struct {
-    gfxGdkNativeRenderer* mRenderer;
-    nsresult               mRV;
-} NativeRenderingClosure;
-
-static cairo_bool_t
-NativeRendering(void *closure,
-                cairo_surface_t *surface,
-                short offset_x, short offset_y,
-                GdkRectangle * rectangles, unsigned int num_rects)
-{
-    NativeRenderingClosure* cl = (NativeRenderingClosure*)closure;
-    nsRefPtr<gfxASurface> gfxSurface = gfxASurface::Wrap(surface);
-    GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(gfxSurface);
-    if (!drawable)
-        return 0;
-
-    nsresult rv = cl->mRenderer->
-        DrawWithGDK(drawable, offset_x, offset_y,
-                    rectangles, num_rects);
-    cl->mRV = rv;
-    return NS_SUCCEEDED(rv);
-}
-
-void
-gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
-                           PRUint32 flags, GdkVisual* visual)
-{
-    NativeRenderingClosure closure = { this, NS_OK };
-    cairo_gdk_drawing_result_t result;
-  
-    int cairoFlags = 0;
-    if (flags & DRAW_SUPPORTS_CLIP_RECT) {
-        cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT;
-    }
-    cairo_draw_with_gdk(ctx->GetCairo(),
-                        NativeRendering, 
-                        &closure, size.width, size.height,
-                        (flags & DRAW_IS_OPAQUE) ? CAIRO_GDK_DRAWING_OPAQUE : CAIRO_GDK_DRAWING_TRANSPARENT,
-                        (cairo_gdk_drawing_support_t)cairoFlags,
-                        NULL);
-    if (NS_FAILED(closure.mRV)) {
-        return closure.mRV;
-    }
-  
-    return NS_OK;
-}
-
-#endif // MOZ_DFB
deleted file mode 100644
--- a/gfx/thebes/gfxGlitzSurface.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Oracle Corporation code.
- *
- * The Initial Developer of the Original Code is Oracle Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2005
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Vladimir Vukicevic <vladimir@pobox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef GFX_GLITZSURFACE_H
-#define GFX_GLITZSURFACE_H
-
-#include "gfxASurface.h"
-
-#include <cairo-glitz.h>
-
-/**
- * A surface that wraps a glitz surface.
- */
-class THEBES_API gfxGlitzSurface : public gfxASurface {
-public:
-    gfxGlitzSurface(glitz_drawable_t *drawable,
-                    glitz_surface_t *glitzSurface,
-                    bool takeOwnership = false);
-
-    virtual ~gfxGlitzSurface();
-
-    /**
-     * When double-buffering is used, swaps the back and the front buffer.
-     */
-    void SwapBuffers();
-
-    unsigned long Width();
-    unsigned long Height();
-
-    glitz_surface_t* GlitzSurface() { return mGlitzSurface; }
-    glitz_drawable_t* GlitzDrawable() { return mGlitzDrawable; }
-
-protected:
-    glitz_drawable_t *mGlitzDrawable;
-    glitz_surface_t *mGlitzSurface;
-    bool mOwnsSurface;
-};
-
-#endif /* GFX_GLITZSURFACE_H */
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -67,24 +67,16 @@
 
 /* Undefine the Status from Xlib since it will conflict with system headers on OSX */
 #if defined(__APPLE__) && defined(Status)
 #undef Status
 #endif
 
 #endif /* MOZ_X11 */
 
-#ifdef MOZ_DFB
-#include "gfxDirectFBSurface.h"
-#endif
-
-#ifdef MOZ_DFB
-#include "gfxDirectFBSurface.h"
-#endif
-
 #include <fontconfig/fontconfig.h>
 
 #include "nsMathUtils.h"
 
 #define GDK_PIXMAP_SIZE_MAX 32767
 
 #ifndef MOZ_PANGO
 #include <ft2build.h>
@@ -199,23 +191,16 @@ gfxPlatformGtk::CreateOffscreenSurface(c
 
             if (xrenderFormat) {
                 newSurface = gfxXlibSurface::Create(screen, xrenderFormat, size);
             }
         }
     }
 #endif
 
-#ifdef MOZ_DFB
-    if (size.width < GDK_PIXMAP_SIZE_MAX && size.height < GDK_PIXMAP_SIZE_MAX) {
-        newSurface = new gfxDirectFBSurface(size, imageFormat);
-    }
-#endif
-
-
     if (!newSurface) {
         // We couldn't create a native surface for whatever reason;
         // e.g., no display, no RENDER, bad size, etc.
         // Fall back to image surface for the data.
         newSurface = new gfxImageSurface(size, imageFormat);
     }
 
     if (newSurface->CairoStatus()) {
deleted file mode 100644
--- a/gfx/thebes/gfxQuartzPDFSurface.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Stuart Parmenter <stuart@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "gfxQuartzPDFSurface.h"
-
-#include "cairo-quartz.h"
-
-gfxQuartzPDFSurface::gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints)
-{
-    mRect = CGRectMake(0.0, 0.0, aSizeInPoints.width, aSizeInPoints.height);
-
-    CFStringRef file = CFStringCreateWithCString(kCFAllocatorDefault, filename, kCFStringEncodingUTF8);
-    CFURLRef fileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, file, kCFURLPOSIXPathStyle, false);
-    mCGContext = CGPDFContextCreateWithURL(fileURL, &mRect, NULL);
-
-    CFRelease(file);
-    CFRelease(fileURL);
-
-    Init(cairo_quartz_surface_create_for_cg_context(mCGContext, aSizeInPoints.width, aSizeInPoints.height));
-}
-
-gfxQuartzPDFSurface::~gfxQuartzPDFSurface()
-{
-    CGContextRelease(mCGContext);
-}
-
-
-nsresult
-gfxQuartzPDFSurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
-{
-    return NS_OK;
-}
-
-nsresult
-gfxQuartzPDFSurface::EndPrinting()
-{
-    return NS_OK;
-}
-
-nsresult
-gfxQuartzPDFSurface::AbortPrinting()
-{
-    return NS_OK;
-}
-
-nsresult
-gfxQuartzPDFSurface::BeginPage()
-{
-    CGContextBeginPage(mCGContext, &mRect);
-
-    return NS_OK;
-}
-
-nsresult
-gfxQuartzPDFSurface::EndPage()
-{
-    CGContextEndPage(mCGContext);
-    return NS_OK;
-}
deleted file mode 100644
--- a/gfx/thebes/gfxQuartzPDFSurface.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Stuart Parmenter <stuart@mozilla.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef GFX_QUARTZPDFSURFACE_H
-#define GFX_QUARTZPDFSURFACE_H
-
-#include "gfxASurface.h"
-#include "gfxContext.h"
-
-#include <Carbon/Carbon.h>
-
-class THEBES_API gfxQuartzPDFSurface : public gfxASurface {
-public:
-    gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints);
-    virtual ~gfxQuartzPDFSurface();
-
-    nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
-    nsresult EndPrinting();
-    nsresult AbortPrinting();
-    nsresult BeginPage();
-    nsresult EndPage();
-
-    virtual const gfxIntSize GetSize() const {
-        gfxIntSize size(mRect.size.width, mRect.size.height);
-        return size;
-    }
-
-    CGContextRef GetCGContext() { return mCGContext; }
-
-    virtual PRInt32 GetDefaultContextFlags() const
-    {
-      return gfxContext::FLAG_DISABLE_SNAPPING |
-             gfxContext::FLAG_DISABLE_COPY_BACKGROUND;
-    }
-
-protected:
-    CGContextRef mCGContext;
-    CGRect mRect;
-};
-#endif /* GFX_QUARTZPDFSURFACE_H */
--- a/image/decoders/icon/android/nsIconChannel.h
+++ b/image/decoders/icon/android/nsIconChannel.h
@@ -34,27 +34,29 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h_
 #define nsIconChannel_h_
 
+#include "mozilla/Attributes.h"
+
 #include "nsIChannel.h"
 #include "nsIURI.h"
 #include "nsIIconURI.h"
 #include "nsCOMPtr.h"
 
 /**
  * This class is the Android implementation of nsIconChannel.
  * It asks Android for an icon, and creates a new channel for
  * that file to which all calls will be proxied.
  */
-class nsIconChannel : public nsIChannel {
+class nsIconChannel MOZ_FINAL : public nsIChannel {
   public:
     NS_DECL_ISUPPORTS
     NS_FORWARD_NSIREQUEST(mRealChannel->)
     NS_FORWARD_NSICHANNEL(mRealChannel->)
 
     nsIconChannel() {}
     ~nsIconChannel() {}
 
--- a/image/decoders/icon/gtk/nsIconChannel.cpp
+++ b/image/decoders/icon/gtk/nsIconChannel.cpp
@@ -278,16 +278,17 @@ moz_gtk_icon_size(const char *name)
     return GTK_ICON_SIZE_DND;
 
   if (strcmp(name, "dialog") == 0)
     return GTK_ICON_SIZE_DIALOG;
 
   return GTK_ICON_SIZE_MENU;
 }
 
+#if defined(MOZ_ENABLE_GNOMEUI) || defined(MOZ_ENABLE_GIO)
 static PRInt32
 GetIconSize(nsIMozIconURI *aIconURI)
 {
   nsCAutoString iconSizeString;
 
   aIconURI->GetIconSize(iconSizeString);
   if (iconSizeString.IsEmpty()) {
     PRUint32 size;
@@ -315,16 +316,17 @@ ScaleIconBuf(GdkPixbuf **aBuf, PRInt32 i
     // replace original buffer by scaled
     g_object_unref(*aBuf);
     *aBuf = scaled;
     if (!scaled)
       return NS_ERROR_OUT_OF_MEMORY;
   }
   return NS_OK;
 }
+#endif
 
 #ifdef MOZ_ENABLE_GNOMEUI
 nsresult
 nsIconChannel::InitWithGnome(nsIMozIconURI *aIconURI)
 {
   nsresult rv;
 
   if (NS_FAILED(ensure_libgnomeui()) || NS_FAILED(ensure_libgnome()) || NS_FAILED(ensure_libgnomevfs())) {
--- a/image/decoders/icon/gtk/nsIconChannel.h
+++ b/image/decoders/icon/gtk/nsIconChannel.h
@@ -32,28 +32,30 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h_
 #define nsIconChannel_h_
 
+#include "mozilla/Attributes.h"
+
 #include "nsIChannel.h"
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 #include "nsIIconURI.h"
 #include "nsCOMPtr.h"
 
 /**
  * This class is the gnome implementation of nsIconChannel. It basically asks
  * gtk/gnome for an icon, saves it as a tmp icon, and creates a new channel for
  * that file to which all calls will be proxied.
  */
-class nsIconChannel : public nsIChannel {
+class nsIconChannel MOZ_FINAL : public nsIChannel {
   public:
     NS_DECL_ISUPPORTS
     NS_FORWARD_NSIREQUEST(mRealChannel->)
     NS_FORWARD_NSICHANNEL(mRealChannel->)
 
     nsIconChannel() {}
     ~nsIconChannel() {}
 
--- a/image/decoders/icon/mac/nsIconChannel.h
+++ b/image/decoders/icon/mac/nsIconChannel.h
@@ -36,29 +36,31 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h___
 #define nsIconChannel_h___
 
+#include "mozilla/Attributes.h"
+
 #include "nsCOMPtr.h"
 #include "nsXPIDLString.h"
 #include "nsIChannel.h"
 #include "nsILoadGroup.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIInputStreamPump.h"
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 
 class nsIFile;
 
-class nsIconChannel : public nsIChannel, public nsIStreamListener
+class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
--- a/image/decoders/icon/os2/nsIconChannel.h
+++ b/image/decoders/icon/os2/nsIconChannel.h
@@ -36,29 +36,31 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h___
 #define nsIconChannel_h___
 
+#include "mozilla/Attributes.h"
+
 #include "nsCOMPtr.h"
 #include "nsXPIDLString.h"
 #include "nsIChannel.h"
 #include "nsILoadGroup.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIURI.h"
 #include "nsIInputStreamPump.h"
 #include "nsIStreamListener.h"
 
 class nsIFile;
 
-class nsIconChannel : public nsIChannel, public nsIStreamListener
+class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
--- a/image/decoders/icon/qt/nsIconChannel.h
+++ b/image/decoders/icon/qt/nsIconChannel.h
@@ -33,28 +33,30 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h_
 #define nsIconChannel_h_
 
+#include "mozilla/Attributes.h"
+
 #include "nsIChannel.h"
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 #include "nsIIconURI.h"
 #include "nsCOMPtr.h"
 
 /**
  * This class is the gnome implementation of nsIconChannel. It basically asks
  * qt for an icon, and creates a new channel for
  * that file to which all calls will be proxied.
  */
-class nsIconChannel : public nsIChannel {
+class nsIconChannel MOZ_FINAL : public nsIChannel {
   public:
     NS_DECL_ISUPPORTS
     NS_FORWARD_NSIREQUEST(mRealChannel->)
     NS_FORWARD_NSICHANNEL(mRealChannel->)
 
     nsIconChannel() {}
     ~nsIconChannel() {}
 
--- a/image/decoders/icon/win/nsIconChannel.h
+++ b/image/decoders/icon/win/nsIconChannel.h
@@ -35,32 +35,34 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIconChannel_h___
 #define nsIconChannel_h___
 
+#include "mozilla/Attributes.h"
+
 #include "nsCOMPtr.h"
 #include "nsXPIDLString.h"
 #include "nsIChannel.h"
 #include "nsILoadGroup.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIURI.h"
 #include "nsIInputStreamPump.h"
 #include "nsIStreamListener.h"
 #include "nsIIconURI.h"
 
 #include <windows.h>
 
 class nsIFile;
 
-class nsIconChannel : public nsIChannel, public nsIStreamListener
+class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
--- a/image/encoders/bmp/nsBMPEncoder.h
+++ b/image/encoders/bmp/nsBMPEncoder.h
@@ -30,35 +30,36 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "mozilla/Attributes.h"
+#include "mozilla/ReentrantMonitor.h"
+
 #include "imgIEncoder.h"
 #include "BMPFileHeaders.h"
 
-#include "mozilla/ReentrantMonitor.h"
-
 #include "nsCOMPtr.h"
 
 #define NS_BMPENCODER_CID \
 { /* 13a5320c-4c91-4FA4-bd16-b081a3ba8c0b */         \
      0x13a5320c,                                     \
      0x4c91,                                         \
      0x4fa4,                                         \
     {0xbd, 0x16, 0xb0, 0x81, 0xa3, 0Xba, 0x8c, 0x0b} \
 }
 
 // Provides BMP encoding functionality. Use InitFromData() to do the
 // encoding. See that function definition for encoding options.
 
-class nsBMPEncoder : public imgIEncoder
+class nsBMPEncoder MOZ_FINAL : public imgIEncoder
 {
   typedef mozilla::ReentrantMonitor ReentrantMonitor;
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_IMGIENCODER
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIASYNCINPUTSTREAM
 
--- a/image/encoders/ico/nsICOEncoder.cpp
+++ b/image/encoders/ico/nsICOEncoder.cpp
@@ -45,25 +45,23 @@
 #include "nsString.h"
 #include "nsStreamUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::imagelib;
 
 NS_IMPL_THREADSAFE_ISUPPORTS3(nsICOEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream)
 
-nsICOEncoder::nsICOEncoder() : mFinished(false),
-                               mImageBufferStart(nsnull), 
+nsICOEncoder::nsICOEncoder() : mImageBufferStart(nsnull),
                                mImageBufferCurr(0),
                                mImageBufferSize(0), 
                                mImageBufferReadPoint(0), 
-                               mCallback(nsnull),
-                               mCallbackTarget(nsnull), 
-                               mNotifyThreshold(0),
-                               mUsePNG(true)
+                               mFinished(false),
+                               mUsePNG(true),
+                               mNotifyThreshold(0)
 {
 }
 
 nsICOEncoder::~nsICOEncoder()
 {
   if (mImageBufferStart) {
     moz_free(mImageBufferStart);
     mImageBufferStart = nsnull;
--- a/image/encoders/ico/nsICOEncoder.h
+++ b/image/encoders/ico/nsICOEncoder.h
@@ -30,19 +30,20 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "imgIEncoder.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/ReentrantMonitor.h"
 
-#include "mozilla/ReentrantMonitor.h"
+#include "imgIEncoder.h"
 
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "ICOFileHeaders.h"
 
 class nsBMPEncoder;
 class nsPNGEncoder;
 
@@ -52,17 +53,17 @@ class nsPNGEncoder;
      0x8968,                                         \
      0x41b1,                                         \
     {0x87, 0x09, 0xb6, 0x12, 0x3b, 0Xce, 0xaf, 0x21} \
 }
 
 // Provides ICO encoding functionality. Use InitFromData() to do the
 // encoding. See that function definition for encoding options.
 
-class nsICOEncoder : public imgIEncoder
+class nsICOEncoder MOZ_FINAL : public imgIEncoder
 {
   typedef mozilla::ReentrantMonitor ReentrantMonitor;
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_IMGIENCODER
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIASYNCINPUTSTREAM
 
--- a/image/encoders/png/nsPNGEncoder.h
+++ b/image/encoders/png/nsPNGEncoder.h
@@ -30,36 +30,37 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "imgIEncoder.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/ReentrantMonitor.h"
 
-#include "mozilla/ReentrantMonitor.h"
+#include "imgIEncoder.h"
 
 #include "nsCOMPtr.h"
 
 #include <png.h>
 
 #define NS_PNGENCODER_CID \
 { /* 38d1592e-b81e-432b-86f8-471878bbfe07 */         \
      0x38d1592e,                                     \
      0xb81e,                                         \
      0x432b,                                         \
     {0x86, 0xf8, 0x47, 0x18, 0x78, 0xbb, 0xfe, 0x07} \
 }
 
 // Provides PNG encoding functionality. Use InitFromData() to do the
 // encoding. See that function definition for encoding options.
 
-class nsPNGEncoder : public imgIEncoder
+class nsPNGEncoder MOZ_FINAL : public imgIEncoder
 {
   typedef mozilla::ReentrantMonitor ReentrantMonitor;
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_IMGIENCODER
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIASYNCINPUTSTREAM
 
--- a/image/src/BMPFileHeaders.h
+++ b/image/src/BMPFileHeaders.h
@@ -133,9 +133,9 @@ enum ERLEState {
   eRLEStateInitial,
   eRLEStateNeedSecondEscapeByte,
   eRLEStateNeedXDelta,
   eRLEStateNeedYDelta,    ///< mStateData will hold x delta
   eRLEStateAbsoluteMode,  ///< mStateData will hold count of existing data to read
   eRLEStateAbsoluteModePadded ///< As above, but another byte of data has to be read as padding
 };
 
-#endif
\ No newline at end of file
+#endif
--- a/image/src/Decoder.cpp
+++ b/image/src/Decoder.cpp
@@ -43,23 +43,23 @@
 
 namespace mozilla {
 namespace imagelib {
 
 Decoder::Decoder(RasterImage &aImage, imgIDecoderObserver* aObserver)
   : mImage(aImage)
   , mObserver(aObserver)
   , mDecodeFlags(0)
+  , mDecodeDone(false)
+  , mDataError(false)
   , mFrameCount(0)
   , mFailCode(NS_OK)
   , mInitialized(false)
   , mSizeDecode(false)
   , mInFrame(false)
-  , mDecodeDone(false)
-  , mDataError(false)
   , mIsAnimated(false)
 {
 }
 
 Decoder::~Decoder()
 {
   NS_WARN_IF_FALSE(!mInFrame, "Shutting down decoder mid-frame!");
   mInitialized = false;
--- a/image/src/DiscardTracker.cpp
+++ b/image/src/DiscardTracker.cpp
@@ -141,32 +141,42 @@ DiscardTracker::DiscardAll()
   // Add the sentinel back to the (now empty) list.
   Reset(&sSentinel);
 
   // Because the sentinel is the only element in the list, the next timer event
   // would be a no-op.  Disable the timer as an optimization.
   TimerOff();
 }
 
+static int
+DiscardTimeoutChangedCallback(const char* aPref, void *aClosure)
+{
+  DiscardTracker::ReloadTimeout();
+  return 0;
+}
+
 /**
  * Initialize the tracker.
  */
 nsresult
 DiscardTracker::Initialize()
 {
   nsresult rv;
 
   // Set up the list. Head<->Sentinel<->Tail
   sHead.curr = sTail.curr = sSentinel.curr = nsnull;
   sHead.prev = sTail.next = nsnull;
   sHead.next = sTail.prev = &sSentinel;
   sSentinel.prev = &sHead;
   sSentinel.next = &sTail;
 
-  // Load the timeout
+  // Watch the timeout pref for changes.
+  Preferences::RegisterCallback(DiscardTimeoutChangedCallback,
+                                DISCARD_TIMEOUT_PREF);
+
   ReloadTimeout();
 
   // Create and start the timer
   nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
   NS_ENSURE_TRUE(t, NS_ERROR_OUT_OF_MEMORY);
   t.forget(&sTimer);
   rv = TimerOn();
   NS_ENSURE_SUCCESS(rv, rv);
@@ -186,17 +196,17 @@ DiscardTracker::Shutdown()
   if (sTimer) {
     sTimer->Cancel();
     NS_RELEASE(sTimer);
     sTimer = nsnull;
   }
 }
 
 /**
- * Sets the minimum timeout.
+ * Read the discard timeout from about:config.
  */
 void
 DiscardTracker::ReloadTimeout()
 {
   nsresult rv;
 
   // read the timeout pref
   PRInt32 discardTimeout;
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -53,16 +53,17 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsAutoPtr.h"
 #include "nsStringStream.h"
 #include "prmem.h"
 #include "prenv.h"
 #include "ImageLogging.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/Preferences.h"
 #include "ImageLayers.h"
 
 #include "nsPNGDecoder.h"
 #include "nsGIFDecoder2.h"
 #include "nsJPEGDecoder.h"
 #include "nsBMPDecoder.h"
 #include "nsICODecoder.h"
 #include "nsIconDecoder.h"
@@ -79,35 +80,34 @@ using namespace mozilla::layers;
 
 /* Accounting for compressed data */
 #if defined(PR_LOGGING)
 static PRLogModuleInfo *gCompressedImageAccountingLog = PR_NewLogModule ("CompressedImageAccounting");
 #else
 #define gCompressedImageAccountingLog
 #endif
 
-// Tweakable progressive decoding parameters
-static PRUint32 gDecodeBytesAtATime = 200000;
-static PRUint32 gMaxMSBeforeYield = 400;
-static PRUint32 gMaxBytesForSyncDecode = 150000;
-
-void
-RasterImage::SetDecodeBytesAtATime(PRUint32 aBytesAtATime)
+// Tweakable progressive decoding parameters.  These are initialized to 0 here
+// because otherwise, we have to initialize them in a static initializer, which
+// makes us slower to start up.
+static bool gInitializedPrefCaches = false;
+static PRUint32 gDecodeBytesAtATime = 0;
+static PRUint32 gMaxMSBeforeYield = 0;
+static PRUint32 gMaxBytesForSyncDecode = 0;
+
+static void
+InitPrefCaches()
 {
-  gDecodeBytesAtATime = aBytesAtATime;
-}
-void
-RasterImage::SetMaxMSBeforeYield(PRUint32 aMaxMS)
-{
-  gMaxMSBeforeYield = aMaxMS;
-}
-void
-RasterImage::SetMaxBytesForSyncDecode(PRUint32 aMaxBytes)
-{
-  gMaxBytesForSyncDecode = aMaxBytes;
+  Preferences::AddUintVarCache(&gDecodeBytesAtATime,
+                               "image.mem.decode_bytes_at_a_time", 200000);
+  Preferences::AddUintVarCache(&gMaxMSBeforeYield,
+                               "image.mem.max_ms_before_yield", 400);
+  Preferences::AddUintVarCache(&gMaxBytesForSyncDecode,
+                               "image.mem.max_bytes_for_sync_decode", 150000);
+  gInitializedPrefCaches = true;
 }
 
 /* We define our own error checking macros here for 2 reasons:
  *
  * 1) Most of the failures we encounter here will (hopefully) be
  * the result of decoding failures (ie, bad data) and not code
  * failures. As such, we don't want to clutter up debug consoles
  * with spurious messages about NS_ENSURE_SUCCESS failures.
@@ -211,16 +211,21 @@ RasterImage::RasterImage(imgStatusTracke
 {
   // Set up the discard tracker node.
   mDiscardTrackerNode.curr = this;
   mDiscardTrackerNode.prev = mDiscardTrackerNode.next = nsnull;
   Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Add(0);
 
   // Statistics
   num_containers++;
+
+  // Register our pref observers if we haven't yet.
+  if (NS_UNLIKELY(!gInitializedPrefCaches)) {
+    InitPrefCaches();
+  }
 }
 
 //******************************************************************************
 RasterImage::~RasterImage()
 {
   delete mAnim;
 
   for (unsigned int i = 0; i < mFrames.Length(); ++i)
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -339,21 +339,16 @@ public:
     kDisposeClearAll         = -1, // Clear the whole image, revealing
                                    // what was there before the gif displayed
     kDisposeNotSpecified,   // Leave frame, let new frame draw on top
     kDisposeKeep,           // Leave frame, let new frame draw on top
     kDisposeClear,          // Clear the frame's area, revealing bg
     kDisposeRestorePrevious // Restore the previous (composited) frame
   };
 
-  // Progressive decoding knobs
-  static void SetDecodeBytesAtATime(PRUint32 aBytesAtATime);
-  static void SetMaxMSBeforeYield(PRUint32 aMaxMS);
-  static void SetMaxBytesForSyncDecode(PRUint32 aMaxBytes);
-
   const char* GetURIString() { return mURIString.get();}
 
 private:
   struct Anim
   {
     //! Area of the first frame that needs to be redrawn on subsequent loops.
     nsIntRect                  firstFrameRefreshArea;
     PRUint32                   currentAnimationFrameIndex; // 0 to numFrames-1
--- a/image/src/SVGDocumentWrapper.h
+++ b/image/src/SVGDocumentWrapper.h
@@ -36,16 +36,18 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* This class wraps an SVG document, for use by VectorImage objects. */
 
 #ifndef mozilla_imagelib_SVGDocumentWrapper_h_
 #define mozilla_imagelib_SVGDocumentWrapper_h_
 
+#include "mozilla/Attributes.h"
+
 #include "nsCOMPtr.h"
 #include "nsIStreamListener.h"
 #include "nsIObserver.h"
 #include "nsIContentViewer.h"
 #include "nsWeakReference.h"
 
 class nsIAtom;
 class nsIPresShell;
@@ -57,19 +59,19 @@ class nsSVGSVGElement;
 
 #define SVG_MIMETYPE     "image/svg+xml"
 #define OBSERVER_SVC_CID "@mozilla.org/observer-service;1"
 
 
 namespace mozilla {
 namespace imagelib {
 
-class SVGDocumentWrapper : public nsIStreamListener,
-                           public nsIObserver,
-                           nsSupportsWeakReference
+class SVGDocumentWrapper MOZ_FINAL : public nsIStreamListener,
+                                     public nsIObserver,
+                                     nsSupportsWeakReference
 {
 public:
   SVGDocumentWrapper();
   ~SVGDocumentWrapper();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUESTOBSERVER
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -32,16 +32,20 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "mozilla/Attributes.h"
+#include "mozilla/FunctionTimer.h"
+#include "mozilla/Preferences.h"
+
 #include "ImageLogging.h"
 #include "imgLoader.h"
 #include "imgRequestProxy.h"
 
 #include "RasterImage.h"
 /* We end up pulling in windows.h because we eventually hit gfxWindowsSurface;
  * windows.h defines LoadImage, so we have to #undef it or imgLoader::LoadImage
  * gets changed.
@@ -84,19 +88,16 @@
 
 // we want to explore making the document own the load group
 // so we can associate the document URI with the load group.
 // until this point, we have an evil hack:
 #include "nsIHttpChannelInternal.h"  
 #include "nsIContentSecurityPolicy.h"
 #include "nsIChannelPolicy.h"
 
-#include "mozilla/FunctionTimer.h"
-#include "mozilla/Preferences.h"
-
 #include "nsContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::imagelib;
 
 #if defined(DEBUG_pavlov) || defined(DEBUG_timeless)
 #include "nsISimpleEnumerator.h"
 #include "nsXPCOM.h"
@@ -131,17 +132,17 @@ static void PrintImageDecoders()
         printf("Have decoder for mime type: %s\n", xcs.get()+decoderContract.Length());
       }
     }
   }
 }
 #endif
 
 
-class imgMemoryReporter :
+class imgMemoryReporter MOZ_FINAL :
   public nsIMemoryReporter
 {
 public:
   enum ReporterType {
     CHROME_BIT = PR_BIT(0),
     USED_BIT   = PR_BIT(1),
     RAW_BIT    = PR_BIT(2),
     HEAP_BIT   = PR_BIT(3),
@@ -754,17 +755,17 @@ nsresult imgLoader::CreateNewProxyForReq
   }
 
   // transfer reference to caller
   *_retval = static_cast<imgIRequest*>(proxyRequest);
 
   return NS_OK;
 }
 
-class imgCacheObserver : public nsIObserver
+class imgCacheObserver MOZ_FINAL : public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 private:
   imgLoader mLoader;
 };
 
@@ -778,17 +779,18 @@ imgCacheObserver::Observe(nsISupports* a
     mLoader.MinimizeCaches();
   } else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
              strcmp(aTopic, "chrome-flush-caches") == 0) {
     mLoader.ClearChromeImageCache();
   }
   return NS_OK;
 }
 
-class imgCacheExpirationTracker : public nsExpirationTracker<imgCacheEntry, 3>
+class imgCacheExpirationTracker MOZ_FINAL
+  : public nsExpirationTracker<imgCacheEntry, 3>
 {
   enum { TIMEOUT_SECONDS = 10 };
 public:
   imgCacheExpirationTracker();
 
 protected:
   void NotifyExpired(imgCacheEntry *entry);
 };
--- a/image/src/imgLoader.h
+++ b/image/src/imgLoader.h
@@ -36,16 +36,18 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef imgLoader_h__
 #define imgLoader_h__
 
+#include "mozilla/Attributes.h"
+
 #include "imgILoader.h"
 #include "imgICache.h"
 #include "nsWeakReference.h"
 #include "nsIContentSniffer.h"
 #include "nsRefPtrHashtable.h"
 #include "nsExpirationTracker.h"
 #include "nsAutoPtr.h"
 #include "prtypes.h"
@@ -387,19 +389,20 @@ private:
 };
 
 /**
  * A class that implements nsIProgressEventSink and forwards all calls to it to
  * the original notification callbacks of the channel. Also implements
  * nsIInterfaceRequestor and gives out itself for nsIProgressEventSink calls,
  * and forwards everything else to the channel's notification callbacks.
  */
-class nsProgressNotificationProxy : public nsIProgressEventSink
-                                  , public nsIChannelEventSink
-                                  , public nsIInterfaceRequestor
+class nsProgressNotificationProxy MOZ_FINAL
+  : public nsIProgressEventSink
+  , public nsIChannelEventSink
+  , public nsIInterfaceRequestor
 {
   public:
     nsProgressNotificationProxy(nsIChannel* channel,
                                 imgIRequest* proxy)
         : mImageRequest(proxy) {
       channel->GetNotificationCallbacks(getter_AddRefs(mOriginalCallbacks));
     }
 
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -79,100 +79,31 @@
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
 
 #include "mozilla/Preferences.h"
 
 #include "DiscardTracker.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 
-#define DISCARD_PREF "image.mem.discardable"
-#define DECODEONDRAW_PREF "image.mem.decodeondraw"
-#define BYTESATATIME_PREF "image.mem.decode_bytes_at_a_time"
-#define MAXMS_PREF "image.mem.max_ms_before_yield"
-#define MAXBYTESFORSYNC_PREF "image.mem.max_bytes_for_sync_decode"
 #define SVG_MIMETYPE "image/svg+xml"
 
 using namespace mozilla;
 using namespace mozilla::imagelib;
 
-/* Kept up to date by a pref observer. */
+static bool gInitializedPrefCaches = false;
 static bool gDecodeOnDraw = false;
 static bool gDiscardable = false;
 
-static const char* kObservedPrefs[] = {
-  DISCARD_PREF,
-  DECODEONDRAW_PREF,
-  DISCARD_TIMEOUT_PREF,
-  nsnull
-};
-
-/*
- * Pref observer goop. Yuck.
- */
-
-// Flag
-static bool gRegisteredPrefObserver = false;
-
-// Reloader
 static void
-ReloadPrefs()
+InitPrefCaches()
 {
-  // Discardable
-  gDiscardable = Preferences::GetBool(DISCARD_PREF, gDiscardable);
-
-  // Decode-on-draw
-  gDecodeOnDraw = Preferences::GetBool(DECODEONDRAW_PREF, gDecodeOnDraw);
-
-  // Progressive decoding knobs
-  PRInt32 bytesAtATime, maxMS, maxBytesForSync;
-  if (NS_SUCCEEDED(Preferences::GetInt(BYTESATATIME_PREF, &bytesAtATime))) {
-    RasterImage::SetDecodeBytesAtATime(bytesAtATime);
-  }
-
-  if (NS_SUCCEEDED(Preferences::GetInt(MAXMS_PREF, &maxMS))) {
-    RasterImage::SetMaxMSBeforeYield(maxMS);
-  }
-
-  if (NS_SUCCEEDED(Preferences::GetInt(MAXBYTESFORSYNC_PREF,
-                                       &maxBytesForSync))) {
-    RasterImage::SetMaxBytesForSyncDecode(maxBytesForSync);
-  }
-
-  // Discard timeout
-  mozilla::imagelib::DiscardTracker::ReloadTimeout();
-}
-
-// Observer
-class imgRequestPrefObserver : public nsIObserver {
-public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIOBSERVER
-};
-NS_IMPL_ISUPPORTS1(imgRequestPrefObserver, nsIObserver)
-
-// Callback
-NS_IMETHODIMP
-imgRequestPrefObserver::Observe(nsISupports     *aSubject,
-                                const char      *aTopic,
-                                const PRUnichar *aData)
-{
-  // Right topic
-  NS_ABORT_IF_FALSE(!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID), "invalid topic");
-
-  // Right pref
-  if (strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_PREF) &&
-      strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DECODEONDRAW_PREF) &&
-      strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_TIMEOUT_PREF))
-    return NS_OK;
-
-  // Process the change
-  ReloadPrefs();
-
-  return NS_OK;
+  Preferences::AddBoolVarCache(&gDiscardable, "image.mem.discardable");
+  Preferences::AddBoolVarCache(&gDecodeOnDraw, "image.mem.decodeondraw");
+  gInitializedPrefCaches = true;
 }
 
 #if defined(PR_LOGGING)
 PRLogModuleInfo *gImgLog = PR_NewLogModule("imgRequest");
 #endif
 
 NS_IMPL_ISUPPORTS8(imgRequest,
                    imgIDecoderObserver, imgIContainerObserver,
@@ -182,17 +113,22 @@ NS_IMPL_ISUPPORTS8(imgRequest,
                    nsIInterfaceRequestor,
                    nsIAsyncVerifyRedirectCallback)
 
 imgRequest::imgRequest() : 
   mValidator(nsnull), mImageSniffers("image-sniffing-services"),
   mInnerWindowId(0), mCORSMode(imgIRequest::CORS_NONE),
   mDecodeRequested(false), mIsMultiPartChannel(false), mGotData(false),
   mIsInCache(false)
-{}
+{
+  // Register our pref observers if we haven't yet.
+  if (NS_UNLIKELY(!gInitializedPrefCaches)) {
+    InitPrefCaches();
+  }
+}
 
 imgRequest::~imgRequest()
 {
   if (mURI) {
     nsCAutoString spec;
     mURI->GetSpec(spec);
     LOG_FUNC_WITH_PARAM(gImgLog, "imgRequest::~imgRequest()", "keyuri", spec.get());
   } else
@@ -235,24 +171,16 @@ nsresult imgRequest::Init(nsIURI *aURI,
                "Initializing with a channel that already calls back to us!");
 
   mChannel->SetNotificationCallbacks(this);
 
   mCacheEntry = aCacheEntry;
 
   SetLoadId(aLoadId);
 
-  // Register our pref observer if it hasn't been done yet.
-  if (NS_UNLIKELY(!gRegisteredPrefObserver)) {
-    nsCOMPtr<nsIObserver> observer(new imgRequestPrefObserver());
-    Preferences::AddStrongObservers(observer, kObservedPrefs);
-    ReloadPrefs();
-    gRegisteredPrefObserver = true;
-  }
-
   return NS_OK;
 }
 
 imgStatusTracker&
 imgRequest::GetStatusTracker()
 {
   if (mImage) {
     NS_ABORT_IF_FALSE(!mStatusTracker,
rename from image/test/reftest/bmp/bmp-8bpp/os2bmp-size-32x32-8bpp.bmp
rename to image/test/reftest/bmp/bmp-8bpp/os2-bmp-size-32x32-8bpp.bmp
--- a/image/test/reftest/bmp/bmp-8bpp/reftest.list
+++ b/image/test/reftest/bmp/bmp-8bpp/reftest.list
@@ -12,10 +12,13 @@
 == bmp-size-9x9-8bpp.bmp   bmp-size-9x9-8bpp.png
 == bmp-size-15x15-8bpp.bmp bmp-size-15x15-8bpp.png
 == bmp-size-16x16-8bpp.bmp bmp-size-16x16-8bpp.png
 == bmp-size-17x17-8bpp.bmp bmp-size-17x17-8bpp.png
 == bmp-size-31x31-8bpp.bmp bmp-size-31x31-8bpp.png
 == bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
 == bmp-size-33x33-8bpp.bmp bmp-size-33x33-8bpp.png
 == bmp-not-square-8bpp.bmp bmp-not-square-8bpp.png
-== os2bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
+== rle-bmp-not-square-8bpp.bmp bmp-not-square-8bpp.png
+== os2-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
+== rle-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
+== top-to-bottom-rle-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
 == top-to-bottom-16x16-8bpp.bmp  bmp-size-16x16-8bpp.png
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8687aab6cf11773b6a7ad5a7a0ead9ab99b69e6e
GIT binary patch
literal 1384
zc${U_Jx>%-6vpvO5M#9)3#9?sgdj#h!n?@Jo|vGGYa>=r4A20TeuF2mLmHtGt06Id
zjsrF>m2?&s^ATtlOxFLsgF$p>&d%(4mYw^%_lBp9&90DM(>FqRz_mi%raHncDui*~
zzE;Y*{!%)FR9@o2jk^c`>EZ0;O9(ZiGK!#<Q%)5j&<<9kxG{1gH*zC4a#|rH&&V@A
zWaJrnMxGUy&m|YRvNVPua*>Oi+mMsz<T-gxp3}_9b8;@h$(`KEJq|pNgQv(jLqT4U
z7vu$bL0*s-MLGOXqvDZKqH@ZqqNLTx@f&`_Z}<(r;ZJP7WZW2j!*BQvzu`|)g5U5P
ze#3A04Zq<}(}myg8-BxY_zl0|Pg9BC@Ed-^Z}<(r;ZM_y-|!oL!*BQvzu}KdVE7Hc
z;Wzw--|!p$a=mLwE&OTi@e9B3r=`I!{K7B%!Y};7pOy{3@C&Q}i9w5jiHD~p#V`EA
zFZ{wU{KB7>n}>)W5?@x_gZPDC_|sOvFZ{wU{K7B%!k@MYe&H8>;TL}47yh_~gkSiD
zU-*Sz_=P`hAN-zHJWFcF@98MYt%cw5JATLS_#MCFPumW^<9Gay-|;(s$Dg(&e#h_l
z9lzsu{Ek0uSNx9O@jHG8?ZBMDr>%_N@jHIU@Aw_R<4@b1K{^9*9_IX@^G9bF?eICy
zQ=H(?PG@Mh%S$|BE521)t>@2{mb$v$9UmVZ{fhrKTGi^yMq_vP{mx0VnL5>KwbE$3
zptI9#ev6&%?(VyHUN0~2@9&+Se*e4kYJcxT+3D-+yVu*hy1KIR>EPhURi~%ye2ksJ
z!NL0jy*-^98|#OMSDk^*&i;+{wZogSGy12~zrMCsc1A}Zjf@Nr4-IW^ZEarfJiP48
z%*;$rO-)WtOpK4cee-W;EOqMj`r^XE{QTV9liAtFv2*c%=c2y2c-c8W4;{Y&i1?LU
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bd793b6b66637a97073cbf180b0f21fb4e523316
GIT binary patch
literal 1288
zc${66|5Dmq5Qg874MC(-tW~O3Q=&iw<W~vC5;#^XXs7p(zk3y4$v0dIGvAHmPVBo0
zopyR)*^_;q-9s{yuRlr-vh~vf+RWZIER-0)e>U)cHIE<2L)Yu;D~z{ctYMHcbpOJ<
z#!D9bc>0?#C#1|qv*9&u4W9JMSsTwI(;D~2V}RGp33Ea}A=mwjh6l3-%!ZNe8QRD}
zW^Gtwum>q?sX;a@Wiy8v9kOPmYh(jA%;`pNhB@W+COgC=%6R=kp77AM?#UAE<38bC
zXgx{s=g)A@=K(L(rvt;fF`UJF)@LOvI3kYYKwPUNJCNPo-8b?U#r^$vT%cizMTLUv
z{$uQC2Fk0|YPnn%3Qj?6DWh7cRQBH1YPExdgF`i}m9>&3<grkofl9GhE~~S*SF6c^
zb!gEkDu2wlD3=N(=Y>N(W4ZjsGajkrMsaKGZH?kL_CGv4$df!vRo=@{p`KMsEZ*Ng
zJ+Th^d$kJZJ&GTWj_UP{%L7C)seC6Er5WB*_n!FqS+TXHAL_?Szlve+d_I>u!ke2L
zIUzkgJv~0osmvi??(Xj72GTw`IgwNAqxCoYvSn>$g^x<$8e`)5tzv6S+rQ~TV!4&6
zT%+7-x7v;K^YgQ_KXur{>uX30Zlj^(OkW9^%@#9Rz=`AA_!hKeI2>N*R%2@k4bGU#
z5S4zb)oK#?8Il=f5iLj|;dGiC{eG)S#rL!3ce7bETPzmwB8+1yBhH8PvD0k&&4%au
zzWxt8ie_*k)Z;J=N2BRz)a&&+oqmUs?|D97j8Y__jHKsu;Ihl(V&hH(n=Me{cHsCI
z7Z+NG7ftwyqH!3G!$COe_PV{^Rj0#m=ac^_lRQ->{EpQbj0U|fwJSOSB`%&ifju6N
z;S8iJS59EFW=*Wm?nK5ifZgqOAy>tqp!KW@doUQlp<N32gg#4VYPSTC%gf+0ul}B!
W&u~bE#QDpI8w9~67yg|?)A|MPyt^*|
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..396672ea1528bb7d3aade59bf4aa68af1f912aaa
GIT binary patch
literal 1284
zc${67ZC2t~5Qg873PEIS5y$V=C<=ste6_*Yd|X=_XnST4`8DfsC39E`=k!Lh6Z@?s
zXS&B5%etxOsk$a`{PMRrNY_6W&|>x&$=lnTg%Vi8zc%n=CyT$3g)S;E-iEP;LBi1e
zEAtw!Y4Gy&cg!4<G8@f?_p~*5+8bwWJdaFk+#8Pp-ZRI{G5wfa_pcfr%o;EoM!IKc
zBL|taVU58aB&;O{>9B;&9A<RLnvtxL4%{#&8+{n&g!h~D5ECoo{VRFQL)W?|i?xsY
zm`|bgIKi(!hI_sbc!|Cp7}ky9EIzY*k~<kmUpmqjUv2>Bw+dX}_iwn^rzY&tXauJZ
zyVL2w$vgf(19EfYvub^ES%uy2_u-I~eAe!=s^k--UGxi=K<U59I>YhpOZ~X-B3}F%
zg`=?FANISQPPfwz+JPSgmt5+o5=GG{R3{u#=yuxy9V+$9Yrg2M2zD5TkfC(l08ah-
zTFWR!5^Bu};MVJPk4wKib`(wEL^ztVX*e7Yhuv;B2zo)I-k?-hsWzEJllgo;orlxu
zcsw2s1_MYBTMbHA9;fO1nn32!d@fT+NJ$2$^m@H!qj7arub-c*A*7O#X0u6fMR1-r
zPv)d>rqhS%17r;08Mo4eOX(t$irW1^W)E&}k+F++Om0zbwwf)13kAh5aE&q3*~1L-
z*?N?FNUPO4m9xS}rD8<E=f|9!z9)}4IaOkPv`#Vxd78~;@(B5Ue}6BhC?21kot-HC
zD$j7Ao}RwFyu1)wJMt&#@$u2gQBH;Mn<)Iglheb)qm-ib{QRs~xlIg5x#En=f`X6=
zJLRyzD$2{{*X44#SS$)+LyE;>St^j--QB9}7Y^9BWZ$BY({fI$Iki^SO4KN%Mn#QE
zrLvnD)`3;iGghk=&nOfeI#R}t8Xv0F>i+)zL5+s2EU|?D!^Cynl59b?x3~Y04=C>K
S?bR{^4h2UQ>zz?k!}<vz?z`mx
deleted file mode 100644
--- a/js/src/analysis-tests/Makefile.in
+++ /dev/null
@@ -1,114 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla 2.
-#
-# The Initial Developer of the Original Code is
-# the Mozilla Foundation <http://www.mozilla.org>.
-#
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Benjamin Smedberg <benjamin@smedbergs.us> (Author)
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-# we will do compilations that create dependency files.
-NEED_MDDEPDIR = 1
-
-include $(DEPTH)/config/autoconf.mk
-
-REDGREEN_WARNING_TESTCASES = \
-  green-callred.cpp \
-  green-accessred.cpp \
-  green-tored-badpath.cpp \
-  misdeclared-red-funcptr.cpp \
-  misdeclared-red-funcptr2.cpp \
-  red-togreenptr.cpp \
-  red-togreenptr-return.cpp \
-  red-togreenptr-arg.cpp \
-  red-togreenptr-field.cpp \
-  red-togreenptr-initializer.cpp \
-  red-togreenptr-initializer-struct.cpp \
-  red-togreenptr-initializer-array.cpp \
-  red-togreenptr-initializer-nested.cpp \
-  red-togreenptr-initializer-cast.cpp \
-  green-callredptr.cpp \
-  $(NULL)
-
-REDGREEN_SUCCESS_TESTCASES = \
-  red-callred.cpp \
-  red-callgreen.cpp \
-  red-accessred.cpp \
-  green-tored.cpp \
-  green-toredptr.cpp \
-  $(NULL)
-
-STATIC_WARNING_TESTCASES = \
-  $(REDGREEN_WARNING_TESTCASES) \
-  $(NULL)
-
-STATIC_PASS_TESTCASES = \
-  $(REDGREEN_SUCCESS_TESTCASES) \
-  $(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-LOCAL_INCLUDES += -I$(srcdir)/.. -I..
-
-check:: \
-  $(STATIC_WARNING_TESTCASES:.cpp=.s-warn) \
-  $(STATIC_PASS_TESTCASES:.cpp=.s-pass) \
-  $(NULL)
-
-# We want to compile each file and invert the result to ensure that
-# compilation failed.
-%.s-warn: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
-	@printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
-	@if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
-	  printf "fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n"; \
-	  exit 1; \
-	fi
-	@if $(CCC) $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).werrlog 2>&1; then \
-	  printf "ok.\n"; \
-	else \
-	  printf "fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n"; \
-	  exit 1; \
-	fi
-
-%.s-pass: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
-	@printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
-	@if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
-	  printf "ok.\n"; \
-	else \
-	  printf "fail:\nerror: compilation of $(<F) failed. It shouldn't have!\n"; \
-	  exit 1; \
-	fi
deleted file mode 100644
--- a/js/src/analysis-tests/green-accessred.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "jstypes.h"
-
-struct Foo
-{
-  JS_REQUIRES_STACK void *redmember;
-};
-
-void* GreenFunc(Foo *f)
-{
-  return f->redmember;
-}
deleted file mode 100644
--- a/js/src/analysis-tests/green-callred.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "jstypes.h"
-
-#ifndef NS_STATIC_CHECKING
-#error Running this without NS_STATIC_CHECKING is silly
-#endif
-
-JS_REQUIRES_STACK void RedFunc();
-
-void GreenFunc()
-{
-  RedFunc();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/green-callredptr.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "jstypes.h"
-
-typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
-
-void GreenFunc(RedFuncPtr f)
-{
-  f();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/green-tored-badpath.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-JS_FORCES_STACK void TurnRedFunc();
-
-void GreenPartlyRedFunc(int i)
-{
-  if (i) {
-    TurnRedFunc();
-  }
-
-  RedFunc();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/green-tored.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-JS_FORCES_STACK void TurnRedFunc();
-
-void GreenToRedFunc()
-{
-  TurnRedFunc();
-
-  RedFunc();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/green-toredptr.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "jstypes.h"
-
-void GreenFunc();
-
-typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
-
-RedFuncPtr Test()
-{
-  // assigning a green function to a red function pointer is ok
-  RedFuncPtr p = GreenFunc;
-  return p;
-}
deleted file mode 100644
--- a/js/src/analysis-tests/misdeclared-red-funcptr.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "jstypes.h"
-
-
-// JS_REQUIRES_STACK should come before the *
-typedef void (* JS_REQUIRES_STACK RedFuncPtr)();
deleted file mode 100644
--- a/js/src/analysis-tests/misdeclared-red-funcptr2.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "jstypes.h"
-
-
-// JS_REQUIRES_STACK should come before the *
-typedef void (* RedFuncPtr)() JS_REQUIRES_STACK;
deleted file mode 100644
--- a/js/src/analysis-tests/red-accessred.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "jstypes.h"
-
-struct Foo
-{
-  JS_REQUIRES_STACK void *redmember;
-};
-
-JS_REQUIRES_STACK void * RedFunc(Foo *f)
-{
-  return f->redmember;
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-callgreen.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "jstypes.h"
-
-void GreenFunc();
-
-void JS_REQUIRES_STACK RedFunc()
-{
-  GreenFunc();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-callred.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc1();
-
-JS_REQUIRES_STACK void RedFunc2()
-{
-  RedFunc1();
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-arg.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "jstypes.h"
-
-typedef void (*GreenFuncPtr)();
-typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
-
-void TakesAsArgument(GreenFuncPtr g);
-
-void Test(RedFuncPtr p)
-{
-  TakesAsArgument(p);
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-field.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "jstypes.h"
-
-typedef void (*GreenFuncPtr)();
-typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
-
-struct Foo
-{
-  int i;
-  GreenFuncPtr p;
-};
-
-void Test(Foo *foo, RedFuncPtr p)
-{
-  foo->p = p;
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-initializer-array.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "jstypes.h"
-
-void GreenFunc();
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)();
-
-GreenFuncPtr fpa[2] = {GreenFunc, RedFunc};
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-initializer-cast.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)(int);
-
-GreenFuncPtr gfpa = (GreenFuncPtr) RedFunc;
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-initializer-nested.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "jstypes.h"
-
-void GreenFunc();
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)();
-
-struct S
-{
-  int i;
-  GreenFuncPtr p;
-};
-
-S sa[] = {
-  { 2, GreenFunc },
-  { 1, RedFunc },
-};
-
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-initializer-struct.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)();
-
-struct GreenStruct
-{
-  GreenFuncPtr func;
-};
-
-GreenStruct gs = { RedFunc };
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-initializer.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)();
-
-GreenFuncPtr funcp = RedFunc;
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr-return.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "jstypes.h"
-
-typedef void (*GreenFuncPtr)();
-typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
-
-GreenFuncPtr Test(RedFuncPtr p)
-{
-  return p;
-}
deleted file mode 100644
--- a/js/src/analysis-tests/red-togreenptr.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "jstypes.h"
-
-JS_REQUIRES_STACK void RedFunc();
-
-typedef void (*GreenFuncPtr)();
-
-GreenFuncPtr Test()
-{
-  return RedFunc;
-}
--- a/js/src/config/system-headers
+++ b/js/src/config/system-headers
@@ -108,21 +108,16 @@ fusion/lock.h
 fusion/types.h
 fusion/vector.h
 fusion/call.h
 fusion/shmalloc.h
 fusion/protocol.h
 fusion/fusion.h
 fusion/arena.h
 fusion/object.h
-directfbgl.h
-directfb_version.h
-directfb.h
-directfb_util.h
-directfb_keynames.h
 dgiff.h
 direct/util.h
 direct/memcpy.h
 direct/interface.h
 direct/conf.h
 direct/tree.h
 direct/signals.h
 direct/build.h
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -1210,16 +1210,106 @@ class NullLiteral : public ParseNode {
 
 class BooleanLiteral : public ParseNode {
   public:
     BooleanLiteral(bool b, const TokenPos &pos)
       : ParseNode(b ? PNK_TRUE : PNK_FALSE, b ? JSOP_TRUE : JSOP_FALSE, PN_NULLARY, pos)
     { }
 };
 
+class XMLDoubleColonProperty : public ParseNode {
+  public:
+    XMLDoubleColonProperty(ParseNode *lhs, ParseNode *rhs,
+                           const TokenPtr &begin, const TokenPtr &end)
+      : ParseNode(PNK_LB, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end))
+    {
+        JS_ASSERT(rhs->isKind(PNK_DBLCOLON));
+        pn_u.binary.left = lhs;
+        pn_u.binary.right = rhs;
+    }
+
+    ParseNode &left() const {
+        return *pn_u.binary.left;
+    }
+
+    ParseNode &right() const {
+        return *pn_u.binary.right;
+    }
+};
+
+class XMLFilterExpression : public ParseNode {
+  public:
+    XMLFilterExpression(ParseNode *lhs, ParseNode *filterExpr,
+                        const TokenPtr &begin, const TokenPtr &end)
+      : ParseNode(PNK_FILTER, JSOP_FILTER, PN_BINARY, TokenPos::make(begin, end))
+    {
+        pn_u.binary.left = lhs;
+        pn_u.binary.right = filterExpr;
+    }
+
+    ParseNode &left() const {
+        return *pn_u.binary.left;
+    }
+
+    ParseNode &filter() const {
+        return *pn_u.binary.right;
+    }
+};
+
+class XMLProperty : public ParseNode {
+  public:
+    XMLProperty(ParseNode *lhs, ParseNode *propertyId,
+                const TokenPtr &begin, const TokenPtr &end)
+      : ParseNode(PNK_LB, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end))
+    {
+        pn_u.binary.left = lhs;
+        pn_u.binary.right = propertyId;
+    }
+
+    ParseNode &left() const {
+        return *pn_u.binary.left;
+    }
+
+    ParseNode &right() const {
+        return *pn_u.binary.right;
+    }
+};
+
+class PropertyAccess : public ParseNode {
+  public:
+    PropertyAccess(ParseNode *lhs, PropertyName *name,
+                   const TokenPtr &begin, const TokenPtr &end)
+      : ParseNode(PNK_DOT, JSOP_GETPROP, PN_NAME, TokenPos::make(begin, end))
+    {
+        JS_ASSERT(lhs != NULL);
+        JS_ASSERT(name != NULL);
+        pn_u.name.expr = lhs;
+        pn_u.name.atom = name;
+    }
+
+    ParseNode &expression() const {
+        return *pn_u.name.expr;
+    }
+
+    PropertyName &name() const {
+        return *pn_u.name.atom->asPropertyName();
+    }
+};
+
+class PropertyByValue : public ParseNode {
+  public:
+    PropertyByValue(ParseNode *lhs, ParseNode *propExpr,
+                    const TokenPtr &begin, const TokenPtr &end)
+      : ParseNode(PNK_LB, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end))
+    {
+        pn_u.binary.left = lhs;
+        pn_u.binary.right = propExpr;
+    }
+};
+
 ParseNode *
 CloneLeftHandSide(ParseNode *opn, TreeContext *tc);
 
 /*
  * js::Definition is a degenerate subtype of the PN_FUNC and PN_NAME variants
  * of js::ParseNode, allocated only for function, var, const, and let
  * declarations that define truly lexical bindings. This means that a child of
  * a PNK_VAR list may be a Definition as well as a ParseNode. The pn_defn bit
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -2649,23 +2649,20 @@ CheckDestructuring(JSContext *cx, BindDa
      *
      * four slots are needed.
      *
      * To satisfy both constraints, we push a dummy slot (and add a
      * corresponding dummy property to the block object) for each initializer
      * that doesn't introduce at least one binding.
      */
     if (toplevel && blockObj && blockCountBefore == blockObj->slotCount()) {
-        if (!DefineNativeProperty(cx, blockObj,
-                                  INT_TO_JSID(blockCountBefore),
-                                  UndefinedValue(), NULL, NULL,
-                                  JSPROP_ENUMERATE | JSPROP_PERMANENT,
-                                  Shape::HAS_SHORTID, blockCountBefore)) {
+        bool redeclared;
+        if (!blockObj->addVar(cx, INT_TO_JSID(blockCountBefore), blockCountBefore, &redeclared))
             return false;
-        }
+        JS_ASSERT(!redeclared);
         JS_ASSERT(blockObj->slotCount() == blockCountBefore + 1);
     }
 
     return true;
 }
 
 /*
  * Extend the pn_pos.end source coordinate of each name in a destructuring
@@ -5691,234 +5688,245 @@ CheckForImmediatelyAppliedLambda(ParseNo
             pn->pn_dflags &= ~PND_FUNARG;
     }
     return pn;
 }
 
 ParseNode *
 Parser::memberExpr(JSBool allowCallSyntax)
 {
-    ParseNode *pn, *pn2, *pn3;
+    ParseNode *lhs;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     /* Check for new expression first. */
     TokenKind tt = tokenStream.getToken(TSF_OPERAND);
     if (tt == TOK_NEW) {
-        pn = ListNode::create(PNK_NEW, tc);
-        if (!pn)
+        lhs = ListNode::create(PNK_NEW, tc);
+        if (!lhs)
             return NULL;
-        pn2 = memberExpr(JS_FALSE);
-        if (!pn2)
+        ParseNode *ctorExpr = memberExpr(JS_FALSE);
+        if (!ctorExpr)
             return NULL;
-        pn2 = CheckForImmediatelyAppliedLambda(pn2);
-        pn->setOp(JSOP_NEW);
-        pn->initList(pn2);
-        pn->pn_pos.begin = pn2->pn_pos.begin;
-
-        if (tokenStream.matchToken(TOK_LP) && !argumentList(pn))
+        ctorExpr = CheckForImmediatelyAppliedLambda(ctorExpr);
+        lhs->setOp(JSOP_NEW);
+        lhs->initList(ctorExpr);
+        lhs->pn_pos.begin = ctorExpr->pn_pos.begin;
+
+        if (tokenStream.matchToken(TOK_LP) && !argumentList(lhs))
             return NULL;
-        if (pn->pn_count > ARGC_LIMIT) {
+        if (lhs->pn_count > ARGC_LIMIT) {
             JS_ReportErrorNumber(context, js_GetErrorMessage, NULL,
                                  JSMSG_TOO_MANY_CON_ARGS);
             return NULL;
         }
-        pn->pn_pos.end = pn->last()->pn_pos.end;
+        lhs->pn_pos.end = lhs->last()->pn_pos.end;
     } else {
-        pn = primaryExpr(tt, JS_FALSE);
-        if (!pn)
+        lhs = primaryExpr(tt, JS_FALSE);
+        if (!lhs)
             return NULL;
 
-        if (pn->isXMLNameOp()) {
-            pn = new_<UnaryNode>(PNK_XMLUNARY, JSOP_XMLNAME, pn->pn_pos, pn);
-            if (!pn)
+        if (lhs->isXMLNameOp()) {
+            lhs = new_<UnaryNode>(PNK_XMLUNARY, JSOP_XMLNAME, lhs->pn_pos, lhs);
+            if (!lhs)
                 return NULL;
         }
     }
 
     while ((tt = tokenStream.getToken()) > TOK_EOF) {
+        ParseNode *nextMember;
         if (tt == TOK_DOT) {
-            pn2 = NameNode::create(PNK_DOT, NULL, tc);
-            if (!pn2)
-                return NULL;
-
-#if JS_HAS_XML_SUPPORT
-            tt = tokenStream.getToken(TSF_OPERAND | TSF_KEYWORD_IS_NAME);
-
-            /* Treat filters as 'with' statements for name deoptimization. */
-            ParseNode *oldWith = tc->innermostWith;
-            StmtInfo stmtInfo;
-            if (tt == TOK_LP) {
-                if (tc->inStrictMode()) {
-                    reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NAME_AFTER_DOT);
-                    return NULL;
-                }
-
-                tc->innermostWith = pn;
-                PushStatement(tc, &stmtInfo, STMT_WITH, -1);
-            }
-
-            pn3 = primaryExpr(tt, JS_TRUE);
-            if (!pn3)
+            tt = tokenStream.getToken(TSF_KEYWORD_IS_NAME);
+            if (tt == TOK_ERROR)
                 return NULL;
-
-            if (tt == TOK_LP) {
-                tc->innermostWith = oldWith;
-                PopStatement(tc);
+            if (tt == TOK_NAME) {
+#if JS_HAS_XML_SUPPORT
+                if (!tc->inStrictMode() && tokenStream.peekToken() == TOK_DBLCOLON) {
+                    ParseNode *propertyId = propertyQualifiedIdentifier();
+                    if (!propertyId)
+                        return NULL;
+
+                    nextMember = new_<XMLDoubleColonProperty>(lhs, propertyId,
+                                                              lhs->pn_pos.begin,
+                                                              tokenStream.currentToken().pos.end);
+                    if (!nextMember)
+                        return NULL;
+                } else
+#endif
+                {
+                    nextMember = new_<PropertyAccess>(lhs, tokenStream.currentToken().name(),
+                                                      lhs->pn_pos.begin,
+                                                      tokenStream.currentToken().pos.end);
+                    if (!nextMember)
+                        return NULL;
+                }
             }
-
-            /* Check both tt and pn_type, to distinguish |x.(y)| and |x.y::z| from |x.y|. */
-            if (tt == TOK_NAME && pn3->isKind(PNK_NAME)) {
-                pn2->setOp(JSOP_GETPROP);
-                pn2->pn_expr = pn;
-                pn2->pn_atom = pn3->pn_atom;
-                freeTree(pn3);
-            } else {
+#if JS_HAS_XML_SUPPORT
+            else if (!tc->inStrictMode()) {
+                TokenPtr begin = lhs->pn_pos.begin;
                 if (tt == TOK_LP) {
-                    pn2->setKind(PNK_FILTER);
-                    pn2->setOp(JSOP_FILTER);
-
-                    /* A filtering predicate is like a with statement. */
+                    /* Filters are effectively 'with', so deoptimize names. */
                     tc->flags |= TCF_FUN_HEAVYWEIGHT;
-                } else if (pn3->isXMLPropertyIdentifier()) {
-                    JS_ASSERT(!tc->inStrictMode());
-                    pn2->setKind(PNK_LB);
-                    pn2->setOp(JSOP_GETELEM);
+
+                    StmtInfo stmtInfo;
+                    ParseNode *oldWith = tc->innermostWith;
+                    tc->innermostWith = lhs;
+                    PushStatement(tc, &stmtInfo, STMT_WITH, -1);
+
+                    ParseNode *filter = bracketedExpr();
+                    if (!filter)
+                        return NULL;
+                    filter->setInParens(true);
+                    MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_IN_PAREN);
+
+                    tc->innermostWith = oldWith;
+                    PopStatement(tc);
+
+                    nextMember =
+                        new_<XMLFilterExpression>(lhs, filter,
+                                                  begin, tokenStream.currentToken().pos.end);
+                    if (!nextMember)
+                        return NULL;
+                } else if (tt == TOK_AT || tt == TOK_STAR) {
+                    ParseNode *propertyId = starOrAtPropertyIdentifier(tt);
+                    if (!propertyId)
+                        return NULL;
+                    nextMember = new_<XMLProperty>(lhs, propertyId,
+                                                   begin, tokenStream.currentToken().pos.end);
+                    if (!nextMember)
+                        return NULL;
                 } else {
                     reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NAME_AFTER_DOT);
                     return NULL;
                 }
-                pn2->setArity(PN_BINARY);
-                pn2->pn_left = pn;
-                pn2->pn_right = pn3;
             }
-#else
-            MUST_MATCH_TOKEN_WITH_FLAGS(TOK_NAME, JSMSG_NAME_AFTER_DOT, TSF_KEYWORD_IS_NAME);
-            pn2->setOp(JSOP_GETPROP);
-            pn2->pn_expr = pn;
-            pn2->pn_atom = tokenStream.currentToken().name();
 #endif
-            pn2->pn_pos.begin = pn->pn_pos.begin;
-            pn2->pn_pos.end = tokenStream.currentToken().pos.end;
+            else {
+                reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NAME_AFTER_DOT);
+                return NULL;
+            }
+        }
 #if JS_HAS_XML_SUPPORT
-        } else if (tt == TOK_DBLDOT) {
+        else if (tt == TOK_DBLDOT) {
             if (tc->inStrictMode()) {
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NAME_AFTER_DOT);
                 return NULL;
             }
 
-            pn2 = BinaryNode::create(PNK_DBLDOT, tc);
-            if (!pn2)
+            nextMember = BinaryNode::create(PNK_DBLDOT, tc);
+            if (!nextMember)
                 return NULL;
             tt = tokenStream.getToken(TSF_OPERAND | TSF_KEYWORD_IS_NAME);
-            pn3 = primaryExpr(tt, JS_TRUE);
+            ParseNode *pn3 = primaryExpr(tt, JS_TRUE);
             if (!pn3)
                 return NULL;
             if (pn3->isKind(PNK_NAME) && !pn3->isInParens()) {
                 pn3->setKind(PNK_STRING);
                 pn3->setArity(PN_NULLARY);
                 pn3->setOp(JSOP_QNAMEPART);
             } else if (!pn3->isXMLPropertyIdentifier()) {
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NAME_AFTER_DOT);
                 return NULL;
             }
-            pn2->setOp(JSOP_DESCENDANTS);
-            pn2->pn_left = pn;
-            pn2->pn_right = pn3;
-            pn2->pn_pos.begin = pn->pn_pos.begin;
-            pn2->pn_pos.end = tokenStream.currentToken().pos.end;
+            nextMember->setOp(JSOP_DESCENDANTS);
+            nextMember->pn_left = lhs;
+            nextMember->pn_right = pn3;
+            nextMember->pn_pos.begin = lhs->pn_pos.begin;
+            nextMember->pn_pos.end = tokenStream.currentToken().pos.end;
+        }
 #endif
-        } else if (tt == TOK_LB) {
-            pn2 = BinaryNode::create(PNK_LB, tc);
-            if (!pn2)
-                return NULL;
-            pn3 = expr();
-            if (!pn3)
+        else if (tt == TOK_LB) {
+            ParseNode *propExpr = expr();
+            if (!propExpr)
                 return NULL;
 
             MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_IN_INDEX);
-            pn2->pn_pos.begin = pn->pn_pos.begin;
-            pn2->pn_pos.end = tokenStream.currentToken().pos.end;
+            TokenPtr begin = lhs->pn_pos.begin, end = tokenStream.currentToken().pos.end;
 
             /*
-             * Optimize o['p'] to o.p by rewriting pn2, but avoid rewriting
-             * o['0'] to use JSOP_GETPROP, to keep fast indexing disjoint in
-             * the interpreter from fast property access. However, if the
-             * bracketed string is a uint32, we rewrite pn3 to be a number
-             * instead of a string.
+             * Optimize property name lookups.  If the name is a PropertyName,
+             * then make a name-based node so the emitter will use a name-based
+             * bytecode.  Otherwise make a node using the property expression
+             * by value.  If the node is a string containing an index, convert
+             * it to a number to save work later.
              */
-            do {
-                if (pn3->isKind(PNK_STRING)) {
-                    jsuint index;
-
-                    if (!js_IdIsIndex(ATOM_TO_JSID(pn3->pn_atom), &index)) {
-                        pn2->setKind(PNK_DOT);
-                        pn2->setOp(JSOP_GETPROP);
-                        pn2->setArity(PN_NAME);
-                        pn2->pn_expr = pn;
-                        pn2->pn_atom = pn3->pn_atom;
-                        break;
-                    }
-                    pn3->setKind(PNK_NUMBER);
-                    pn3->setOp(JSOP_DOUBLE);
-                    pn3->pn_dval = index;
+            uint32_t index;
+            PropertyName *name = NULL;
+            if (propExpr->isKind(PNK_STRING)) {
+                JSAtom *atom = propExpr->pn_atom;
+                if (atom->isIndex(&index)) {
+                    propExpr->setKind(PNK_NUMBER);
+                    propExpr->setOp(JSOP_DOUBLE);
+                    propExpr->pn_dval = index;
+                } else {
+                    name = atom->asPropertyName();
                 }
-                pn2->setOp(JSOP_GETELEM);
-                pn2->pn_left = pn;
-                pn2->pn_right = pn3;
-            } while (0);
-        } else if (allowCallSyntax && tt == TOK_LP) {
-            pn2 = ListNode::create(PNK_LP, tc);
-            if (!pn2)
+            } else if (propExpr->isKind(PNK_NUMBER)) {
+                JSAtom *atom;
+                if (!js_ValueToAtom(context, NumberValue(propExpr->pn_dval), &atom))
+                    return NULL;
+                if (!atom->isIndex(&index))
+                    name = atom->asPropertyName();
+            }
+
+            if (name)
+                nextMember = new_<PropertyAccess>(lhs, name, begin, end);
+            else
+                nextMember = new_<PropertyByValue>(lhs, propExpr, begin, end);
+            if (!nextMember)
                 return NULL;
-            pn2->setOp(JSOP_CALL);
-
-            pn = CheckForImmediatelyAppliedLambda(pn);
-            if (pn->isOp(JSOP_NAME)) {
-                if (pn->pn_atom == context->runtime->atomState.evalAtom) {
+        } else if (allowCallSyntax && tt == TOK_LP) {
+            nextMember = ListNode::create(PNK_LP, tc);
+            if (!nextMember)
+                return NULL;
+            nextMember->setOp(JSOP_CALL);
+
+            lhs = CheckForImmediatelyAppliedLambda(lhs);
+            if (lhs->isOp(JSOP_NAME)) {
+                if (lhs->pn_atom == context->runtime->atomState.evalAtom) {
                     /* Select JSOP_EVAL and flag tc as heavyweight. */
-                    pn2->setOp(JSOP_EVAL);
+                    nextMember->setOp(JSOP_EVAL);
                     tc->noteCallsEval();
                     tc->flags |= TCF_FUN_HEAVYWEIGHT;
                     /*
                      * In non-strict mode code, direct calls to eval can add
                      * variables to the call object.
                      */
                     if (!tc->inStrictMode())
                         tc->noteHasExtensibleScope();
                 }
-            } else if (pn->isOp(JSOP_GETPROP)) {
+            } else if (lhs->isOp(JSOP_GETPROP)) {
                 /* Select JSOP_FUNAPPLY given foo.apply(...). */
-                if (pn->pn_atom == context->runtime->atomState.applyAtom)
-                    pn2->setOp(JSOP_FUNAPPLY);
-                else if (pn->pn_atom == context->runtime->atomState.callAtom)
-                    pn2->setOp(JSOP_FUNCALL);
+                if (lhs->pn_atom == context->runtime->atomState.applyAtom)
+                    nextMember->setOp(JSOP_FUNAPPLY);
+                else if (lhs->pn_atom == context->runtime->atomState.callAtom)
+                    nextMember->setOp(JSOP_FUNCALL);
             }
 
-            pn2->initList(pn);
-            pn2->pn_pos.begin = pn->pn_pos.begin;
-
-            if (!argumentList(pn2))
+            nextMember->initList(lhs);
+            nextMember->pn_pos.begin = lhs->pn_pos.begin;
+
+            if (!argumentList(nextMember))
                 return NULL;
-            if (pn2->pn_count > ARGC_LIMIT) {
+            if (nextMember->pn_count > ARGC_LIMIT) {
                 JS_ReportErrorNumber(context, js_GetErrorMessage, NULL,
                                      JSMSG_TOO_MANY_FUN_ARGS);
                 return NULL;
             }
-            pn2->pn_pos.end = tokenStream.currentToken().pos.end;
+            nextMember->pn_pos.end = tokenStream.currentToken().pos.end;
         } else {
             tokenStream.ungetToken();
-            return pn;
+            return lhs;
         }
 
-        pn = pn2;
+        lhs = nextMember;
     }
     if (tt == TOK_ERROR)
         return NULL;
-    return pn;
+    return lhs;
 }
 
 ParseNode *
 Parser::bracketedExpr()
 {
     uintN oldflags;
     ParseNode *pn;
 
@@ -6557,16 +6565,186 @@ Parser::parseXMLText(JSObject *chain, bo
     }
     tokenStream.setXMLOnlyMode(false);
 
     return pn;
 }
 
 #endif /* JS_HAS_XMLSUPPORT */
 
+bool
+Parser::checkForFunctionNode(PropertyName *name, ParseNode *node)
+{
+    /*
+     * In |a.ns::name|, |ns| refers to an in-scope variable, so |ns| can't be a
+     * keyword.  (Exception: |function::name| is the actual name property, not
+     * what E4X would expose.)  We parsed |ns| accepting a keyword as a name,
+     * so we must implement the keyword restriction manually in this case.
+     */
+    if (const KeywordInfo *ki = FindKeyword(name->charsZ(), name->length())) {
+        if (ki->tokentype != TOK_FUNCTION) {
+            reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_KEYWORD_NOT_NS);
+            return false;
+        }
+
+        node->setArity(PN_NULLARY);
+        node->setKind(PNK_FUNCTION);
+    }
+
+    return true;
+}
+
+#if JS_HAS_XML_SUPPORT
+ParseNode *
+Parser::propertyQualifiedIdentifier()
+{
+    JS_ASSERT(!tc->inStrictMode());
+    JS_ASSERT(tokenStream.isCurrentTokenType(TOK_NAME));
+    JS_ASSERT(tokenStream.currentToken().t_op == JSOP_NAME);
+    JS_ASSERT(tokenStream.peekToken() == TOK_DBLCOLON);
+
+    /* Deoptimize QualifiedIdentifier properties to avoid tricky analysis. */
+    tc->flags |= TCF_FUN_HEAVYWEIGHT;
+
+    PropertyName *name = tokenStream.currentToken().name();
+    ParseNode *node = NameNode::create(PNK_NAME, name, tc);
+    if (!node)
+        return NULL;
+    node->setOp(JSOP_NAME);
+    node->pn_dflags |= PND_DEOPTIMIZED;
+
+    if (!checkForFunctionNode(name, node))
+        return NULL;
+
+    tokenStream.consumeKnownToken(TOK_DBLCOLON);
+    return qualifiedSuffix(node);
+}
+#endif
+
+ParseNode *
+Parser::identifierName(bool afterDot)
+{
+    JS_ASSERT(tokenStream.isCurrentTokenType(TOK_NAME));
+
+    PropertyName *name = tokenStream.currentToken().name();
+    ParseNode *node = NameNode::create(PNK_NAME, name, tc);
+    if (!node)
+        return NULL;
+    JS_ASSERT(tokenStream.currentToken().t_op == JSOP_NAME);
+    node->setOp(JSOP_NAME);
+
+    if ((tc->flags & (TCF_IN_FUNCTION | TCF_FUN_PARAM_ARGUMENTS)) == TCF_IN_FUNCTION &&
+        name == context->runtime->atomState.argumentsAtom) {
+        /*
+         * Flag arguments usage so we can avoid unsafe optimizations such
+         * as formal parameter assignment analysis (because of the hated
+         * feature whereby arguments alias formals). We do this even for
+         * a reference of the form foo.arguments, which ancient code may
+         * still use instead of arguments (more hate).
+         */
+        tc->noteArgumentsUse(node);
+
+        /*
+         * Bind early to JSOP_ARGUMENTS to relieve later code from having
+         * to do this work (new rule for the emitter to count on).
+         */
+        if (!afterDot && !(tc->flags & TCF_DECL_DESTRUCTURING)
+            && !tc->inStatement(STMT_WITH)) {
+            node->setOp(JSOP_ARGUMENTS);
+            node->pn_dflags |= PND_BOUND;
+        }
+    } else if ((!afterDot
+#if JS_HAS_XML_SUPPORT
+                || (!tc->inStrictMode() && tokenStream.peekToken() == TOK_DBLCOLON)
+#endif
+               ) && !(tc->flags & TCF_DECL_DESTRUCTURING))
+    {
+        /* In case this is a generator expression outside of any function. */
+        if (!tc->inFunction() && name == context->runtime->atomState.argumentsAtom)
+            tc->countArgumentsUse(node);
+
+        StmtInfo *stmt = LexicalLookup(tc, name, NULL);
+
+        MultiDeclRange mdl = tc->decls.lookupMulti(name);
+
+        Definition *dn;
+        if (!mdl.empty()) {
+            dn = mdl.front();
+        } else {
+            if (AtomDefnAddPtr p = tc->lexdeps->lookupForAdd(name)) {
+                dn = p.value();
+            } else {
+                /*
+                 * No definition before this use in any lexical scope.
+                 * Create a placeholder definition node to either:
+                 * - Be adopted when we parse the real defining
+                 *   declaration, or
+                 * - Be left as a free variable definition if we never
+                 *   see the real definition.
+                 */
+                dn = MakePlaceholder(node, tc);
+                if (!dn || !tc->lexdeps->add(p, name, dn))
+                    return NULL;
+
+                /*
+                 * In case this is a forward reference to a function,
+                 * we pessimistically set PND_FUNARG if the next token
+                 * is not a left parenthesis.
+                 *
+                 * If the definition eventually parsed into dn is not a
+                 * function, this flag won't hurt, and if we do parse a
+                 * function with pn's name, then the PND_FUNARG flag is
+                 * necessary for safe context->display-based optimiza-
+                 * tion of the closure's static link.
+                 */
+                if (tokenStream.peekToken() != TOK_LP)
+                    dn->pn_dflags |= PND_FUNARG;
+            }
+        }
+
+        JS_ASSERT(dn->isDefn());
+        LinkUseToDef(node, dn, tc);
+
+        /* Here we handle the backward function reference case. */
+        if (tokenStream.peekToken() != TOK_LP)
+            dn->pn_dflags |= PND_FUNARG;
+
+        node->pn_dflags |= (dn->pn_dflags & PND_FUNARG);
+        if (stmt && stmt->type == STMT_WITH)
+            node->pn_dflags |= PND_DEOPTIMIZED;
+    }
+
+#if JS_HAS_XML_SUPPORT
+    if (!tc->inStrictMode() && tokenStream.matchToken(TOK_DBLCOLON)) {
+        if (afterDot) {
+            if (!checkForFunctionNode(name, node))
+                return NULL;
+        }
+        node = qualifiedSuffix(node);
+        if (!node)
+            return NULL;
+    }
+#endif
+
+    return node;
+}
+
+#if JS_HAS_XML_SUPPORT
+ParseNode *
+Parser::starOrAtPropertyIdentifier(TokenKind tt)
+{
+    JS_ASSERT(tt == TOK_AT || tt == TOK_STAR);
+    if (tc->inStrictMode()) {
+        reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
+        return NULL;
+    }
+    return (tt == TOK_AT) ? attributeIdentifier() : qualifiedIdentifier();
+}
+#endif
+
 ParseNode *
 Parser::primaryExpr(TokenKind tt, JSBool afterDot)
 {
     JS_ASSERT(tokenStream.isCurrentTokenType(tt));
 
     ParseNode *pn, *pn2, *pn3;
     JSOp op;
 
@@ -6979,190 +7157,60 @@ Parser::primaryExpr(TokenKind tt, JSBool
         if (!pn)
             return NULL;
         pn->setInParens(true);
         if (!genexp)
             MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_IN_PAREN);
         break;
       }
 
-#if JS_HAS_XML_SUPPORT
-      case TOK_STAR:
-        if (tc->inStrictMode()) {
-            reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
-            return NULL;
-        }
-        pn = qualifiedIdentifier();
+      case TOK_STRING:
+        pn = atomNode(PNK_STRING, JSOP_STRING);
         if (!pn)
             return NULL;
         break;
 
+#if JS_HAS_XML_SUPPORT
       case TOK_AT:
-        if (tc->inStrictMode()) {
-            reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
-            return NULL;
-        }      
-        pn = attributeIdentifier();
-        if (!pn)
-            return NULL;
+      case TOK_STAR:
+        pn = starOrAtPropertyIdentifier(tt);
         break;
 
       case TOK_XMLSTAGO:
         pn = xmlElementOrListRoot(JS_TRUE);
         if (!pn)
             return NULL;
         break;
-#endif /* JS_HAS_XML_SUPPORT */
-
-#if JS_HAS_XML_SUPPORT
+
       case TOK_XMLCDATA:
         JS_ASSERT(!tc->inStrictMode());
         pn = atomNode(PNK_XMLCDATA, JSOP_XMLCDATA);
         if (!pn)
             return NULL;
         break;
 
       case TOK_XMLCOMMENT:
         JS_ASSERT(!tc->inStrictMode());
         pn = atomNode(PNK_XMLCOMMENT, JSOP_XMLCOMMENT);
         if (!pn)
             return NULL;
         break;
-#endif
-      case TOK_STRING:
-        pn = atomNode(PNK_STRING, JSOP_STRING);
-        if (!pn)
-            return NULL;
-        break;
-
-#if JS_HAS_XML_SUPPORT
+
       case TOK_XMLPI: {
         JS_ASSERT(!tc->inStrictMode());
         const Token &tok = tokenStream.currentToken();
         pn = new_<XMLProcessingInstruction>(tok.xmlPITarget(), tok.xmlPIData(), tok.pos);
         if (!pn)
             return NULL;
         break;
       }
 #endif
 
       case TOK_NAME:
-        pn = NameNode::create(PNK_NAME, tokenStream.currentToken().name(), tc);
-        if (!pn)
-            return NULL;
-        JS_ASSERT(tokenStream.currentToken().t_op == JSOP_NAME);
-        pn->setOp(JSOP_NAME);
-
-        if ((tc->flags & (TCF_IN_FUNCTION | TCF_FUN_PARAM_ARGUMENTS)) == TCF_IN_FUNCTION &&
-            pn->pn_atom == context->runtime->atomState.argumentsAtom) {
-            /*
-             * Flag arguments usage so we can avoid unsafe optimizations such
-             * as formal parameter assignment analysis (because of the hated
-             * feature whereby arguments alias formals). We do this even for
-             * a reference of the form foo.arguments, which ancient code may
-             * still use instead of arguments (more hate).
-             */
-            tc->noteArgumentsUse(pn);
-
-            /*
-             * Bind early to JSOP_ARGUMENTS to relieve later code from having
-             * to do this work (new rule for the emitter to count on).
-             */
-            if (!afterDot && !(tc->flags & TCF_DECL_DESTRUCTURING)
-                && !tc->inStatement(STMT_WITH)) {
-                pn->setOp(JSOP_ARGUMENTS);
-                pn->pn_dflags |= PND_BOUND;
-            }
-        } else if ((!afterDot
-#if JS_HAS_XML_SUPPORT
-                    || (!tc->inStrictMode() && tokenStream.peekToken() == TOK_DBLCOLON)
-#endif
-                   ) && !(tc->flags & TCF_DECL_DESTRUCTURING)) {
-            /* In case this is a generator expression outside of any function. */
-            if (!tc->inFunction() &&
-                pn->pn_atom == context->runtime->atomState.argumentsAtom) {
-                tc->countArgumentsUse(pn);
-            }
-
-            StmtInfo *stmt = LexicalLookup(tc, pn->pn_atom, NULL);
-
-            MultiDeclRange mdl = tc->decls.lookupMulti(pn->pn_atom);
-
-            Definition *dn;
-            if (!mdl.empty()) {
-                dn = mdl.front();
-            } else {
-                AtomDefnAddPtr p = tc->lexdeps->lookupForAdd(pn->pn_atom);
-                if (p) {
-                    dn = p.value();
-                } else {
-                    /*
-                     * No definition before this use in any lexical scope.
-                     * Create a placeholder definition node to either:
-                     * - Be adopted when we parse the real defining
-                     *   declaration, or
-                     * - Be left as a free variable definition if we never
-                     *   see the real definition.
-                     */
-                    dn = MakePlaceholder(pn, tc);
-                    if (!dn || !tc->lexdeps->add(p, dn->pn_atom, dn))
-                        return NULL;
-
-                    /*
-                     * In case this is a forward reference to a function,
-                     * we pessimistically set PND_FUNARG if the next token
-                     * is not a left parenthesis.
-                     *
-                     * If the definition eventually parsed into dn is not a
-                     * function, this flag won't hurt, and if we do parse a
-                     * function with pn's name, then the PND_FUNARG flag is
-                     * necessary for safe context->display-based optimiza-
-                     * tion of the closure's static link.
-                     */
-                    if (tokenStream.peekToken() != TOK_LP)
-                        dn->pn_dflags |= PND_FUNARG;
-                }
-            }
-
-            JS_ASSERT(dn->isDefn());
-            LinkUseToDef(pn, dn, tc);
-
-            /* Here we handle the backward function reference case. */
-            if (tokenStream.peekToken() != TOK_LP)
-                dn->pn_dflags |= PND_FUNARG;
-
-            pn->pn_dflags |= (dn->pn_dflags & PND_FUNARG);
-            if (stmt && stmt->type == STMT_WITH)
-                pn->pn_dflags |= PND_DEOPTIMIZED;
-        }
-
-#if JS_HAS_XML_SUPPORT
-        if (!tc->inStrictMode() && tokenStream.matchToken(TOK_DBLCOLON)) {
-            if (afterDot) {
-                /*
-                 * Here primaryExpr is called after . or .. followed by a name
-                 * followed by ::. This is the only case where a keyword after
-                 * . or .. is not treated as a property name.
-                 */
-                const KeywordInfo *ki = FindKeyword(pn->pn_atom->charsZ(), pn->pn_atom->length());
-                if (ki) {
-                    if (ki->tokentype != TOK_FUNCTION) {
-                        reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_KEYWORD_NOT_NS);
-                        return NULL;
-                    }
-
-                    pn->setArity(PN_NULLARY);
-                    pn->setKind(PNK_FUNCTION);
-                }
-            }
-            pn = qualifiedSuffix(pn);
-            if (!pn)
-                return NULL;
-        }
-#endif
+        pn = identifierName(afterDot);
         break;
 
       case TOK_REGEXP:
       {
         pn = NullaryNode::create(PNK_REGEXP, tc);
         if (!pn)
             return NULL;
 
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -244,29 +244,36 @@ struct Parser : private AutoGCRooter
                                  ParseNodeKind kind = PNK_SEMI, JSOp op = JSOP_NOP);
     ParseNode *generatorExpr(ParseNode *kid);
     JSBool argumentList(ParseNode *listNode);
     ParseNode *bracketedExpr();
     ParseNode *letBlock(LetContext letContext);
     ParseNode *returnOrYield(bool useAssignExpr);
     ParseNode *destructuringExpr(BindData *data, TokenKind tt);
 
+    bool checkForFunctionNode(PropertyName *name, ParseNode *node);
+
+    ParseNode *identifierName(bool afterDot);
+
 #if JS_HAS_XML_SUPPORT
     ParseNode *endBracketedExpr();
 
     ParseNode *propertySelector();
     ParseNode *qualifiedSuffix(ParseNode *pn);
     ParseNode *qualifiedIdentifier();
     ParseNode *attributeIdentifier();
     ParseNode *xmlExpr(JSBool inTag);
     ParseNode *xmlNameExpr();
     ParseNode *xmlTagContent(ParseNodeKind tagkind, JSAtom **namep);
     JSBool xmlElementContent(ParseNode *pn);
     ParseNode *xmlElementOrList(JSBool allowList);
     ParseNode *xmlElementOrListRoot(JSBool allowList);
+
+    ParseNode *starOrAtPropertyIdentifier(TokenKind tt);
+    ParseNode *propertyQualifiedIdentifier();
 #endif /* JS_HAS_XML_SUPPORT */
 
     bool setAssignmentLhsOps(ParseNode *pn, JSOp op);
 };
 
 inline bool
 Parser::reportErrorNumber(ParseNode *pn, uintN flags, uintN errorNumber, ...)
 {
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -2278,17 +2278,16 @@ TokenKindToString(TokenKind tt)
       case TOK_XMLATTR:         return "TOK_XMLATTR";
       case TOK_XMLSPACE:        return "TOK_XMLSPACE";
       case TOK_XMLTEXT:         return "TOK_XMLTEXT";
       case TOK_XMLCOMMENT:      return "TOK_XMLCOMMENT";
       case TOK_XMLCDATA:        return "TOK_XMLCDATA";
       case TOK_XMLPI:           return "TOK_XMLPI";
       case TOK_AT:              return "TOK_AT";
       case TOK_DBLCOLON:        return "TOK_DBLCOLON";
-      case TOK_ANYNAME:         return "TOK_ANYNAME";
       case TOK_DBLDOT:          return "TOK_DBLDOT";
       case TOK_FILTER:          return "TOK_FILTER";
       case TOK_XMLELEM:         return "TOK_XMLELEM";
       case TOK_XMLLIST:         return "TOK_XMLLIST";
       case TOK_YIELD:           return "TOK_YIELD";
       case TOK_LEXICALSCOPE:    return "TOK_LEXICALSCOPE";
       case TOK_LET:             return "TOK_LET";
       case TOK_RESERVED:        return "TOK_RESERVED";
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -126,17 +126,16 @@ enum TokenKind {
     TOK_XMLATTR,                   /* XML quoted attribute value */
     TOK_XMLSPACE,                  /* XML whitespace */
     TOK_XMLTEXT,                   /* XML text */
     TOK_XMLCOMMENT,                /* XML comment */
     TOK_XMLCDATA,                  /* XML CDATA section */
     TOK_XMLPI,                     /* XML processing instruction */
     TOK_AT,                        /* XML attribute op (@) */
     TOK_DBLCOLON,                  /* namespace qualified name op (::) */
-    TOK_ANYNAME,                   /* XML AnyName singleton (*) */
     TOK_DBLDOT,                    /* XML descendant op (..) */
     TOK_FILTER,                    /* XML filtering predicate op (.()) */
     TOK_XMLELEM,                   /* XML element node type (no token) */
     TOK_XMLLIST,                   /* XML list node type (no token) */
     TOK_YIELD,                     /* yield from generator function */
     TOK_LEXICALSCOPE,              /* block scope AST node label */
     TOK_LET,                       /* let keyword */
     TOK_RESERVED,                  /* reserved keywords */
@@ -197,22 +196,16 @@ enum TokenKind {
 
 inline bool
 TokenKindIsEquality(TokenKind tt)
 {
     return TOK_EQUALITY_START <= tt && tt <= TOK_EQUALITY_LAST;
 }