From 7de5f246ff5b7a89ed1d0ae48618d6f0d2376fff Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 11 Jan 2012 11:17:56 +1300 Subject: [PATCH 001/165] Bug 702158 - Build Skia Azure backend on linux. r=mattwoodrow --- config/system-headers | 5 ++++ configure.in | 2 +- .../src/nsCanvasRenderingContext2DAzure.cpp | 2 +- gfx/skia/Makefile.in | 14 +++++++++++ gfx/thebes/gfxPlatformGtk.cpp | 25 +++++++++++++++++++ gfx/thebes/gfxPlatformGtk.h | 5 ++++ js/src/config/system-headers | 5 ++++ 7 files changed, 56 insertions(+), 2 deletions(-) diff --git a/config/system-headers b/config/system-headers index 6544f6b7ed0..a4c34167f19 100644 --- a/config/system-headers +++ b/config/system-headers @@ -268,6 +268,11 @@ freetype/ftoutln.h freetype/ttnameid.h freetype/tttables.h freetype/t1tables.h +freetype/ftlcdfil.h +freetype/ftsizes.h +freetype/ftadvanc.h +freetype/ftbitmap.h +freetype/ftxf86.h fribidi/fribidi.h FSp_fopen.h fstream diff --git a/configure.in b/configure.in index 21f3fb702e9..afb83cf82ad 100644 --- a/configure.in +++ b/configure.in @@ -7997,7 +7997,7 @@ dnl ======================================================== dnl Graphics checks. dnl ======================================================== -if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android"; then +if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then MOZ_ENABLE_SKIA=1 else MOZ_ENABLE_SKIA= diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp index 866fc655cc2..d9c5a861982 100644 --- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -995,7 +995,7 @@ NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult) !Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) { return NS_ERROR_NOT_AVAILABLE; } -#elif !defined(XP_MACOSX) && !defined(ANDROID) +#elif !defined(XP_MACOSX) && !defined(ANDROID) && !defined(XP_LINUX) return NS_ERROR_NOT_AVAILABLE; #endif diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in index 1a41171fa19..2ead7b8ea2c 100644 --- a/gfx/skia/Makefile.in +++ b/gfx/skia/Makefile.in @@ -68,6 +68,7 @@ VPATH += \ $(srcdir)/src/ports \ $(srcdir)/src/opts \ $(srcdir)/src/effects \ + $(srcdir)/src/utils \ $(NULL) EXPORTS_skia = \ @@ -319,6 +320,19 @@ DEFINES += -DSK_BUILD_FOR_ANDROID_NDK OS_CXXFLAGS += $(CAIRO_FT_CFLAGS) endif +ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT)) +CPPSRCS += \ + SkFontHost_FreeType.cpp \ + SkFontHost_linux.cpp \ + SkFontHost_gamma.cpp \ + SkTime_Unix.cpp \ + SkMMapStream.cpp \ + SkOSFile.cpp \ + $(NULL) + +OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS) +endif + ifeq (windows,$(MOZ_WIDGET_TOOLKIT)) EXPORTS_skia += \ include/config/sk_stdint.h \ diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 94e5ab27e8e..c3614d8ccbe 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -56,6 +56,8 @@ #include "gfxFT2Fonts.h" #endif +#include "mozilla/gfx/2D.h" + #include "cairo.h" #include @@ -83,6 +85,9 @@ #include FT_FREETYPE_H #endif +using namespace mozilla; +using namespace mozilla::gfx; + gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull; #ifndef MOZ_PANGO @@ -761,3 +766,23 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target) return NULL; } + +RefPtr +gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont) +{ + NativeFont nativeFont; + nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE; + nativeFont.mFont = aFont; + RefPtr scaledFont = + Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize()); + + return scaledFont; +} + +bool +gfxPlatformGtk::SupportsAzure(BackendType& aBackend) +{ + aBackend = BACKEND_SKIA; + return true; +} + diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h index b383f30d7af..2ec617c19c1 100644 --- a/gfx/thebes/gfxPlatformGtk.h +++ b/gfx/thebes/gfxPlatformGtk.h @@ -66,6 +66,11 @@ public: already_AddRefed CreateOffscreenSurface(const gfxIntSize& size, gfxASurface::gfxContentType contentType); + mozilla::RefPtr + GetScaledFontForFont(gfxFont *aFont); + + virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend); + nsresult GetFontList(nsIAtom *aLangGroup, const nsACString& aGenericFamily, nsTArray& aListOfFonts); diff --git a/js/src/config/system-headers b/js/src/config/system-headers index 6544f6b7ed0..a4c34167f19 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -268,6 +268,11 @@ freetype/ftoutln.h freetype/ttnameid.h freetype/tttables.h freetype/t1tables.h +freetype/ftlcdfil.h +freetype/ftsizes.h +freetype/ftadvanc.h +freetype/ftbitmap.h +freetype/ftxf86.h fribidi/fribidi.h FSp_fopen.h fstream From cc277b70ce2e2ac93f038ac1348731adfa7b5731 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 10 Jan 2012 09:26:45 -0500 Subject: [PATCH 002/165] Bug 716867 - test_sqliteMultiReporter.xul calls SimpleTest.finish needlessly; r=njn --- .../components/aboutmemory/tests/test_sqliteMultiReporter.xul | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul b/toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul index 888be1cc084..f77c1d594f9 100644 --- a/toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul +++ b/toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul @@ -50,7 +50,6 @@ // we explicitly check something. ok(true); - SimpleTest.finish(); ]]> From 88e3637ccab07b18b2d911db378c4597fce72d7f Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Thu, 5 Jan 2012 16:14:23 -0800 Subject: [PATCH 003/165] bug 715507 - GlobalHistory is accessing Gecko on the wrong thread r=dougt,kats --- mobile/android/base/GeckoAppShell.java | 4 +++- mobile/android/base/GeckoEvent.java | 7 ++++++- mozglue/android/APKOpen.cpp | 2 -- widget/android/AndroidJNI.cpp | 12 ------------ widget/android/AndroidJavaWrappers.h | 1 + widget/android/nsAppShell.cpp | 11 +++++++++++ 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 3560ce25aab..05369bfb8a6 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -132,7 +132,9 @@ public class GeckoAppShell public static native void loadLibs(String apkName, boolean shouldExtract); public static native void onChangeNetworkLinkStatus(String status); public static native void reportJavaCrash(String stack); - public static native void notifyUriVisited(String uri); + public static void notifyUriVisited(String uri) { + sendEventToGecko(new GeckoEvent(GeckoEvent.VISTITED, uri)); + } public static native void processNextNativeEvent(); diff --git a/mobile/android/base/GeckoEvent.java b/mobile/android/base/GeckoEvent.java index 14f646f4f84..b6029044c6a 100644 --- a/mobile/android/base/GeckoEvent.java +++ b/mobile/android/base/GeckoEvent.java @@ -1,4 +1,4 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; -*- +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -80,6 +80,7 @@ public class GeckoEvent { public static final int BROADCAST = 19; public static final int VIEWPORT = 20; public static final int TILE_SIZE = 21; + public static final int VISTITED = 22; public static final int IME_COMPOSITION_END = 0; public static final int IME_COMPOSITION_BEGIN = 1; @@ -257,4 +258,8 @@ public class GeckoEvent { mCharacters = uri; } + public GeckoEvent(int type, String data) { + mType = type; + mCharacters = data; + } } diff --git a/mozglue/android/APKOpen.cpp b/mozglue/android/APKOpen.cpp index bb1a6980094..d2685c2d707 100644 --- a/mozglue/android/APKOpen.cpp +++ b/mozglue/android/APKOpen.cpp @@ -296,7 +296,6 @@ SHELL_WRAPPER1(onChangeNetworkLinkStatus, jstring) SHELL_WRAPPER1(reportJavaCrash, jstring) SHELL_WRAPPER0(executeNextRunnable) SHELL_WRAPPER1(cameraCallbackBridge, jbyteArray) -SHELL_WRAPPER1(notifyUriVisited, jstring) SHELL_WRAPPER3(notifyBatteryChange, jdouble, jboolean, jdouble); SHELL_WRAPPER3(notifySmsReceived, jstring, jstring, jlong); SHELL_WRAPPER0(bindWidgetTexture); @@ -703,7 +702,6 @@ loadLibs(const char *apkName) GETFUNC(reportJavaCrash); GETFUNC(executeNextRunnable); GETFUNC(cameraCallbackBridge); - GETFUNC(notifyUriVisited); GETFUNC(notifyBatteryChange); GETFUNC(notifySmsReceived); GETFUNC(bindWidgetTexture); diff --git a/widget/android/AndroidJNI.cpp b/widget/android/AndroidJNI.cpp index 4e30f13b43f..d0e467ef588 100644 --- a/widget/android/AndroidJNI.cpp +++ b/widget/android/AndroidJNI.cpp @@ -54,10 +54,6 @@ #include "mozilla/Services.h" #include "nsINetworkLinkService.h" -#ifdef MOZ_ANDROID_HISTORY -#include "nsAndroidHistory.h" -#endif - #ifdef MOZ_CRASHREPORTER #include "nsICrashReporter.h" #include "nsExceptionHandler.h" @@ -214,14 +210,6 @@ Java_org_mozilla_gecko_GeckoAppShell_executeNextRunnable(JNIEnv *, jclass) __android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "leaving %s", __PRETTY_FUNCTION__); } -NS_EXPORT void JNICALL -Java_org_mozilla_gecko_GeckoAppShell_notifyUriVisited(JNIEnv *jenv, jclass, jstring uri) -{ -#ifdef MOZ_ANDROID_HISTORY - nsAndroidHistory::NotifyURIVisited(nsJNIString(uri, jenv)); -#endif -} - NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_notifyBatteryChange(JNIEnv* jenv, jclass, jdouble aLevel, diff --git a/widget/android/AndroidJavaWrappers.h b/widget/android/AndroidJavaWrappers.h index 6dcd34202a9..408be53d734 100644 --- a/widget/android/AndroidJavaWrappers.h +++ b/widget/android/AndroidJavaWrappers.h @@ -533,6 +533,7 @@ public: BROADCAST = 19, VIEWPORT = 20, TILE_SIZE = 21, + VISITED = 22, dummy_java_enum_list_end }; diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 9918b1837c6..00661901535 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -55,6 +55,10 @@ #include #include +#ifdef MOZ_ANDROID_HISTORY +#include "nsAndroidHistory.h" +#endif + #ifdef MOZ_LOGGING #define FORCE_PR_LOG #include "prlog.h" @@ -445,6 +449,13 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) break; } + case AndroidGeckoEvent::VISITED: { +#ifdef MOZ_ANDROID_HISTORY + nsAndroidHistory::NotifyURIVisited(nsString(curEvent->Characters())); +#endif + break; + } + default: nsWindow::OnGlobalAndroidEvent(curEvent); } From cd8cf6f1e37eff6e60f99ee71fb13e88f9d8bc65 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Tue, 10 Jan 2012 00:02:03 -0800 Subject: [PATCH 004/165] bug 716818 - potential race condition in GeckoThread r=mfinkle --- mobile/android/base/GeckoApp.java | 4 +++- mobile/android/base/GeckoThread.java | 10 +--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index ec1ccfcbe8c..ce302d483f9 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1460,7 +1460,7 @@ abstract public class GeckoApp prefetchDNS(intent.getData()); - sGeckoThread = new GeckoThread(intent, mLastUri, mLastTitle); + sGeckoThread = new GeckoThread(intent, mLastUri); if (!ACTION_DEBUG.equals(intent.getAction()) && checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched)) sGeckoThread.start(); @@ -1482,6 +1482,8 @@ abstract public class GeckoApp mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar); } + mBrowserToolbar.setTitle(mLastTitle); + mFavicons = new Favicons(this); // setup gecko layout diff --git a/mobile/android/base/GeckoThread.java b/mobile/android/base/GeckoThread.java index c46cb686994..338dbfd29de 100644 --- a/mobile/android/base/GeckoThread.java +++ b/mobile/android/base/GeckoThread.java @@ -54,12 +54,10 @@ public class GeckoThread extends Thread { Intent mIntent; String mUri; - String mTitle; - GeckoThread (Intent intent, String uri, String title) { + GeckoThread (Intent intent, String uri) { mIntent = intent; mUri = uri; - mTitle = title; } public void run() { @@ -95,12 +93,6 @@ public class GeckoThread extends Thread { Log.w(LOGTAG, "zerdatime " + new Date().getTime() + " - runGecko"); // and then fire us up - - app.mMainHandler.post(new Runnable() { - public void run() { - app.mBrowserToolbar.setTitle(mTitle); - } - }); try { Log.w(LOGTAG, "RunGecko - URI = " + mUri); From 9f30cdc5a801318eb8beccd2595475275d7fb872 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Tue, 10 Jan 2012 14:42:24 -0800 Subject: [PATCH 005/165] Bug 707207: Add the hotfix certificate's fingerprint. r=Unfocused --- browser/app/profile/firefox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 83472328ec4..ac24ae06a17 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -83,7 +83,7 @@ pref("extensions.update.autoUpdateDefault", true); pref("extensions.hotfix.id", "firefox-hotfix@mozilla.org"); pref("extensions.hotfix.cert.checkAttributes", true); -pref("extensions.hotfix.certs.1.sha1Fingerprint", "foo"); +pref("extensions.hotfix.certs.1.sha1Fingerprint", "F1:DB:F9:6A:7B:B8:04:FA:48:3C:16:95:C7:2F:17:C6:5B:C2:9F:45"); // Disable add-ons installed into the shared user and shared system areas by // default. This does not include the application directory. See the SCOPE From 193cc7645abfca20288db6ef614a2f0d95e1a0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez?= Date: Tue, 10 Jan 2012 17:53:08 -0500 Subject: [PATCH 006/165] Bug 714855 - RIL: Implement ICC states transitions and ICC codes (PIN,PIN2,PUK,PUK2) handling. r=philikon --- dom/telephony/ril_consts.js | 13 +++ dom/telephony/ril_worker.js | 181 +++++++++++++++++++++++++++++++----- 2 files changed, 173 insertions(+), 21 deletions(-) diff --git a/dom/telephony/ril_consts.js b/dom/telephony/ril_consts.js index c2752fae343..ddada301405 100644 --- a/dom/telephony/ril_consts.js +++ b/dom/telephony/ril_consts.js @@ -189,6 +189,19 @@ const RADIO_STATE_RUIM_LOCKED_OR_ABSENT = 7; const RADIO_STATE_NV_NOT_READY = 8; const RADIO_STATE_NV_READY = 9; +const CARD_STATE_ABSENT = 0; +const CARD_STATE_PRESENT = 1; +const CARD_STATE_ERROR = 2; + +const CARD_APP_STATE_UNKNOWN = 0; +const CARD_APP_STATE_DETECTED = 1; +const CARD_APP_STATE_PIN = 2; // If PIN1 or UPin is required. +const CARD_APP_STATE_PUK = 3; // If PUK1 or Puk for UPin is required. +const CARD_APP_STATE_SUBSCRIPTION_PERSO = 4; // perso_substate should be looked + // at when app_state is assigned + // to this value. +const CARD_APP_STATE_READY = 5; + const CARD_MAX_APPS = 8; const CALL_STATE_ACTIVE = 0; diff --git a/dom/telephony/ril_worker.js b/dom/telephony/ril_worker.js index a111ad905ac..188846b2d96 100644 --- a/dom/telephony/ril_worker.js +++ b/dom/telephony/ril_worker.js @@ -513,7 +513,7 @@ let Buf = { let RIL = { /** - * Retrieve the ICC card's status. + * Retrieve the ICC's status. * * Response will call Phone.onICCStatus(). */ @@ -527,7 +527,7 @@ let RIL = { * @param pin * String containing the PIN. * - * Response will call Phone.onEnterSIMPIN(). + * Response will call Phone.onEnterICCPIN(). */ enterICCPIN: function enterICCPIN(pin) { Buf.newParcel(REQUEST_ENTER_SIM_PIN); @@ -536,6 +536,42 @@ let RIL = { Buf.sendParcel(); }, + /** + * Change the current ICC PIN number + * + * @param oldPin + * String containing the old PIN value + * @param newPin + * String containing the new PIN value + * + * Response will call Phone.onChangeICCPIN(). + */ + changeICCPIN: function changeICCPIN(oldPin, newPin) { + Buf.newParcel(REQUEST_CHANGE_SIM_PIN); + Buf.writeUint32(2); + Buf.writeString(oldPin); + Buf.writeString(newPin); + Buf.sendParcel(); + }, + + /** + * Supplies SIM PUK and a new PIN to unlock the ICC + * + * @param puk + * String containing the PUK value. + * @param newPin + * String containing the new PIN value. + * + * Response will call Phone.onEnterICCPUK(). + */ + enterICCPUK: function enterICCPUK(puk, newPin) { + Buf.newParcel(REQUEST_ENTER_SIM_PUK); + Buf.writeUint32(2); + Buf.writeString(puk); + Buf.writeString(newPin); + Buf.sendParcel(); + }, + /** * Request the phone's radio power to be switched on or off. * @@ -767,7 +803,7 @@ let RIL = { RIL[REQUEST_GET_SIM_STATUS] = function REQUEST_GET_SIM_STATUS() { let iccStatus = { - cardState: Buf.readUint32(), // CARDSTATE_* + cardState: Buf.readUint32(), // CARD_STATE_* universalPINState: Buf.readUint32(), // PINSTATE_* gsmUmtsSubscriptionAppIndex: Buf.readUint32(), setCdmaSubscriptionAppIndex: Buf.readUint32(), @@ -782,7 +818,7 @@ RIL[REQUEST_GET_SIM_STATUS] = function REQUEST_GET_SIM_STATUS() { for (let i = 0 ; i < apps_length ; i++) { iccStatus.apps.push({ app_type: Buf.readUint32(), // APPTYPE_* - app_state: Buf.readUint32(), // APPSTATE_* + app_state: Buf.readUint32(), // CARD_APP_STATE_* perso_substate: Buf.readUint32(), // PERSOSUBSTATE_* aid: Buf.readString(), app_label: Buf.readString(), @@ -797,10 +833,15 @@ RIL[REQUEST_ENTER_SIM_PIN] = function REQUEST_ENTER_SIM_PIN() { let response = Buf.readUint32List(); Phone.onEnterICCPIN(response); }; -RIL[REQUEST_ENTER_SIM_PUK] = null; +RIL[REQUEST_ENTER_SIM_PUK] = function REQUEST_ENTER_SIM_PUK() { + let response = Buf.readUint32List(); + Phone.onEnterICCPUK(response); +}; RIL[REQUEST_ENTER_SIM_PIN2] = null; RIL[REQUEST_ENTER_SIM_PUK2] = null; -RIL[REQUEST_CHANGE_SIM_PIN] = null; +RIL[REQUEST_CHANGE_SIM_PIN] = function REQUEST_CHANGE_SIM_PIN() { + Phone.onChangeICCPIN(); +}; RIL[REQUEST_CHANGE_SIM_PIN2] = null; RIL[REQUEST_ENTER_NETWORK_DEPERSONALIZATION] = null; RIL[REQUEST_GET_CURRENT_CALLS] = function REQUEST_GET_CURRENT_CALLS(length) { @@ -1060,7 +1101,9 @@ RIL[UNSOLICITED_CALL_RING] = function UNSOLICITED_CALL_RING() { } Phone.onCallRing(info); }; -RIL[UNSOLICITED_RESPONSE_SIM_STATUS_CHANGED] = null; +RIL[UNSOLICITED_RESPONSE_SIM_STATUS_CHANGED] = function UNSOLICITED_RESPONSE_SIM_STATUS_CHANGED() { + Phone.onICCStatusChanged(); +}; RIL[UNSOLICITED_RESPONSE_CDMA_NEW_SMS] = null; RIL[UNSOLICITED_RESPONSE_NEW_BROADCAST_SMS] = null; RIL[UNSOLICITED_CDMA_RUIM_SMS_STORAGE_FULL] = null; @@ -1113,10 +1156,16 @@ let Phone = { networkSelectionMode: null, /** - * ICC card status + * ICC status. Keeps a reference of the data response to the + * getICCStatus request. */ iccStatus: null, + /** + * Card state + */ + cardState: null, + /** * Active calls */ @@ -1216,7 +1265,7 @@ let Phone = { if (newState == RADIO_STATE_SIM_READY || newState == RADIO_STATE_RUIM_READY || newState == RADIO_STATE_NV_READY) { - // The ICC card has become available. Get all the things. + // The ICC has become available. Get all the things. RIL.getICCStatus(); this.requestNetworkInfo(); RIL.getSignalStrength(); @@ -1307,15 +1356,101 @@ let Phone = { }, onICCStatus: function onICCStatus(iccStatus) { - debug("SIM card state is " + iccStatus.cardState); - debug("Universal PIN state is " + iccStatus.universalPINState); - debug(iccStatus); - //TODO set to simStatus and figure out state transitions. - this.iccStatus = iccStatus; //XXX TODO + if (DEBUG) { + debug("iccStatus: " + JSON.stringify(iccStatus)); + } + this.iccStatus = iccStatus; + + if ((!iccStatus) || (iccStatus.cardState == CARD_STATE_ABSENT)) { + if (DEBUG) debug("ICC absent"); + if (this.cardState == DOM_CARDSTATE_ABSENT) { + return; + } + this.cardState = DOM_CARDSTATE_ABSENT; + this.sendDOMMessage({type: "cardstatechange", + cardState: this.cardState}); + return; + } + + if ((this.radioState == RADIO_STATE_OFF) || + (this.radioState == RADIO_STATE_UNAVAILABLE) || + (this.radioState == RADIO_STATE_SIM_NOT_READY) || + (this.radioState == RADIO_STATE_RUIM_NOT_READY) || + (this.radioState == RADIO_STATE_NV_NOT_READY) || + (this.radioState == RADIO_STATE_NV_READY)) { + if (DEBUG) debug("ICC not ready"); + if (this.cardState == DOM_CARDSTATE_NOT_READY) { + return; + } + this.cardState = DOM_CARDSTATE_NOT_READY; + this.sendDOMMessage({type: "cardstatechange", + cardState: this.cardState}); + return; + } + + if ((this.radioState == RADIO_STATE_SIM_LOCKED_OR_ABSENT) || + (this.radioState == RADIO_STATE_SIM_READY) || + (this.radioState == RADIO_STATE_RUIM_LOCKED_OR_ABSENT) || + (this.radioState == RADIO_STATE_RUIM_READY)) { + let app = iccStatus.apps[iccStatus.gsmUmtsSubscriptionAppIndex]; + if (!app) { + if (DEBUG) { + debug("Subscription application is not present in iccStatus."); + } + if (this.cardState == DOM_CARDSTATE_ABSENT) { + return; + } + this.cardState = DOM_CARDSTATE_ABSENT; + this.sendDOMMessage({type: "cardstatechange", + cardState: this.cardState}); + return; + } + + let newCardState; + switch (app.app_state) { + case CARD_APP_STATE_PIN: + newCardState = DOM_CARDSTATE_PIN_REQUIRED; + break; + case CARD_APP_STATE_PUK: + newCardState = DOM_CARDSTATE_PUK_REQUIRED; + break; + case CARD_APP_STATE_SUBSCRIPTION_PERSO: + newCardState = DOM_CARDSTATE_NETWORK_LOCKED; + break; + case CARD_APP_STATE_READY: + newCardState = DOM_CARDSTATE_READY; + break; + case CARD_APP_STATE_UNKNOWN: + case CARD_APP_STATE_DETECTED: + default: + newCardState = DOM_CARDSTATE_NOT_READY; + } + + if (this.cardState == newCardState) { + return; + } + this.cardState = newCardState; + this.sendDOMMessage({type: "cardstatechange", + cardState: this.cardState}); + } + }, + + onICCStatusChanged: function onICCStatusChanged() { + RIL.getICCStatus(); }, onEnterICCPIN: function onEnterICCPIN(response) { - debug("REQUEST_ENTER_SIM_PIN returned " + response); + if (DEBUG) debug("REQUEST_ENTER_SIM_PIN returned " + response); + //TODO + }, + + onChangeICCPIN: function onChangeICCPIN() { + if (DEBUG) debug("REQUEST_CHANGE_SIM_PIN"); + //TODO + }, + + onEnterICCPUK: function onEnterICCPUK(response) { + if (DEBUG) debug("REQUEST_ENTER_SIM_PUK returned " + response); //TODO }, @@ -1349,7 +1484,7 @@ let Phone = { onOperator: function onOperator(operator) { if (operator.length < 3) { - debug("Expected at least 3 strings for operator."); + if (DEBUG) debug("Expected at least 3 strings for operator."); } if (!this.operator || this.operator.alphaLong != operator[0] || @@ -1414,9 +1549,9 @@ let Phone = { // An SMS is a string, but we won't read it as such, so let's read the // string length and then defer to PDU parsing helper. let messageStringLength = Buf.readUint32(); - debug("Got new SMS, length " + messageStringLength); + if (DEBUG) debug("Got new SMS, length " + messageStringLength); let message = GsmPDUHelper.readMessage(); - debug(message); + if (DEBUG) debug(message); // Read string delimiters. See Buf.readString(). let delimiter = Buf.readUint16(); @@ -1581,7 +1716,9 @@ let Phone = { //TODO: we shouldn't get here, but if we do, we might want to hold on // to the message and retry once we know the SMSC... or just notify an // error to the mainthread and let them deal with retrying? - debug("Cannot send the SMS. Need to get the SMSC address first."); + if (DEBUG) { + debug("Cannot send the SMS. Need to get the SMSC address first."); + } return; } //TODO: verify values on 'options' @@ -1602,7 +1739,9 @@ let Phone = { if (DEBUG) debug("Received DOM message " + JSON.stringify(message)); let method = this[message.type]; if (typeof method != "function") { - debug("Don't know what to do with message " + JSON.stringify(message)); + if (DEBUG) { + debug("Don't know what to do with message " + JSON.stringify(message)); + } return; } method.call(this, message); @@ -1726,7 +1865,7 @@ let GsmPDUHelper = { /** * Write numerical data as swapped nibble BCD. - * + * * @param data * Data to write (as a string or a number) */ From 176bb0c176c2102e885422d6f973d1adb0708504 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Wed, 11 Jan 2012 11:58:43 +1300 Subject: [PATCH 007/165] Bug 716417 - Don't add media elements to the element table twice if when we hit decode thread limit. r=roc --- .../html/content/src/nsHTMLMediaElement.cpp | 47 +++++++++++++++++++ content/media/nsBuiltinDecoder.cpp | 2 + 2 files changed, 49 insertions(+) diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index f939116f68e..2ff46558475 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -1317,21 +1317,51 @@ typedef nsTHashtable MediaElementURITable; // same mLoadingSrc. static MediaElementURITable* gElementTable; +#ifdef DEBUG +// Returns the number of times aElement appears in the media element table +// for aURI. If this returns other than 0 or 1, there's a bug somewhere! +static unsigned +MediaElementTableCount(nsHTMLMediaElement* aElement, nsIURI* aURI) +{ + if (!gElementTable || !aElement || !aURI) { + return 0; + } + MediaElementSetForURI* entry = gElementTable->GetEntry(aURI); + if (!entry) { + return 0; + } + PRUint32 count = 0; + for (PRUint32 i = 0; i < entry->mElements.Length(); ++i) { + nsHTMLMediaElement* elem = entry->mElements[i]; + if (elem == aElement) { + count++; + } + } + return count; +} +#endif + void nsHTMLMediaElement::AddMediaElementToURITable() { NS_ASSERTION(mDecoder && mDecoder->GetStream(), "Call this only with decoder Load called"); + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, + "Should not have entry for element in element table before addition"); if (!gElementTable) { gElementTable = new MediaElementURITable(); gElementTable->Init(); } MediaElementSetForURI* entry = gElementTable->PutEntry(mLoadingSrc); entry->mElements.AppendElement(this); + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 1, + "Should have a single entry for element in element table after addition"); } void nsHTMLMediaElement::RemoveMediaElementFromURITable() { + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 1, + "Before remove, should have a single entry for element in element table"); NS_ASSERTION(mDecoder, "Don't call this without decoder!"); NS_ASSERTION(mLoadingSrc, "Can't have decoder without source!"); if (!gElementTable) @@ -1347,6 +1377,8 @@ nsHTMLMediaElement::RemoveMediaElementFromURITable() gElementTable = nsnull; } } + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, + "After remove, should no longer have an entry in element table"); } nsHTMLMediaElement* @@ -1431,6 +1463,10 @@ nsHTMLMediaElement::~nsHTMLMediaElement() RemoveMediaElementFromURITable(); mDecoder->Shutdown(); } + + NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, + "Destroyed media element should no longer be in element table"); + if (mChannel) { mChannel->Cancel(NS_BINDING_ABORTED); } @@ -1951,6 +1987,7 @@ nsHTMLMediaElement::CreateDecoder(const nsACString& aType) nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal) { NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set"); + NS_ASSERTION(mDecoder == nsnull, "Shouldn't have a decoder"); nsMediaStream* originalStream = aOriginal->GetStream(); if (!originalStream) @@ -1990,6 +2027,7 @@ nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel, nsIStreamListener **aListener) { NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set"); + NS_ASSERTION(mDecoder == nsnull, "Shouldn't have a decoder"); nsCAutoString mimeType; aChannel->GetContentType(mimeType); @@ -2059,6 +2097,15 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder) NotifyAudioAvailableListener(); } + if (NS_FAILED(rv)) { + RemoveMediaElementFromURITable(); + mDecoder->Shutdown(); + mDecoder = nsnull; + } + + NS_ASSERTION(NS_SUCCEEDED(rv) == (MediaElementTableCount(this, mLoadingSrc) == 1), + "Media element should have single table entry if decode initialized"); + mBegun = true; return rv; } diff --git a/content/media/nsBuiltinDecoder.cpp b/content/media/nsBuiltinDecoder.cpp index 120171e644e..511c83b948a 100644 --- a/content/media/nsBuiltinDecoder.cpp +++ b/content/media/nsBuiltinDecoder.cpp @@ -202,12 +202,14 @@ nsresult nsBuiltinDecoder::Load(nsMediaStream* aStream, mDecoderStateMachine = CreateStateMachine(); if (!mDecoderStateMachine) { + LOG(PR_LOG_DEBUG, ("%p Failed to create state machine!", this)); return NS_ERROR_FAILURE; } nsBuiltinDecoder* cloneDonor = static_cast(aCloneDonor); if (NS_FAILED(mDecoderStateMachine->Init(cloneDonor ? cloneDonor->mDecoderStateMachine : nsnull))) { + LOG(PR_LOG_DEBUG, ("%p Failed to init state machine!", this)); return NS_ERROR_FAILURE; } { From 0b10e8edb8988c5e76ab5dbf6be8e6bcc7c8d44a Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Tue, 10 Jan 2012 15:32:58 -0800 Subject: [PATCH 008/165] Bug 717004: Drop unused/unnecessary rv from GetLayoutHistoryAndKey, and check rv of nsILayoutHistoryState::GetState before using its output. r=volkmar --- content/html/content/src/nsGenericHTMLElement.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 8300ac19c72..cb28a0c1465 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1624,16 +1624,16 @@ nsGenericHTMLElement::RestoreFormControlState(nsGenericHTMLElement* aContent, { nsCOMPtr history; nsCAutoString key; - nsresult rv = GetLayoutHistoryAndKey(aContent, true, - getter_AddRefs(history), key); + GetLayoutHistoryAndKey(aContent, true, + getter_AddRefs(history), key); if (!history) { return false; } nsPresState *state; // Get the pres state for this key - rv = history->GetState(key, &state); - if (state) { + nsresult rv = history->GetState(key, &state); + if (NS_SUCCEEDED(rv) && state) { bool result = aControl->RestoreState(state); history->RemoveState(key); return result; From 6eeeb1f9b30e27aa6975ec7f89af3b3d98cf8ada Mon Sep 17 00:00:00 2001 From: Florian Scholz Date: Tue, 10 Jan 2012 23:49:26 +0000 Subject: [PATCH 009/165] Bug 696647 - Remove invalid MathML atoms; r=karlt --- content/base/src/nsGkAtomList.h | 4 ---- content/base/src/nsTreeSanitizer.cpp | 4 ---- 2 files changed, 8 deletions(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 646e1f73ca4..51a2f1b49d6 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -1537,9 +1537,7 @@ GK_ATOM(lspace_, "lspace") GK_ATOM(lt_, "lt") GK_ATOM(maction_, "maction") GK_ATOM(maligngroup_, "maligngroup") -GK_ATOM(malign_, "malign") GK_ATOM(malignmark_, "malignmark") -GK_ATOM(malignscope_, "malignscope") GK_ATOM(mathbackground_, "mathbackground") GK_ATOM(mathcolor_, "mathcolor") GK_ATOM(mathsize_, "mathsize") @@ -1553,7 +1551,6 @@ GK_ATOM(menclose_, "menclose") GK_ATOM(merror_, "merror") GK_ATOM(mfenced_, "mfenced") GK_ATOM(mfrac_, "mfrac") -GK_ATOM(mfraction_, "mfraction") GK_ATOM(mglyph_, "mglyph") GK_ATOM(mi_, "mi") GK_ATOM(minlabelspacing_, "minlabelspacing") @@ -1566,7 +1563,6 @@ GK_ATOM(mn_, "mn") GK_ATOM(momentabout_, "momentabout") GK_ATOM(moment_, "moment") GK_ATOM(mo_, "mo") -GK_ATOM(monospaced_, "monospaced") GK_ATOM(movablelimits_, "movablelimits") GK_ATOM(mover_, "mover") GK_ATOM(mpadded_, "mpadded") diff --git a/content/base/src/nsTreeSanitizer.cpp b/content/base/src/nsTreeSanitizer.cpp index 01bd513d2be..ef5c84d3f3b 100644 --- a/content/base/src/nsTreeSanitizer.cpp +++ b/content/base/src/nsTreeSanitizer.cpp @@ -738,10 +738,8 @@ nsIAtom** const kElementsMathML[] = { &nsGkAtoms::lowlimit_, // lowlimit &nsGkAtoms::lt_, // lt &nsGkAtoms::maction_, // maction - &nsGkAtoms::malign_, // malign &nsGkAtoms::maligngroup_, // maligngroup &nsGkAtoms::malignmark_, // malignmark - &nsGkAtoms::malignscope_, // malignscope &nsGkAtoms::math, // math &nsGkAtoms::matrix, // matrix &nsGkAtoms::matrixrow_, // matrixrow @@ -752,7 +750,6 @@ nsIAtom** const kElementsMathML[] = { &nsGkAtoms::merror_, // merror &nsGkAtoms::mfenced_, // mfenced &nsGkAtoms::mfrac_, // mfrac - &nsGkAtoms::mfraction_, // mfraction &nsGkAtoms::mglyph_, // mglyph &nsGkAtoms::mi_, // mi &nsGkAtoms::min, // min @@ -924,7 +921,6 @@ nsIAtom** const kAttributesMathML[] = { &nsGkAtoms::mediummathspace_, // mediummathspace &nsGkAtoms::minlabelspacing_, // minlabelspacing &nsGkAtoms::minsize_, // minsize - &nsGkAtoms::monospaced_, // monospaced &nsGkAtoms::movablelimits_, // movablelimits &nsGkAtoms::msgroup_, // msgroup &nsGkAtoms::name, // name From 78570190e0cb5d8a1df11e32ad3b92b1f692db98 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Tue, 10 Jan 2012 19:23:31 -0500 Subject: [PATCH 010/165] Bug 717019 - Attempt to fix intermittent timeout of test_getContentState.html by switching from http://example.net (which is a live domain) to http://example.org (which is faked by mochitest). r=me --- dom/tests/mochitest/general/test_getContentState.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/tests/mochitest/general/test_getContentState.html b/dom/tests/mochitest/general/test_getContentState.html index df8be90adb4..ebc18d9e0d9 100644 --- a/dom/tests/mochitest/general/test_getContentState.html +++ b/dom/tests/mochitest/general/test_getContentState.html @@ -135,7 +135,7 @@ function iframeLoaded() { - + From 08c9e05cce5d67d96510f7b19076b61c198e298d Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 11 Jan 2012 13:33:20 +1300 Subject: [PATCH 011/165] Bug 715916 - Check the result of GetFrame in RasterImage::GetImageContainer. r=joe --- image/src/RasterImage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index bf33f74bb50..bdc964da682 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -954,7 +954,9 @@ RasterImage::GetImageContainer(LayerManager* aManager, CairoImage::Data cairoData; nsRefPtr imageSurface; - GetFrame(FRAME_CURRENT, FLAG_SYNC_DECODE, getter_AddRefs(imageSurface)); + nsresult rv = GetFrame(FRAME_CURRENT, FLAG_SYNC_DECODE, getter_AddRefs(imageSurface)); + NS_ENSURE_SUCCESS(rv, rv); + cairoData.mSurface = imageSurface; GetWidth(&cairoData.mSize.width); GetHeight(&cairoData.mSize.height); From ed04f5bb8eb9f9516096d1d485234763f796387a Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 11 Jan 2012 01:22:15 +0000 Subject: [PATCH 012/165] Backout b9e154713763 (bug 702158) for pgo linux failures --- config/system-headers | 5 ---- configure.in | 2 +- .../src/nsCanvasRenderingContext2DAzure.cpp | 2 +- gfx/skia/Makefile.in | 14 ----------- gfx/thebes/gfxPlatformGtk.cpp | 25 ------------------- gfx/thebes/gfxPlatformGtk.h | 5 ---- js/src/config/system-headers | 5 ---- 7 files changed, 2 insertions(+), 56 deletions(-) diff --git a/config/system-headers b/config/system-headers index a4c34167f19..6544f6b7ed0 100644 --- a/config/system-headers +++ b/config/system-headers @@ -268,11 +268,6 @@ freetype/ftoutln.h freetype/ttnameid.h freetype/tttables.h freetype/t1tables.h -freetype/ftlcdfil.h -freetype/ftsizes.h -freetype/ftadvanc.h -freetype/ftbitmap.h -freetype/ftxf86.h fribidi/fribidi.h FSp_fopen.h fstream diff --git a/configure.in b/configure.in index afb83cf82ad..21f3fb702e9 100644 --- a/configure.in +++ b/configure.in @@ -7997,7 +7997,7 @@ dnl ======================================================== dnl Graphics checks. dnl ======================================================== -if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then +if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android"; then MOZ_ENABLE_SKIA=1 else MOZ_ENABLE_SKIA= diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp index d9c5a861982..866fc655cc2 100644 --- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -995,7 +995,7 @@ NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult) !Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) { return NS_ERROR_NOT_AVAILABLE; } -#elif !defined(XP_MACOSX) && !defined(ANDROID) && !defined(XP_LINUX) +#elif !defined(XP_MACOSX) && !defined(ANDROID) return NS_ERROR_NOT_AVAILABLE; #endif diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in index 2ead7b8ea2c..1a41171fa19 100644 --- a/gfx/skia/Makefile.in +++ b/gfx/skia/Makefile.in @@ -68,7 +68,6 @@ VPATH += \ $(srcdir)/src/ports \ $(srcdir)/src/opts \ $(srcdir)/src/effects \ - $(srcdir)/src/utils \ $(NULL) EXPORTS_skia = \ @@ -320,19 +319,6 @@ DEFINES += -DSK_BUILD_FOR_ANDROID_NDK OS_CXXFLAGS += $(CAIRO_FT_CFLAGS) endif -ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT)) -CPPSRCS += \ - SkFontHost_FreeType.cpp \ - SkFontHost_linux.cpp \ - SkFontHost_gamma.cpp \ - SkTime_Unix.cpp \ - SkMMapStream.cpp \ - SkOSFile.cpp \ - $(NULL) - -OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS) -endif - ifeq (windows,$(MOZ_WIDGET_TOOLKIT)) EXPORTS_skia += \ include/config/sk_stdint.h \ diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index c3614d8ccbe..94e5ab27e8e 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -56,8 +56,6 @@ #include "gfxFT2Fonts.h" #endif -#include "mozilla/gfx/2D.h" - #include "cairo.h" #include @@ -85,9 +83,6 @@ #include FT_FREETYPE_H #endif -using namespace mozilla; -using namespace mozilla::gfx; - gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull; #ifndef MOZ_PANGO @@ -766,23 +761,3 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target) return NULL; } - -RefPtr -gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont) -{ - NativeFont nativeFont; - nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE; - nativeFont.mFont = aFont; - RefPtr scaledFont = - Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize()); - - return scaledFont; -} - -bool -gfxPlatformGtk::SupportsAzure(BackendType& aBackend) -{ - aBackend = BACKEND_SKIA; - return true; -} - diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h index 2ec617c19c1..b383f30d7af 100644 --- a/gfx/thebes/gfxPlatformGtk.h +++ b/gfx/thebes/gfxPlatformGtk.h @@ -66,11 +66,6 @@ public: already_AddRefed CreateOffscreenSurface(const gfxIntSize& size, gfxASurface::gfxContentType contentType); - mozilla::RefPtr - GetScaledFontForFont(gfxFont *aFont); - - virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend); - nsresult GetFontList(nsIAtom *aLangGroup, const nsACString& aGenericFamily, nsTArray& aListOfFonts); diff --git a/js/src/config/system-headers b/js/src/config/system-headers index a4c34167f19..6544f6b7ed0 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -268,11 +268,6 @@ freetype/ftoutln.h freetype/ttnameid.h freetype/tttables.h freetype/t1tables.h -freetype/ftlcdfil.h -freetype/ftsizes.h -freetype/ftadvanc.h -freetype/ftbitmap.h -freetype/ftxf86.h fribidi/fribidi.h FSp_fopen.h fstream From cfdfba830e1a50fdf2d5129a74a524b6c7daa40b Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 11 Jan 2012 01:44:45 +0000 Subject: [PATCH 013/165] Bug 714694 - Part 1, Add IdleService to gonk backend; r=mwu --- widget/gonk/Makefile.in | 1 + widget/gonk/nsIdleServiceGonk.cpp | 57 +++++++++++++++++++++++++++++++ widget/gonk/nsIdleServiceGonk.h | 57 +++++++++++++++++++++++++++++++ widget/gonk/nsWidgetFactory.cpp | 5 +++ 4 files changed, 120 insertions(+) create mode 100644 widget/gonk/nsIdleServiceGonk.cpp create mode 100644 widget/gonk/nsIdleServiceGonk.h diff --git a/widget/gonk/Makefile.in b/widget/gonk/Makefile.in index a6cf5f3dec4..32e8505b4a7 100644 --- a/widget/gonk/Makefile.in +++ b/widget/gonk/Makefile.in @@ -58,6 +58,7 @@ CPPSRCS = \ nsWindow.cpp \ nsLookAndFeel.cpp \ nsScreenManagerGonk.cpp \ + nsIdleServiceGonk.cpp \ $(NULL) SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a diff --git a/widget/gonk/nsIdleServiceGonk.cpp b/widget/gonk/nsIdleServiceGonk.cpp new file mode 100644 index 00000000000..188ac5a9571 --- /dev/null +++ b/widget/gonk/nsIdleServiceGonk.cpp @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Gijs Kruitbosch . + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu + * Kan-Ru Chen + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIdleServiceGonk.h" +#include "nsIServiceManager.h" + +NS_IMPL_ISUPPORTS2(nsIdleServiceGonk, nsIIdleService, nsIdleService) + +bool +nsIdleServiceGonk::PollIdleTime(PRUint32 *aIdleTime) +{ + return false; +} + +bool +nsIdleServiceGonk::UsePollMode() +{ + return false; +} diff --git a/widget/gonk/nsIdleServiceGonk.h b/widget/gonk/nsIdleServiceGonk.h new file mode 100644 index 00000000000..8232fbbca43 --- /dev/null +++ b/widget/gonk/nsIdleServiceGonk.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Gijs Kruitbosch . + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu + * Kan-Ru Chen + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsIdleServiceGonk_h__ +#define nsIdleServiceGonk_h__ + +#include "nsIdleService.h" + +class nsIdleServiceGonk : public nsIdleService +{ +public: + NS_DECL_ISUPPORTS + + bool PollIdleTime(PRUint32* aIdleTime); +protected: + bool UsePollMode(); +}; + +#endif // nsIdleServiceGonk_h__ diff --git a/widget/gonk/nsWidgetFactory.cpp b/widget/gonk/nsWidgetFactory.cpp index 38d1ec3ddf9..9a728ccbdd6 100644 --- a/widget/gonk/nsWidgetFactory.cpp +++ b/widget/gonk/nsWidgetFactory.cpp @@ -46,6 +46,7 @@ #include "nsLookAndFeel.h" #include "nsAppShellSingleton.h" #include "nsScreenManagerGonk.h" +#include "nsIdleServiceGonk.h" #include "nsHTMLFormatConverter.h" #include "nsXULAppAPI.h" @@ -53,12 +54,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceGonk) NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); NS_DEFINE_NAMED_CID(NS_WINDOW_CID); NS_DEFINE_NAMED_CID(NS_CHILD_CID); NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, NULL, nsWindowConstructor }, @@ -66,6 +69,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor }, { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerGonkConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, + { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor }, { NULL } }; @@ -75,6 +79,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/appshell/gonk;1", &kNS_APPSHELL_CID }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, + { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { NULL } }; From 269d831b1d242ed0d77bfd4fab525fb70be026bc Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 11 Jan 2012 01:44:46 +0000 Subject: [PATCH 014/165] Bug 714694 - Part 2, Track user activity in gonk backend; r=mwu --- widget/gonk/nsWindow.cpp | 13 +++++++++++++ widget/gonk/nsWindow.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index cb52758cb38..5d6c58c5c74 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -49,6 +49,7 @@ #include "nsAutoPtr.h" #include "nsAppShell.h" #include "nsTArray.h" +#include "nsIdleService.h" #include "nsWindow.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args) @@ -141,6 +142,7 @@ nsWindow::DispatchInputEvent(nsGUIEvent &aEvent) if (!gFocusedWindow) return nsEventStatus_eIgnore; + gFocusedWindow->UserActivity(); aEvent.widget = gFocusedWindow; return gFocusedWindow->mEventCallback(&aEvent); } @@ -443,3 +445,14 @@ nsWindow::BringToTop() Update(); } +void +nsWindow::UserActivity() +{ + if (!mIdleService) { + mIdleService = do_GetService("@mozilla.org/widget/idleservice;1"); + } + + if (mIdleService) { + mIdleService->ResetIdleTimeOut(); + } +} diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 743067c5c39..ac899962667 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -42,6 +42,8 @@ extern nsIntRect gScreenBounds; +class nsIdleService; + namespace mozilla { namespace gl { class GLContext; @@ -131,8 +133,13 @@ protected: bool mVisible; nsIntRegion mDirtyRegion; InputContext mInputContext; + nsCOMPtr mIdleService; void BringToTop(); + + // Call this function when the users activity is the direct cause of an + // event (like a keypress or mouse click). + void UserActivity(); }; #endif /* nsWindow_h */ From e9f0c952470417d619b1aa8a0540fbc8dcfad2dd Mon Sep 17 00:00:00 2001 From: "julian.reschke@gmx.de" Date: Tue, 10 Jan 2012 20:06:17 -0500 Subject: [PATCH 015/165] Bug 716961 - clean up HTTP header field name constants in nsHttpAtomList.h r=bz --HG-- extra : rebase_source : c4158e1795522f37aa47b946b1b7e2ee2d758a71 --- netwerk/protocol/http/nsHttpAtomList.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/netwerk/protocol/http/nsHttpAtomList.h b/netwerk/protocol/http/nsHttpAtomList.h index 403f559059f..58fcbb0dce8 100644 --- a/netwerk/protocol/http/nsHttpAtomList.h +++ b/netwerk/protocol/http/nsHttpAtomList.h @@ -61,7 +61,6 @@ HTTP_ATOM(Authentication, "Authentication") HTTP_ATOM(Authorization, "Authorization") HTTP_ATOM(Cache_Control, "Cache-Control") HTTP_ATOM(Connection, "Connection") -HTTP_ATOM(Content_Base, "Content-Base") HTTP_ATOM(Content_Disposition, "Content-Disposition") HTTP_ATOM(Content_Encoding, "Content-Encoding") HTTP_ATOM(Content_Language, "Content-Language") @@ -69,24 +68,20 @@ HTTP_ATOM(Content_Length, "Content-Length") HTTP_ATOM(Content_Location, "Content-Location") HTTP_ATOM(Content_MD5, "Content-MD5") HTTP_ATOM(Content_Range, "Content-Range") -HTTP_ATOM(Content_Transfer_Encoding, "Content-Transfer-Encoding") HTTP_ATOM(Content_Type, "Content-Type") HTTP_ATOM(Cookie, "Cookie") HTTP_ATOM(Date, "Date") HTTP_ATOM(DAV, "DAV") HTTP_ATOM(Depth, "Depth") -HTTP_ATOM(Derived_From, "Derived-From") HTTP_ATOM(Destination, "Destination") HTTP_ATOM(DoNotTrack, "DNT") HTTP_ATOM(ETag, "Etag") HTTP_ATOM(Expect, "Expect") HTTP_ATOM(Expires, "Expires") -HTTP_ATOM(Forwarded, "Forwarded") HTTP_ATOM(From, "From") HTTP_ATOM(Host, "Host") HTTP_ATOM(If, "If") HTTP_ATOM(If_Match, "If-Match") -HTTP_ATOM(If_Match_Any, "If-Match-Any") HTTP_ATOM(If_Modified_Since, "If-Modified-Since") HTTP_ATOM(If_None_Match, "If-None-Match") HTTP_ATOM(If_None_Match_Any, "If-None-Match-Any") @@ -98,8 +93,6 @@ HTTP_ATOM(Lock_Token, "Lock-Token") HTTP_ATOM(Link, "Link") HTTP_ATOM(Location, "Location") HTTP_ATOM(Max_Forwards, "Max-Forwards") -HTTP_ATOM(Message_Id, "Message-Id") -HTTP_ATOM(Mime, "Mime") HTTP_ATOM(Overwrite, "Overwrite") HTTP_ATOM(Pragma, "Pragma") HTTP_ATOM(Proxy_Authenticate, "Proxy-Authenticate") From 2d1629e4833cb7ac75fca94f70793ab82d046f93 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Tue, 10 Jan 2012 20:07:29 -0500 Subject: [PATCH 016/165] bug 716871 remove nshttp::CLAMP r=jduell --HG-- extra : rebase_source : 52fb3f75e30bb1e329c2e3cfe2ef6e758adb5b60 --- netwerk/protocol/http/HttpChannelChild.cpp | 2 +- netwerk/protocol/http/nsHttp.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index bbc35ff884c..f7aa2ff7542 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -1217,7 +1217,7 @@ HttpChannelChild::ResumeAt(PRUint64 startPos, const nsACString& entityID) NS_IMETHODIMP HttpChannelChild::SetPriority(PRInt32 aPriority) { - PRInt16 newValue = CLAMP(aPriority, PR_INT16_MIN, PR_INT16_MAX); + PRInt16 newValue = clamped(aPriority, PR_INT16_MIN, PR_INT16_MAX); if (mPriority == newValue) return NS_OK; mPriority = newValue; diff --git a/netwerk/protocol/http/nsHttp.h b/netwerk/protocol/http/nsHttp.h index f2106d9175b..551f6e9ba9a 100644 --- a/netwerk/protocol/http/nsHttp.h +++ b/netwerk/protocol/http/nsHttp.h @@ -234,10 +234,6 @@ PRTimeToSeconds(PRTime t_usec) #define NowInSeconds() PRTimeToSeconds(PR_Now()) -// ripped from glib.h -#undef CLAMP -#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - // round q-value to one decimal place; return most significant digit as uint. #define QVAL_TO_UINT(q) ((unsigned int) ((q + 0.05) * 10.0)) From 8eb8a4528178cd7878c456d9ee124617ff909853 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 11 Jan 2012 02:06:28 +0000 Subject: [PATCH 017/165] Backout 4c84b021a3c8 & d16206820082 (bug 714694) to correct patch author --- widget/gonk/Makefile.in | 1 - widget/gonk/nsIdleServiceGonk.cpp | 57 ------------------------------- widget/gonk/nsIdleServiceGonk.h | 57 ------------------------------- widget/gonk/nsWidgetFactory.cpp | 5 --- widget/gonk/nsWindow.cpp | 13 ------- widget/gonk/nsWindow.h | 7 ---- 6 files changed, 140 deletions(-) delete mode 100644 widget/gonk/nsIdleServiceGonk.cpp delete mode 100644 widget/gonk/nsIdleServiceGonk.h diff --git a/widget/gonk/Makefile.in b/widget/gonk/Makefile.in index 32e8505b4a7..a6cf5f3dec4 100644 --- a/widget/gonk/Makefile.in +++ b/widget/gonk/Makefile.in @@ -58,7 +58,6 @@ CPPSRCS = \ nsWindow.cpp \ nsLookAndFeel.cpp \ nsScreenManagerGonk.cpp \ - nsIdleServiceGonk.cpp \ $(NULL) SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a diff --git a/widget/gonk/nsIdleServiceGonk.cpp b/widget/gonk/nsIdleServiceGonk.cpp deleted file mode 100644 index 188ac5a9571..00000000000 --- a/widget/gonk/nsIdleServiceGonk.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:expandtab:shiftwidth=4:tabstop=4: - */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Gijs Kruitbosch . - * Portions created by the Initial Developer are Copyright (C) 2007 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Michael Wu - * Kan-Ru Chen - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsIdleServiceGonk.h" -#include "nsIServiceManager.h" - -NS_IMPL_ISUPPORTS2(nsIdleServiceGonk, nsIIdleService, nsIdleService) - -bool -nsIdleServiceGonk::PollIdleTime(PRUint32 *aIdleTime) -{ - return false; -} - -bool -nsIdleServiceGonk::UsePollMode() -{ - return false; -} diff --git a/widget/gonk/nsIdleServiceGonk.h b/widget/gonk/nsIdleServiceGonk.h deleted file mode 100644 index 8232fbbca43..00000000000 --- a/widget/gonk/nsIdleServiceGonk.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:expandtab:shiftwidth=4:tabstop=4: - */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Gijs Kruitbosch . - * Portions created by the Initial Developer are Copyright (C) 2007 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Michael Wu - * Kan-Ru Chen - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIdleServiceGonk_h__ -#define nsIdleServiceGonk_h__ - -#include "nsIdleService.h" - -class nsIdleServiceGonk : public nsIdleService -{ -public: - NS_DECL_ISUPPORTS - - bool PollIdleTime(PRUint32* aIdleTime); -protected: - bool UsePollMode(); -}; - -#endif // nsIdleServiceGonk_h__ diff --git a/widget/gonk/nsWidgetFactory.cpp b/widget/gonk/nsWidgetFactory.cpp index 9a728ccbdd6..38d1ec3ddf9 100644 --- a/widget/gonk/nsWidgetFactory.cpp +++ b/widget/gonk/nsWidgetFactory.cpp @@ -46,7 +46,6 @@ #include "nsLookAndFeel.h" #include "nsAppShellSingleton.h" #include "nsScreenManagerGonk.h" -#include "nsIdleServiceGonk.h" #include "nsHTMLFormatConverter.h" #include "nsXULAppAPI.h" @@ -54,14 +53,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceGonk) NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); NS_DEFINE_NAMED_CID(NS_WINDOW_CID); NS_DEFINE_NAMED_CID(NS_CHILD_CID); NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); -NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, NULL, nsWindowConstructor }, @@ -69,7 +66,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor }, { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerGonkConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, - { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor }, { NULL } }; @@ -79,7 +75,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/appshell/gonk;1", &kNS_APPSHELL_CID }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, - { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { NULL } }; diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 5d6c58c5c74..cb52758cb38 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -49,7 +49,6 @@ #include "nsAutoPtr.h" #include "nsAppShell.h" #include "nsTArray.h" -#include "nsIdleService.h" #include "nsWindow.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args) @@ -142,7 +141,6 @@ nsWindow::DispatchInputEvent(nsGUIEvent &aEvent) if (!gFocusedWindow) return nsEventStatus_eIgnore; - gFocusedWindow->UserActivity(); aEvent.widget = gFocusedWindow; return gFocusedWindow->mEventCallback(&aEvent); } @@ -445,14 +443,3 @@ nsWindow::BringToTop() Update(); } -void -nsWindow::UserActivity() -{ - if (!mIdleService) { - mIdleService = do_GetService("@mozilla.org/widget/idleservice;1"); - } - - if (mIdleService) { - mIdleService->ResetIdleTimeOut(); - } -} diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index ac899962667..743067c5c39 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -42,8 +42,6 @@ extern nsIntRect gScreenBounds; -class nsIdleService; - namespace mozilla { namespace gl { class GLContext; @@ -133,13 +131,8 @@ protected: bool mVisible; nsIntRegion mDirtyRegion; InputContext mInputContext; - nsCOMPtr mIdleService; void BringToTop(); - - // Call this function when the users activity is the direct cause of an - // event (like a keypress or mouse click). - void UserActivity(); }; #endif /* nsWindow_h */ From ea114890d0cde76bac43bd9a0141af703e4cf081 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Wed, 11 Jan 2012 02:06:59 +0000 Subject: [PATCH 018/165] Bug 714694 - Part 1, Add IdleService to gonk backend; r=mwu --- widget/gonk/Makefile.in | 1 + widget/gonk/nsIdleServiceGonk.cpp | 57 +++++++++++++++++++++++++++++++ widget/gonk/nsIdleServiceGonk.h | 57 +++++++++++++++++++++++++++++++ widget/gonk/nsWidgetFactory.cpp | 5 +++ 4 files changed, 120 insertions(+) create mode 100644 widget/gonk/nsIdleServiceGonk.cpp create mode 100644 widget/gonk/nsIdleServiceGonk.h diff --git a/widget/gonk/Makefile.in b/widget/gonk/Makefile.in index a6cf5f3dec4..32e8505b4a7 100644 --- a/widget/gonk/Makefile.in +++ b/widget/gonk/Makefile.in @@ -58,6 +58,7 @@ CPPSRCS = \ nsWindow.cpp \ nsLookAndFeel.cpp \ nsScreenManagerGonk.cpp \ + nsIdleServiceGonk.cpp \ $(NULL) SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a diff --git a/widget/gonk/nsIdleServiceGonk.cpp b/widget/gonk/nsIdleServiceGonk.cpp new file mode 100644 index 00000000000..188ac5a9571 --- /dev/null +++ b/widget/gonk/nsIdleServiceGonk.cpp @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Gijs Kruitbosch . + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu + * Kan-Ru Chen + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIdleServiceGonk.h" +#include "nsIServiceManager.h" + +NS_IMPL_ISUPPORTS2(nsIdleServiceGonk, nsIIdleService, nsIdleService) + +bool +nsIdleServiceGonk::PollIdleTime(PRUint32 *aIdleTime) +{ + return false; +} + +bool +nsIdleServiceGonk::UsePollMode() +{ + return false; +} diff --git a/widget/gonk/nsIdleServiceGonk.h b/widget/gonk/nsIdleServiceGonk.h new file mode 100644 index 00000000000..8232fbbca43 --- /dev/null +++ b/widget/gonk/nsIdleServiceGonk.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Gijs Kruitbosch . + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu + * Kan-Ru Chen + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsIdleServiceGonk_h__ +#define nsIdleServiceGonk_h__ + +#include "nsIdleService.h" + +class nsIdleServiceGonk : public nsIdleService +{ +public: + NS_DECL_ISUPPORTS + + bool PollIdleTime(PRUint32* aIdleTime); +protected: + bool UsePollMode(); +}; + +#endif // nsIdleServiceGonk_h__ diff --git a/widget/gonk/nsWidgetFactory.cpp b/widget/gonk/nsWidgetFactory.cpp index 38d1ec3ddf9..9a728ccbdd6 100644 --- a/widget/gonk/nsWidgetFactory.cpp +++ b/widget/gonk/nsWidgetFactory.cpp @@ -46,6 +46,7 @@ #include "nsLookAndFeel.h" #include "nsAppShellSingleton.h" #include "nsScreenManagerGonk.h" +#include "nsIdleServiceGonk.h" #include "nsHTMLFormatConverter.h" #include "nsXULAppAPI.h" @@ -53,12 +54,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceGonk) NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); NS_DEFINE_NAMED_CID(NS_WINDOW_CID); NS_DEFINE_NAMED_CID(NS_CHILD_CID); NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_WINDOW_CID, false, NULL, nsWindowConstructor }, @@ -66,6 +69,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor }, { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerGonkConstructor }, { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, + { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor }, { NULL } }; @@ -75,6 +79,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/appshell/gonk;1", &kNS_APPSHELL_CID }, { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID }, { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, + { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { NULL } }; From 61a59e26f5080b956e3566d5b8ee37367a74b808 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Wed, 11 Jan 2012 02:07:00 +0000 Subject: [PATCH 019/165] Bug 714694 - Part 2, Track user activity in gonk backend; r=mwu DONTBUILD --- widget/gonk/nsWindow.cpp | 13 +++++++++++++ widget/gonk/nsWindow.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index cb52758cb38..5d6c58c5c74 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -49,6 +49,7 @@ #include "nsAutoPtr.h" #include "nsAppShell.h" #include "nsTArray.h" +#include "nsIdleService.h" #include "nsWindow.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args) @@ -141,6 +142,7 @@ nsWindow::DispatchInputEvent(nsGUIEvent &aEvent) if (!gFocusedWindow) return nsEventStatus_eIgnore; + gFocusedWindow->UserActivity(); aEvent.widget = gFocusedWindow; return gFocusedWindow->mEventCallback(&aEvent); } @@ -443,3 +445,14 @@ nsWindow::BringToTop() Update(); } +void +nsWindow::UserActivity() +{ + if (!mIdleService) { + mIdleService = do_GetService("@mozilla.org/widget/idleservice;1"); + } + + if (mIdleService) { + mIdleService->ResetIdleTimeOut(); + } +} diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 743067c5c39..ac899962667 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -42,6 +42,8 @@ extern nsIntRect gScreenBounds; +class nsIdleService; + namespace mozilla { namespace gl { class GLContext; @@ -131,8 +133,13 @@ protected: bool mVisible; nsIntRegion mDirtyRegion; InputContext mInputContext; + nsCOMPtr mIdleService; void BringToTop(); + + // Call this function when the users activity is the direct cause of an + // event (like a keypress or mouse click). + void UserActivity(); }; #endif /* nsWindow_h */ From 66ffdd2bfbc6b9f56034ffd9ca0f85fb22c75df6 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Wed, 11 Jan 2012 11:09:41 +0900 Subject: [PATCH 020/165] Bug 716819 Move nsToolkit::VistaCreateItemFromParsingNameInit() and nsToolkit::createItemFromParsingName to WinUtils r=jimm --- widget/windows/JumpListItem.cpp | 10 ++++++---- widget/windows/WinUtils.cpp | 35 +++++++++++++++++++++++++++++++++ widget/windows/WinUtils.h | 23 ++++++++++++++++++++++ widget/windows/nsFilePicker.cpp | 18 +++++++++-------- widget/windows/nsToolkit.cpp | 23 ---------------------- widget/windows/nsToolkit.h | 8 -------- 6 files changed, 74 insertions(+), 43 deletions(-) diff --git a/widget/windows/JumpListItem.cpp b/widget/windows/JumpListItem.cpp index 3dea09fc831..6394db6bb43 100644 --- a/widget/windows/JumpListItem.cpp +++ b/widget/windows/JumpListItem.cpp @@ -55,7 +55,7 @@ #include "mozIAsyncFavicons.h" #include "mozilla/Preferences.h" #include "JumpListBuilder.h" -#include "nsToolkit.h" +#include "WinUtils.h" namespace mozilla { namespace widget { @@ -738,13 +738,15 @@ nsresult JumpListLink::GetShellItem(nsCOMPtr& item, nsRefPtr +#include class nsWindow; @@ -198,6 +199,28 @@ public: * mouse message handling. */ static PRUint16 GetMouseInputSource(); + + /** + * VistaCreateItemFromParsingNameInit() initializes the static pointer for + * SHCreateItemFromParsingName() API which is usable only on Vista and later. + * This returns TRUE if the API is available. Otherwise, FALSE. + */ + static bool VistaCreateItemFromParsingNameInit(); + + /** + * SHCreateItemFromParsingName() calls native SHCreateItemFromParsingName() + * API. Note that you must call VistaCreateItemFromParsingNameInit() before + * calling this. And the result must be TRUE. Otherwise, returns E_FAIL. + */ + static HRESULT SHCreateItemFromParsingName(PCWSTR pszPath, IBindCtx *pbc, + REFIID riid, void **ppv); + +private: + typedef HRESULT (WINAPI * SHCreateItemFromParsingNamePtr)(PCWSTR pszPath, + IBindCtx *pbc, + REFIID riid, + void **ppv); + static SHCreateItemFromParsingNamePtr sCreateItemFromParsingName; }; } // namespace widget diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index c76045cab5a..3ddcae5322b 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -619,11 +619,12 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir) // initial strings dialog->SetTitle(mTitle.get()); if (!aInitialDir.IsEmpty() && - nsToolkit::VistaCreateItemFromParsingNameInit()) { + WinUtils::VistaCreateItemFromParsingNameInit()) { nsRefPtr folder; - if (SUCCEEDED(nsToolkit::createItemFromParsingName(aInitialDir.get(), NULL, - IID_IShellItem, - getter_AddRefs(folder)))) { + if (SUCCEEDED( + WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), NULL, + IID_IShellItem, + getter_AddRefs(folder)))) { dialog->SetFolder(folder); } } @@ -944,11 +945,12 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir) // initial location if (!aInitialDir.IsEmpty() && - nsToolkit::VistaCreateItemFromParsingNameInit()) { + WinUtils::VistaCreateItemFromParsingNameInit()) { nsRefPtr folder; - if (SUCCEEDED(nsToolkit::createItemFromParsingName(aInitialDir.get(), NULL, - IID_IShellItem, - getter_AddRefs(folder)))) { + if (SUCCEEDED( + WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), NULL, + IID_IShellItem, + getter_AddRefs(folder)))) { dialog->SetFolder(folder); } } diff --git a/widget/windows/nsToolkit.cpp b/widget/windows/nsToolkit.cpp index 3bbc656ac13..1909d2af14a 100644 --- a/widget/windows/nsToolkit.cpp +++ b/widget/windows/nsToolkit.cpp @@ -57,11 +57,6 @@ nsToolkit* nsToolkit::gToolkit = nsnull; HINSTANCE nsToolkit::mDllInstance = 0; static const unsigned long kD3DUsageDelay = 5000; -// SHCreateItemFromParsingName is only available on vista and up. -nsToolkit::SHCreateItemFromParsingNamePtr nsToolkit::createItemFromParsingName = nsnull; -const PRUnichar nsToolkit::kSehllLibraryName[] = L"shell32.dll"; -HMODULE nsToolkit::sShellDll = nsnull; - static void StartAllowingD3D9(nsITimer *aTimer, void *aClosure) { @@ -125,24 +120,6 @@ nsToolkit::StartAllowingD3D9() nsWindow::StartAllowingD3D9(false); } -// Load and store Vista+ SHCreateItemFromParsingName -bool -nsToolkit::VistaCreateItemFromParsingNameInit() -{ - if (createItemFromParsingName) - return true; - if (sShellDll) - return false; - sShellDll = LoadLibraryW(kSehllLibraryName); - if (!sShellDll) - return false; - createItemFromParsingName = (SHCreateItemFromParsingNamePtr) - GetProcAddress(sShellDll, "SHCreateItemFromParsingName"); - if (createItemFromParsingName == nsnull) - return false; - return true; -} - //------------------------------------------------------------------------- // // Return the nsToolkit for the current thread. If a toolkit does not diff --git a/widget/windows/nsToolkit.h b/widget/windows/nsToolkit.h index 663c3ae285d..0b32117c67b 100644 --- a/widget/windows/nsToolkit.h +++ b/widget/windows/nsToolkit.h @@ -44,8 +44,6 @@ #include "nsITimer.h" #include "nsCOMPtr.h" #include -#include -#include // Avoid including windowsx.h to prevent macro pollution #ifndef GET_X_LPARAM @@ -113,18 +111,12 @@ public: static void Startup(HMODULE hModule); static void Shutdown(); static void StartAllowingD3D9(); - static bool VistaCreateItemFromParsingNameInit(); - - typedef HRESULT (WINAPI * SHCreateItemFromParsingNamePtr)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv); - static SHCreateItemFromParsingNamePtr createItemFromParsingName; protected: static nsToolkit* gToolkit; nsCOMPtr mD3D9Timer; MouseTrailer mMouseTrailer; - static const PRUnichar kSehllLibraryName[]; - static HMODULE sShellDll; }; #endif // TOOLKIT_H From 323f3ddfa82e5dd1b7e7b4a04f5e42e41878b25b Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Tue, 10 Jan 2012 16:53:16 -0800 Subject: [PATCH 021/165] Bug 461820 - prevent accessing searchbar history from content (tests) r=dolske --HG-- extra : rebase_source : c83545f7fa62353bad8cdd783fdd09626b9a23e0 --- .../components/search/test/browser_426329.js | 45 ++++++++++++++++++- .../satchel/test/test_form_autocomplete.html | 26 ++++++++++- .../satchel/test/test_form_submission.html | 14 ++++-- 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/browser/components/search/test/browser_426329.js b/browser/components/search/test/browser_426329.js index 0004baf7fb6..8e1b6c5545a 100644 --- a/browser/components/search/test/browser_426329.js +++ b/browser/components/search/test/browser_426329.js @@ -8,6 +8,7 @@ this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/Chr function test() { waitForExplicitFinish(); + var searchEntries = ["test", "More Text", "Some Text"]; var searchBar = BrowserSearch.searchBar; var searchButton = document.getAnonymousElementByAttribute(searchBar, "anonid", "search-go-button"); @@ -166,7 +167,7 @@ function test() { is(searchBar.value, "More Text", "drop text/uri-list on searchbar"); SimpleTest.executeSoon(testRightClick); } - + function testRightClick() { init(); searchBar.removeEventListener("popupshowing", stopPopup, true); @@ -177,10 +178,29 @@ function test() { is(gBrowser.tabs.length, preTabNo, "RightClick did not open new tab"); is(gBrowser.currentURI.spec, "about:blank", "RightClick did nothing"); - finalize(); + testSearchHistory(); }, 5000); } + function testSearchHistory() { + var textbox = searchBar._textbox; + for (var i = 0; i < searchEntries.length; i++) { + let exists = textbox._formHistSvc.entryExists(textbox.searchParam, searchEntries[i]); + ok(exists, "form history entry '" + searchEntries[i] + "' should exist"); + } + testAutocomplete(); + } + + function testAutocomplete() { + var popup = searchBar.textbox.popup; + popup.addEventListener("popupshowing", function() { + checkMenuEntries(searchEntries); + finalize(); + popup.removeEventListener("popupshowing", this, false); + }, false); + searchBar.textbox.showHistoryPopup(); + } + function finalize() { searchBar.value = ""; while (gBrowser.tabs.length != 1) { @@ -211,5 +231,26 @@ function test() { buttonArg, null); aTarget.dispatchEvent(event); } + + // modified from toolkit/components/satchel/test/test_form_autocomplete.html + function checkMenuEntries(expectedValues) { + var actualValues = getMenuEntries(); + is(actualValues.length, expectedValues.length, "Checking length of expected menu"); + for (var i = 0; i < expectedValues.length; i++) + is(actualValues[i], expectedValues[i], "Checking menu entry #"+i); + } + + function getMenuEntries() { + var entries = []; + var autocompleteMenu = searchBar.textbox.popup; + // Could perhaps pull values directly from the controller, but it seems + // more reliable to test the values that are actually in the tree? + var column = autocompleteMenu.tree.columns[0]; + var numRows = autocompleteMenu.tree.view.rowCount; + for (var i = 0; i < numRows; i++) { + entries.push(autocompleteMenu.tree.view.getValueAt(i, column)); + } + return entries; + } } diff --git a/toolkit/components/satchel/test/test_form_autocomplete.html b/toolkit/components/satchel/test/test_form_autocomplete.html index ef027ad7465..2c1b4bc0a0b 100644 --- a/toolkit/components/satchel/test/test_form_autocomplete.html +++ b/toolkit/components/satchel/test/test_form_autocomplete.html @@ -80,6 +80,12 @@ Form History test: form field autocomplete + +
+ + +
+
@@ -121,6 +127,7 @@ fh.addEntry("field6", "value");
 fh.addEntry("field7", "value");
 fh.addEntry("field8", "value");
 fh.addEntry("field9", "value");
+fh.addEntry("searchbar-history", "blacklist test");
 
 // All these non-implemeted types might need autocomplete tests in the future.
 var todoTypes = [ "datetime", "date", "month", "week", "time", "datetime-local",
@@ -720,14 +727,29 @@ function runTest(testNum) {
         ok(true, "oninput should have been received");
         ok(event.bubbles, "input event should bubble");
         ok(event.cancelable, "input event should be cancelable");
-        SimpleTest.finish();
       }, false);
 
       doKey("down");
       checkForm("");
       doKey("return");
       checkForm("value1");
-      return;
+      testNum = 599;
+      break;
+
+    case 600:
+        // check we don't show autocomplete for searchbar-history
+        input = $_(12, "searchbar-history");
+
+        // Trigger autocomplete popup
+        checkForm("");
+        restoreForm();
+        doKey("down");
+        break;
+
+    case 601:
+        checkMenuEntries([]);
+        SimpleTest.finish();
+        return;
 
     default:
         ok(false, "Unexpected invocation of test #" + testNum);
diff --git a/toolkit/components/satchel/test/test_form_submission.html b/toolkit/components/satchel/test/test_form_submission.html
index 83ea0a8f7ad..9928207a9ef 100644
--- a/toolkit/components/satchel/test/test_form_submission.html
+++ b/toolkit/components/satchel/test/test_form_submission.html
@@ -165,6 +165,12 @@
     
   
 
+  
+  
+ + +
+ @@ -328,6 +334,7 @@ function startTest() { $_(20, "test1").value = "dontSaveThis"; $_(22, "test1").value = "dontSaveThis"; $_(23, "test1").value = "dontSaveThis"; + $_(24, "searchbar-history").value = "dontSaveThis"; $_(101, "test1").value = "savedValue"; $_(102, "test2").value = "savedValue"; @@ -365,7 +372,7 @@ function checkSubmit(formNum) { // Check for expected storage state. switch (formNum) { - // Test 1-23 should not save anything. + // Test 1-24 should not save anything. case 1: case 2: case 3: @@ -389,6 +396,7 @@ function checkSubmit(formNum) { case 21: case 22: case 23: + case 24: ok(!fh.hasEntries, "checking for empty storage"); break; case 100: @@ -470,7 +478,7 @@ function checkSubmit(formNum) { // End the test at the last form. if (formNum == 110) { - is(numSubmittedForms, 34, "Ensuring all forms were submitted."); + is(numSubmittedForms, 35, "Ensuring all forms were submitted."); Services.obs.removeObserver(checkObserver, "satchel-storage-changed"); SimpleTest.finish(); return false; // return false to cancel current form submission @@ -488,7 +496,7 @@ function checkSubmit(formNum) { checkObserver.waitForChecks(function() { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var nextFormNum = formNum == 23 ? 100 : (formNum + 1); + var nextFormNum = formNum == 24 ? 100 : (formNum + 1); // Submit the next form. Special cases are Forms 21 and 100, which happen // from an HTTPS domain in an iframe. From cda05e6e2e86b700d8854a72566c06018f71e0c8 Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Fri, 2 Dec 2011 01:14:33 -0800 Subject: [PATCH 022/165] Bug 706733 - Use constants defined on nsIBrowserProfileMigrator rather than redefining them r=mak --HG-- extra : rebase_source : f99634ff01e9933a1a2cc15348d5c8b6c675ba47 --- .../migration/src/ChromeProfileMigrator.js | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/browser/components/migration/src/ChromeProfileMigrator.js b/browser/components/migration/src/ChromeProfileMigrator.js index 23d63280e9c..89d953932ba 100644 --- a/browser/components/migration/src/ChromeProfileMigrator.js +++ b/browser/components/migration/src/ChromeProfileMigrator.js @@ -40,21 +40,13 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; const Cr = Components.results; +const MIGRATOR = Ci.nsIBrowserProfileMigrator; const LOCAL_FILE_CID = "@mozilla.org/file/local;1"; const FILE_INPUT_STREAM_CID = "@mozilla.org/network/file-input-stream;1"; const BUNDLE_MIGRATION = "chrome://browser/locale/migration/migration.properties"; -const MIGRATE_ALL = 0x0000; -const MIGRATE_SETTINGS = 0x0001; -const MIGRATE_COOKIES = 0x0002; -const MIGRATE_HISTORY = 0x0004; -const MIGRATE_FORMDATA = 0x0008; -const MIGRATE_PASSWORDS = 0x0010; -const MIGRATE_BOOKMARKS = 0x0020; -const MIGRATE_OTHERDATA = 0x0040; - const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000; const S100NS_PER_MS = 10; @@ -142,7 +134,7 @@ ChromeProfileMigrator.prototype = { * Notify to observers to start migration * * @param aType - * notification type such as MIGRATE_BOOKMARKS + * notification type such as MIGRATOR.BOOKMARKS */ _notifyStart : function Chrome_notifyStart(aType) { @@ -154,7 +146,7 @@ ChromeProfileMigrator.prototype = { * Notify observers that a migration error occured with an item * * @param aType - * notification type such as MIGRATE_BOOKMARKS + * notification type such as MIGRATOR.BOOKMARKS */ _notifyError : function Chrome_notifyError(aType) { @@ -166,7 +158,7 @@ ChromeProfileMigrator.prototype = { * If all items are finished, it sends migration end notification. * * @param aType - * notification type such as MIGRATE_BOOKMARKS + * notification type such as MIGRATOR.BOOKMARKS */ _notifyCompleted : function Chrome_notifyIfCompleted(aType) { @@ -182,7 +174,7 @@ ChromeProfileMigrator.prototype = { */ _migrateBookmarks : function Chrome_migrateBookmarks() { - this._notifyStart(MIGRATE_BOOKMARKS); + this._notifyStart(MIGRATOR.BOOKMARKS); try { PlacesUtils.bookmarks.runInBatchMode({ @@ -194,7 +186,7 @@ ChromeProfileMigrator.prototype = { NetUtil.asyncFetch(file, function(aInputStream, aResultCode) { if (!Components.isSuccessCode(aResultCode)) { - migrator._notifyCompleted(MIGRATE_BOOKMARKS); + migrator._notifyCompleted(MIGRATOR.BOOKMARKS); return; } @@ -232,14 +224,14 @@ ChromeProfileMigrator.prototype = { insertBookmarkItems(parentId, roots.other.children); } - migrator._notifyCompleted(MIGRATE_BOOKMARKS); + migrator._notifyCompleted(MIGRATOR.BOOKMARKS); }); } }, null); } catch (e) { Cu.reportError(e); - this._notifyError(MIGRATE_BOOKMARKS); - this._notifyCompleted(MIGRATE_BOOKMARKS); + this._notifyError(MIGRATOR.BOOKMARKS); + this._notifyCompleted(MIGRATOR.BOOKMARKS); } }, @@ -248,7 +240,7 @@ ChromeProfileMigrator.prototype = { */ _migrateHistory : function Chrome_migrateHistory() { - this._notifyStart(MIGRATE_HISTORY); + this._notifyStart(MIGRATOR.HISTORY); try { PlacesUtils.history.runInBatchMode({ @@ -305,7 +297,7 @@ ChromeProfileMigrator.prototype = { handleCompletion : function(aReason) { this._db.asyncClose(); - this._self._notifyCompleted(MIGRATE_HISTORY); + this._self._notifyCompleted(MIGRATOR.HISTORY); } }); stmt.finalize(); @@ -313,8 +305,8 @@ ChromeProfileMigrator.prototype = { }, null); } catch (e) { Cu.reportError(e); - this._notifyError(MIGRATE_HISTORY); - this._notifyCompleted(MIGRATE_HISTORY); + this._notifyError(MIGRATOR.HISTORY); + this._notifyCompleted(MIGRATOR.HISTORY); } }, @@ -323,7 +315,7 @@ ChromeProfileMigrator.prototype = { */ _migrateCookies : function Chrome_migrateCookies() { - this._notifyStart(MIGRATE_COOKIES); + this._notifyStart(MIGRATOR.COOKIES); try { // Access sqlite3 database of Chrome's cookie @@ -369,14 +361,14 @@ ChromeProfileMigrator.prototype = { handleCompletion : function(aReason) { this._db.asyncClose(); - this._self._notifyCompleted(MIGRATE_COOKIES); + this._self._notifyCompleted(MIGRATOR.COOKIES); }, }); stmt.finalize(); } catch (e) { Cu.reportError(e); - this._notifyError(MIGRATE_COOKIES); - this._notifyCompleted(MIGRATE_COOKIES); + this._notifyError(MIGRATOR.COOKIES); + this._notifyCompleted(MIGRATOR.COOKIES); } }, @@ -409,13 +401,13 @@ ChromeProfileMigrator.prototype = { // notification is sent this._pendingCount = 1; - if (aItems & MIGRATE_HISTORY) + if (aItems & MIGRATOR.HISTORY) this._migrateHistory(); - if (aItems & MIGRATE_COOKIES) + if (aItems & MIGRATOR.COOKIES) this._migrateCookies(); - if (aItems & MIGRATE_BOOKMARKS) + if (aItems & MIGRATOR.BOOKMARKS) this._migrateBookmarks(); if (--this._pendingCount == 0) { @@ -452,7 +444,7 @@ ChromeProfileMigrator.prototype = { file.append("Bookmarks"); if (file.exists()) { this._paths.bookmarks = file.path; - result += MIGRATE_BOOKMARKS; + result += MIGRATOR.BOOKMARKS; } } catch (e) { Cu.reportError(e); @@ -471,7 +463,7 @@ ChromeProfileMigrator.prototype = { file.append("History"); if (file.exists()) { this._paths.history = file.path; - result += MIGRATE_HISTORY; + result += MIGRATOR.HISTORY; } } catch (e) { Cu.reportError(e); @@ -482,7 +474,7 @@ ChromeProfileMigrator.prototype = { file.append("Cookies"); if (file.exists()) { this._paths.cookies = file.path; - result += MIGRATE_COOKIES; + result += MIGRATOR.COOKIES; } } catch (e) { Cu.reportError(e); From b707813fff10be0e2b49c5c00c6df7f49ec8cbbe Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Tue, 29 Nov 2011 02:30:40 -0800 Subject: [PATCH 023/165] Bug 273874 - Firefox migrator for new profiles r=mak --HG-- rename : browser/components/migration/src/ChromeProfileMigrator.js => browser/components/migration/src/FirefoxProfileMigrator.js extra : rebase_source : d5dfea053ede5abb3a535296085bdfe93ece8511 --- .../components/migration/content/migration.js | 3 + .../migration/content/migration.xul | 1 + .../src/BrowserProfileMigrators.manifest | 2 + .../migration/src/FirefoxProfileMigrator.js | 404 ++++++++++++++++++ browser/components/migration/src/Makefile.in | 1 + .../migration/src/nsProfileMigrator.cpp | 6 + browser/installer/package-manifest.in | 1 + .../chrome/browser/migration/migration.dtd | 2 + .../browser/migration/migration.properties | 5 + toolkit/components/places/PlacesUtils.jsm | 4 +- 10 files changed, 428 insertions(+), 1 deletion(-) create mode 100644 browser/components/migration/src/FirefoxProfileMigrator.js diff --git a/browser/components/migration/content/migration.js b/browser/components/migration/content/migration.js index 57310bbd1ea..3bc34c76e87 100644 --- a/browser/components/migration/content/migration.js +++ b/browser/components/migration/content/migration.js @@ -339,6 +339,9 @@ var MigrationWizard = { case "chrome": source = "sourceNameChrome"; break; + case "firefox": + source = "sourceNameFirefox"; + break; } // semi-wallpaper for crash when multiple profiles exist, since we haven't initialized mSourceProfile in places diff --git a/browser/components/migration/content/migration.xul b/browser/components/migration/content/migration.xul index 11a4f46adb6..f8653b17bef 100644 --- a/browser/components/migration/content/migration.xul +++ b/browser/components/migration/content/migration.xul @@ -76,6 +76,7 @@ #endif #endif +