From 9fdb936eb2cf3fcd81ddd689fd2e3f29e9dc9625 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 9 Feb 2010 18:24:49 +0200 Subject: [PATCH 01/31] Bug 544018 - print preview doesn't work in view source , r=dao --- browser/base/content/browser-fullZoom.js | 6 +- browser/base/content/browser.js | 34 +++-- content/base/src/nsDocument.cpp | 2 + .../components/printing/content/printUtils.js | 128 +++++------------- .../viewsource/content/viewPartialSource.xul | 2 +- .../viewsource/content/viewSource.js | 48 ++++--- .../viewsource/content/viewSource.xul | 2 +- 7 files changed, 97 insertions(+), 125 deletions(-) diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index d150f18f9b61..8ade7f68650e 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -333,13 +333,13 @@ var FullZoom = { * one. **/ _applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) { - if (!this.siteSpecific && !this._inPrivateBrowsing) + if ((!this.siteSpecific && !this._inPrivateBrowsing) || + gInPrintPreviewMode) return; var browser = aBrowser || gBrowser.selectedBrowser; try { - if (gInPrintPreviewMode || - browser.contentDocument instanceof Ci.nsIImageDocument || + if (browser.contentDocument instanceof Ci.nsIImageDocument || this._inPrivateBrowsing) ZoomManager.setZoomForBrowser(browser, 1); else if (typeof aValue != "undefined") diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 10a5b0be3b3e..ae3fe2267209 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2536,11 +2536,34 @@ function BrowserReloadWithFlags(reloadFlags) { } var PrintPreviewListener = { + _printPreviewTab: null, + _tabBeforePrintPreview: null, + + getPrintPreviewBrowser: function () { + if (!this._printPreviewTab) { + this._tabBeforePrintPreview = gBrowser.selectedTab; + this._printPreviewTab = gBrowser.loadOneTab("about:blank", + { inBackground: false }); + gBrowser.selectedTab = this._printPreviewTab; + } + return gBrowser.getBrowserForTab(this._printPreviewTab); + }, + getSourceBrowser: function () { + return this._tabBeforePrintPreview ? + this._tabBeforePrintPreview.linkedBrowser : gBrowser.selectedBrowser; + }, + getNavToolbox: function () { + return gNavToolbox; + }, onEnter: function () { gInPrintPreviewMode = true; this._toggleAffectedChrome(); }, onExit: function () { + gBrowser.selectedTab = this._tabBeforePrintPreview; + this._tabBeforePrintPreview = null; + gBrowser.removeTab(this._printPreviewTab); + this._printPreviewTab = null; gInPrintPreviewMode = false; this._toggleAffectedChrome(); }, @@ -2572,8 +2595,7 @@ var PrintPreviewListener = { this._chromeState.sidebarOpen = !sidebar.hidden; this._sidebarCommand = sidebar.getAttribute("sidebarcommand"); - this._chromeState.hadTabStrip = gBrowser.getStripVisibility(); - gBrowser.setStripVisibilityTo(false); + gBrowser.mStrip.setAttribute("moz-collapsed", "true"); var notificationBox = gBrowser.getNotificationBox(); this._chromeState.notificationsOpen = !notificationBox.notificationsHidden; @@ -2588,8 +2610,7 @@ var PrintPreviewListener = { gFindBar.close(); }, _showChrome: function () { - if (this._chromeState.hadTabStrip) - gBrowser.setStripVisibilityTo(true); + gBrowser.mStrip.removeAttribute("moz-collapsed"); if (this._chromeState.notificationsOpen) gBrowser.getNotificationBox().notificationsHidden = false; @@ -2602,11 +2623,6 @@ var PrintPreviewListener = { } } -function getPPBrowser() -{ - return gBrowser; -} - function getMarkupDocumentViewer() { return gBrowser.markupDocumentViewer; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index f231c2662f2e..e92224a693d4 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1798,6 +1798,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnloadBlocker) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOriginalDocument) // An element will only be in the linkmap as long as it's in the // document, so we'll traverse the table here instead of from the element. @@ -1851,6 +1852,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDisplayDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA diff --git a/toolkit/components/printing/content/printUtils.js b/toolkit/components/printing/content/printUtils.js index eaa4c6a1241c..9f93e8064734 100644 --- a/toolkit/components/printing/content/printUtils.js +++ b/toolkit/components/printing/content/printUtils.js @@ -87,32 +87,27 @@ var PrintUtils = { } }, - // calling PrintUtils.printPreview() requires that you have three functions - // in the global scope: getPPBrowser(), which returns the browser element in - // the window print preview uses, getNavToolbox(), which returns the element - // (usually the main toolbox element) before which the print preview toolbar - // should be inserted, and getWebNavigation(), which returns the document's - // nsIWebNavigation object - printPreview: function (aListenerOrEnterCallback, aExitCallback) + // If aCallback is not null, it must be an object which has the following methods: + // getPrintPreviewBrowser(), getSourceBrowser(), + // getNavToolbox(), onEnter() and onExit(). + // If aCallback is null, then printPreview must previously have been called with + // non-null aCallback and that object will be reused. + printPreview: function (aCallback) { - // if we're already in PP mode, don't set the callbacks; chances - // are they're null because someone is calling printPreview() to + // if we're already in PP mode, don't set the callback; chances + // are it is null because someone is calling printPreview() to // get us to refresh the display. if (!document.getElementById("print-preview-toolbar")) { - if (typeof aListenerOrEnterCallback == "object") { - this._onEnterPP = function () { aListenerOrEnterCallback.onEnter(); }; - this._onExitPP = function () { aListenerOrEnterCallback.onExit(); }; - } else { - this._onEnterPP = aListenerOrEnterCallback; - this._onExitPP = aExitCallback; - } + this._callback = aCallback; + this._sourceBrowser = aCallback.getSourceBrowser(); + this._originalTitle = this._sourceBrowser.contentDocument.title; + this._originalURL = this._sourceBrowser.currentURI.spec; } else { // collapse the browser here -- it will be shown in - // onEnterPrintPreview; this forces a reflow which fixes display + // enterPrintPreview; this forces a reflow which fixes display // issues in bug 267422. - var browser = getPPBrowser(); - if (browser) - browser.collapsed = true; + this._sourceBrowser = this._callback.getPrintPreviewBrowser(); + this._sourceBrowser.collapsed = true; } this._webProgressPP = {}; @@ -133,17 +128,16 @@ var PrintUtils = { PPROMPTSVC.showProgress(window, webBrowserPrint, printSettings, this._obsPP, false, this._webProgressPP, ppParams, notifyOnOpen); if (ppParams.value) { - var webNav = getWebNavigation(); - ppParams.value.docTitle = webNav.document.title; - ppParams.value.docURL = webNav.currentURI.spec; + ppParams.value.docTitle = this._originalTitle; + ppParams.value.docURL = this._originalURL; } // this tells us whether we should continue on with PP or // wait for the callback via the observer if (!notifyOnOpen.value.valueOf() || this._webProgressPP.value == null) - this.enterPrintPreview(aWindow); + this.enterPrintPreview(); } catch (e) { - this.enterPrintPreview(aWindow); + this.enterPrintPreview(); } }, @@ -155,11 +149,7 @@ var PrintUtils = { }, getPrintPreview: function() { - if (this._printPreviewTab) { - var docShell = getPPBrowser().getBrowserForTab(this._printPreviewTab).docShell; - return docShell.printPreview; - } - return null; + return this._callback.getPrintPreviewBrowser().docShell.printPreview; }, //////////////////////////////////////// @@ -202,11 +192,12 @@ var PrintUtils = { return printSettings; }, - _originalZoomValue: null, _closeHandlerPP: null, _webProgressPP: null, - _onEnterPP: null, - _onExitPP: null, + _callback: null, + _sourceBrowser: null, + _originalTitle: "", + _originalURL: "", // This observer is called once the progress dialog has been "opened" _obsPP: @@ -227,44 +218,19 @@ var PrintUtils = { } }, - _originalTab: null, - _printPreviewTab: null, - enterPrintPreview: function () { gFocusedElement = document.commandDispatcher.focusedElement; - // Reset the zoom value and save it to be restored later. - if (typeof ZoomManager == "object") { - this._originalZoomValue = ZoomManager.zoom; - ZoomManager.reset(); - } - var webBrowserPrint; var printSettings = this.getPrintSettings(); - var tabbrowser = getPPBrowser(); - var contentWindow = null; - if (tabbrowser) { - if (this._printPreviewTab) { - contentWindow = - tabbrowser.getBrowserForTab(this._printPreviewTab).contentWindow; - } else { - this._originalTab = tabbrowser.mCurrentTab; - contentWindow = window.content - this._printPreviewTab = tabbrowser.loadOneTab("about:blank", null, null, - null, true, false); - } - } + var originalWindow = this._sourceBrowser.contentWindow; try { webBrowserPrint = this.getPrintPreview(); - webBrowserPrint.printPreview(printSettings, contentWindow, + webBrowserPrint.printPreview(printSettings, originalWindow, this._webProgressPP.value); } catch (e) { - this._printPreviewTab = null; - this._originalTab = null; - if (typeof ZoomManager == "object") - ZoomManager.zoom = this._originalZoomValue; // Pressing cancel is expressed as an NS_ERROR_ABORT return value, // causing an exception to be thrown which we catch here. // Unfortunately this will also consume helpful failures, so add a @@ -275,12 +241,9 @@ var PrintUtils = { var printPreviewTB = document.getElementById("print-preview-toolbar"); if (printPreviewTB) { printPreviewTB.updateToolbar(); - var browser = getPPBrowser(); - if (browser) - browser.collapsed = false; - - tabbrowser.getBrowserForTab(this._printPreviewTab).contentWindow.focus(); - tabbrowser.selectedTab = this._printPreviewTab; + var browser = this._callback.getPrintPreviewBrowser(); + browser.collapsed = false; + browser.contentWindow.focus(); return; } @@ -293,7 +256,7 @@ var PrintUtils = { printPreviewTB.id = "print-preview-toolbar"; printPreviewTB.className = "toolbar-primary"; - var navToolbox = getNavToolbox(); + var navToolbox = this._callback.getNavToolbox(); navToolbox.parentNode.insertBefore(printPreviewTB, navToolbox); // copy the window close handler @@ -306,14 +269,12 @@ var PrintUtils = { // disable chrome shortcuts... window.addEventListener("keypress", this.onKeyPressPP, true); - tabbrowser.getBrowserForTab(this._printPreviewTab).contentWindow.focus(); - tabbrowser.selectedTab = this._printPreviewTab; + var browser = this._callback.getPrintPreviewBrowser(); + browser.collapsed = false; + browser.contentWindow.focus(); // on Enter PP Call back - if (this._onEnterPP) { - this._onEnterPP(); - this._onEnterPP = null; - } + this._callback.onEnter(); }, exitPrintPreview: function () @@ -324,23 +285,12 @@ var PrintUtils = { document.documentElement.setAttribute("onclose", this._closeHandlerPP); this._closeHandlerPP = null; - var webBrowserPrint = this.getWebBrowserPrint(); + var webBrowserPrint = this.getPrintPreview(); webBrowserPrint.exitPrintPreview(); - var tabbrowser = getPPBrowser(); - if (tabbrowser) { - tabbrowser.removeTab(this._printPreviewTab); - tabbrowser.selectedTab = this._originalTab; - this._originalTab = null; - this._printPreviewTab = null; - } - - if (typeof ZoomManager == "object") - ZoomManager.zoom = this._originalZoomValue; - // remove the print preview toolbar var printPreviewTB = document.getElementById("print-preview-toolbar"); - getNavToolbox().parentNode.removeChild(printPreviewTB); + this._callback.getNavToolbox().parentNode.removeChild(printPreviewTB); var fm = Components.classes["@mozilla.org/focus-manager;1"] .getService(Components.interfaces.nsIFocusManager); @@ -350,11 +300,7 @@ var PrintUtils = { window.content.focus(); gFocusedElement = null; - // on Exit PP Call back - if (this._onExitPP) { - this._onExitPP(); - this._onExitPP = null; - } + this._callback.onExit(); }, onKeyPressPP: function (aEvent) diff --git a/toolkit/components/viewsource/content/viewPartialSource.xul b/toolkit/components/viewsource/content/viewPartialSource.xul index ba10fbaf3d98..705c09458660 100644 --- a/toolkit/components/viewsource/content/viewPartialSource.xul +++ b/toolkit/components/viewsource/content/viewPartialSource.xul @@ -78,7 +78,7 @@ - + diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index 2678b06d32fd..67e904a56f9d 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -383,26 +383,34 @@ function ViewSourceSavePage() saveURL(window.content.location.href.substring(12), null, "SaveLinkTitle"); } -function onEnterPP() -{ - var toolbox = document.getElementById("viewSource-toolbox"); - toolbox.hidden = true; -} - -function onExitPP() -{ - var toolbox = document.getElementById("viewSource-toolbox"); - toolbox.hidden = false; -} - -function getPPBrowser() { - return gBrowser; -} - -// printUtils.js uses this -function getNavToolbox() -{ - return document.getElementById("appcontent"); +var PrintPreviewListener = { + getPrintPreviewBrowser: function () { + var browser = document.getElementById("ppBrowser"); + if (!browser) { + browser = document.createElement("browser"); + browser.setAttribute("id", "ppBrowser"); + browser.setAttribute("flex", "1"); + document.getElementById("appcontent"). + insertBefore(browser, document.getElementById("FindToolbar")); + } + return browser; + }, + getSourceBrowser: function () { + return gBrowser; + }, + getNavToolbox: function () { + return document.getElementById("appcontent"); + }, + onEnter: function () { + var toolbox = document.getElementById("viewSource-toolbox"); + toolbox.hidden = true; + gBrowser.collapsed = true; + }, + onExit: function () { + document.getElementById("ppBrowser").collapsed = true; + gBrowser.collapsed = false; + document.getElementById("viewSource-toolbox").hidden = false; + } } function getWebNavigation() diff --git a/toolkit/components/viewsource/content/viewSource.xul b/toolkit/components/viewsource/content/viewSource.xul index b132db8f1e0b..78ed8d8ba588 100644 --- a/toolkit/components/viewsource/content/viewSource.xul +++ b/toolkit/components/viewsource/content/viewSource.xul @@ -78,7 +78,7 @@ - + From 5553fe0b7e4be1eb0973f462e60b8bf7b6213954 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:05 -0500 Subject: [PATCH 02/31] Bug 542033. Use the right MOZ_FIX_LINK_PATHS when darwin is the target. r=ted --- configure.in | 2 +- js/src/configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 0c7d4719c877..e023e3337e73 100644 --- a/configure.in +++ b/configure.in @@ -1730,7 +1730,6 @@ case "$host" in HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11" HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" - MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' ;; *-linux*|*-kfreebsd*-gnu) @@ -1916,6 +1915,7 @@ case "$target" in LDFLAGS=$_SAVE_LDFLAGS fi + MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' ;; *-freebsd*) diff --git a/js/src/configure.in b/js/src/configure.in index 300fbfc31c7f..629b71870182 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1508,7 +1508,6 @@ case "$host" in HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11" HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" - MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc' ;; @@ -1677,6 +1676,7 @@ case "$target" in LDFLAGS=$_SAVE_LDFLAGS fi + MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' ;; *-freebsd*) From 3e75949842899d5c084de9280dc67f4e1da7fa78 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 03/31] Bug 543079. Put system libs into OS_LIBS, not EXTRA_DSO_LDOPTS, when building libxul. r=ted --- toolkit/library/Makefile.in | 2 +- toolkit/library/libxul-config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index a7db916e4e83..3b00293b9083 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -177,7 +177,7 @@ EXTRA_DSO_LDOPTS += $(NSPR_LIBS) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) CXXFLAGS += $(TK_CFLAGS) -EXTRA_DSO_LDOPTS += \ +OS_LIBS += \ -framework SystemConfiguration \ -framework QuickTime \ -framework IOKit \ diff --git a/toolkit/library/libxul-config.mk b/toolkit/library/libxul-config.mk index 65cf38f58786..676daff934b3 100644 --- a/toolkit/library/libxul-config.mk +++ b/toolkit/library/libxul-config.mk @@ -363,7 +363,7 @@ COMPONENT_LIBS += gkdebug endif ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -EXTRA_DSO_LDOPTS += -framework OpenGL -lcups +OS_LIBS += -framework OpenGL -lcups endif EXTRA_DSO_LDOPTS += \ From af4d6a692144c76b3749331c6b880306ce1f8a2f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 04/31] Bug 543081. Put -lobjc in LDFLAGS, not LIXBUL_LIBS. r=ted --- configure.in | 4 ++-- js/src/configure.in | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index e023e3337e73..53e039e68b24 100644 --- a/configure.in +++ b/configure.in @@ -4901,10 +4901,10 @@ cairo-cocoa) AC_DEFINE(XP_MACOSX) TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook' TK_CFLAGS="-DNO_X11" - LDFLAGS="$LDFLAGS -framework Cocoa" + LDFLAGS="$LDFLAGS -framework Cocoa -lobjc" CFLAGS="$CFLAGS $TK_CFLAGS" CXXFLAGS="$CXXFLAGS $TK_CFLAGS" - LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc' + LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL' MOZ_FS_LAYOUT=bundle MOZ_WEBGL=1 ;; diff --git a/js/src/configure.in b/js/src/configure.in index 629b71870182..f5259f307806 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1508,7 +1508,8 @@ case "$host" in HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11" HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" - LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc' + LDFLAGS="$LDFLAGS -lobjc" + LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL' ;; *-linux*|*-kfreebsd*-gnu) From 91d68aa02c1ffd15399e8cbfa5701409e3781c58 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 05/31] Bug 543086. Don't try to build the default plug-in on mac if we don't have pbbuild. It'll just fail. r=ted --- modules/plugin/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/plugin/Makefile.in b/modules/plugin/Makefile.in index aef5287e3c4d..d1013d73f783 100644 --- a/modules/plugin/Makefile.in +++ b/modules/plugin/Makefile.in @@ -68,9 +68,11 @@ ifeq ($(OS_ARCH),OS2) TOOL_DIRS += default/os2 endif +ifdef PBBUILD ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) TOOL_DIRS += default/mac endif +endif ifdef ENABLE_TESTS ifneq (,$(filter WINNT Darwin Linux OS2 SunOS,$(OS_ARCH))) From 618d27911f2b07362ff6c12729afd3e317634589 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 06/31] Bug 543111. Make breakpad compile when cross-compiling with toolwhip. r=ted --- toolkit/crashreporter/Makefile.in | 9 ++++++++- .../google-breakpad/src/common/dwarf/functioninfo.cc | 3 +++ .../google-breakpad/src/common/mac/Makefile.in | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 9ba5c2e580bb..64559bd433d3 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -61,12 +61,19 @@ endif ifeq ($(OS_ARCH),Darwin) CMMSRCS = mac_utils.mm +# Check both OS_ARCH (needed to be able to run it afterward) and +# HOST_OS_ARCH (needed because it refuses to cross-compile). +ifeq ($(HOST_OS_ARCH),Darwin) +DIRS += \ + google-breakpad/src/tools/mac/dump_syms \ + $(NULL) +endif + DIRS += \ google-breakpad/src/common \ google-breakpad/src/common/mac \ google-breakpad/src/client \ google-breakpad/src/client/mac/handler \ - google-breakpad/src/tools/mac/dump_syms \ $(NULL) endif diff --git a/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc b/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc index 1957153e92f7..8b3056e2daba 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc +++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc @@ -34,6 +34,9 @@ #include #include #include +#include +#include +#include #include "common/dwarf/functioninfo.h" diff --git a/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in index c0bdbccc3438..eda5680186b3 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in +++ b/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in @@ -62,11 +62,13 @@ CMSRCS = \ HTTPMultipartUpload.m \ $(NULL) +ifeq ($(HOST_OS_ARCH),Darwin) HOST_CPPSRCS = $(CPPSRCS) HOST_CMMSRCS = \ dump_syms.mm \ $(NULL) +endif # need static lib FORCE_STATIC_LIB = 1 From 6a12c8a3bb9d0eb62bd1abe84730cf787c757852 Mon Sep 17 00:00:00 2001 From: Jae-Seong Lee-Russo Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 07/31] Bug 530382. Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in docshell. r=jst --- docshell/base/nsDocShell.cpp | 4 ++-- docshell/shistory/src/nsSHistory.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index db0abb87d1c7..e3fede4be1ab 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2112,8 +2112,8 @@ nsDocShell::HistoryPurged(PRInt32 aNumEntries) // eviction. We need to adjust by the number of entries that we // just purged from history, so that we look at the right session history // entries during eviction. - mPreviousTransIndex = PR_MAX(-1, mPreviousTransIndex - aNumEntries); - mLoadedTransIndex = PR_MAX(0, mLoadedTransIndex - aNumEntries); + mPreviousTransIndex = NS_MAX(-1, mPreviousTransIndex - aNumEntries); + mLoadedTransIndex = NS_MAX(0, mLoadedTransIndex - aNumEntries); PRInt32 count = mChildList.Count(); for (PRInt32 i = 0; i < count; ++i) { diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index ffd132642abf..9b946b96d148 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -551,7 +551,7 @@ nsSHistory::PurgeHistory(PRInt32 aEntries) if (mLength <= 0 || aEntries <= 0) return NS_ERROR_FAILURE; - aEntries = PR_MIN(aEntries, mLength); + aEntries = NS_MIN(aEntries, mLength); PRBool purgeHistory = PR_TRUE; // Notify the listener about the history purge @@ -813,13 +813,13 @@ nsSHistory::EvictWindowContentViewers(PRInt32 aFromIndex, PRInt32 aToIndex) if (endIndex <= 0) { return; } - startIndex = PR_MAX(0, aFromIndex - gHistoryMaxViewers); + startIndex = NS_MAX(0, aFromIndex - gHistoryMaxViewers); } else { // going backward startIndex = aToIndex + gHistoryMaxViewers + 1; if (startIndex >= mLength) { return; } - endIndex = PR_MIN(mLength, aFromIndex + gHistoryMaxViewers + 1); + endIndex = NS_MIN(mLength, aFromIndex + gHistoryMaxViewers + 1); } #ifdef DEBUG @@ -913,8 +913,8 @@ nsSHistory::EvictGlobalContentViewer() // viewer. There could be up to gHistoryMaxViewers content viewers, // but we don't know whether they are before or after the mIndex position // in the SHEntry list. Just check both sides, to be safe. - PRInt32 startIndex = PR_MAX(0, shist->mIndex - gHistoryMaxViewers); - PRInt32 endIndex = PR_MIN(shist->mLength - 1, + PRInt32 startIndex = NS_MAX(0, shist->mIndex - gHistoryMaxViewers); + PRInt32 endIndex = NS_MIN(shist->mLength - 1, shist->mIndex + gHistoryMaxViewers); nsCOMPtr trans; shist->GetTransactionAtIndex(startIndex, getter_AddRefs(trans)); @@ -1006,8 +1006,8 @@ nsSHistory::EvictGlobalContentViewer() NS_IMETHODIMP nsSHistory::EvictExpiredContentViewerForEntry(nsISHEntry *aEntry) { - PRInt32 startIndex = PR_MAX(0, mIndex - gHistoryMaxViewers); - PRInt32 endIndex = PR_MIN(mLength - 1, + PRInt32 startIndex = NS_MAX(0, mIndex - gHistoryMaxViewers); + PRInt32 endIndex = NS_MIN(mLength - 1, mIndex + gHistoryMaxViewers); nsCOMPtr trans; GetTransactionAtIndex(startIndex, getter_AddRefs(trans)); From f603c639e58e8b25d6d1a0784b2dd2f9ff20fa19 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 12:09:06 -0500 Subject: [PATCH 08/31] Bug 453929. Cache getElementsBy(Class)Name return values. r=jst --- content/base/src/nsContentList.cpp | 128 ++++++++++++++++++- content/base/src/nsContentList.h | 71 ++++++++++ content/base/src/nsDocument.cpp | 11 +- content/html/document/src/nsHTMLDocument.cpp | 13 +- 4 files changed, 212 insertions(+), 11 deletions(-) diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index d5b7b4862345..d795d56a94f4 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -296,6 +296,109 @@ NS_GetContentList(nsINode* aRootNode, nsIAtom* aMatchAtom, return list; } +// Hashtable for storing nsCacheableFuncStringContentList +static PLDHashTable gFuncStringContentListHashTable; + +struct FuncStringContentListHashEntry : public PLDHashEntryHdr +{ + nsCacheableFuncStringContentList* mContentList; +}; + +static PLDHashNumber +FuncStringContentListHashtableHashKey(PLDHashTable *table, const void *key) +{ + const nsFuncStringCacheKey* funcStringKey = + static_cast(key); + return funcStringKey->GetHash(); +} + +static PRBool +FuncStringContentListHashtableMatchEntry(PLDHashTable *table, + const PLDHashEntryHdr *entry, + const void *key) +{ + const FuncStringContentListHashEntry *e = + static_cast(entry); + const nsFuncStringCacheKey* ourKey = + static_cast(key); + + return e->mContentList->Equals(ourKey); +} + +already_AddRefed +NS_GetFuncStringContentList(nsINode* aRootNode, + nsContentListMatchFunc aFunc, + nsContentListDestroyFunc aDestroyFunc, + void* aData, + const nsAString& aString) +{ + NS_ASSERTION(aRootNode, "content list has to have a root"); + + nsCacheableFuncStringContentList* list = nsnull; + + static PLDHashTableOps hash_table_ops = + { + PL_DHashAllocTable, + PL_DHashFreeTable, + FuncStringContentListHashtableHashKey, + FuncStringContentListHashtableMatchEntry, + PL_DHashMoveEntryStub, + PL_DHashClearEntryStub, + PL_DHashFinalizeStub + }; + + // Initialize the hashtable if needed. + if (!gFuncStringContentListHashTable.ops) { + PRBool success = PL_DHashTableInit(&gFuncStringContentListHashTable, + &hash_table_ops, nsnull, + sizeof(FuncStringContentListHashEntry), + 16); + + if (!success) { + gFuncStringContentListHashTable.ops = nsnull; + } + } + + FuncStringContentListHashEntry *entry = nsnull; + // First we look in our hashtable. Then we create a content list if needed + if (gFuncStringContentListHashTable.ops) { + nsFuncStringCacheKey hashKey(aRootNode, aFunc, aString); + + // A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases + // when the entry is already in the hashtable. + entry = static_cast + (PL_DHashTableOperate(&gFuncStringContentListHashTable, + &hashKey, + PL_DHASH_ADD)); + if (entry) + list = entry->mContentList; + } + + if (!list) { + // We need to create a ContentList and add it to our new entry, if + // we have an entry + list = new nsCacheableFuncStringContentList(aRootNode, aFunc, aDestroyFunc, aData, aString); + if (entry) { + if (list) + entry->mContentList = list; + else + PL_DHashTableRawRemove(&gContentListHashTable, entry); + } + + NS_ENSURE_TRUE(list, nsnull); + } else { + // List was already in the hashtable; clean up our new aData + if (aDestroyFunc) { + (*aDestroyFunc)(aData); + } + } + + NS_ADDREF(list); + + // Don't cache these lists globally + + return list; +} // nsContentList implementation @@ -450,7 +553,7 @@ nsContentList::NodeWillBeDestroyed(const nsINode* aNode) { // We shouldn't do anything useful from now on - RemoveFromHashtable(); + RemoveFromCaches(); mRootNode = nsnull; // We will get no more updates, so we can never know we're up to @@ -913,6 +1016,29 @@ nsContentList::BringSelfUpToDate(PRBool aDoFlush) "PopulateSelf dod not bring content list up to date!"); } +nsCacheableFuncStringContentList::~nsCacheableFuncStringContentList() +{ + RemoveFromFuncStringHashtable(); +} + +void +nsCacheableFuncStringContentList::RemoveFromFuncStringHashtable() +{ + if (!gFuncStringContentListHashTable.ops) { + return; + } + + nsFuncStringCacheKey key(mRootNode, mFunc, mString); + PL_DHashTableOperate(&gFuncStringContentListHashTable, + &key, + PL_DHASH_REMOVE); + + if (gFuncStringContentListHashTable.entryCount == 0) { + PL_DHashTableFinish(&gFuncStringContentListHashTable); + gFuncStringContentListHashTable.ops = nsnull; + } +} + #ifdef DEBUG_CONTENT_LIST void nsContentList::AssertInSync() diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h index e5e49bdf789f..fe7e00fc6441 100644 --- a/content/base/src/nsContentList.h +++ b/content/base/src/nsContentList.h @@ -55,6 +55,7 @@ #include "nsINameSpaceManager.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" +#include "nsCRT.h" // Magic namespace id that means "match all namespaces". This is // negative so it won't collide with actual namespace constants. @@ -396,6 +397,15 @@ protected: Reset(); } + /** + * To be called from non-destructor locations that want to remove from caches. + * Needed because if subclasses want to have cache behavior they can't just + * override RemoveFromHashtable(), since we call that in our destructor. + */ + virtual void RemoveFromCaches() { + RemoveFromHashtable(); + } + /** * Function to use to determine whether a piece of content matches * our criterion @@ -434,8 +444,69 @@ protected: #endif }; +/** + * A class of cacheable content list; cached on the combination of aRootNode + aFunc + aDataString + */ +class nsCacheableFuncStringContentList; + +class NS_STACK_CLASS nsFuncStringCacheKey { +public: + nsFuncStringCacheKey(nsINode* aRootNode, + nsContentListMatchFunc aFunc, + const nsAString& aString) : + mRootNode(aRootNode), + mFunc(aFunc), + mString(aString) + {} + + PRUint32 GetHash(void) const + { + return NS_PTR_TO_INT32(mRootNode) ^ (NS_PTR_TO_INT32(mFunc) << 12) ^ + nsCRT::HashCode(PromiseFlatString(mString).get()); + } + +private: + friend class nsCacheableFuncStringContentList; + + nsINode* const mRootNode; + const nsContentListMatchFunc mFunc; + const nsAString& mString; +}; + +class nsCacheableFuncStringContentList : public nsContentList { +public: + nsCacheableFuncStringContentList(nsINode* aRootNode, + nsContentListMatchFunc aFunc, + nsContentListDestroyFunc aDestroyFunc, + void* aData, + const nsAString& aString) : + nsContentList(aRootNode, aFunc, aDestroyFunc, aData), + mString(aString) + {} + + virtual ~nsCacheableFuncStringContentList(); + + PRBool Equals(const nsFuncStringCacheKey* aKey) { + return mRootNode == aKey->mRootNode && mFunc == aKey->mFunc && + mString == aKey->mString; + } +protected: + virtual void RemoveFromCaches() { + RemoveFromFuncStringHashtable(); + } + void RemoveFromFuncStringHashtable(); + + nsString mString; +}; + already_AddRefed NS_GetContentList(nsINode* aRootNode, nsIAtom* aMatchAtom, PRInt32 aMatchNameSpaceId); +already_AddRefed +NS_GetFuncStringContentList(nsINode* aRootNode, + nsContentListMatchFunc aFunc, + nsContentListDestroyFunc aDestroyFunc, + void* aData, + const nsAString& aString); #endif // nsContentList_h___ diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index e92224a693d4..6958c4cc9275 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2861,21 +2861,24 @@ nsDocument::GetElementsByClassNameHelper(nsINode* aRootNode, aRootNode->GetOwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks ? eIgnoreCase : eCaseMatters; - - elements = new nsContentList(aRootNode, MatchClassNames, - DestroyClassNameArray, info); + + elements = + NS_GetFuncStringContentList(aRootNode, MatchClassNames, + DestroyClassNameArray, info, + aClasses).get(); } else { delete info; info = nsnull; elements = new nsBaseContentList(); + NS_IF_ADDREF(elements); } if (!elements) { delete info; return NS_ERROR_OUT_OF_MEMORY; } + // Transfer ownership *aReturn = elements; - NS_ADDREF(*aReturn); return NS_OK; } diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 6d4c541248ce..36c3d930329a 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -2280,17 +2280,18 @@ NS_IMETHODIMP nsHTMLDocument::GetElementsByName(const nsAString& aElementName, nsIDOMNodeList** aReturn) { - void* elementNameData = new nsString(aElementName); + nsString* elementNameData = new nsString(aElementName); NS_ENSURE_TRUE(elementNameData, NS_ERROR_OUT_OF_MEMORY); nsContentList* elements = - new nsContentList(this, - MatchNameAttribute, - nsContentUtils::DestroyMatchString, - elementNameData); + NS_GetFuncStringContentList(this, + MatchNameAttribute, + nsContentUtils::DestroyMatchString, + elementNameData, + *elementNameData).get(); NS_ENSURE_TRUE(elements, NS_ERROR_OUT_OF_MEMORY); + // Transfer ownership *aReturn = elements; - NS_ADDREF(*aReturn); return NS_OK; } From 7892aabac99cb0b51c74d6cb01242b94aaa1fbcf Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Tue, 9 Feb 2010 11:02:11 -0800 Subject: [PATCH 09/31] Bug 543976 - Clean up Maemo defines. r=ted --- config/autoconf.mk.in | 12 +- config/system-headers | 4 +- configure.in | 113 +++++++++++------- content/canvas/src/Makefile.in | 9 +- content/canvas/src/nsGLPbufferEGL.cpp | 6 +- content/events/src/nsEventStateManager.h | 4 +- docshell/build/Makefile.in | 4 +- js/src/config/system-headers | 4 +- layout/generic/nsObjectFrame.cpp | 24 ++-- modules/plugin/base/public/npapi.h | 4 +- .../plugin/base/public/nsPluginNativeWindow.h | 2 +- modules/plugin/base/src/nsNPAPIPlugin.cpp | 4 +- .../plugin/base/src/nsNPAPIPluginInstance.cpp | 2 +- .../base/src/nsPluginNativeWindowGtk2.cpp | 2 +- .../downloads/src/nsDownloadManager.cpp | 2 +- toolkit/library/Makefile.in | 8 +- toolkit/xre/nsNativeAppSupportUnix.cpp | 10 +- uriloader/exthandler/Makefile.in | 2 +- uriloader/exthandler/nsDBusHandlerApp.cpp | 4 +- uriloader/exthandler/unix/nsGNOMERegistry.cpp | 4 +- uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 10 +- uriloader/exthandler/unix/nsMIMEInfoUnix.h | 2 +- .../exthandler/unix/nsOSHelperAppService.cpp | 2 +- widget/src/gtk2/Makefile.in | 4 +- widget/src/gtk2/mozcontainer.h | 2 +- widget/src/gtk2/nsFilePicker.cpp | 4 +- widget/src/gtk2/nsLookAndFeel.cpp | 6 +- widget/src/gtk2/nsWindow.cpp | 14 +-- xpcom/base/nsMemoryImpl.cpp | 4 +- xpcom/base/nsSystemInfo.cpp | 2 +- xpcom/build/Makefile.in | 4 +- xpcom/io/Makefile.in | 6 +- xpcom/io/SpecialSystemDirectory.cpp | 2 +- xpcom/io/nsLocalFileUnix.cpp | 4 +- 34 files changed, 152 insertions(+), 138 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 9850fcd593ac..39be5a405cbb 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -623,15 +623,9 @@ HAS_OGLES = @HAS_OGLES@ MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@ -NS_OSSO = @NS_OSSO@ -MOZ_PLATFORM_HILDON = @MOZ_PLATFORM_HILDON@ - -LIBHILDONMIME_CFLAGS = @LIBHILDONMIME_CFLAGS@ -LIBHILDONMIME_LIBS = @LIBHILDONMIME_LIBS@ -LIBOSSO_CFLAGS = @LIBOSSO_CFLAGS@ -LIBOSSO_LIBS = @LIBOSSO_LIBS@ -LIBHILDONFM_CFLAGS = @LIBHILDONFM_CFLAGS@ -LIBHILDONFM_LIBS = @LIBHILDONFM_LIBS@ +MOZ_PLATFORM_MAEMO = @MOZ_PLATFORM_MAEMO@ +MOZ_PLATFORM_MAEMO_CFLAGS = @MOZ_PLATFORM_MAEMO_CFLAGS@ +MOZ_PLATFORM_MAEMO_LIBS = @MOZ_PLATFORM_MAEMO_LIBS@ MOZ_ENABLE_LIBCONIC = @MOZ_ENABLE_LIBCONIC@ LIBCONIC_CFLAGS = @LIBCONIC_CFLAGS@ diff --git a/config/system-headers b/config/system-headers index 890ead5340bc..d695f52f1297 100644 --- a/config/system-headers +++ b/config/system-headers @@ -1009,12 +1009,10 @@ hunspell.hxx #if MOZ_NATIVE_BZ2==1 bzlib.h #endif -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) hildon-uri.h hildon-mime.h hildon-file-chooser-dialog.h -#endif -#ifdef NS_OSSO libosso.h osso-mem.h #endif diff --git a/configure.in b/configure.in index 53e039e68b24..766d378c77f0 100644 --- a/configure.in +++ b/configure.in @@ -6408,47 +6408,78 @@ AC_SUBST(LIBCONIC_CFLAGS) AC_SUBST(LIBCONIC_LIBS) dnl ======================================================== -dnl = Hildon and OSSO checks +dnl = Maemo checks dnl ======================================================== -PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, - MOZ_PLATFORM_HILDON=1, - MOZ_PLATFORM_HILDON=) -if test $MOZ_PLATFORM_HILDON; then - AC_DEFINE(MOZ_PLATFORM_HILDON) - X11_COMPOSITED_PLUGINS="yes" + +MAEMO_SDK_TARGET_VER=-1 + +MOZ_ARG_WITH_STRING(maemo-version, +[ --with-maemo-version=MAEMO_SDK_TARGET_VER + Maemo SDK Version], + MAEMO_SDK_TARGET_VER=$withval) + +case "$MAEMO_SDK_TARGET_VER" in +5) + MOZ_PLATFORM_MAEMO=5 + ;; + +6) + MOZ_PLATFORM_MAEMO=6 + ;; + +-1) + dnl We aren't compiling for Maemo, move on. + ;; +*) + AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.]) + ;; +esac + +if test $MOZ_PLATFORM_MAEMO; then + AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO) + + if test -z "$MOZ_ENABLE_DBUS"; then + AC_MSG_ERROR([DBus is required when building for Maemo]) + fi + + MOZ_GFX_OPTIMIZE_MOBILE=1 + MOZ_WEBGL_GLX= + + if test $MOZ_PLATFORM_MAEMO = 5; then + dnl if we have Xcomposite we should also have Xdamage and Xfixes + AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [], + [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])]) + AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"], + [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS) + + AC_SUBST(XCOMPOSITE_LIBS) + + PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=) + MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS" + MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS" + if test -z "$_LIB_FOUND"; then + AC_MSG_ERROR([Hildon Mime is required when building for Maemo]) + fi + + + PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=) + MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS" + MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS" + if test -z "$_LIB_FOUND"; then + AC_MSG_ERROR([LibOSSO is required when building for Maemo]) + fi + + PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=) + MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS" + MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS" + if test -z "$_LIB_FOUND"; then + AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo]) + fi + fi + + AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS) + AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS) fi -AC_SUBST(LIBHILDONMIME_CFLAGS) -AC_SUBST(LIBHILDONMIME_LIBS) - -if test "$X11_COMPOSITED_PLUGINS" = "yes"; then - dnl if we have Xcomposite we should also have Xdamage and Xfixes - AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [], - [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])]) - AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"], - [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS) -fi -AC_SUBST(XCOMPOSITE_LIBS) - -PKG_CHECK_MODULES(LIBOSSO,libosso, - NS_OSSO=1, - NS_OSSO=) - -if test $NS_OSSO; then - if test -z "$MOZ_ENABLE_DBUS"; then - AC_MSG_ERROR([DBus is required when building for OSSO]) - fi - AC_DEFINE(NS_OSSO) - MOZ_GFX_OPTIMIZE_MOBILE=1 - MOZ_WEBGL_GLX= -fi -AC_SUBST(LIBOSSO_CFLAGS) -AC_SUBST(LIBOSSO_LIBS) - -PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, - NS_HILDONFM=1, - NS_HILDONFM=) -AC_SUBST(LIBHILDONFM_CFLAGS) -AC_SUBST(LIBHILDONFM_LIBS) dnl ======================================================== dnl = faststripe theme @@ -8018,9 +8049,7 @@ AC_SUBST(NS_USE_NATIVE) AC_SUBST(MOZ_WIDGET_TOOLKIT) AC_SUBST(MOZ_UPDATE_XTERM) AC_SUBST(MINIMO) -AC_SUBST(MOZ_PLATFORM_HILDON) -AC_SUBST(NS_OSSO) -AC_SUBST(NS_MAEMO_LOCATION) +AC_SUBST(MOZ_PLATFORM_MAEMO) AC_SUBST(MOZ_AUTH_EXTENSION) AC_SUBST(MOZ_MATHML) AC_SUBST(MOZ_PERMISSIONS) diff --git a/content/canvas/src/Makefile.in b/content/canvas/src/Makefile.in index 308c77fd1357..d0f4098fc042 100644 --- a/content/canvas/src/Makefile.in +++ b/content/canvas/src/Makefile.in @@ -59,16 +59,15 @@ CPPSRCS = \ ifdef MOZ_WEBGL -ifeq (1_1,$(MOZ_X11)_$(NS_OSSO)) +ifdef MOZ_X11 +ifdef MOZ_PLATFORM_MAEMO WEBGL_PLATFORM = EGL DEFINES += -DUSE_GLES2 -endif - -ifeq (1_,$(MOZ_X11)_$(NS_OSSO)) +else WEBGL_PLATFORM = GLX EXTRA_DSO_LIBS += X11 endif - +endif ifeq (windows,$(MOZ_WIDGET_TOOLKIT)) ifdef WINCE diff --git a/content/canvas/src/nsGLPbufferEGL.cpp b/content/canvas/src/nsGLPbufferEGL.cpp index a850578bfbfc..f5ca1431f0aa 100644 --- a/content/canvas/src/nsGLPbufferEGL.cpp +++ b/content/canvas/src/nsGLPbufferEGL.cpp @@ -163,7 +163,7 @@ nsGLPbufferEGL::Init(mozilla::WebGLContext *priv) { mPriv = priv; -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO // Maemo has missing DSO dependencies on their OpenGL libraries; // so ensure that the prerequisite libs are loaded in the process // before loading GL. An alternate approach is to use LD_PRELOAD. @@ -199,7 +199,7 @@ nsGLPbufferEGL::Init(mozilla::WebGLContext *priv) gEGLWrap.fBindAPI (EGL_OPENGL_ES_API); -#if defined(MOZ_X11) && defined(NS_OSSO) +#if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO) EGLint attribs[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, EGL_PIXMAP_BIT, @@ -477,7 +477,7 @@ nsGLPbufferEGL::SwapBuffers() gfxASurface* nsGLPbufferEGL::ThebesSurface() { -#if defined(MOZ_X11) && defined(NS_OSSO) +#if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO) if (getenv("IMAGE")) return mThebesSurface; return mXlibSurface; diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 893cde451034..e09e38f0150e 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -63,9 +63,9 @@ class imgIContainer; class nsDOMDataTransfer; // mac uses click-hold context menus, a holdover from 4.x -// touch screens (like hildon) could use this also, +// touch screens (like maemo) could use this also, // perhaps we should move to NS_TOUCHSCREEN -#if defined(XP_MACOSX) || defined(MOZ_PLATFORM_HILDON) +#if defined(XP_MACOSX) || defined(MOZ_PLATFORM_MAEMO) #define CLICK_HOLD_CONTEXT_MENUS 1 #endif diff --git a/docshell/build/Makefile.in b/docshell/build/Makefile.in index 992fae8d7098..fdd9b8ef5b7f 100644 --- a/docshell/build/Makefile.in +++ b/docshell/build/Makefile.in @@ -115,6 +115,6 @@ ifdef MOZ_ENABLE_DBUS EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS) endif -ifdef MOZ_PLATFORM_HILDON -EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) +ifdef MOZ_PLATFORM_MAEMO +EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS) endif diff --git a/js/src/config/system-headers b/js/src/config/system-headers index 890ead5340bc..d695f52f1297 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -1009,12 +1009,10 @@ hunspell.hxx #if MOZ_NATIVE_BZ2==1 bzlib.h #endif -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) hildon-uri.h hildon-mime.h hildon-file-chooser-dialog.h -#endif -#ifdef NS_OSSO libosso.h osso-mem.h #endif diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index f1e97ef57537..dcee78aade22 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -173,7 +173,7 @@ enum { XKeyPress = KeyPress }; #undef KeyPress #endif -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) #define MOZ_COMPOSITED_PLUGINS 1 #include "gfxXlibSurface.h" @@ -416,7 +416,7 @@ public: return strncmp(GetPluginName(), aPluginName, strlen(aPluginName)) == 0; } -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) nsresult SetAbsoluteScreenPosition(nsIDOMElement* element, nsIDOMClientRect* position, nsIDOMClientRect* clip); @@ -511,7 +511,7 @@ private: }; #endif -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) // On hildon, we attempt to use NPImageExpose which allows us faster // painting. @@ -1225,7 +1225,7 @@ nsObjectFrame::SetAbsoluteScreenPosition(nsIDOMElement* element, nsIDOMClientRect* position, nsIDOMClientRect* clip) { -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) if (!mInstanceOwner) return NS_ERROR_NOT_AVAILABLE; return mInstanceOwner->SetAbsoluteScreenPosition(element, position, clip); @@ -2137,7 +2137,7 @@ GetMIMEType(nsIPluginInstance *aPluginInstance) static PRBool DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop) { -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO==5) // Don't delay stop on Maemo/Hildon (bug 530739). if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash")) return PR_FALSE; @@ -2455,7 +2455,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner() mLastPoint = nsIntPoint(0,0); #endif -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) mPluginSize = nsIntSize(0,0); mXlibSurfGC = None; mBlitWindow = nsnull; @@ -2525,7 +2525,7 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() mInstance->InvalidateOwner(); } -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) ReleaseXShm(); #endif } @@ -2737,7 +2737,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect) if (!mObjectFrame || !invalidRect || !mWidgetVisible) return NS_ERROR_FAILURE; -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) PRBool simpleImageRender = PR_FALSE; mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool, &simpleImageRender); @@ -4871,7 +4871,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext, if (!mInstance || !mObjectFrame) return; -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) // through to be able to paint the context passed in. This allows // us to handle plugins that do not self invalidate (slowly, but // accurately), and it allows us to reduce flicker. @@ -4960,7 +4960,7 @@ DepthOfVisual(const Screen* screen, const Visual* visual) } #endif -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) static GdkWindow* GetClosestWindow(nsIDOMElement *element) { @@ -5651,7 +5651,7 @@ void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost) mPluginHost = aHost; } -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) PRBool nsPluginInstanceOwner::UpdateVisibility(PRBool aVisible) { // NOTE: Death grip must be held by caller. @@ -5815,7 +5815,7 @@ void nsPluginInstanceOwner::FixUpURLS(const nsString &name, nsAString &value) } } -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) nsresult nsPluginInstanceOwner::SetAbsoluteScreenPosition(nsIDOMElement* element, nsIDOMClientRect* position, diff --git a/modules/plugin/base/public/npapi.h b/modules/plugin/base/public/npapi.h index b8e943d54eb8..9622b7a9fc04 100644 --- a/modules/plugin/base/public/npapi.h +++ b/modules/plugin/base/public/npapi.h @@ -338,7 +338,7 @@ typedef enum { , NPPVpluginEventModel = 1001 #endif -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) , NPPVpluginWindowlessLocalBool = 2002 #endif } NPPVariable; @@ -383,7 +383,7 @@ typedef enum { #endif , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ #endif -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) , NPNVSupportsWindowlessLocal = 2002 #endif } NPNVariable; diff --git a/modules/plugin/base/public/nsPluginNativeWindow.h b/modules/plugin/base/public/nsPluginNativeWindow.h index f85c9a00f239..c4e8e55059ce 100644 --- a/modules/plugin/base/public/nsPluginNativeWindow.h +++ b/modules/plugin/base/public/nsPluginNativeWindow.h @@ -103,7 +103,7 @@ public: SetPluginInstance(aPluginInstance); return NS_OK; } -#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2) +#if (MOZ_PLATFORM_MAEMO == 5) #define MOZ_COMPOSITED_PLUGINS #endif #ifdef MOZ_COMPOSITED_PLUGINS diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index 1133a769467e..0e442982037d 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -2139,7 +2139,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) return NPERR_GENERIC_ERROR; } -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) case NPNVSupportsWindowlessLocal: { *(NPBool*)result = PR_TRUE; return NPERR_NO_ERROR; @@ -2277,7 +2277,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result) return inst->SetWindowless(bWindowless); #endif } -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) case NPPVpluginWindowlessLocalBool: { NPBool bWindowlessLocal = (result != nsnull); return inst->SetWindowlessLocal(bWindowlessLocal); diff --git a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp index 32cfbf86ba11..b2110eb5b41d 100644 --- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp +++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp @@ -1392,7 +1392,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRBool* handled) NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value) { -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) // The maemo flash plugin does not remember this. It sets the // value, but doesn't support the get value. if (variable == NPPVpluginWindowlessLocalBool) { diff --git a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp index a86366a6fc82..a6fa4d66d0dc 100644 --- a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp +++ b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp @@ -49,7 +49,7 @@ #include #include -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) #define MOZ_COMPOSITED_PLUGINS #endif diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp index 7f6c4b0d01af..cbce17f3d3f3 100644 --- a/toolkit/components/downloads/src/nsDownloadManager.cpp +++ b/toolkit/components/downloads/src/nsDownloadManager.cpp @@ -1170,7 +1170,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) } } #elif defined(XP_UNIX) -#if defined(NS_OSSO) +#if defined(MOZ_PLATFORM_MAEMO) // As maemo does not follow the XDG "standard" (as usually desktop // Linux distros do) neither has a working $HOME/Desktop folder // for us to fallback into, "$HOME/MyDocs/.documents/" is the folder diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 3b00293b9083..07f08ac5ba5f 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -197,18 +197,14 @@ EXTRA_DSO_LDOPTS += \ endif endif -ifdef MOZ_PLATFORM_HILDON -EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) $(LIBHILDONFM_LIBS) +ifdef MOZ_PLATFORM_MAEMO +EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS) endif ifdef MOZ_ENABLE_LIBCONIC EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS) endif -ifdef NS_OSSO -EXTRA_DSO_LDOPTS += $(LIBOSSO_LIBS) -endif - ifdef MOZ_ENABLE_DBUS EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS) endif diff --git a/toolkit/xre/nsNativeAppSupportUnix.cpp b/toolkit/xre/nsNativeAppSupportUnix.cpp index 1afaa8f4315a..e21667e4381d 100644 --- a/toolkit/xre/nsNativeAppSupportUnix.cpp +++ b/toolkit/xre/nsNativeAppSupportUnix.cpp @@ -59,7 +59,7 @@ #include #include -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO struct DBusMessage; /* libosso.h references internals of dbus */ #include @@ -157,7 +157,7 @@ public: NS_IMETHOD Stop(PRBool *aResult); private: -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO osso_context_t *m_osso_context; /* A note about why we need to have m_hw_state: the osso hardware callback does not tell us what changed, just @@ -168,7 +168,7 @@ private: #endif }; -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO static void OssoDisplayCallback(osso_display_state_t state, gpointer data) { @@ -309,7 +309,7 @@ nsNativeAppSupportUnix::Start(PRBool *aRetVal) exit(0); } -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO /* zero state out. */ memset(&m_hw_state, 0, sizeof(osso_hw_state_t)); @@ -454,7 +454,7 @@ nsNativeAppSupportUnix::Stop(PRBool *aResult) NS_ENSURE_ARG(aResult); *aResult = PR_TRUE; -#ifdef NS_OSSO +#ifdef MOZ_PLATFORM_MAEMO if (m_osso_context) { osso_hw_unset_event_cb(m_osso_context, nsnull); osso_rpc_unset_default_cb_f(m_osso_context, OssoDbusCallback, nsnull); diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in index 05667cb91754..f0afdce60f2f 100644 --- a/uriloader/exthandler/Makefile.in +++ b/uriloader/exthandler/Makefile.in @@ -135,7 +135,7 @@ LOCAL_INCLUDES += $(TK_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS) EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS) endif -ifdef MOZ_PLATFORM_HILDON +ifdef MOZ_PLATFORM_MAEMO ifdef MOZ_ENABLE_GNOMEVFS LOCAL_INCLUDES += $(MOZ_GNOMEVFS_CFLAGS) EXTRA_DSO_LDOPTS += $(MOZ_GNOMEVFS_LIBS) diff --git a/uriloader/exthandler/nsDBusHandlerApp.cpp b/uriloader/exthandler/nsDBusHandlerApp.cpp index bac95802750d..a06d49288473 100644 --- a/uriloader/exthandler/nsDBusHandlerApp.cpp +++ b/uriloader/exthandler/nsDBusHandlerApp.cpp @@ -44,7 +44,7 @@ #include "nsIClassInfoImpl.h" #include "nsCOMPtr.h" -#ifdef NS_OSSO +#if (MOZ_PLATFORM_MAEMO == 5) #include #define APP_LAUNCH_BANNER_SERVICE "com.nokia.hildon-desktop" @@ -157,7 +157,7 @@ nsDBusHandlerApp::LaunchWithURI(nsIURI *aURI, if (dbus_connection_send(connection, msg, NULL)) { dbus_connection_flush(connection); dbus_message_unref(msg); -#ifdef NS_OSSO +#if (MOZ_PLATFORM_MAEMO == 5) msg = dbus_message_new_method_call (APP_LAUNCH_BANNER_SERVICE, APP_LAUNCH_BANNER_METHOD_PATH, APP_LAUNCH_BANNER_METHOD_INTERFACE, diff --git a/uriloader/exthandler/unix/nsGNOMERegistry.cpp b/uriloader/exthandler/unix/nsGNOMERegistry.cpp index 509b153298ab..560b6347e2bf 100644 --- a/uriloader/exthandler/unix/nsGNOMERegistry.cpp +++ b/uriloader/exthandler/unix/nsGNOMERegistry.cpp @@ -53,7 +53,7 @@ #include #endif -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO #include #endif @@ -192,7 +192,7 @@ nsGNOMERegistry::GetFromType(const nsACString& aMIMEType) else gnomeHandlerApp->GetName(name); -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO // On Maemo/Hildon, GetName ends up calling gnome_vfs_mime_application_get_name, // which happens to return a non-localized message-id for the application. To // get the localized name for the application, we have to call dgettext with diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp index ddbffba415fc..bfe53c367a06 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp @@ -37,7 +37,7 @@ * * ***** END LICENSE BLOCK ***** */ -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) #include #include #include @@ -57,7 +57,7 @@ nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI) { nsresult rv = nsGNOMERegistry::LoadURL(aURI); -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) if (NS_FAILED(rv)){ HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull); if (action) { @@ -90,7 +90,7 @@ nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) if (*_retval) return NS_OK; -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull); if (action) { *_retval = PR_TRUE; @@ -109,7 +109,7 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile) nsCAutoString nativePath; aFile->GetNativePath(nativePath); -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) if(NS_SUCCEEDED(LaunchDefaultWithDBus(PromiseFlatCString(nativePath).get()))) return NS_OK; #endif @@ -150,7 +150,7 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile) return LaunchWithIProcess(mDefaultApplication, nativePath); } -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) /* This method tries to launch the associated default handler for the given * mime/file via hildon specific APIs (in this case hildon_mime_open_file* diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.h b/uriloader/exthandler/unix/nsMIMEInfoUnix.h index 64c7cace1b05..f05ae505cc54 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.h +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.h @@ -57,7 +57,7 @@ protected: virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI); virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile *aFile); -#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS) +#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) nsresult LaunchDefaultWithDBus(const char *aFilePath); NS_IMETHOD GetPossibleApplicationHandlers(nsIMutableArray * *aPossibleAppHandlers); #endif diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 28cd5d23805c..f4fc700bc586 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -1211,7 +1211,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch #ifdef MOZ_WIDGET_GTK2 // Check the GConf registry for a protocol handler *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme); -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme); #endif #endif diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in index 5996582a3b88..2f992561844e 100644 --- a/widget/src/gtk2/Makefile.in +++ b/widget/src/gtk2/Makefile.in @@ -118,7 +118,7 @@ EXTRA_DSO_LDOPTS += \ $(QCMS_LIBS) \ $(NULL) -ifdef MOZ_PLATFORM_HILDON +ifdef MOZ_PLATFORM_MAEMO ifdef MOZ_ENABLE_GCONF EXTRA_DSO_LDOPTS += $(MOZ_GCONF_LIBS) endif @@ -145,7 +145,7 @@ include $(topsrcdir)/config/rules.mk CFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS) CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS) -ifdef MOZ_PLATFORM_HILDON +ifdef MOZ_PLATFORM_MAEMO ifdef MOZ_ENABLE_GCONF CXXFLAGS += $(MOZ_GCONF_CFLAGS) endif diff --git a/widget/src/gtk2/mozcontainer.h b/widget/src/gtk2/mozcontainer.h index d09bd2822323..7da70aaa52f4 100644 --- a/widget/src/gtk2/mozcontainer.h +++ b/widget/src/gtk2/mozcontainer.h @@ -84,7 +84,7 @@ extern "C" { #define MOZ_CONAINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass)) #if (GTK_CHECK_VERSION(2, 12, 0) || \ - (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON))) + (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_MAEMO))) #define HAVE_GTK_MOTION_HINTS #endif diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp index b3c97315f763..73e27724415d 100644 --- a/widget/src/gtk2/nsFilePicker.cpp +++ b/widget/src/gtk2/nsFilePicker.cpp @@ -56,7 +56,7 @@ #include "nsFilePicker.h" #include "nsAccessibilityHelper.h" -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO #include #endif @@ -433,7 +433,7 @@ nsFilePicker::Show(PRInt16 *aReturn) GtkFileChooserAction action = GetGtkFileChooserAction(mMode); const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE) ? GTK_STOCK_SAVE : GTK_STOCK_OPEN; -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO GtkWidget *file_chooser = hildon_file_chooser_dialog_new_with_properties(parent_widget, "action", action, diff --git a/widget/src/gtk2/nsLookAndFeel.cpp b/widget/src/gtk2/nsLookAndFeel.cpp index 1c92cc9b7142..ddd32deefb6d 100644 --- a/widget/src/gtk2/nsLookAndFeel.cpp +++ b/widget/src/gtk2/nsLookAndFeel.cpp @@ -43,7 +43,7 @@ #include "gtkdrawing.h" -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO #include "nsIServiceManager.h" #include "nsIPropertyBag2.h" #include "nsLiteralString.h" @@ -582,7 +582,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) res = NS_ERROR_NOT_IMPLEMENTED; break; case eMetric_TouchEnabled: -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO // All Hildon devices are touch-enabled aMetric = 1; #else @@ -591,7 +591,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) #endif break; case eMetric_MaemoClassic: -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO { aMetric = 0; nsCOMPtr infoService(do_GetService("@mozilla.org/system-info;1")); diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp index 7c9509eefea0..25060b496959 100644 --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -38,7 +38,7 @@ * * ***** END LICENSE BLOCK ***** */ -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO #define MAEMO_CHANGES #endif @@ -305,7 +305,7 @@ static GdkEventKey *gKeyEvent = NULL; static PRBool gKeyEventCommitted = PR_FALSE; static PRBool gKeyEventChanged = PR_FALSE; static PRBool gIMESuppressCommit = PR_FALSE; -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO static PRBool gIMEVirtualKeyboardOpened = PR_FALSE; #endif @@ -3500,7 +3500,7 @@ nsWindow::OnVisibilityNotifyEvent(GtkWidget *aWidget, mIsFullyObscured = PR_FALSE; -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO #ifdef USE_XIM // In Hildon/Maemo, a browser window will get into 'patially visible' state wheneven an // autocomplete feature is dropped down (from urlbar or from an entry form completion), @@ -3510,7 +3510,7 @@ nsWindow::OnVisibilityNotifyEvent(GtkWidget *aWidget, // to this it until the pointer is ungrabbed. if(!gIMEVirtualKeyboardOpened) #endif // USE_XIM -#endif // MOZ_PLATFORM_HILDON +#endif // MOZ_PLATFORM_MAEMO // if we have to retry the grab, retry it. EnsureGrabs(); break; @@ -6853,7 +6853,7 @@ nsWindow::IMEGetContext() static PRBool IsIMEEnabledState(PRUint32 aState) { -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO return aState == nsIWidget::IME_STATUS_ENABLED || aState == nsIWidget::IME_STATUS_PLUGIN || aState == nsIWidget::IME_STATUS_PASSWORD; @@ -7061,7 +7061,7 @@ nsWindow::SetIMEEnabled(PRUint32 aState) // Even when aState is not PR_TRUE, we need to set IME focus. // Because some IMs are updating the status bar of them in this time. focusedWin->IMESetFocus(); -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO if (mIMEData->mEnabled) { // It is not desired that the hildon's autocomplete mechanism displays // user previous entered passwds, so lets make completions invisible @@ -7437,7 +7437,7 @@ IM_get_input_context(nsWindow *aWindow) data->mEnabled == nsIWidget::IME_STATUS_PLUGIN) return data->mContext; if (data->mEnabled == nsIWidget::IME_STATUS_PASSWORD) -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO return data->mContext; #else return data->mSimpleContext; diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 18df3396b3fe..785fdee9e1cf 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -57,7 +57,7 @@ #include #endif -#if defined (NS_OSSO) +#if defined(MOZ_PLATFORM_MAEMO) #include #include #include @@ -128,7 +128,7 @@ nsMemoryImpl::IsLowMemory(PRBool *result) GlobalMemoryStatusEx(&stat); *result = (stat.ullAvailPageFile < kRequiredMemory) && ((float)stat.ullAvailPageFile / stat.ullTotalPageFile) < 0.1; -#elif defined(NS_OSSO) +#elif defined(MOZ_PLATFORM_MAEMO) static int osso_highmark_fd = -1; if (osso_highmark_fd == -1) { osso_highmark_fd = open (kHighMark, O_RDONLY); diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 122767cf80e0..8c4afa6e8c05 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -100,7 +100,7 @@ nsSystemInfo::Init() #endif -#ifdef MOZ_PLATFORM_HILDON +#ifdef MOZ_PLATFORM_MAEMO char * line = nsnull; size_t len = 0; ssize_t read; diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in index be26a290fb27..e4438ba0ed2a 100644 --- a/xpcom/build/Makefile.in +++ b/xpcom/build/Makefile.in @@ -170,8 +170,8 @@ endif ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT))) EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) -ifdef MOZ_PLATFORM_HILDON -EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) +ifdef MOZ_PLATFORM_MAEMO +EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS) endif endif diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in index bf35c09a4977..f6f05e6fcdc5 100644 --- a/xpcom/io/Makefile.in +++ b/xpcom/io/Makefile.in @@ -199,8 +199,8 @@ endif LOCAL_INCLUDES = -I.. -ifdef MOZ_PLATFORM_HILDON -CFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) $(LIBHILDONMIME_CFLAGS) -CXXFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) $(LIBHILDONMIME_CFLAGS) +ifeq ($(MOZ_PLATFORM_MAEMO), 5) +CFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS) +CXXFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS) endif diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 59ed01d3e1a0..0c29bcfca695 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -490,7 +490,7 @@ GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory, rv = file->AppendNative(NS_LITERAL_CSTRING("Desktop")); } -#if defined(NS_OSSO) +#if defined(MOZ_PLATFORM_MAEMO) // "MYDOCSDIR" is exported to point to "/home/user/MyDocs" in maemo. else if (Unix_XDG_Documents == aSystemDirectory) { diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index ea8a048c4854..9cc30b1c4c24 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -92,7 +92,7 @@ #include "nsIGnomeVFSService.h" #endif -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO == 5) #include #include #include @@ -1746,7 +1746,7 @@ NS_IMETHODIMP nsLocalFile::Launch() { #ifdef MOZ_WIDGET_GTK2 -#ifdef MOZ_PLATFORM_HILDON +#if (MOZ_PLATFORM_MAEMO==5) const PRInt32 kHILDON_SUCCESS = 1; DBusError err; dbus_error_init(&err); From 6c65d9c0c9b792e3ec182c6f3e26f069349c3189 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2010 14:33:19 -0500 Subject: [PATCH 10/31] Backed out changeset df90f0171ba7 (bug 543111) --HG-- extra : rebase_source : 35dfbceff1bec0fda34c652723b5ef4b5d7edfdd --- toolkit/crashreporter/Makefile.in | 9 +-------- .../google-breakpad/src/common/dwarf/functioninfo.cc | 3 --- .../google-breakpad/src/common/mac/Makefile.in | 2 -- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 64559bd433d3..9ba5c2e580bb 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -61,19 +61,12 @@ endif ifeq ($(OS_ARCH),Darwin) CMMSRCS = mac_utils.mm -# Check both OS_ARCH (needed to be able to run it afterward) and -# HOST_OS_ARCH (needed because it refuses to cross-compile). -ifeq ($(HOST_OS_ARCH),Darwin) -DIRS += \ - google-breakpad/src/tools/mac/dump_syms \ - $(NULL) -endif - DIRS += \ google-breakpad/src/common \ google-breakpad/src/common/mac \ google-breakpad/src/client \ google-breakpad/src/client/mac/handler \ + google-breakpad/src/tools/mac/dump_syms \ $(NULL) endif diff --git a/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc b/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc index 8b3056e2daba..1957153e92f7 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc +++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf/functioninfo.cc @@ -34,9 +34,6 @@ #include #include #include -#include -#include -#include #include "common/dwarf/functioninfo.h" diff --git a/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in index eda5680186b3..c0bdbccc3438 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in +++ b/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in @@ -62,13 +62,11 @@ CMSRCS = \ HTTPMultipartUpload.m \ $(NULL) -ifeq ($(HOST_OS_ARCH),Darwin) HOST_CPPSRCS = $(CPPSRCS) HOST_CMMSRCS = \ dump_syms.mm \ $(NULL) -endif # need static lib FORCE_STATIC_LIB = 1 From 1ba8851c67f9ea559696b0072cf2fffeb8c3922a Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Mon, 8 Feb 2010 23:13:12 -0500 Subject: [PATCH 11/31] Bug 544697. pixman: Reenable NEON support. r=vlad,bsmedberg 3f91dcac71c4 turned off NEON because of build breakage. This turns it back on. We also need to add a SSRCS target so that .S files get built with gcc. --- config/rules.mk | 1 + gfx/cairo/libpixman/src/Makefile.in | 4 ++-- gfx/cairo/libpixman/src/pixman-arm-neon-asm.S | 12 ++++++------ js/src/config/rules.mk | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config/rules.mk b/config/rules.mk index 002650776f61..c6b6d742af41 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -380,6 +380,7 @@ _OBJS = \ $(JRI_STUB_CFILES) \ $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \ $(CSRCS:.c=.$(OBJ_SUFFIX)) \ + $(SSRCS:.S=.$(OBJ_SUFFIX)) \ $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \ $(CMSRCS:.m=.$(OBJ_SUFFIX)) \ $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \ diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index 86a0585ea5a7..925c494ddf71 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -92,8 +92,7 @@ ifdef HAVE_ARM_SIMD USE_ARM_SIMD_GCC=1 endif ifdef HAVE_ARM_NEON -# temporarily disabled to see if it fixes odd mobile build breakage -#USE_ARM_NEON_GCC=1 +USE_ARM_NEON_GCC=1 endif endif @@ -148,6 +147,7 @@ endif ifdef USE_ARM_NEON_GCC CSRCS += pixman-arm-neon.c +SSRCS += pixman-arm-neon-asm.S DEFINES += -DUSE_ARM_NEON ARM_NEON_CFLAGS = -mfloat-abi=softfp -mfpu=neon endif diff --git a/gfx/cairo/libpixman/src/pixman-arm-neon-asm.S b/gfx/cairo/libpixman/src/pixman-arm-neon-asm.S index 29868844235e..40c8ec4a9603 100644 --- a/gfx/cairo/libpixman/src/pixman-arm-neon-asm.S +++ b/gfx/cairo/libpixman/src/pixman-arm-neon-asm.S @@ -817,8 +817,8 @@ generate_composite_function \ vsli.u64 d0, d0, #8 vsli.u64 d0, d0, #16 vsli.u64 d0, d0, #32 - vmov d1, d0 - vmov q1, q0 + vorr d1, d0, d0 + vorr q1, q0, q0 .endm .macro pixman_composite_src_n_8_cleanup @@ -856,8 +856,8 @@ generate_composite_function \ vld1.32 {d0[0]}, [DUMMY] vsli.u64 d0, d0, #16 vsli.u64 d0, d0, #32 - vmov d1, d0 - vmov q1, q0 + vorr d1, d0, d0 + vorr q1, q0, q0 .endm .macro pixman_composite_src_n_0565_cleanup @@ -894,8 +894,8 @@ generate_composite_function \ add DUMMY, sp, #ARGS_STACK_OFFSET vld1.32 {d0[0]}, [DUMMY] vsli.u64 d0, d0, #32 - vmov d1, d0 - vmov q1, q0 + vorr d1, d0, d0 + vorr q1, q0, q0 .endm .macro pixman_composite_src_n_8888_cleanup diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 002650776f61..c6b6d742af41 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -380,6 +380,7 @@ _OBJS = \ $(JRI_STUB_CFILES) \ $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \ $(CSRCS:.c=.$(OBJ_SUFFIX)) \ + $(SSRCS:.S=.$(OBJ_SUFFIX)) \ $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \ $(CMSRCS:.m=.$(OBJ_SUFFIX)) \ $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \ From 10b31fba6c3e3373039358d6bb8febbf31d5dbaa Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 9 Feb 2010 13:07:16 -0800 Subject: [PATCH 12/31] Bug 542974 - Make the cookie parser's handling of " characters more like IE. r=dwitte --- netwerk/cookie/src/nsCookieService.cpp | 61 ++++++++------------------ netwerk/test/TestCookie.cpp | 38 +++++++++------- 2 files changed, 40 insertions(+), 59 deletions(-) diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp index 9492be6fba3b..83e95977c5b4 100644 --- a/netwerk/cookie/src/nsCookieService.cpp +++ b/netwerk/cookie/src/nsCookieService.cpp @@ -1727,11 +1727,7 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain, ** Begin BNF: token = 1* - value = token-value | quoted-string - token-value = 1* - quoted-string = ( <"> *( qdtext | quoted-pair ) <"> ) - qdtext = > ; CR | LF removed by necko - quoted-pair = "\" ; CR | LF removed by necko + value = 1* separators = ";" | "=" value-sep = ";" cookie-sep = CR | LF @@ -1766,7 +1762,6 @@ nsCookieService::AddInternal(const nsCString &aBaseDomain, // helper functions for GetTokenValue static inline PRBool iswhitespace (char c) { return c == ' ' || c == '\t'; } static inline PRBool isterminator (char c) { return c == '\n' || c == '\r'; } -static inline PRBool isquoteterminator(char c) { return isterminator(c) || c == '"'; } static inline PRBool isvalueseparator (char c) { return isterminator(c) || c == ';'; } static inline PRBool istokenseparator (char c) { return isvalueseparator(c) || c == '='; } @@ -1806,39 +1801,16 @@ nsCookieService::GetTokenValue(nsASingleFragmentCString::const_char_iterator &aI start = aIter; - if (*aIter == '"') { - // process - // (note: cookie terminators, CR | LF, can't happen: - // they're removed by necko before the header gets here) - // assume value mangled if no terminating '"', return - while (++aIter != aEndIter && !isquoteterminator(*aIter)) { - // if (backwhacked char), skip over it. this allows '\"' in . - // we increment once over the backwhack, nullcheck, then continue to the 'while', - // which increments over the backwhacked char. one exception - we don't allow - // CR | LF here either (see above about necko) - if (*aIter == '\\' && (++aIter == aEndIter || isterminator(*aIter))) - break; - } + // process + // just look for ';' to terminate ('=' allowed) + while (aIter != aEndIter && !isvalueseparator(*aIter)) + ++aIter; - if (aIter != aEndIter && !isterminator(*aIter)) { - // include terminating quote in attribute string - aTokenValue.Rebind(start, ++aIter); - // skip to next ';' - while (aIter != aEndIter && !isvalueseparator(*aIter)) - ++aIter; - } - } else { - // process - // just look for ';' to terminate ('=' allowed) - while (aIter != aEndIter && !isvalueseparator(*aIter)) - ++aIter; - - // remove trailing ; first check we're not at the beginning - if (aIter != start) { - lastSpace = aIter; - while (--lastSpace != start && iswhitespace(*lastSpace)); - aTokenValue.Rebind(start, ++lastSpace); - } + // remove trailing ; first check we're not at the beginning + if (aIter != start) { + lastSpace = aIter; + while (--lastSpace != start && iswhitespace(*lastSpace)); + aTokenValue.Rebind(start, ++lastSpace); } } @@ -1900,10 +1872,6 @@ nsCookieService::ParseAttributes(nsDependentCString &aCookieHeader, if (!tokenValue.IsEmpty()) { tokenValue.BeginReading(tempBegin); tokenValue.EndReading(tempEnd); - if (*tempBegin == '"' && *--tempEnd == '"') { - // our parameter is a quoted-string; remove quotes for later parsing - tokenValue.Rebind(++tempBegin, tempEnd); - } } // decide which attribute we have, and copy the string @@ -2272,8 +2240,15 @@ nsCookieService::GetExpiry(nsCookieAttributes &aCookieAttributes, PRTime tempExpires; PRInt64 expires; + // For Expires, we trim leading and trailing " characters to maximize + // the compatibility of our date parsing. In principle, this processsing + // should be done in our date parser. + nsCString& expiresAttr = aCookieAttributes.expires; + if (!expiresAttr.IsEmpty() && expiresAttr.First() == '"' && expiresAttr.Last() == '"') + expiresAttr = Substring(expiresAttr.BeginReading() + 1, expiresAttr.EndReading() - 1); + // parse expiry time - if (PR_ParseTimeString(aCookieAttributes.expires.get(), PR_TRUE, &tempExpires) == PR_SUCCESS) { + if (PR_ParseTimeString(expiresAttr.get(), PR_TRUE, &tempExpires) == PR_SUCCESS) { expires = tempExpires / PR_USEC_PER_SEC; } else { return PR_TRUE; diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index f16438f66b75..8f9cee0de81f 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -462,39 +462,45 @@ main(PRInt32 argc, char *argv[]) SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=Thu, 10 Apr 1980 16:33:12 GMT", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[2] = CheckResult(cookie.get(), MUST_BE_NULL); - - SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=60", nsnull); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[3] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); - SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=-20", nsnull); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT\"", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[4] = CheckResult(cookie.get(), MUST_BE_NULL); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=60", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[5] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); - SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=Thu, 10 Apr 1980 16:33:12 GMT", nsnull); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=-20", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[6] = CheckResult(cookie.get(), MUST_BE_NULL); SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=60", nsnull); + GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); + rv[7] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=Thu, 10 Apr 1980 16:33:12 GMT", nsnull); + GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); + rv[8] = CheckResult(cookie.get(), MUST_BE_NULL); + SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; max-age=60", nsnull); SetACookie(cookieService, "http://expireme.org/", nsnull, "newtest=expiry; max-age=60", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); - rv[7] = CheckResult(cookie.get(), MUST_CONTAIN, "test=expiry"); - rv[8] = CheckResult(cookie.get(), MUST_CONTAIN, "newtest=expiry"); + rv[9] = CheckResult(cookie.get(), MUST_CONTAIN, "test=expiry"); + rv[10] = CheckResult(cookie.get(), MUST_CONTAIN, "newtest=expiry"); SetACookie(cookieService, "http://expireme.org/", nsnull, "test=differentvalue; max-age=0", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); - rv[9] = CheckResult(cookie.get(), MUST_EQUAL, "newtest=expiry"); + rv[11] = CheckResult(cookie.get(), MUST_EQUAL, "newtest=expiry"); SetACookie(cookieService, "http://expireme.org/", nsnull, "newtest=evendifferentvalue; max-age=0", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); - rv[10] = CheckResult(cookie.get(), MUST_BE_NULL); - - SetACookie(cookieService, "http://foo.expireme.org/", nsnull, "test=expiry; domain=.expireme.org; max-age=60", nsnull); - GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); - rv[11] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); - SetACookie(cookieService, "http://bar.expireme.org/", nsnull, "test=differentvalue; domain=.expireme.org; max-age=0", nsnull); - GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[12] = CheckResult(cookie.get(), MUST_BE_NULL); - allTestsPassed = PrintResult(rv, 13) && allTestsPassed; + SetACookie(cookieService, "http://foo.expireme.org/", nsnull, "test=expiry; domain=.expireme.org; max-age=60", nsnull); + GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); + rv[13] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); + SetACookie(cookieService, "http://bar.expireme.org/", nsnull, "test=differentvalue; domain=.expireme.org; max-age=0", nsnull); + GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); + rv[14] = CheckResult(cookie.get(), MUST_BE_NULL); + + allTestsPassed = PrintResult(rv, 15) && allTestsPassed; // *** multiple cookie tests @@ -535,7 +541,7 @@ main(PRInt32 argc, char *argv[]) rv[1] = CheckResult(cookie.get(), MUST_BE_NULL); SetACookie(cookieService, "http://parser.test/", nsnull, "test=\"fubar! = foo;bar\\\";\" parser; domain=.parser.test; max-age=6\nfive; max-age=2.63,", nsnull); GetACookie(cookieService, "http://parser.test/", nsnull, getter_Copies(cookie)); - rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, "test=\"fubar! = foo;bar\\\";\""); + rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, "test=\"fubar! = foo"); rv[3] = CheckResult(cookie.get(), MUST_CONTAIN, "five"); SetACookie(cookieService, "http://parser.test/", nsnull, "test=kill; domain=.parser.test; max-age=0 \n five; max-age=0", nsnull); GetACookie(cookieService, "http://parser.test/", nsnull, getter_Copies(cookie)); From 0eb8344d99bec343eb9d5a2a168868860ed72303 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Fri, 5 Feb 2010 10:21:37 -0800 Subject: [PATCH 13/31] Bug 542391: No prompt to update extensions when upgrading to Firefox 3.6. r=robstrong --- .../mozapps/extensions/nsExtensionManager.js | 17 +- .../test/addons/test_bug542391_1/install.rdf | 22 ++ .../test/addons/test_bug542391_2/install.rdf | 22 ++ .../test/addons/test_bug542391_3/install.rdf | 22 ++ .../test/addons/test_bug542391_4/install.rdf | 22 ++ .../test/addons/test_bug542391_5/install.rdf | 22 ++ .../test/unit/head_extensionmanager.js | 51 ++-- .../extensions/test/unit/test_bug542391.js | 271 ++++++++++++++++++ 8 files changed, 426 insertions(+), 23 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug542391_1/install.rdf create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug542391_2/install.rdf create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug542391_3/install.rdf create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug542391_4/install.rdf create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug542391_5/install.rdf create mode 100644 toolkit/mozapps/extensions/test/unit/test_bug542391.js diff --git a/toolkit/mozapps/extensions/nsExtensionManager.js b/toolkit/mozapps/extensions/nsExtensionManager.js index 25e7f532e733..0702537d85e5 100644 --- a/toolkit/mozapps/extensions/nsExtensionManager.js +++ b/toolkit/mozapps/extensions/nsExtensionManager.js @@ -2506,6 +2506,9 @@ ExtensionManager.prototype = { ERROR("Error flushing caches: " + e); } + // Reset the first run flag. + gFirstRun = false; + return needsRestart; }, @@ -3179,6 +3182,7 @@ ExtensionManager.prototype = { var ds = this.datasource; var inactiveItemIDs = []; + var appEnabledItemIDs = []; var ctr = getContainer(ds, ds._itemRoot); var elements = ctr.GetElements(); while (elements.hasMoreElements()) { @@ -3189,6 +3193,8 @@ ExtensionManager.prototype = { if (appDisabled == "true" || appDisabled == OP_NEEDS_DISABLE || userDisabled == "true" || userDisabled == OP_NEEDS_DISABLE) inactiveItemIDs.push(id); + if (appDisabled != "true" && appDisabled != OP_NEEDS_DISABLE) + appEnabledItemIDs.push(id); } if (isDirty) @@ -3259,9 +3265,12 @@ ExtensionManager.prototype = { if (ds.getItemProperty(id, "appDisabled")) properties.appDisabled = null; } - else if (!ds.getItemProperty(id, "appDisabled")) { - properties.appDisabled = EM_L("true"); - disabledAddons.push(id); + else { + if (!ds.getItemProperty(id, "appDisabled")) + properties.appDisabled = EM_L("true"); + // If this item used to be app enabled then the upgrade has made it incompatible + if (appEnabledItemIDs.indexOf(id) >= 0) + disabledAddons.push(id); } ds.setItemProperties(id, properties); @@ -3301,7 +3310,7 @@ ExtensionManager.prototype = { // Determine if we should check for compatibility updates when upgrading if // we have add-ons that aren't managed by the application. - if (!allAppManaged && !gFirstRun && disabledAddons.length > 0) { + if (!allAppManaged && !gFirstRun) { // Should we show a UI or just pass the list via a pref? if (getPref("getBoolPref", PREF_EM_SHOW_MISMATCH_UI, true)) { this._showMismatchWindow(inactiveItemIDs); diff --git a/toolkit/mozapps/extensions/test/addons/test_bug542391_1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug542391_1/install.rdf new file mode 100644 index 000000000000..7e4d57952a79 --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug542391_1/install.rdf @@ -0,0 +1,22 @@ + + + + + + bug542391_1@tests.mozilla.org + 1.0 + + + + xpcshell@tests.mozilla.org + 1 + 1 + + + + + Bug 542391 Test 1 + + + diff --git a/toolkit/mozapps/extensions/test/addons/test_bug542391_2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug542391_2/install.rdf new file mode 100644 index 000000000000..df73fa932fdc --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug542391_2/install.rdf @@ -0,0 +1,22 @@ + + + + + + bug542391_2@tests.mozilla.org + 1.0 + + + + xpcshell@tests.mozilla.org + 1 + 2 + + + + + Bug 542391 Test 2 + + + diff --git a/toolkit/mozapps/extensions/test/addons/test_bug542391_3/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug542391_3/install.rdf new file mode 100644 index 000000000000..05cb23d4532b --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug542391_3/install.rdf @@ -0,0 +1,22 @@ + + + + + + bug542391_3@tests.mozilla.org + 1.0 + + + + xpcshell@tests.mozilla.org + 1 + 2 + + + + + Bug 542391 Test 3 + + + diff --git a/toolkit/mozapps/extensions/test/addons/test_bug542391_4/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug542391_4/install.rdf new file mode 100644 index 000000000000..e13f63eb369d --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug542391_4/install.rdf @@ -0,0 +1,22 @@ + + + + + + bug542391_4@tests.mozilla.org + 1.0 + + + + xpcshell@tests.mozilla.org + 1 + 3 + + + + + Bug 542391 Test 4 + + + diff --git a/toolkit/mozapps/extensions/test/addons/test_bug542391_5/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug542391_5/install.rdf new file mode 100644 index 000000000000..e4e587cf70a7 --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug542391_5/install.rdf @@ -0,0 +1,22 @@ + + + + + + bug542391_5@tests.mozilla.org + 1.0 + + + + xpcshell@tests.mozilla.org + 1 + 3 + + + + + Bug 542391 Test 5 + + + diff --git a/toolkit/mozapps/extensions/test/unit/head_extensionmanager.js b/toolkit/mozapps/extensions/test/unit/head_extensionmanager.js index d036fced27d3..8775f840ac1a 100644 --- a/toolkit/mozapps/extensions/test/unit/head_extensionmanager.js +++ b/toolkit/mozapps/extensions/test/unit/head_extensionmanager.js @@ -50,6 +50,7 @@ const NS_INSTALL_LOCATION_APPPROFILE = "app-profile"; const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1"; const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}"); +var gXULAppInfo = null; var gEM = null; var gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"] .getService(Components.interfaces.nsIRDFService); @@ -156,7 +157,7 @@ function do_get_addon(name) */ function createAppInfo(id, name, version, platformVersion) { - var XULAppInfo = { + gXULAppInfo = { vendor: "Mozilla", name: name, ID: id, @@ -184,7 +185,7 @@ function createAppInfo(id, name, version, platformVersion) createInstance: function (outer, iid) { if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION; - return XULAppInfo.QueryInterface(iid); + return gXULAppInfo.QueryInterface(iid); } }; var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar); @@ -192,6 +193,26 @@ function createAppInfo(id, name, version, platformVersion) XULAPPINFO_CONTRACTID, XULAppInfoFactory); } +function startEM(upgraded) { + var needsRestart = false; + if (upgraded) { + try { + needsRestart = gEM.checkForMismatches(); + } + catch (e) { + do_throw("checkForMismatches threw an exception: " + e + "\n"); + needsRestart = false; + upgraded = false; + } + } + + if (!upgraded || !needsRestart) + needsRestart = gEM.start(); + + if (needsRestart) + restartEM(); +} + /** * This simulates an application startup. Since we will be starting from an * empty profile we follow that path. @@ -206,19 +227,7 @@ function startupEM() // First run is a new profile which nsAppRunner would consider as an update // (no existing compatibility.ini) - var upgraded = true; - var needsRestart = false; - try { - needsRestart = gEM.checkForMismatches(); - } - catch (e) { - dump("checkForMismatches threw an exception: " + e + "\n"); - needsRestart = false; - upgraded = false; - } - - if (!upgraded || !needsRestart) - needsRestart = gEM.start(); + startEM(true); } /** @@ -235,11 +244,15 @@ function shutdownEM() * Many operations require restarts to take effect. This function should * perform all that is necessary for this to happen. */ -function restartEM() +function restartEM(newVersion) { - var needsRestart = gEM.start(); - if (needsRestart) - gEM.start(); + if (newVersion) { + gXULAppInfo.version = newVersion; + startEM(true); + } + else { + startEM(false); + } } var gDirSvc = Components.classes["@mozilla.org/file/directory_service;1"] diff --git a/toolkit/mozapps/extensions/test/unit/test_bug542391.js b/toolkit/mozapps/extensions/test/unit/test_bug542391.js new file mode 100644 index 000000000000..24727c495f14 --- /dev/null +++ b/toolkit/mozapps/extensions/test/unit/test_bug542391.js @@ -0,0 +1,271 @@ +/* ***** 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.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Corporation. + * + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dave Townsend + * + * 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 ***** + */ + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cr = Components.results; + +const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul"; +const PREF_EM_DISABLED_ADDONS_LIST = "extensions.disabledAddons"; +const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI"; + +// This will be called to show the blocklist message, we just make it look like +// it was dismissed. +var WindowWatcher = { + expected: false, + arguments: null, + + openWindow: function(parent, url, name, features, arguments) { + do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG); + do_check_true(this.expected); + this.expected = false; + this.arguments = arguments.QueryInterface(Ci.nsIVariant); + }, + + QueryInterface: function(iid) { + if (iid.equals(Ci.nsIWindowWatcher) + || iid.equals(Ci.nsISupports)) + return this; + + throw Cr.NS_ERROR_NO_INTERFACE; + } +} + +var WindowWatcherFactory = { + createInstance: function createInstance(outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return WindowWatcher.QueryInterface(iid); + } +}; + +var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar); +registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), + "Fake Window Watcher", + "@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory); + +function isDisabled(id) { + return getManifestProperty(id, "isDisabled") == "true"; +} + +function appDisabled(id) { + return getManifestProperty(id, "appDisabled") == "true"; +} + +function userDisabled(id) { + return getManifestProperty(id, "userDisabled") == "true"; +} + +function check_state_v1() { + do_check_neq(gEM.getItemForID("bug542391_1@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_1@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_1@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_2@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_2@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_2@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_3@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_3@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_3@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_4@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_4@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_4@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_5@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_5@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_5@tests.mozilla.org")); +} + +function check_state_v2() { + do_check_neq(gEM.getItemForID("bug542391_1@tests.mozilla.org"), null); + do_check_true(appDisabled("bug542391_1@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_1@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_2@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_2@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_2@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_3@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_3@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_3@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_4@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_4@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_4@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_5@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_5@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_5@tests.mozilla.org")); +} + +function check_state_v3() { + do_check_neq(gEM.getItemForID("bug542391_1@tests.mozilla.org"), null); + do_check_true(appDisabled("bug542391_1@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_1@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_2@tests.mozilla.org"), null); + do_check_true(appDisabled("bug542391_2@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_2@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_3@tests.mozilla.org"), null); + do_check_true(appDisabled("bug542391_3@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_3@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_4@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_4@tests.mozilla.org")); + do_check_true(userDisabled("bug542391_4@tests.mozilla.org")); + + do_check_neq(gEM.getItemForID("bug542391_5@tests.mozilla.org"), null); + do_check_false(appDisabled("bug542391_5@tests.mozilla.org")); + do_check_false(userDisabled("bug542391_5@tests.mozilla.org")); +} + +// Install all the test add-ons, disable two of them and "upgrade" the app to +// version 2 which will appDisable one. +function run_test() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); + + startupEM(); + + gEM.installItemFromFile(do_get_addon("test_bug542391_1"), + NS_INSTALL_LOCATION_APPPROFILE); + gEM.installItemFromFile(do_get_addon("test_bug542391_2"), + NS_INSTALL_LOCATION_APPPROFILE); + gEM.installItemFromFile(do_get_addon("test_bug542391_3"), + NS_INSTALL_LOCATION_APPPROFILE); + gEM.installItemFromFile(do_get_addon("test_bug542391_4"), + NS_INSTALL_LOCATION_APPPROFILE); + gEM.installItemFromFile(do_get_addon("test_bug542391_5"), + NS_INSTALL_LOCATION_APPPROFILE); + + restartEM(); + gEM.disableItem("bug542391_2@tests.mozilla.org"); + gEM.disableItem("bug542391_4@tests.mozilla.org"); + restartEM(); + + check_state_v1(); + + WindowWatcher.expected = true; + restartEM("2"); + do_check_false(WindowWatcher.expected); + check_state_v2(); + + run_test_1(); +} + +// Upgrade to version 3 which will appDisable two more add-ons. Check that the +// 3 already disabled add-ons were passed to the mismatch dialog. +function run_test_1() { + WindowWatcher.expected = true; + restartEM("3"); + do_check_false(WindowWatcher.expected); + check_state_v3(); + do_check_eq(WindowWatcher.arguments.length, 3); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0); + + run_test_2(); +} + +// Downgrade to version 2 which will remove appDisable from two add-ons and +// should pass all 4 previously disabled add-ons. +function run_test_2() { + WindowWatcher.expected = true; + restartEM("2"); + do_check_false(WindowWatcher.expected); + check_state_v2(); + do_check_eq(WindowWatcher.arguments.length, 4); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_3@tests.mozilla.org") >= 0); + do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0); + + run_test_4(); +} + +// Upgrade to version 3 which will appDisable two more add-ons. +function run_test_3() { + gPrefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, false); + + restartEM("3"); + check_state_v3(); + var disabled = []; + try { + gPrefs.getCharPref(PREF_EM_DISABLED_ADDONS_LIST).split(","); + } + catch (e) {} + do_check_eq(disabled.length, 2); + do_check_true(disabled.indexOf("bug542391_2@tests.mozilla.org") >= 0); + do_check_true(disabled.indexOf("bug542391_3@tests.mozilla.org") >= 0); + gPrefs.clearUserPref(PREF_EM_DISABLED_ADDONS_LIST); + + run_test_2(); +} + +// Downgrade to version 2 which will remove appDisable from two add-ons. +function run_test_4() { + restartEM("2"); + check_state_v2(); + var disabled = []; + try { + gPrefs.getCharPref(PREF_EM_DISABLED_ADDONS_LIST).split(","); + } + catch (e) {} + do_check_eq(disabled.length, 0); + + finish_test(); +} + +function finish_test() { + gEM.uninstallItem("bug542391_1@tests.mozilla.org"); + gEM.uninstallItem("bug542391_2@tests.mozilla.org"); + gEM.uninstallItem("bug542391_3@tests.mozilla.org"); + gEM.uninstallItem("bug542391_4@tests.mozilla.org"); + gEM.uninstallItem("bug542391_5@tests.mozilla.org"); + + restartEM(); + do_check_eq(gEM.getItemForID("bug542391_1@tests.mozilla.org"), null); + do_check_eq(gEM.getItemForID("bug542391_2@tests.mozilla.org"), null); + do_check_eq(gEM.getItemForID("bug542391_3@tests.mozilla.org"), null); + do_check_eq(gEM.getItemForID("bug542391_4@tests.mozilla.org"), null); + do_check_eq(gEM.getItemForID("bug542391_5@tests.mozilla.org"), null); +} From 3415af3075c773f2204f882c11c3fd7235d24b31 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 9 Feb 2010 14:06:37 -0800 Subject: [PATCH 14/31] Bug 345681: Remove the vestigial nsICheckboxControlFrame and nsIRadioControlFrame interfaces. r=roc --- .../html/content/src/nsHTMLInputElement.cpp | 22 ++----- layout/base/nsCSSFrameConstructor.cpp | 2 - layout/forms/Makefile.in | 2 - layout/forms/nsGfxCheckboxControlFrame.cpp | 14 ----- layout/forms/nsGfxCheckboxControlFrame.h | 9 +-- layout/forms/nsGfxRadioControlFrame.cpp | 12 ---- layout/forms/nsGfxRadioControlFrame.h | 7 +-- layout/forms/nsICheckboxControlFrame.h | 61 ------------------- layout/forms/nsIRadioControlFrame.h | 60 ------------------ layout/generic/nsQueryFrame.h | 2 - 10 files changed, 6 insertions(+), 185 deletions(-) delete mode 100644 layout/forms/nsICheckboxControlFrame.h delete mode 100644 layout/forms/nsIRadioControlFrame.h diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 7b51f8c4b9ee..fb6f3e8f4004 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -60,8 +60,6 @@ #include "nsIFormControl.h" #include "nsIForm.h" #include "nsIFormSubmission.h" -#include "nsITextControlFrame.h" -#include "nsIRadioControlFrame.h" #include "nsIDocument.h" #include "nsIPresShell.h" #include "nsIFormControlFrame.h" @@ -81,7 +79,6 @@ #include "nsIDOMNSEvent.h" #include "nsIDOMNodeList.h" #include "nsIDOMHTMLCollection.h" -#include "nsICheckboxControlFrame.h" #include "nsLinebreakConverter.h" //to strip out carriage returns #include "nsReadableUtils.h" #include "nsUnicharUtils.h" @@ -98,7 +95,6 @@ #include "nsRuleData.h" // input type=radio -#include "nsIRadioControlFrame.h" #include "nsIRadioGroupContainer.h" // input type=file @@ -1368,20 +1364,10 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify) // // Notify the frame // - nsIFrame* frame = GetPrimaryFrame(); - if (frame) { - nsPresContext *presContext = GetPresContext(); - - if (mType == NS_FORM_INPUT_CHECKBOX) { - nsICheckboxControlFrame* checkboxFrame = do_QueryFrame(frame); - if (checkboxFrame) { - checkboxFrame->OnChecked(presContext, aChecked); - } - } else if (mType == NS_FORM_INPUT_RADIO) { - nsIRadioControlFrame* radioFrame = do_QueryFrame(frame); - if (radioFrame) { - radioFrame->OnChecked(presContext, aChecked); - } + if (mType == NS_FORM_INPUT_CHECKBOX || mType == NS_FORM_INPUT_RADIO) { + nsIFrame* frame = GetPrimaryFrame(); + if (frame) { + frame->InvalidateOverflowRect(); } } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 32d0e2a7827e..321dcf7601ce 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -77,8 +77,6 @@ #include "nsIComboboxControlFrame.h" #include "nsIListControlFrame.h" #include "nsISelectControlFrame.h" -#include "nsIRadioControlFrame.h" -#include "nsICheckboxControlFrame.h" #include "nsIDOMCharacterData.h" #include "nsIDOMHTMLImageElement.h" #include "nsPlaceholderFrame.h" diff --git a/layout/forms/Makefile.in b/layout/forms/Makefile.in index e7b4cf91b772..228b7395cc14 100644 --- a/layout/forms/Makefile.in +++ b/layout/forms/Makefile.in @@ -58,8 +58,6 @@ EXPORTS = \ nsIListControlFrame.h \ nsIComboboxControlFrame.h \ nsIFormControlFrame.h \ - nsIRadioControlFrame.h \ - nsICheckboxControlFrame.h \ nsISelectControlFrame.h \ nsITextControlFrame.h \ $(NULL) diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index cc02e48bcd06..a2247e586af6 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -119,11 +119,6 @@ nsGfxCheckboxControlFrame::~nsGfxCheckboxControlFrame() { } - -NS_QUERYFRAME_HEAD(nsGfxCheckboxControlFrame) - NS_QUERYFRAME_ENTRY(nsICheckboxControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) - #ifdef ACCESSIBILITY NS_IMETHODIMP nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible) @@ -140,15 +135,6 @@ nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible) } #endif -//------------------------------------------------------------ -NS_IMETHODIMP -nsGfxCheckboxControlFrame::OnChecked(nsPresContext* aPresContext, - PRBool aChecked) -{ - InvalidateOverflowRect(); - return NS_OK; -} - //------------------------------------------------------------ NS_IMETHODIMP nsGfxCheckboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, diff --git a/layout/forms/nsGfxCheckboxControlFrame.h b/layout/forms/nsGfxCheckboxControlFrame.h index 3cc8fb2b97cf..2727b5a8cad5 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.h +++ b/layout/forms/nsGfxCheckboxControlFrame.h @@ -38,14 +38,12 @@ #define nsGfxCheckboxControlFrame_h___ #include "nsFormControlFrame.h" -#include "nsICheckboxControlFrame.h" #ifdef ACCESSIBILITY class nsIAccessible; #endif -class nsGfxCheckboxControlFrame : public nsFormControlFrame, - public nsICheckboxControlFrame +class nsGfxCheckboxControlFrame : public nsFormControlFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -67,11 +65,6 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - //nsICheckboxControlFrame methods - NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked); - - NS_DECL_QUERYFRAME - protected: PRBool IsChecked(); diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index b80cf6da00bf..4cd0ea05afef 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -64,10 +64,6 @@ nsGfxRadioControlFrame::~nsGfxRadioControlFrame() { } -NS_QUERYFRAME_HEAD(nsGfxRadioControlFrame) - NS_QUERYFRAME_ENTRY(nsIRadioControlFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) - #ifdef ACCESSIBILITY NS_IMETHODIMP nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible) @@ -126,11 +122,3 @@ nsGfxRadioControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return aLists.Content()->AppendNewToTop(new (aBuilder) nsDisplayGeneric(this, PaintCheckedRadioButton, "CheckedRadioButton")); } - -NS_IMETHODIMP -nsGfxRadioControlFrame::OnChecked(nsPresContext* aPresContext, - PRBool aChecked) -{ - InvalidateOverflowRect(); - return NS_OK; -} diff --git a/layout/forms/nsGfxRadioControlFrame.h b/layout/forms/nsGfxRadioControlFrame.h index 52a46d31bf21..011131ef11e5 100644 --- a/layout/forms/nsGfxRadioControlFrame.h +++ b/layout/forms/nsGfxRadioControlFrame.h @@ -39,7 +39,6 @@ #define nsGfxRadioControlFrame_h___ #include "nsFormControlFrame.h" -#include "nsIRadioControlFrame.h" #ifdef ACCESSIBILITY class nsIAccessible; @@ -47,21 +46,17 @@ class nsIAccessible; // nsGfxRadioControlFrame -class nsGfxRadioControlFrame : public nsFormControlFrame, - public nsIRadioControlFrame - +class nsGfxRadioControlFrame : public nsFormControlFrame { public: nsGfxRadioControlFrame(nsStyleContext* aContext); ~nsGfxRadioControlFrame(); - NS_DECL_QUERYFRAME NS_DECL_FRAMEARENA_HELPERS #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked); NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/layout/forms/nsICheckboxControlFrame.h b/layout/forms/nsICheckboxControlFrame.h deleted file mode 100644 index da9e26c00ae8..000000000000 --- a/layout/forms/nsICheckboxControlFrame.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** 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.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of 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 nsICheckControlFrame_h___ -#define nsICheckControlFrame_h___ - -#include "nsQueryFrame.h" -class nsStyleContext; -class nsPresContext; - -/** - * nsICheckControlFrame is the common interface radio buttons. - * @see nsFromControlFrame and its base classes for more info - */ -class nsICheckboxControlFrame -{ -public: - NS_DECL_QUERYFRAME_TARGET(nsICheckboxControlFrame) - - /** - * Called by content when checkbox "checked" changes - */ - NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0; -}; - -#endif - diff --git a/layout/forms/nsIRadioControlFrame.h b/layout/forms/nsIRadioControlFrame.h deleted file mode 100644 index ee22d7e35d72..000000000000 --- a/layout/forms/nsIRadioControlFrame.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** 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.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of 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 nsIRadioControlFrame_h___ -#define nsIRadioControlFrame_h___ - -#include "nsQueryFrame.h" -class nsStyleContext; - -/** - * nsIRadioControlFrame is the common interface radio buttons. - * @see nsFormControlFrame and its base classes for more info - */ -class nsIRadioControlFrame -{ -public: - NS_DECL_QUERYFRAME_TARGET(nsIRadioControlFrame) - - /** - * Called by content when the radio button's state changes - */ - NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0; -}; - -#endif - diff --git a/layout/generic/nsQueryFrame.h b/layout/generic/nsQueryFrame.h index b3d5322a6222..8fb853eec66e 100644 --- a/layout/generic/nsQueryFrame.h +++ b/layout/generic/nsQueryFrame.h @@ -111,7 +111,6 @@ public: nsHTMLScrollFrame_id, nsIAnonymousContentCreator_id, nsICSSPseudoComparator_id, - nsICheckboxControlFrame_id, nsIComboboxControlFrame_id, nsIFormControlFrame_id, nsIFrame_id, @@ -123,7 +122,6 @@ public: nsIObjectFrame_id, nsIPageSequenceFrame_id, nsIPercentHeightObserver_id, - nsIRadioControlFrame_id, nsIRootBox_id, nsISVGChildFrame_id, nsISVGGlyphFragmentLeaf_id, From 6f802fa89d173c1aab6dfe2d31913a13d7cb7abe Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 9 Feb 2010 14:07:33 -0800 Subject: [PATCH 15/31] Bug 540633: Label httpd.js debug logs, optionally timestamp them, and add support for enabling or disabling them in the middle of a run (currently only for mochitests). r=jwalden --- netwerk/test/httpserver/httpd.js | 29 ++++++++++++++++++++++++--- testing/mochitest/server.js | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/netwerk/test/httpserver/httpd.js b/netwerk/test/httpserver/httpd.js index a141b3e0b658..41ae8465d27f 100644 --- a/netwerk/test/httpserver/httpd.js +++ b/netwerk/test/httpserver/httpd.js @@ -57,6 +57,9 @@ const PR_UINT32_MAX = Math.pow(2, 32) - 1; /** True if debugging output is enabled, false otherwise. */ var DEBUG = false; // non-const *only* so tweakable in server tests +/** True if debugging output should be timestamped. */ +var DEBUG_TIMESTAMP = false; // non-const so tweakable in server tests + var gGlobalObject = this; /** @@ -75,7 +78,7 @@ function NS_ASSERT(cond, msg) var stack = new Error().stack.split(/\n/); dumpn(stack.map(function(val) { return "###!!! " + val; }).join("\n")); - + throw Cr.NS_ERROR_ABORT; } } @@ -164,12 +167,32 @@ const HEADERS_SUFFIX = HIDDEN_CHAR + "headers" + HIDDEN_CHAR; /** Type used to denote SJS scripts for CGI-like functionality. */ const SJS_TYPE = "sjs"; +/** Base for relative timestamps produced by dumpn(). */ +var firstStamp = 0; -/** dump(str) with a trailing "\n" -- only outputs if DEBUG */ +/** dump(str) with a trailing "\n" -- only outputs if DEBUG. */ function dumpn(str) { if (DEBUG) - dump(str + "\n"); + { + var prefix = "HTTPD-INFO | "; + if (DEBUG_TIMESTAMP) + { + if (firstStamp === 0) + firstStamp = Date.now(); + + var elapsed = Date.now() - firstStamp; // milliseconds + var min = Math.floor(elapsed / 60000); + var sec = (elapsed % 60000) / 1000; + + if (sec < 10) + prefix += min + ":0" + sec.toFixed(3) + " | "; + else + prefix += min + ":" + sec.toFixed(3) + " | "; + } + + dump(prefix + str + "\n"); + } } /** Dumps the current JS stack if DEBUG. */ diff --git a/testing/mochitest/server.js b/testing/mochitest/server.js index bb88d5c5e826..4bb343a86f36 100644 --- a/testing/mochitest/server.js +++ b/testing/mochitest/server.js @@ -198,6 +198,7 @@ function createMochitestServer(serverBasePath) server.registerDirectory("/", serverBasePath); server.registerPathHandler("/server/shutdown", serverShutdown); + server.registerPathHandler("/server/debug", serverDebug); server.registerContentType("sjs", "sjs"); // .sjs == CGI-like functionality server.registerContentType("jar", "application/x-jar"); server.registerContentType("ogg", "application/ogg"); @@ -310,6 +311,39 @@ function serverShutdown(metadata, response) server.stop(serverStopped); } +// /server/debug?[012] +function serverDebug(metadata, response) +{ + response.setStatusLine(metadata.httpVersion, 400, "Bad debugging level"); + if (metadata.queryString.length !== 1) + return; + + var mode; + if (metadata.queryString === "0") { + // do this now so it gets logged with the old mode + dumpn("Server debug logs disabled."); + DEBUG = false; + DEBUG_TIMESTAMP = false; + mode = "disabled"; + } else if (metadata.queryString === "1") { + DEBUG = true; + DEBUG_TIMESTAMP = false; + mode = "enabled"; + } else if (metadata.queryString === "2") { + DEBUG = true; + DEBUG_TIMESTAMP = true; + mode = "enabled, with timestamps"; + } else { + return; + } + + response.setStatusLine(metadata.httpVersion, 200, "OK"); + response.setHeader("Content-type", "text/plain", false); + var body = "Server debug logs " + mode + "."; + response.bodyOutputStream.write(body, body.length); + dumpn(body); +} + // // DIRECTORY LISTINGS // From cf1ed17091ef87e1ba2b87a085e60a7d4d17c747 Mon Sep 17 00:00:00 2001 From: Dan Witte Date: Tue, 9 Feb 2010 15:42:44 -0800 Subject: [PATCH 16/31] Fix failing test. --- netwerk/test/TestCookie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 8f9cee0de81f..525ad0e7ab6d 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -464,7 +464,7 @@ main(PRInt32 argc, char *argv[]) rv[2] = CheckResult(cookie.get(), MUST_BE_NULL); SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); - rv[3] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry"); + rv[3] = CheckResult(cookie.get(), MUST_BE_NULL); SetACookie(cookieService, "http://expireme.org/", nsnull, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT\"", nsnull); GetACookie(cookieService, "http://expireme.org/", nsnull, getter_Copies(cookie)); rv[4] = CheckResult(cookie.get(), MUST_BE_NULL); From cce526cb1af9cefa55119ecb812ec2568480adf0 Mon Sep 17 00:00:00 2001 From: David Dahl Date: Tue, 9 Feb 2010 15:48:51 -0800 Subject: [PATCH 17/31] Bug 534079: Sub chunks are incorrectly applied in some cases. r=Tony Chang --- .../src/nsUrlClassifierDBService.cpp | 20 ++++------- .../tests/unit/head_urlclassifier.js | 2 +- .../url-classifier/tests/unit/test_addsub.js | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp index aa6817489b7a..7749abd035ef 100644 --- a/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp @@ -23,6 +23,7 @@ * Tony Chang (original author) * Brett Wilson * Dave Camp + * David Dahl * * 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 @@ -131,7 +132,7 @@ static const PRLogModuleInfo *gUrlClassifierDbServiceLog = nsnull; // want to change schema, or to recover from updating bugs. When an // implementation version change is detected, the database is scrapped // and we start over. -#define IMPLEMENTATION_VERSION 6 +#define IMPLEMENTATION_VERSION 7 #define MAX_HOST_COMPONENTS 5 #define MAX_PATH_COMPONENTS 4 @@ -2639,10 +2640,8 @@ nsUrlClassifierDBServiceWorker::SubChunk(PRUint32 tableId, LOG(("Subbing %d entries in chunk %d in table %d", entries.Length(), chunkNum, tableId)); - nsAutoTArray existingEntries; - nsUrlClassifierDomainHash lastKey; - for (PRUint32 i = 0; i < entries.Length(); i++) { + nsAutoTArray existingEntries; nsUrlClassifierEntry& thisEntry = entries[i]; HandlePendingLookups(); @@ -2651,15 +2650,10 @@ nsUrlClassifierDBServiceWorker::SubChunk(PRUint32 tableId, PRBool haveAdds = (mCachedAddChunks.BinaryIndexOf(thisEntry.mAddChunkId) != mCachedAddChunks.NoIndex); - if (i == 0 || lastKey != thisEntry.mKey) { - existingEntries.Clear(); - lastKey = thisEntry.mKey; - - if (haveAdds) { - rv = mMainStore.ReadAddEntries(thisEntry.mKey, thisEntry.mTableId, - thisEntry.mAddChunkId, existingEntries); - NS_ENSURE_SUCCESS(rv, rv); - } + if (haveAdds) { + rv = mMainStore.ReadAddEntries(thisEntry.mKey, thisEntry.mTableId, + thisEntry.mAddChunkId, existingEntries); + NS_ENSURE_SUCCESS(rv, rv); } for (PRUint32 j = 0; j < existingEntries.Length(); j++) { diff --git a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js index 54671ec876c1..deea9fab484a 100644 --- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js +++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js @@ -188,7 +188,7 @@ checkUrls: function(urls, expected, cb) } else { cb(); } - } + }; doLookup(); }, diff --git a/toolkit/components/url-classifier/tests/unit/test_addsub.js b/toolkit/components/url-classifier/tests/unit/test_addsub.js index 7547e0b0b1a9..1303bd399ba4 100644 --- a/toolkit/components/url-classifier/tests/unit/test_addsub.js +++ b/toolkit/components/url-classifier/tests/unit/test_addsub.js @@ -287,6 +287,38 @@ function testSubsDifferentChunks() { doTest([subUpdate1, subUpdate2, addUpdate], assertions); } +// for bug 534079 +function testSubsDifferentChunksSameHostId() { + var subUrls1 = [ "1:foo.com/a" ]; + var subUrls2 = [ "1:foo.com/b", "2:foo.com/c" ]; + + var addUrls = [ "foo.com/a", "foo.com/b" ]; + var addUrls2 = [ "foo.com/c" ]; + + var subUpdate1 = buildPhishingUpdate( + [{ "chunkNum" : 1, + "chunkType" : "s", + "urls": subUrls1 }]); + var subUpdate2 = buildPhishingUpdate( + [{ "chunkNum" : 2, + "chunkType" : "s", + "urls" : subUrls2 }]); + + var addUpdate = buildPhishingUpdate( + [{ "chunkNum" : 1, + "urls" : addUrls }]); + var addUpdate2 = buildPhishingUpdate( + [{ "chunkNum" : 2, + "urls" : addUrls2 }]); + + var assertions = { + "tableData" : "test-phish-simple;a:1-2:s:1-2", + "urlsDontExist" : [ "foo.com/c", "foo.com/b", "foo.com/a", ], + }; + + doTest([addUpdate, addUpdate2, subUpdate1, subUpdate2], assertions); +} + // Test lists of expired chunks function testExpireLists() { var addUpdate = buildPhishingUpdate( @@ -446,6 +478,7 @@ function run_test() testSubPartiallyMatches, testSubPartiallyMatches2, testSubsDifferentChunks, + testSubsDifferentChunksSameHostId, testExpireLists, testDuplicateAddChunks, testExpireWholeSub, From 0ce3c7810fc454f10fdbfc5df77bc8a4e740d396 Mon Sep 17 00:00:00 2001 From: Boying Lu Date: Tue, 9 Feb 2010 16:47:48 -0800 Subject: [PATCH 18/31] Bug 542187 - replace double quote with single quote, r=ted --- configure.in | 16 ++++++++-------- js/src/configure.in | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/configure.in b/configure.in index 766d378c77f0..a641ea9572bf 100644 --- a/configure.in +++ b/configure.in @@ -403,28 +403,28 @@ else AC_CHECK_PROGS(STRIP, strip, :) AC_CHECK_PROGS(WINDRES, windres, :) if test -z "$HOST_CC"; then - HOST_CC="$CC" + HOST_CC='$(CC)' fi if test -z "$HOST_CFLAGS"; then - HOST_CFLAGS="$CFLAGS" + HOST_CFLAGS='$(CFLAGS)' fi if test -z "$HOST_CXX"; then - HOST_CXX="$CXX" + HOST_CXX='$(CXX)' fi if test -z "$HOST_CXXFLAGS"; then - HOST_CXXFLAGS="$CXXFLAGS" + HOST_CXXFLAGS='$(CXXFLAGS)' fi if test -z "$HOST_LDFLAGS"; then - HOST_LDFLAGS="$LDFLAGS" + HOST_LDFLAGS='$(LDFLAGS)' fi if test -z "$HOST_RANLIB"; then - HOST_RANLIB="$RANLIB" + HOST_RANLIB='$(RANLIB)' fi if test -z "$HOST_AR"; then - HOST_AR="$AR" + HOST_AR='$(AR)' fi if test -z "$HOST_AR_FLAGS"; then - HOST_AR_FLAGS="$AR_FLAGS" + HOST_AR_FLAGS='$(AR_FLAGS)' fi fi diff --git a/js/src/configure.in b/js/src/configure.in index f5259f307806..4e6780218310 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -358,28 +358,28 @@ else AC_CHECK_PROGS(STRIP, strip, :) AC_CHECK_PROGS(WINDRES, windres, :) if test -z "$HOST_CC"; then - HOST_CC="$CC" + HOST_CC='$(CC)' fi if test -z "$HOST_CFLAGS"; then - HOST_CFLAGS="$CFLAGS" + HOST_CFLAGS='$(CFLAGS)' fi if test -z "$HOST_CXX"; then - HOST_CXX="$CXX" + HOST_CXX='$(CXX)' fi if test -z "$HOST_CXXFLAGS"; then - HOST_CXXFLAGS="$CXXFLAGS" + HOST_CXXFLAGS='$(CXXFLAGS)' fi if test -z "$HOST_LDFLAGS"; then - HOST_LDFLAGS="$LDFLAGS" + HOST_LDFLAGS='$(LDFLAGS)' fi if test -z "$HOST_RANLIB"; then - HOST_RANLIB="$RANLIB" + HOST_RANLIB='$(RANLIB)' fi if test -z "$HOST_AR"; then - HOST_AR="$AR" + HOST_AR='$(AR)' fi if test -z "$HOST_AR_FLAGS"; then - HOST_AR_FLAGS="$AR_FLAGS" + HOST_AR_FLAGS='$(AR_FLAGS)' fi fi From 4ca497e3c1bf5e34998a69546389aed6258bcc9f Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Wed, 10 Feb 2010 01:58:14 +0100 Subject: [PATCH 19/31] Add toolkit/mozapps/readstrings/Makefile. b=545257 r=not-needed --- toolkit/toolkit-makefiles.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 9a2562448004..61645a8b53bc 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -753,6 +753,7 @@ MAKEFILES_xulapp=" toolkit/mozapps/extensions/Makefile toolkit/mozapps/handling/Makefile toolkit/mozapps/plugins/Makefile + toolkit/mozapps/readstrings/Makefile toolkit/mozapps/update/Makefile toolkit/mozapps/update/updater/Makefile toolkit/mozapps/xpinstall/Makefile From 5dc97f65d883db353d4499f9b138b4b9a437641a Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 20/31] Bug 539828 - Need CSS pseudoclass for crashed plugins. r=dbaron --- content/base/src/nsObjectLoadingContent.cpp | 4 ++++ content/events/public/nsIEventStateManager.h | 4 ++++ layout/style/nsCSSPseudoClassList.h | 2 ++ layout/style/test/test_selectors.html | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 7618ae0a8e38..043e5a2a31cf 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -955,6 +955,9 @@ nsObjectLoadingContent::ObjectState() const case ePluginBlocklisted: state |= NS_EVENT_STATE_HANDLER_BLOCKED; break; + case ePluginCrashed: + state |= NS_EVENT_STATE_HANDLER_CRASHED; + break; case ePluginUnsupported: state |= NS_EVENT_STATE_TYPE_UNSUPPORTED; break; @@ -1931,6 +1934,7 @@ nsObjectLoadingContent::SetAbsoluteScreenPosition(nsIDOMElement* element, NS_IMETHODIMP nsObjectLoadingContent::PluginCrashed() { + AutoNotifier notifier(this, PR_TRUE); UnloadContent(); mFallbackReason = ePluginCrashed; nsCOMPtr thisContent = do_QueryInterface(static_cast(this)); diff --git a/content/events/public/nsIEventStateManager.h b/content/events/public/nsIEventStateManager.h index ebb866014b8e..e0f57b12e20d 100644 --- a/content/events/public/nsIEventStateManager.h +++ b/content/events/public/nsIEventStateManager.h @@ -197,4 +197,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventStateManager, NS_IEVENTSTATEMANAGER_IID) #define NS_EVENT_STATE_INDETERMINATE 0x04000000 // CSS3-Selectors +// Handler for the content has crashed +#define NS_EVENT_STATE_HANDLER_CRASHED \ + 0x08000000 + #endif // nsIEventStateManager_h__ diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h index ac2c834849b0..3c2da8e678a1 100644 --- a/layout/style/nsCSSPseudoClassList.h +++ b/layout/style/nsCSSPseudoClassList.h @@ -114,6 +114,8 @@ CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled", NS_EVENT_STATE_HANDLER_DISABLED) CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked", NS_EVENT_STATE_HANDLER_BLOCKED) +CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed", + NS_EVENT_STATE_HANDLER_CRASHED) CSS_PSEUDO_CLASS(mozHasHandlerRef, ":-moz-has-handlerref") diff --git a/layout/style/test/test_selectors.html b/layout/style/test/test_selectors.html index f79a1aabb82b..7e92d1ae458e 100644 --- a/layout/style/test/test_selectors.html +++ b/layout/style/test/test_selectors.html @@ -704,6 +704,13 @@ function run() { test_balanced_unparseable(":-moz-tree-twisty(open())"); test_balanced_unparseable("::-moz-tree-twisty(hover ())"); + // Plugin pseudoclasses + test_parseable(":-moz-type-unsupported"); + test_parseable(":-moz-handler-disabled"); + test_parseable(":-moz-handler-blocked"); + test_parseable(":-moz-handler-crashed"); + test_parseable(":-moz-has-handlerref"); + // Case sensitivity of tag selectors function setup_cased_spans(body) { var data = [ From 2a33518c3ce6e84c308c153997cf711d174c4221 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 21/31] Bug 541076 - add minidump id and plugin name to PluginCrashed event. p=ted+dolske, r=jst, r=ted --- .../base/public/nsIObjectLoadingContent.idl | 3 +- content/base/src/nsObjectLoadingContent.cpp | 93 ++++++++++++++++++- dom/plugins/PluginModuleParent.cpp | 26 +++++- modules/plugin/base/src/nsNPAPIPlugin.cpp | 4 +- modules/plugin/base/src/nsNPAPIPlugin.h | 5 +- modules/plugin/base/src/nsPluginHost.cpp | 17 +++- modules/plugin/base/src/nsPluginHost.h | 2 +- .../test/mochitest/test_crash_notify.xul | 63 +++++++++++++ 8 files changed, 198 insertions(+), 15 deletions(-) diff --git a/content/base/public/nsIObjectLoadingContent.idl b/content/base/public/nsIObjectLoadingContent.idl index f0a83e888ce1..30234fd64084 100644 --- a/content/base/public/nsIObjectLoadingContent.idl +++ b/content/base/public/nsIObjectLoadingContent.idl @@ -124,5 +124,6 @@ interface nsIObjectLoadingContent : nsISupports */ [noscript] nsIFrame getPrintFrame(); - [noscript] void pluginCrashed(); + [noscript] void pluginCrashed(in AString pluginName, + in boolean submittedCrashReport); }; diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 043e5a2a31cf..df5fd3a78a83 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -44,9 +44,13 @@ // Interface headers #include "imgILoader.h" +#include "nsEventDispatcher.h" #include "nsIContent.h" #include "nsIDocShell.h" #include "nsIDocument.h" +#include "nsIDOMDataContainerEvent.h" +#include "nsIDOMDocumentEvent.h" +#include "nsIDOMEventTarget.h" #include "nsIExternalProtocolHandler.h" #include "nsIEventStateManager.h" #include "nsIObjectFrame.h" @@ -54,6 +58,7 @@ #include "nsIPluginHost.h" #include "nsIPluginInstance.h" #include "nsIPresShell.h" +#include "nsIPrivateDOMEvent.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptSecurityManager.h" #include "nsIStreamConverterService.h" @@ -79,6 +84,7 @@ #include "nsNetUtil.h" #include "nsMimeTypes.h" #include "nsStyleUtil.h" +#include "nsGUIEvent.h" // Concrete classes #include "nsFrameLoader.h" @@ -200,9 +206,6 @@ nsPluginErrorEvent::Run() case ePluginOutdated: type = NS_LITERAL_STRING("PluginOutdated"); break; - case ePluginCrashed: - type = NS_LITERAL_STRING("PluginCrashed"); - break; default: return NS_OK; } @@ -212,6 +215,79 @@ nsPluginErrorEvent::Run() return NS_OK; } +/** + * A task for firing PluginCrashed DOM Events. + */ +class nsPluginCrashedEvent : public nsRunnable { +public: + nsCOMPtr mContent; + nsString mPluginName; + PRBool mSubmittedCrashReport; + + nsPluginCrashedEvent(nsIContent* aContent, + const nsAString& aPluginName, + PRBool submittedCrashReport) + : mContent(aContent), + mPluginName(aPluginName), + mSubmittedCrashReport(submittedCrashReport) + {} + + ~nsPluginCrashedEvent() {} + + NS_IMETHOD Run(); +}; + +NS_IMETHODIMP +nsPluginCrashedEvent::Run() +{ + LOG(("OBJLC []: Firing plugin crashed event for content %p\n", + mContent.get())); + + nsCOMPtr domEventDoc = + do_QueryInterface(mContent->GetDocument()); + if (!domEventDoc) { + NS_WARNING("Couldn't get document for PluginCrashed event!"); + return NS_OK; + } + + nsCOMPtr event; + domEventDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"), + getter_AddRefs(event)); + nsCOMPtr privateEvent(do_QueryInterface(event)); + nsCOMPtr containerEvent(do_QueryInterface(event)); + if (!privateEvent || !containerEvent) { + NS_WARNING("Couldn't QI event for PluginCrashed event!"); + return NS_OK; + } + + event->InitEvent(NS_LITERAL_STRING("PluginCrashed"), PR_TRUE, PR_TRUE); + privateEvent->SetTrusted(PR_TRUE); + privateEvent->GetInternalNSEvent()->flags |= NS_EVENT_FLAG_ONLY_CHROME_DISPATCH; + + nsCOMPtr variant; + + // add a "pluginName" property to this event + variant = do_CreateInstance("@mozilla.org/variant;1"); + if (!variant) { + NS_WARNING("Couldn't create pluginName variant for PluginCrashed event!"); + return NS_OK; + } + variant->SetAsAString(mPluginName); + containerEvent->SetData(NS_LITERAL_STRING("pluginName"), variant); + + // add a "submittedCrashReport" property to this event + variant = do_CreateInstance("@mozilla.org/variant;1"); + if (!variant) { + NS_WARNING("Couldn't create crashSubmit variant for PluginCrashed event!"); + return NS_OK; + } + variant->SetAsBool(mSubmittedCrashReport); + containerEvent->SetData(NS_LITERAL_STRING("submittedCrashReport"), variant); + + nsEventDispatcher::DispatchDOMEvent(mContent, nsnull, event, nsnull, nsnull); + return NS_OK; +} + class AutoNotifier { public: AutoNotifier(nsObjectLoadingContent* aContent, PRBool aNotify) : @@ -1932,12 +2008,19 @@ nsObjectLoadingContent::SetAbsoluteScreenPosition(nsIDOMElement* element, } NS_IMETHODIMP -nsObjectLoadingContent::PluginCrashed() +nsObjectLoadingContent::PluginCrashed(const nsAString& pluginName, + PRBool submittedCrashReport) { AutoNotifier notifier(this, PR_TRUE); UnloadContent(); mFallbackReason = ePluginCrashed; nsCOMPtr thisContent = do_QueryInterface(static_cast(this)); - FirePluginError(thisContent, mFallbackReason); + nsCOMPtr ev = new nsPluginCrashedEvent(thisContent, + pluginName, + submittedCrashReport); + nsresult rv = NS_DispatchToCurrentThread(ev); + if (NS_FAILED(rv)) { + NS_WARNING("failed to dispatch nsPluginCrashedEvent"); + } return NS_OK; } diff --git a/dom/plugins/PluginModuleParent.cpp b/dom/plugins/PluginModuleParent.cpp index 46e4c6915198..c02765e1f8f3 100644 --- a/dom/plugins/PluginModuleParent.cpp +++ b/dom/plugins/PluginModuleParent.cpp @@ -50,6 +50,24 @@ using namespace mozilla::plugins; PR_STATIC_ASSERT(sizeof(NPIdentifier) == sizeof(void*)); +class PluginCrashed : public nsRunnable +{ +public: + PluginCrashed(nsNPAPIPlugin* plugin, + const nsString& dumpID) + : mDumpID(dumpID), + mPlugin(plugin) { } + + NS_IMETHOD Run() { + mPlugin->PluginCrashed(mDumpID); + return NS_OK; + } + +private: + nsNPAPIPlugin* mPlugin; + nsString mDumpID; +}; + // static PluginLibrary* PluginModuleParent::LoadModule(const char* aFilePath) @@ -160,8 +178,13 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why) switch (why) { case AbnormalShutdown: { nsCOMPtr dump; + nsAutoString dumpID; if (GetMinidump(getter_AddRefs(dump))) { WriteExtraDataForMinidump(dump); + if (NS_SUCCEEDED(dump->GetLeafName(dumpID))) { + dumpID.Replace(dumpID.Length() - 4, 4, + NS_LITERAL_STRING("")); + } } else { NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!"); @@ -172,8 +195,7 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why) // and potentially modify the actor child list while enumerating it. if (mPlugin) { nsCOMPtr r = - new nsRunnableMethod( - mPlugin, &nsNPAPIPlugin::PluginCrashed); + new PluginCrashed(mPlugin, dumpID); NS_DispatchToMainThread(r); } break; diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index 0e442982037d..1482cd2dceb4 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -300,10 +300,10 @@ nsNPAPIPlugin::SetPluginRefNum(short aRefNum) #ifdef MOZ_IPC void -nsNPAPIPlugin::PluginCrashed() +nsNPAPIPlugin::PluginCrashed(const nsAString& dumpID) { nsRefPtr host = dont_AddRef(nsPluginHost::GetInst()); - host->PluginCrashed(this); + host->PluginCrashed(this, dumpID); } #endif diff --git a/modules/plugin/base/src/nsNPAPIPlugin.h b/modules/plugin/base/src/nsNPAPIPlugin.h index 9671cbd7fd36..0d1fa83f5a9a 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.h +++ b/modules/plugin/base/src/nsNPAPIPlugin.h @@ -93,8 +93,9 @@ public: #ifdef MOZ_IPC // The IPC mechanism notifies the nsNPAPIPlugin if the plugin crashes and is - // no longer usable. - void PluginCrashed(); + // no longer usable. dumpID is the ID of a minidump that was written, + // or empty if no minidump was written. + void PluginCrashed(const nsAString& dumpID); #endif protected: diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp index 72c9fb62de67..de3604687114 100644 --- a/modules/plugin/base/src/nsPluginHost.cpp +++ b/modules/plugin/base/src/nsPluginHost.cpp @@ -89,6 +89,7 @@ #include "nsVersionComparator.h" #include "nsIPrivateBrowsingService.h" #include "nsIObjectLoadingContent.h" +#include "nsIWritablePropertyBag2.h" #include "nsEnumeratorUtils.h" #include "nsXPCOM.h" @@ -5207,7 +5208,7 @@ NS_IMETHODIMP nsPluginHost::Notify(nsITimer* timer) #ifdef MOZ_IPC void -nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin) +nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin, const nsAString& dumpID) { nsPluginTag* pluginTag = FindTagForPlugin(aPlugin); if (!pluginTag) { @@ -5215,6 +5216,17 @@ nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin) return; } + // Notify the app's observer that a plugin crashed so it can submit a crashreport. + PRBool submittedCrashReport = PR_FALSE; + nsCOMPtr obsService = do_GetService("@mozilla.org/observer-service;1"); + nsCOMPtr propbag = do_CreateInstance("@mozilla.org/hash-property-bag;1"); + if (obsService && propbag) { + propbag->SetPropertyAsAString(NS_LITERAL_STRING("minidumpID"), dumpID); + obsService->NotifyObservers(propbag, "plugin-crashed", nsnull); + // see if an observer submitted a crash report. + propbag->GetPropertyAsBool(NS_LITERAL_STRING("submittedCrashReport"), &submittedCrashReport); + } + // Invalidate each nsPluginInstanceTag for the crashed plugin for (PRUint32 i = mInstanceTags.Length(); i > 0; i--) { @@ -5225,7 +5237,8 @@ nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin) instanceTag->mInstance->GetDOMElement(getter_AddRefs(domElement)); nsCOMPtr objectContent(do_QueryInterface(domElement)); if (objectContent) { - objectContent->PluginCrashed(); + objectContent->PluginCrashed(NS_ConvertUTF8toUTF16(pluginTag->mName), + submittedCrashReport); } instanceTag->mInstance->Stop(); diff --git a/modules/plugin/base/src/nsPluginHost.h b/modules/plugin/base/src/nsPluginHost.h index d187d665ab8f..1a3cf951d93e 100644 --- a/modules/plugin/base/src/nsPluginHost.h +++ b/modules/plugin/base/src/nsPluginHost.h @@ -160,7 +160,7 @@ public: void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame); #ifdef MOZ_IPC - void PluginCrashed(nsNPAPIPlugin* plugin); + void PluginCrashed(nsNPAPIPlugin* plugin, const nsAString& dumpID); #endif nsPluginInstanceTag *FindInstanceTag(nsIPluginInstance *instance); diff --git a/modules/plugin/test/mochitest/test_crash_notify.xul b/modules/plugin/test/mochitest/test_crash_notify.xul index 68e1238d8e82..4106a840f279 100644 --- a/modules/plugin/test/mochitest/test_crash_notify.xul +++ b/modules/plugin/test/mochitest/test_crash_notify.xul @@ -19,12 +19,71 @@ SimpleTest.waitForExplicitFinish(); var success = false; +var observerFired = false; + +var testObserver = { + observe: function(subject, topic, data) { + observerFired = true; + ok(true, "Observer fired"); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + is(topic, "plugin-crashed", "Checking correct topic"); + is(data, null, "Checking null data"); + ok((subject instanceof Components.interfaces.nsIPropertyBag2), "got Propbag"); + ok((subject instanceof Components.interfaces.nsIWritablePropertyBag2), +"got writable Propbag"); + + var id = subject.getPropertyAsAString("minidumpID"); + isnot(id, "", "got a non-empty crash id"); + let directoryService = + Components.classes["@mozilla.org/file/directory_service;1"]. + getService(Components.interfaces.nsIProperties); + let profD = directoryService.get("ProfD", Components.interfaces.nsIFile); + profD.append("minidumps"); + let dumpFile = profD.clone(); + dumpFile.append(id + ".dmp"); + ok(dumpFile.exists(), "minidump exists"); + let extraFile = profD.clone(); + extraFile.append(id + ".extra"); + ok(extraFile.exists(), "extra file exists"); + // cleanup, to be nice + dumpFile.remove(false); + extraFile.remove(false); + }, + + QueryInterface: function(iid) { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + if (iid.equals(Components.interfaces.nsIObserver) || + iid.equals(Components.interfaces.nsISupportsWeakReference) || + iid.equals(Components.interfaces.nsISupports)) + return this; + throw Components.results.NS_NOINTERFACE; + } +}; + + function onPluginCrashed(aEvent) { ok(true, "Plugin crashed notification received"); + ok(observerFired, "Observer should have fired first"); + is(aEvent.type, "PluginCrashed", "event is correct type"); var pluginElement = document.getElementById("plugin1"); is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element"); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + + ok(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent, + "plugin crashed event has the right interface"); + var pluginName = aEvent.getData("pluginName"); + is(pluginName, "Test Plug-in"); + var didReport = aEvent.getData("submittedCrashReport"); + // The app itself may or may not have decided to submit the report, so + // allow either true or false here. + ok((didReport == true || didReport == false), "event said crash report was submitted"); + + var os = Components.classes["@mozilla.org/observer-service;1"]. + getService(Components.interfaces.nsIObserverService); + os.removeObserver(testObserver, "plugin-crashed"); + SimpleTest.finish(); } @@ -38,6 +97,10 @@ function runTests() { return; } + var os = Components.classes["@mozilla.org/observer-service;1"]. + getService(Components.interfaces.nsIObserverService); + os.addObserver(testObserver, "plugin-crashed", true); + document.addEventListener("PluginCrashed", onPluginCrashed, false); var pluginElement = document.getElementById("plugin1"); From 38218420d50853a808a1d886b21a37dfb30fa598 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 22/31] bug 539843 - Need a mechanism for plugin crashed UI to trigger crash report submission. r=dtownsend --HG-- rename : toolkit/crashreporter/content/crashes.js => toolkit/crashreporter/CrashSubmit.jsm --- toolkit/crashreporter/CrashSubmit.jsm | 366 ++++++++++++++++++ toolkit/crashreporter/Makefile.in | 4 + toolkit/crashreporter/content/crashes.js | 285 +++----------- .../crashreporter/content/oopcrashdialog.js | 19 +- .../crashreporter/content/oopcrashdialog.xul | 1 - .../browser/browser_aboutCrashesResubmit.js | 9 +- .../test/browser/crashreport.sjs | 3 +- 7 files changed, 443 insertions(+), 244 deletions(-) create mode 100644 toolkit/crashreporter/CrashSubmit.jsm diff --git a/toolkit/crashreporter/CrashSubmit.jsm b/toolkit/crashreporter/CrashSubmit.jsm new file mode 100644 index 000000000000..cf723de7ea18 --- /dev/null +++ b/toolkit/crashreporter/CrashSubmit.jsm @@ -0,0 +1,366 @@ +/* ***** 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 code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ted Mielczarek (original 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 ***** */ + +let EXPORTED_SYMBOLS = [ + "CrashSubmit" +]; + +const Cc = Components.classes; +const Ci = Components.interfaces; +const STATE_START = Ci.nsIWebProgressListener.STATE_START; +const STATE_STOP = Ci.nsIWebProgressListener.STATE_STOP; + +let reportURL = null; +let strings = null; +let myListener = null; + +function parseKeyValuePairs(text) { + var lines = text.split('\n'); + var data = {}; + for (let i = 0; i < lines.length; i++) { + if (lines[i] == '') + continue; + + // can't just .split() because the value might contain = characters + let eq = lines[i].indexOf('='); + if (eq != -1) { + let [key, value] = [lines[i].substring(0, eq), + lines[i].substring(eq + 1)]; + if (key && value) + data[key] = value.replace("\\n", "\n", "g").replace("\\\\", "\\", "g"); + } + } + return data; +} + +function parseKeyValuePairsFromFile(file) { + var fstream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fstream.init(file, -1, 0, 0); + var is = Cc["@mozilla.org/intl/converter-input-stream;1"]. + createInstance(Ci.nsIConverterInputStream); + is.init(fstream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); + var str = {}; + var contents = ''; + while (is.readString(4096, str) != 0) { + contents += str.value; + } + is.close(); + fstream.close(); + return parseKeyValuePairs(contents); +} + +function parseINIStrings(file) { + var factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"]. + getService(Ci.nsIINIParserFactory); + var parser = factory.createINIParser(file); + var obj = {}; + var en = parser.getKeys("Strings"); + while (en.hasMore()) { + var key = en.getNext(); + obj[key] = parser.getString("Strings", key); + } + return obj; +} + +// Since we're basically re-implementing part of the crashreporter +// client here, we'll just steal the strings we need from crashreporter.ini +function getL10nStrings() { + let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + let path = dirSvc.get("GreD", Ci.nsIFile); + path.append("crashreporter.ini"); + if (!path.exists()) { + // see if we're on a mac + path = path.parent; + path.append("crashreporter.app"); + path.append("Contents"); + path.append("MacOS"); + path.append("crashreporter.ini"); + if (!path.exists()) { + // very bad, but I don't know how to recover + return; + } + } + let crstrings = parseINIStrings(path); + strings = { + 'crashid': crstrings.CrashID, + 'reporturl': crstrings.CrashDetailsURL + }; + + path = dirSvc.get("XCurProcD", Ci.nsIFile); + path.append("crashreporter-override.ini"); + if (path.exists()) { + crstrings = parseINIStrings(path); + if ('CrashID' in crstrings) + strings['crashid'] = crstrings.CrashID; + if ('CrashDetailsURL' in crstrings) + strings['reporturl'] = crstrings.CrashDetailsURL; + } +} + +function getPendingMinidump(id) { + let directoryService = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + let pendingDir = directoryService.get("UAppData", Ci.nsIFile); + pendingDir.append("Crash Reports"); + pendingDir.append("pending"); + let dump = pendingDir.clone(); + let extra = pendingDir.clone(); + dump.append(id + ".dmp"); + extra.append(id + ".extra"); + return [dump, extra]; +} + +function addFormEntry(doc, form, name, value) { + var input = doc.createElement("input"); + input.type = "hidden"; + input.name = name; + input.value = value; + form.appendChild(input); +} + +function writeSubmittedReport(crashID, viewURL) { + let directoryService = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + let reportFile = directoryService.get("UAppData", Ci.nsIFile); + reportFile.append("Crash Reports"); + reportFile.append("submitted"); + reportFile.append(crashID + ".txt"); + var fstream = Cc["@mozilla.org/network/file-output-stream;1"]. + createInstance(Ci.nsIFileOutputStream); + // open, write, truncate + fstream.init(reportFile, -1, -1, 0); + var os = Cc["@mozilla.org/intl/converter-output-stream;1"]. + createInstance(Ci.nsIConverterOutputStream); + os.init(fstream, "UTF-8", 0, 0x0000); + + var data = strings.crashid.replace("%s", crashID); + if (viewURL) + data += "\n" + strings.reporturl.replace("%s", viewURL); + + os.writeString(data); + os.close(); + fstream.close(); +} + +// the Submitter class represents an individual submission. +function Submitter(id, element, submitSuccess, submitError) { + this.id = id; + this.element = element; + this.document = element.ownerDocument; + this.successCallback = submitSuccess; + this.errorCallback = submitError; +} + +Submitter.prototype = { + submitSuccess: function Submitter_submitSuccess(ret) + { + if (!ret.CrashID) { + this.cleanup(); + return; + } + + // Write out the details file to submitted/ + writeSubmittedReport(ret.CrashID, ret.ViewURL); + + // Delete from pending dir + try { + this.dump.remove(false); + this.extra.remove(false); + } + catch (ex) { + // report an error? not much the user can do here. + } + + if (this.successCallback) + this.successCallback(this.id, ret); + this.cleanup(); + }, + + cleanup: function Submitter_cleanup() { + // drop some references just to be nice + this.element = null; + this.document = null; + this.successCallback = null; + this.errorCallback = null; + this.iframe = null; + this.dump = null; + this.extra = null; + // remove this object from the list of active submissions + let idx = CrashSubmit._activeSubmissions.indexOf(this); + if (idx != -1) + CrashSubmit._activeSubmissions.splice(idx, 1); + }, + + submitForm: function Submitter_submitForm() + { + let reportData = parseKeyValuePairsFromFile(this.extra); + let form = this.iframe.contentDocument.forms[0]; + if ('ServerURL' in reportData) { + form.action = reportData.ServerURL; + delete reportData.ServerURL; + } + else { + return false; + } + // add the other data + for (let [name, value] in Iterator(reportData)) { + addFormEntry(this.iframe.contentDocument, form, name, value); + } + // tell the server not to throttle this, since it was manually submitted + addFormEntry(this.iframe.contentDocument, form, "Throttleable", "0"); + // add the minidump + this.iframe.contentDocument.getElementById('minidump').value + = this.dump.path; + this.iframe.docShell.QueryInterface(Ci.nsIWebProgress); + this.iframe.docShell.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); + form.submit(); + return true; + }, + + // web progress listener + QueryInterface: function(aIID) + { + if (aIID.equals(Ci.nsIWebProgressListener) || + aIID.equals(Ci.nsISupportsWeakReference) || + aIID.equals(Ci.nsISupports)) + return this; + throw Components.results.NS_NOINTERFACE; + }, + + onStateChange: function(aWebProgress, aRequest, aFlag, aStatus) + { + if(aFlag & STATE_STOP) { + this.iframe.docShell.removeProgressListener(this); + + // check general request status first + if (!Components.isSuccessCode(aStatus)) { + this.element.removeChild(this.iframe); + if (this.errorCallback) { + this.errorCallback(this.id); + this.cleanup(); + } + return 0; + } + // check HTTP status + if (aRequest instanceof Ci.nsIHttpChannel && + aRequest.responseStatus != 200) { + this.element.removeChild(this.iframe); + if (this.errorCallback) { + this.errorCallback(this.id); + this.cleanup(); + } + return 0; + } + + var ret = parseKeyValuePairs(this.iframe.contentDocument.documentElement.textContent); + this.element.removeChild(this.iframe); + this.submitSuccess(ret); + } + return 0; + }, + + onLocationChange: function(aProgress, aRequest, aURI) {return 0;}, + onProgressChange: function() {return 0;}, + onStatusChange: function() {return 0;}, + onSecurityChange: function() {return 0;}, + + submit: function Submitter_submit() + { + let [dump, extra] = getPendingMinidump(this.id); + if (!dump.exists() || !extra.exists()) + return false; + this.dump = dump; + this.extra = extra; + let iframe = this.document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "iframe"); + iframe.setAttribute("type", "content"); + + let self = this; + function loadHandler() { + if (iframe.contentWindow.location == "about:blank") + return; + iframe.removeEventListener("load", loadHandler, true); + self.submitForm(); + } + + iframe.addEventListener("load", loadHandler, true); + this.element.appendChild(iframe); + this.iframe = iframe; + iframe.webNavigation.loadURI("chrome://global/content/crash-submit-form.xhtml", 0, null, null, null); + return true; + } +}; + +//=================================== +// External API goes here +let CrashSubmit = { + /** + * Submit the crash report named id.dmp from the "pending" directory. + * + * @param id + * Filename (minus .dmp extension) of the minidump to submit. + * @param element + * A DOM element to which an iframe can be appended as a child, + * used for form submission. + * @param submitSuccess + * A function that will be called if the report is submitted + * successfully with two parameters: the id that was passed + * to this function, and an object containing the key/value + * data returned from the server in its properties. + * @param submitError + * A function that will be called with one parameter if the + * report fails to submit: the id that was passed to this + * function. + * + * @return true if the submission began successfully, or false if + * it failed for some reason. (If the dump file does not + * exist, for example.) + */ + submit: function CrashSubmit_submit(id, element, submitSuccess, submitError) + { + let submitter = new Submitter(id, element, submitSuccess, submitError); + CrashSubmit._activeSubmissions.push(submitter); + return submitter.submit(); + }, + + // List of currently active submit objects + _activeSubmissions: [] +}; + +// Run this when first loaded +getL10nStrings(); \ No newline at end of file diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 9ba5c2e580bb..48061bb297f5 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -111,6 +111,10 @@ CPPSRCS = \ FORCE_STATIC_LIB = 1 +EXTRA_JS_MODULES = \ + CrashSubmit.jsm \ + $(NULL) + ifdef ENABLE_TESTS TOOL_DIRS = test endif diff --git a/toolkit/crashreporter/content/crashes.js b/toolkit/crashreporter/content/crashes.js index b59df00e9b69..f1b6cfef9f45 100644 --- a/toolkit/crashreporter/content/crashes.js +++ b/toolkit/crashreporter/content/crashes.js @@ -1,150 +1,52 @@ +/* ***** 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 code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dave Townsend (original author) + * Ted Mielczarek + * + * 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 ***** */ + const Cc = Components.classes; const Ci = Components.interfaces; -var reportURL = null; var reportsDir, pendingDir; -var strings = null; -var myListener = null; -function parseKeyValuePairs(text) { - var lines = text.split('\n'); - var data = {}; - for (let i = 0; i < lines.length; i++) { - if (lines[i] == '') - continue; - - // can't just .split() because the value might contain = characters - let eq = lines[i].indexOf('='); - if (eq != -1) { - let [key, value] = [lines[i].substring(0, eq), - lines[i].substring(eq + 1)]; - if (key && value) - data[key] = value.replace("\\n", "\n", "g").replace("\\\\", "\\", "g"); - } - } - return data; -} - -function parseKeyValuePairsFromFile(file) { - var fstream = Cc["@mozilla.org/network/file-input-stream;1"]. - createInstance(Ci.nsIFileInputStream); - fstream.init(file, -1, 0, 0); - var is = Cc["@mozilla.org/intl/converter-input-stream;1"]. - createInstance(Ci.nsIConverterInputStream); - is.init(fstream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); - var str = {}; - var contents = ''; - while (is.readString(4096, str) != 0) { - contents += str.value; - } - is.close(); - fstream.close(); - return parseKeyValuePairs(contents); -} - -function parseINIStrings(file) { - var factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"]. - getService(Ci.nsIINIParserFactory); - var parser = factory.createINIParser(file); - var obj = {}; - var en = parser.getKeys("Strings"); - while (en.hasMore()) { - var key = en.getNext(); - obj[key] = parser.getString("Strings", key); - } - return obj; -} - -// Since we're basically re-implementing part of the crashreporter -// client here, we'll just steal the strings we need from crashreporter.ini -function getL10nStrings() { - let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties); - let path = dirSvc.get("GreD", Ci.nsIFile); - path.append("crashreporter.ini"); - if (!path.exists()) { - // see if we're on a mac - path = path.parent; - path.append("crashreporter.app"); - path.append("Contents"); - path.append("MacOS"); - path.append("crashreporter.ini"); - if (!path.exists()) { - // very bad, but I don't know how to recover - return; - } - } - let crstrings = parseINIStrings(path); - strings = { - 'crashid': crstrings.CrashID, - 'reporturl': crstrings.CrashDetailsURL - }; - - path = dirSvc.get("XCurProcD", Ci.nsIFile); - path.append("crashreporter-override.ini"); - if (path.exists()) { - crstrings = parseINIStrings(path); - if ('CrashID' in crstrings) - strings['crashid'] = crstrings.CrashID; - if ('CrashDetailsURL' in crstrings) - strings['reporturl'] = crstrings.CrashDetailsURL; - } -} - -function getPendingMinidump(id) { - let directoryService = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties); - let dump = pendingDir.clone(); - let extra = pendingDir.clone(); - dump.append(id + ".dmp"); - extra.append(id + ".extra"); - return [dump, extra]; -} - -function addFormEntry(doc, form, name, value) { - var input = doc.createElement("input"); - input.type = "hidden"; - input.name = name; - input.value = value; - form.appendChild(input); -} - -function writeSubmittedReport(crashID, viewURL) { - let reportFile = reportsDir.clone(); - reportFile.append(crashID + ".txt"); - var fstream = Cc["@mozilla.org/network/file-output-stream;1"]. - createInstance(Ci.nsIFileOutputStream); - // open, write, truncate - fstream.init(reportFile, -1, -1, 0); - var os = Cc["@mozilla.org/intl/converter-output-stream;1"]. - createInstance(Ci.nsIConverterOutputStream); - os.init(fstream, "UTF-8", 0, 0x0000); - - var data = strings.crashid.replace("%s", crashID); - if (viewURL) - data += "\n" + strings.reporturl.replace("%s", viewURL); - - os.writeString(data); - os.close(); - fstream.close(); -} - -function submitSuccess(ret, link, dump, extra) { - if (!ret.CrashID) - return; - // Write out the details file to submitted/ - writeSubmittedReport(ret.CrashID, ret.ViewURL); - - // Delete from pending dir - try { - dump.remove(false); - extra.remove(false); - } - catch (ex) { - // report an error? not much the user can do here. - } +Components.utils.import("resource://gre/modules/CrashSubmit.jsm"); +function submitSuccess(dumpid, ret) { + let link = document.getElementById(dumpid); if (link) { + link.className = ""; // reset the link to point at our new crash report. this way, if the // user clicks "Back", the link will be correct. let CrashID = ret.CrashID; @@ -158,105 +60,23 @@ function submitSuccess(ret, link, dump, extra) { window.location.href = reportURL + CrashID; } } - else { - window.close(); - } } -function submitForm(iframe, dump, extra, link) -{ - let reportData = parseKeyValuePairsFromFile(extra); - let form = iframe.contentDocument.forms[0]; - if ('ServerURL' in reportData) { - form.action = reportData.ServerURL; - delete reportData.ServerURL; - } - else { - return false; - } - // add the other data - for (let [name, value] in Iterator(reportData)) { - addFormEntry(iframe.contentDocument, form, name, value); - } - // tell the server not to throttle this, since it was manually submitted - addFormEntry(iframe.contentDocument, form, "Throttleable", "0"); - // add the minidump - iframe.contentDocument.getElementById('minidump').value = dump.path; - - // web progress listener - const STATE_START = Ci.nsIWebProgressListener.STATE_START; - const STATE_STOP = Ci.nsIWebProgressListener.STATE_STOP; - myListener = { - QueryInterface: function(aIID) { - if (aIID.equals(Ci.nsIWebProgressListener) || - aIID.equals(Ci.nsISupportsWeakReference) || - aIID.equals(Ci.nsISupports)) - return this; - throw Components.results.NS_NOINTERFACE; - }, - - onStateChange: function(aWebProgress, aRequest, aFlag, aStatus) { - if(aFlag & STATE_STOP) { - iframe.docShell.removeProgressListener(myListener); - myListener = null; - if (link) - link.className = ""; - - //XXX: give some indication of failure? - // check general request status first - if (!Components.isSuccessCode(aStatus)) { - document.body.removeChild(iframe); - return 0; - } - // check HTTP status - if (aRequest instanceof Ci.nsIHttpChannel && - aRequest.responseStatus != 200) { - document.body.removeChild(iframe); - return 0; - } - - var ret = parseKeyValuePairs(iframe.contentDocument.documentElement.textContent); - document.body.removeChild(iframe); - submitSuccess(ret, link, dump, extra); - } - return 0; - }, - - onLocationChange: function(aProgress, aRequest, aURI) {return 0;}, - onProgressChange: function() {return 0;}, - onStatusChange: function() {return 0;}, - onSecurityChange: function() {return 0;}, - }; - iframe.docShell.QueryInterface(Ci.nsIWebProgress); - iframe.docShell.addProgressListener(myListener, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); - form.submit(); - return true; -} - -function createAndSubmitForm(id, link) { - let [dump, extra] = getPendingMinidump(id); - if (!dump.exists() || !extra.exists()) - return false; - let iframe = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "iframe"); - iframe.setAttribute("type", "content"); - - function loadHandler() { - if (iframe.contentWindow.location == "about:blank") - return; - iframe.removeEventListener("load", loadHandler, true); - submitForm(iframe, dump, extra, link); - } - - iframe.addEventListener("load", loadHandler, true); - document.body.appendChild(iframe); - iframe.webNavigation.loadURI("chrome://global/content/crash-submit-form.xhtml", 0, null, null, null); - return true; +function submitError(dumpid) { + //XXX: do something more useful here + let link = document.getElementById(dumpid); + if (link) + link.className = ""; + // dispatch an event, useful for testing + let event = document.createEvent("Events"); + event.initEvent("CrashSubmitFailed", true, false); + document.dispatchEvent(event); } function submitPendingReport(event) { var link = event.target; var id = link.firstChild.textContent; - if (createAndSubmitForm(id, link)) + if (CrashSubmit.submit(id, document.body, submitSuccess, submitError)) link.className = "submitting"; event.preventDefault(); return false; @@ -425,6 +245,5 @@ function clearReports() { } function init() { - getL10nStrings(); populateReportList(); } diff --git a/toolkit/crashreporter/content/oopcrashdialog.js b/toolkit/crashreporter/content/oopcrashdialog.js index 4de6ae47fdf4..0a830c80440b 100644 --- a/toolkit/crashreporter/content/oopcrashdialog.js +++ b/toolkit/crashreporter/content/oopcrashdialog.js @@ -1,14 +1,14 @@ // This code is TEMPORARY for submitting crashes via an ugly popup dialog: // bug 525849 tracks the real implementation. +const Cc = Components.classes; +const Ci = Components.interfaces; + +Components.utils.import("resource://gre/modules/CrashSubmit.jsm"); + var id; function collectData() { - // HACK: crashes.js uses document.body, so we just alias it - document.body = document.getElementById('iframe-holder'); - - getL10nStrings(); - let directoryService = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); pendingDir = directoryService.get("UAppData", Ci.nsIFile); @@ -31,11 +31,18 @@ function collectData() { extraFile.moveTo(pendingDir, ""); } +function submitDone() +{ + // we don't currently distinguish between success or failure here + window.close(); +} + function onSubmit() { document.documentElement.getButton('accept').disabled = true; document.documentElement.getButton('accept').label = 'Sending'; document.getElementById('throbber').src = 'chrome://global/skin/icons/loading_16.png'; - createAndSubmitForm(id, null); + CrashSubmit.submit(id, document.getElementById('iframe-holder'), + submitDone, submitDone); return false; } diff --git a/toolkit/crashreporter/content/oopcrashdialog.xul b/toolkit/crashreporter/content/oopcrashdialog.xul index 4180d30edf5e..6bb8f1bd9da5 100644 --- a/toolkit/crashreporter/content/oopcrashdialog.xul +++ b/toolkit/crashreporter/content/oopcrashdialog.xul @@ -17,7 +17,6 @@ } - + + + diff --git a/toolkit/crashreporter/content/oopcrashdialog.js b/toolkit/crashreporter/content/oopcrashdialog.js index 0a830c80440b..b0be226734cf 100644 --- a/toolkit/crashreporter/content/oopcrashdialog.js +++ b/toolkit/crashreporter/content/oopcrashdialog.js @@ -11,24 +11,9 @@ var id; function collectData() { let directoryService = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); - pendingDir = directoryService.get("UAppData", Ci.nsIFile); - pendingDir.append("Crash Reports"); - pendingDir.append("pending"); - if (!pendingDir.exists()) - pendingDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0770); - - reportsDir = directoryService.get("UAppData", Ci.nsIFile); - reportsDir.append("Crash Reports"); - reportsDir.append("submitted"); - if (!reportsDir.exists()) - reportsDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0770); let dumpFile = window.arguments[0].QueryInterface(Ci.nsIFile); - let extraFile = dumpFile.clone(); id = dumpFile.leafName.replace(/.dmp$/, ""); - extraFile.leafName = id + ".extra"; - dumpFile.moveTo(pendingDir, ""); - extraFile.moveTo(pendingDir, ""); } function submitDone() diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index f11e5afb9568..1f53871f0a55 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -975,10 +975,6 @@ public: SubmitCrashReport(nsIFile* dumpFile) : mDumpFile(dumpFile) { } NS_IMETHOD Run() { - char* e = getenv("MOZ_CRASHREPORTER_NO_REPORT"); - if (e && *e) - return NS_OK; - nsCOMPtr windowWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID); nsCOMPtr newWindow; @@ -1025,6 +1021,25 @@ static PLDHashOperator EnumerateChildAnnotations(const nsACString& key, return PL_DHASH_NEXT; } +static bool +MoveToPending(nsIFile* dumpFile, nsIFile* extraFile) +{ + nsCOMPtr dirSvc + = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); + if (!dirSvc) + return false; + nsCOMPtr pendingDir; + if (NS_FAILED(dirSvc->Get("UAppData", + NS_GET_IID(nsILocalFile), + getter_AddRefs(pendingDir))) || + NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("Crash Reports"))) || + NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("pending")))) + return false; + + return NS_FAILED(dumpFile->MoveTo(pendingDir, EmptyString())) || + NS_FAILED(extraFile->MoveTo(pendingDir, EmptyString())); +} + static void OnChildProcessDumpRequested(void* aContext, const ClientInfo* aClientInfo, @@ -1084,13 +1099,23 @@ OnChildProcessDumpRequested(void* aContext, stream->Write("\n", 1, &written); stream->Close(); + bool doReport = true; + char* e = getenv("MOZ_CRASHREPORTER_NO_REPORT"); + if (e && *e) + doReport = false; + + if (doReport) + MoveToPending(lf, extraFile); + { MutexAutoLock lock(*dumpMapLock); pidToMinidump->Put(pid, lf); } - nsCOMPtr r = new SubmitCrashReport(lf); - NS_DispatchToMainThread(r); + if (doReport) { + nsCOMPtr r = new SubmitCrashReport(lf); + NS_DispatchToMainThread(r); + } } static bool From 3e1253bd35436a8e18fd3349b832a3d727d6a54a Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 24/31] Bug 541594 - extend nsIINIParser to allow writing INI files. p=dolske+benjamin, r=benjamin, r=dolske --- js/src/xpconnect/loader/XPCOMUtils.jsm | 23 +++ xpcom/ds/Makefile.in | 4 + xpcom/ds/nsIINIParser.idl | 14 ++ xpcom/ds/nsINIProcessor.js | 209 ++++++++++++++++++++++++ xpcom/glue/nsCRTGlue.cpp | 2 +- xpcom/glue/nsINIParser.cpp | 42 ++--- xpcom/tests/unit/data/iniparser01.ini | 0 xpcom/tests/unit/data/iniparser02.ini | 1 + xpcom/tests/unit/data/iniparser03.ini | 1 + xpcom/tests/unit/data/iniparser04.ini | 1 + xpcom/tests/unit/data/iniparser05.ini | 1 + xpcom/tests/unit/data/iniparser06.ini | 2 + xpcom/tests/unit/data/iniparser07.ini | 2 + xpcom/tests/unit/data/iniparser08.ini | 2 + xpcom/tests/unit/data/iniparser09.ini | 2 + xpcom/tests/unit/data/iniparser10.ini | 3 + xpcom/tests/unit/data/iniparser11.ini | 3 + xpcom/tests/unit/data/iniparser12.ini | 3 + xpcom/tests/unit/data/iniparser13.ini | 3 + xpcom/tests/unit/data/iniparser14.ini | 6 + xpcom/tests/unit/data/iniparser15.ini | 6 + xpcom/tests/unit/test_iniProcessor.js | 211 +++++++++++++++++++++++++ 22 files changed, 520 insertions(+), 21 deletions(-) create mode 100644 xpcom/ds/nsINIProcessor.js create mode 100644 xpcom/tests/unit/data/iniparser01.ini create mode 100644 xpcom/tests/unit/data/iniparser02.ini create mode 100644 xpcom/tests/unit/data/iniparser03.ini create mode 100644 xpcom/tests/unit/data/iniparser04.ini create mode 100644 xpcom/tests/unit/data/iniparser05.ini create mode 100644 xpcom/tests/unit/data/iniparser06.ini create mode 100644 xpcom/tests/unit/data/iniparser07.ini create mode 100644 xpcom/tests/unit/data/iniparser08.ini create mode 100644 xpcom/tests/unit/data/iniparser09.ini create mode 100644 xpcom/tests/unit/data/iniparser10.ini create mode 100644 xpcom/tests/unit/data/iniparser11.ini create mode 100644 xpcom/tests/unit/data/iniparser12.ini create mode 100644 xpcom/tests/unit/data/iniparser13.ini create mode 100644 xpcom/tests/unit/data/iniparser14.ini create mode 100644 xpcom/tests/unit/data/iniparser15.ini create mode 100644 xpcom/tests/unit/test_iniProcessor.js diff --git a/js/src/xpconnect/loader/XPCOMUtils.jsm b/js/src/xpconnect/loader/XPCOMUtils.jsm index ac94054c42b0..2d5467e1acfc 100644 --- a/js/src/xpconnect/loader/XPCOMUtils.jsm +++ b/js/src/xpconnect/loader/XPCOMUtils.jsm @@ -281,6 +281,28 @@ var XPCOMUtils = { .getService(Ci.nsICategoryManager); }, + /** + * Helper which iterates over a nsISimpleEnumerator. + * @param e The nsISimpleEnumerator to iterate over. + * @param i The expected interface for each element. + */ + IterSimpleEnumerator: function XPCU_IterSimpleEnumerator(e, i) + { + while (e.hasMoreElements()) + yield e.getNext().QueryInterface(i); + }, + + /** + * Helper which iterates over a string enumerator. + * @param e The string enumerator (nsIUTF8StringEnumerator or + * nsIStringEnumerator) over which to iterate. + */ + IterStringEnumerator: function XPCU_IterStringEnumerator(e) + { + while (e.hasMore()) + yield e.getNext(); + }, + /** * Returns an nsIFactory for |component|. */ @@ -314,3 +336,4 @@ function makeQI(interfaceNames) { throw Cr.NS_ERROR_NO_INTERFACE; }; } + diff --git a/xpcom/ds/Makefile.in b/xpcom/ds/Makefile.in index aca2b4b18d12..b27fe3af6bb7 100644 --- a/xpcom/ds/Makefile.in +++ b/xpcom/ds/Makefile.in @@ -154,6 +154,10 @@ XPIDLSRCS += nsIWindowsRegKey.idl EXPORTS += nsWindowsRegKey.h endif +EXTRA_COMPONENTS = \ + nsINIProcessor.js \ + $(NULL) + # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 diff --git a/xpcom/ds/nsIINIParser.idl b/xpcom/ds/nsIINIParser.idl index fd3e38920a5c..884719a1cdea 100644 --- a/xpcom/ds/nsIINIParser.idl +++ b/xpcom/ds/nsIINIParser.idl @@ -59,6 +59,20 @@ interface nsIINIParser : nsISupports AUTF8String getString(in AUTF8String aSection, in AUTF8String aKey); }; +[scriptable, uuid(712dc5da-8d09-45d0-ba2e-de27eb384c4c)] +interface nsIINIParserWriter : nsISupports +{ + /** + * Set the value of a string for a particular section and key. + */ + void setString(in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue); + + /** + * Write to the INI file. + */ + void writeFile([optional] in nsILocalFile aINIFile); +}; + [scriptable, uuid(ccae7ea5-1218-4b51-aecb-c2d8ecd46af9)] interface nsIINIParserFactory : nsISupports { diff --git a/xpcom/ds/nsINIProcessor.js b/xpcom/ds/nsINIProcessor.js new file mode 100644 index 000000000000..9e38d381321f --- /dev/null +++ b/xpcom/ds/nsINIProcessor.js @@ -0,0 +1,209 @@ +/* ***** 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.org code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Justin Dolske (original 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 ***** */ + + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cr = Components.results; +const Cu = Components.utils; + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + +function INIProcessorFactory() { +} + +INIProcessorFactory.prototype = { + classDescription: "INIProcessorFactory", + contractID: "@mozilla.org/xpcom/ini-processor-factory;1", + classID: Components.ID("{6ec5f479-8e13-4403-b6ca-fe4c2dca14fd}"), + QueryInterface : XPCOMUtils.generateQI([Ci.nsIINIParserFactory]), + + createINIParser : function (aINIFile) { + return new INIProcessor(aINIFile); + } + +}; // end of INIProcessorFactory implementation + +const MODE_WRONLY = 0x02; +const MODE_CREATE = 0x08; +const MODE_TRUNCATE = 0x20; + +// nsIINIParser implementation +function INIProcessor(aFile) { + this._iniFile = aFile; + this._iniData = {}; + this._readFile(); +} + +INIProcessor.prototype = { + QueryInterface : XPCOMUtils.generateQI([Ci.nsIINIParser, Ci.nsIINIParserWriter]), + + __utfConverter : null, // UCS2 <--> UTF8 string conversion + get _utfConverter() { + if (!this.__utfConverter) { + this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]. + createInstance(Ci.nsIScriptableUnicodeConverter); + this.__utfConverter.charset = "UTF-8"; + } + return this.__utfConverter; + }, + + _utfConverterReset : function() { + this.__utfConverter = null; + }, + + _iniFile : null, + _iniData : null, + + /* + * Reads the INI file and stores the data internally. + */ + _readFile : function() { + // If file doesn't exist, there's nothing to do. + if (!this._iniFile.exists() || 0 == this._iniFile.fileSize) + return; + + let iniParser = Cc["@mozilla.org/xpcom/ini-parser-factory;1"] + .getService(Ci.nsIINIParserFactory).createINIParser(this._iniFile); + for (let section in XPCOMUtils.IterStringEnumerator(iniParser.getSections())) { + this._iniData[section] = {}; + for (let key in XPCOMUtils.IterStringEnumerator(iniParser.getKeys(section))) { + this._iniData[section][key] = iniParser.getString(section, key); + } + } + }, + + // nsIINIParser + + getSections : function() { + let sections = []; + for (let section in this._iniData) + sections.push(section); + return new stringEnumerator(sections); + }, + + getKeys : function(aSection) { + let keys = []; + if (aSection in this._iniData) + for (let key in this._iniData[aSection]) + keys.push(key); + return new stringEnumerator(keys); + }, + + getString : function(aSection, aKey) { + if (!(aSection in this._iniData)) + throw Cr.NS_ERROR_FAILURE; + if (!(aKey in this._iniData[aSection])) + throw Cr.NS_ERROR_FAILURE; + return this._iniData[aSection][aKey]; + }, + + + // nsIINIParserWriter + + setString : function(aSection, aKey, aValue) { + const isSectionIllegal = /[\0\r\n\[\]]/; + const isKeyValIllegal = /[\0\r\n=]/; + + if (isSectionIllegal.test(aSection)) + throw Components.Exception("bad character in section name", + Cr.ERROR_ILLEGAL_VALUE); + if (isKeyValIllegal.test(aKey) || isKeyValIllegal.test(aValue)) + throw Components.Exception("bad character in key/value", + Cr.ERROR_ILLEGAL_VALUE); + + if (!(aSection in this._iniData)) + this._iniData[aSection] = {}; + + this._iniData[aSection][aKey] = aValue; + }, + + writeFile : function(aFile) { + + let converter = this._utfConverter; + function writeLine(data) { + data = converter.ConvertFromUnicode(data); + data += converter.Finish(); + data += "\n"; + outputStream.write(data, data.length); + } + + if (!aFile) + aFile = this._iniFile; + + let safeStream = Cc["@mozilla.org/network/safe-file-output-stream;1"]. + createInstance(Ci.nsIFileOutputStream); + safeStream.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, + 0600, null); + + var outputStream = Cc["@mozilla.org/network/buffered-output-stream;1"]. + createInstance(Ci.nsIBufferedOutputStream); + outputStream.init(safeStream, 8192); + outputStream.QueryInterface(Ci.nsISafeOutputStream); // for .finish() + + for (let section in this._iniData) { + writeLine("[" + section + "]"); + for (let key in this._iniData[section]) { + writeLine(key + "=" + this._iniData[section][key]); + } + } + + outputStream.finish(); + } +}; + +function stringEnumerator(stringArray) { + this._strings = stringArray; +} +stringEnumerator.prototype = { + QueryInterface : XPCOMUtils.generateQI([Ci.nsIUTF8StringEnumerator]), + + _strings : null, + _enumIndex: 0, + + hasMore : function() { + return (this._enumIndex < this._strings.length); + }, + + getNext : function() { + return this._strings[this._enumIndex++]; + } +}; + +let component = [INIProcessorFactory]; +function NSGetModule (compMgr, fileSpec) { + return XPCOMUtils.generateModule(component); +} diff --git a/xpcom/glue/nsCRTGlue.cpp b/xpcom/glue/nsCRTGlue.cpp index 5baf337188a0..134dee0b66a7 100644 --- a/xpcom/glue/nsCRTGlue.cpp +++ b/xpcom/glue/nsCRTGlue.cpp @@ -91,7 +91,7 @@ NS_strtok(const char *delims, char **str) } while (*i); *str = NULL; - return ret; + return NULL; } PRUint32 diff --git a/xpcom/glue/nsINIParser.cpp b/xpcom/glue/nsINIParser.cpp index c6a37d937574..f86bcea196e7 100644 --- a/xpcom/glue/nsINIParser.cpp +++ b/xpcom/glue/nsINIParser.cpp @@ -163,7 +163,6 @@ nsINIParser::InitFromFILE(FILE *fd) char *buffer = mFileContents; char *currSection = nsnull; - INIValue *last = nsnull; // outer loop tokenizes into lines while (char *token = NS_strtok(kNL, &buffer)) { @@ -177,7 +176,6 @@ nsINIParser::InitFromFILE(FILE *fd) if (token[0] == '[') { // section header! ++token; currSection = token; - last = nsnull; char *rb = NS_strtok(kRBracket, &token); if (!rb || NS_strtok(kWhitespace, &token)) { @@ -202,28 +200,32 @@ nsINIParser::InitFromFILE(FILE *fd) if (!e) continue; - INIValue *val = new INIValue(key, token); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; + INIValue *v; + if (!mSections.Get(currSection, &v)) { + v = new INIValue(key, token); + if (!v) + return NS_ERROR_OUT_OF_MEMORY; - // If we haven't already added something to this section, "last" will - // be null. - if (!last) { - mSections.Get(currSection, &last); - while (last && last->next) - last = last->next; - } - - if (last) { - // Add this element on to the tail of the existing list - - last->next = val; - last = val; + mSections.Put(currSection, v); continue; } - // We've never encountered this section before, add it to the head - mSections.Put(currSection, val); + // Check whether this key has already been specified; overwrite + // if so, or append if not. + while (v) { + if (!strcmp(key, v->key)) { + v->value = token; + break; + } + if (!v->next) { + v->next = new INIValue(key, token); + if (!v->next) + return NS_ERROR_OUT_OF_MEMORY; + break; + } + v = v->next; + } + NS_ASSERTION(v, "v should never be null coming out of this loop"); } return NS_OK; diff --git a/xpcom/tests/unit/data/iniparser01.ini b/xpcom/tests/unit/data/iniparser01.ini new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/xpcom/tests/unit/data/iniparser02.ini b/xpcom/tests/unit/data/iniparser02.ini new file mode 100644 index 000000000000..d3f5a12faa99 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser02.ini @@ -0,0 +1 @@ + diff --git a/xpcom/tests/unit/data/iniparser03.ini b/xpcom/tests/unit/data/iniparser03.ini new file mode 100644 index 000000000000..60b0742537a3 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser03.ini @@ -0,0 +1 @@ +[] diff --git a/xpcom/tests/unit/data/iniparser04.ini b/xpcom/tests/unit/data/iniparser04.ini new file mode 100644 index 000000000000..23a50d155f56 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser04.ini @@ -0,0 +1 @@ +[section1] diff --git a/xpcom/tests/unit/data/iniparser05.ini b/xpcom/tests/unit/data/iniparser05.ini new file mode 100644 index 000000000000..ade13733774b --- /dev/null +++ b/xpcom/tests/unit/data/iniparser05.ini @@ -0,0 +1 @@ +[section1]junk diff --git a/xpcom/tests/unit/data/iniparser06.ini b/xpcom/tests/unit/data/iniparser06.ini new file mode 100644 index 000000000000..c24821e6ed52 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser06.ini @@ -0,0 +1,2 @@ +[section1] + diff --git a/xpcom/tests/unit/data/iniparser07.ini b/xpcom/tests/unit/data/iniparser07.ini new file mode 100644 index 000000000000..49816873b2e7 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser07.ini @@ -0,0 +1,2 @@ +[section1] +name1 diff --git a/xpcom/tests/unit/data/iniparser08.ini b/xpcom/tests/unit/data/iniparser08.ini new file mode 100644 index 000000000000..cfa15c9ffec3 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser08.ini @@ -0,0 +1,2 @@ +[section1] +name1= diff --git a/xpcom/tests/unit/data/iniparser09.ini b/xpcom/tests/unit/data/iniparser09.ini new file mode 100644 index 000000000000..1c87762ba436 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser09.ini @@ -0,0 +1,2 @@ +[section1] +name1=value1 diff --git a/xpcom/tests/unit/data/iniparser10.ini b/xpcom/tests/unit/data/iniparser10.ini new file mode 100644 index 000000000000..037fd793039f --- /dev/null +++ b/xpcom/tests/unit/data/iniparser10.ini @@ -0,0 +1,3 @@ + +[section1] +name1=value1 diff --git a/xpcom/tests/unit/data/iniparser11.ini b/xpcom/tests/unit/data/iniparser11.ini new file mode 100644 index 000000000000..f8d573a284f2 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser11.ini @@ -0,0 +1,3 @@ +# comment +[section1] +name1=value1 diff --git a/xpcom/tests/unit/data/iniparser12.ini b/xpcom/tests/unit/data/iniparser12.ini new file mode 100644 index 000000000000..2727940c097a --- /dev/null +++ b/xpcom/tests/unit/data/iniparser12.ini @@ -0,0 +1,3 @@ +[section1] +# [sectionBAD] +name1=value1 diff --git a/xpcom/tests/unit/data/iniparser13.ini b/xpcom/tests/unit/data/iniparser13.ini new file mode 100644 index 000000000000..21d40b140cde --- /dev/null +++ b/xpcom/tests/unit/data/iniparser13.ini @@ -0,0 +1,3 @@ +[section1] +name1=value1 +# nameBAD=valueBAD diff --git a/xpcom/tests/unit/data/iniparser14.ini b/xpcom/tests/unit/data/iniparser14.ini new file mode 100644 index 000000000000..744af4cb65ea --- /dev/null +++ b/xpcom/tests/unit/data/iniparser14.ini @@ -0,0 +1,6 @@ +[section1] +name1=value1 +name2=value2 +[section2] +name1=value1 +name2=foopy diff --git a/xpcom/tests/unit/data/iniparser15.ini b/xpcom/tests/unit/data/iniparser15.ini new file mode 100644 index 000000000000..608a27d8fb36 --- /dev/null +++ b/xpcom/tests/unit/data/iniparser15.ini @@ -0,0 +1,6 @@ +[section1] +name1=value1 +[section2] +name1=foopy +[section1] +name1=newValue1 diff --git a/xpcom/tests/unit/test_iniProcessor.js b/xpcom/tests/unit/test_iniProcessor.js new file mode 100644 index 000000000000..41dea378a171 --- /dev/null +++ b/xpcom/tests/unit/test_iniProcessor.js @@ -0,0 +1,211 @@ +const Ci = Components.interfaces; +const Cc = Components.classes; +const Cr = Components.results; + +let testnum = 0; +let factory; + +function parserForFile(filename) { + let parser = null; + try { + let file = do_get_file(filename); + do_check_true(!!file); + parser = factory.createINIParser(file); + do_check_true(!!parser); + } catch(e) { + dump("INFO | caught error: " + e); + // checkParserOutput will handle a null parser when it's expected. + } + return parser; + +} + +function checkParserOutput(parser, expected) { + // If the expected output is null, we expect the parser to have + // failed (and vice-versa). + if (!parser || !expected) { + do_check_eq(parser, null); + do_check_eq(expected, null); + return; + } + + let output = getParserOutput(parser); + for (let section in expected) { + do_check_true(section in output); + for (let key in expected[section]) { + do_check_true(key in output[section]); + do_check_eq(output[section][key], expected[section][key]); + delete output[section][key]; + } + for (let key in output[section]) + do_check_eq(key, "wasn't expecting this key!"); + delete output[section]; + } + for (let section in output) + do_check_eq(section, "wasn't expecting this section!"); +} + +function getParserOutput(parser) { + let output = {}; + + let sections = parser.getSections(); + do_check_true(!!sections); + while (sections.hasMore()) { + let section = sections.getNext(); + do_check_false(section in output); // catch dupes + output[section] = {}; + + let keys = parser.getKeys(section); + do_check_true(!!keys); + while (keys.hasMore()) { + let key = keys.getNext(); + do_check_false(key in output[section]); // catch dupes + let value = parser.getString(section, key); + output[section][key] = value; + } + } + return output; +} + +function run_test() { +try { + +let testdata = [ + { filename: "data/iniparser01.ini", reference: {} }, + { filename: "data/iniparser02.ini", reference: {} }, + { filename: "data/iniparser03.ini", reference: {} }, + { filename: "data/iniparser04.ini", reference: {} }, + { filename: "data/iniparser05.ini", reference: {} }, + { filename: "data/iniparser06.ini", reference: {} }, + { filename: "data/iniparser07.ini", reference: {} }, + { filename: "data/iniparser08.ini", reference: { section1: { name1: "" }} }, + { filename: "data/iniparser09.ini", reference: { section1: { name1: "value1" } } }, + { filename: "data/iniparser10.ini", reference: { section1: { name1: "value1" } } }, + { filename: "data/iniparser11.ini", reference: { section1: { name1: "value1" } } }, + { filename: "data/iniparser12.ini", reference: { section1: { name1: "value1" } } }, + { filename: "data/iniparser13.ini", reference: { section1: { name1: "value1" } } }, + { filename: "data/iniparser14.ini", reference: + { section1: { name1: "value1", name2: "value2" }, + section2: { name1: "value1", name2: "foopy" }} }, + { filename: "data/iniparser15.ini", reference: + { section1: { name1: "newValue1" }, + section2: { name1: "foopy" }} }, + ]; + +/* ========== 0 ========== */ +factory = Cc["@mozilla.org/xpcom/ini-processor-factory;1"]. + getService(Ci.nsIINIParserFactory); +do_check_true(!!factory); + +/* ========== 1 - 15 ========== */ + +// Test reading from a variety of files. While we're at it, write out each one +// and read it back to ensure that nothing changed. +for (testnum = 1; testnum <= 15; testnum++) { + let filename = testdata[testnum -1].filename; + dump("INFO | test #" + testnum + ", filename " + filename + "\n"); + let parser = parserForFile(filename); + checkParserOutput(parser, testdata[testnum - 1].reference); + if (!parser) + continue; + do_check_true(parser instanceof Ci.nsIINIParserWriter); + // write contents out to a new file + let newfilename = filename + ".new"; + let newfile = do_get_file(filename); + newfile.leafName += ".new"; + parser.writeFile(newfile); + // read new file and make sure the contents are the same. + parser = parserForFile(newfilename); + checkParserOutput(parser, testdata[testnum - 1].reference); +} + +/* ========== 16 ========== */ + +// test writing to a new file. +let newfile = do_get_file("data/"); +newfile.append("non-existant-file.ini"); +if (newfile.exists()) + newfile.remove(false); +do_check_false(newfile.exists()); + +let parser = factory.createINIParser(newfile); +do_check_true(!!parser); +do_check_true(parser instanceof Ci.nsIINIParserWriter); +checkParserOutput(parser, {}); +parser.writeFile(); +do_check_true(newfile.exists()); + +// test adding a new section and new key +parser.setString("section", "key", "value"); +parser.writeFile(); +do_check_true(newfile.exists()); +checkParserOutput(parser, {section: {key: "value"} }); +// read it in again, check for same data. +parser = parserForFile("data/non-existant-file.ini"); +checkParserOutput(parser, {section: {key: "value"} }); + +/* ========== 17 ========== */ + +// test modifying a existing key's value (in an existing section) +parser = parserForFile("data/iniparser09.ini"); +checkParserOutput(parser, {section1: {name1: "value1"} }); + +do_check_true(parser instanceof Ci.nsIINIParserWriter); +parser.setString("section1", "name1", "value2"); +checkParserOutput(parser, {section1: {name1: "value2"} }); + +/* ========== 18 ========== */ + +// test trying to set illegal characters +let caughtError; +caughtError = false; +checkParserOutput(parser, {section1: {name1: "value2"} }); + +// Bad characters in section name +try { parser.SetString("bad\0", "ok", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("bad\r", "ok", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("bad\n", "ok", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("bad[", "ok", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("bad]", "ok", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); + +// Bad characters in key name +caughtError = false; +try { parser.SetString("ok", "bad\0", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "bad\r", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "bad\n", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "bad=", "ok"); } catch (e) { caughtError = true; } +do_check_true(caughtError); + +// Bad characters in value +caughtError = false; +try { parser.SetString("ok", "ok", "bad\0"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "ok", "bad\r"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "ok", "bad\n"); } catch (e) { caughtError = true; } +do_check_true(caughtError); +caughtError = false; +try { parser.SetString("ok", "ok", "bad="); } catch (e) { caughtError = true; } +do_check_true(caughtError); + +} catch(e) { + throw "FAILED in test #" + testnum + " -- " + e; +} +} From efed813bd9d9099b888b4fc9491403f0786eed24 Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 25/31] Bug 540532 - allow setting report submission preference via XPCOM. r=gavin, r=ted --- browser/components/preferences/advanced.js | 32 ++++ browser/components/preferences/advanced.xul | 7 +- .../chrome/browser/preferences/advanced.dtd | 2 + .../client/crashreporter_linux.cpp | 10 + .../client/crashreporter_win.cpp | 8 + toolkit/crashreporter/nsExceptionHandler.cpp | 172 ++++++++++++++++++ toolkit/crashreporter/nsExceptionHandler.h | 2 + toolkit/xre/nsAppRunner.cpp | 13 ++ xpcom/system/nsICrashReporter.idl | 7 +- 9 files changed, 251 insertions(+), 2 deletions(-) diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js index 980a69b8a005..d13150fa4f4b 100644 --- a/browser/components/preferences/advanced.js +++ b/browser/components/preferences/advanced.js @@ -66,6 +66,9 @@ var gAdvancedPane = { this.updateModeItems(); #endif this.updateOfflineApps(); +#ifdef MOZ_CRASHREPORTER + this.initSubmitCrashes(); +#endif }, /** @@ -139,6 +142,35 @@ var gAdvancedPane = { return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0; }, + /** + * + */ + initSubmitCrashes: function () + { + var checkbox = document.getElementById("submitCrashesBox"); + try { + var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"]. + getService(Components.interfaces.nsICrashReporter); + checkbox.checked = cr.submitReports; + } catch (e) { + checkbox.style.display = "none"; + } + }, + + /** + * + */ + updateSubmitCrashes: function () + { + var checkbox = document.getElementById("submitCrashesBox"); + try { + var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"]. + getService(Components.interfaces.nsICrashReporter); + cr.submitReports = checkbox.checked; + } catch (e) { } + }, + + // NETWORK TAB /* diff --git a/browser/components/preferences/advanced.xul b/browser/components/preferences/advanced.xul index 8ea529675241..fc758706848a 100644 --- a/browser/components/preferences/advanced.xul +++ b/browser/components/preferences/advanced.xul @@ -184,7 +184,7 @@ #ifdef HAVE_SHELL_SERVICE - + @@ -196,6 +196,11 @@ oncommand="gAdvancedPane.checkNow()" preference="pref.general.disable_button.default_browser"/> +#ifdef MOZ_CRASHREPORTER + +#endif #endif diff --git a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd index 71210c46152e..3cf951cabd7f 100644 --- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd +++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd @@ -25,6 +25,8 @@ + + diff --git a/toolkit/crashreporter/client/crashreporter_linux.cpp b/toolkit/crashreporter/client/crashreporter_linux.cpp index 1adc262e687d..95062745747c 100644 --- a/toolkit/crashreporter/client/crashreporter_linux.cpp +++ b/toolkit/crashreporter/client/crashreporter_linux.cpp @@ -98,6 +98,11 @@ static const char kIniFile[] = "crashreporter.ini"; static void LoadSettings() { + /* + * NOTE! This code needs to stay in sync with the preference checking + * code in in nsExceptionHandler.cpp. + */ + StringTable settings; if (ReadStringsFromFile(gSettingsPath + "/" + kIniFile, settings, true)) { if (settings.find("Email") != settings.end()) { @@ -125,6 +130,11 @@ static void LoadSettings() static void SaveSettings() { + /* + * NOTE! This code needs to stay in sync with the preference setting + * code in in nsExceptionHandler.cpp. + */ + StringTable settings; ReadStringsFromFile(gSettingsPath + "/" + kIniFile, settings, true); diff --git a/toolkit/crashreporter/client/crashreporter_win.cpp b/toolkit/crashreporter/client/crashreporter_win.cpp index caccb402e8e7..f00c73537558 100644 --- a/toolkit/crashreporter/client/crashreporter_win.cpp +++ b/toolkit/crashreporter/client/crashreporter_win.cpp @@ -181,6 +181,10 @@ static bool CheckBoolKey(const wchar_t* key, const wchar_t* valueName, bool* enabled) { + /* + * NOTE! This code needs to stay in sync with the preference checking + * code in in nsExceptionHandler.cpp. + */ *enabled = false; bool found = false; HKEY hRegKey; @@ -208,6 +212,10 @@ static bool CheckBoolKey(const wchar_t* key, static void SetBoolKey(const wchar_t* key, const wchar_t* value, bool enabled) { + /* + * NOTE! This code needs to stay in sync with the preference setting + * code in in nsExceptionHandler.cpp. + */ HKEY hRegKey; // remove the old value from the registry if it exists diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 1f53871f0a55..18c11351abe3 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Josh Aas + * Justin Dolske * * 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 @@ -43,6 +44,7 @@ #undef WIN32_LEAN_AND_MEAN #endif +#include "nsIWindowsRegKey.h" #if defined(MOZ_IPC) # include "client/windows/crash_generation/crash_generation_server.h" #endif @@ -58,6 +60,9 @@ #include #include "mac_utils.h" #elif defined(XP_LINUX) +#include "nsDirectoryServiceUtils.h" +#include "nsDirectoryServiceDefs.h" +#include "nsIINIParser.h" #if defined(MOZ_IPC) # include "client/linux/crash_generation/client_info.h" # include "client/linux/crash_generation/crash_generation_server.h" @@ -88,6 +93,7 @@ #include "nsDataHashtable.h" #include "nsInterfaceHashtable.h" #include "prprf.h" +#include "nsIXULAppInfo.h" #if defined(MOZ_IPC) using google_breakpad::CrashGenerationServer; @@ -966,6 +972,172 @@ nsresult AppendObjCExceptionInfoToAppNotes(void *inException) } #endif +/* + * Combined code to get/set the crash reporter submission pref on + * different platforms. + */ +static nsresult PrefSubmitReports(PRBool* aSubmitReports, bool writePref) +{ + nsresult rv; +#if defined(XP_WIN32) + /* + * NOTE! This needs to stay in sync with the preference checking code + * in toolkit/crashreporter/client/crashreporter_win.cpp + */ + nsCOMPtr appinfo = + do_GetService("@mozilla.org/xre/app-info;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsCAutoString appVendor, appName; + rv = appinfo->GetVendor(appVendor); + NS_ENSURE_SUCCESS(rv, rv); + rv = appinfo->GetName(appName); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr regKey + (do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCAutoString regPath; + + regPath.AppendLiteral("Software\\"); + if(!appVendor.IsEmpty()) { + regPath.Append(appVendor); + regPath.AppendLiteral("\\"); + } + regPath.Append(appName); + regPath.AppendLiteral("\\Crash Reporter"); + + // If we're saving the pref value, just write it to ROOT_KEY_CURRENT_USER + // and we're done. + if (writePref) { + rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, + NS_ConvertUTF8toUTF16(regPath), + nsIWindowsRegKey::ACCESS_SET_VALUE); + NS_ENSURE_SUCCESS(rv, rv); + + PRUint32 value = *aSubmitReports ? 1 : 0; + rv = regKey->WriteIntValue(NS_LITERAL_STRING("SubmitCrashReport"), value); + regKey->Close(); + return rv; + } + + // We're reading the pref value, so we need to first look under + // ROOT_KEY_LOCAL_MACHINE to see if it's set there, and then fall back to + // ROOT_KEY_CURRENT_USER. If it's not set in either place, the pref defaults + // to "true". + PRUint32 value; + rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE, + NS_ConvertUTF8toUTF16(regPath), + nsIWindowsRegKey::ACCESS_QUERY_VALUE); + if (NS_SUCCEEDED(rv)) { + rv = regKey->ReadIntValue(NS_LITERAL_STRING("SubmitCrashReport"), &value); + regKey->Close(); + if (NS_SUCCEEDED(rv)) { + *aSubmitReports = !!value; + return NS_OK; + } + } + + rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, + NS_ConvertUTF8toUTF16(regPath), + nsIWindowsRegKey::ACCESS_QUERY_VALUE); + if (NS_FAILED(rv)) { + *aSubmitReports = PR_TRUE; + return NS_OK; + } + + rv = regKey->ReadIntValue(NS_LITERAL_STRING("SubmitCrashReport"), &value); + // default to true on failure + if (NS_FAILED(rv)) { + value = 1; + rv = NS_OK; + } + regKey->Close(); + + *aSubmitReports = !!value; + return NS_OK; +#elif defined(XP_UNIX) + /* + * NOTE! This needs to stay in sync with the preference checking code + * in toolkit/crashreporter/client/crashreporter_linux.cpp + */ + nsCOMPtr reporterINI; + rv = NS_GetSpecialDirectory("UAppData", getter_AddRefs(reporterINI)); + NS_ENSURE_SUCCESS(rv, rv); + reporterINI->AppendNative(NS_LITERAL_CSTRING("Crash Reports")); + reporterINI->AppendNative(NS_LITERAL_CSTRING("crashreporter.ini")); + + PRBool exists; + rv = reporterINI->Exists(&exists); + NS_ENSURE_SUCCESS(rv, rv); + if (!exists) { + if (!writePref) { + // If reading the pref, default to true if .ini doesn't exist. + *aSubmitReports = PR_TRUE; + return NS_OK; + } + // Create the file so the INI processor can write to it. + rv = reporterINI->Create(nsIFile::NORMAL_FILE_TYPE, 0600); + NS_ENSURE_SUCCESS(rv, rv); + } + + nsCOMPtr iniFactory = + do_GetService("@mozilla.org/xpcom/ini-processor-factory;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr localFile = do_QueryInterface(reporterINI); + NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE); + nsCOMPtr iniParser; + rv = iniFactory->CreateINIParser(localFile, + getter_AddRefs(iniParser)); + NS_ENSURE_SUCCESS(rv, rv); + + // If we're writing the pref, just set and we're done. + if (writePref) { + nsCOMPtr iniWriter = do_QueryInterface(iniParser); + NS_ENSURE_TRUE(iniWriter, NS_ERROR_FAILURE); + + rv = iniWriter->SetString(NS_LITERAL_CSTRING("Crash Reporter"), + NS_LITERAL_CSTRING("SubmitReport"), + *aSubmitReports ? NS_LITERAL_CSTRING("1") : + NS_LITERAL_CSTRING("0")); + NS_ENSURE_SUCCESS(rv, rv); + rv = iniWriter->WriteFile(NULL); + return rv; + } + + nsCAutoString submitReportValue; + rv = iniParser->GetString(NS_LITERAL_CSTRING("Crash Reporter"), + NS_LITERAL_CSTRING("SubmitReport"), + submitReportValue); + + // Default to "true" if the pref can't be found. + if (NS_FAILED(rv)) + *aSubmitReports = PR_TRUE; + else if (submitReportValue.EqualsASCII("0")) + *aSubmitReports = PR_FALSE; + else + *aSubmitReports = PR_TRUE; + + return NS_OK; +#else + // TODO: Implement for OSX (bug 542379) + return NS_ERROR_NOT_IMPLEMENTED; +#endif +} + +nsresult GetSubmitReports(PRBool* aSubmitReports) +{ + return PrefSubmitReports(aSubmitReports, false); +} + +nsresult SetSubmitReports(PRBool aSubmitReports) +{ + return PrefSubmitReports(&aSubmitReports, true); +} + + #if defined(MOZ_IPC) //----------------------------------------------------------------------------- // Out-of-process crash reporting API wrappers diff --git a/toolkit/crashreporter/nsExceptionHandler.h b/toolkit/crashreporter/nsExceptionHandler.h index baf698f58152..2258e70470c5 100644 --- a/toolkit/crashreporter/nsExceptionHandler.h +++ b/toolkit/crashreporter/nsExceptionHandler.h @@ -70,6 +70,8 @@ nsresult SetupExtraData(nsILocalFile* aAppDataDirectory, #ifdef XP_MACOSX nsresult AppendObjCExceptionInfoToAppNotes(void *inException); #endif +nsresult GetSubmitReports(PRBool* aSubmitReport); +nsresult SetSubmitReports(PRBool aSubmitReport); #ifdef MOZ_IPC // Out-of-process crash reporter API. diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 68782142ed1d..386930e00673 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -975,6 +975,19 @@ nsXULAppInfo::AppendObjCExceptionInfoToAppNotes(void* aException) return NS_ERROR_NOT_IMPLEMENTED; #endif } + +NS_IMETHODIMP +nsXULAppInfo::GetSubmitReports(PRBool* aEnabled) +{ + return CrashReporter::GetSubmitReports(aEnabled); +} + +NS_IMETHODIMP +nsXULAppInfo::SetSubmitReports(PRBool aEnabled) +{ + return CrashReporter::SetSubmitReports(aEnabled); +} + #endif static const nsXULAppInfo kAppInfo; diff --git a/xpcom/system/nsICrashReporter.idl b/xpcom/system/nsICrashReporter.idl index 683966c2dd38..171e16e70cf4 100644 --- a/xpcom/system/nsICrashReporter.idl +++ b/xpcom/system/nsICrashReporter.idl @@ -47,7 +47,7 @@ interface nsIURL; * future releases. */ -[scriptable, uuid(44650737-59f7-4c9b-adbe-2b6d4dfee86a)] +[scriptable, uuid(56761088-57ad-4f5c-bd61-f678c2807fe0)] interface nsICrashReporter : nsISupports { /** @@ -117,4 +117,9 @@ interface nsICrashReporter : nsISupports * @param aException NSException object to append note for */ [noscript] void appendObjCExceptionInfoToAppNotes(in voidPtr aException); + + /** + * User preference for submitting crash reports. + */ + attribute boolean submitReports; }; From 41a1ce46d1cb777e27c488955c1501cf27c60dc2 Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Tue, 9 Feb 2010 17:05:31 -0800 Subject: [PATCH 26/31] Bug 541755 - Add ability to remove notification bar without triggering animation. r=enn --- toolkit/content/widgets/notification.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/toolkit/content/widgets/notification.xml b/toolkit/content/widgets/notification.xml index 98c32286131d..cb9a2e91e2e7 100644 --- a/toolkit/content/widgets/notification.xml +++ b/toolkit/content/widgets/notification.xml @@ -141,10 +141,11 @@ + + @@ -204,6 +206,7 @@ + Date: Tue, 9 Feb 2010 17:05:32 -0800 Subject: [PATCH 27/31] Bug 539848 - Make in-content plugin problem UI look better. r=gavin --HG-- rename : toolkit/mozapps/plugins/content/missingPlugin.xml => toolkit/mozapps/plugins/content/pluginProblem.xml rename : toolkit/mozapps/plugins/content/missingPluginBinding.css => toolkit/mozapps/plugins/content/pluginProblemBinding.css rename : toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css => toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css rename : toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css => toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css --- browser/base/content/browser.js | 13 ++ toolkit/mozapps/jar.mn | 4 +- .../mozapps/plugins/content/missingPlugin.xml | 130 ------------------ .../mozapps/plugins/content/pluginProblem.xml | 62 +++++++++ ...inBinding.css => pluginProblemBinding.css} | 23 ++-- toolkit/mozapps/plugins/pluginGlue.js | 2 +- toolkit/themes/pinstripe/mozapps/jar.mn | 3 +- .../mozapps/plugins/backgroundStripes.png | Bin 0 -> 369 bytes .../mozapps/plugins/missingPlugin.css | 68 --------- .../mozapps/plugins/pluginProblem.css | 70 ++++++++++ toolkit/themes/winstripe/mozapps/jar.mn | 6 +- .../plugins/backgroundStripes-aero.png | Bin 0 -> 369 bytes .../mozapps/plugins/backgroundStripes.png | Bin 0 -> 369 bytes .../mozapps/plugins/missingPlugin.css | 68 --------- .../mozapps/plugins/pluginProblem.css | 70 ++++++++++ 15 files changed, 235 insertions(+), 284 deletions(-) delete mode 100644 toolkit/mozapps/plugins/content/missingPlugin.xml create mode 100644 toolkit/mozapps/plugins/content/pluginProblem.xml rename toolkit/mozapps/plugins/content/{missingPluginBinding.css => pluginProblemBinding.css} (76%) create mode 100644 toolkit/themes/pinstripe/mozapps/plugins/backgroundStripes.png delete mode 100644 toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css create mode 100644 toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css create mode 100644 toolkit/themes/winstripe/mozapps/plugins/backgroundStripes-aero.png create mode 100644 toolkit/themes/winstripe/mozapps/plugins/backgroundStripes.png delete mode 100644 toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css create mode 100644 toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ae3fe2267209..2f42e7ca17e3 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5994,6 +5994,8 @@ function getPluginInfo(pluginElement) var gMissingPluginInstaller = { installSinglePlugin: function (aEvent) { + if (!aEvent.isTrusted) + return; var missingPluginsArray = {}; var pluginInfo = getPluginInfo(aEvent.target); @@ -6009,6 +6011,8 @@ var gMissingPluginInstaller = { }, managePlugins: function (aEvent) { + if (!aEvent.isTrusted) + return; BrowserOpenAddonsMgr("plugins"); aEvent.stopPropagation(); }, @@ -6030,6 +6034,11 @@ var gMissingPluginInstaller = { aEvent.target.addEventListener("click", gMissingPluginInstaller.installSinglePlugin, true); + aEvent.target.addEventListener("keydown", + function(evt) { if (evt.keyCode == evt.DOM_VK_RETURN) + gMissingPluginInstaller.installSinglePlugin(evt) }, + true); + } let hideBarPrefName = aEvent.type == "PluginOutdated" ? @@ -6153,6 +6162,10 @@ var gMissingPluginInstaller = { aEvent.target.addEventListener("click", gMissingPluginInstaller.managePlugins, true); + aEvent.target.addEventListener("keydown", + function(evt) { if (evt.keyCode == evt.DOM_VK_RETURN) + gMissingPluginInstaller.managePlugins(evt) }, + true); }, refreshBrowser: function (aEvent) { diff --git a/toolkit/mozapps/jar.mn b/toolkit/mozapps/jar.mn index ca27decc9b45..31a26ada7157 100644 --- a/toolkit/mozapps/jar.mn +++ b/toolkit/mozapps/jar.mn @@ -19,8 +19,8 @@ toolkit.jar: content/mozapps/plugins/pluginInstallerWizard.css (plugins/content/pluginInstallerWizard.css) content/mozapps/plugins/pluginInstallerDatasource.js (plugins/content/pluginInstallerDatasource.js) content/mozapps/plugins/pluginInstallerService.js (plugins/content/pluginInstallerService.js) - content/mozapps/plugins/missingPlugin.xml (plugins/content/missingPlugin.xml) - content/mozapps/plugins/missingPluginBinding.css (plugins/content/missingPluginBinding.css) + content/mozapps/plugins/pluginProblem.xml (plugins/content/pluginProblem.xml) + content/mozapps/plugins/pluginProblemBinding.css (plugins/content/pluginProblemBinding.css) content/mozapps/handling/handler.css (handling/content/handler.css) content/mozapps/handling/handler.xml (handling/content/handler.xml) content/mozapps/handling/dialog.xul (handling/content/dialog.xul) diff --git a/toolkit/mozapps/plugins/content/missingPlugin.xml b/toolkit/mozapps/plugins/content/missingPlugin.xml deleted file mode 100644 index a3dfeb12cd8d..000000000000 --- a/toolkit/mozapps/plugins/content/missingPlugin.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - &missingPlugin.label; - - - - - - - - - - - - - - - - - - - - - - - - - &disabledPlugin.label; - - - - - - - - - - - - - - - - - - - - - - - - &blockedPlugin.label; - - - - - - - - - diff --git a/toolkit/mozapps/plugins/content/pluginProblem.xml b/toolkit/mozapps/plugins/content/pluginProblem.xml new file mode 100644 index 000000000000..05a5bf08e72d --- /dev/null +++ b/toolkit/mozapps/plugins/content/pluginProblem.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + &missingPlugin.label; + &disabledPlugin.label; + &blockedPlugin.label; + + + + + + diff --git a/toolkit/mozapps/plugins/content/missingPluginBinding.css b/toolkit/mozapps/plugins/content/pluginProblemBinding.css similarity index 76% rename from toolkit/mozapps/plugins/content/missingPluginBinding.css rename to toolkit/mozapps/plugins/content/pluginProblemBinding.css index 62c11695832e..0e3fe5cb4c99 100644 --- a/toolkit/mozapps/plugins/content/missingPluginBinding.css +++ b/toolkit/mozapps/plugins/content/pluginProblemBinding.css @@ -20,6 +20,8 @@ * * Contributor(s): * + * Justin Dolske + * * 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"), @@ -36,17 +38,14 @@ @namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */ -embed:-moz-type-unsupported, applet:-moz-type-unsupported, -object:-moz-has-handlerref:-moz-type-unsupported { - -moz-binding: url('chrome://mozapps/content/plugins/missingPlugin.xml#missingPlugin') !important; -} - -embed:-moz-handler-disabled, applet:-moz-handler-disabled, -object:-moz-has-handlerref:-moz-handler-disabled { - -moz-binding: url('chrome://mozapps/content/plugins/missingPlugin.xml#disabledPlugin') !important; -} - -embed:-moz-handler-blocked, applet:-moz-handler-blocked, +embed:-moz-type-unsupported, +embed:-moz-handler-disabled, +embed:-moz-handler-blocked, +applet:-moz-type-unsupported, +applet:-moz-handler-disabled, +applet:-moz-handler-blocked, +object:-moz-has-handlerref:-moz-type-unsupported, +object:-moz-has-handlerref:-moz-handler-disabled, object:-moz-has-handlerref:-moz-handler-blocked { - -moz-binding: url('chrome://mozapps/content/plugins/missingPlugin.xml#blockedPlugin') !important; + -moz-binding: url('chrome://mozapps/content/plugins/pluginProblem.xml#pluginProblem') !important; } diff --git a/toolkit/mozapps/plugins/pluginGlue.js b/toolkit/mozapps/plugins/pluginGlue.js index 8a43a5090886..f5681d838774 100644 --- a/toolkit/mozapps/plugins/pluginGlue.js +++ b/toolkit/mozapps/plugins/pluginGlue.js @@ -43,7 +43,7 @@ var module = { categoryEntry: "pluginfinder xbl binding", - categoryValue: "chrome://mozapps/content/plugins/missingPluginBinding.css", + categoryValue: "chrome://mozapps/content/plugins/pluginProblemBinding.css", // registerSelf: Register this component. registerSelf: function (compMgr, fileSpec, location, type) { diff --git a/toolkit/themes/pinstripe/mozapps/jar.mn b/toolkit/themes/pinstripe/mozapps/jar.mn index be444ab249fb..c009e8f73115 100644 --- a/toolkit/themes/pinstripe/mozapps/jar.mn +++ b/toolkit/themes/pinstripe/mozapps/jar.mn @@ -19,7 +19,8 @@ toolkit.jar: skin/classic/mozapps/extensions/eula.css (extensions/eula.css) skin/classic/mozapps/extensions/blocklist.css (extensions/blocklist.css) skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png) - skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css) + skin/classic/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css) + skin/classic/mozapps/plugins/backgroundStripes.png (plugins/backgroundStripes.png) skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png) skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png) skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png) diff --git a/toolkit/themes/pinstripe/mozapps/plugins/backgroundStripes.png b/toolkit/themes/pinstripe/mozapps/plugins/backgroundStripes.png new file mode 100644 index 0000000000000000000000000000000000000000..fca1c022890568daff0997c842f0770fd1b1a03b GIT binary patch literal 369 zcmV-%0gnEOP)d|**gw{KoA2^5^*u^pCeI3n*s?zV0W31?R7Ps_2hD1 z%d&i?gv|4t&^k@;jMgmdx~}oyOl%o9bm44lC>Q}721db#fRV87U^J{N7!m6RM#Z{- zk+J4rbgU_u0c!?k!J2@Xu#drP*hgSSY&Vz{+XZIEHiOx*O<)CVHCP2(1y;h|g4M8> zU`6a-uqyTxtc*Q?)v-J92-pog3ibyc3A-&^j>wcRUPj8eq0h8}%*2-dP;fRj6pVlk z1EXL=z(`nkFdEhsjEHpuqheja$XIhQI@T1-fHecNU`@bG*vDWt>?1HEwj0cf?E*7n zo5AeZCa?mw8mxk?0xMx}!D`q`up;&^SQUE;R>mH{>ewB41ndSL1zW&h$>*~Z3}zD6 P00000NkvXXu0mjfkC2n+ literal 0 HcmV?d00001 diff --git a/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css b/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css deleted file mode 100644 index b4b3ae3b8a90..000000000000 --- a/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file's style only applies to broken objects, not the rest - * of the page. - */ - -@namespace html url(http://www.w3.org/1999/xhtml); - -html|object:not([width]), html|object[width=""], -html|embed:not([width]), html|embed[width=""], -html|applet:not([width]), html|applet[width=""] { - width: 240px; -} - -html|object:not([height]), html|object[height=""], -html|embed:not([height]), html|embed[height=""], -html|applet:not([height]), html|applet[height=""] { - height: 200px; -} - -html|object > *|*, -html|embed > *|*, -html|applet > *|* { - width: inherit; - height: inherit; -} - -html|a, html|div { - display: inline-block; - /* overflow:hidden makes baseline vertical-alignment act like plugins */ - overflow: hidden; - vertical-align: inherit; - border: 1px outset; - padding: 5px; - font-size: 12px; - font-family: sans-serif; - background: white; - -moz-user-select: none; - text-decoration: none; - color: black; -} - -vbox { - width: inherit; - height: inherit; - -moz-box-align: center; - -moz-box-pack: center; -} - -#missingPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png); -} - -#disabledPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginDisabled.png); -} - -#blockedPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png); -} - -#missingPluginPlaceholder, -#disabledPluginPlaceholder, -#blockedPluginPlaceholder { - display: block; - border: 0px; - width: 32px; - height: 32px; -} diff --git a/toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css b/toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css new file mode 100644 index 000000000000..fd27b9bd713f --- /dev/null +++ b/toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css @@ -0,0 +1,70 @@ +@namespace html url(http://www.w3.org/1999/xhtml); + +/* These styles affect only the bound element, not other page content. */ + +html|object:not([width]), html|object[width=""], +html|embed:not([width]), html|embed[width=""], +html|applet:not([width]), html|applet[width=""] { + width: 240px; +} + +html|object:not([height]), html|object[height=""], +html|embed:not([height]), html|embed[height=""], +html|applet:not([height]), html|applet[height=""] { + height: 200px; +} + +.mainBox { + width: inherit; + height: inherit; + overflow: hidden; + text-align: center; + + background-image: url(chrome://mozapps/skin/plugins/backgroundStripes.png); + -moz-border-radius: 12px; + /* recessed effect with dark inner shadow and lightened bottom */ + -moz-box-shadow: inset 0 1px 5px rgba(0,0,0,0.8), + 0 1px 0 rgba(255,255,255,0.2); + padding: 5px; + -moz-user-select: none; +} +:-moz-type-unsupported .mainBox, +:-moz-handler-disabled .mainBox, +:-moz-handler-blocked .mainBox { + -moz-user-focus: normal; +} +:-moz-type-unsupported .mainBox:focus, +:-moz-handler-disabled .mainBox:focus, +:-moz-handler-blocked .mainBox:focus { + outline: 1px dotted; +} + +.icon { + min-width: 48px; + min-height: 48px; + background-position: center; + background-repeat: no-repeat; +} +:-moz-type-unsupported .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png); +} +:-moz-handler-disabled .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginDisabled.png); +} +:-moz-handler-blocked .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png); +} + +.msg { + display: none; + color: white; + font: 12px sans-serif; + font-weight: bold; + cursor: default; + text-shadow: rgba(0,0,0,0.8) 0 0 5px; +} +:-moz-type-unsupported .msgUnsupported, +:-moz-handler-disabled .msgDisabled, +:-moz-handler-blocked .msgBlocked { + display: block; +} diff --git a/toolkit/themes/winstripe/mozapps/jar.mn b/toolkit/themes/winstripe/mozapps/jar.mn index aab51d6f6c85..18c2f009ff45 100644 --- a/toolkit/themes/winstripe/mozapps/jar.mn +++ b/toolkit/themes/winstripe/mozapps/jar.mn @@ -25,7 +25,8 @@ toolkit.jar: skin/classic/mozapps/places/defaultFavicon.png (places/defaultFavicon.png) skin/classic/mozapps/places/tagContainerIcon.png (places/tagContainerIcon.png) #endif - skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css) + skin/classic/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css) + skin/classic/mozapps/plugins/backgroundStripes.png (plugins/backgroundStripes.png) skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png) skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png) skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png) @@ -67,7 +68,8 @@ toolkit.jar: skin/classic/aero/mozapps/places/defaultFavicon.png (places/defaultFavicon-aero.png) skin/classic/aero/mozapps/places/tagContainerIcon.png (places/tagContainerIcon-aero.png) #endif - skin/classic/aero/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css) + skin/classic/aero/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css) + skin/classic/aero/mozapps/plugins/backgroundStripes.png (plugins/backgroundStripes-aero.png) skin/classic/aero/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric-aero.png) skin/classic/aero/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled-aero.png) skin/classic/aero/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked-aero.png) diff --git a/toolkit/themes/winstripe/mozapps/plugins/backgroundStripes-aero.png b/toolkit/themes/winstripe/mozapps/plugins/backgroundStripes-aero.png new file mode 100644 index 0000000000000000000000000000000000000000..fca1c022890568daff0997c842f0770fd1b1a03b GIT binary patch literal 369 zcmV-%0gnEOP)d|**gw{KoA2^5^*u^pCeI3n*s?zV0W31?R7Ps_2hD1 z%d&i?gv|4t&^k@;jMgmdx~}oyOl%o9bm44lC>Q}721db#fRV87U^J{N7!m6RM#Z{- zk+J4rbgU_u0c!?k!J2@Xu#drP*hgSSY&Vz{+XZIEHiOx*O<)CVHCP2(1y;h|g4M8> zU`6a-uqyTxtc*Q?)v-J92-pog3ibyc3A-&^j>wcRUPj8eq0h8}%*2-dP;fRj6pVlk z1EXL=z(`nkFdEhsjEHpuqheja$XIhQI@T1-fHecNU`@bG*vDWt>?1HEwj0cf?E*7n zo5AeZCa?mw8mxk?0xMx}!D`q`up;&^SQUE;R>mH{>ewB41ndSL1zW&h$>*~Z3}zD6 P00000NkvXXu0mjfkC2n+ literal 0 HcmV?d00001 diff --git a/toolkit/themes/winstripe/mozapps/plugins/backgroundStripes.png b/toolkit/themes/winstripe/mozapps/plugins/backgroundStripes.png new file mode 100644 index 0000000000000000000000000000000000000000..fca1c022890568daff0997c842f0770fd1b1a03b GIT binary patch literal 369 zcmV-%0gnEOP)d|**gw{KoA2^5^*u^pCeI3n*s?zV0W31?R7Ps_2hD1 z%d&i?gv|4t&^k@;jMgmdx~}oyOl%o9bm44lC>Q}721db#fRV87U^J{N7!m6RM#Z{- zk+J4rbgU_u0c!?k!J2@Xu#drP*hgSSY&Vz{+XZIEHiOx*O<)CVHCP2(1y;h|g4M8> zU`6a-uqyTxtc*Q?)v-J92-pog3ibyc3A-&^j>wcRUPj8eq0h8}%*2-dP;fRj6pVlk z1EXL=z(`nkFdEhsjEHpuqheja$XIhQI@T1-fHecNU`@bG*vDWt>?1HEwj0cf?E*7n zo5AeZCa?mw8mxk?0xMx}!D`q`up;&^SQUE;R>mH{>ewB41ndSL1zW&h$>*~Z3}zD6 P00000NkvXXu0mjfkC2n+ literal 0 HcmV?d00001 diff --git a/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css b/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css deleted file mode 100644 index b4b3ae3b8a90..000000000000 --- a/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file's style only applies to broken objects, not the rest - * of the page. - */ - -@namespace html url(http://www.w3.org/1999/xhtml); - -html|object:not([width]), html|object[width=""], -html|embed:not([width]), html|embed[width=""], -html|applet:not([width]), html|applet[width=""] { - width: 240px; -} - -html|object:not([height]), html|object[height=""], -html|embed:not([height]), html|embed[height=""], -html|applet:not([height]), html|applet[height=""] { - height: 200px; -} - -html|object > *|*, -html|embed > *|*, -html|applet > *|* { - width: inherit; - height: inherit; -} - -html|a, html|div { - display: inline-block; - /* overflow:hidden makes baseline vertical-alignment act like plugins */ - overflow: hidden; - vertical-align: inherit; - border: 1px outset; - padding: 5px; - font-size: 12px; - font-family: sans-serif; - background: white; - -moz-user-select: none; - text-decoration: none; - color: black; -} - -vbox { - width: inherit; - height: inherit; - -moz-box-align: center; - -moz-box-pack: center; -} - -#missingPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png); -} - -#disabledPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginDisabled.png); -} - -#blockedPluginPlaceholder { - list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png); -} - -#missingPluginPlaceholder, -#disabledPluginPlaceholder, -#blockedPluginPlaceholder { - display: block; - border: 0px; - width: 32px; - height: 32px; -} diff --git a/toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css b/toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css new file mode 100644 index 000000000000..fd27b9bd713f --- /dev/null +++ b/toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css @@ -0,0 +1,70 @@ +@namespace html url(http://www.w3.org/1999/xhtml); + +/* These styles affect only the bound element, not other page content. */ + +html|object:not([width]), html|object[width=""], +html|embed:not([width]), html|embed[width=""], +html|applet:not([width]), html|applet[width=""] { + width: 240px; +} + +html|object:not([height]), html|object[height=""], +html|embed:not([height]), html|embed[height=""], +html|applet:not([height]), html|applet[height=""] { + height: 200px; +} + +.mainBox { + width: inherit; + height: inherit; + overflow: hidden; + text-align: center; + + background-image: url(chrome://mozapps/skin/plugins/backgroundStripes.png); + -moz-border-radius: 12px; + /* recessed effect with dark inner shadow and lightened bottom */ + -moz-box-shadow: inset 0 1px 5px rgba(0,0,0,0.8), + 0 1px 0 rgba(255,255,255,0.2); + padding: 5px; + -moz-user-select: none; +} +:-moz-type-unsupported .mainBox, +:-moz-handler-disabled .mainBox, +:-moz-handler-blocked .mainBox { + -moz-user-focus: normal; +} +:-moz-type-unsupported .mainBox:focus, +:-moz-handler-disabled .mainBox:focus, +:-moz-handler-blocked .mainBox:focus { + outline: 1px dotted; +} + +.icon { + min-width: 48px; + min-height: 48px; + background-position: center; + background-repeat: no-repeat; +} +:-moz-type-unsupported .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png); +} +:-moz-handler-disabled .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginDisabled.png); +} +:-moz-handler-blocked .icon { + background-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png); +} + +.msg { + display: none; + color: white; + font: 12px sans-serif; + font-weight: bold; + cursor: default; + text-shadow: rgba(0,0,0,0.8) 0 0 5px; +} +:-moz-type-unsupported .msgUnsupported, +:-moz-handler-disabled .msgDisabled, +:-moz-handler-blocked .msgBlocked { + display: block; +} From 6eb9a66d1020548ed3881dcab879a1b605aa2743 Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Tue, 9 Feb 2010 17:05:32 -0800 Subject: [PATCH 28/31] Bug 538910 - Plugins: Need a "plugin crashed" UI. r=gavin, ui-r=faaborg, icon=shorlander --- browser/base/content/browser.js | 142 +++++++++++++++++- .../en-US/chrome/browser/browser.properties | 3 + .../crashreporter/content/oopcrashdialog.js | 33 ---- .../crashreporter/content/oopcrashdialog.xul | 32 ---- toolkit/crashreporter/jar.mn | 2 - toolkit/crashreporter/nsExceptionHandler.cpp | 32 ---- .../en-US/chrome/mozapps/plugins/plugins.dtd | 18 +++ .../mozapps/plugins/content/pluginProblem.xml | 5 + .../plugins/content/pluginProblemBinding.css | 5 +- toolkit/themes/pinstripe/mozapps/jar.mn | 1 + .../mozapps/plugins/pluginCrashed.png | Bin 0 -> 1470 bytes .../mozapps/plugins/pluginProblem.css | 11 +- toolkit/themes/winstripe/mozapps/jar.mn | 2 + .../mozapps/plugins/pluginCrashed-aero.png | Bin 0 -> 1470 bytes .../mozapps/plugins/pluginCrashed.png | Bin 0 -> 1470 bytes .../mozapps/plugins/pluginProblem.css | 11 +- 16 files changed, 194 insertions(+), 103 deletions(-) delete mode 100644 toolkit/crashreporter/content/oopcrashdialog.js delete mode 100644 toolkit/crashreporter/content/oopcrashdialog.xul create mode 100644 toolkit/themes/pinstripe/mozapps/plugins/pluginCrashed.png create mode 100644 toolkit/themes/winstripe/mozapps/plugins/pluginCrashed-aero.png create mode 100644 toolkit/themes/winstripe/mozapps/plugins/pluginCrashed.png diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 2f42e7ca17e3..37f5de130f33 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1101,14 +1101,18 @@ function HandleAppCommandEvent(evt) { } function prepareForStartup() { + var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); + gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false); // Note: we need to listen to untrusted events, because the pluginfinder XBL // binding can't fire trusted ones (runs with page privileges). gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true, true); + gBrowser.addEventListener("PluginCrashed", gMissingPluginInstaller.pluginInstanceCrashed, true, true); gBrowser.addEventListener("PluginBlocklisted", gMissingPluginInstaller.newMissingPlugin, true, true); gBrowser.addEventListener("PluginOutdated", gMissingPluginInstaller.newMissingPlugin, true, true); gBrowser.addEventListener("PluginDisabled", gMissingPluginInstaller.newDisabledPlugin, true, true); gBrowser.addEventListener("NewPluginInstalled", gMissingPluginInstaller.refreshBrowser, false); + os.addObserver(gMissingPluginInstaller.pluginCrashed, "plugin-crashed", false); window.addEventListener("AppCommand", HandleAppCommandEvent, true); var webNavigation; @@ -1152,7 +1156,6 @@ function prepareForStartup() { // progress notifications for back/forward button updating webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"] .createInstance(Components.interfaces.nsISHistory); - var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); os.addObserver(gBrowser.browsers[0], "browser:purge-session-history", false); // remove the disablehistory attribute so the browser cleans up, as @@ -5993,6 +5996,20 @@ function getPluginInfo(pluginElement) var gMissingPluginInstaller = { + get CrashSubmit() { + delete this.CrashSubmit; + Cu.import("resource://gre/modules/CrashSubmit.jsm", this); + return this.CrashSubmit; + }, + + get crashReportHelpURL() { + delete this.crashReportHelpURL; + let url = formatURL("app.support.baseURL", true); + url += "plugin-crashed"; + this.crashReportHelpURL = url; + return this.crashReportHelpURL; + }, + installSinglePlugin: function (aEvent) { if (!aEvent.isTrusted) return; @@ -6168,6 +6185,129 @@ var gMissingPluginInstaller = { true); }, + // Crashed-plugin observer. Notified once per plugin crash, before events + // are dispatched to individual plugin instances. + pluginCrashed : function(subject, topic, data) { + let propertyBag = subject; + if (!(propertyBag instanceof Ci.nsIPropertyBag2) || + !(propertyBag instanceof Ci.nsIWritablePropertyBag2)) + return; + +#ifdef MOZ_CRASHREPORTER + let minidumpID = subject.getPropertyAsAString("minidumpID"); + let submitReports = gCrashReporter.submitReports; + // The crash reporter wants a DOM element it can append an IFRAME to, + // which it uses to submit a form. Let's just give it gBrowser. + if (submitReports) + gMissingPluginInstaller.CrashSubmit.submit(minidumpID, gBrowser, null, null); + propertyBag.setPropertyAsBool("submittedCrashReport", submitReports); +#endif + }, + + pluginInstanceCrashed: function (aEvent) { + // Evil content could fire a fake event at us, ignore them. + if (!aEvent.isTrusted) + return; + + if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent)) + return; + + let submittedReport = aEvent.getData("submittedCrashReport"); + let pluginName = aEvent.getData("pluginName"); + + // We're expecting this to be a plugin. + let plugin = aEvent.target; + if (!(plugin instanceof Ci.nsIObjectLoadingContent)) + return; + + // Force a style flush, so that we ensure our binding is attached. + plugin.clientTop; + + let messageString = gNavigatorBundle.getFormattedString("crashedpluginsMessage.title", [pluginName]); + + // + // Configure the crashed-plugin placeholder. + // + let doc = plugin.ownerDocument; + let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); + + // The binding has role="link" here, since missing/disabled/blocked + // plugin UI has a onclick handler on the whole thing. This isn't needed + // for the plugin-crashed UI, because we use actual HTML links in the text. + overlay.removeAttribute("role"); + +#ifdef MOZ_CRASHREPORTER + let helpClass = submittedReport ? "submitLink" : "notSubmitLink"; + let helpLink = doc.getAnonymousElementByAttribute(plugin, "class", helpClass); + helpLink.href = gMissingPluginInstaller.crashReportHelpURL; + let showClass = submittedReport ? "msg msgSubmitted" : "msg msgNotSubmitted"; + let textToShow = doc.getAnonymousElementByAttribute(plugin, "class", showClass); + textToShow.style.display = "block"; +#endif + + let crashText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgCrashed"); + crashText.textContent = messageString; + + let link = doc.getAnonymousElementByAttribute(plugin, "class", "reloadLink"); + link.addEventListener("click", function(e) { if (e.isTrusted) browser.reload(); }, true); + + let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument + .defaultView.top.document); + let notificationBox = gBrowser.getNotificationBox(browser); + + // Is the 's size too small to hold what we want to show? + let pluginRect = plugin.getBoundingClientRect(); + // XXX bug 446693. The text-shadow on the submitted-report text at + // the bottom causes scrollHeight to be larger than it should be. + let isObjectTooSmall = (overlay.scrollWidth > pluginRect.width) || + (overlay.scrollHeight - 5 > pluginRect.height); + if (isObjectTooSmall) { + // Hide the overlay's contents. Use visibility style, so that it + // doesn't collapse down to 0x0. + overlay.style.visibility = "hidden"; + // If another plugin on the page was large enough to show our UI, we + // don't want to show a notification bar. + if (!doc.mozNoPluginCrashedNotification) + showNotificationBar(); + } else { + // If a previous plugin on the page was too small and resulted in + // adding a notification bar, then remove it because this plugin + // instance it big enough to serve as in-content notification. + hideNotificationBar(); + doc.mozNoPluginCrashedNotification = true; + } + + function hideNotificationBar() { + let notification = notificationBox.getNotificationWithValue("plugin-crashed"); + if (notification) + notificationBox.removeNotification(notification, true); + } + + function showNotificationBar() { + // If there's already an existing notification bar, don't do anything. + let notification = notificationBox.getNotificationWithValue("plugin-crashed"); + if (notification) + return; + + // Configure the notification bar + let priority = notificationBox.PRIORITY_WARNING_MEDIUM; + let iconURL = "chrome://mozapps/skin/plugins/pluginGeneric-16.png"; + let label = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.label"); + let accessKey = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.accesskey"); + + let buttons = [{ + label: label, + accessKey: accessKey, + popup: null, + callback: function() { browser.reload(); }, + }]; + + let notification = notificationBox.appendNotification(messageString, "plugin-crashed", + iconURL, priority, buttons); + } + + }, + refreshBrowser: function (aEvent) { // browser elements are anonymous so we can't just use target. var browser = aEvent.originalTarget; diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 0550d4fcf5d6..19974e9a1021 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -74,6 +74,9 @@ blockedpluginsMessage.infoButton.label=Details… blockedpluginsMessage.infoButton.accesskey=D blockedpluginsMessage.searchButton.label=Update Plugins… blockedpluginsMessage.searchButton.accesskey=U +crashedpluginsMessage.title=The %S plugin has crashed. +crashedpluginsMessage.reloadButton.label=Reload page +crashedpluginsMessage.reloadButton.accesskey=R # Sanitize # LOCALIZATION NOTE (sanitizeDialog2.everything.title): When "Time range to diff --git a/toolkit/crashreporter/content/oopcrashdialog.js b/toolkit/crashreporter/content/oopcrashdialog.js deleted file mode 100644 index b0be226734cf..000000000000 --- a/toolkit/crashreporter/content/oopcrashdialog.js +++ /dev/null @@ -1,33 +0,0 @@ -// This code is TEMPORARY for submitting crashes via an ugly popup dialog: -// bug 525849 tracks the real implementation. - -const Cc = Components.classes; -const Ci = Components.interfaces; - -Components.utils.import("resource://gre/modules/CrashSubmit.jsm"); - -var id; - -function collectData() { - let directoryService = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties); - - let dumpFile = window.arguments[0].QueryInterface(Ci.nsIFile); - id = dumpFile.leafName.replace(/.dmp$/, ""); -} - -function submitDone() -{ - // we don't currently distinguish between success or failure here - window.close(); -} - -function onSubmit() -{ - document.documentElement.getButton('accept').disabled = true; - document.documentElement.getButton('accept').label = 'Sending'; - document.getElementById('throbber').src = 'chrome://global/skin/icons/loading_16.png'; - CrashSubmit.submit(id, document.getElementById('iframe-holder'), - submitDone, submitDone); - return false; -} diff --git a/toolkit/crashreporter/content/oopcrashdialog.xul b/toolkit/crashreporter/content/oopcrashdialog.xul deleted file mode 100644 index 6bb8f1bd9da5..000000000000 --- a/toolkit/crashreporter/content/oopcrashdialog.xul +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - -Mozilla Bug 100533 -

