From 44afcbd8c4d44ad35cb061533e5a708d5fe85d1d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:31:00 -0700 Subject: [PATCH 01/32] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/19756fa13aa0 Author: Kevin Grandon Desc: Bug 1007147 - [Home2] Follow-up, add overflow: hidden to icons to prevent x-axis panning r=me --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7c0e0cdaa921..62796a8f2be7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "fbf868517b3026b39be4afac45883ddf76f6bc9d", + "revision": "19756fa13aa055c790178b642438963f5e0f8122", "repo_path": "/integration/gaia-central" } From 667a873aeb0fb6595635a2f8631535ddafc3d619 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:41:24 -0700 Subject: [PATCH 02/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 7d1c59b5cd8b..211592fec6f4 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ec1af4719ce5..a97702978737 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 7be06186f855..174eae1c27b8 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 7d1c59b5cd8b..211592fec6f4 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5db7c8ea9166..4490ee47c65b 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a808a2b5e1d4..58aed83dcdb5 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 0f815aa9d026..d28012bd5ddf 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 034cb3c2da6c..0c3d7a9bdecb 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 26323158cd86..706d7f4ebedb 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index ff7e25ceb529..4ed0f6e53073 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 18023e446f64..1e705e283ed7 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 04d9f7cc9545db20b7d03495c10c211b68bf8183 Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Thu, 8 May 2014 14:49:41 -0700 Subject: [PATCH 03/32] Bug 1006128 - Fix IPDL unit tests after bug 960774, r=bsmedberg. --- ipc/ipdl/test/cxx/TestActorPunning.h | 4 ++++ ipc/ipdl/test/cxx/TestBadActor.h | 1 + ipc/ipdl/test/cxx/TestDesc.h | 5 ++++- ipc/ipdl/test/cxx/TestJSON.h | 3 +++ ipc/ipdl/test/cxx/TestManyChildAllocs.h | 1 + ipc/ipdl/test/cxx/TestMultiMgrs.h | 7 +++++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ipc/ipdl/test/cxx/TestActorPunning.h b/ipc/ipdl/test/cxx/TestActorPunning.h index 724d1bfca193..7f58bb1c4ac7 100644 --- a/ipc/ipdl/test/cxx/TestActorPunning.h +++ b/ipc/ipdl/test/cxx/TestActorPunning.h @@ -47,6 +47,8 @@ class TestActorPunningPunnedParent : public: TestActorPunningPunnedParent() {} virtual ~TestActorPunningPunnedParent() {} +protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} }; class TestActorPunningSubParent : @@ -55,6 +57,8 @@ class TestActorPunningSubParent : public: TestActorPunningSubParent() {} virtual ~TestActorPunningSubParent() {} +protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} }; diff --git a/ipc/ipdl/test/cxx/TestBadActor.h b/ipc/ipdl/test/cxx/TestBadActor.h index 1d88811f3236..4270881a8461 100644 --- a/ipc/ipdl/test/cxx/TestBadActor.h +++ b/ipc/ipdl/test/cxx/TestBadActor.h @@ -51,6 +51,7 @@ public: virtual ~TestBadActorSubParent() { } protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} virtual bool RecvPing(); }; diff --git a/ipc/ipdl/test/cxx/TestDesc.h b/ipc/ipdl/test/cxx/TestDesc.h index 52272384093a..4c22afa64cac 100644 --- a/ipc/ipdl/test/cxx/TestDesc.h +++ b/ipc/ipdl/test/cxx/TestDesc.h @@ -80,8 +80,8 @@ public: virtual ~TestDescSubParent() { } protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} virtual PTestDescSubsubParent* AllocPTestDescSubsubParent() MOZ_OVERRIDE; - virtual bool DeallocPTestDescSubsubParent(PTestDescSubsubParent* actor) MOZ_OVERRIDE; }; @@ -108,6 +108,9 @@ class TestDescSubsubParent : public: TestDescSubsubParent() { } virtual ~TestDescSubsubParent() { } + +protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} }; class TestDescSubsubChild : diff --git a/ipc/ipdl/test/cxx/TestJSON.h b/ipc/ipdl/test/cxx/TestJSON.h index 854fa871c43b..1dc6ff14546a 100644 --- a/ipc/ipdl/test/cxx/TestJSON.h +++ b/ipc/ipdl/test/cxx/TestJSON.h @@ -18,6 +18,9 @@ class TestHandleParent : public: TestHandleParent() { } virtual ~TestHandleParent() { } + +protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} }; class TestJSONParent : diff --git a/ipc/ipdl/test/cxx/TestManyChildAllocs.h b/ipc/ipdl/test/cxx/TestManyChildAllocs.h index 19ca8acb6220..61627f5c13eb 100644 --- a/ipc/ipdl/test/cxx/TestManyChildAllocs.h +++ b/ipc/ipdl/test/cxx/TestManyChildAllocs.h @@ -72,6 +72,7 @@ public: virtual ~TestManyChildAllocsSubParent() { } protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} virtual bool RecvHello() MOZ_OVERRIDE { return true; } }; diff --git a/ipc/ipdl/test/cxx/TestMultiMgrs.h b/ipc/ipdl/test/cxx/TestMultiMgrs.h index e8093404568e..8a8eba5ee90b 100644 --- a/ipc/ipdl/test/cxx/TestMultiMgrs.h +++ b/ipc/ipdl/test/cxx/TestMultiMgrs.h @@ -25,6 +25,9 @@ class TestMultiMgrsBottomParent : public: TestMultiMgrsBottomParent() { } virtual ~TestMultiMgrsBottomParent() { } + +protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} }; class TestMultiMgrsLeftParent : @@ -40,6 +43,8 @@ public: } protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} + virtual PTestMultiMgrsBottomParent* AllocPTestMultiMgrsBottomParent() MOZ_OVERRIDE { return new TestMultiMgrsBottomParent(); @@ -65,6 +70,8 @@ public: } protected: + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE {} + virtual PTestMultiMgrsBottomParent* AllocPTestMultiMgrsBottomParent() MOZ_OVERRIDE { return new TestMultiMgrsBottomParent(); From 4146287bcbd0299ef1b8c36ee0d2ee620b9a12dc Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:53:40 -0700 Subject: [PATCH 04/32] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e121aac89613 Author: Kevin Grandon Desc: Bug 1004768 - [Home2] Remove will-change property as it hurts scrolling performance with too many individual layers r=me --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 62796a8f2be7..624dd08b13a7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "19756fa13aa055c790178b642438963f5e0f8122", + "revision": "e121aac89613bafc2354b803f1693f6687eb9363", "repo_path": "/integration/gaia-central" } From 4b807d5259914ac0f5c1bbef11d29d7b0e7d55b2 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:53:51 -0700 Subject: [PATCH 05/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 211592fec6f4..8f0a20793af1 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index a97702978737..e2beb0c96cfb 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 174eae1c27b8..68487ee48443 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 211592fec6f4..8f0a20793af1 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 4490ee47c65b..274848b8ce2c 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 58aed83dcdb5..ea493b0addf4 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index d28012bd5ddf..7dc13f75f224 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 0c3d7a9bdecb..d716440447e7 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 706d7f4ebedb..9f25eb2cdce0 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 4ed0f6e53073..2c85af3dde80 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 1e705e283ed7..62609417898a 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From e128943f1bcab3d5e9e8aa7478a0d7caba62d507 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 15:40:47 -0700 Subject: [PATCH 06/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/5476e49adf00 Author: punamdahiya Desc: Merge pull request #19079 from punamdahiya/Bug994529 Bug994529 - [Gallery][Wallpaper] The left upper of interface cannot be d.isplayed for a short time when set picture as wallpaper r=djf ======== https://hg.mozilla.org/integration/gaia-central/rev/350bbedbccab Author: Punam Dahiya Desc: Bug994529 - [Gallery][Wallpaper] The left upper of interface cannot be displayed for a short time when set picture as wallpaper --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 624dd08b13a7..a189ed1d887d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e121aac89613bafc2354b803f1693f6687eb9363", + "revision": "5476e49adf00cafde6cb68e876f0514dac4b993d", "repo_path": "/integration/gaia-central" } From 29389a337d68553d32796e8e844db4acf757316e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 15:42:59 -0700 Subject: [PATCH 07/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8f0a20793af1..db9da9805d2e 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index e2beb0c96cfb..84b69ce9e932 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 68487ee48443..60dc25b84d0f 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8f0a20793af1..db9da9805d2e 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 274848b8ce2c..d1f4106c2482 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index ea493b0addf4..c707448361a2 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 7dc13f75f224..5a278820c54a 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index d716440447e7..c203620792e5 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 9f25eb2cdce0..4a8c09245542 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 2c85af3dde80..61ac24017ea9 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 62609417898a..69d95e9b0b2f 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f94ee39a934f97937a4efa1fe877fbef1921b4b0 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Mon, 21 Apr 2014 19:59:30 -0400 Subject: [PATCH 08/32] Bug 999694 - Use fence objects in SharedSurfaceGralloc, r=jgilbert --- gfx/gl/GLLibraryEGL.cpp | 10 +++++++ gfx/gl/GLLibraryEGL.h | 9 +++++- gfx/gl/SharedSurfaceGralloc.cpp | 53 +++++++++++++++++++++++++++++++++ gfx/gl/SharedSurfaceGralloc.h | 2 ++ 4 files changed, 73 insertions(+), 1 deletion(-) diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp index 1d03a6f85012..3940823815cb 100644 --- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -31,6 +31,7 @@ static const char *sEGLExtensionNames[] = { "EGL_EXT_create_context_robustness", "EGL_KHR_image", "EGL_KHR_fence_sync", + "EGL_ANDROID_native_fence_sync", nullptr }; @@ -195,6 +196,10 @@ GLLibraryEGL::EnsureInitialized() SYMBOL(GetProcAddress), SYMBOL(SwapBuffers), SYMBOL(CopyBuffers), + // On Android 4.2 and up, certain features like ANDROID_native_fence_sync + // can only be queried by using a special eglQueryString. + { (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID, + { "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } }, SYMBOL(QueryString), SYMBOL(QueryContext), SYMBOL(BindTexImage), @@ -208,6 +213,11 @@ GLLibraryEGL::EnsureInitialized() return false; } +#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17 + MOZ_RELEASE_ASSERT(mSymbols.fQueryStringImplementationANDROID, + "Couldn't find eglQueryStringImplementationANDROID"); +#endif + mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY); if (!fInitialize(mEGLDisplay, nullptr, nullptr)) return false; diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h index c5e8094dec17..d34e2f67037f 100644 --- a/gfx/gl/GLLibraryEGL.h +++ b/gfx/gl/GLLibraryEGL.h @@ -117,6 +117,7 @@ public: EXT_create_context_robustness, KHR_image, KHR_fence_sync, + ANDROID_native_fence_sync, Extensions_Max }; @@ -296,7 +297,12 @@ public: const GLubyte* fQueryString(EGLDisplay dpy, EGLint name) { BEFORE_GL_CALL; - const GLubyte* b = mSymbols.fQueryString(dpy, name); + const GLubyte* b; + if (mSymbols.fQueryStringImplementationANDROID) { + b = mSymbols.fQueryStringImplementationANDROID(dpy, name); + } else { + b = mSymbols.fQueryString(dpy, name); + } AFTER_GL_CALL; return b; } @@ -484,6 +490,7 @@ public: pfnCopyBuffers fCopyBuffers; typedef const GLubyte* (GLAPIENTRY * pfnQueryString)(EGLDisplay, EGLint name); pfnQueryString fQueryString; + pfnQueryString fQueryStringImplementationANDROID; typedef EGLBoolean (GLAPIENTRY * pfnQueryContext)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); pfnQueryContext fQueryContext; diff --git a/gfx/gl/SharedSurfaceGralloc.cpp b/gfx/gl/SharedSurfaceGralloc.cpp index 4c3b8cb9aa16..7b3ea901039d 100644 --- a/gfx/gl/SharedSurfaceGralloc.cpp +++ b/gfx/gl/SharedSurfaceGralloc.cpp @@ -132,11 +132,46 @@ SharedSurface_Gralloc::~SharedSurface_Gralloc() mGL->MakeCurrent(); mGL->fDeleteTextures(1, &mProdTex); + + if (mSync) { + MOZ_ALWAYS_TRUE( mEGL->fDestroySync(mEGL->Display(), mSync) ); + mSync = 0; + } } void SharedSurface_Gralloc::Fence() { + if (mSync) { + MOZ_ALWAYS_TRUE( mEGL->fDestroySync(mEGL->Display(), mSync) ); + mSync = 0; + } + + // When Android native fences are available, try + // them first since they're more likely to work. + // Android native fences are also likely to perform better. + if (mEGL->IsExtensionSupported(GLLibraryEGL::ANDROID_native_fence_sync)) { + mGL->MakeCurrent(); + mSync = mEGL->fCreateSync(mEGL->Display(), + LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID, + nullptr); + if (mSync) { + mGL->fFlush(); + return; + } + } + + if (mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync)) { + mGL->MakeCurrent(); + mSync = mEGL->fCreateSync(mEGL->Display(), + LOCAL_EGL_SYNC_FENCE, + nullptr); + if (mSync) { + mGL->fFlush(); + return; + } + } + // We should be able to rely on genlock write locks/read locks. // But they're broken on some configs, and even a glFinish doesn't // work. glReadPixels seems to, though. @@ -151,5 +186,23 @@ SharedSurface_Gralloc::Fence() bool SharedSurface_Gralloc::WaitSync() { + if (!mSync) { + // We must not be needed. + return true; + } + MOZ_ASSERT(mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync)); + + EGLint status = mEGL->fClientWaitSync(mEGL->Display(), + mSync, + 0, + LOCAL_EGL_FOREVER); + + if (status != LOCAL_EGL_CONDITION_SATISFIED) { + return false; + } + + MOZ_ALWAYS_TRUE( mEGL->fDestroySync(mEGL->Display(), mSync) ); + mSync = 0; + return true; } diff --git a/gfx/gl/SharedSurfaceGralloc.h b/gfx/gl/SharedSurfaceGralloc.h index caa42b68a51f..c792ba168db8 100644 --- a/gfx/gl/SharedSurfaceGralloc.h +++ b/gfx/gl/SharedSurfaceGralloc.h @@ -38,6 +38,7 @@ public: protected: GLLibraryEGL* const mEGL; + EGLSync mSync; RefPtr mAllocator; RefPtr mTextureClient; const GLuint mProdTex; @@ -55,6 +56,7 @@ protected: size, hasAlpha) , mEGL(egl) + , mSync(0) , mAllocator(allocator) , mTextureClient(textureClient) , mProdTex(prodTex) From e85484214002d9cd87e20b6bcfd595f596ff2377 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 10:45:57 -0700 Subject: [PATCH 09/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/246baa233b51 Author: James Burke Desc: Merge pull request #18970 from jrburke/bug940512-calendar-drawer-new Bug 940512 - [calendar] change drawers to slide down UX r=gaye ======== https://hg.mozilla.org/integration/gaia-central/rev/0df62dd52212 Author: jrburke Desc: Bug 940512 - [calendar] change drawers to slide down UX for better integration with Haida app edge swiping --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d47b8ca7f368..8434d747eacf 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "18441d7d35b6a96732575fb5c28cedfed8269fb2", + "revision": "246baa233b518e7ee6a6ae7f9d4c4bd0480995b3", "repo_path": "/integration/gaia-central" } From 08e6427c26bb592478bfdee587f23e4bd9926968 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 10:51:24 -0700 Subject: [PATCH 10/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 35bb6584ddd2..4f28dbb0bb14 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index e35c3a28c321..6a2a4efb6aca 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 465662b54031..7518ad7c3582 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 35bb6584ddd2..4f28dbb0bb14 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5c918d3e0802..c2469a9696fa 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 426cbbc6b736..9952bd9ba398 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 1fdc279ce806..e5f3f5af9db2 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index c85da3ff03f0..6ac45e42e7fa 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index fbc4899e351e..e6335014b924 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 205803294f67..dff4304b5e12 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index e0a7997556dc..13616266cf2e 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 5019a7e2a1801b045351b769ca9d13b8bdf4424b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 11:10:35 -0700 Subject: [PATCH 11/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9f6a7686bb24 Author: James Burke Desc: Merge pull request #16433 from jrburke/bug940132-email-drawer Bug 940132 - [email] change drawers to slide down r=asuth ======== https://hg.mozilla.org/integration/gaia-central/rev/b67d30b1994b Author: jrburke Desc: Bug 940132 - [email] change drawers to slide down --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 8434d747eacf..7e84e1b4f832 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "246baa233b518e7ee6a6ae7f9d4c4bd0480995b3", + "revision": "9f6a7686bb2409986bac58a4b91e1f4c41c133af", "repo_path": "/integration/gaia-central" } From fb860638be2d2a418a9e3a0b2d83eddade4631e1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 11:16:34 -0700 Subject: [PATCH 12/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4f28dbb0bb14..4235bf02e036 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 6a2a4efb6aca..1017c01f693c 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 7518ad7c3582..5ef33d7f9727 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4f28dbb0bb14..4235bf02e036 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index c2469a9696fa..9fa5994f5091 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 9952bd9ba398..daf81d8269f2 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index e5f3f5af9db2..801ede67f66d 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 6ac45e42e7fa..41da0f1a67a9 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index e6335014b924..854a8f57733d 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index dff4304b5e12..77997fc7245f 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 13616266cf2e..9228ca7ab446 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From e97775227c748165736cb8c3fa9c188a16ca5645 Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Thu, 8 May 2014 11:41:58 -0700 Subject: [PATCH 13/32] Bug 1007398 - Properly handle racing destruction of PTelephonyChild actors, r=hsinyi. --- dom/telephony/ipc/TelephonyChild.cpp | 42 +++++---- dom/telephony/ipc/TelephonyChild.h | 8 +- dom/telephony/ipc/TelephonyIPCProvider.cpp | 104 ++++++++++++++++++++- dom/telephony/ipc/TelephonyIPCProvider.h | 5 +- 4 files changed, 135 insertions(+), 24 deletions(-) diff --git a/dom/telephony/ipc/TelephonyChild.cpp b/dom/telephony/ipc/TelephonyChild.cpp index 131093bae0a4..52966c6215b1 100644 --- a/dom/telephony/ipc/TelephonyChild.cpp +++ b/dom/telephony/ipc/TelephonyChild.cpp @@ -3,7 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "mozilla/dom/telephony/TelephonyChild.h" +#include "TelephonyChild.h" +#include "TelephonyIPCProvider.h" USING_TELEPHONY_NAMESPACE @@ -11,16 +12,23 @@ USING_TELEPHONY_NAMESPACE * TelephonyChild ******************************************************************************/ -TelephonyChild::TelephonyChild(nsITelephonyListener* aListener) - : mListener(aListener) +TelephonyChild::TelephonyChild(TelephonyIPCProvider* aProvider) + : mProvider(aProvider) +{ + MOZ_ASSERT(aProvider); +} + +TelephonyChild::~TelephonyChild() { - MOZ_ASSERT(aListener); } void TelephonyChild::ActorDestroy(ActorDestroyReason aWhy) { - mListener = nullptr; + if (mProvider) { + mProvider->NoteActorDestroyed(); + mProvider = nullptr; + } } PTelephonyRequestChild* @@ -41,9 +49,9 @@ TelephonyChild::RecvNotifyCallError(const uint32_t& aClientId, const int32_t& aCallIndex, const nsString& aError) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->NotifyError(aClientId, aCallIndex, aError); + mProvider->NotifyError(aClientId, aCallIndex, aError); return true; } @@ -51,9 +59,9 @@ bool TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId, const IPCCallStateData& aData) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->CallStateChanged(aClientId, + mProvider->CallStateChanged(aClientId, aData.callIndex(), aData.callState(), aData.number(), @@ -70,18 +78,18 @@ bool TelephonyChild::RecvNotifyCdmaCallWaiting(const uint32_t& aClientId, const nsString& aNumber) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->NotifyCdmaCallWaiting(aClientId, aNumber); + mProvider->NotifyCdmaCallWaiting(aClientId, aNumber); return true; } bool TelephonyChild::RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->ConferenceCallStateChanged(aCallState); + mProvider->ConferenceCallStateChanged(aCallState); return true; } @@ -89,9 +97,9 @@ bool TelephonyChild::RecvNotifyConferenceError(const nsString& aName, const nsString& aMessage) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->NotifyConferenceError(aName, aMessage); + mProvider->NotifyConferenceError(aName, aMessage); return true; } @@ -100,9 +108,9 @@ TelephonyChild::RecvNotifySupplementaryService(const uint32_t& aClientId, const int32_t& aCallIndex, const uint16_t& aNotification) { - MOZ_ASSERT(mListener); + MOZ_ASSERT(mProvider); - mListener->SupplementaryServiceNotification(aClientId, aCallIndex, + mProvider->SupplementaryServiceNotification(aClientId, aCallIndex, aNotification); return true; } diff --git a/dom/telephony/ipc/TelephonyChild.h b/dom/telephony/ipc/TelephonyChild.h index 62ead6351fc1..d2c0701eb2cb 100644 --- a/dom/telephony/ipc/TelephonyChild.h +++ b/dom/telephony/ipc/TelephonyChild.h @@ -13,13 +13,15 @@ BEGIN_TELEPHONY_NAMESPACE +class TelephonyIPCProvider; + class TelephonyChild : public PTelephonyChild { public: - TelephonyChild(nsITelephonyListener* aListener); + TelephonyChild(TelephonyIPCProvider* aProvider); protected: - virtual ~TelephonyChild() {} + virtual ~TelephonyChild(); virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; @@ -55,7 +57,7 @@ protected: const uint16_t& aNotification) MOZ_OVERRIDE; private: - nsCOMPtr mListener; + nsRefPtr mProvider; }; class TelephonyRequestChild : public PTelephonyRequestChild diff --git a/dom/telephony/ipc/TelephonyIPCProvider.cpp b/dom/telephony/ipc/TelephonyIPCProvider.cpp index f194b25282b8..10be74b177b6 100644 --- a/dom/telephony/ipc/TelephonyIPCProvider.cpp +++ b/dom/telephony/ipc/TelephonyIPCProvider.cpp @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ipc/TelephonyIPCProvider.h" +#include "TelephonyIPCProvider.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/telephony/TelephonyChild.h" @@ -53,7 +53,17 @@ TelephonyIPCProvider::TelephonyIPCProvider() TelephonyIPCProvider::~TelephonyIPCProvider() { - mPTelephonyChild->Send__delete__(mPTelephonyChild); + if (mPTelephonyChild) { + mPTelephonyChild->Send__delete__(mPTelephonyChild); + mPTelephonyChild = nullptr; + } +} + +void +TelephonyIPCProvider::NoteActorDestroyed() +{ + MOZ_ASSERT(mPTelephonyChild); + mPTelephonyChild = nullptr; } @@ -94,6 +104,11 @@ TelephonyIPCProvider::RegisterListener(nsITelephonyListener *aListener) { MOZ_ASSERT(!mListeners.Contains(aListener)); + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + // nsTArray doesn't fail. mListeners.AppendElement(aListener); @@ -108,6 +123,11 @@ TelephonyIPCProvider::UnregisterListener(nsITelephonyListener *aListener) { MOZ_ASSERT(mListeners.Contains(aListener)); + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + // We always have the element here, so it can't fail. mListeners.RemoveElement(aListener); @@ -122,6 +142,11 @@ TelephonyIPCProvider::SendRequest(nsITelephonyListener *aListener, nsITelephonyCallback *aCallback, const IPCTelephonyRequest& aRequest) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + // Life time of newly allocated TelephonyRequestChild instance is managed by // IPDL itself. TelephonyRequestChild* actor = new TelephonyRequestChild(aListener, aCallback); @@ -146,6 +171,11 @@ TelephonyIPCProvider::Dial(uint32_t aClientId, const nsAString& aNumber, NS_IMETHODIMP TelephonyIPCProvider::HangUp(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendHangUpCall(aClientId, aCallIndex); return NS_OK; } @@ -153,6 +183,11 @@ TelephonyIPCProvider::HangUp(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::AnswerCall(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendAnswerCall(aClientId, aCallIndex); return NS_OK; } @@ -160,6 +195,11 @@ TelephonyIPCProvider::AnswerCall(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::RejectCall(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendRejectCall(aClientId, aCallIndex); return NS_OK; } @@ -167,6 +207,11 @@ TelephonyIPCProvider::RejectCall(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::HoldCall(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendHoldCall(aClientId, aCallIndex); return NS_OK; } @@ -174,6 +219,11 @@ TelephonyIPCProvider::HoldCall(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::ResumeCall(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendResumeCall(aClientId, aCallIndex); return NS_OK; } @@ -181,6 +231,11 @@ TelephonyIPCProvider::ResumeCall(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::ConferenceCall(uint32_t aClientId) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendConferenceCall(aClientId); return NS_OK; } @@ -188,6 +243,11 @@ TelephonyIPCProvider::ConferenceCall(uint32_t aClientId) NS_IMETHODIMP TelephonyIPCProvider::SeparateCall(uint32_t aClientId, uint32_t aCallIndex) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendSeparateCall(aClientId, aCallIndex); return NS_OK; } @@ -195,6 +255,11 @@ TelephonyIPCProvider::SeparateCall(uint32_t aClientId, uint32_t aCallIndex) NS_IMETHODIMP TelephonyIPCProvider::HoldConference(uint32_t aClientId) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendHoldConference(aClientId); return NS_OK; } @@ -202,6 +267,11 @@ TelephonyIPCProvider::HoldConference(uint32_t aClientId) NS_IMETHODIMP TelephonyIPCProvider::ResumeConference(uint32_t aClientId) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendResumeConference(aClientId); return NS_OK; } @@ -209,6 +279,11 @@ TelephonyIPCProvider::ResumeConference(uint32_t aClientId) NS_IMETHODIMP TelephonyIPCProvider::StartTone(uint32_t aClientId, const nsAString& aDtmfChar) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendStartTone(aClientId, nsString(aDtmfChar)); return NS_OK; } @@ -216,6 +291,11 @@ TelephonyIPCProvider::StartTone(uint32_t aClientId, const nsAString& aDtmfChar) NS_IMETHODIMP TelephonyIPCProvider::StopTone(uint32_t aClientId) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendStopTone(aClientId); return NS_OK; } @@ -223,6 +303,11 @@ TelephonyIPCProvider::StopTone(uint32_t aClientId) NS_IMETHODIMP TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendGetMicrophoneMuted(aMuted); return NS_OK; } @@ -230,6 +315,11 @@ TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted) NS_IMETHODIMP TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendSetMicrophoneMuted(aMuted); return NS_OK; } @@ -237,6 +327,11 @@ TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted) NS_IMETHODIMP TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendGetSpeakerEnabled(aEnabled); return NS_OK; } @@ -244,6 +339,11 @@ TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled) NS_IMETHODIMP TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled) { + if (!mPTelephonyChild) { + NS_WARNING("TelephonyProvider used after shutdown has begun!"); + return NS_ERROR_FAILURE; + } + mPTelephonyChild->SendSetSpeakerEnabled(aEnabled); return NS_OK; } diff --git a/dom/telephony/ipc/TelephonyIPCProvider.h b/dom/telephony/ipc/TelephonyIPCProvider.h index 62812bac960c..4042fa5af3d9 100644 --- a/dom/telephony/ipc/TelephonyIPCProvider.h +++ b/dom/telephony/ipc/TelephonyIPCProvider.h @@ -28,10 +28,11 @@ public: TelephonyIPCProvider(); -protected: - virtual ~TelephonyIPCProvider(); + void NoteActorDestroyed(); private: + ~TelephonyIPCProvider(); + nsTArray > mListeners; PTelephonyChild* mPTelephonyChild; uint32_t mDefaultServiceId; From c73d1d085aec487018f80a5eb6e8ade6e471602a Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Thu, 8 May 2014 15:24:32 -0400 Subject: [PATCH 14/32] Bug 1000883 - Remove mochitest-specific network hack from b2g emulator reftests, r=AutomatedTester --- build/mobile/b2gautomation.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py index 5d489009c6a2..2f241833bc1c 100644 --- a/build/mobile/b2gautomation.py +++ b/build/mobile/b2gautomation.py @@ -250,17 +250,6 @@ class B2GRemoteAutomation(Automation): if 'b2g' not in session: raise Exception("bad session value %s returned by start_session" % session) - if self._is_emulator: - # Disable offline status management (bug 777145), otherwise the network - # will be 'offline' when the mochitests start. Presumably, the network - # won't be offline on a real device, so we only do this for emulators. - self.marionette.set_context(self.marionette.CONTEXT_CHROME) - self.marionette.execute_script(""" - Components.utils.import("resource://gre/modules/Services.jsm"); - Services.io.manageOfflineStatus = false; - Services.io.offline = false; - """) - if self.context_chrome: self.marionette.set_context(self.marionette.CONTEXT_CHROME) else: From d3cff8077195d7f13d19687816d00c1d2ce7053d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:11:51 -0700 Subject: [PATCH 15/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/22be86b1e87e Author: Douglas Sherk Desc: Merge pull request #18961 from DouglasSherk/1006133-sms-deletion-tests Bug 1006133 - [Messages] Add tests for UI message deletion. r=azasypkin ======== https://hg.mozilla.org/integration/gaia-central/rev/a69ee3434699 Author: DouglasSherk Desc: Bug 1006133 - [Messages] Add tests for UI message deletion. r=azasypkin --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7e84e1b4f832..efe64823d842 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "9f6a7686bb2409986bac58a4b91e1f4c41c133af", + "revision": "22be86b1e87eedabfe4df6b8ea86947a0366f4d8", "repo_path": "/integration/gaia-central" } From fa75ce404b2dc07e6f43687b7be23d2bbecabb18 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:16:37 -0700 Subject: [PATCH 16/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4235bf02e036..e73cea0056ae 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 1017c01f693c..41e734226f36 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 5ef33d7f9727..204c7a18b2a0 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4235bf02e036..e73cea0056ae 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 9fa5994f5091..675ccb9f7ecf 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index daf81d8269f2..ad0ec487198e 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 801ede67f66d..f370c059ed41 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 41da0f1a67a9..e000d712ec74 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 854a8f57733d..f89b517cf3ca 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 77997fc7245f..a2bef5b0cbcc 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 9228ca7ab446..d040897dec58 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From d0394466354df48657c7c3cd2bdf72bc40ea7c1c Mon Sep 17 00:00:00 2001 From: Shinuk Lee Date: Wed, 7 May 2014 17:11:00 -0400 Subject: [PATCH 17/32] Bug 999396 - Flip camera face-detection pref on. r=mikeh, sr=hkoka --- modules/libpref/src/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index e1e125a8df74..fa343a445ed8 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -4123,4 +4123,4 @@ pref("beacon.enabled", true); // Camera prefs pref("camera.control.autofocus_moving_callback.enabled", false); -pref("camera.control.face_detection.enabled", false); +pref("camera.control.face_detection.enabled", true); From 8ad50c9f3c47d603add946d19a07ffc879d91e0a Mon Sep 17 00:00:00 2001 From: Sam Penrose Date: Wed, 7 May 2014 11:14:05 -0700 Subject: [PATCH 18/32] Bug 1004242 - Expose FxAccounts resendVerificationEmail to Gaia. r=jedp --- b2g/components/FxAccountsMgmtService.jsm | 10 ++++++ services/fxaccounts/FxAccountsManager.jsm | 11 ++++++ .../fxaccounts/tests/xpcshell/test_manager.js | 36 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/b2g/components/FxAccountsMgmtService.jsm b/b2g/components/FxAccountsMgmtService.jsm index da0897d70e45..fa45637b8df3 100644 --- a/b2g/components/FxAccountsMgmtService.jsm +++ b/b2g/components/FxAccountsMgmtService.jsm @@ -120,6 +120,16 @@ this.FxAccountsMgmtService = { } ).then(null, Components.utils.reportError); break; + case "resendVerificationEmail": + FxAccountsManager.resendVerificationEmail().then( + () => { + self._onFulfill(msg.id); + }, + reason => { + self._onReject(msg.id, reason); + } + ).then(null, Components.utils.reportError); + break; case "signIn": case "signUp": case "refreshAuthentication": diff --git a/services/fxaccounts/FxAccountsManager.jsm b/services/fxaccounts/FxAccountsManager.jsm index be1aed0083ee..03039c952944 100644 --- a/services/fxaccounts/FxAccountsManager.jsm +++ b/services/fxaccounts/FxAccountsManager.jsm @@ -250,6 +250,17 @@ this.FxAccountsManager = { return this._signOut(); }, + resendVerificationEmail: function() { + return this._fxAccounts.resendVerificationEmail().then( + (result) => { + return result; + }, + (error) => { + return this._error(ERROR_SERVER_ERROR, error); + } + ); + }, + getAccount: function() { // We check first if we have session details cached. if (this._activeSession) { diff --git a/services/fxaccounts/tests/xpcshell/test_manager.js b/services/fxaccounts/tests/xpcshell/test_manager.js index efa9ca402e01..9a9c726c1345 100644 --- a/services/fxaccounts/tests/xpcshell/test_manager.js +++ b/services/fxaccounts/tests/xpcshell/test_manager.js @@ -122,6 +122,15 @@ FxAccountsManager._fxAccounts = { return deferred.promise; }, + resendVerificationEmail: function() { + return this.getSignedInUser().then(data => { + if (data) { + return Promise.resolve(true); + } + throw new Error("Cannot resend verification email; no signed-in user"); + }); + }, + setSignedInUser: function(user) { this._setSignedInUserCalled = true; let deferred = Promise.defer(); @@ -580,6 +589,33 @@ add_test(function(test_signIn_already_signed_user) { ); }); +add_test(function(test_resendVerificationEmail_error_handling) { + do_print("= resendVerificationEmail smoke test ="); + let user = FxAccountsManager._fxAccounts._signedInUser; + FxAccountsManager._fxAccounts._signedInUser.verified = false; + FxAccountsManager.resendVerificationEmail().then( + (success) => { + do_check_true(success); + }, + (error) => { + do_throw("Unexpected failure"); + } + ); + // Here we verify that when FxAccounts.resendVerificationEmail + // throws an error, we gracefully handle it in the reject() channel. + FxAccountsManager._fxAccounts._signedInUser = null; + FxAccountsManager.resendVerificationEmail().then( + (success) => { + do_throw("Unexpected success"); + }, + (error) => { + do_check_eq(error.error, ERROR_SERVER_ERROR); + } + ); + FxAccountsManager._fxAccounts._signedInUser = user; + run_next_test(); +}); + add_test(function(test_verificationStatus_unverified_session_unverified_user) { do_print("= verificationStatus unverified session and user ="); FakeFxAccountsClient._verified = false; From 652b112b779fb0c2e10a94ec427c2ea04ad685d3 Mon Sep 17 00:00:00 2001 From: Victor Porof Date: Wed, 7 May 2014 22:10:42 -0400 Subject: [PATCH 19/32] Bug 1007465 - The .variables-view-edit class in widgets.inc.css has left padding, r=bgrins --- browser/themes/shared/devtools/widgets.inc.css | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/themes/shared/devtools/widgets.inc.css b/browser/themes/shared/devtools/widgets.inc.css index 17aac311e94f..f3ab93abf134 100644 --- a/browser/themes/shared/devtools/widgets.inc.css +++ b/browser/themes/shared/devtools/widgets.inc.css @@ -808,7 +808,6 @@ list-style-image: url("chrome://browser/skin/devtools/vview-edit.png"); -moz-image-region: rect(0,16px,16px,0); cursor: pointer; - padding-left: 2px; } .variables-view-edit:hover { From 464392b58d6b721d2fc1d7007d35b279c448d8b6 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:26:09 -0700 Subject: [PATCH 20/32] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/207ca4a72172 Author: Jared Hirsch Desc: Merge pull request #18840 from 6a68/bug-1004099-fxa-settingsapp-remove-accountId Bug 1004099 - FxA Settings app - remove refs to 'accountId', replace with 'email' ======== https://hg.mozilla.org/integration/gaia-central/rev/fd62b6a13e42 Author: Jared Hirsch Desc: Bug 1004099 - FxA Settings app - remove refs to 'accountId', replace with 'email'. r=arthurcc ======== https://hg.mozilla.org/integration/gaia-central/rev/3deb1abd401f Author: Jared Hirsch Desc: Merge pull request #18839 from 6a68/bug-1003993-fxa-systemapp-remove-accountId Bug 1003993 - FxA System app - remove refs to 'accountId', replace with 'email' ======== https://hg.mozilla.org/integration/gaia-central/rev/b6d9156c743b Author: Jared Hirsch Desc: Bug 1003993 - FxA System app - remove refs to 'accountId', replace with 'email'. r=ferjm --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index efe64823d842..25a1ad596cab 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "22be86b1e87eedabfe4df6b8ea86947a0366f4d8", + "revision": "207ca4a721723c4719fb376b111b43bae79bd82f", "repo_path": "/integration/gaia-central" } From 9f25bf3ba0ae8cc6a6a45bb3f017681dafb270c1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:28:00 -0700 Subject: [PATCH 21/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index e73cea0056ae..5b6f311429e9 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 41e734226f36..e9105745e757 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 204c7a18b2a0..8b905d836127 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index e73cea0056ae..5b6f311429e9 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 675ccb9f7ecf..b67c707342e2 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index ad0ec487198e..e477fed037d3 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index f370c059ed41..04918180a584 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index e000d712ec74..40c3f97edc45 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index f89b517cf3ca..cbc2b4b306ad 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index a2bef5b0cbcc..a84f897c5d9a 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index d040897dec58..d78fc7c76514 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 65495b57b5b1a92b4a80a7ecf3658ad0b2e00810 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:32:53 -0700 Subject: [PATCH 22/32] Bumping manifests a=b2g-bump --- b2g/config/flame/sources.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index b67c707342e2..ab7001e4fba4 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -119,7 +119,7 @@ - + From a1a771d474a6a9c50197df066d44475ce919a24e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:50:53 -0700 Subject: [PATCH 23/32] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9d42b77320ed Author: Arnau Desc: Merge pull request #18784 from rnowm/1000132 Bug 1000132 - [Building Blocks] Split headers.css to demo @import r=cyee ======== https://hg.mozilla.org/integration/gaia-central/rev/5d8904e5e8c6 Author: rnowm Desc: Bug 1000132 - [Building Blocks] Split headers.css to demo @import --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 25a1ad596cab..3a9c46c73ea6 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "207ca4a721723c4719fb376b111b43bae79bd82f", + "revision": "9d42b77320ede120cb394f12f3e94567500e930c", "repo_path": "/integration/gaia-central" } From e75a7cbd6d90f7b889c4ed596a4f3aa9fd0e9330 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 13:56:21 -0700 Subject: [PATCH 24/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 5b6f311429e9..c905ea4530b9 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index e9105745e757..c8d76fa15835 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 8b905d836127..a2da43dd2efe 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 5b6f311429e9..c905ea4530b9 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index ab7001e4fba4..95a94c9aef4e 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index e477fed037d3..6ff1185e1008 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 04918180a584..4daf3a2b0109 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 40c3f97edc45..2797e3c218f6 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index cbc2b4b306ad..253ef4285956 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index a84f897c5d9a..93e43de38597 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index d78fc7c76514..4a0f999dcd3c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 8bf8be15f1ee5b91f816d957e1b08c644c7936a5 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Thu, 8 May 2014 10:07:00 -0400 Subject: [PATCH 25/32] Bug 967475 - Implement mozChromeNotifications API. r=mhenretty, r=bent --HG-- extra : rebase_source : 595b53c85f031784bd77591d4e0593e60b39ccfd --- b2g/components/AlertsHelper.jsm | 13 +- b2g/components/AlertsService.js | 8 +- b2g/installer/package-manifest.in | 2 + browser/installer/package-manifest.in | 2 + dom/bindings/BindingUtils.cpp | 9 + .../notification/nsINotificationStorage.idl | 9 +- dom/src/notification/ChromeNotifications.js | 113 ++++++++++++ .../notification/ChromeNotifications.manifest | 3 + dom/src/notification/Notification.cpp | 53 +++--- dom/src/notification/Notification.h | 7 +- dom/src/notification/NotificationDB.jsm | 82 ++++++++- dom/src/notification/NotificationStorage.js | 6 +- dom/src/notification/moz.build | 2 + .../test/unit/test_notificationdb.js | 113 ++++++++++++ .../mochitest/notification/MockServices.js | 54 ++++-- .../mochitest/notification/mochitest.ini | 1 + .../notification/test_bug931307.html | 4 +- .../test_notification_basics.html | 2 +- .../test_notification_resend.html | 170 ++++++++++++++++++ .../test_notification_storage.html | 6 +- dom/webidl/ChromeNotifications.webidl | 14 ++ dom/webidl/moz.build | 1 + mobile/android/installer/package-manifest.in | 2 + 23 files changed, 614 insertions(+), 62 deletions(-) create mode 100644 dom/src/notification/ChromeNotifications.js create mode 100644 dom/src/notification/ChromeNotifications.manifest create mode 100644 dom/tests/mochitest/notification/test_notification_resend.html create mode 100644 dom/webidl/ChromeNotifications.webidl diff --git a/b2g/components/AlertsHelper.jsm b/b2g/components/AlertsHelper.jsm index 9260c1066af9..0089f381eca1 100644 --- a/b2g/components/AlertsHelper.jsm +++ b/b2g/components/AlertsHelper.jsm @@ -144,7 +144,8 @@ let AlertsHelper = { lang: listener.lang, dir: listener.dir, id: listener.id, - tag: listener.tag + tag: listener.tag, + timestamp: listener.timestamp }, Services.io.newURI(listener.target, null, null), Services.io.newURI(listener.manifestURL, null, null) @@ -194,7 +195,7 @@ let AlertsHelper = { }, showNotification: function(imageURL, title, text, textClickable, cookie, - uid, bidi, lang, manifestURL) { + uid, bidi, lang, manifestURL, timestamp) { function send(appName, appIcon) { SystemAppProxy._sendCustomEvent(kMozChromeNotificationEvent, { type: kDesktopNotification, @@ -206,7 +207,8 @@ let AlertsHelper = { lang: lang, appName: appName, appIcon: appIcon, - manifestURL: manifestURL + manifestURL: manifestURL, + timestamp: timestamp }); } @@ -248,12 +250,13 @@ let AlertsHelper = { lang: details.lang || undefined, id: details.id || undefined, dir: details.dir || undefined, - tag: details.tag || undefined + tag: details.tag || undefined, + timestamp: details.timestamp || undefined }; this.registerAppListener(data.uid, listener); this.showNotification(data.imageURL, data.title, data.text, details.textClickable, null, data.uid, details.dir, - details.lang, details.manifestURL); + details.lang, details.manifestURL, details.timestamp); }, closeAlert: function(name) { diff --git a/b2g/components/AlertsService.js b/b2g/components/AlertsService.js index 96be4593039f..b7b2f1a8cd7e 100644 --- a/b2g/components/AlertsService.js +++ b/b2g/components/AlertsService.js @@ -43,6 +43,7 @@ const kMessageAlertNotificationSend = "alert-notification-send"; const kMessageAlertNotificationClose = "alert-notification-close"; const kTopicAlertFinished = "alertfinished"; +const kTopicAlertClickCallback = "alertclickcallback"; function AlertsService() { Services.obs.addObserver(this, "xpcom-shutdown", false); @@ -103,7 +104,8 @@ AlertsService.prototype = { id: aDetails.id || undefined, dbId: aDetails.dbId || undefined, dir: aDetails.dir || undefined, - tag: aDetails.tag || undefined + tag: aDetails.tag || undefined, + timestamp: aDetails.timestamp || undefined }; cpmm.sendAsyncMessage(kMessageAppNotificationSend, { @@ -135,6 +137,7 @@ AlertsService.prototype = { // the notification so the app get a change to react. if (data.target) { gSystemMessenger.sendMessage(kNotificationSystemMessageName, { + clicked: (topic === kTopicAlertClickCallback), title: listener.title, body: listener.text, imageURL: listener.imageURL, @@ -142,7 +145,8 @@ AlertsService.prototype = { dir: listener.dir, id: listener.id, tag: listener.tag, - dbId: listener.dbId + dbId: listener.dbId, + timestamp: listener.timestamp }, Services.io.newURI(data.target, null, null), Services.io.newURI(listener.manifestURL, null, null) diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index cc6d99a78af7..8a26fc7e293a 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -336,6 +336,8 @@ @BINPATH@/components/zipwriter.xpt ; JavaScript components +@BINPATH@/components/ChromeNotifications.js +@BINPATH@/components/ChromeNotifications.manifest @BINPATH@/components/ConsoleAPI.manifest @BINPATH@/components/ConsoleAPIStorage.js @BINPATH@/components/BrowserElementParent.manifest diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 8b380fb04de3..baa9f3b329ed 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -344,6 +344,8 @@ @BINPATH@/components/telemetry.xpt ; JavaScript components +@BINPATH@/components/ChromeNotifications.js +@BINPATH@/components/ChromeNotifications.manifest @BINPATH@/components/ConsoleAPI.manifest @BINPATH@/components/ConsoleAPIStorage.js @BINPATH@/components/BrowserElementParent.manifest diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 572099a0d8bf..6d0e48803c0c 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -14,6 +14,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/FloatingPoint.h" #include "mozilla/Assertions.h" +#include "mozilla/Preferences.h" #include "AccessCheck.h" #include "jsfriendapi.h" @@ -2155,6 +2156,10 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle v, bool IsInPrivilegedApp(JSContext* aCx, JSObject* aObj) { + if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) { + return true; + } + using mozilla::dom::workers::GetWorkerPrivateFromContext; if (!NS_IsMainThread()) { return GetWorkerPrivateFromContext(aCx)->IsInPrivilegedApp(); @@ -2169,6 +2174,10 @@ IsInPrivilegedApp(JSContext* aCx, JSObject* aObj) bool IsInCertifiedApp(JSContext* aCx, JSObject* aObj) { + if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) { + return true; + } + using mozilla::dom::workers::GetWorkerPrivateFromContext; if (!NS_IsMainThread()) { return GetWorkerPrivateFromContext(aCx)->IsInCertifiedApp(); diff --git a/dom/interfaces/notification/nsINotificationStorage.idl b/dom/interfaces/notification/nsINotificationStorage.idl index a046989222d4..da3b89212e1c 100644 --- a/dom/interfaces/notification/nsINotificationStorage.idl +++ b/dom/interfaces/notification/nsINotificationStorage.idl @@ -39,7 +39,7 @@ interface nsINotificationStorageCallback : nsISupports /** * Interface for notification persistence layer. */ -[scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)] +[scriptable, uuid(cc4656d7-2a2a-47f1-8016-55891e833d64)] interface nsINotificationStorage : nsISupports { @@ -55,6 +55,10 @@ interface nsINotificationStorage : nsISupports * @param body: the notification body * @param tag: notification tag, will replace any existing * notifications with same origin/tag pair + * @param alertName: the alert identifier as used by system app. + * Stored in the database to avoid re-computing + * it. Built from origin and tag or id depending + * whether there is a tag defined. */ void put(in DOMString origin, in DOMString id, @@ -63,7 +67,8 @@ interface nsINotificationStorage : nsISupports in DOMString lang, in DOMString body, in DOMString tag, - in DOMString icon); + in DOMString icon, + in DOMString alertName); /** * Retrieve a list of notifications. diff --git a/dom/src/notification/ChromeNotifications.js b/dom/src/notification/ChromeNotifications.js new file mode 100644 index 000000000000..11e0af818e32 --- /dev/null +++ b/dom/src/notification/ChromeNotifications.js @@ -0,0 +1,113 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const DEBUG = false; + +function debug(s) { + dump("-*- ChromeNotifications.js: " + s + "\n"); +} + +const Ci = Components.interfaces; +const Cu = Components.utils; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "Services", + "resource://gre/modules/Services.jsm"); + +XPCOMUtils.defineLazyServiceGetter(this, "cpmm", + "@mozilla.org/childprocessmessagemanager;1", + "nsIMessageSender"); + +XPCOMUtils.defineLazyServiceGetter(this, "appNotifier", + "@mozilla.org/system-alerts-service;1", + "nsIAppNotificationService"); + +const CHROMENOTIFICATIONS_CID = "{74f94093-8b37-497e-824f-c3b250a911da}"; +const CHROMENOTIFICATIONS_CONTRACTID = "@mozilla.org/mozChromeNotifications;1"; + +function ChromeNotifications() { + this.innerWindowID = null; + this.resendCallback = null; +} + +ChromeNotifications.prototype = { + + init: function(aWindow) { + let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + this.innerWindowID = util.currentInnerWindowID; + Services.obs.addObserver(this, "inner-window-destroyed", false); + cpmm.addMessageListener("Notification:GetAllCrossOrigin:Return:OK", this); + }, + + performResend: function(notifications) { + let resentNotifications = 0; + + notifications.forEach(function(notification) { + appNotifier.showAppNotification( + notification.icon, + notification.title, + notification.body, + null, + { + manifestURL: notification.origin, + id: notification.alertName, + dir: notification.dir, + lang: notification.lang, + tag: notification.tag, + dbId: notification.id, + timestamp: notification.timestamp + } + ); + resentNotifications++; + }); + + try { + this.resendCallback && this.resendCallback(resentNotifications); + } catch (ex) { + if (DEBUG) debug("Content sent exception: " + ex); + } + }, + + mozResendAllNotifications: function(resendCallback) { + this.resendCallback = resendCallback; + cpmm.sendAsyncMessage("Notification:GetAllCrossOrigin", {}); + }, + + receiveMessage: function(message) { + switch (message.name) { + case "Notification:GetAllCrossOrigin:Return:OK": + this.performResend(message.data.notifications); + break; + + default: + if (DEBUG) { debug("Unrecognized message: " + message.name); } + break; + } + }, + + observe: function(aSubject, aTopic, aData) { + if (DEBUG) debug("Topic: " + aTopic); + if (aTopic == "inner-window-destroyed") { + let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data; + if (wId != this.innerWindowID) { + return; + } + Services.obs.removeObserver(this, "inner-window-destroyed"); + cpmm.removeMessageListener("Notification:GetAllCrossOrigin:Return:OK", this); + } + }, + + classID : Components.ID(CHROMENOTIFICATIONS_CID), + contractID : CHROMENOTIFICATIONS_CONTRACTID, + QueryInterface: XPCOMUtils.generateQI([Ci.nsIChromeNotifications, + Ci.nsIDOMGlobalPropertyInitializer, + Ci.nsIObserver, + Ci.nsIMessageListener]), +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeNotifications]); diff --git a/dom/src/notification/ChromeNotifications.manifest b/dom/src/notification/ChromeNotifications.manifest new file mode 100644 index 000000000000..74e93107ffd7 --- /dev/null +++ b/dom/src/notification/ChromeNotifications.manifest @@ -0,0 +1,3 @@ +# ChromeNotifications.js +component {74f94093-8b37-497e-824f-c3b250a911da} ChromeNotifications.js +contract @mozilla.org/mozChromeNotifications;1 {74f94093-8b37-497e-824f-c3b250a911da} diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 047699c48849..157203bf870c 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -423,6 +423,22 @@ Notification::Notification(const nsAString& aID, const nsAString& aTitle, const mID(aID), mTitle(aTitle), mBody(aBody), mDir(aDir), mLang(aLang), mTag(aTag), mIconUrl(aIconUrl), mIsClosed(false) { + nsAutoString alertName; + DebugOnly rv = GetOrigin(GetOwner(), alertName); + MOZ_ASSERT(NS_SUCCEEDED(rv), "GetOrigin should not have failed"); + + // Get the notification name that is unique per origin + tag/ID. + // The name of the alert is of the form origin#tag/ID. + alertName.AppendLiteral("#"); + if (!mTag.IsEmpty()) { + alertName.Append(NS_LITERAL_STRING("tag:")); + alertName.Append(mTag); + } else { + alertName.Append(NS_LITERAL_STRING("notag:")); + alertName.Append(mID); + } + + mAlertName = alertName; } // static @@ -462,6 +478,10 @@ Notification::Constructor(const GlobalObject& aGlobal, nsString id; notification->GetID(id); + + nsString alertName; + notification->GetAlertName(alertName); + aRv = notificationStorage->Put(origin, id, aTitle, @@ -469,7 +489,8 @@ Notification::Constructor(const GlobalObject& aGlobal, aOptions.mLang, aOptions.mBody, aOptions.mTag, - aOptions.mIcon); + aOptions.mIcon, + alertName); if (aRv.Failed()) { return nullptr; } @@ -557,10 +578,6 @@ Notification::ShowInternal() nsCOMPtr observer = new NotificationObserver(this); - nsString alertName; - rv = GetAlertName(alertName); - NS_ENSURE_SUCCESS_VOID(rv); - #ifdef MOZ_B2G nsCOMPtr appNotifier = do_GetService("@mozilla.org/system-alerts-service;1"); @@ -578,7 +595,7 @@ Notification::ShowInternal() AppNotificationServiceOptions ops; ops.mTextClickable = true; ops.mManifestURL = manifestUrl; - ops.mId = alertName; + ops.mId = mAlertName; ops.mDbId = mID; ops.mDir = DirectionToString(mDir); ops.mLang = mLang; @@ -602,7 +619,7 @@ Notification::ShowInternal() nsString uniqueCookie = NS_LITERAL_STRING("notification:"); uniqueCookie.AppendInt(sCount++); alertService->ShowAlertNotification(absoluteUrl, mTitle, mBody, true, - uniqueCookie, observer, alertName, + uniqueCookie, observer, mAlertName, DirectionToString(mDir), mLang, GetPrincipal()); } @@ -771,10 +788,8 @@ Notification::CloseInternal() nsCOMPtr alertService = do_GetService(NS_ALERTSERVICE_CONTRACTID); if (alertService) { - nsString alertName; - rv = GetAlertName(alertName); if (NS_SUCCEEDED(rv)) { - alertService->CloseAlert(alertName, GetPrincipal()); + alertService->CloseAlert(mAlertName, GetPrincipal()); } } } @@ -812,24 +827,6 @@ Notification::GetOrigin(nsPIDOMWindow* aWindow, nsString& aOrigin) return NS_OK; } -nsresult -Notification::GetAlertName(nsString& aAlertName) -{ - // Get the notification name that is unique per origin + tag/ID. - // The name of the alert is of the form origin#tag/ID. - nsresult rv = GetOrigin(GetOwner(), aAlertName); - NS_ENSURE_SUCCESS(rv, rv); - aAlertName.AppendLiteral("#"); - if (!mTag.IsEmpty()) { - aAlertName.Append(NS_LITERAL_STRING("tag:")); - aAlertName.Append(mTag); - } else { - aAlertName.Append(NS_LITERAL_STRING("notag:")); - aAlertName.Append(mID); - } - return NS_OK; -} - } // namespace dom } // namespace mozilla diff --git a/dom/src/notification/Notification.h b/dom/src/notification/Notification.h index cd5de4d69d9f..ae83174b7d4f 100644 --- a/dom/src/notification/Notification.h +++ b/dom/src/notification/Notification.h @@ -133,7 +133,10 @@ protected: static nsresult GetOrigin(nsPIDOMWindow* aWindow, nsString& aOrigin); - nsresult GetAlertName(nsString& aAlertName); + void GetAlertName(nsAString& aRetval) + { + aRetval = mAlertName; + } nsString mID; nsString mTitle; @@ -143,6 +146,8 @@ protected: nsString mTag; nsString mIconUrl; + nsString mAlertName; + bool mIsClosed; static uint32_t sCount; diff --git a/dom/src/notification/NotificationDB.jsm b/dom/src/notification/NotificationDB.jsm index f082176f51da..5a53dbe6d28a 100644 --- a/dom/src/notification/NotificationDB.jsm +++ b/dom/src/notification/NotificationDB.jsm @@ -16,6 +16,9 @@ const Ci = Components.interfaces; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Services", + "resource://gre/modules/Services.jsm"); + XPCOMUtils.defineLazyServiceGetter(this, "ppmm", "@mozilla.org/parentprocessmessagemanager;1", "nsIMessageListenerManager"); @@ -33,8 +36,23 @@ const NOTIFICATION_STORE_DIR = OS.Constants.Path.profileDir; const NOTIFICATION_STORE_PATH = OS.Path.join(NOTIFICATION_STORE_DIR, "notificationstore.json"); +const kMessages = [ + "Notification:Save", + "Notification:Delete", + "Notification:GetAll", + "Notification:GetAllCrossOrigin" +]; + let NotificationDB = { + + // Ensure we won't call init() while xpcom-shutdown is performed + _shutdownInProgress: false, + init: function() { + if (this._shutdownInProgress) { + return; + } + this.notifications = {}; this.byTag = {}; this.loaded = false; @@ -42,9 +60,29 @@ let NotificationDB = { this.tasks = []; // read/write operation queue this.runningTask = false; - ppmm.addMessageListener("Notification:Save", this); - ppmm.addMessageListener("Notification:Delete", this); - ppmm.addMessageListener("Notification:GetAll", this); + Services.obs.addObserver(this, "xpcom-shutdown", false); + this.registerListeners(); + }, + + registerListeners: function() { + for (let message of kMessages) { + ppmm.addMessageListener(message, this); + } + }, + + unregisterListeners: function() { + for (let message of kMessages) { + ppmm.removeMessageListener(message, this); + } + }, + + observe: function(aSubject, aTopic, aData) { + if (DEBUG) debug("Topic: " + aTopic); + if (aTopic == "xpcom-shutdown") { + this._shutdownInProgress = true; + Services.obs.removeObserver(this, "xpcom-shutdown"); + this.unregisterListeners(); + } }, // Attempt to read notification file, if it's not there we will create it. @@ -160,6 +198,15 @@ let NotificationDB = { }); break; + case "Notification:GetAllCrossOrigin": + this.queueTask("getallaccrossorigin", message.data, + function(notifications) { + returnMessage("Notification:GetAllCrossOrigin:Return:OK", { + notifications: notifications + }); + }); + break; + case "Notification:Save": this.queueTask("save", message.data, function() { returnMessage("Notification:Save:Return:OK", { @@ -193,14 +240,14 @@ let NotificationDB = { // Only run immediately if we aren't currently running another task. if (!this.runningTask) { - if (DEBUG) { dump("Task queue was not running, starting now..."); } + if (DEBUG) { debug("Task queue was not running, starting now..."); } this.runNextTask(); } }, runNextTask: function() { if (this.tasks.length === 0) { - if (DEBUG) { dump("No more tasks to run, queue depleted"); } + if (DEBUG) { debug("No more tasks to run, queue depleted"); } this.runningTask = false; return; } @@ -223,6 +270,10 @@ let NotificationDB = { this.taskGetAll(task.data, wrappedCallback); break; + case "getallaccrossorigin": + this.taskGetAllCrossOrigin(wrappedCallback); + break; + case "save": this.taskSave(task.data, wrappedCallback); break; @@ -245,6 +296,27 @@ let NotificationDB = { callback(notifications); }, + taskGetAllCrossOrigin: function(callback) { + if (DEBUG) { debug("Task, getting all whatever origin"); } + var notifications = []; + for (var origin in this.notifications) { + for (var i in this.notifications[origin]) { + var notification = this.notifications[origin][i]; + + // Notifications without the alertName field cannot be resent by + // mozResendAllNotifications, so we just skip them. They will + // still be available to applications via Notification.get() + if (!('alertName' in notification)) { + continue; + } + + notification.origin = origin; + notifications.push(notification); + } + } + callback(notifications); + }, + taskSave: function(data, callback) { if (DEBUG) { debug("Task, saving"); } var origin = data.origin; diff --git a/dom/src/notification/NotificationStorage.js b/dom/src/notification/NotificationStorage.js index b8b86ea28113..a241a52158b2 100644 --- a/dom/src/notification/NotificationStorage.js +++ b/dom/src/notification/NotificationStorage.js @@ -36,7 +36,7 @@ function NotificationStorage() { NotificationStorage.prototype = { - put: function(origin, id, title, dir, lang, body, tag, icon) { + put: function(origin, id, title, dir, lang, body, tag, icon, alertName) { if (DEBUG) { debug("PUT: " + id + ": " + title); } var notification = { id: id, @@ -45,7 +45,9 @@ NotificationStorage.prototype = { lang: lang, body: body, tag: tag, - icon: icon + icon: icon, + alertName: alertName, + timestamp: new Date().getTime() }; this._notifications[id] = notification; diff --git a/dom/src/notification/moz.build b/dom/src/notification/moz.build index 552eb3af0c97..45c29b89ee31 100644 --- a/dom/src/notification/moz.build +++ b/dom/src/notification/moz.build @@ -5,6 +5,8 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_COMPONENTS += [ + 'ChromeNotifications.js', + 'ChromeNotifications.manifest', 'NotificationStorage.js', 'NotificationStorage.manifest', ] diff --git a/dom/src/notification/test/unit/test_notificationdb.js b/dom/src/notification/test/unit/test_notificationdb.js index b274b48606bc..171324a174ca 100644 --- a/dom/src/notification/test/unit/test_notificationdb.js +++ b/dom/src/notification/test/unit/test_notificationdb.js @@ -336,3 +336,116 @@ add_test(function test_send_two_get_two() { requestID: (requestID + 1) // 21 }); }); + +// Cleanup previous notification +add_test(function test_delete_previous() { + let requestID = 25; + let msgReply = "Notification:Delete:Return:OK"; + let msgHandler = function(message) { + do_check_eq(requestID, message.data.requestID); + }; + + addAndSend("Notification:Delete", msgReply, msgHandler, { + origin: systemNotification.origin, + id: "{8ef9a628-f0f4-44b4-820d-c117573c33e3}", + requestID: requestID + }); +}); + +// Store two notifications, one without alertName and one with +add_test(function test_send_two_alertName() { + let requestID = 30; + let notifications = [ + { + origin: "app://system.gaiamobile.org/manifest.webapp", + id: "{27ead857-4f43-457f-a770-93b82fbfc223}", + title: "Notification title", + dir: "auto", + lang: "", + body: "Notification body", + tag: "", + icon: "icon.png", + timestamp: new Date().getTime() + }, { + origin: "app://system.gaiamobile.org/manifest.webapp", + id: "{40275e04-58d0-47be-8cc7-540578f793a4}", + title: "Notification title", + dir: "auto", + lang: "", + body: "Notification body", + tag: "", + icon: "icon.png", + alertName: "alertName", + timestamp: new Date().getTime() + } + ]; + let origin = notifications[0].origin; + + let msgGetCrossOriginReply = "Notification:GetAllCrossOrigin:Return:OK"; + let msgGetCrossOriginHandler = { + receiveMessage: function(message) { + if (message.name === msgGetCrossOriginReply) { + cpmm.removeMessageListener( + msgGetCrossOriginReply, msgGetCrossOriginHandler); + + let gotNotifications = message.data.notifications; + + // we expect to have one notification + do_check_eq(1, gotNotifications.length); + + // compare the only notification we should have got back + compareNotification(gotNotifications[0], notifications[1]); + + run_next_test(); + } + } + }; + cpmm.addMessageListener(msgGetCrossOriginReply, msgGetCrossOriginHandler); + + let msgGetReply = "Notification:GetAll:Return:OK"; + let msgGetHandler = { + receiveMessage: function(message) { + if (message.name === msgGetReply) { + cpmm.removeMessageListener(msgGetReply, msgGetHandler); + + let gotNotifications = message.data.notifications; + + // we expect to have two notifications + do_check_eq(2, gotNotifications.length); + + // compare each notification + for (let i = 0; i < gotNotifications.length; i++) { + compareNotification(gotNotifications[i], notifications[i]); + } + + run_next_test(); + } + } + }; + cpmm.addMessageListener(msgGetReply, msgGetHandler); + + let msgSaveReply = "Notification:Save:Return:OK"; + let msgSaveCalls = 0; + let msgSaveHandler = { + receiveMessage: function(message) { + if (message.name === msgSaveReply) { + msgSaveCalls++; + if (msgSaveCalls === 2) { + cpmm.removeMessageListener(msgSaveReply, msgSaveHandler); + // Trigger getall + cpmm.sendAsyncMessage("Notification:GetAll", { + origin: origin + }); + } + } + } + }; + cpmm.addMessageListener(msgSaveReply, msgSaveHandler); + + notifications.forEach(function(n) { + cpmm.sendAsyncMessage("Notification:Save", { + origin: origin, + notification: n + }); + }); +}); diff --git a/dom/tests/mochitest/notification/MockServices.js b/dom/tests/mochitest/notification/MockServices.js index 164cc7e9a91f..28c5f7750ae2 100644 --- a/dom/tests/mochitest/notification/MockServices.js +++ b/dom/tests/mochitest/notification/MockServices.js @@ -12,41 +12,66 @@ var MockServices = (function () { var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager .QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar); - var activeNotifications = Object.create(null); + var activeAlertNotifications = Object.create(null); + + var activeAppNotifications = Object.create(null); var mockAlertsService = { showAlertNotification: function(imageUrl, title, text, textClickable, cookie, alertListener, name) { var listener = SpecialPowers.wrap(alertListener); - activeNotifications[name] = { + activeAlertNotifications[name] = { listener: listener, cookie: cookie }; // fake async alert show event - setTimeout(function () { - listener.observe(null, "alertshow", cookie); - }, 100); + if (listener) { + setTimeout(function () { + listener.observe(null, "alertshow", cookie); + }, 100); + } // ?? SpecialPowers.wrap(alertListener).observe(null, "alertclickcallback", cookie); }, - showAppNotification: function(imageUrl, title, text, textClickable, - manifestURL, alertListener, name) { - this.showAlertNotification(imageUrl, title, text, textClickable, "", alertListener, name); + showAppNotification: function(aImageUrl, aTitle, aText, aAlertListener, aDetails) { + var listener = aAlertListener || (activeAlertNotifications[aDetails.id] ? activeAlertNotifications[aDetails.id].listener : undefined); + activeAppNotifications[aDetails.id] = { + observer: listener, + title: aTitle, + text: aText, + manifestURL: aDetails.manifestURL, + imageURL: aImageUrl, + lang: aDetails.lang || undefined, + id: aDetails.id || undefined, + dbId: aDetails.dbId || undefined, + dir: aDetails.dir || undefined, + tag: aDetails.tag || undefined, + timestamp: aDetails.timestamp || undefined + }; + this.showAlertNotification(aImageUrl, aTitle, aText, true, "", listener, aDetails.id); }, closeAlert: function(name) { - var notification = activeNotifications[name]; - if (notification) { - notification.listener.observe(null, "alertfinished", notification.cookie); - delete activeNotifications[name]; + var alertNotification = activeAlertNotifications[name]; + if (alertNotification) { + if (alertNotification.listener) { + alertNotification.listener.observe(null, "alertfinished", alertNotification.cookie); + } + delete activeAlertNotifications[name]; + } + + var appNotification = activeAppNotifications[name]; + if (appNotification) { + delete activeAppNotifications[name]; } }, QueryInterface: function(aIID) { if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) || - SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) { + SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService) || + SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAppNotificationService)) { return this; } throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE; @@ -77,5 +102,8 @@ var MockServices = (function () { registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService); registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService); }, + + activeAlertNotifications: activeAlertNotifications, + activeAppNotifications: activeAppNotifications, }; })(); diff --git a/dom/tests/mochitest/notification/mochitest.ini b/dom/tests/mochitest/notification/mochitest.ini index ac54da835798..89d4e45169c3 100644 --- a/dom/tests/mochitest/notification/mochitest.ini +++ b/dom/tests/mochitest/notification/mochitest.ini @@ -9,3 +9,4 @@ support-files = skip-if = (toolkit == 'gonk' && debug) #debug-only timeout [test_bug931307.html] skip-if = (toolkit == 'gonk' && debug) #debug-only timeout +[test_notification_resend.html] diff --git a/dom/tests/mochitest/notification/test_bug931307.html b/dom/tests/mochitest/notification/test_bug931307.html index 9477b1ea6210..03030114fa7d 100644 --- a/dom/tests/mochitest/notification/test_bug931307.html +++ b/dom/tests/mochitest/notification/test_bug931307.html @@ -13,15 +13,17 @@ + + + + + + From eff987d3353068a8f4e36ceccb009c43ff3495b1 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 8 May 2014 16:10:16 -0400 Subject: [PATCH 27/32] Backed out changeset b9e61c8bdf49 (bug 1002456) for mochitest-dt orange. --- browser/devtools/debugger/test/browser.ini | 2 - .../test/browser_dbg_optimized-out-vars.js | 48 ------------------- .../test/doc_closure-optimized-out.html | 34 ------------- 3 files changed, 84 deletions(-) delete mode 100644 browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js delete mode 100644 browser/devtools/debugger/test/doc_closure-optimized-out.html diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini index bd7a176c06fb..a2a0bf3d24d7 100644 --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -42,7 +42,6 @@ support-files = doc_blackboxing.html doc_breakpoints-break-on-last-line-of-script-on-reload.html doc_closures.html - doc_closure-optimized-out.html doc_cmd-break.html doc_cmd-dbg.html doc_conditional-breakpoints.html @@ -162,7 +161,6 @@ skip-if = true # Bug 933950 (leaky test) [browser_dbg_navigation.js] [browser_dbg_no-page-sources.js] [browser_dbg_on-pause-highlight.js] -[browser_dbg_optimized-out-vars.js] [browser_dbg_panel-size.js] [browser_dbg_parser-01.js] [browser_dbg_parser-02.js] diff --git a/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js b/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js deleted file mode 100644 index e30f0334f13a..000000000000 --- a/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js +++ /dev/null @@ -1,48 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that optimized out variables aren't present in the variables view. - -function test() { - Task.spawn(function* () { - const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html"; - let panel, debuggee, gDebugger, sources; - - let [, debuggee, panel] = yield initDebugger(TAB_URL); - gDebugger = panel.panelWin; - sources = gDebugger.DebuggerView.Sources; - - yield waitForSourceShown(panel, ".html"); - yield panel.addBreakpoint({ url: sources.values[0], line: 18 }); - yield ensureThreadClientState(panel, "resumed"); - - // Spin the event loop before causing the debuggee to pause, to allow - // this function to return first. - executeSoon(() => { - EventUtils.sendMouseEvent({ type: "click" }, - debuggee.document.querySelector("button"), - debuggee); - }); - - yield waitForDebuggerEvents(panel, gDebugger.EVENTS.FETCHED_SCOPES); - let gVars = gDebugger.DebuggerView.Variables; - let outerScope = gVars.getScopeAtIndex(1); - outerScope.expand(); - - let outerNodes = outerScope.target.querySelector(".variables-view-element-details").childNodes; - is(outerNodes.length, 1, "Should only have one variable in scope."); - - let upvarVar = outerScope.get("upvar"); - ok(!upvarVar, "upvar was optimized out."); - - let argVar = outerScope.get("arg"); - is(argVar.target.querySelector(".name").getAttribute("value"), "arg", - "Should have the right property name for |arg|."); - is(argVar.target.querySelector(".value").getAttribute("value"), 42, - "Should have the right property value for |arg|."); - - yield resumeDebuggerThenCloseAndFinish(panel); - }).then(null, aError => { - ok(false, "Got an error: " + aError.message + "\n" + aError.stack); - }); -} diff --git a/browser/devtools/debugger/test/doc_closure-optimized-out.html b/browser/devtools/debugger/test/doc_closure-optimized-out.html deleted file mode 100644 index 3ad4e8fc0a07..000000000000 --- a/browser/devtools/debugger/test/doc_closure-optimized-out.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Debugger Test for Inspecting Optimized-Out Variables - - - - - - - - From 246bc581eedf2ecf4daf7c7cd487ea74477ce9ad Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Thu, 8 May 2014 16:24:23 -0400 Subject: [PATCH 28/32] Bug 1007836 - Send 'tablet' flag with TelemetryPing info r=rnewman --- toolkit/components/telemetry/TelemetryPing.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/telemetry/TelemetryPing.jsm b/toolkit/components/telemetry/TelemetryPing.jsm index 9a3edf74b130..ce0fb109fa20 100644 --- a/toolkit/components/telemetry/TelemetryPing.jsm +++ b/toolkit/components/telemetry/TelemetryPing.jsm @@ -471,7 +471,7 @@ let Impl = { // sysinfo fields are not always available, get what we can. let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); let fields = ["cpucount", "memsize", "arch", "version", "kernel_version", - "device", "manufacturer", "hardware", + "device", "manufacturer", "hardware", "tablet", "hasMMX", "hasSSE", "hasSSE2", "hasSSE3", "hasSSSE3", "hasSSE4A", "hasSSE4_1", "hasSSE4_2", "hasEDSP", "hasARMv6", "hasARMv7", "hasNEON", "isWow64", From d779ecd8840a7cf904e2e186302db18042edf983 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:20:45 -0700 Subject: [PATCH 29/32] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/fbf868517b30 Author: James Burke Desc: Merge pull request #19075 from jrburke/bug1007845-email-calendar-en-whitespace Bug 1007845 - Fix whitespace removals from en-US locale files r=asuth,gaye ======== https://hg.mozilla.org/integration/gaia-central/rev/1dd027af203e Author: jrburke Desc: Bug 1007845 - Fix whitespace removals from en-US locale files from bug 940512 and bug 940132 ======== https://hg.mozilla.org/integration/gaia-central/rev/edb3144bb169 Author: Kevin Grandon Desc: Merge pull request #19061 from crdlc/bug-1007147 Bug 1007147 - Fit visual details to icon's label ======== https://hg.mozilla.org/integration/gaia-central/rev/fa0b1d16f8c4 Author: crdlc Desc: Bug 1007147 - Fit visual details to icons label --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 3a9c46c73ea6..7c0e0cdaa921 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "9d42b77320ede120cb394f12f3e94567500e930c", + "revision": "fbf868517b3026b39be4afac45883ddf76f6bc9d", "repo_path": "/integration/gaia-central" } From edf1c29057b2ddfc22189d7e04e1acbe58dec8e5 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Thu, 8 May 2014 14:22:57 -0700 Subject: [PATCH 30/32] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c905ea4530b9..7d1c59b5cd8b 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index c8d76fa15835..ec1af4719ce5 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a2da43dd2efe..7be06186f855 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index c905ea4530b9..7d1c59b5cd8b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 95a94c9aef4e..5db7c8ea9166 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 6ff1185e1008..a808a2b5e1d4 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 4daf3a2b0109..0f815aa9d026 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 2797e3c218f6..034cb3c2da6c 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 253ef4285956..26323158cd86 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 93e43de38597..ff7e25ceb529 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 4a0f999dcd3c..18023e446f64 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 54f2dadcee1561e261c03dbdf960b5e369bf9066 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Thu, 8 May 2014 16:06:40 -0700 Subject: [PATCH 31/32] Backed out changeset 21d743a319c6 (bug 967475) for apparently introducing two hazards to the build --- b2g/components/AlertsHelper.jsm | 13 +- b2g/components/AlertsService.js | 8 +- b2g/installer/package-manifest.in | 2 - browser/installer/package-manifest.in | 2 - dom/bindings/BindingUtils.cpp | 9 - .../notification/nsINotificationStorage.idl | 9 +- dom/src/notification/ChromeNotifications.js | 113 ------------ .../notification/ChromeNotifications.manifest | 3 - dom/src/notification/Notification.cpp | 53 +++--- dom/src/notification/Notification.h | 7 +- dom/src/notification/NotificationDB.jsm | 82 +-------- dom/src/notification/NotificationStorage.js | 6 +- dom/src/notification/moz.build | 2 - .../test/unit/test_notificationdb.js | 113 ------------ .../mochitest/notification/MockServices.js | 54 ++---- .../mochitest/notification/mochitest.ini | 1 - .../notification/test_bug931307.html | 4 +- .../test_notification_basics.html | 2 +- .../test_notification_resend.html | 170 ------------------ .../test_notification_storage.html | 6 +- dom/webidl/ChromeNotifications.webidl | 14 -- dom/webidl/moz.build | 1 - mobile/android/installer/package-manifest.in | 2 - 23 files changed, 62 insertions(+), 614 deletions(-) delete mode 100644 dom/src/notification/ChromeNotifications.js delete mode 100644 dom/src/notification/ChromeNotifications.manifest delete mode 100644 dom/tests/mochitest/notification/test_notification_resend.html delete mode 100644 dom/webidl/ChromeNotifications.webidl diff --git a/b2g/components/AlertsHelper.jsm b/b2g/components/AlertsHelper.jsm index 0089f381eca1..9260c1066af9 100644 --- a/b2g/components/AlertsHelper.jsm +++ b/b2g/components/AlertsHelper.jsm @@ -144,8 +144,7 @@ let AlertsHelper = { lang: listener.lang, dir: listener.dir, id: listener.id, - tag: listener.tag, - timestamp: listener.timestamp + tag: listener.tag }, Services.io.newURI(listener.target, null, null), Services.io.newURI(listener.manifestURL, null, null) @@ -195,7 +194,7 @@ let AlertsHelper = { }, showNotification: function(imageURL, title, text, textClickable, cookie, - uid, bidi, lang, manifestURL, timestamp) { + uid, bidi, lang, manifestURL) { function send(appName, appIcon) { SystemAppProxy._sendCustomEvent(kMozChromeNotificationEvent, { type: kDesktopNotification, @@ -207,8 +206,7 @@ let AlertsHelper = { lang: lang, appName: appName, appIcon: appIcon, - manifestURL: manifestURL, - timestamp: timestamp + manifestURL: manifestURL }); } @@ -250,13 +248,12 @@ let AlertsHelper = { lang: details.lang || undefined, id: details.id || undefined, dir: details.dir || undefined, - tag: details.tag || undefined, - timestamp: details.timestamp || undefined + tag: details.tag || undefined }; this.registerAppListener(data.uid, listener); this.showNotification(data.imageURL, data.title, data.text, details.textClickable, null, data.uid, details.dir, - details.lang, details.manifestURL, details.timestamp); + details.lang, details.manifestURL); }, closeAlert: function(name) { diff --git a/b2g/components/AlertsService.js b/b2g/components/AlertsService.js index b7b2f1a8cd7e..96be4593039f 100644 --- a/b2g/components/AlertsService.js +++ b/b2g/components/AlertsService.js @@ -43,7 +43,6 @@ const kMessageAlertNotificationSend = "alert-notification-send"; const kMessageAlertNotificationClose = "alert-notification-close"; const kTopicAlertFinished = "alertfinished"; -const kTopicAlertClickCallback = "alertclickcallback"; function AlertsService() { Services.obs.addObserver(this, "xpcom-shutdown", false); @@ -104,8 +103,7 @@ AlertsService.prototype = { id: aDetails.id || undefined, dbId: aDetails.dbId || undefined, dir: aDetails.dir || undefined, - tag: aDetails.tag || undefined, - timestamp: aDetails.timestamp || undefined + tag: aDetails.tag || undefined }; cpmm.sendAsyncMessage(kMessageAppNotificationSend, { @@ -137,7 +135,6 @@ AlertsService.prototype = { // the notification so the app get a change to react. if (data.target) { gSystemMessenger.sendMessage(kNotificationSystemMessageName, { - clicked: (topic === kTopicAlertClickCallback), title: listener.title, body: listener.text, imageURL: listener.imageURL, @@ -145,8 +142,7 @@ AlertsService.prototype = { dir: listener.dir, id: listener.id, tag: listener.tag, - dbId: listener.dbId, - timestamp: listener.timestamp + dbId: listener.dbId }, Services.io.newURI(data.target, null, null), Services.io.newURI(listener.manifestURL, null, null) diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index 8a26fc7e293a..cc6d99a78af7 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -336,8 +336,6 @@ @BINPATH@/components/zipwriter.xpt ; JavaScript components -@BINPATH@/components/ChromeNotifications.js -@BINPATH@/components/ChromeNotifications.manifest @BINPATH@/components/ConsoleAPI.manifest @BINPATH@/components/ConsoleAPIStorage.js @BINPATH@/components/BrowserElementParent.manifest diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index baa9f3b329ed..8b380fb04de3 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -344,8 +344,6 @@ @BINPATH@/components/telemetry.xpt ; JavaScript components -@BINPATH@/components/ChromeNotifications.js -@BINPATH@/components/ChromeNotifications.manifest @BINPATH@/components/ConsoleAPI.manifest @BINPATH@/components/ConsoleAPIStorage.js @BINPATH@/components/BrowserElementParent.manifest diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 6d0e48803c0c..572099a0d8bf 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -14,7 +14,6 @@ #include "mozilla/DebugOnly.h" #include "mozilla/FloatingPoint.h" #include "mozilla/Assertions.h" -#include "mozilla/Preferences.h" #include "AccessCheck.h" #include "jsfriendapi.h" @@ -2156,10 +2155,6 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle v, bool IsInPrivilegedApp(JSContext* aCx, JSObject* aObj) { - if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) { - return true; - } - using mozilla::dom::workers::GetWorkerPrivateFromContext; if (!NS_IsMainThread()) { return GetWorkerPrivateFromContext(aCx)->IsInPrivilegedApp(); @@ -2174,10 +2169,6 @@ IsInPrivilegedApp(JSContext* aCx, JSObject* aObj) bool IsInCertifiedApp(JSContext* aCx, JSObject* aObj) { - if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) { - return true; - } - using mozilla::dom::workers::GetWorkerPrivateFromContext; if (!NS_IsMainThread()) { return GetWorkerPrivateFromContext(aCx)->IsInCertifiedApp(); diff --git a/dom/interfaces/notification/nsINotificationStorage.idl b/dom/interfaces/notification/nsINotificationStorage.idl index da3b89212e1c..a046989222d4 100644 --- a/dom/interfaces/notification/nsINotificationStorage.idl +++ b/dom/interfaces/notification/nsINotificationStorage.idl @@ -39,7 +39,7 @@ interface nsINotificationStorageCallback : nsISupports /** * Interface for notification persistence layer. */ -[scriptable, uuid(cc4656d7-2a2a-47f1-8016-55891e833d64)] +[scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)] interface nsINotificationStorage : nsISupports { @@ -55,10 +55,6 @@ interface nsINotificationStorage : nsISupports * @param body: the notification body * @param tag: notification tag, will replace any existing * notifications with same origin/tag pair - * @param alertName: the alert identifier as used by system app. - * Stored in the database to avoid re-computing - * it. Built from origin and tag or id depending - * whether there is a tag defined. */ void put(in DOMString origin, in DOMString id, @@ -67,8 +63,7 @@ interface nsINotificationStorage : nsISupports in DOMString lang, in DOMString body, in DOMString tag, - in DOMString icon, - in DOMString alertName); + in DOMString icon); /** * Retrieve a list of notifications. diff --git a/dom/src/notification/ChromeNotifications.js b/dom/src/notification/ChromeNotifications.js deleted file mode 100644 index 11e0af818e32..000000000000 --- a/dom/src/notification/ChromeNotifications.js +++ /dev/null @@ -1,113 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const DEBUG = false; - -function debug(s) { - dump("-*- ChromeNotifications.js: " + s + "\n"); -} - -const Ci = Components.interfaces; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Services", - "resource://gre/modules/Services.jsm"); - -XPCOMUtils.defineLazyServiceGetter(this, "cpmm", - "@mozilla.org/childprocessmessagemanager;1", - "nsIMessageSender"); - -XPCOMUtils.defineLazyServiceGetter(this, "appNotifier", - "@mozilla.org/system-alerts-service;1", - "nsIAppNotificationService"); - -const CHROMENOTIFICATIONS_CID = "{74f94093-8b37-497e-824f-c3b250a911da}"; -const CHROMENOTIFICATIONS_CONTRACTID = "@mozilla.org/mozChromeNotifications;1"; - -function ChromeNotifications() { - this.innerWindowID = null; - this.resendCallback = null; -} - -ChromeNotifications.prototype = { - - init: function(aWindow) { - let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - this.innerWindowID = util.currentInnerWindowID; - Services.obs.addObserver(this, "inner-window-destroyed", false); - cpmm.addMessageListener("Notification:GetAllCrossOrigin:Return:OK", this); - }, - - performResend: function(notifications) { - let resentNotifications = 0; - - notifications.forEach(function(notification) { - appNotifier.showAppNotification( - notification.icon, - notification.title, - notification.body, - null, - { - manifestURL: notification.origin, - id: notification.alertName, - dir: notification.dir, - lang: notification.lang, - tag: notification.tag, - dbId: notification.id, - timestamp: notification.timestamp - } - ); - resentNotifications++; - }); - - try { - this.resendCallback && this.resendCallback(resentNotifications); - } catch (ex) { - if (DEBUG) debug("Content sent exception: " + ex); - } - }, - - mozResendAllNotifications: function(resendCallback) { - this.resendCallback = resendCallback; - cpmm.sendAsyncMessage("Notification:GetAllCrossOrigin", {}); - }, - - receiveMessage: function(message) { - switch (message.name) { - case "Notification:GetAllCrossOrigin:Return:OK": - this.performResend(message.data.notifications); - break; - - default: - if (DEBUG) { debug("Unrecognized message: " + message.name); } - break; - } - }, - - observe: function(aSubject, aTopic, aData) { - if (DEBUG) debug("Topic: " + aTopic); - if (aTopic == "inner-window-destroyed") { - let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data; - if (wId != this.innerWindowID) { - return; - } - Services.obs.removeObserver(this, "inner-window-destroyed"); - cpmm.removeMessageListener("Notification:GetAllCrossOrigin:Return:OK", this); - } - }, - - classID : Components.ID(CHROMENOTIFICATIONS_CID), - contractID : CHROMENOTIFICATIONS_CONTRACTID, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIChromeNotifications, - Ci.nsIDOMGlobalPropertyInitializer, - Ci.nsIObserver, - Ci.nsIMessageListener]), -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeNotifications]); diff --git a/dom/src/notification/ChromeNotifications.manifest b/dom/src/notification/ChromeNotifications.manifest deleted file mode 100644 index 74e93107ffd7..000000000000 --- a/dom/src/notification/ChromeNotifications.manifest +++ /dev/null @@ -1,3 +0,0 @@ -# ChromeNotifications.js -component {74f94093-8b37-497e-824f-c3b250a911da} ChromeNotifications.js -contract @mozilla.org/mozChromeNotifications;1 {74f94093-8b37-497e-824f-c3b250a911da} diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 157203bf870c..047699c48849 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -423,22 +423,6 @@ Notification::Notification(const nsAString& aID, const nsAString& aTitle, const mID(aID), mTitle(aTitle), mBody(aBody), mDir(aDir), mLang(aLang), mTag(aTag), mIconUrl(aIconUrl), mIsClosed(false) { - nsAutoString alertName; - DebugOnly rv = GetOrigin(GetOwner(), alertName); - MOZ_ASSERT(NS_SUCCEEDED(rv), "GetOrigin should not have failed"); - - // Get the notification name that is unique per origin + tag/ID. - // The name of the alert is of the form origin#tag/ID. - alertName.AppendLiteral("#"); - if (!mTag.IsEmpty()) { - alertName.Append(NS_LITERAL_STRING("tag:")); - alertName.Append(mTag); - } else { - alertName.Append(NS_LITERAL_STRING("notag:")); - alertName.Append(mID); - } - - mAlertName = alertName; } // static @@ -478,10 +462,6 @@ Notification::Constructor(const GlobalObject& aGlobal, nsString id; notification->GetID(id); - - nsString alertName; - notification->GetAlertName(alertName); - aRv = notificationStorage->Put(origin, id, aTitle, @@ -489,8 +469,7 @@ Notification::Constructor(const GlobalObject& aGlobal, aOptions.mLang, aOptions.mBody, aOptions.mTag, - aOptions.mIcon, - alertName); + aOptions.mIcon); if (aRv.Failed()) { return nullptr; } @@ -578,6 +557,10 @@ Notification::ShowInternal() nsCOMPtr observer = new NotificationObserver(this); + nsString alertName; + rv = GetAlertName(alertName); + NS_ENSURE_SUCCESS_VOID(rv); + #ifdef MOZ_B2G nsCOMPtr appNotifier = do_GetService("@mozilla.org/system-alerts-service;1"); @@ -595,7 +578,7 @@ Notification::ShowInternal() AppNotificationServiceOptions ops; ops.mTextClickable = true; ops.mManifestURL = manifestUrl; - ops.mId = mAlertName; + ops.mId = alertName; ops.mDbId = mID; ops.mDir = DirectionToString(mDir); ops.mLang = mLang; @@ -619,7 +602,7 @@ Notification::ShowInternal() nsString uniqueCookie = NS_LITERAL_STRING("notification:"); uniqueCookie.AppendInt(sCount++); alertService->ShowAlertNotification(absoluteUrl, mTitle, mBody, true, - uniqueCookie, observer, mAlertName, + uniqueCookie, observer, alertName, DirectionToString(mDir), mLang, GetPrincipal()); } @@ -788,8 +771,10 @@ Notification::CloseInternal() nsCOMPtr alertService = do_GetService(NS_ALERTSERVICE_CONTRACTID); if (alertService) { + nsString alertName; + rv = GetAlertName(alertName); if (NS_SUCCEEDED(rv)) { - alertService->CloseAlert(mAlertName, GetPrincipal()); + alertService->CloseAlert(alertName, GetPrincipal()); } } } @@ -827,6 +812,24 @@ Notification::GetOrigin(nsPIDOMWindow* aWindow, nsString& aOrigin) return NS_OK; } +nsresult +Notification::GetAlertName(nsString& aAlertName) +{ + // Get the notification name that is unique per origin + tag/ID. + // The name of the alert is of the form origin#tag/ID. + nsresult rv = GetOrigin(GetOwner(), aAlertName); + NS_ENSURE_SUCCESS(rv, rv); + aAlertName.AppendLiteral("#"); + if (!mTag.IsEmpty()) { + aAlertName.Append(NS_LITERAL_STRING("tag:")); + aAlertName.Append(mTag); + } else { + aAlertName.Append(NS_LITERAL_STRING("notag:")); + aAlertName.Append(mID); + } + return NS_OK; +} + } // namespace dom } // namespace mozilla diff --git a/dom/src/notification/Notification.h b/dom/src/notification/Notification.h index ae83174b7d4f..cd5de4d69d9f 100644 --- a/dom/src/notification/Notification.h +++ b/dom/src/notification/Notification.h @@ -133,10 +133,7 @@ protected: static nsresult GetOrigin(nsPIDOMWindow* aWindow, nsString& aOrigin); - void GetAlertName(nsAString& aRetval) - { - aRetval = mAlertName; - } + nsresult GetAlertName(nsString& aAlertName); nsString mID; nsString mTitle; @@ -146,8 +143,6 @@ protected: nsString mTag; nsString mIconUrl; - nsString mAlertName; - bool mIsClosed; static uint32_t sCount; diff --git a/dom/src/notification/NotificationDB.jsm b/dom/src/notification/NotificationDB.jsm index 5a53dbe6d28a..f082176f51da 100644 --- a/dom/src/notification/NotificationDB.jsm +++ b/dom/src/notification/NotificationDB.jsm @@ -16,9 +16,6 @@ const Ci = Components.interfaces; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Services", - "resource://gre/modules/Services.jsm"); - XPCOMUtils.defineLazyServiceGetter(this, "ppmm", "@mozilla.org/parentprocessmessagemanager;1", "nsIMessageListenerManager"); @@ -36,23 +33,8 @@ const NOTIFICATION_STORE_DIR = OS.Constants.Path.profileDir; const NOTIFICATION_STORE_PATH = OS.Path.join(NOTIFICATION_STORE_DIR, "notificationstore.json"); -const kMessages = [ - "Notification:Save", - "Notification:Delete", - "Notification:GetAll", - "Notification:GetAllCrossOrigin" -]; - let NotificationDB = { - - // Ensure we won't call init() while xpcom-shutdown is performed - _shutdownInProgress: false, - init: function() { - if (this._shutdownInProgress) { - return; - } - this.notifications = {}; this.byTag = {}; this.loaded = false; @@ -60,29 +42,9 @@ let NotificationDB = { this.tasks = []; // read/write operation queue this.runningTask = false; - Services.obs.addObserver(this, "xpcom-shutdown", false); - this.registerListeners(); - }, - - registerListeners: function() { - for (let message of kMessages) { - ppmm.addMessageListener(message, this); - } - }, - - unregisterListeners: function() { - for (let message of kMessages) { - ppmm.removeMessageListener(message, this); - } - }, - - observe: function(aSubject, aTopic, aData) { - if (DEBUG) debug("Topic: " + aTopic); - if (aTopic == "xpcom-shutdown") { - this._shutdownInProgress = true; - Services.obs.removeObserver(this, "xpcom-shutdown"); - this.unregisterListeners(); - } + ppmm.addMessageListener("Notification:Save", this); + ppmm.addMessageListener("Notification:Delete", this); + ppmm.addMessageListener("Notification:GetAll", this); }, // Attempt to read notification file, if it's not there we will create it. @@ -198,15 +160,6 @@ let NotificationDB = { }); break; - case "Notification:GetAllCrossOrigin": - this.queueTask("getallaccrossorigin", message.data, - function(notifications) { - returnMessage("Notification:GetAllCrossOrigin:Return:OK", { - notifications: notifications - }); - }); - break; - case "Notification:Save": this.queueTask("save", message.data, function() { returnMessage("Notification:Save:Return:OK", { @@ -240,14 +193,14 @@ let NotificationDB = { // Only run immediately if we aren't currently running another task. if (!this.runningTask) { - if (DEBUG) { debug("Task queue was not running, starting now..."); } + if (DEBUG) { dump("Task queue was not running, starting now..."); } this.runNextTask(); } }, runNextTask: function() { if (this.tasks.length === 0) { - if (DEBUG) { debug("No more tasks to run, queue depleted"); } + if (DEBUG) { dump("No more tasks to run, queue depleted"); } this.runningTask = false; return; } @@ -270,10 +223,6 @@ let NotificationDB = { this.taskGetAll(task.data, wrappedCallback); break; - case "getallaccrossorigin": - this.taskGetAllCrossOrigin(wrappedCallback); - break; - case "save": this.taskSave(task.data, wrappedCallback); break; @@ -296,27 +245,6 @@ let NotificationDB = { callback(notifications); }, - taskGetAllCrossOrigin: function(callback) { - if (DEBUG) { debug("Task, getting all whatever origin"); } - var notifications = []; - for (var origin in this.notifications) { - for (var i in this.notifications[origin]) { - var notification = this.notifications[origin][i]; - - // Notifications without the alertName field cannot be resent by - // mozResendAllNotifications, so we just skip them. They will - // still be available to applications via Notification.get() - if (!('alertName' in notification)) { - continue; - } - - notification.origin = origin; - notifications.push(notification); - } - } - callback(notifications); - }, - taskSave: function(data, callback) { if (DEBUG) { debug("Task, saving"); } var origin = data.origin; diff --git a/dom/src/notification/NotificationStorage.js b/dom/src/notification/NotificationStorage.js index a241a52158b2..b8b86ea28113 100644 --- a/dom/src/notification/NotificationStorage.js +++ b/dom/src/notification/NotificationStorage.js @@ -36,7 +36,7 @@ function NotificationStorage() { NotificationStorage.prototype = { - put: function(origin, id, title, dir, lang, body, tag, icon, alertName) { + put: function(origin, id, title, dir, lang, body, tag, icon) { if (DEBUG) { debug("PUT: " + id + ": " + title); } var notification = { id: id, @@ -45,9 +45,7 @@ NotificationStorage.prototype = { lang: lang, body: body, tag: tag, - icon: icon, - alertName: alertName, - timestamp: new Date().getTime() + icon: icon }; this._notifications[id] = notification; diff --git a/dom/src/notification/moz.build b/dom/src/notification/moz.build index 45c29b89ee31..552eb3af0c97 100644 --- a/dom/src/notification/moz.build +++ b/dom/src/notification/moz.build @@ -5,8 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_COMPONENTS += [ - 'ChromeNotifications.js', - 'ChromeNotifications.manifest', 'NotificationStorage.js', 'NotificationStorage.manifest', ] diff --git a/dom/src/notification/test/unit/test_notificationdb.js b/dom/src/notification/test/unit/test_notificationdb.js index 171324a174ca..b274b48606bc 100644 --- a/dom/src/notification/test/unit/test_notificationdb.js +++ b/dom/src/notification/test/unit/test_notificationdb.js @@ -336,116 +336,3 @@ add_test(function test_send_two_get_two() { requestID: (requestID + 1) // 21 }); }); - -// Cleanup previous notification -add_test(function test_delete_previous() { - let requestID = 25; - let msgReply = "Notification:Delete:Return:OK"; - let msgHandler = function(message) { - do_check_eq(requestID, message.data.requestID); - }; - - addAndSend("Notification:Delete", msgReply, msgHandler, { - origin: systemNotification.origin, - id: "{8ef9a628-f0f4-44b4-820d-c117573c33e3}", - requestID: requestID - }); -}); - -// Store two notifications, one without alertName and one with -add_test(function test_send_two_alertName() { - let requestID = 30; - let notifications = [ - { - origin: "app://system.gaiamobile.org/manifest.webapp", - id: "{27ead857-4f43-457f-a770-93b82fbfc223}", - title: "Notification title", - dir: "auto", - lang: "", - body: "Notification body", - tag: "", - icon: "icon.png", - timestamp: new Date().getTime() - }, { - origin: "app://system.gaiamobile.org/manifest.webapp", - id: "{40275e04-58d0-47be-8cc7-540578f793a4}", - title: "Notification title", - dir: "auto", - lang: "", - body: "Notification body", - tag: "", - icon: "icon.png", - alertName: "alertName", - timestamp: new Date().getTime() - } - ]; - let origin = notifications[0].origin; - - let msgGetCrossOriginReply = "Notification:GetAllCrossOrigin:Return:OK"; - let msgGetCrossOriginHandler = { - receiveMessage: function(message) { - if (message.name === msgGetCrossOriginReply) { - cpmm.removeMessageListener( - msgGetCrossOriginReply, msgGetCrossOriginHandler); - - let gotNotifications = message.data.notifications; - - // we expect to have one notification - do_check_eq(1, gotNotifications.length); - - // compare the only notification we should have got back - compareNotification(gotNotifications[0], notifications[1]); - - run_next_test(); - } - } - }; - cpmm.addMessageListener(msgGetCrossOriginReply, msgGetCrossOriginHandler); - - let msgGetReply = "Notification:GetAll:Return:OK"; - let msgGetHandler = { - receiveMessage: function(message) { - if (message.name === msgGetReply) { - cpmm.removeMessageListener(msgGetReply, msgGetHandler); - - let gotNotifications = message.data.notifications; - - // we expect to have two notifications - do_check_eq(2, gotNotifications.length); - - // compare each notification - for (let i = 0; i < gotNotifications.length; i++) { - compareNotification(gotNotifications[i], notifications[i]); - } - - run_next_test(); - } - } - }; - cpmm.addMessageListener(msgGetReply, msgGetHandler); - - let msgSaveReply = "Notification:Save:Return:OK"; - let msgSaveCalls = 0; - let msgSaveHandler = { - receiveMessage: function(message) { - if (message.name === msgSaveReply) { - msgSaveCalls++; - if (msgSaveCalls === 2) { - cpmm.removeMessageListener(msgSaveReply, msgSaveHandler); - // Trigger getall - cpmm.sendAsyncMessage("Notification:GetAll", { - origin: origin - }); - } - } - } - }; - cpmm.addMessageListener(msgSaveReply, msgSaveHandler); - - notifications.forEach(function(n) { - cpmm.sendAsyncMessage("Notification:Save", { - origin: origin, - notification: n - }); - }); -}); diff --git a/dom/tests/mochitest/notification/MockServices.js b/dom/tests/mochitest/notification/MockServices.js index 28c5f7750ae2..164cc7e9a91f 100644 --- a/dom/tests/mochitest/notification/MockServices.js +++ b/dom/tests/mochitest/notification/MockServices.js @@ -12,66 +12,41 @@ var MockServices = (function () { var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager .QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar); - var activeAlertNotifications = Object.create(null); - - var activeAppNotifications = Object.create(null); + var activeNotifications = Object.create(null); var mockAlertsService = { showAlertNotification: function(imageUrl, title, text, textClickable, cookie, alertListener, name) { var listener = SpecialPowers.wrap(alertListener); - activeAlertNotifications[name] = { + activeNotifications[name] = { listener: listener, cookie: cookie }; // fake async alert show event - if (listener) { - setTimeout(function () { - listener.observe(null, "alertshow", cookie); - }, 100); - } + setTimeout(function () { + listener.observe(null, "alertshow", cookie); + }, 100); // ?? SpecialPowers.wrap(alertListener).observe(null, "alertclickcallback", cookie); }, - showAppNotification: function(aImageUrl, aTitle, aText, aAlertListener, aDetails) { - var listener = aAlertListener || (activeAlertNotifications[aDetails.id] ? activeAlertNotifications[aDetails.id].listener : undefined); - activeAppNotifications[aDetails.id] = { - observer: listener, - title: aTitle, - text: aText, - manifestURL: aDetails.manifestURL, - imageURL: aImageUrl, - lang: aDetails.lang || undefined, - id: aDetails.id || undefined, - dbId: aDetails.dbId || undefined, - dir: aDetails.dir || undefined, - tag: aDetails.tag || undefined, - timestamp: aDetails.timestamp || undefined - }; - this.showAlertNotification(aImageUrl, aTitle, aText, true, "", listener, aDetails.id); + showAppNotification: function(imageUrl, title, text, textClickable, + manifestURL, alertListener, name) { + this.showAlertNotification(imageUrl, title, text, textClickable, "", alertListener, name); }, closeAlert: function(name) { - var alertNotification = activeAlertNotifications[name]; - if (alertNotification) { - if (alertNotification.listener) { - alertNotification.listener.observe(null, "alertfinished", alertNotification.cookie); - } - delete activeAlertNotifications[name]; - } - - var appNotification = activeAppNotifications[name]; - if (appNotification) { - delete activeAppNotifications[name]; + var notification = activeNotifications[name]; + if (notification) { + notification.listener.observe(null, "alertfinished", notification.cookie); + delete activeNotifications[name]; } }, QueryInterface: function(aIID) { if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) || - SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService) || - SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAppNotificationService)) { + SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) { return this; } throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE; @@ -102,8 +77,5 @@ var MockServices = (function () { registrar.unregisterFactory(MOCK_ALERTS_CID, mockAlertsService); registrar.unregisterFactory(MOCK_SYSTEM_ALERTS_CID, mockAlertsService); }, - - activeAlertNotifications: activeAlertNotifications, - activeAppNotifications: activeAppNotifications, }; })(); diff --git a/dom/tests/mochitest/notification/mochitest.ini b/dom/tests/mochitest/notification/mochitest.ini index 89d4e45169c3..ac54da835798 100644 --- a/dom/tests/mochitest/notification/mochitest.ini +++ b/dom/tests/mochitest/notification/mochitest.ini @@ -9,4 +9,3 @@ support-files = skip-if = (toolkit == 'gonk' && debug) #debug-only timeout [test_bug931307.html] skip-if = (toolkit == 'gonk' && debug) #debug-only timeout -[test_notification_resend.html] diff --git a/dom/tests/mochitest/notification/test_bug931307.html b/dom/tests/mochitest/notification/test_bug931307.html index 03030114fa7d..9477b1ea6210 100644 --- a/dom/tests/mochitest/notification/test_bug931307.html +++ b/dom/tests/mochitest/notification/test_bug931307.html @@ -13,17 +13,15 @@