-
- - - - -
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug1297.html b/testing/mochitest/tests/test_bug1297.html deleted file mode 100644 index 41b9bffba1d4..000000000000 --- a/testing/mochitest/tests/test_bug1297.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - Test for Bug 1297 - - - - - -Mozilla Bug 1297 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug1366.html b/testing/mochitest/tests/test_bug1366.html deleted file mode 100644 index a66fa94fe3ed..000000000000 --- a/testing/mochitest/tests/test_bug1366.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Test for Bug 1366 - - - - - -Mozilla Bug 1366 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug1400.html b/testing/mochitest/tests/test_bug1400.html deleted file mode 100644 index 355844881ddf..000000000000 --- a/testing/mochitest/tests/test_bug1400.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Test for Bug 1400 - - - - - -Mozilla Bug 1400 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug1682.html b/testing/mochitest/tests/test_bug1682.html deleted file mode 100644 index 57edbc9bc432..000000000000 --- a/testing/mochitest/tests/test_bug1682.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Test for Bug 1682 - - - - - -Mozilla Bug 1682 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug172261.html b/testing/mochitest/tests/test_bug172261.html deleted file mode 100644 index d47de4159b92..000000000000 --- a/testing/mochitest/tests/test_bug172261.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Test for Bug 172261 - - - - - -Mozilla Bug 172261 -

- -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug1823.html b/testing/mochitest/tests/test_bug1823.html deleted file mode 100644 index c319f98bf781..000000000000 --- a/testing/mochitest/tests/test_bug1823.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Test for Bug 1823 - - - - - -Mozilla Bug 1823 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug2082.html b/testing/mochitest/tests/test_bug2082.html deleted file mode 100644 index f429ce754c2b..000000000000 --- a/testing/mochitest/tests/test_bug2082.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Test for Bug 2082 - - - - - -Mozilla Bug 2082 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug218236.html b/testing/mochitest/tests/test_bug218236.html deleted file mode 100644 index 0e930393028d..000000000000 --- a/testing/mochitest/tests/test_bug218236.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Test for Bug 218236 - - - - - -Mozilla Bug 218236 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug218277.html b/testing/mochitest/tests/test_bug218277.html deleted file mode 100644 index e63f0188e528..000000000000 --- a/testing/mochitest/tests/test_bug218277.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Test for Bug 218277 - - - - - -Mozilla Bug 218277 -

-
- -
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug237071.html b/testing/mochitest/tests/test_bug237071.html deleted file mode 100644 index ceb7ebd9fdac..000000000000 --- a/testing/mochitest/tests/test_bug237071.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Test for Bug 237071 - - - - - -Mozilla Bug 237071 -

-
-
    -
  1. should be 22
  2. -
  3. should be 23
  4. -
-
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug238409.html b/testing/mochitest/tests/test_bug238409.html deleted file mode 100644 index c9b4f25a078b..000000000000 --- a/testing/mochitest/tests/test_bug238409.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Test for Bug 238409 - - - - - -Mozilla Bug 238409 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug24958.html b/testing/mochitest/tests/test_bug24958.html deleted file mode 100644 index 3cd04d1c513f..000000000000 --- a/testing/mochitest/tests/test_bug24958.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Test for Bug 24958 - - - - - - -Mozilla Bug 24958 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug277724.html b/testing/mochitest/tests/test_bug277724.html deleted file mode 100644 index ace086776b55..000000000000 --- a/testing/mochitest/tests/test_bug277724.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - Test for Bug 277724 - - - - - -Mozilla Bug 277724 -

-
-
-
- - - - - - diff --git a/testing/mochitest/tests/test_bug300691-1.html b/testing/mochitest/tests/test_bug300691-1.html deleted file mode 100644 index 39d63e57ae15..000000000000 --- a/testing/mochitest/tests/test_bug300691-1.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Test for Bug 300691 - - - - - - -Mozilla Bug 300691 -

- -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug300691-2.html b/testing/mochitest/tests/test_bug300691-2.html deleted file mode 100644 index e2a4e4986dd8..000000000000 --- a/testing/mochitest/tests/test_bug300691-2.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Test for Bug 300691 - - - - - -Mozilla Bug 300691 -

- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug300691-3.xhtml b/testing/mochitest/tests/test_bug300691-3.xhtml deleted file mode 100644 index df20ff992d87..000000000000 --- a/testing/mochitest/tests/test_bug300691-3.xhtml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Test for Bug 300691 - - - - - -Mozilla Bug 300691 -

- -
-
-
-
-
-
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug302186.html b/testing/mochitest/tests/test_bug302186.html deleted file mode 100644 index e6de785dbe34..000000000000 --- a/testing/mochitest/tests/test_bug302186.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - Test for Bug 302186 - - - - - - - -Mozilla Bug 302186 -

-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- There should be no red. -
-
- There should be no red. - -
-
- - -
-
- - There should be no red. -
-
- There should be no red. - -
-
- - -
-
- - There should be no red. -
-
- There should be no red. -
-
- - -
-
- - There should be no red. -
-
- There should be no red. - -
-
- - - - -
-
- There should be no red. -
-
- - -
-
- There should be no red. -
-
- -
- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug308484.html b/testing/mochitest/tests/test_bug308484.html deleted file mode 100644 index 014a570cc36a..000000000000 --- a/testing/mochitest/tests/test_bug308484.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Test for Bug 308484 - - - - - -Mozilla Bug 308484 -

- -
-
-
- - diff --git a/testing/mochitest/tests/test_bug308856.html b/testing/mochitest/tests/test_bug308856.html deleted file mode 100644 index 9c2034188fee..000000000000 --- a/testing/mochitest/tests/test_bug308856.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Test for Bug 308856 - - - - - -Mozilla Bug 308856 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug311681.html b/testing/mochitest/tests/test_bug311681.html deleted file mode 100644 index 46fb7908c6e9..000000000000 --- a/testing/mochitest/tests/test_bug311681.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Test for Bug 311681 - - - - - -Mozilla Bug 311681 - -

- -
-
- - - diff --git a/testing/mochitest/tests/test_bug311681.xhtml b/testing/mochitest/tests/test_bug311681.xhtml deleted file mode 100644 index d869cc3b3ba0..000000000000 --- a/testing/mochitest/tests/test_bug311681.xhtml +++ /dev/null @@ -1,105 +0,0 @@ - - - - Test for Bug 311681 - - - - - -Mozilla Bug 311681 - -

- -
-
- - - diff --git a/testing/mochitest/tests/test_bug311681.xml b/testing/mochitest/tests/test_bug311681.xml deleted file mode 100644 index 9e3dadedeca6..000000000000 --- a/testing/mochitest/tests/test_bug311681.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - Test for Bug 311681 - - - - - -Mozilla Bug 311681 - -

- -
-
- - - diff --git a/testing/mochitest/tests/test_bug311681.xul b/testing/mochitest/tests/test_bug311681.xul deleted file mode 100644 index 9c7f5af878da..000000000000 --- a/testing/mochitest/tests/test_bug311681.xul +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - Test for Bug 311681 - - - - -Mozilla Bug 311681 - -

- -
-
- - -
diff --git a/testing/mochitest/tests/test_bug319381.html b/testing/mochitest/tests/test_bug319381.html deleted file mode 100644 index 8ed87f86363a..000000000000 --- a/testing/mochitest/tests/test_bug319381.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - Test for Bug 319381 - - - - - -Mozilla Bug 319381 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug332848.xhtml b/testing/mochitest/tests/test_bug332848.xhtml deleted file mode 100644 index 1087455867ff..000000000000 --- a/testing/mochitest/tests/test_bug332848.xhtml +++ /dev/null @@ -1,71 +0,0 @@ - - - - Test for Bug 332848 - - - - - -Mozilla Bug 332848 -

- -
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug333983.html b/testing/mochitest/tests/test_bug333983.html deleted file mode 100644 index 947ac1c73d91..000000000000 --- a/testing/mochitest/tests/test_bug333983.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Test for Bug 333983 - - - - - -Mozilla Bug 333983 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug3348.html b/testing/mochitest/tests/test_bug3348.html deleted file mode 100644 index 19968c02da6a..000000000000 --- a/testing/mochitest/tests/test_bug3348.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Test for Bug 3348 - - - - - -Mozilla Bug 3348 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug337124.html b/testing/mochitest/tests/test_bug337124.html deleted file mode 100644 index 99cc5c74159c..000000000000 --- a/testing/mochitest/tests/test_bug337124.html +++ /dev/null @@ -1,33 +0,0 @@ - -Test for Bug 337124 - - - - - -Mozilla Bug 337124 - - - - -
- -
- -
-
- - -
- 
-
- - \ No newline at end of file diff --git a/testing/mochitest/tests/test_bug337631.html b/testing/mochitest/tests/test_bug337631.html deleted file mode 100644 index b8e7bc41596a..000000000000 --- a/testing/mochitest/tests/test_bug337631.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Test for Bug 337631 - - - - - -Mozilla Bug 337631 -

-
- -foo - -

adsfasdf

- -
-
-
-
- - - diff --git a/testing/mochitest/tests/test_bug338541.xhtml b/testing/mochitest/tests/test_bug338541.xhtml deleted file mode 100644 index fb61249dc7fc..000000000000 --- a/testing/mochitest/tests/test_bug338541.xhtml +++ /dev/null @@ -1,50 +0,0 @@ - - - - Test for Bug 338541 - - - - - -Mozilla Bug 338541 -

-
-
-
- - - - diff --git a/testing/mochitest/tests/test_bug338679.html b/testing/mochitest/tests/test_bug338679.html deleted file mode 100644 index 9f76beb72801..000000000000 --- a/testing/mochitest/tests/test_bug338679.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - -Testcase bug 338679 - - - - - -Mozilla Bug 338679 -
-
-
Actual result:
-
-
-    
-
- -
Expected result:
- -
-
-Previous:       width: 20em;
-New:            width: auto;
-    
-
-
-
-
-
-
- - diff --git a/testing/mochitest/tests/test_bug339350.xhtml b/testing/mochitest/tests/test_bug339350.xhtml deleted file mode 100644 index e856e45e9188..000000000000 --- a/testing/mochitest/tests/test_bug339350.xhtml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - diff --git a/testing/mochitest/tests/test_bug339494.html b/testing/mochitest/tests/test_bug339494.html deleted file mode 100644 index 5a65c21fa330..000000000000 --- a/testing/mochitest/tests/test_bug339494.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Test for Bug 339494 - - - - - -Mozilla Bug 339494 -

- -
-
-
- - - diff --git a/testing/mochitest/tests/test_bug339494.xhtml b/testing/mochitest/tests/test_bug339494.xhtml deleted file mode 100644 index 92894e607f8e..000000000000 --- a/testing/mochitest/tests/test_bug339494.xhtml +++ /dev/null @@ -1,61 +0,0 @@ - - - - Test for Bug 339494 - - - - - -Mozilla Bug 339494 -

-