From 36f7184c2703ef773937290d6a4a670aac354231 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 01:07:30 -0700 Subject: [PATCH 01/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index cdb0d05b10e..11ae710b42b 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a1578fd8057..a552a5fa720 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -20,7 +20,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index a6ed0c2d65b..807632273a1 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 62c6e52f559..8f06e94fd77 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index a1578fd8057..a552a5fa720 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -20,7 +20,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b88fef48a4c..1ac64eb533a 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index c54a0fefbb6..dadf541e999 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 cb720acafca..71296e4fedb 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 5ef8f9b4670..6fbb9019438 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -16,7 +16,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 31869b9766a..58db6d5ce75 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 34b5b4c036b..a51b7e97a66 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -18,7 +18,7 @@ - + From a2040a2c92edc62e3c56819ab50b30f1ca4ec648 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 01:25:47 -0700 Subject: [PATCH 02/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/db069a8ba1b2 Author: Julien Wajsberg Desc: Merge pull request #25295 from julienw/1016731-fix-page-test Bug 1016731 - Intermittent page_test.js | page.js > page > appendIcon > ... ======== https://hg.mozilla.org/integration/gaia-central/rev/f63d4255bcc6 Author: Julien Wajsberg Desc: Bug 1016731 - Intermittent page_test.js | page.js > page > appendIcon > "after all" hook | TypeError: GridManager is null r=crdlc --- 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 6744f75759e..fef2f1a2f81 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "f486771c1a2a76bfea1a5c7eac8debe14f29927b", + "revision": "db069a8ba1b27bb22af0f119ae340b32f61edeae", "repo_path": "/integration/gaia-central" } From 105ddace2f37a23093aea82cc7feb0b677983f91 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 01:31:57 -0700 Subject: [PATCH 03/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 11ae710b42b..04c41294457 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a552a5fa720..442e5de7811 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 807632273a1..4ef0dbdcfa5 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 8f06e94fd77..cb5d2e92852 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 a552a5fa720..442e5de7811 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 1ac64eb533a..ae9269cc0ce 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index dadf541e999..117ba142dcc 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 71296e4fedb..71d54d30bdb 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 6fbb9019438..2033bb4c410 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 58db6d5ce75..e25c287940b 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a51b7e97a66..cac02fddba1 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f248e2c7230eba410b64d876e19dec87be11329e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 01:55:49 -0700 Subject: [PATCH 04/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c4d3584c0e95 Author: Alive.Kuo Desc: Merge pull request #25118 from alivedise/bugzilla/1076327_master_final/ignore-screenchange-when-lockscreen-is-not-ready Bug 1076327 - Ignore screenchange event if lockscreen is not ready, r=gweng ======== https://hg.mozilla.org/integration/gaia-central/rev/fd03d134a6d1 Author: Alive Kuo Desc: Bug 1076327 - Ignore screenchange event if lockscreen is not ready --- 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 fef2f1a2f81..02017d43ee1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "db069a8ba1b27bb22af0f119ae340b32f61edeae", + "revision": "c4d3584c0e9555532391e3ae3a87e708b08d3cf8", "repo_path": "/integration/gaia-central" } From d24bf6d445448beb1822ffc173b9091baabdfd4f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 02:01:59 -0700 Subject: [PATCH 05/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 04c41294457..fe8d1b3ee87 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 442e5de7811..63d7567f5bb 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 4ef0dbdcfa5..2501c0a2680 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 cb5d2e92852..a007593c81c 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 442e5de7811..63d7567f5bb 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index ae9269cc0ce..28bf59b6dea 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 117ba142dcc..739ea3ed408 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 71d54d30bdb..089a1e34eb7 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 2033bb4c410..d7c74b6a5c5 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index e25c287940b..86a6b857c1a 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index cac02fddba1..b2e76790775 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From c488f0a093ebfcafcbab6c682f21f517062348e3 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Sat, 18 Oct 2014 05:58:00 +0200 Subject: [PATCH 06/46] Bug 1084955 - Remove redeclaration of Cu. r=fabrice The Cu const is already defined by settings.js when adb.js is included by shell.html. We should not redefine it. --HG-- extra : rebase_source : 1063bfb6eea004fbc68655360dc1684ddfb91c71 --- b2g/chrome/content/devtools/adb.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/b2g/chrome/content/devtools/adb.js b/b2g/chrome/content/devtools/adb.js index f2b2f8f360f..d3b0bf0caa2 100644 --- a/b2g/chrome/content/devtools/adb.js +++ b/b2g/chrome/content/devtools/adb.js @@ -8,8 +8,6 @@ // This file is only loaded on Gonk to manage ADB state -const { utils: Cu } = Components; - const DEBUG = false; var debug = function(str) { dump("AdbController: " + str + "\n"); From 635f40dd4636d0fe670a92e2b6ed6b931fcdeb94 Mon Sep 17 00:00:00 2001 From: Jonathan Hao Date: Mon, 13 Oct 2014 11:30:26 +0800 Subject: [PATCH 07/46] Bug 1080464 - [RTSP] Live stream frames are not rendered. r=ettseng r=bechen --HG-- extra : rebase_source : aac290fc9cc887bd1a7a641b894a445ef4098c67 --- content/media/MediaDecoderStateMachine.cpp | 3 ++- netwerk/protocol/rtsp/rtsp/RTSPSource.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/content/media/MediaDecoderStateMachine.cpp b/content/media/MediaDecoderStateMachine.cpp index eda5925ce9a..acf9f29a94e 100644 --- a/content/media/MediaDecoderStateMachine.cpp +++ b/content/media/MediaDecoderStateMachine.cpp @@ -2707,7 +2707,8 @@ void MediaDecoderStateMachine::AdvanceFrame() // Filter out invalid frames by checking the frame time. FrameTime could be // zero if it's a initial frame. int64_t frameTime = currentFrame->mTime - mStartTime; - if (frameTime > 0 || (frameTime == 0 && mPlayDuration == 0)) { + if (frameTime > 0 || (frameTime == 0 && mPlayDuration == 0) || + mScheduler->IsRealTime()) { ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); // If we have video, we want to increment the clock in steps of the frame // duration. diff --git a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp index 7a7b93eabd8..4eaaf17c90b 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp +++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp @@ -231,9 +231,10 @@ void RTSPSource::performPlay(int64_t playTimeUs) { int64_t duration = 0; getDuration(&duration); - MOZ_ASSERT(playTimeUs < duration, + MOZ_ASSERT(duration == 0 || playTimeUs < duration, "Should never receive an out of bounds play time!"); - if (playTimeUs >= duration) { + if (duration > 0 && playTimeUs >= duration) { + // if not a live stream and play time out of bounds return; } From ffc288b4c56aaeaf6b3b5cc00b789522b1fee937 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Wed, 8 Oct 2014 22:49:00 +0200 Subject: [PATCH 08/46] Bug 1079758 - Send logshake capture start event. r=gwagner --HG-- extra : rebase_source : a4503b9f96e31001aaa4388c1ca6ee5cfe477d18 --- b2g/components/LogShake.jsm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/b2g/components/LogShake.jsm b/b2g/components/LogShake.jsm index a1acffa50fd..c5d3ca5b25e 100644 --- a/b2g/components/LogShake.jsm +++ b/b2g/components/LogShake.jsm @@ -9,6 +9,8 @@ * 'capture-logs-success' event with detail.logFilenames representing each log * file's filename in the directory. If an error occurs it will instead produce * a 'capture-logs-error' event. + * We send a capture-logs-start events to notify the system app and the user, + * since dumping can be a bit long sometimes. */ /* enable Mozilla javascript extensions and global strictness declaration, @@ -54,6 +56,7 @@ function debug(msg) { const EXCITEMENT_THRESHOLD = 500; const DEVICE_MOTION_EVENT = 'devicemotion'; const SCREEN_CHANGE_EVENT = 'screenchange'; +const CAPTURE_LOGS_START_EVENT = 'capture-logs-start'; const CAPTURE_LOGS_ERROR_EVENT = 'capture-logs-error'; const CAPTURE_LOGS_SUCCESS_EVENT = 'capture-logs-success'; @@ -165,6 +168,7 @@ let LogShake = { if (excitement > EXCITEMENT_THRESHOLD) { if (!this.captureRequested) { this.captureRequested = true; + SystemAppProxy._sendCustomEvent(CAPTURE_LOGS_START_EVENT, {}); captureLogs().then(logResults => { // On resolution send the success event to the requester SystemAppProxy._sendCustomEvent(CAPTURE_LOGS_SUCCESS_EVENT, { From b857f53eeb0fcc97e4aa7a36a791dd3f57636fb6 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Wed, 8 Oct 2014 03:25:00 +0200 Subject: [PATCH 09/46] Bug 1067329 - Fix logshake directory computation. r=gwagner --HG-- extra : rebase_source : 3b1bcbe2ca9f6f38ebad792c19d0b943e4f67edf --- b2g/components/LogShake.jsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/components/LogShake.jsm b/b2g/components/LogShake.jsm index c5d3ca5b25e..654fcf187f2 100644 --- a/b2g/components/LogShake.jsm +++ b/b2g/components/LogShake.jsm @@ -222,7 +222,7 @@ function getLogDirectory() { d = new Date(d.getTime() - d.getTimezoneOffset() * 60000); let timestamp = d.toISOString().slice(0, -5).replace(/[:T]/g, '-'); // return directory name of format 'logs/timestamp/' - return OS.Path.join('logs', timestamp, ''); + return OS.Path.join('logs', timestamp); } /** @@ -285,7 +285,7 @@ function saveLogs(logArrays) { // The filename represents the relative path within the SD card, not the // absolute path because Gaia will refer to it using the DeviceStorage // API - let filename = dirName + getLogFilename(logLocation); + let filename = OS.Path.join(dirName, getLogFilename(logLocation)); logFilenames.push(filename); let saveRequest = OS.File.writeAtomic(OS.Path.join(sdcardPrefix, filename), logArray); saveRequests.push(saveRequest); From e353fdacc1f679c7f7d5299e8089f305597a8145 Mon Sep 17 00:00:00 2001 From: Henry Chang Date: Wed, 8 Oct 2014 15:18:35 +0800 Subject: [PATCH 10/46] Bug 1049460 - Change wpa_supplicant mux/demux method on KK to enable wifi direct. r=vchang --HG-- extra : rebase_source : 0633f2b2999d9aca03543463164b3de83b67f4f5 --- dom/wifi/DOMWifiP2pManager.js | 2 +- dom/wifi/WifiCommand.jsm | 7 +++++++ dom/wifi/WifiP2pManager.jsm | 28 +++++++++++++++++++--------- dom/wifi/WifiProxyService.cpp | 34 +++++++++++++++++++++++++++++++--- dom/wifi/WifiWorker.js | 6 +++++- 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/dom/wifi/DOMWifiP2pManager.js b/dom/wifi/DOMWifiP2pManager.js index 1d3214d6352..49c2fa4b83e 100644 --- a/dom/wifi/DOMWifiP2pManager.js +++ b/dom/wifi/DOMWifiP2pManager.js @@ -149,7 +149,7 @@ MozWifiP2pManager.prototype = { case "WifiP2pManager:getPeerList:Return:OK": request = this.takeRequest(msg.rid); - Services.DOMRequest.fireSuccess(request, msg.data); + Services.DOMRequest.fireSuccess(request, Cu.cloneInto(msg.data, this._window)); break; case "WifiP2pManager:getPeerList:Return:NO": diff --git a/dom/wifi/WifiCommand.jsm b/dom/wifi/WifiCommand.jsm index 35763de5036..93b0f1a1ec9 100644 --- a/dom/wifi/WifiCommand.jsm +++ b/dom/wifi/WifiCommand.jsm @@ -25,6 +25,13 @@ this.WifiCommand = function(aControlMessage, aInterface, aSdkVersion) { var command = {}; + //------------------------------------------------- + // Utilities. + //------------------------------------------------- + command.getSdkVersion = function() { + return aSdkVersion; + }; + //------------------------------------------------- // General commands. //------------------------------------------------- diff --git a/dom/wifi/WifiP2pManager.jsm b/dom/wifi/WifiP2pManager.jsm index 61e299a6c18..cc3332cf355 100644 --- a/dom/wifi/WifiP2pManager.jsm +++ b/dom/wifi/WifiP2pManager.jsm @@ -608,18 +608,28 @@ function P2pStateMachine(aP2pCommand, aNetUtil) { _sm.pause(); - // Step 1: Connect to p2p0. - aP2pCommand.connectToSupplicant(function (status) { - let detail; - - if (0 !== status) { - debug('Failed to connect to p2p0'); - onFailure(); + // This function will only call back on success. + function connectToSupplicantIfNeeded(callback) { + if (aP2pCommand.getSdkVersion() >= 19) { + // No need to connect to supplicant on KK. Call back directly. + callback(); return; } + aP2pCommand.connectToSupplicant(function (status) { + if (0 !== status) { + debug('Failed to connect to p2p0'); + onFailure(); + return; + } + debug('wpa_supplicant p2p0 connected!'); + _onSupplicantConnected(); + callback(); + }); + } - debug('wpa_supplicant p2p0 connected!'); - _onSupplicantConnected(); + // Step 1: Connect to p2p0 if needed. + connectToSupplicantIfNeeded(function callback () { + let detail; // Step 2: Get MAC address. if (!_localDevice.address) { diff --git a/dom/wifi/WifiProxyService.cpp b/dom/wifi/WifiProxyService.cpp index 9c054b1b87f..5770c96811d 100644 --- a/dom/wifi/WifiProxyService.cpp +++ b/dom/wifi/WifiProxyService.cpp @@ -174,6 +174,14 @@ WifiProxyService::Start(nsIWifiEventListener* aListener, MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aListener); +#if ANDROID_VERSION >= 19 + // KK changes the way mux'ing/demux'ing different supplicant interfaces + // (e.g. wlan0/p2p0) from multi-sockets to single socket embedded with + // prefixed interface name (e.g. IFNAME=wlan0 xxxxxx). Therefore, we use + // the first given interface as the global interface for KK. + aNumOfInterfaces = 1; +#endif + nsresult rv; // Since EventRunnable runs in the manner of blocking, we have to @@ -250,6 +258,14 @@ WifiProxyService::WaitForEvent(const nsACString& aInterface) { MOZ_ASSERT(NS_IsMainThread()); +#if ANDROID_VERSION >= 19 + // We will only have one global interface for KK. + if (!mEventThreadList.IsEmpty()) { + nsCOMPtr runnable = new EventRunnable(aInterface); + mEventThreadList[0].mThread->Dispatch(runnable, nsIEventTarget::DISPATCH_NORMAL); + return NS_OK; + } +#else // Dispatch to the event thread which has the given interface name for (size_t i = 0; i < mEventThreadList.Length(); i++) { if (mEventThreadList[i].mInterface.Equals(aInterface)) { @@ -258,6 +274,7 @@ WifiProxyService::WaitForEvent(const nsACString& aInterface) return NS_OK; } } +#endif return NS_ERROR_FAILURE; } @@ -282,16 +299,27 @@ void WifiProxyService::DispatchWifiEvent(const nsAString& aEvent, const nsACString& aInterface) { MOZ_ASSERT(NS_IsMainThread()); + +#if ANDROID_VERSION < 19 + mListener->OnWaitEvent(aEvent, aInterface); +#else + // The interface might be embedded in the event string such as + // "IFNAME=wlan0 CTRL-EVENT-BSS-ADDED 65 3c:94:d5:7c:11:8b". + // Parse the interface name from the event string and use p2p0 + // as the default interface if "IFNAME" is not found. nsAutoString event; + nsAutoString embeddedInterface(NS_LITERAL_STRING("p2p0")); if (StringBeginsWith(aEvent, NS_LITERAL_STRING("IFNAME"))) { - // Jump over IFNAME for gonk-kk. + int32_t ifnameFrom = aEvent.FindChar('=') + 1; + int32_t ifnameTo = aEvent.FindChar(' ') - 1; + embeddedInterface = Substring(aEvent, ifnameFrom, ifnameTo - ifnameFrom + 1); event = Substring(aEvent, aEvent.FindChar(' ') + 1); } else { event = aEvent; } - // Call the listener. - mListener->OnWaitEvent(event, aInterface); + mListener->OnWaitEvent(event, NS_ConvertUTF16toUTF8(embeddedInterface)); +#endif } NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WifiProxyService, diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index ee636f1d1a4..f4c0ba62b80 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -134,7 +134,11 @@ var WifiManager = (function() { if (manager.ifname === iface && handleEvent(event)) { waitForEvent(iface); } else if (p2pSupported) { - if (WifiP2pManager.INTERFACE_NAME === iface) { + // Please refer to + // http://androidxref.com/4.4.2_r1/xref/frameworks/base/wifi/java/android/net/wifi/WifiMonitor.java#519 + // for interface event mux/demux rules. In short words, both + // 'p2p0' and 'p2p-' should go to Wifi P2P state machine. + if (WifiP2pManager.INTERFACE_NAME === iface || -1 !== iface.indexOf('p2p-')) { // If the connection is closed, wifi.c::wifi_wait_for_event() // will still return 'CTRL-EVENT-TERMINATING - connection closed' // rather than blocking. So when we see this special event string, From 42b8e818db1ada9fe0c5e4d787e1968703ff0459 Mon Sep 17 00:00:00 2001 From: Jonathan Hao Date: Fri, 3 Oct 2014 17:41:26 +0800 Subject: [PATCH 11/46] Bug 1045062 - [RTSP] Replace CHECK assertions by NS_ASSERTION or graceful assertions. r=sworkman --HG-- extra : rebase_source : c4d53eaa5c21dcf993513ba7f32e1070cc8490fa --- netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp | 24 +++- netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp | 73 ++++++++---- netwerk/protocol/rtsp/rtsp/AAVCAssembler.h | 4 +- netwerk/protocol/rtsp/rtsp/AH263Assembler.cpp | 30 ++++- netwerk/protocol/rtsp/rtsp/AH263Assembler.h | 2 +- .../rtsp/rtsp/AMPEG4AudioAssembler.cpp | 105 +++++++++++++----- .../protocol/rtsp/rtsp/AMPEG4AudioAssembler.h | 2 +- .../rtsp/rtsp/AMPEG4ElementaryAssembler.cpp | 51 +++++++-- .../rtsp/rtsp/AMPEG4ElementaryAssembler.h | 2 +- netwerk/protocol/rtsp/rtsp/APacketSource.cpp | 98 +++++++++++----- netwerk/protocol/rtsp/rtsp/ARTPAssembler.cpp | 11 +- netwerk/protocol/rtsp/rtsp/ARTPAssembler.h | 2 +- netwerk/protocol/rtsp/rtsp/ARTPSession.cpp | 18 ++- netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp | 4 +- .../protocol/rtsp/rtsp/ARTSPConnection.cpp | 48 +++++--- .../protocol/rtsp/rtsp/ARawAudioAssembler.cpp | 13 ++- .../protocol/rtsp/rtsp/ARawAudioAssembler.h | 2 +- .../rtsp/rtsp/ASessionDescription.cpp | 43 ++++--- .../protocol/rtsp/rtsp/ASessionDescription.h | 2 +- .../rtsp/rtsp/RTSPConnectionHandler.h | 103 +++++++++++++---- netwerk/protocol/rtsp/rtsp/RTSPSource.cpp | 21 ++-- netwerk/protocol/rtsp/rtsp/RTSPTransmitter.h | 37 ++++-- netwerk/protocol/rtsp/rtsp/UDPPusher.cpp | 16 ++- 23 files changed, 525 insertions(+), 186 deletions(-) diff --git a/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp b/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp index 11d0d226824..0618cb7b766 100644 --- a/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/AAMRAssembler.cpp @@ -137,13 +137,20 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket( queue->erase(queue->begin()); ++mNextExpectedSeqNo; - LOGV("AMR packet too short."); + LOGW("AMR packet too short."); return MALFORMED_PACKET; } unsigned payloadHeader = buffer->data()[0]; - CHECK_EQ(payloadHeader & 0x0f, 0u); // RR + if (payloadHeader & 0x0f != 0u) { + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + + LOGW("Wrong payload header"); + + return MALFORMED_PACKET; + } Vector tableOfContents; @@ -154,7 +161,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket( queue->erase(queue->begin()); ++mNextExpectedSeqNo; - LOGV("Unable to parse TOC."); + LOGW("Unable to parse TOC."); return MALFORMED_PACKET; } @@ -168,7 +175,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket( queue->erase(queue->begin()); ++mNextExpectedSeqNo; - LOGV("Illegal TOC entry."); + LOGW("Illegal TOC entry."); return MALFORMED_PACKET; } @@ -183,7 +190,12 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket( } sp accessUnit = new ABuffer(totalSize); - CopyTimes(accessUnit, buffer); + if (!CopyTimes(accessUnit, buffer)) { + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + + return MALFORMED_PACKET; + } size_t dstOffset = 0; for (size_t i = 0; i < tableOfContents.size(); ++i) { @@ -195,7 +207,7 @@ ARTPAssembler::AssemblyStatus AAMRAssembler::addPacket( queue->erase(queue->begin()); ++mNextExpectedSeqNo; - LOGV("AMR packet too short."); + LOGW("AMR packet too short."); return MALFORMED_PACKET; } diff --git a/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp b/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp index e03ccd3a27c..0aedd57eadf 100644 --- a/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/AAVCAssembler.cpp @@ -21,6 +21,8 @@ #include "ARTPSource.h" +#include "mozilla/Assertions.h" + #include #include #include @@ -82,7 +84,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit( if (size < 1 || (data[0] & 0x80)) { // Corrupt. - LOGV("Ignoring corrupt buffer."); + LOGW("Ignoring corrupt buffer."); queue->erase(queue->begin()); ++mNextExpectedSeqNo; @@ -91,10 +93,11 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit( unsigned nalType = data[0] & 0x1f; if (nalType >= 1 && nalType <= 23) { - addSingleNALUnit(buffer); + bool success = addSingleNALUnit(buffer); queue->erase(queue->begin()); ++mNextExpectedSeqNo; - return OK; + + return success ? OK : MALFORMED_PACKET; } else if (nalType == 28) { // FU-A return addFragmentedNALUnit(queue); @@ -115,21 +118,29 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addNALUnit( } } -void AAVCAssembler::addSingleNALUnit(const sp &buffer) { +bool AAVCAssembler::addSingleNALUnit(const sp &buffer) { LOGV("addSingleNALUnit of size %d", buffer->size()); #if !LOG_NDEBUG hexdump(buffer->data(), buffer->size()); #endif uint32_t rtpTime; - CHECK(buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)); + if (!buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)) { + LOGW("Cannot find rtp-time"); + return false; + } if (!mNALUnits.empty() && rtpTime != mAccessUnitRTPTime) { - submitAccessUnit(); + if (!submitAccessUnit()) { + LOGW("Cannot find rtp-time. Malformed packet."); + + return false; + } } mAccessUnitRTPTime = rtpTime; mNALUnits.push_back(buffer); + return true; } bool AAVCAssembler::addSingleTimeAggregationPacket(const sp &buffer) { @@ -154,9 +165,14 @@ bool AAVCAssembler::addSingleTimeAggregationPacket(const sp &buffer) { sp unit = new ABuffer(nalSize); memcpy(unit->data(), &data[2], nalSize); - CopyTimes(unit, buffer); + if (!CopyTimes(unit, buffer)) { + return false; + } - addSingleNALUnit(unit); + if (!addSingleNALUnit(unit)) { + LOGW("addSingleNALUnit() failed"); + return false; + } data += 2 + nalSize; size -= 2 + nalSize; @@ -171,19 +187,31 @@ bool AAVCAssembler::addSingleTimeAggregationPacket(const sp &buffer) { ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit( List > *queue) { - CHECK(!queue->empty()); + MOZ_ASSERT(!queue->empty()); sp buffer = *queue->begin(); const uint8_t *data = buffer->data(); size_t size = buffer->size(); - CHECK(size > 0); + if (size <= 0) { + LOGW("Buffer is empty"); + + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + return MALFORMED_PACKET; + } unsigned indicator = data[0]; - CHECK((indicator & 0x1f) == 28); + if ((indicator & 0x1f) != 28) { + LOGW("Indicator is wrong"); + + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + return MALFORMED_PACKET; + } if (size < 2) { - LOGV("Ignoring malformed FU buffer (size = %d)", size); + LOGW("Ignoring malformed FU buffer (size = %d)", size); queue->erase(queue->begin()); ++mNextExpectedSeqNo; @@ -193,7 +221,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit( if (!(data[1] & 0x80)) { // Start bit not set on the first buffer. - LOGV("Start bit not set on first buffer"); + LOGW("Start bit not set on first buffer"); queue->erase(queue->begin()); ++mNextExpectedSeqNo; @@ -235,7 +263,7 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit( || data[0] != indicator || (data[1] & 0x1f) != nalType || (data[1] & 0x80)) { - LOGV("Ignoring malformed FU buffer."); + LOGW("Ignoring malformed FU buffer."); // Delete the whole start of the FU. @@ -277,7 +305,9 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit( ++totalSize; sp unit = new ABuffer(totalSize); - CopyTimes(unit, *queue->begin()); + if (!CopyTimes(unit, *queue->begin())) { + return MALFORMED_PACKET; + } unit->data()[0] = (nri << 5) | nalType; @@ -299,15 +329,17 @@ ARTPAssembler::AssemblyStatus AAVCAssembler::addFragmentedNALUnit( unit->setRange(0, totalSize); - addSingleNALUnit(unit); + if (!addSingleNALUnit(unit)) { + return MALFORMED_PACKET; + } LOGV("successfully assembled a NAL unit from fragments."); return OK; } -void AAVCAssembler::submitAccessUnit() { - CHECK(!mNALUnits.empty()); +bool AAVCAssembler::submitAccessUnit() { + MOZ_ASSERT(!mNALUnits.empty()); LOGV("Access unit complete (%d nal units)", mNALUnits.size()); @@ -329,7 +361,9 @@ void AAVCAssembler::submitAccessUnit() { offset += nal->size(); } - CopyTimes(accessUnit, *mNALUnits.begin()); + if (!CopyTimes(accessUnit, *mNALUnits.begin())) { + return false; + } #if 0 printf(mAccessUnitDamaged ? "X" : "."); @@ -346,6 +380,7 @@ void AAVCAssembler::submitAccessUnit() { sp msg = mNotifyMsg->dup(); msg->setObject("access-unit", accessUnit); msg->post(); + return true; } ARTPAssembler::AssemblyStatus AAVCAssembler::assembleMore( diff --git a/netwerk/protocol/rtsp/rtsp/AAVCAssembler.h b/netwerk/protocol/rtsp/rtsp/AAVCAssembler.h index 87b62384e39..590bba71e5d 100644 --- a/netwerk/protocol/rtsp/rtsp/AAVCAssembler.h +++ b/netwerk/protocol/rtsp/rtsp/AAVCAssembler.h @@ -49,11 +49,11 @@ private: List > mNALUnits; AssemblyStatus addNALUnit(const sp &source); - void addSingleNALUnit(const sp &buffer); + bool addSingleNALUnit(const sp &buffer); AssemblyStatus addFragmentedNALUnit(List > *queue); bool addSingleTimeAggregationPacket(const sp &buffer); - void submitAccessUnit(); + bool submitAccessUnit(); DISALLOW_EVIL_CONSTRUCTORS(AAVCAssembler); }; diff --git a/netwerk/protocol/rtsp/rtsp/AH263Assembler.cpp b/netwerk/protocol/rtsp/rtsp/AH263Assembler.cpp index 6bcf56dc7bc..ddc1a2d5dc5 100644 --- a/netwerk/protocol/rtsp/rtsp/AH263Assembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/AH263Assembler.cpp @@ -19,6 +19,8 @@ #include "ARTPSource.h" #include "RtspPrlog.h" +#include "mozilla/Assertions.h" + #include #include #include @@ -84,10 +86,24 @@ ARTPAssembler::AssemblyStatus AH263Assembler::addPacket( } uint32_t rtpTime; - CHECK(buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)); + if (!buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)) { + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + + LOGW("Cannot find rtp-time. Malformed packet."); + + return MALFORMED_PACKET; + } if (mPackets.size() > 0 && rtpTime != mAccessUnitRTPTime) { - submitAccessUnit(); + if (!submitAccessUnit()) { + queue->erase(queue->begin()); + ++mNextExpectedSeqNo; + + LOGW("Cannot find rtp-time. Malformed packet."); + + return MALFORMED_PACKET; + } } mAccessUnitRTPTime = rtpTime; @@ -174,8 +190,8 @@ ARTPAssembler::AssemblyStatus AH263Assembler::addPacket( return OK; } -void AH263Assembler::submitAccessUnit() { - CHECK(!mPackets.empty()); +bool AH263Assembler::submitAccessUnit() { + MOZ_ASSERT(!mPackets.empty()); #if VERBOSE LOG(VERBOSE) << "Access unit complete (" << mPackets.size() << " packets)"; @@ -204,7 +220,9 @@ void AH263Assembler::submitAccessUnit() { ++it; } - CopyTimes(accessUnit, *mPackets.begin()); + if (!CopyTimes(accessUnit, *mPackets.begin())) { + return false; + } #if 0 printf(mAccessUnitDamaged ? "X" : "."); @@ -221,6 +239,8 @@ void AH263Assembler::submitAccessUnit() { sp msg = mNotifyMsg->dup(); msg->setObject("access-unit", accessUnit); msg->post(); + + return true; } void AH263Assembler::packetLost() { diff --git a/netwerk/protocol/rtsp/rtsp/AH263Assembler.h b/netwerk/protocol/rtsp/rtsp/AH263Assembler.h index 0b2e4d36992..029beca3707 100644 --- a/netwerk/protocol/rtsp/rtsp/AH263Assembler.h +++ b/netwerk/protocol/rtsp/rtsp/AH263Assembler.h @@ -48,7 +48,7 @@ private: List > mPackets; AssemblyStatus addPacket(const sp &source); - void submitAccessUnit(); + bool submitAccessUnit(); DISALLOW_EVIL_CONSTRUCTORS(AH263Assembler); }; diff --git a/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp b/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp index 14332cfe1c0..9cca42b8c6b 100644 --- a/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.cpp @@ -21,6 +21,8 @@ #include "ARTPSource.h" +#include "mozilla/Assertions.h" + #include #include #include @@ -136,7 +138,9 @@ static status_t parseGASpecificConfig( } unsigned extensionFlag3 = bits->getBits(1); - CHECK_EQ(extensionFlag3, 0u); // TBD in version 3 + if (extensionFlag3 != 0u) { + return ERROR_UNSUPPORTED; // TBD in version 3 + } } return OK; @@ -147,7 +151,9 @@ static status_t parseAudioSpecificConfig(ABitReader *bits, sp *asc) { size_t totalNumBits = bits->numBitsLeft(); unsigned audioObjectType; - CHECK_EQ(parseAudioObjectType(bits, &audioObjectType), (status_t)OK); + if (parseAudioObjectType(bits, &audioObjectType) != (status_t)OK) { + return ERROR_UNSUPPORTED; + } unsigned samplingFreqIndex = bits->getBits(4); if (samplingFreqIndex == 0x0f) { @@ -166,16 +172,22 @@ static status_t parseAudioSpecificConfig(ABitReader *bits, sp *asc) { if (extensionSamplingFreqIndex == 0x0f) { /* unsigned extensionSamplingFrequency = */bits->getBits(24); } - CHECK_EQ(parseAudioObjectType(bits, &audioObjectType), (status_t)OK); + if (parseAudioObjectType(bits, &audioObjectType) != (status_t)OK) { + return ERROR_UNSUPPORTED; + } } - CHECK((audioObjectType >= 1 && audioObjectType <= 4) - || (audioObjectType >= 6 && audioObjectType <= 7) - || audioObjectType == 17 - || (audioObjectType >= 19 && audioObjectType <= 23)); + if (!((audioObjectType >= 1 && audioObjectType <= 4) || + (audioObjectType >= 6 && audioObjectType <= 7) || + audioObjectType == 17 || + (audioObjectType >= 19 && audioObjectType <= 23))) { + return ERROR_UNSUPPORTED; + } - CHECK_EQ(parseGASpecificConfig( - bits, audioObjectType, channelConfiguration), (status_t)OK); + if (parseGASpecificConfig(bits, audioObjectType, channelConfiguration) + != (status_t)OK) { + return ERROR_UNSUPPORTED; + } if (audioObjectType == 17 || (audioObjectType >= 19 && audioObjectType <= 27)) { @@ -186,7 +198,9 @@ static status_t parseAudioSpecificConfig(ABitReader *bits, sp *asc) { if (epConfig == 3) { unsigned directMapping = bits->getBits(1); - CHECK_EQ(directMapping, 1u); + if (directMapping != 1u) { + return ERROR_UNSUPPORTED; + } } } } @@ -198,8 +212,10 @@ static status_t parseAudioSpecificConfig(ABitReader *bits, sp *asc) { if (syncExtensionType == 0x2b7) { LOGI("found syncExtension"); - CHECK_EQ(parseAudioObjectType(bits, &extensionAudioObjectType), - (status_t)OK); + if (parseAudioObjectType(bits, &extensionAudioObjectType) + != (status_t)OK) { + return ERROR_UNSUPPORTED; + } sbrPresent = bits->getBits(1); @@ -266,28 +282,37 @@ static status_t parseStreamMuxConfig( audioMuxVersionA = bits->getBits(1); } - CHECK_EQ(audioMuxVersionA, 0u); // otherwise future spec + if (audioMuxVersionA != 0u) { + return ERROR_UNSUPPORTED; // future spec + } - if (audioMuxVersion != 0) { + if (audioMuxVersion != 0u) { return ERROR_UNSUPPORTED; // XXX to be implemented; } - CHECK_EQ(audioMuxVersion, 0u); // XXX to be implemented unsigned allStreamsSameTimeFraming = bits->getBits(1); - CHECK_EQ(allStreamsSameTimeFraming, 1u); // There's only one stream. + if (allStreamsSameTimeFraming != 1u) { + return ERROR_UNSUPPORTED; // There's only one stream. + } *numSubFrames = bits->getBits(6); unsigned numProgram = bits->getBits(4); - CHECK_EQ(numProgram, 0u); // disabled in RTP LATM + if (numProgram != 0u) { + return ERROR_UNSUPPORTED; // disabled in RTP LATM + } unsigned numLayer = bits->getBits(3); - CHECK_EQ(numLayer, 0u); // disabled in RTP LATM + if (numLayer != 0u) { + return ERROR_UNSUPPORTED; // disabled in RTP LATM + } if (audioMuxVersion == 0) { // AudioSpecificConfig - CHECK_EQ(parseAudioSpecificConfig(bits, NULL /* asc */), (status_t)OK); + if (parseAudioSpecificConfig(bits, NULL /* asc */) != (status_t)OK) { + return ERROR_UNSUPPORTED; + } } else { - TRESPASS(); // XXX to be implemented + return ERROR_UNSUPPORTED; // XXX to be implemented } *frameLengthType = bits->getBits(3); @@ -339,7 +364,7 @@ static status_t parseStreamMuxConfig( *otherDataLenBits = 0; if (*otherDataPresent) { if (audioMuxVersion == 1) { - TRESPASS(); // XXX to be implemented + return ERROR_UNSUPPORTED; // XXX to be implemented } else { *otherDataLenBits = 0; @@ -362,7 +387,9 @@ static status_t parseStreamMuxConfig( } sp AMPEG4AudioAssembler::removeLATMFraming(const sp &buffer) { - CHECK(!mMuxConfigPresent); // XXX to be implemented + if (mMuxConfigPresent) { + return NULL; // XXX to be implemented + } sp out = new ABuffer(buffer->size()); out->setRange(0, 0); @@ -404,7 +431,9 @@ sp AMPEG4AudioAssembler::removeLATMFraming(const sp &buffer) { default: { - CHECK_GE(mFixedFrameLength, 0); + if (mFixedFrameLength < 0) { + return NULL; + } payloadLength = mFixedFrameLength; break; @@ -425,8 +454,14 @@ sp AMPEG4AudioAssembler::removeLATMFraming(const sp &buffer) { if (mOtherDataPresent) { // We want to stay byte-aligned. - CHECK((mOtherDataLenBits % 8) == 0); - CHECK_LE(offset + (mOtherDataLenBits / 8), buffer->size()); + if (mOtherDataLenBits % 8 != 0) { + mAccessUnitDamaged = true; + return out; + } + if (offset + (mOtherDataLenBits / 8) > buffer->size()) { + mAccessUnitDamaged = true; + return out; + } offset += mOtherDataLenBits / 8; } } @@ -520,10 +555,17 @@ ARTPAssembler::AssemblyStatus AMPEG4AudioAssembler::addPacket( } uint32_t rtpTime; - CHECK(buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)); + if (!buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)) { + LOGW("Cannot find rtp-time. Malformed packet."); + + return MALFORMED_PACKET; + } if (mPackets.size() > 0 && rtpTime != mAccessUnitRTPTime) { - submitAccessUnit(); + if (!submitAccessUnit()) { + LOGW("Cannot find rtp-time. Malformed packet."); + return MALFORMED_PACKET; + } } mAccessUnitRTPTime = rtpTime; @@ -535,8 +577,8 @@ ARTPAssembler::AssemblyStatus AMPEG4AudioAssembler::addPacket( return OK; } -void AMPEG4AudioAssembler::submitAccessUnit() { - CHECK(!mPackets.empty()); +bool AMPEG4AudioAssembler::submitAccessUnit() { + MOZ_ASSERT(!mPackets.empty()); #if VERBOSE LOG(VERBOSE) << "Access unit complete (" << mPackets.size() << " packets)"; @@ -565,7 +607,9 @@ void AMPEG4AudioAssembler::submitAccessUnit() { } accessUnit = removeLATMFraming(accessUnit); - CopyTimes(accessUnit, *mPackets.begin()); + if (!accessUnit.get() || !CopyTimes(accessUnit, *mPackets.begin())) { + return false; + } if (mAccessUnitDamaged) { accessUnit->meta()->setInt32("damaged", true); @@ -577,6 +621,7 @@ void AMPEG4AudioAssembler::submitAccessUnit() { sp msg = mNotifyMsg->dup(); msg->setObject("access-unit", accessUnit); msg->post(); + return true; } void AMPEG4AudioAssembler::packetLost() { diff --git a/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.h b/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.h index 1969c190f4e..2836c040996 100644 --- a/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.h +++ b/netwerk/protocol/rtsp/rtsp/AMPEG4AudioAssembler.h @@ -58,7 +58,7 @@ private: List > mPackets; AssemblyStatus addPacket(const sp &source); - void submitAccessUnit(); + bool submitAccessUnit(); sp removeLATMFraming(const sp &buffer); diff --git a/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp b/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp index 0b05296cff8..9a936287ed4 100644 --- a/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.cpp @@ -21,6 +21,8 @@ #include "ARTPSource.h" +#include "mozilla/Assertions.h" + #include #include #include @@ -216,10 +218,18 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket( } uint32_t rtpTime; - CHECK(buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)); + if (!buffer->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)) { + LOGW("Cannot find rtp-time. Malformed packet."); + + return MALFORMED_PACKET; + } if (mPackets.size() > 0 && rtpTime != mAccessUnitRTPTime) { - submitAccessUnit(); + if (!submitAccessUnit()) { + LOGW("Cannot find rtp-time. Malformed packet."); + + return MALFORMED_PACKET; + } } // If constantDuration and CTSDelta are not present. We should assume the @@ -236,10 +246,18 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket( } else { // hexdump(buffer->data(), buffer->size()); - CHECK_GE(buffer->size(), 2u); + if (buffer->size() < 2u) { + LOGW("Payload format error. Malformed packet."); + + return MALFORMED_PACKET; + } unsigned AU_headers_length = U16_AT(buffer->data()); // in bits - CHECK_GE(buffer->size(), 2 + (AU_headers_length + 7) / 8); + if (buffer->size() < 2 + (AU_headers_length + 7) / 8) { + LOGW("Payload format error. Malformed packet."); + + return MALFORMED_PACKET; + } List headers; @@ -330,7 +348,11 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket( mPreviousAUCount++; const AUHeader &header = *it; const AUHeader &first = *headers.begin(); - CHECK_LE(offset + header.mSize, buffer->size()); + if (offset + header.mSize > buffer->size()) { + LOGW("Payload format error. Malformed packet."); + + return MALFORMED_PACKET; + } sp accessUnit = new ABuffer(header.mSize); memcpy(accessUnit->data(), buffer->data() + offset, header.mSize); @@ -345,7 +367,11 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket( mPackets.push_back(accessUnit); } - CHECK_EQ(offset, buffer->size()); + if (offset != buffer->size()) { + LOGW("Payload format error. Malformed packet."); + + return MALFORMED_PACKET; + } } queue->erase(queue->begin()); @@ -354,8 +380,8 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket( return OK; } -void AMPEG4ElementaryAssembler::submitAccessUnit() { - CHECK(!mPackets.empty()); +bool AMPEG4ElementaryAssembler::submitAccessUnit() { + MOZ_ASSERT(mPackets.empty()); LOGV("Access unit complete (%d nal units)", mPackets.size()); @@ -374,7 +400,9 @@ void AMPEG4ElementaryAssembler::submitAccessUnit() { sp accessUnit = new ABuffer((*it)->size()); sp nal = *it; memcpy(accessUnit->data(), nal->data(), nal->size()); - CopyTimes(accessUnit, nal); + if (!CopyTimes(accessUnit, nal)) { + return false; + } if (mAccessUnitDamaged) { accessUnit->meta()->setInt32("damaged", true); @@ -404,7 +432,9 @@ void AMPEG4ElementaryAssembler::submitAccessUnit() { memcpy(accessUnit->data() + offset, nal->data(), nal->size()); offset += nal->size(); } - CopyTimes(accessUnit, *mPackets.begin()); + if (!CopyTimes(accessUnit, *mPackets.begin())) { + return false; + } if (mAccessUnitDamaged) { accessUnit->meta()->setInt32("damaged", true); @@ -417,6 +447,7 @@ void AMPEG4ElementaryAssembler::submitAccessUnit() { mPackets.clear(); mAccessUnitDamaged = false; + return true; } ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::assembleMore( diff --git a/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.h b/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.h index 116eb7a7a05..e1c74477589 100644 --- a/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.h +++ b/netwerk/protocol/rtsp/rtsp/AMPEG4ElementaryAssembler.h @@ -67,7 +67,7 @@ private: List > mPackets; AssemblyStatus addPacket(const sp &source); - void submitAccessUnit(); + bool submitAccessUnit(); DISALLOW_EVIL_CONSTRUCTORS(AMPEG4ElementaryAssembler); }; diff --git a/netwerk/protocol/rtsp/rtsp/APacketSource.cpp b/netwerk/protocol/rtsp/rtsp/APacketSource.cpp index f8c18c60167..0fdbaa3accd 100644 --- a/netwerk/protocol/rtsp/rtsp/APacketSource.cpp +++ b/netwerk/protocol/rtsp/rtsp/APacketSource.cpp @@ -114,8 +114,11 @@ static sp MakeAVCCodecSpecificData( } sp profileLevelID = decodeHex(val); - CHECK(profileLevelID != NULL); - CHECK_EQ(profileLevelID->size(), 3u); + if (!profileLevelID.get() || profileLevelID->size() != 3u) { + LOGW("Format error in profile-level-id"); + + return NULL; + } Vector > paramSets; @@ -135,21 +138,27 @@ static sp MakeAVCCodecSpecificData( AString nalString(val, start, end - start); sp nal = decodeBase64(nalString); - CHECK(nal != NULL); - CHECK_GT(nal->size(), 0u); - CHECK_LE(nal->size(), 65535u); + if (!nal.get() || nal->size() <= 0u || nal->size() > 65535u) { + return NULL; + } uint8_t nalType = nal->data()[0] & 0x1f; if (numSeqParameterSets == 0) { - CHECK_EQ((unsigned)nalType, 7u); + if ((unsigned)nalType != 7u) { + return NULL; + } } else if (numPicParameterSets > 0) { - CHECK_EQ((unsigned)nalType, 8u); + if ((unsigned)nalType != 8u) { + return NULL; + } } if (nalType == 7) { ++numSeqParameterSets; totalSeqParameterSetSize += nal->size(); } else { - CHECK_EQ((unsigned)nalType, 8u); + if ((unsigned)nalType != 8u) { + return NULL; + } ++numPicParameterSets; totalPicParameterSetSize += nal->size(); } @@ -163,8 +172,12 @@ static sp MakeAVCCodecSpecificData( start = commaPos + 1; } - CHECK_LT(numSeqParameterSets, 32u); - CHECK_LE(numPicParameterSets, 255u); + if (numSeqParameterSets >= 32u) { + return NULL; + } + if (numPicParameterSets > 255u) { + return NULL; + } size_t csdSize = 1 + 3 + 1 + 1 @@ -268,19 +281,29 @@ sp MakeAACCodecSpecificData2(const char *params) { const char *s = val.c_str(); char *end; objectType = strtoul(s, &end, 10); - CHECK(end > s && *end == '\0'); + if (end <= s || *end != '\0') { + return NULL; + } } else { objectType = 0x40; // Audio ISO/IEC 14496-3 } - CHECK(GetAttribute(params, "config", &val)); + if (!GetAttribute(params, "config", &val)) { + LOGW("Cannot find attribute config"); + + return NULL; + } sp config = decodeHex(val); - CHECK(config != NULL); + if (!config.get()) { + return NULL; + } // Make sure size fits into a single byte and doesn't have to // be encoded. - CHECK_LT(20 + config->size(), 128u); + if (20 + config->size() >= 128u) { + return NULL; + } static const uint8_t kStaticESDS[] = { 0x03, 22, @@ -368,10 +391,16 @@ static sp MakeMPEG4VideoCodecSpecificData( *height = 0; AString val; - CHECK(GetAttribute(params, "config", &val)); + if (!GetAttribute(params, "config", &val)) { + LOGW("Cannot find attribute config"); + + return NULL; + } sp config = decodeHex(val); - CHECK(config != NULL); + if (!config.get()) { + return NULL; + } if (!ExtractDimensionsMPEG4Config(config, width, height)) { return NULL; @@ -477,8 +506,11 @@ APacketSource::APacketSource( mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AAC); int32_t sampleRate, numChannels; - ASessionDescription::ParseFormatDesc( - desc.c_str(), &sampleRate, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + desc.c_str(), &sampleRate, &numChannels)) { + mInitCheck = ERROR_UNSUPPORTED; + return; + } mFormat->setInt32(kKeySampleRate, sampleRate); mFormat->setInt32(kKeyChannelCount, numChannels); @@ -497,8 +529,11 @@ APacketSource::APacketSource( mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_NB); int32_t sampleRate, numChannels; - ASessionDescription::ParseFormatDesc( - desc.c_str(), &sampleRate, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + desc.c_str(), &sampleRate, &numChannels)) { + mInitCheck = ERROR_UNSUPPORTED; + return; + } mFormat->setInt32(kKeySampleRate, sampleRate); mFormat->setInt32(kKeyChannelCount, numChannels); @@ -510,8 +545,11 @@ APacketSource::APacketSource( mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_WB); int32_t sampleRate, numChannels; - ASessionDescription::ParseFormatDesc( - desc.c_str(), &sampleRate, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + desc.c_str(), &sampleRate, &numChannels)) { + mInitCheck = ERROR_UNSUPPORTED; + return; + } mFormat->setInt32(kKeySampleRate, sampleRate); mFormat->setInt32(kKeyChannelCount, numChannels); @@ -561,20 +599,28 @@ APacketSource::APacketSource( mFormat->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AAC); int32_t sampleRate, numChannels; - ASessionDescription::ParseFormatDesc( - desc.c_str(), &sampleRate, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + desc.c_str(), &sampleRate, &numChannels)) { + mInitCheck = ERROR_UNSUPPORTED; + return; + } mFormat->setInt32(kKeySampleRate, sampleRate); mFormat->setInt32(kKeyChannelCount, numChannels); sp codecSpecificData = MakeAACCodecSpecificData2(params.c_str()); - + if (!codecSpecificData.get()) { + mInitCheck = ERROR_UNSUPPORTED; + return; + } mFormat->setData( kKeyESDS, 0, codecSpecificData->data(), codecSpecificData->size()); } else if (ARawAudioAssembler::Supports(desc.c_str())) { - ARawAudioAssembler::MakeFormat(desc.c_str(), mFormat); + if (!ARawAudioAssembler::MakeFormat(desc.c_str(), mFormat)) { + mInitCheck = ERROR_UNSUPPORTED; + } } else { mInitCheck = ERROR_UNSUPPORTED; } diff --git a/netwerk/protocol/rtsp/rtsp/ARTPAssembler.cpp b/netwerk/protocol/rtsp/rtsp/ARTPAssembler.cpp index a897c10da4a..1d59365cefd 100644 --- a/netwerk/protocol/rtsp/rtsp/ARTPAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/ARTPAssembler.cpp @@ -16,6 +16,8 @@ #include "ARTPAssembler.h" +#include "RtspPrlog.h" + #include #include #include @@ -64,14 +66,19 @@ void ARTPAssembler::onPacketReceived(const sp &source) { } // static -void ARTPAssembler::CopyTimes(const sp &to, const sp &from) { +bool ARTPAssembler::CopyTimes(const sp &to, const sp &from) { uint32_t rtpTime; - CHECK(from->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)); + if (!from->meta()->findInt32("rtp-time", (int32_t *)&rtpTime)) { + LOGW("CopyTimes: Cannot find rtp-time"); + + return false; + } to->meta()->setInt32("rtp-time", rtpTime); // Copy the seq number. to->setInt32Data(from->int32Data()); + return true; } } // namespace android diff --git a/netwerk/protocol/rtsp/rtsp/ARTPAssembler.h b/netwerk/protocol/rtsp/rtsp/ARTPAssembler.h index 17d27003699..f352e232115 100644 --- a/netwerk/protocol/rtsp/rtsp/ARTPAssembler.h +++ b/netwerk/protocol/rtsp/rtsp/ARTPAssembler.h @@ -44,7 +44,7 @@ protected: virtual AssemblyStatus assembleMore(const sp &source) = 0; virtual void packetLost() = 0; - static void CopyTimes(const sp &to, const sp &from); + static bool CopyTimes(const sp &to, const sp &from); private: int64_t mFirstFailureTimeUs; diff --git a/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp b/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp index 31a477cdcdc..b052adb464e 100644 --- a/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp +++ b/netwerk/protocol/rtsp/rtsp/ARTPSession.cpp @@ -44,7 +44,10 @@ ARTPSession::ARTPSession() } status_t ARTPSession::setup(const sp &desc) { - CHECK_EQ(mInitCheck, (status_t)NO_INIT); + if (mInitCheck != (status_t)NO_INIT) { + LOGE("Unexpected mInitCheck"); + return NO_INIT; + } mDesc = desc; @@ -157,12 +160,21 @@ void ARTPSession::onMessageReceived(const sp &msg) { sp obj; CHECK(msg->findObject("access-unit", &obj)); + if (!msg->findObject("access-unit", &obj)) { + LOGW("Cannot find access-unit"); + + break; + } sp accessUnit = static_cast(obj.get()); uint64_t ntpTime; - CHECK(accessUnit->meta()->findInt64( - "ntp-time", (int64_t *)&ntpTime)); + if (!accessUnit->meta()->findInt64( + "ntp-time", (int64_t *)&ntpTime)) { + LOGW("Cannot find ntp-time"); + + break; + } #if 0 #if 0 diff --git a/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp b/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp index ab30b705d2e..6ee688390f4 100644 --- a/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp +++ b/netwerk/protocol/rtsp/rtsp/ARTPWriter.cpp @@ -140,7 +140,9 @@ status_t ARTPWriter::start(MetaData *params) { mNumSRsSent = 0; const char *mime; - CHECK(mSource->getFormat()->findCString(kKeyMIMEType, &mime)); + if (!mSource->getFormat()->findCString(kKeyMIMEType, &mime)) { + return ERROR_UNSUPPORTED; + } mMode = INVALID; if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) { diff --git a/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp b/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp index b512a8b1d29..2a15973aa7d 100644 --- a/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp +++ b/netwerk/protocol/rtsp/rtsp/ARTSPConnection.cpp @@ -748,8 +748,9 @@ bool ARTSPConnection::receiveRTSPResponse() { if (mAuthType == NONE && mUser.size() > 0 && parseAuthMethod(response)) { ssize_t i; - CHECK_EQ((status_t)OK, findPendingRequest(response, &i)); - CHECK_GE(i, 0); + if ((status_t)OK != findPendingRequest(response, &i) || i < 0) { + return false; + } sp reply = mPendingRequests.valueAt(i); mPendingRequests.removeItemsAt(i); @@ -779,7 +780,9 @@ bool ARTSPConnection::handleServerRequest(const sp &request) { // support the method. ssize_t space1 = request->mStatusLine.find(" "); - CHECK_GE(space1, 0); + if (space1 < 0) { + return false; + } AString response; response.append("RTSP/1.0 501 Not Implemented\r\n"); @@ -909,15 +912,19 @@ bool ARTSPConnection::parseAuthMethod(const sp &response) { if (!strncmp(value.c_str(), "Basic", 5)) { mAuthType = BASIC; } else { - - CHECK(!strncmp(value.c_str(), "Digest", 6)); + if (strncmp(value.c_str(), "Digest", 6)) { + return false; + } mAuthType = DIGEST; i = value.find("nonce="); - CHECK_GE(i, 0); - CHECK_EQ(value.c_str()[i + 6], '\"'); + if (i < 0 || value.c_str()[i + 6] != '\"') { + return false; + } ssize_t j = value.find("\"", i + 7); - CHECK_GE(j, 0); + if (j < 0) { + return false; + } mNonce.setTo(value, i + 7, j - i - 7); } @@ -983,16 +990,21 @@ static void H(const AString &s, AString *out) { } } -static void GetMethodAndURL( +static bool GetMethodAndURL( const AString &request, AString *method, AString *url) { ssize_t space1 = request.find(" "); - CHECK_GE(space1, 0); + if (space1 < 0) { + return false; + } ssize_t space2 = request.find(" ", space1 + 1); - CHECK_GE(space2, 0); + if (space2 < 0) { + return false; + } method->setTo(request, 0, space1); url->setTo(request, space1 + 1, space2 - space1); + return true; } void ARTSPConnection::addAuthentication(AString *request) { @@ -1002,7 +1014,10 @@ void ARTSPConnection::addAuthentication(AString *request) { // Find the boundary between headers and the body. ssize_t i = request->find("\r\n\r\n"); - CHECK_GE(i, 0); + if (i < 0) { + LOGE("Failed to find the boundary between headers and the body"); + return; + } if (mAuthType == BASIC) { AString tmp; @@ -1026,7 +1041,10 @@ void ARTSPConnection::addAuthentication(AString *request) { CHECK_EQ((int)mAuthType, (int)DIGEST); AString method, url; - GetMethodAndURL(*request, &method, &url); + if (!GetMethodAndURL(*request, &method, &url)) { + LOGE("Fail to get method and url"); + return; + } AString A1; A1.append(mUser); @@ -1076,7 +1094,9 @@ void ARTSPConnection::addAuthentication(AString *request) { void ARTSPConnection::addUserAgent(AString *request) const { // Find the boundary between headers and the body. ssize_t i = request->find("\r\n\r\n"); - CHECK_GE(i, 0); + if (i < 0) { + LOGE("Failed to find the boundary between headers and the body"); + } request->insert(mUserAgent, i + 2); } diff --git a/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp b/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp index 204bde5858e..ae27a78a2bc 100644 --- a/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp +++ b/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.cpp @@ -87,7 +87,7 @@ ARTPAssembler::AssemblyStatus ARawAudioAssembler::addPacket( queue->erase(queue->begin()); ++mNextExpectedSeqNo; - LOGV("raw audio packet too short."); + LOGW("raw audio packet too short."); return MALFORMED_PACKET; } @@ -120,22 +120,25 @@ bool ARawAudioAssembler::Supports(const char *desc) { } // static -void ARawAudioAssembler::MakeFormat( +bool ARawAudioAssembler::MakeFormat( const char *desc, const sp &format) { if (!strncmp(desc, "PCMU/", 5)) { format->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_G711_MLAW); } else if (!strncmp(desc, "PCMA/", 5)) { format->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_G711_ALAW); } else { - TRESPASS(); + return false; } int32_t sampleRate, numChannels; - ASessionDescription::ParseFormatDesc( - desc, &sampleRate, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + desc, &sampleRate, &numChannels)) { + return false; + } format->setInt32(kKeySampleRate, sampleRate); format->setInt32(kKeyChannelCount, numChannels); + return true; } } // namespace android diff --git a/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.h b/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.h index 89a94ec2170..8bc9dbbb4f5 100644 --- a/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.h +++ b/netwerk/protocol/rtsp/rtsp/ARawAudioAssembler.h @@ -34,7 +34,7 @@ struct ARawAudioAssembler : public ARTPAssembler { static bool Supports(const char *desc); - static void MakeFormat( + static bool MakeFormat( const char *desc, const sp &format); protected: diff --git a/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp b/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp index 63269fda056..48b0ead1377 100644 --- a/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp +++ b/netwerk/protocol/rtsp/rtsp/ASessionDescription.cpp @@ -201,12 +201,15 @@ bool ASessionDescription::getFormatType( getFormat(index, &format); const char *lastSpacePos = strrchr(format.c_str(), ' '); - CHECK(lastSpacePos != NULL); + if (!lastSpacePos) { + return false; + } char *end; unsigned long x = strtoul(lastSpacePos + 1, &end, 10); - CHECK_GT(end, lastSpacePos + 1); - CHECK_EQ(*end, '\0'); + if (end <= lastSpacePos + 1 || *end != '\0') { + return false; + } *PT = x; @@ -244,13 +247,15 @@ bool ASessionDescription::getDimensions( const char *s = value.c_str(); char *end; *width = strtoul(s, &end, 10); - CHECK_GT(end, s); - CHECK_EQ(*end, '-'); + if (end <= s || *end != '-') { + return false; + } s = end + 1; *height = strtoul(s, &end, 10); - CHECK_GT(end, s); - CHECK_EQ(*end, '\0'); + if (end <= s || *end != '\0') { + return false; + } return true; } @@ -258,7 +263,9 @@ bool ASessionDescription::getDimensions( bool ASessionDescription::getDurationUs(int64_t *durationUs) const { *durationUs = 0; - CHECK(mIsValid); + if (!mIsValid) { + return false; + } AString value; if (!findAttribute(0, "a=range", &value)) { @@ -280,16 +287,22 @@ bool ASessionDescription::getDurationUs(int64_t *durationUs) const { } // static -void ASessionDescription::ParseFormatDesc( +bool ASessionDescription::ParseFormatDesc( const char *desc, int32_t *timescale, int32_t *numChannels) { const char *slash1 = strchr(desc, '/'); - CHECK(slash1 != NULL); + if (!slash1) { + return false; + } const char *s = slash1 + 1; char *end; unsigned long x = strtoul(s, &end, 10); - CHECK_GT(end, s); - CHECK(*end == '\0' || *end == '/'); + if (end <= s) { + return false; + } + if (*end != '\0' && *end != '/') { + return false; + } *timescale = x; *numChannels = 1; @@ -297,11 +310,13 @@ void ASessionDescription::ParseFormatDesc( if (*end == '/') { s = end + 1; unsigned long x = strtoul(s, &end, 10); - CHECK_GT(end, s); - CHECK_EQ(*end, '\0'); + if (end <= s || *end != '\0') { + return false; + } *numChannels = x; } + return true; } // static diff --git a/netwerk/protocol/rtsp/rtsp/ASessionDescription.h b/netwerk/protocol/rtsp/rtsp/ASessionDescription.h index cfc52647eac..4b094a714bb 100644 --- a/netwerk/protocol/rtsp/rtsp/ASessionDescription.h +++ b/netwerk/protocol/rtsp/rtsp/ASessionDescription.h @@ -51,7 +51,7 @@ struct ASessionDescription : public RefBase { bool getDurationUs(int64_t *durationUs) const; - static void ParseFormatDesc( + static bool ParseFormatDesc( const char *desc, int32_t *timescale, int32_t *numChannels); bool findAttribute(size_t index, const char *key, AString *value) const; diff --git a/netwerk/protocol/rtsp/rtsp/RTSPConnectionHandler.h b/netwerk/protocol/rtsp/rtsp/RTSPConnectionHandler.h index 850b99176e1..1b6d50af366 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPConnectionHandler.h +++ b/netwerk/protocol/rtsp/rtsp/RTSPConnectionHandler.h @@ -22,6 +22,8 @@ #include "ARTSPConnection.h" #include "ASessionDescription.h" +#include "RtspPrlog.h" + #include #include @@ -561,10 +563,13 @@ struct RtspConnectionHandler : public AHandler { "get something usable..."); AString tmp; - CHECK(MakeURL( + if (!MakeURL( mSessionURL.c_str(), mBaseURL.c_str(), - &tmp)); + &tmp)) { + LOGE("Fail to make url"); + result = ERROR_UNSUPPORTED; + } mBaseURL = tmp; } @@ -776,9 +781,9 @@ struct RtspConnectionHandler : public AHandler { static_cast(obj.get()); if (response->mStatusCode != 200) { result = UNKNOWN_ERROR; + } else if (!parsePlayResponse(response)) { + result = UNKNOWN_ERROR; } else { - parsePlayResponse(response); - sp timeout = new AMessage(kWhatTimeout, id()); timeout->post(kPlayTimeoutUs); mPausePending = false; @@ -1145,11 +1150,14 @@ struct RtspConnectionHandler : public AHandler { if (response->mStatusCode != 200) { result = UNKNOWN_ERROR; + } else if (!parsePlayResponse(response)) { + result = UNKNOWN_ERROR; } else { - parsePlayResponse(response); - ssize_t i = response->mHeaders.indexOfKey("rtp-info"); - CHECK_GE(i, 0); + if (i < 0) { + LOGE("No RTP info in response"); + (new AMessage(kWhatAbort, id()))->post(); + } LOGV("rtp-info: %s", response->mHeaders.valueAt(i).c_str()); @@ -1178,7 +1186,10 @@ struct RtspConnectionHandler : public AHandler { sp buffer = static_cast(obj.get()); int32_t index; - CHECK(buffer->meta()->findInt32("index", &index)); + if (!buffer->meta()->findInt32("index", &index)) { + LOGW("Cannot find index"); + break; + } mRTPConn->injectPacket(index, buffer); break; @@ -1266,7 +1277,7 @@ struct RtspConnectionHandler : public AHandler { } } - void parsePlayResponse(const sp &response) { + bool parsePlayResponse(const sp &response) { mSeekable = false; for (size_t i = 0; i < mTracks.size(); ++i) { @@ -1278,25 +1289,31 @@ struct RtspConnectionHandler : public AHandler { if (i < 0) { // Server doesn't even tell use what range it is going to // play, therefore we won't support seeking. - return; + return false; } AString range = response->mHeaders.valueAt(i); LOGV("Range: %s", range.c_str()); AString val; - CHECK(GetAttribute(range.c_str(), "npt", &val)); + if (!GetAttribute(range.c_str(), "npt", &val)) { + LOGE("No npt attribute in range"); + return false; + } float npt1, npt2; if (!ASessionDescription::parseNTPRange(val.c_str(), &npt1, &npt2)) { // This is a live stream and therefore not seekable. LOGI("This is a live stream"); - return; + return false; } i = response->mHeaders.indexOfKey("rtp-info"); - CHECK_GE(i, 0); + if (i < 0) { + LOGE("No RTP info"); + return false; + } AString rtpInfo = response->mHeaders.valueAt(i); List streamInfos; @@ -1308,16 +1325,25 @@ struct RtspConnectionHandler : public AHandler { (*it).trim(); LOGV("streamInfo[%d] = %s", n, (*it).c_str()); - CHECK(GetAttribute((*it).c_str(), "url", &val)); + if (!GetAttribute((*it).c_str(), "url", &val)) { + LOGE("No url attribute"); + return false; + } size_t trackIndex = 0; while (trackIndex < mTracks.size() && !(val == mTracks.editItemAt(trackIndex).mURL)) { ++trackIndex; } - CHECK_LT(trackIndex, mTracks.size()); + if (trackIndex >= mTracks.size()) { + LOGE("No matching url"); + return false; + } - CHECK(GetAttribute((*it).c_str(), "seq", &val)); + if (!GetAttribute((*it).c_str(), "seq", &val)) { + LOGE("No seq attribute"); + return false; + } char *end; unsigned long seq = strtoul(val.c_str(), &end, 10); @@ -1326,7 +1352,10 @@ struct RtspConnectionHandler : public AHandler { info->mFirstSeqNumInSegment = seq; info->mNewSegment = true; - CHECK(GetAttribute((*it).c_str(), "rtptime", &val)); + if (!GetAttribute((*it).c_str(), "rtptime", &val)) { + LOGE("No rtptime attribute"); + return false; + } uint32_t rtpTime = strtoul(val.c_str(), &end, 10); @@ -1345,6 +1374,7 @@ struct RtspConnectionHandler : public AHandler { } mSeekable = true; + return true; } sp getTrackFormat(size_t index, int32_t *timeScale) { @@ -1440,10 +1470,26 @@ private: } AString url; - CHECK(mSessionDesc->findAttribute(index, "a=control", &url)); + if (!mSessionDesc->findAttribute(index, "a=control", &url)) { + LOGW("Unsupported format. Ignoring track #%d.", index); + + sp reply = new AMessage(kWhatSetup, id()); + reply->setSize("index", index); + reply->setInt32("result", ERROR_UNSUPPORTED); + reply->post(); + return; + } AString trackURL; - CHECK(MakeURL(mBaseURL.c_str(), url.c_str(), &trackURL)); + if (!MakeURL(mBaseURL.c_str(), url.c_str(), &trackURL)) { + LOGW("Unsupported format. Ignoring track #%d.", index); + + sp reply = new AMessage(kWhatSetup, id()); + reply->setSize("index", index); + reply->setInt32("result", ERROR_UNSUPPORTED); + reply->post(); + return; + } mTracks.push(TrackInfo()); TrackInfo *info = &mTracks.editItemAt(mTracks.size() - 1); @@ -1467,8 +1513,16 @@ private: int32_t timescale; int32_t numChannels; - ASessionDescription::ParseFormatDesc( - formatDesc.c_str(), ×cale, &numChannels); + if (!ASessionDescription::ParseFormatDesc( + formatDesc.c_str(), ×cale, &numChannels)) { + LOGW("Unsupported format. Ignoring track #%d.", index); + + sp reply = new AMessage(kWhatSetup, id()); + reply->setSize("index", index); + reply->setInt32("result", ERROR_UNSUPPORTED); + reply->post(); + return; + } info->mTimeScale = timescale; @@ -1617,8 +1671,11 @@ private: int32_t trackIndex, const TrackInfo *track, const sp &accessUnit) { uint32_t rtpTime; - CHECK(accessUnit->meta()->findInt32( - "rtp-time", (int32_t *)&rtpTime)); + if (!accessUnit->meta()->findInt32( + "rtp-time", (int32_t *)&rtpTime)) { + LOGE("No RTP time in access unit meta"); + return false; + } int64_t relRtpTimeUs = (((int64_t)rtpTime - (int64_t)track->mNormalPlayTimeRTP) * 1000000ll) diff --git a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp index 4eaaf17c90b..f0526cc07cd 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp +++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp @@ -595,20 +595,26 @@ void RTSPSource::onConnected(bool isSeekable) meta->SetTotalTracks(numTracks); meta->SetMimeType(mimeType); - CHECK(format->findInt64(kKeyDuration, &int64Value)); + bool success; + success = format->findInt64(kKeyDuration, &int64Value); + MOZ_ASSERT(success); meta->SetDuration(int64Value); if (isAudio) { - CHECK(format->findInt32(kKeyChannelCount, &int32Value)); + success = format->findInt32(kKeyChannelCount, &int32Value); + MOZ_ASSERT(success); meta->SetChannelCount(int32Value); - CHECK(format->findInt32(kKeySampleRate, &int32Value)); + success = format->findInt32(kKeySampleRate, &int32Value); + MOZ_ASSERT(success); meta->SetSampleRate(int32Value); } else { - CHECK(format->findInt32(kKeyWidth, &int32Value)); + success = format->findInt32(kKeyWidth, &int32Value); + MOZ_ASSERT(success); meta->SetWidth(int32Value); - CHECK(format->findInt32(kKeyHeight, &int32Value)); + success = format->findInt32(kKeyHeight, &int32Value); + MOZ_ASSERT(success); meta->SetHeight(int32Value); } @@ -706,8 +712,9 @@ void RTSPSource::onTrackDataAvailable(size_t trackIndex) meta = new mozilla::net::RtspMetaData(); - CHECK(accessUnit != NULL); - CHECK(accessUnit->meta()->findInt64("timeUs", &int64Value)); + MOZ_ASSERT(accessUnit != NULL); + bool success = accessUnit->meta()->findInt64("timeUs", &int64Value); + MOZ_ASSERT(success); meta->SetTimeStamp(int64Value); meta->SetFrameType(MEDIASTREAM_FRAMETYPE_NORMAL); diff --git a/netwerk/protocol/rtsp/rtsp/RTSPTransmitter.h b/netwerk/protocol/rtsp/rtsp/RTSPTransmitter.h index e53773a5688..3d70e27f108 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPTransmitter.h +++ b/netwerk/protocol/rtsp/rtsp/RTSPTransmitter.h @@ -266,28 +266,37 @@ struct MyTransmitter : public AHandler { } } - void authenticate(const sp &response) { + bool authenticate(const sp &response) { ssize_t i = response->mHeaders.indexOfKey("www-authenticate"); - CHECK_GE(i, 0); + if (i < 0) { + return false; + } AString value = response->mHeaders.valueAt(i); if (!strncmp(value.c_str(), "Basic", 5)) { mAuthType = BASIC; } else { - CHECK(!strncmp(value.c_str(), "Digest", 6)); + if (strncmp(value.c_str(), "Digest", 6)) { + return false; + } + mAuthType = DIGEST; i = value.find("nonce="); - CHECK_GE(i, 0); - CHECK_EQ(value.c_str()[i + 6], '\"'); + if (i < 0 || value.c_str()[i + 6] != '\"') { + return false; + } ssize_t j = value.find("\"", i + 7); - CHECK_GE(j, 0); + if (j < 0) { + return false; + } mNonce.setTo(value, i + 7, j - i - 7); } issueAnnounce(); + return true; } void addAuthentication( @@ -383,13 +392,11 @@ struct MyTransmitter : public AHandler { CHECK(response != NULL); if (response->mStatusCode == 401) { - if (mAuthType != NONE) { + if (mAuthType != NONE || !authenticate(response)) { LOG(INFO) << "FAILED to authenticate"; (new AMessage(kWhatQuit, id()))->post(); break; } - - authenticate(response); break; } } @@ -462,14 +469,24 @@ struct MyTransmitter : public AHandler { sp obj; CHECK(msg->findObject("response", &obj)); + if (!obj.get()) { + LOGE("No response to SETUP"); + (new AMessage(kWhatQuit, id()))->post(); + break; + } sp response; if (result == OK) { response = static_cast(obj.get()); - CHECK(response != NULL); + if (!response.get()) { + LOGE("No response to SETUP"); + (new AMessage(kWhatQuit, id()))->post(); + break; + } } if (result != OK || response->mStatusCode != 200) { + LOGE("SETUP error") (new AMessage(kWhatQuit, id()))->post(); break; } diff --git a/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp b/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp index 20b42304994..a5c3eb8f4d6 100644 --- a/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp +++ b/netwerk/protocol/rtsp/rtsp/UDPPusher.cpp @@ -86,7 +86,10 @@ bool UDPPusher::onPush() { length = fromlel(length); - CHECK_GT(length, 0u); + if (length <= 0u) { + LOGE("Zero length"); + return false; + } sp buffer = new ABuffer(length); if (fread(buffer->data(), 1, length, mFile) < length) { @@ -99,6 +102,10 @@ bool UDPPusher::onPush() { &mRemoteAddr, PR_INTERVAL_NO_WAIT); CHECK_EQ(n, (ssize_t)buffer->size()); + if (n != (ssize_t)buffer->size()) { + LOGE("Sizes don't match"); + return false; + } uint32_t timeMs; if (fread(&timeMs, 1, sizeof(timeMs), mFile) < sizeof(timeMs)) { @@ -107,7 +114,10 @@ bool UDPPusher::onPush() { } timeMs = fromlel(timeMs); - CHECK_GE(timeMs, mFirstTimeMs); + if (timeMs < mFirstTimeMs) { + LOGE("Time is wrong"); + return false; + } timeMs -= mFirstTimeMs; int64_t whenUs = mFirstTimeUs + timeMs * 1000ll; @@ -143,7 +153,7 @@ void UDPPusher::onMessageReceived(const sp &msg) { mSocket, buffer->data(), buffer->size(), 0, &tmp, PR_INTERVAL_NO_WAIT); - CHECK_EQ(n, (ssize_t)buffer->size()); + MOZ_ASSERT(n, (ssize_t)buffer->size()); } break; } From 9f2b38520448da61e5ea352fc7464fe36aa3e493 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 02:25:47 -0700 Subject: [PATCH 12/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/023d3928df2f Author: Greg Weng Desc: Merge pull request #25067 from snowmantw/bug1069879-2.2 Bug 1069879 - Only three dots shown when entering passcode ======== https://hg.mozilla.org/integration/gaia-central/rev/2fbd7ddec55f Author: Greg Weng Desc: Bug 1069879 - Only three dots shown when entering passcode --- 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 02017d43ee1..c6a4459d270 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c4d3584c0e9555532391e3ae3a87e708b08d3cf8", + "revision": "023d3928df2f85aa7204dc1fa38d5bc5324d8398", "repo_path": "/integration/gaia-central" } From 4b9ee53bc6ed3958b7ab200ac22b641050be7b04 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 02:31:57 -0700 Subject: [PATCH 13/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index fe8d1b3ee87..f3683907d17 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 63d7567f5bb..1bd43a0dbff 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 2501c0a2680..0376036c757 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 a007593c81c..8c94f69e41b 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 63d7567f5bb..1bd43a0dbff 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 28bf59b6dea..b52bceca1c8 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 739ea3ed408..1721033479c 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 089a1e34eb7..84c804e03cd 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 d7c74b6a5c5..cf01da46425 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 86a6b857c1a..bf1581fea24 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index b2e76790775..936ec7d0fc3 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From cc971795a299bf8f4c6106d831902263f3f7470e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 03:07:30 -0700 Subject: [PATCH 14/46] Bumping manifests a=b2g-bump --- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0376036c757..30fc09d0fa7 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -134,7 +134,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b52bceca1c8..7e80d0f902e 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -151,7 +151,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 1721033479c..d47f11753c3 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -145,7 +145,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index bf1581fea24..49dd02aa12d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -129,7 +129,7 @@ - + From 2c67ff2e59c289916280dc35042ec8ebf68a0f98 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 03:25:47 -0700 Subject: [PATCH 15/46] Bumping gaia.json for 5 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/7bce6f1246c0 Author: Timothy Guan-tin Chien Desc: Merge pull request #25252 from timdream/keyboard-state-queue2 Bug 1083638 - Control layout loading/unloading in an AbortablePromiseQueue, r=timdream ======== https://hg.mozilla.org/integration/gaia-central/rev/89629dd03c53 Author: Timothy Guan-tin Chien Desc: Bug 1083638 - Follow-up, marionette test for switch between inputs in the same frame ======== https://hg.mozilla.org/integration/gaia-central/rev/e630a253a2b6 Author: Timothy Guan-tin Chien Desc: Bug 1083638 - Control layout loading/unloading in an AbortablePromiseQueue ======== https://hg.mozilla.org/integration/gaia-central/rev/366f5299cb8f Author: George Desc: Merge pull request #25207 from cctuan/1075353 Bug 1075353 - 1st inline activity is not killed before the second inline activity comes. ======== https://hg.mozilla.org/integration/gaia-central/rev/42928a1343c4 Author: cctuan Desc: Bug 1075353 - 1st inline activity is not killed before the second inline activity comes. --- 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 c6a4459d270..bb4270dd5f2 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "023d3928df2f85aa7204dc1fa38d5bc5324d8398", + "revision": "7bce6f1246c04b2199eff59904edc833d9b25c5e", "repo_path": "/integration/gaia-central" } From 0608f59d0d2ff059f27f89134869dc02fb5281f0 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 03:31:57 -0700 Subject: [PATCH 16/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index f3683907d17..7b4cb33df8d 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 1bd43a0dbff..7fe3508c0f6 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 30fc09d0fa7..4ef6f86ba1b 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 8c94f69e41b..3eed6810ab4 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 1bd43a0dbff..7fe3508c0f6 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 7e80d0f902e..717d5e9d7d8 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d47f11753c3..f46415a9874 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 84c804e03cd..cc4c30b72aa 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 cf01da46425..5e1763fc9c9 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 49dd02aa12d..8e888e31f75 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 936ec7d0fc3..1b058e56d4b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 91f913f386176aca4c9c1c6c43f78a137d5d528e Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 1 Oct 2014 10:50:33 +0200 Subject: [PATCH 17/46] Bug 1074419: Close received socket file descriptors on errors, r=shawnjohnjr --- dom/bluetooth/bluedroid/BluetoothSocket.cpp | 5 ++++- dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp | 5 +++++ dom/bluetooth2/bluedroid/BluetoothSocket.cpp | 5 ++++- dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothSocket.cpp b/dom/bluetooth/bluedroid/BluetoothSocket.cpp index 4b89d23c17d..1be128eafd7 100644 --- a/dom/bluetooth/bluedroid/BluetoothSocket.cpp +++ b/dom/bluetooth/bluedroid/BluetoothSocket.cpp @@ -363,6 +363,8 @@ public: { MOZ_ASSERT(NS_IsMainThread()); + mozilla::ScopedClose fd(aFd); // Close received socket fd on error + if (mImpl->IsShutdownOnMainThread()) { BT_LOGD("mConsumer is null, aborting receive!"); return; @@ -374,7 +376,8 @@ public: } mImpl->mConsumer->SetAddress(aBdAddress); - XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new AcceptTask(mImpl, aFd)); + XRE_GetIOMessageLoop()->PostTask(FROM_HERE, + new AcceptTask(mImpl, fd.forget())); } void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE diff --git a/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp b/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp index a024dd79420..fcfc6f8b98b 100644 --- a/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothSocketHALInterface.cpp @@ -9,6 +9,7 @@ #include #include #include "BluetoothHALHelpers.h" +#include "mozilla/FileUtils.h" #include "nsClassHashtable.h" #include "nsXULAppAPI.h" @@ -485,6 +486,10 @@ public: void Proceed(BluetoothStatus aStatus) MOZ_OVERRIDE { + if ((aStatus != STATUS_SUCCESS) && (GetClientFd() != -1)) { + mozilla::ScopedClose(GetClientFd()); // Close received socket fd on error + } + DispatchBluetoothSocketHALResult( GetResultHandler(), &BluetoothSocketResultHandler::Accept, GetClientFd(), GetBdAddress(), GetConnectionStatus(), aStatus); diff --git a/dom/bluetooth2/bluedroid/BluetoothSocket.cpp b/dom/bluetooth2/bluedroid/BluetoothSocket.cpp index 4991f0d6292..f63ccb9b6f6 100644 --- a/dom/bluetooth2/bluedroid/BluetoothSocket.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothSocket.cpp @@ -363,6 +363,8 @@ public: { MOZ_ASSERT(NS_IsMainThread()); + mozilla::ScopedClose fd(aFd); // Close received socket fd on error + if (mImpl->IsShutdownOnMainThread()) { BT_LOGD("mConsumer is null, aborting receive!"); return; @@ -374,7 +376,8 @@ public: } mImpl->mConsumer->SetAddress(aBdAddress); - XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new AcceptTask(mImpl, aFd)); + XRE_GetIOMessageLoop()->PostTask(FROM_HERE, + new AcceptTask(mImpl, fd.forget())); } void OnError(BluetoothStatus aStatus) MOZ_OVERRIDE diff --git a/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp index eb2cb5c019f..e0bb66bf6de 100644 --- a/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothSocketHALInterface.cpp @@ -9,6 +9,7 @@ #include #include #include "BluetoothHALHelpers.h" +#include "mozilla/FileUtils.h" #include "nsClassHashtable.h" #include "nsXULAppAPI.h" @@ -485,6 +486,10 @@ public: void Proceed(BluetoothStatus aStatus) MOZ_OVERRIDE { + if ((aStatus != STATUS_SUCCESS) && (GetClientFd() != -1)) { + mozilla::ScopedClose(GetClientFd()); // Close received socket fd on error + } + DispatchBluetoothSocketHALResult( GetResultHandler(), &BluetoothSocketResultHandler::Accept, GetClientFd(), GetBdAddress(), GetConnectionStatus(), aStatus); From 5025b6715a5418b85bea8e2ca8d5c4a2fd886f2b Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Mon, 20 Oct 2014 13:45:30 +0300 Subject: [PATCH 18/46] Bug 1057688 - Skip doing a DNSPrefetch when LOAD_NO_NETWORK_IO or ONLY_FROM_CACHE flags are present r=mcmanus --- netwerk/protocol/http/nsHttpChannel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 5164b7f7dbb..7db6bb5dc2b 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -4857,10 +4857,13 @@ nsHttpChannel::BeginConnect() if (mLoadFlags & VALIDATE_ALWAYS || BYPASS_LOCAL_CACHE(mLoadFlags)) mCaps |= NS_HTTP_REFRESH_DNS; - if (!mConnectionInfo->UsingHttpProxy()) { + if (!mConnectionInfo->UsingHttpProxy() && + !(mLoadFlags & (LOAD_NO_NETWORK_IO | LOAD_ONLY_FROM_CACHE))) { // Start a DNS lookup very early in case the real open is queued the DNS can // happen in parallel. Do not do so in the presence of an HTTP proxy as // all lookups other than for the proxy itself are done by the proxy. + // Also we don't do a lookup if the LOAD_NO_NETWORK_IO or + // LOAD_ONLY_FROM_CACHE flags are set. // // We keep the DNS prefetch object around so that we can retrieve // timing information from it. There is no guarantee that we actually From e58beda89d94f27ac3afd4b8277e0b6c0cb4529c Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Mon, 20 Oct 2014 13:46:20 +0300 Subject: [PATCH 19/46] Bug 1082723 - Add IPv6 delimiters to nsLocation::GetHostname and Link::GetHostname r=smaug --- content/base/public/nsContentUtils.h | 6 ++++++ content/base/src/Link.cpp | 8 +------- content/base/src/nsContentUtils.cpp | 20 ++++++++++++++++++++ dom/base/URL.cpp | 12 +----------- dom/base/nsLocation.cpp | 13 ++----------- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 899b91bf103..0ae1c1fdbc6 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -2184,6 +2184,12 @@ public: */ static uint64_t GetInnerWindowID(nsIRequest* aRequest); + /** + * If the hostname for aURI is an IPv6 it encloses it in brackets, + * otherwise it just outputs the hostname in aHost. + */ + static void GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost); + private: static bool InitializeEventTable(); diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index 2d42795563f..3b2926324ad 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -361,13 +361,7 @@ Link::GetHostname(nsAString &_hostname, ErrorResult& aError) return; } - nsAutoCString host; - nsresult rv = uri->GetHost(host); - // Note that failure to get the host from the URI is not necessarily a bad - // thing. Some URIs do not have a host. - if (NS_SUCCEEDED(rv)) { - CopyUTF8toUTF16(host, _hostname); - } + nsContentUtils::GetHostOrIPv6WithBrackets(uri, _hostname); } void diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index ade188d74e2..e347523d84a 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -6998,3 +6998,23 @@ nsContentUtils::GetInnerWindowID(nsIRequest* aRequest) return inner ? inner->WindowID() : 0; } + +void +nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost) +{ + aHost.Truncate(); + nsAutoCString hostname; + nsresult rv = aURI->GetHost(hostname); + if (NS_FAILED(rv)) { // Some URIs do not have a host + return; + } + + if (hostname.FindChar(':') != -1) { // Escape IPv6 address + MOZ_ASSERT(!hostname.Length() || + (hostname[0] !='[' && hostname[hostname.Length() - 1] != ']')); + hostname.Insert('[', 0); + hostname.Append(']'); + } + + CopyUTF8toUTF16(hostname, aHost); +} diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index 4e651efb79f..0b98c295fa8 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -382,17 +382,7 @@ void URL::GetHostname(nsString& aHostname, ErrorResult& aRv) const { aHostname.Truncate(); - nsAutoCString tmp; - nsresult rv = mURI->GetHost(tmp); - if (NS_SUCCEEDED(rv)) { - if (tmp.FindChar(':') != -1) { // Escape IPv6 address - MOZ_ASSERT(!tmp.Length() || - (tmp[0] !='[' && tmp[tmp.Length() - 1] != ']')); - tmp.Insert('[', 0); - tmp.Append(']'); - } - CopyUTF8toUTF16(tmp, aHostname); - } + nsContentUtils::GetHostOrIPv6WithBrackets(mURI, aHostname); } void diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index 2ccd1be6bbc..2146cf3a688 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -407,18 +407,9 @@ nsLocation::GetHostname(nsAString& aHostname) aHostname.Truncate(); nsCOMPtr uri; - nsresult result; - - result = GetURI(getter_AddRefs(uri), true); - + GetURI(getter_AddRefs(uri), true); if (uri) { - nsAutoCString host; - - result = uri->GetHost(host); - - if (NS_SUCCEEDED(result)) { - AppendUTF8toUTF16(host, aHostname); - } + nsContentUtils::GetHostOrIPv6WithBrackets(uri, aHostname); } return NS_OK; From bafe189f4518f90d9b0ddbe29ccd3b8291e1c445 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Mon, 20 Oct 2014 13:47:26 +0300 Subject: [PATCH 20/46] Bug 1082723 - Remove expected FAIL for a-element IPv6 web-platform tests r=smaug --- testing/web-platform/meta/url/a-element.html.ini | 6 ------ testing/web-platform/meta/url/a-element.xhtml.ini | 6 ------ 2 files changed, 12 deletions(-) diff --git a/testing/web-platform/meta/url/a-element.html.ini b/testing/web-platform/meta/url/a-element.html.ini index 49e21ab629e..0d95fc51bd1 100644 --- a/testing/web-platform/meta/url/a-element.html.ini +++ b/testing/web-platform/meta/url/a-element.html.ini @@ -84,12 +84,6 @@ [Parsing: against ] expected: FAIL - [Parsing: against ] - expected: FAIL - - [Parsing: against ] - expected: FAIL - [Parsing: against ] expected: FAIL diff --git a/testing/web-platform/meta/url/a-element.xhtml.ini b/testing/web-platform/meta/url/a-element.xhtml.ini index 1ee62296774..45452d39659 100644 --- a/testing/web-platform/meta/url/a-element.xhtml.ini +++ b/testing/web-platform/meta/url/a-element.xhtml.ini @@ -84,12 +84,6 @@ [Parsing: against ] expected: FAIL - [Parsing: against ] - expected: FAIL - - [Parsing: against ] - expected: FAIL - [Parsing: against ] expected: FAIL From 5ddc4c01d7b602d6708113b11ecaaa4064187fd6 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 20 Oct 2014 10:55:48 +0100 Subject: [PATCH 21/46] Bug 1085159 - Port the code that uses nsRenderingContext::DrawLine() to Moz2D. r=mattwoodrow --HG-- extra : rebase_source : 70553292850517d695994c0a3422fab8ea0b760a --- gfx/src/nsRenderingContext.cpp | 52 ------------------- gfx/src/nsRenderingContext.h | 5 -- layout/base/nsCSSRendering.cpp | 8 ++- layout/base/nsLayoutUtils.cpp | 13 +++++ layout/base/nsLayoutUtils.h | 7 +++ layout/generic/nsFrameSetFrame.cpp | 80 ++++++++++++++++-------------- layout/tables/nsTableCellFrame.cpp | 25 ++++++---- layout/xul/nsBoxFrame.cpp | 50 ++++++++++--------- layout/xul/nsBoxFrame.h | 16 ++++-- 9 files changed, 122 insertions(+), 134 deletions(-) diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 663b894d96f..b91fdefca2d 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -111,58 +111,6 @@ nsRenderingContext::SetColor(nscolor aColor) mThebes->SetColor(gfxRGBA(aColor)); } -// -// shapes -// - -void -nsRenderingContext::DrawLine(const nsPoint& aStartPt, const nsPoint& aEndPt) -{ - DrawLine(aStartPt.x, aStartPt.y, aEndPt.x, aEndPt.y); -} - -void -nsRenderingContext::DrawLine(nscoord aX0, nscoord aY0, - nscoord aX1, nscoord aY1) -{ - gfxPoint p0 = gfxPoint(FROM_TWIPS(aX0), FROM_TWIPS(aY0)); - gfxPoint p1 = gfxPoint(FROM_TWIPS(aX1), FROM_TWIPS(aY1)); - - // we can't draw thick lines with gfx, so we always assume we want - // pixel-aligned lines if the rendering context is at 1.0 scale - gfxMatrix savedMatrix = mThebes->CurrentMatrix(); - if (!savedMatrix.HasNonTranslation()) { - p0 = mThebes->UserToDevice(p0); - p1 = mThebes->UserToDevice(p1); - - p0.Round(); - p1.Round(); - - mThebes->SetMatrix(gfxMatrix()); - - mThebes->NewPath(); - - // snap straight lines - if (p0.x == p1.x) { - mThebes->Line(p0 + gfxPoint(0.5, 0), - p1 + gfxPoint(0.5, 0)); - } else if (p0.y == p1.y) { - mThebes->Line(p0 + gfxPoint(0, 0.5), - p1 + gfxPoint(0, 0.5)); - } else { - mThebes->Line(p0, p1); - } - - mThebes->Stroke(); - - mThebes->SetMatrix(savedMatrix); - } else { - mThebes->NewPath(); - mThebes->Line(p0, p1); - mThebes->Stroke(); - } -} - // // text diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 82287e44358..78ada4e3a07 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -52,11 +52,6 @@ public: void IntersectClip(const nsRect& aRect); void SetColor(nscolor aColor); - // Shapes - - void DrawLine(const nsPoint& aStartPt, const nsPoint& aEndPt); - void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1); - // Text void SetFont(nsFontMetrics *aFontMetrics); diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 0d8437c8e03..ed0b87039f9 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -3507,14 +3507,18 @@ DrawSolidBorderSegment(nsRenderingContext& aContext, // simple line or rectangle if ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide)) { if (1 == aRect.height) - aContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft()); + StrokeLineWithSnapping(aRect.TopLeft(), aRect.BottomLeft(), + appUnitsPerDevPixel, *drawTarget, + color, StrokeOptions(), drawOptions); else drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget), color, drawOptions); } else { if (1 == aRect.width) - aContext.DrawLine(aRect.TopLeft(), aRect.TopRight()); + StrokeLineWithSnapping(aRect.TopLeft(), aRect.TopRight(), + appUnitsPerDevPixel, *drawTarget, + color, StrokeOptions(), drawOptions); else drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget), color, drawOptions); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 173634d8194..33f13fb53ae 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -7060,6 +7060,19 @@ Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel, return rect; } +void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2, + int32_t aAppUnitsPerDevPixel, + DrawTarget& aDrawTarget, + const Pattern& aPattern, + const StrokeOptions& aStrokeOptions, + const DrawOptions& aDrawOptions) +{ + Point p1 = NSPointToPoint(aP1, aAppUnitsPerDevPixel); + Point p2 = NSPointToPoint(aP2, aAppUnitsPerDevPixel); + SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget); + aDrawTarget.StrokeLine(p1, p2, aPattern, aStrokeOptions, aDrawOptions); +} + namespace layout { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index b1671987884..ff27096d09b 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2425,6 +2425,13 @@ gfx::Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel); gfx::Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel, const gfx::DrawTarget& aSnapDT); +void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2, + int32_t aAppUnitsPerDevPixel, + gfx::DrawTarget& aDrawTarget, + const gfx::Pattern& aPattern, + const gfx::StrokeOptions& aStrokeOptions = gfx::StrokeOptions(), + const gfx::DrawOptions& aDrawOptions = gfx::DrawOptions()); + namespace layout { /** diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 16aa284af83..0ce0a8972e4 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -11,6 +11,7 @@ #include "gfxUtils.h" #include "mozilla/DebugOnly.h" #include "mozilla/gfx/2D.h" +#include "mozilla/gfx/Helpers.h" #include "mozilla/Likely.h" #include "nsGenericHTMLElement.h" @@ -111,7 +112,7 @@ public: void SetVisibility(bool aVisibility); void SetColor(nscolor aColor); - void PaintBorder(nsRenderingContext& aRenderingContext, nsPoint aPt); + void PaintBorder(DrawTarget* aDrawTarget, nsPoint aPt); protected: nsHTMLFramesetBorderFrame(nsStyleContext* aContext, int32_t aWidth, bool aVertical, bool aVisible); @@ -1491,7 +1492,7 @@ void nsDisplayFramesetBorder::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) { static_cast(mFrame)-> - PaintBorder(*aCtx, ToReferenceFrame()); + PaintBorder(aCtx->GetDrawTarget(), ToReferenceFrame()); } void @@ -1503,49 +1504,52 @@ nsHTMLFramesetBorderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, new (aBuilder) nsDisplayFramesetBorder(aBuilder, this)); } -void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContext, +void nsHTMLFramesetBorderFrame::PaintBorder(DrawTarget* aDrawTarget, nsPoint aPt) { - nscolor WHITE = NS_RGB(255, 255, 255); - - nscolor bgColor = - LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground, - NS_RGB(200,200,200)); - nscolor fgColor = - LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground, - NS_RGB(0,0,0)); - nscolor hltColor = - LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight, - NS_RGB(255,255,255)); - nscolor sdwColor = - LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow, - NS_RGB(128,128,128)); - - gfxContext* ctx = aRenderingContext.ThebesContext(); - - gfxPoint toRefFrame = - nsLayoutUtils::PointToGfxPoint(aPt, PresContext()->AppUnitsPerDevPixel()); - - gfxContextMatrixAutoSaveRestore autoSR(ctx); - ctx->SetMatrix(ctx->CurrentMatrix().Translate(toRefFrame)); - nscoord widthInPixels = nsPresContext::AppUnitsToIntCSSPixels(mWidth); nscoord pixelWidth = nsPresContext::CSSPixelsToAppUnits(1); if (widthInPixels <= 0) return; - nsPoint start(0,0); - nsPoint end((mVertical) ? 0 : mRect.width, (mVertical) ? mRect.height : 0); + ColorPattern bgColor(ToDeviceColor( + LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground, + NS_RGB(200, 200, 200)))); - nscolor color = WHITE; + ColorPattern fgColor(ToDeviceColor( + LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground, + NS_RGB(0, 0, 0)))); + + ColorPattern hltColor(ToDeviceColor( + LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight, + NS_RGB(255, 255, 255)))); + + ColorPattern sdwColor(ToDeviceColor( + LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow, + NS_RGB(128, 128, 128)))); + + ColorPattern color(ToDeviceColor(NS_RGB(255, 255, 255))); // default to white if (mVisibility || mVisibilityOverride) { - color = (NO_COLOR == mColor) ? bgColor : mColor; + color = (NO_COLOR == mColor) ? bgColor : + ColorPattern(ToDeviceColor(mColor)); } - aRenderingContext.SetColor(color); + + int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel(); + + Point toRefFrame = NSPointToPoint(aPt, appUnitsPerDevPixel); + + AutoRestoreTransform autoRestoreTransform(aDrawTarget); + aDrawTarget->SetTransform( + aDrawTarget->GetTransform().PreTranslate(toRefFrame)); + + nsPoint start(0, 0); + nsPoint end = mVertical ? nsPoint(0, mRect.height) : nsPoint(mRect.width, 0); + // draw grey or white first for (int i = 0; i < widthInPixels; i++) { - aRenderingContext.DrawLine (start, end); + StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget, + color); if (mVertical) { start.x += pixelWidth; end.x = start.x; @@ -1559,30 +1563,30 @@ void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContex return; if (widthInPixels >= 5) { - aRenderingContext.SetColor(hltColor); start.x = (mVertical) ? pixelWidth : 0; start.y = (mVertical) ? 0 : pixelWidth; end.x = (mVertical) ? start.x : mRect.width; end.y = (mVertical) ? mRect.height : start.y; - aRenderingContext.DrawLine(start, end); + StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget, + hltColor); } if (widthInPixels >= 2) { - aRenderingContext.SetColor(sdwColor); start.x = (mVertical) ? mRect.width - (2 * pixelWidth) : 0; start.y = (mVertical) ? 0 : mRect.height - (2 * pixelWidth); end.x = (mVertical) ? start.x : mRect.width; end.y = (mVertical) ? mRect.height : start.y; - aRenderingContext.DrawLine(start, end); + StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget, + sdwColor); } if (widthInPixels >= 1) { - aRenderingContext.SetColor(fgColor); start.x = (mVertical) ? mRect.width - pixelWidth : 0; start.y = (mVertical) ? 0 : mRect.height - pixelWidth; end.x = (mVertical) ? start.x : mRect.width; end.y = (mVertical) ? mRect.height : start.y; - aRenderingContext.DrawLine(start, end); + StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget, + fgColor); } } diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 6a0659aa6d3..6c300f78f87 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -335,21 +335,28 @@ nsTableCellFrame::DecorateForSelection(nsRenderingContext& aRenderingContext, nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1); - aRenderingContext.SetColor(bordercolor); - aRenderingContext.DrawLine(onePixel, 0, mRect.width, 0); - aRenderingContext.DrawLine(0, onePixel, 0, mRect.height); - aRenderingContext.DrawLine(onePixel, mRect.height, mRect.width, mRect.height); - aRenderingContext.DrawLine(mRect.width, onePixel, mRect.width, mRect.height); + StrokeLineWithSnapping(nsPoint(onePixel, 0), nsPoint(mRect.width, 0), + appUnitsPerDevPixel, *drawTarget, color); + StrokeLineWithSnapping(nsPoint(0, onePixel), nsPoint(0, mRect.height), + appUnitsPerDevPixel, *drawTarget, color); + StrokeLineWithSnapping(nsPoint(onePixel, mRect.height), + nsPoint(mRect.width, mRect.height), + appUnitsPerDevPixel, *drawTarget, color); + StrokeLineWithSnapping(nsPoint(mRect.width, onePixel), + nsPoint(mRect.width, mRect.height), + appUnitsPerDevPixel, *drawTarget, color); //middle nsRect r(onePixel, onePixel, mRect.width - onePixel, mRect.height - onePixel); Rect devPixelRect = NSRectToRect(r, appUnitsPerDevPixel, *drawTarget); drawTarget->StrokeRect(devPixelRect, color); //shading - aRenderingContext.DrawLine(2*onePixel, mRect.height-2*onePixel, - mRect.width-onePixel, mRect.height- (2*onePixel)); - aRenderingContext.DrawLine(mRect.width - (2*onePixel), 2*onePixel, - mRect.width - (2*onePixel), mRect.height-onePixel); + StrokeLineWithSnapping(nsPoint(2*onePixel, mRect.height-2*onePixel), + nsPoint(mRect.width-onePixel, mRect.height- (2*onePixel)), + appUnitsPerDevPixel, *drawTarget, color); + StrokeLineWithSnapping(nsPoint(mRect.width - (2*onePixel), 2*onePixel), + nsPoint(mRect.width - (2*onePixel), mRect.height-onePixel), + appUnitsPerDevPixel, *drawTarget, color); } } } diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index 4bca3f853ee..6b9544078af 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -37,6 +37,7 @@ #include "mozilla/gfx/2D.h" #include "nsBoxLayoutState.h" #include "mozilla/dom/Touch.h" +#include "mozilla/Move.h" #include "nsStyleContext.h" #include "nsPlaceholderFrame.h" #include "nsPresContext.h" @@ -1292,7 +1293,7 @@ nsDisplayXULDebug::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) { static_cast(mFrame)-> - PaintXULDebugOverlay(*aCtx, ToReferenceFrame()); + PaintXULDebugOverlay(*aCtx->GetDrawTarget(), ToReferenceFrame()); } static void @@ -1472,8 +1473,7 @@ nsBoxFrame::PaintXULDebugBackground(nsRenderingContext& aRenderingContext, } void -nsBoxFrame::PaintXULDebugOverlay(nsRenderingContext& aRenderingContext, - nsPoint aPt) +nsBoxFrame::PaintXULDebugOverlay(DrawTarget& aDrawTarget, nsPoint aPt) nsMargin border; GetBorder(border); @@ -1516,14 +1516,12 @@ nsBoxFrame::PaintXULDebugOverlay(nsRenderingContext& aRenderingContext, nscoord flex = kid->GetFlex(state); if (!kid->IsCollapsed()) { - aRenderingContext.SetColor(NS_RGB(255,255,255)); - if (isHorizontal) borderSize = cr.width; else borderSize = cr.height; - - DrawSpacer(GetPresContext(), aRenderingContext, isHorizontal, flex, x, y, borderSize, spacerSize); + + DrawSpacer(GetPresContext(), aDrawTarget, isHorizontal, flex, x, y, borderSize, spacerSize); } kid = GetNextBox(kid); @@ -1598,28 +1596,34 @@ nsBoxFrame::GetDebug(bool& aDebug) #ifdef DEBUG_LAYOUT void -nsBoxFrame::DrawLine(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2) +nsBoxFrame::DrawLine(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2) { - if (aHorizontal) - aRenderingContext.DrawLine(x1,y1,x2,y2); - else - aRenderingContext.DrawLine(y1,x1,y2,x2); + nsPoint p1(x1, y1); + nsPoint p2(x2, y2); + if (!aHorizontal) { + Swap(p1.x, p1.y); + Swap(p2.x, p2.y); + } + ColorPattern white(ToDeviceColor(Color(1.f, 1.f, 1.f, 1.f))); + StrokeLineWithSnapping(p1, p2, PresContext()->AppUnitsPerDevPixel(), + aDrawTarget, color); } void -nsBoxFrame::FillRect(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height) +nsBoxFrame::FillRect(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height) { - DrawTarget* drawTarget = aRenderingContext->GetDrawTarget(); Rect rect = NSRectToRect(aHorizontal ? nsRect(x, y, width, height) : nsRect(y, x, height, width), PresContext()->AppUnitsPerDevPixel(), - *drawTarget); + aDrawTarget); ColorPattern white(ToDeviceColor(Color(1.f, 1.f, 1.f, 1.f))); - drawTarget->FillRect(rect, white); + aDrawTarget.FillRect(rect, white); } void -nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize) +nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, DrawTarget& aDrawTarget, + bool aHorizontal, int32_t flex, nscoord x, nscoord y, + nscoord size, nscoord spacerSize) { nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1); @@ -1639,21 +1643,19 @@ nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderi int halfCoilSize = coilSize/2; if (flex == 0) { - DrawLine(aRenderingContext, aHorizontal, x,y + spacerSize/2, x + size, y + spacerSize/2); + DrawLine(aDrawTarget, aHorizontal, x,y + spacerSize/2, x + size, y + spacerSize/2); } else { for (int i=0; i < coils; i++) { - DrawLine(aRenderingContext, aHorizontal, offset, center+halfSpacer, offset+halfCoilSize, center-halfSpacer); - DrawLine(aRenderingContext, aHorizontal, offset+halfCoilSize, center-halfSpacer, offset+coilSize, center+halfSpacer); + DrawLine(aDrawTarget, aHorizontal, offset, center+halfSpacer, offset+halfCoilSize, center-halfSpacer); + DrawLine(aDrawTarget, aHorizontal, offset+halfCoilSize, center-halfSpacer, offset+coilSize, center+halfSpacer); offset += coilSize; } } - FillRect(aRenderingContext, aHorizontal, x + size - spacerSize/2, y, spacerSize/2, spacerSize); - FillRect(aRenderingContext, aHorizontal, x, y, spacerSize/2, spacerSize); - - //DrawKnob(aPresContext, aRenderingContext, x + size - spacerSize, y, spacerSize); + FillRect(aDrawTarget, aHorizontal, x + size - spacerSize/2, y, spacerSize/2, spacerSize); + FillRect(aDrawTarget, aHorizontal, x, y, spacerSize/2, spacerSize); } void diff --git a/layout/xul/nsBoxFrame.h b/layout/xul/nsBoxFrame.h index 1e249641c35..47b24a39403 100644 --- a/layout/xul/nsBoxFrame.h +++ b/layout/xul/nsBoxFrame.h @@ -21,6 +21,12 @@ class nsBoxLayoutState; +namespace mozilla { +namespace gfx { +class DrawTarget; +} +} + nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot, @@ -30,6 +36,8 @@ nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, class nsBoxFrame : public nsContainerFrame { + typedef mozilla::gfx::DrawTarget DrawTarget; + public: NS_DECL_FRAMEARENA_HELPERS #ifdef DEBUG @@ -174,7 +182,7 @@ protected: virtual void GetBoxName(nsAutoString& aName) MOZ_OVERRIDE; void PaintXULDebugBackground(nsRenderingContext& aRenderingContext, nsPoint aPt); - void PaintXULDebugOverlay(nsRenderingContext& aRenderingContext, + void PaintXULDebugOverlay(DrawTarget& aRenderingContext, nsPoint aPt); #endif @@ -224,9 +232,9 @@ private: void GetValue(nsPresContext* aPresContext, const nsSize& a, const nsSize& b, char* value); void GetValue(nsPresContext* aPresContext, int32_t a, int32_t b, char* value); - void DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize); - void DrawLine(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2); - void FillRect(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height); + void DrawSpacer(nsPresContext* aPresContext, DrawTarget& aDrawTarget, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize); + void DrawLine(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2); + void FillRect(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height); #endif virtual void UpdateMouseThrough(); From ee86633d81831703c013415fd929c7d1336144af Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 20 Oct 2014 10:55:48 +0100 Subject: [PATCH 22/46] Bug 1085160 - Port the code that uses nsRenderingContext::IntersectClip() to Moz2D. r=mattwoodrow --HG-- extra : rebase_source : 54226509a1b16efdc76f92f202cc2be07cf43ab4 --- gfx/src/nsRenderingContext.cpp | 17 ------------ gfx/src/nsRenderingContext.h | 1 - gfx/thebes/gfxContext.cpp | 14 +++++++--- gfx/thebes/gfxContext.h | 3 ++- layout/base/nsCSSRendering.cpp | 14 +++++++--- layout/base/nsDisplayList.cpp | 10 ++++--- layout/forms/nsComboboxControlFrame.cpp | 10 ++++--- layout/forms/nsFieldSetFrame.cpp | 28 +++++++++++--------- layout/generic/nsImageFrame.cpp | 9 ++++--- layout/generic/nsPageFrame.cpp | 14 +++++++--- layout/svg/nsSVGIntegrationUtils.cpp | 8 ++++-- layout/svg/nsSVGUtils.cpp | 6 ++++- layout/xul/nsBoxFrame.h | 1 + layout/xul/nsGroupBoxFrame.cpp | 35 ++++++++++++++----------- layout/xul/tree/nsTreeBodyFrame.cpp | 11 +++++--- 15 files changed, 110 insertions(+), 71 deletions(-) diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index b91fdefca2d..9a07749f4fc 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -85,23 +85,6 @@ nsRenderingContext::Init(nsDeviceContext* aContext, // graphics state // -void -nsRenderingContext::IntersectClip(const nsRect& aRect) -{ - mThebes->NewPath(); - gfxRect clipRect(GFX_RECT_FROM_TWIPS_RECT(aRect)); - if (mThebes->UserToDevicePixelSnapped(clipRect, true)) { - gfxMatrix mat(mThebes->CurrentMatrix()); - mat.Invert(); - clipRect = mat.Transform(clipRect); - mThebes->Rectangle(clipRect); - } else { - mThebes->Rectangle(clipRect); - } - - mThebes->Clip(); -} - void nsRenderingContext::SetColor(nscolor aColor) { diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 78ada4e3a07..d85eceac1fb 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -49,7 +49,6 @@ public: // Graphics state - void IntersectClip(const nsRect& aRect); void SetColor(nscolor aColor); // Text diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index 927cc3556c6..67cc2934fc4 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -721,13 +721,19 @@ gfxContext::CurrentFillRule() const } // clipping +void +gfxContext::Clip(const Rect& rect) +{ + AzureState::PushedClip clip = { nullptr, rect, mTransform }; + CurrentState().pushedClips.AppendElement(clip); + mDT->PushClipRect(rect); + NewPath(); +} + void gfxContext::Clip(const gfxRect& rect) { - AzureState::PushedClip clip = { nullptr, ToRect(rect), mTransform }; - CurrentState().pushedClips.AppendElement(clip); - mDT->PushClipRect(ToRect(rect)); - NewPath(); + Clip(ToRect(rect)); } void diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h index a1a9e1ad6bd..5f95d1d3e28 100644 --- a/gfx/thebes/gfxContext.h +++ b/gfx/thebes/gfxContext.h @@ -40,6 +40,7 @@ class gfxContext MOZ_FINAL { typedef mozilla::gfx::FillRule FillRule; typedef mozilla::gfx::Path Path; typedef mozilla::gfx::Pattern Pattern; + typedef mozilla::gfx::Rect Rect; NS_INLINE_DECL_REFCOUNTING(gfxContext) @@ -531,6 +532,7 @@ public: * Helper functions that will create a rect path and call Clip(). * Any current path will be destroyed by these functions! */ + void Clip(const Rect& rect); void Clip(const gfxRect& rect); // will clip to a rect /** @@ -613,7 +615,6 @@ private: typedef mozilla::gfx::Color Color; typedef mozilla::gfx::StrokeOptions StrokeOptions; typedef mozilla::gfx::Float Float; - typedef mozilla::gfx::Rect Rect; typedef mozilla::gfx::CompositionOp CompositionOp; typedef mozilla::gfx::PathBuilder PathBuilder; typedef mozilla::gfx::SourceSurface SourceSurface; diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index ed0b87039f9..395ac6a5396 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -683,7 +683,10 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext, } else { // We're drawing borders around the joined continuation boxes so we need // to clip that to the slice that we want for this frame. - aRenderingContext.IntersectClip(aBorderArea); + aRenderingContext.ThebesContext()-> + Clip(NSRectToRect(aBorderArea, + aForFrame->PresContext()->AppUnitsPerDevPixel(), + *aRenderingContext.GetDrawTarget())); } } else { MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea), @@ -1368,7 +1371,10 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext, } } } - aRenderingContext.IntersectClip(fragmentClip); + aRenderingContext.ThebesContext()-> + Clip(NSRectToRect(fragmentClip, + aForFrame->PresContext()->AppUnitsPerDevPixel(), + *aRenderingContext.GetDrawTarget())); gfxCornerSizes clipRectRadii; if (hasBorderRadius) { @@ -3207,7 +3213,9 @@ DrawBorderImage(nsPresContext* aPresContext, nsRect clip = aBorderArea; clip.Inflate(imageOutset); autoSR.EnsureSaved(aRenderingContext.ThebesContext()); - aRenderingContext.IntersectClip(clip); + aRenderingContext.ThebesContext()-> + Clip(NSRectToRect(clip, aForFrame->PresContext()->AppUnitsPerDevPixel(), + *aRenderingContext.GetDrawTarget())); } } else { borderImgArea = aBorderArea; diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 7f3db0a27fe..26895c46978 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3062,12 +3062,16 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder, PROFILER_LABEL("nsDisplayBoxShadowInner", "Paint", js::ProfileEntry::Category::GRAPHICS); + DrawTarget* drawTarget = aCtx->GetDrawTarget(); + gfxContext* gfx = aCtx->ThebesContext(); + int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); + for (uint32_t i = 0; i < rects.Length(); ++i) { - aCtx->ThebesContext()->Save(); - aCtx->IntersectClip(rects[i]); + gfx->Save(); + gfx->Clip(NSRectToRect(rects[i], appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBoxShadowInner(presContext, *aCtx, mFrame, borderRect, rects[i]); - aCtx->ThebesContext()->Restore(); + gfx->Restore(); } } diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index b182f3846ca..ce13584a304 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1505,9 +1505,13 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext, if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || sFocused != this) return; - aRenderingContext.ThebesContext()->Save(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + + gfx->Save(); nsRect clipRect = mDisplayFrame->GetRect() + aPt; - aRenderingContext.IntersectClip(clipRect); + gfx->Clip(NSRectToRect(clipRect, + PresContext()->AppUnitsPerDevPixel(), + *aRenderingContext.GetDrawTarget())); // REVIEW: Why does the old code paint mDisplayFrame again? We've // already painted it in the children above. So clipping it here won't do @@ -1527,7 +1531,7 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext, StrokeSnappedEdgesOfRect(r, *aRenderingContext.GetDrawTarget(), color, strokeOptions); - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); } //--------------------------------------------------------- diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index 0a8ed8bd2d8..9c7737ba90e 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -5,7 +5,9 @@ #include "nsFieldSetFrame.h" +#include "mozilla/gfx/2D.h" #include "nsCSSAnonBoxes.h" +#include "nsLayoutUtils.h" #include "nsLegendFrame.h" #include "nsCSSRendering.h" #include @@ -21,6 +23,7 @@ #include "mozilla/Maybe.h" using namespace mozilla; +using namespace mozilla::gfx; using namespace mozilla::layout; nsContainerFrame* @@ -219,12 +222,15 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.width = legendRect.x - rect.x; clipRect.height = topBorder; - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); + + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext); - - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); // draw right side @@ -233,12 +239,11 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.width = rect.XMost() - legendRect.XMost(); clipRect.height = topBorder; - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext); - - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); // draw bottom @@ -246,12 +251,11 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.y += topBorder; clipRect.height = mRect.height - (yoff + topBorder); - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext); - - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); } else { nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index ac638ba2196..7acdccae3d0 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1220,9 +1220,13 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext, return; } + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + // Clip so we don't render outside the inner rect - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(inner); + gfx->Save(); + gfx->Clip(NSRectToRect(inner, PresContext()->AppUnitsPerDevPixel(), + *drawTarget)); // Check if we should display image placeholders if (gIconLoad->mPrefShowPlaceholders) { @@ -1261,7 +1265,6 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext, // just draw some graffiti in the mean time if (!iconUsed) { ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f))); - DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); nscoord iconXPos = (vis->mDirection == NS_STYLE_DIRECTION_RTL) ? inner.XMost() - size : inner.x; diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 249bb4d6a7b..b0176979158 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -4,6 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsPageFrame.h" + +#include "mozilla/gfx/2D.h" +#include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsRenderingContext.h" #include "nsGkAtoms.h" @@ -25,6 +28,7 @@ extern PRLogModuleInfo *GetLayoutPrintingLog(); #endif using namespace mozilla; +using namespace mozilla::gfx; nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -372,12 +376,16 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext, y = aRect.YMost() - aHeight - mPD->mEdgePaperMargin.bottom; } + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + // set up new clip and draw the text - aRenderingContext.ThebesContext()->Save(); + gfx->Save(); + gfx->Clip(NSRectToRect(aRect, PresContext()->AppUnitsPerDevPixel(), + *drawTarget)); aRenderingContext.SetColor(NS_RGB(0,0,0)); - aRenderingContext.IntersectClip(aRect); nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent)); - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); } } diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index b0e523adbc1..4a83ea82350 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -473,6 +473,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, bool isTrivialClip = clipPathFrame ? clipPathFrame->IsTrivial() : true; + DrawTarget* drawTarget = aCtx->GetDrawTarget(); gfxContext* gfx = aCtx->ThebesContext(); gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx); @@ -519,8 +520,11 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, || aFrame->StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) { complexEffects = true; gfx->Save(); - aCtx->IntersectClip(aFrame->GetVisualOverflowRectRelativeToSelf() + - toUserSpace); + nsRect clipRect = + aFrame->GetVisualOverflowRectRelativeToSelf() + toUserSpace; + gfx->Clip(NSRectToRect(clipRect, + aFrame->PresContext()->AppUnitsPerDevPixel(), + *drawTarget)); gfx->PushGroup(gfxContentType::COLOR_ALPHA); } diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 4da936afaad..fbbcc120783 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -28,6 +28,7 @@ #include "nsIFrame.h" #include "nsIPresShell.h" #include "nsISVGChildFrame.h" +#include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsRenderingContext.h" #include "nsStyleCoord.h" @@ -556,6 +557,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, if (opacity != 1.0f && CanOptimizeOpacity(aFrame)) opacity = 1.0f; + DrawTarget* drawTarget = aContext->GetDrawTarget(); gfxContext *gfx = aContext->ThebesContext(); bool complexEffects = false; @@ -587,7 +589,9 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, // GetCanvasTM(). overflowRect = overflowRect + aFrame->GetPosition(); } - aContext->IntersectClip(overflowRect); + gfx->Clip(NSRectToRect(overflowRect, + aFrame->PresContext()->AppUnitsPerDevPixel(), + *drawTarget)); } gfx->PushGroup(gfxContentType::COLOR_ALPHA); } diff --git a/layout/xul/nsBoxFrame.h b/layout/xul/nsBoxFrame.h index 47b24a39403..0fc5c9ec301 100644 --- a/layout/xul/nsBoxFrame.h +++ b/layout/xul/nsBoxFrame.h @@ -36,6 +36,7 @@ nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, class nsBoxFrame : public nsContainerFrame { +protected: typedef mozilla::gfx::DrawTarget DrawTarget; public: diff --git a/layout/xul/nsGroupBoxFrame.cpp b/layout/xul/nsGroupBoxFrame.cpp index 808fa0dfe50..44a52e5325b 100644 --- a/layout/xul/nsGroupBoxFrame.cpp +++ b/layout/xul/nsGroupBoxFrame.cpp @@ -6,11 +6,17 @@ // YY need to pass isMultiple before create called #include "nsBoxFrame.h" + +#include "mozilla/gfx/2D.h" #include "nsCSSRendering.h" +#include "nsLayoutUtils.h" #include "nsRenderingContext.h" #include "nsStyleContext.h" #include "nsDisplayList.h" +using namespace mozilla; +using namespace mozilla::gfx; + class nsGroupBoxFrame : public nsBoxFrame { public: NS_DECL_FRAMEARENA_HELPERS @@ -123,6 +129,10 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, void nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { + + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + Sides skipSides; const nsStyleBorder* borderStyleData = StyleBorder(); const nsMargin& border = borderStyleData->GetComputedBorder(); @@ -152,6 +162,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES); if (groupBox) { + int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel(); // we should probably use PaintBorderEdges to do this but for now just use clipping // to achieve the same effect. @@ -161,13 +172,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.width = groupRect.x - rect.x; clipRect.height = border.top; - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, skipSides); - - aRenderingContext.ThebesContext()->Restore(); - + gfx->Restore(); // draw right side clipRect = rect; @@ -175,14 +184,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.width = rect.XMost() - groupRect.XMost(); clipRect.height = border.top; - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, skipSides); - - aRenderingContext.ThebesContext()->Restore(); - - + gfx->Restore(); // draw bottom @@ -190,12 +196,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, clipRect.y += border.top; clipRect.height = mRect.height - (yoff + border.top); - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(clipRect); + gfx->Save(); + gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget)); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, skipSides); - - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); } else { nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 82af450a09b..9be16c9d0b1 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2797,8 +2797,13 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext, { // Update our available height and our page count. CalcInnerBox(); - aRenderingContext.ThebesContext()->Save(); - aRenderingContext.IntersectClip(mInnerBox + aPt); + + DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); + gfxContext* gfx = aRenderingContext.ThebesContext(); + + gfx->Save(); + gfx->Clip(NSRectToRect(mInnerBox + aPt, PresContext()->AppUnitsPerDevPixel(), + *drawTarget)); int32_t oldPageCount = mPageLength; if (!mHasFixedRowCount) mPageLength = mInnerBox.height/mRowHeight; @@ -2856,7 +2861,7 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext, PaintDropFeedback(feedbackRect, PresContext(), aRenderingContext, aDirtyRect, aPt); } } - aRenderingContext.ThebesContext()->Restore(); + gfx->Restore(); } From 3801b3e8c8ccc9ca1ebc271f691694410c121245 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 20 Oct 2014 10:55:49 +0100 Subject: [PATCH 23/46] Bug 1085165 - Get rid of the nsRenderingContext::SetColor() method. r=mattwoodrow --HG-- extra : rebase_source : dc4604e04cae84b8dcbd2d9890191713555c8c7a --- gfx/src/nsRenderingContext.cpp | 13 ------------- gfx/src/nsRenderingContext.h | 4 ---- layout/base/nsCSSRendering.cpp | 8 ++++---- layout/base/nsPresShell.cpp | 4 ++-- layout/generic/TextOverflow.cpp | 2 +- layout/generic/nsBulletFrame.cpp | 4 +++- layout/generic/nsImageFrame.cpp | 2 +- layout/generic/nsPageFrame.cpp | 4 ++-- layout/mathml/nsMathMLContainerFrame.cpp | 2 +- layout/mathml/nsMathMLmencloseFrame.cpp | 3 ++- layout/mathml/nsMathMLmfracFrame.cpp | 2 +- layout/xul/nsTextBoxFrame.cpp | 2 +- layout/xul/tree/nsTreeBodyFrame.cpp | 5 +---- 13 files changed, 19 insertions(+), 36 deletions(-) diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 9a07749f4fc..5e12fc5a053 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -81,19 +81,6 @@ nsRenderingContext::Init(nsDeviceContext* aContext, Init(aContext, new gfxContext(aDrawTarget)); } -// -// graphics state -// - -void -nsRenderingContext::SetColor(nscolor aColor) -{ - /* This sets the color assuming the sRGB color space, since that's - * what all CSS colors are defined to be in by the spec. - */ - mThebes->SetColor(gfxRGBA(aColor)); -} - // // text diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index d85eceac1fb..ab872badd2e 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -47,10 +47,6 @@ public: return int32_t(mP2A); } - // Graphics state - - void SetColor(nscolor aColor); - // Text void SetFont(nsFontMetrics *aFontMetrics); diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 395ac6a5396..0d9039b0745 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -3616,8 +3616,6 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, uint8_t aEndBevelSide, nscoord aEndBevelOffset) { - aContext.SetColor (aBorderColor); - bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide)); nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel); uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE; @@ -3633,6 +3631,8 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, AntialiasMode oldMode = ctx->CurrentAntialiasMode(); ctx->SetAntialiasMode(AntialiasMode::NONE); + ctx->SetColor(aBorderColor); + switch (aBorderStyle) { case NS_STYLE_BORDER_STYLE_NONE: case NS_STYLE_BORDER_STYLE_HIDDEN: @@ -3691,7 +3691,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT; // FIXME: In theory, this should use the visited-dependent // background color, but I don't care. - aContext.SetColor ( + ctx->SetColor( MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor)); nsRect rect(aBorder); nscoord half; @@ -3726,7 +3726,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT; // FIXME: In theory, this should use the visited-dependent // background color, but I don't care. - aContext.SetColor ( + ctx->SetColor( MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor)); if (horizontal) { rect.y = rect.y + half; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index fa5b89db112..4c06cbb4e00 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -10109,9 +10109,9 @@ void ReflowCountMgr::PaintCount(const char* aName, ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f))); drawTarget->FillRect(devPxRect, black); - aRenderingContext->SetColor(color2); + aRenderingContext->ThebesContext()->SetColor(color2); aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15); - aRenderingContext->SetColor(color); + aRenderingContext->ThebesContext()->SetColor(color); aRenderingContext->DrawString(buf, strlen(buf), x,y); aRenderingContext->ThebesContext()->Restore(); diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index 6f78a765ad3..905d46f2d7b 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -212,7 +212,7 @@ nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder, nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect, foregroundColor, PaintTextShadowCallback, (void*)this); - aCtx->SetColor(foregroundColor); + aCtx->ThebesContext()->SetColor(foregroundColor); PaintTextToContext(aCtx, nsPoint(0, 0)); } diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index cfb33f33146..9bb6070f104 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -319,7 +319,6 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, nsRefPtr fm; ColorPattern color(ToDeviceColor( nsLayoutUtils::GetColor(this, eCSSProperty_color))); - aRenderingContext.SetColor(nsLayoutUtils::GetColor(this, eCSSProperty_color)); DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel(); @@ -421,6 +420,9 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, break; default: + aRenderingContext.ThebesContext()->SetColor( + nsLayoutUtils::GetColor(this, eCSSProperty_color)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), GetFontSizeInflation()); GetListItemText(text); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 7acdccae3d0..0956856eb79 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1076,7 +1076,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext, const nsRect& aRect) { // Set font and color - aRenderingContext.SetColor(StyleColor()->mColor); + aRenderingContext.ThebesContext()->SetColor(StyleColor()->mColor); nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), nsLayoutUtils::FontSizeInflationFor(this)); diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index b0176979158..0af82b075d7 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -383,7 +383,7 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext, gfx->Save(); gfx->Clip(NSRectToRect(aRect, PresContext()->AppUnitsPerDevPixel(), *drawTarget)); - aRenderingContext.SetColor(NS_RGB(0,0,0)); + aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0)); nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent)); gfx->Restore(); } @@ -586,7 +586,7 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext, } nsRect rect(aPt, mRect.Size()); - aRenderingContext.SetColor(NS_RGB(0,0,0)); + aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0)); // Get the FontMetrics to determine width.height of strings nsRefPtr fontMet; diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index d464bf38130..9a3965653a6 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -106,7 +106,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder, ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f))); drawTarget->FillRect(rect, red); - aCtx->SetColor(NS_RGB(255,255,255)); + aCtx->ThebesContext()->SetColor(NS_RGB(255,255,255)); nscoord ascent = aCtx->FontMetrics()->MaxAscent(); NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup"); aCtx->DrawString(errorMsg.get(), uint32_t(errorMsg.Length()), diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index c8a3511688d..0ef4edc377d 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -774,7 +774,8 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder, // paint the frame with the current text color ColorPattern color(ToDeviceColor( mFrame->GetVisitedDependentColor(eCSSProperty_color))); - aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color)); + aCtx->ThebesContext()->SetColor( + mFrame->GetVisitedDependentColor(eCSSProperty_color)); DrawTarget* drawTarget = aCtx->GetDrawTarget(); diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 34ade9929dc..59579dfc72b 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -604,7 +604,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder, gfxRect rect = presContext->AppUnitsToGfxUnits(mRect + ToReferenceFrame()); // paint with the current text color - aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color)); + aCtx->ThebesContext()->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color)); // draw the slash as a parallelogram gfxContext *gfxCtx = aCtx->ThebesContext(); diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index 7fc8393afe6..8e12f7b1e55 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -507,7 +507,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext, nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor; ColorPattern color(ToDeviceColor(c)); - aRenderingContext.SetColor(c); + aRenderingContext.ThebesContext()->SetColor(c); nsresult rv = NS_ERROR_FAILURE; diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 9be16c9d0b1..785ec47fb6a 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -3618,7 +3618,6 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex, // Set our color. ColorPattern color(ToDeviceColor(textContext->StyleColor()->mColor)); - aRenderingContext.SetColor(textContext->StyleColor()->mColor); // Draw decorations. uint8_t decorations = textContext->StyleTextReset()->mTextDecorationLine; @@ -3652,6 +3651,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex, ctx->PushGroup(gfxContentType::COLOR_ALPHA); } + ctx->SetColor(textContext->StyleColor()->mColor); nsLayoutUtils::DrawString(this, &aRenderingContext, text.get(), text.Length(), textRect.TopLeft() + nsPoint(0, baseline), cellContext); @@ -3757,9 +3757,6 @@ nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex, // Adjust the rect for its border and padding. AdjustForBorderPadding(meterContext, meterRect); - // Set our color. - aRenderingContext.SetColor(meterContext->StyleColor()->mColor); - // Now obtain the value for our cell. nsAutoString value; mView->GetCellValue(aRowIndex, aColumn, value); From f1262ecc43a5899161d9e0c5aee1e24212b1386c Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 20 Oct 2014 10:55:49 +0100 Subject: [PATCH 24/46] Bug 1085167, part 1 - Feed the appUnitPerDevPixel value through to nsCSSRendering::DrawTableBorderSegment. r=mattwoodrow --HG-- extra : rebase_source : 4ef83ee8f45915311c1f7379e06c77f40605c17c --- layout/base/nsCSSRendering.cpp | 45 +++++++++++++++++----------------- layout/base/nsCSSRendering.h | 1 + layout/tables/nsTableFrame.cpp | 11 +++++++++ 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 0d9039b0745..030bc5932d4 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -3498,6 +3498,7 @@ static void DrawSolidBorderSegment(nsRenderingContext& aContext, nsRect aRect, nscolor aColor, + int32_t aAppUnitsPerDevPixel, nscoord aTwipsPerPixel, uint8_t aStartBevelSide = 0, nscoord aStartBevelOffset = 0, @@ -3505,7 +3506,6 @@ DrawSolidBorderSegment(nsRenderingContext& aContext, nscoord aEndBevelOffset = 0) { DrawTarget* drawTarget = aContext.GetDrawTarget(); - int32_t appUnitsPerDevPixel = aContext.AppUnitsPerDevPixel(); ColorPattern color(ToDeviceColor(aColor)); DrawOptions drawOptions(1.f, CompositionOp::OP_OVER, AntialiasMode::NONE); @@ -3516,29 +3516,29 @@ DrawSolidBorderSegment(nsRenderingContext& aContext, if ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide)) { if (1 == aRect.height) StrokeLineWithSnapping(aRect.TopLeft(), aRect.BottomLeft(), - appUnitsPerDevPixel, *drawTarget, + aAppUnitsPerDevPixel, *drawTarget, color, StrokeOptions(), drawOptions); else - drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget), + drawTarget->FillRect(NSRectToRect(aRect, aAppUnitsPerDevPixel, *drawTarget), color, drawOptions); } else { if (1 == aRect.width) StrokeLineWithSnapping(aRect.TopLeft(), aRect.TopRight(), - appUnitsPerDevPixel, *drawTarget, + aAppUnitsPerDevPixel, *drawTarget, color, StrokeOptions(), drawOptions); else - drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget), + drawTarget->FillRect(NSRectToRect(aRect, aAppUnitsPerDevPixel, *drawTarget), color, drawOptions); } } else { // polygon with beveling Point poly[4]; - SetPoly(NSRectToRect(aRect, appUnitsPerDevPixel), poly); + SetPoly(NSRectToRect(aRect, aAppUnitsPerDevPixel), poly); Float startBevelOffset = - NSAppUnitsToFloatPixels(aStartBevelOffset, appUnitsPerDevPixel); + NSAppUnitsToFloatPixels(aStartBevelOffset, aAppUnitsPerDevPixel); switch(aStartBevelSide) { case NS_SIDE_TOP: poly[0].x += startBevelOffset; @@ -3554,7 +3554,7 @@ DrawSolidBorderSegment(nsRenderingContext& aContext, } Float endBevelOffset = - NSAppUnitsToFloatPixels(aEndBevelOffset, appUnitsPerDevPixel); + NSAppUnitsToFloatPixels(aEndBevelOffset, aAppUnitsPerDevPixel); switch(aEndBevelSide) { case NS_SIDE_TOP: poly[1].x -= endBevelOffset; @@ -3610,6 +3610,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, nscolor aBorderColor, const nsStyleBackground* aBGColor, const nsRect& aBorder, + int32_t aAppUnitsPerDevPixel, int32_t aAppUnitsPerCSSPixel, uint8_t aStartBevelSide, nscoord aStartBevelOffset, @@ -3654,21 +3655,21 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (horizontal) { GetDashInfo(aBorder.width, dashLength, twipsPerPixel, numDashSpaces, startDashLength, endDashLength); nsRect rect(aBorder.x, aBorder.y, startDashLength, aBorder.height); - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel); + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel); for (int32_t spaceX = 0; spaceX < numDashSpaces; spaceX++) { rect.x += rect.width + dashLength; rect.width = (spaceX == (numDashSpaces - 1)) ? endDashLength : dashLength; - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel); + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel); } } else { GetDashInfo(aBorder.height, dashLength, twipsPerPixel, numDashSpaces, startDashLength, endDashLength); nsRect rect(aBorder.x, aBorder.y, aBorder.width, startDashLength); - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel); + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel); for (int32_t spaceY = 0; spaceY < numDashSpaces; spaceY++) { rect.y += rect.height + dashLength; rect.height = (spaceY == (numDashSpaces - 1)) ? endDashLength : dashLength; - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel); + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel); } } } @@ -3679,7 +3680,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if ((horizontal && (twipsPerPixel >= aBorder.height)) || (!horizontal && (twipsPerPixel >= aBorder.width))) { // a one pixel border - DrawSolidBorderSegment(aContext, aBorder, aBorderColor, twipsPerPixel, + DrawSolidBorderSegment(aContext, aBorder, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, aStartBevelOffset, aEndBevelSide, aEndBevelOffset); } @@ -3705,7 +3706,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_TOP == aEndBevelSide) { rect.width -= endBevel; } - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } else { // left, right @@ -3718,7 +3719,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_LEFT == aEndBevelSide) { rect.height -= endBevel; } - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } @@ -3738,7 +3739,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_BOTTOM == aEndBevelSide) { rect.width -= endBevel; } - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } else { @@ -3751,7 +3752,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_RIGHT == aEndBevelSide) { rect.height -= endBevel; } - DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } } @@ -3778,7 +3779,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_TOP == aEndBevelSide) { topRect.width -= aEndBevelOffset - endBevel; } - DrawSolidBorderSegment(aContext, topRect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, topRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); // draw the botom line or rect @@ -3791,7 +3792,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_BOTTOM == aEndBevelSide) { bottomRect.width -= aEndBevelOffset - endBevel; } - DrawSolidBorderSegment(aContext, bottomRect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, bottomRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } else { // left, right @@ -3805,7 +3806,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_LEFT == aEndBevelSide) { leftRect.height -= aEndBevelOffset - endBevel; } - DrawSolidBorderSegment(aContext, leftRect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, leftRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); nscoord widthOffset = aBorder.width - thirdWidth; @@ -3817,14 +3818,14 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext, if (NS_SIDE_RIGHT == aEndBevelSide) { rightRect.height -= aEndBevelOffset - endBevel; } - DrawSolidBorderSegment(aContext, rightRect, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, rightRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, startBevel, aEndBevelSide, endBevel); } break; } // else fall through to solid case NS_STYLE_BORDER_STYLE_SOLID: - DrawSolidBorderSegment(aContext, aBorder, aBorderColor, twipsPerPixel, aStartBevelSide, + DrawSolidBorderSegment(aContext, aBorder, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide, aStartBevelOffset, aEndBevelSide, aEndBevelOffset); break; case NS_STYLE_BORDER_STYLE_OUTSET: diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index 04dcbc1dfe8..9e41c1b178b 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -589,6 +589,7 @@ struct nsCSSRendering { nscolor aBorderColor, const nsStyleBackground* aBGColor, const nsRect& aBorderRect, + int32_t aAppUnitsPerDevPixel, int32_t aAppUnitsPerCSSPixel, uint8_t aStartBevelSide = 0, nscoord aStartBevelOffset = 0, diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 5b7078a4278..74e563c22c9 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -6929,6 +6929,10 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter, uint8_t style = NS_STYLE_BORDER_STYLE_SOLID; nscolor color = 0xFFFFFFFF; + // All the tables frames have the same presContext, so we just use any one + // that exists here: + int32_t appUnitsPerDevPixel = col->PresContext()->AppUnitsPerDevPixel(); + switch (mOwner) { case eTableOwner: owner = aIter.mTable; @@ -6989,6 +6993,7 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter, NS_SIDE_RIGHT : NS_SIDE_LEFT; nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color, aIter.mTableBgColor, segRect, + appUnitsPerDevPixel, nsPresContext::AppUnitsPerCSSPixel(), topBevelSide, mTopBevelOffset, bottomBevelSide, bottomBevelOffset); @@ -7109,6 +7114,10 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter, nsIFrame* col; nsIFrame* owner = nullptr; + // All the tables frames have the same presContext, so we just use any one + // that exists here: + int32_t appUnitsPerDevPixel = row->PresContext()->AppUnitsPerDevPixel(); + uint8_t style = NS_STYLE_BORDER_STYLE_SOLID; nscolor color = 0xFFFFFFFF; @@ -7171,6 +7180,7 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter, if (aIter.mTableIsLTR) { nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color, aIter.mTableBgColor, segRect, + appUnitsPerDevPixel, nsPresContext::AppUnitsPerCSSPixel(), mLeftBevelSide, nsPresContext::CSSPixelsToAppUnits(mLeftBevelOffset), @@ -7180,6 +7190,7 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter, segRect.x -= segRect.width; nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color, aIter.mTableBgColor, segRect, + appUnitsPerDevPixel, nsPresContext::AppUnitsPerCSSPixel(), mRightBevelSide, mRightBevelOffset, mLeftBevelSide, From 134efbf1e5dbc4231f6a614160a0a1a883a13bc3 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 20 Oct 2014 10:55:49 +0100 Subject: [PATCH 25/46] Bug 1085167, part 2 - Get rid of nsRenderingContext's DeviceContext and any need for it to know about app-units-per-device-pixel. r=mattwoodrow --HG-- extra : rebase_source : d8fb804f03a1cc4635d6acd7f66f5f21962de6d3 --- gfx/src/nsDeviceContext.cpp | 2 +- gfx/src/nsRenderingContext.cpp | 17 +++-------------- gfx/src/nsRenderingContext.h | 16 +++------------- layout/base/FrameLayerBuilder.cpp | 4 ++-- layout/base/nsCSSRendering.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 2 +- layout/base/nsPresShell.cpp | 10 ++++------ layout/generic/nsCanvasFrame.cpp | 2 +- layout/generic/nsPageFrame.cpp | 1 + layout/generic/nsSimplePageSequenceFrame.cpp | 1 + layout/mathml/nsMathMLChar.cpp | 1 + layout/style/nsRuleNode.cpp | 1 + layout/svg/nsFilterInstance.cpp | 2 +- layout/svg/nsSVGIntegrationUtils.cpp | 2 +- layout/svg/nsSVGMaskFrame.cpp | 2 +- layout/svg/nsSVGPatternFrame.cpp | 2 +- layout/svg/nsSVGUtils.cpp | 2 +- widget/cocoa/nsNativeThemeCocoa.mm | 2 ++ widget/windows/nsNativeThemeWin.cpp | 2 ++ 19 files changed, 29 insertions(+), 44 deletions(-) diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 58182e08a39..569db22996d 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -410,7 +410,7 @@ nsDeviceContext::CreateRenderingContext() dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr); #endif - pContext->Init(this, dt); + pContext->Init(dt); pContext->GetDrawTarget()->AddUserData(&sDisablePixelSnapping, (void*)0x1, nullptr); pContext->ThebesContext()->SetMatrix(gfxMatrix::Scaling(mPrintingScale, diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp index 5e12fc5a053..92327869bf6 100644 --- a/gfx/src/nsRenderingContext.cpp +++ b/gfx/src/nsRenderingContext.cpp @@ -20,12 +20,6 @@ #include "nsRect.h" // for nsRect, nsIntRect #include "nsRegion.h" // for nsIntRegionRectIterator, etc -// XXXTodo: rename FORM_TWIPS to FROM_APPUNITS -#define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A))) -#define FROM_TWIPS_INT(_x) (NSToIntRound((gfxFloat)((_x)/(mP2A)))) -#define TO_TWIPS(_x) ((nscoord)((_x)*(mP2A))) -#define GFX_RECT_FROM_TWIPS_RECT(_r) (gfxRect(FROM_TWIPS((_r).x), FROM_TWIPS((_r).y), FROM_TWIPS((_r).width), FROM_TWIPS((_r).height))) - // Hard limit substring lengths to 8000 characters ... this lets us statically // size the cluster buffer array in FindSafeLength #define MAX_GFX_TEXT_BUF_SIZE 8000 @@ -64,21 +58,16 @@ static int32_t FindSafeLength(const char *aString, uint32_t aLength, //// nsRenderingContext void -nsRenderingContext::Init(nsDeviceContext* aContext, - gfxContext *aThebesContext) +nsRenderingContext::Init(gfxContext *aThebesContext) { - mDeviceContext = aContext; mThebes = aThebesContext; - mThebes->SetLineWidth(1.0); - mP2A = mDeviceContext->AppUnitsPerDevPixel(); } void -nsRenderingContext::Init(nsDeviceContext* aContext, - DrawTarget *aDrawTarget) +nsRenderingContext::Init(DrawTarget *aDrawTarget) { - Init(aContext, new gfxContext(aDrawTarget)); + Init(new gfxContext(aDrawTarget)); } diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index ab872badd2e..e3e3bda59f7 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -15,7 +15,6 @@ #include "nsBoundingMetrics.h" // for nsBoundingMetrics #include "nsColor.h" // for nscolor #include "nsCoord.h" // for nscoord, NSToIntRound -#include "nsDeviceContext.h" // for nsDeviceContext #include "nsFontMetrics.h" // for nsFontMetrics #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc #include "nsString.h" // for nsString @@ -30,22 +29,16 @@ class nsRenderingContext MOZ_FINAL typedef mozilla::gfx::DrawTarget DrawTarget; public: - nsRenderingContext() : mP2A(0.) {} + nsRenderingContext() {} NS_INLINE_DECL_REFCOUNTING(nsRenderingContext) - void Init(nsDeviceContext* aContext, gfxContext* aThebesContext); - void Init(nsDeviceContext* aContext, DrawTarget* aDrawTarget); + void Init(gfxContext* aThebesContext); + void Init(DrawTarget* aDrawTarget); // These accessors will never return null. gfxContext *ThebesContext() { return mThebes; } DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); } - nsDeviceContext *DeviceContext() { return mDeviceContext; } - - int32_t AppUnitsPerDevPixel() const { - // we know this is an int (it's stored as a double for convenience) - return int32_t(mP2A); - } // Text @@ -79,10 +72,7 @@ private: int32_t GetMaxChunkLength(); nsRefPtr mThebes; - nsRefPtr mDeviceContext; nsRefPtr mFontMetrics; - - double mP2A; // cached app units per device pixel value }; #endif // NSRENDERINGCONTEXT__H__ diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 2be83426883..4dd3d68199a 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4212,7 +4212,7 @@ static void DebugPaintItem(nsRenderingContext* aDest, nsRefPtr context = new gfxContext(tempDT); context->SetMatrix(gfxMatrix::Translation(-gfxPoint(bounds.x, bounds.y))); nsRefPtr ctx = new nsRenderingContext(); - ctx->Init(aDest->DeviceContext(), context); + ctx->Init(context); aItem->Paint(aBuilder, ctx); RefPtr surface = tempDT->Snapshot(); @@ -4479,7 +4479,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer, } nsRefPtr rc = new nsRenderingContext(); - rc->Init(presContext->DeviceContext(), aContext); + rc->Init(aContext); if (shouldDrawRectsSeparately) { nsIntRegionRectIterator it(aRegionToDraw); diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 030bc5932d4..bd89b0f8268 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1313,7 +1313,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext, // Draw the widget shape gfxContextMatrixAutoSaveRestore save(shadowContext); nsRefPtr wrapperCtx = new nsRenderingContext(); - wrapperCtx->Init(aPresContext->DeviceContext(), shadowContext); + wrapperCtx->Init(shadowContext); gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(nsPoint(shadowItem->mXOffset, shadowItem->mYOffset), diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 33f13fb53ae..4c56ad57958 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4710,7 +4710,7 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame, // Conjure an nsRenderingContext from a gfxContext for drawing the text // to blur. nsRefPtr renderingContext = new nsRenderingContext(); - renderingContext->Init(presCtx->DeviceContext(), shadowContext); + renderingContext->Init(shadowContext); aDestCtx->Save(); aDestCtx->NewPath(); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 4c06cbb4e00..dd84082031e 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3071,7 +3071,7 @@ PresShell::CreateReferenceRenderingContext() nsRefPtr rc; if (mPresContext->IsScreen()) { rc = new nsRenderingContext(); - rc->Init(devCtx, gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); + rc->Init(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); } else { rc = devCtx->CreateRenderingContext(); } @@ -4807,7 +4807,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags, AutoSaveRestoreRenderingState _(this); nsRefPtr rc = new nsRenderingContext(); - rc->Init(devCtx, aThebesContext); + rc->Init(aThebesContext); bool wouldFlushRetainedLayers = false; uint32_t flags = nsLayoutUtils::PAINT_IGNORE_SUPPRESSION; @@ -5061,8 +5061,6 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, if (!pc || aArea.width == 0 || aArea.height == 0) return nullptr; - nsDeviceContext* deviceContext = pc->DeviceContext(); - // use the rectangle to create the surface nsIntRect pixelArea = aArea.ToOutsidePixels(pc->AppUnitsPerDevPixel()); @@ -5075,7 +5073,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, // if the image is larger in one or both directions than half the size of // the available screen area, scale the image down to that size. nsRect maxSize; - deviceContext->GetClientRect(maxSize); + pc->DeviceContext()->GetClientRect(maxSize); nscoord maxWidth = pc->AppUnitsToDevPixels(maxSize.width >> 1); nscoord maxHeight = pc->AppUnitsToDevPixels(maxSize.height >> 1); bool resize = (pixelArea.width > maxWidth || pixelArea.height > maxHeight); @@ -5128,7 +5126,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, } nsRefPtr rc = new nsRenderingContext(); - rc->Init(deviceContext, ctx); + rc->Init(ctx); gfxMatrix initialTM = ctx->CurrentMatrix(); diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index 81feef54b20..8688e972fe4 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -300,7 +300,7 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder, ctx->SetMatrix( ctx->CurrentMatrix().Translate(-destRect.x, -destRect.y)); context = new nsRenderingContext(); - context->Init(aCtx->DeviceContext(), ctx); + context->Init(ctx); } } #endif diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 0af82b075d7..f19e6c1cd64 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -6,6 +6,7 @@ #include "nsPageFrame.h" #include "mozilla/gfx/2D.h" +#include "nsDeviceContext.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsRenderingContext.h" diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index 561e0087dc8..0aeaf8eb06d 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -6,6 +6,7 @@ #include "nsSimplePageSequenceFrame.h" #include "nsCOMPtr.h" +#include "nsDeviceContext.h" #include "nsPresContext.h" #include "gfxContext.h" #include "nsRenderingContext.h" diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index b707c2e37a3..4d285619f69 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -10,6 +10,7 @@ #include "mozilla/MathAlgorithms.h" #include "nsCOMPtr.h" +#include "nsDeviceContext.h" #include "nsIFrame.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 5728bac326c..96bfc374215 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -17,6 +17,7 @@ #include "mozilla/Likely.h" #include "mozilla/LookAndFeel.h" +#include "nsDeviceContext.h" #include "nsRuleNode.h" #include "nscore.h" #include "nsIWidget.h" diff --git a/layout/svg/nsFilterInstance.cpp b/layout/svg/nsFilterInstance.cpp index eaca8db5cb6..755d13678f3 100644 --- a/layout/svg/nsFilterInstance.cpp +++ b/layout/svg/nsFilterInstance.cpp @@ -449,7 +449,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT) PreMultiply(deviceToFilterSpace)); nsRefPtr tmpCtx(new nsRenderingContext()); - tmpCtx->Init(mTargetFrame->PresContext()->DeviceContext(), ctx); + tmpCtx->Init(ctx); mPaintCallback->Paint(tmpCtx, mTargetFrame, mPaintTransform, &dirty); mSourceGraphic.mSourceSurface = offscreenDT->Snapshot(); diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 4a83ea82350..e31dd702e9a 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -642,7 +642,7 @@ PaintFrameCallback::operator()(gfxContext* aContext, mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER); nsRefPtr context(new nsRenderingContext()); - context->Init(mFrame->PresContext()->DeviceContext(), aContext); + context->Init(aContext); aContext->Save(); // Clip to aFillRect so that we don't paint outside. diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp index 57d4891467f..5a018774f48 100644 --- a/layout/svg/nsSVGMaskFrame.cpp +++ b/layout/svg/nsSVGMaskFrame.cpp @@ -227,7 +227,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext, aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft()); nsRefPtr tmpCtx = new nsRenderingContext(); - tmpCtx->Init(this->PresContext()->DeviceContext(), maskDT); + tmpCtx->Init(maskDT); tmpCtx->ThebesContext()->SetMatrix(maskSurfaceMatrix); mMatrixForChildren = GetMaskTransform(aMaskedFrame) * aMatrix; diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index bce097f4448..e20cf958a60 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -379,7 +379,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget, } nsRefPtr context(new nsRenderingContext()); - context->Init(aSource->PresContext()->DeviceContext(), dt); + context->Init(dt); gfxContext* gfx = context->ThebesContext(); // Fill with transparent black diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index fbbcc120783..8b97e739a27 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1589,7 +1589,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext, aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey, aContextPaint, nullptr); nsRefPtr context(new nsRenderingContext()); - context->Init(frame->PresContext()->DeviceContext(), aContext); + context->Init(aContext); svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED); gfxMatrix m; if (frame->GetContent()->IsSVG()) { diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 48bca34479f..fe4c076807b 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -4,6 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsNativeThemeCocoa.h" + +#include "nsDeviceContext.h" #include "nsObjCExceptions.h" #include "nsNumberControlFrame.h" #include "nsRangeFrame.h" diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 5449f2e14ba..cdbc3668dc6 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -4,8 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsNativeThemeWin.h" + #include "mozilla/EventStates.h" #include "mozilla/WindowsVersion.h" +#include "nsDeviceContext.h" #include "nsRenderingContext.h" #include "nsRect.h" #include "nsSize.h" From ae728489aec8543339aa251f3699cd7d2b8c2e23 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 04:55:46 -0700 Subject: [PATCH 26/46] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/5f5d70eda06a Author: BavarianTomcat Desc: Revert "Bug 1069879 - Only three dots shown when entering passcode" for gaia unit test failures This reverts commit 3b99f2d2a05dd78d85779e36a16af0b6d59a9847. --- 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 bb4270dd5f2..e17cecf276e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "7bce6f1246c04b2199eff59904edc833d9b25c5e", + "revision": "5f5d70eda06a9f0e7aa75823706826f08499a496", "repo_path": "/integration/gaia-central" } From 2bec8a97977495334bb744610fdeb481fa6de9a8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 05:01:57 -0700 Subject: [PATCH 27/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 7b4cb33df8d..735d2adf7c9 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 7fe3508c0f6..52297f7c0d1 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 4ef6f86ba1b..32f013130c5 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 3eed6810ab4..4f82793a69c 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 7fe3508c0f6..52297f7c0d1 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 717d5e9d7d8..67ff726d137 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f46415a9874..002d1ac2436 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index cc4c30b72aa..d0b13436fad 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 5e1763fc9c9..85959d209c8 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 8e888e31f75..38aba6b623e 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 1b058e56d4b..03e18f2dfcd 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 290d899d1e719b39aac4f4c539a6e448423e3c5a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 20 Oct 2014 14:22:47 +0200 Subject: [PATCH 28/46] Bug 928362: Support ad-hoc mode for Wifi, r=vchang, r=mrbkap This patch adds support for Wifi networks that run in ad-hoc mode. The network attributes 'frequency' and 'mode' are required by wpa_supplicant to connect to an ad-hoc network. 'Frequency' is just the frequency of the channel in use. 'Mode' is the network's mode, with 0 being infrastructure mode, 1 being IBSS mode (aka ad-hoc mode), and 2 being access-point mode. If ad-hoc mode is not supported on your device, you can set the environment property 'ro.moz.wifi.ibss_supported' to false to disable it in Gecko. --- dom/webidl/MozWifiManager.webidl | 4 ++ dom/wifi/WifiWorker.js | 79 ++++++++++++++++++++++++++------ 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/dom/webidl/MozWifiManager.webidl b/dom/webidl/MozWifiManager.webidl index fb2382e6920..1539e21adb5 100644 --- a/dom/webidl/MozWifiManager.webidl +++ b/dom/webidl/MozWifiManager.webidl @@ -28,6 +28,8 @@ dictionary WifiWPSInfo { dictionary NetworkProperties { DOMString ssid; + long mode; + long frequency; sequence? security; sequence? capabilities; boolean known; @@ -63,6 +65,8 @@ dictionary NetworkProperties { Func="Navigator::HasWifiManagerSupport"] interface MozWifiNetwork { readonly attribute DOMString ssid; + readonly attribute long mode; + readonly attribute long frequency; [Constant, Cached] readonly attribute sequence? security; [Constant, Cached] readonly attribute sequence? capabilities; readonly attribute boolean known; diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index f4c0ba62b80..18bd9281e7e 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -82,6 +82,9 @@ const WPA_SUPPLICANT = "wpa_supplicant"; const DHCP_PROP = "init.svc.dhcpcd"; const DHCP = "dhcpcd"; +const MODE_ESS = 0; +const MODE_IBSS = 1; + XPCOMUtils.defineLazyServiceGetter(this, "gNetworkManager", "@mozilla.org/network/manager;1", "nsINetworkManager"); @@ -112,22 +115,27 @@ var WifiManager = (function() { driverDelay: libcutils.property_get("ro.moz.wifi.driverDelay"), p2pSupported: libcutils.property_get("ro.moz.wifi.p2p_supported") === "1", eapSimSupported: libcutils.property_get("ro.moz.wifi.eapsim_supported") === "1", + ibssSupported: libcutils.property_get("ro.moz.wifi.ibss_supported", "true") === "true", ifname: libcutils.property_get("wifi.interface") }; } let {sdkVersion, unloadDriverEnabled, schedScanRecovery, - driverDelay, p2pSupported, eapSimSupported, ifname} = getStartupPrefs(); + driverDelay, p2pSupported, eapSimSupported, ibssSupported, ifname} = getStartupPrefs(); let capabilities = { security: ["OPEN", "WEP", "WPA-PSK", "WPA-EAP"], eapMethod: ["PEAP", "TTLS"], eapPhase2: ["MSCHAPV2"], - certificate: ["SERVER"] + certificate: ["SERVER"], + mode: [MODE_ESS] }; if (eapSimSupported) { capabilities.eapMethod.unshift("SIM"); } + if (ibssSupported) { + capabilities.mode.push(MODE_IBSS); + } let wifiListener = { onWaitEvent: function(event, iface) { @@ -1188,7 +1196,13 @@ var WifiManager = (function() { {name: "pin", type: "string"}, {name: "pcsc", type: "string"}, {name: "ca_cert", type: "string"}, - {name: "subject_match", type: "string"} + {name: "subject_match", type: "string"}, + {name: "frequency", type: "integer"}, + {name: "mode", type: "integer"} + ]; + // These fields are only handled in IBSS (aka ad-hoc) mode + var ibssNetworkConfigurationFields = [ + "frequency", "mode" ]; manager.getNetworkConfiguration = function(config, callback) { @@ -1223,9 +1237,23 @@ var WifiManager = (function() { config[name] !== '*')); } + function getModeFromConfig() { + /* we use the mode from the config, or ESS as default */ + return hasValidProperty("mode") ? config["mode"] : MODE_ESS; + } + + var mode = getModeFromConfig(); + + function validForMode(name, mode) { + /* all fields are valid for IBSS */ + return (mode == MODE_IBSS) || + /* IBSS fields are not valid for ESS */ + ((mode == MODE_ESS) && !(name in ibssNetworkConfigurationFields)); + } + for (var n = 0; n < networkConfigurationFields.length; ++n) { let fieldName = networkConfigurationFields[n].name; - if (!hasValidProperty(fieldName)) { + if (!hasValidProperty(fieldName) || !validForMode(fieldName, mode)) { ++done; } else { wifiCommand.setNetworkVariable(netId, fieldName, config[fieldName], function(ok) { @@ -1556,6 +1584,18 @@ function getNetworkKey(network) return escape(ssid) + encryption; } +function getMode(flags) { + if (!flags) + return -1; + + if (/\[ESS/.test(flags)) + return MODE_ESS; + if (/\[IBSS/.test(flags)) + return MODE_IBSS; + + return -1; +} + function getKeyManagement(flags) { var types = []; if (!flags) @@ -1602,8 +1642,10 @@ function calculateSignal(strength) { return Math.floor(((strength - MIN_RSSI) / (MAX_RSSI - MIN_RSSI)) * 100); } -function Network(ssid, security, password, capabilities) { +function Network(ssid, mode, frequency, security, password, capabilities) { this.ssid = ssid; + this.mode = mode; + this.frequency = frequency; this.security = security; if (typeof password !== "undefined") @@ -1617,6 +1659,8 @@ function Network(ssid, security, password, capabilities) { Network.api = { ssid: "r", + mode: "r", + frequency: "r", security: "r", capabilities: "r", known: "r", @@ -1636,9 +1680,9 @@ Network.api = { // Note: We never use ScanResult.prototype, so the fact that it's unrelated to // Network.prototype is OK. -function ScanResult(ssid, bssid, flags, signal) { - Network.call(this, ssid, getKeyManagement(flags), undefined, - getCapabilities(flags)); +function ScanResult(ssid, bssid, frequency, flags, signal) { + Network.call(this, ssid, getMode(flags), frequency, + getKeyManagement(flags), undefined, getCapabilities(flags)); this.bssid = bssid; this.signalStrength = signal; this.relSignalStrength = calculateSignal(Number(signal)); @@ -1850,6 +1894,8 @@ function WifiWorker() { return null; } var ssid = dequote(net.ssid); + var mode = net.mode; + var frequency = net.frequency; var security = (net.key_mgmt === "NONE" && net.wep_key0) ? ["WEP"] : (net.key_mgmt && net.key_mgmt !== "NONE") ? [net.key_mgmt.split(" ")[0]] : []; @@ -1860,7 +1906,7 @@ function WifiWorker() { password = "*"; } - var pub = new Network(ssid, security, password); + var pub = new Network(ssid, mode, frequency, security, password); if (net.identity) pub.identity = dequote(net.identity); if ("netId" in net) @@ -2062,10 +2108,12 @@ function WifiWorker() { break; case "ASSOCIATING": // id has not yet been filled in, so we can only report the ssid and - // bssid. + // bssid. mode and frequency are simply made up. self.currentNetwork = { bssid: WifiManager.connectionInfo.bssid, - ssid: quote(WifiManager.connectionInfo.ssid) }; + ssid: quote(WifiManager.connectionInfo.ssid), + mode: MODE_ESS, + frequency: 0}; self._fireEvent("onconnecting", { network: netToDOM(self.currentNetwork) }); break; case "ASSOCIATED": @@ -2261,6 +2309,8 @@ function WifiWorker() { return; } + let capabilities = WifiManager.getCapabilities(); + // Now that we have scan results, there's no more need to continue // scanning. Ignore any errors from this command. WifiManager.setScanMode("inactive", function() {}); @@ -2274,17 +2324,18 @@ function WifiWorker() { if (match && match[5]) { let ssid = match[5], bssid = match[1], + frequency = match[2], signalLevel = match[3], flags = match[4]; - // Skip ad-hoc networks which aren't supported (bug 811635). - if (flags && flags.indexOf("[IBSS]") >= 0) + /* Skip networks with unknown or unsupported modes. */ + if (capabilities.mode.indexOf(getMode(flags)) == -1) continue; // If this is the first time that we've seen this SSID in the scan // results, add it to the list along with any other information. // Also, we use the highest signal strength that we see. - let network = new ScanResult(ssid, bssid, flags, signalLevel); + let network = new ScanResult(ssid, bssid, frequency, flags, signalLevel); let networkKey = getNetworkKey(network); let eapIndex = -1; From d7a49aedc72b111fd3d190bd106e026e570d7185 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 05:55:47 -0700 Subject: [PATCH 29/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9c98cf6ebabf Author: Timothy Guan-tin Chien Desc: Merge pull request #25305 from timdream/value-selector-focus Bug 1085233 - Remove app.focus() call from Value Selector, r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/e5fcd2baa697 Author: Timothy Guan-tin Chien Desc: Bug 1085233 - Remove app.focus() call from Value Selector --- 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 e17cecf276e..1b98d731ef1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "5f5d70eda06a9f0e7aa75823706826f08499a496", + "revision": "9c98cf6ebabffce2f9dd1e564a5bf1dca44331f6", "repo_path": "/integration/gaia-central" } From 5bc1e085265668405c8b513e3f1ffd8d3405de3f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 06:01:57 -0700 Subject: [PATCH 30/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 735d2adf7c9..9b574a6c07c 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 52297f7c0d1..bb442179f14 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 32f013130c5..bd2bc754b9f 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 4f82793a69c..810aa85a924 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 52297f7c0d1..bb442179f14 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 67ff726d137..699463bdcb4 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 002d1ac2436..f5e4f02459a 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index d0b13436fad..bb59fd1b255 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 85959d209c8..5e434002662 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 38aba6b623e..7e25f772058 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 03e18f2dfcd..48eccbe9cea 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 78a2333f3150c546fa888a03459ead5d9ca71b00 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 06:56:04 -0700 Subject: [PATCH 31/46] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/cf4bacdaa175 Author: Ryan VanderMeulen Desc: Merge pull request #25170 from mancas/bug1080799 Bug 1080799 - Connecting to/joining (hidden?) Wi-Fi fails after factory ... ======== https://hg.mozilla.org/integration/gaia-central/rev/4bd42f1916de Author: Manuel Casas Desc: Bug 1080799 - Connecting to/joining (hidden?) Wi-Fi fails after factory resetting phone/first run, restart required ======== https://hg.mozilla.org/integration/gaia-central/rev/b40c05465404 Author: Ryan VanderMeulen Desc: Merge pull request #25268 from fcampo/1080771-highlight-contact-phone Bug 1080771 - [Contacts] Remove phone highlight ======== https://hg.mozilla.org/integration/gaia-central/rev/a49e9a8e1a4e Author: Fernando Campo Desc: Bug 1080771 - [Contacts] Remove phone highlight --- 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 1b98d731ef1..ccb1e4f8df4 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "9c98cf6ebabffce2f9dd1e564a5bf1dca44331f6", + "revision": "cf4bacdaa17516155ab63698dedd98178a077b3f", "repo_path": "/integration/gaia-central" } From 4ae6a7d88f81ad94d53ce643eddf81c6092f3d78 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 07:01:44 -0700 Subject: [PATCH 32/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 9b574a6c07c..8f3c05d2e86 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index bb442179f14..a3a0e08d44b 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 bd2bc754b9f..afc1477fcbd 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 810aa85a924..f2c4aabed98 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 bb442179f14..a3a0e08d44b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 699463bdcb4..212d04f82bd 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f5e4f02459a..1ab37a6a8ed 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index bb59fd1b255..c6cad275f94 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 5e434002662..8a71ff640aa 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 7e25f772058..0aa3f5a6f7c 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 48eccbe9cea..3019972d2b9 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f3efbc0ccc81a55d5c2f37622819b413e6cc4dc4 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 08:15:55 -0700 Subject: [PATCH 33/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/99ecc3f35fb6 Author: Marina Desc: Merge pull request #25304 from gitmai/bug-1083122-contacts-checkbox-must-be-blue-on-deleting Bug 1083122 contacts checkbox must be blue on deleting r=jmcf ======== https://hg.mozilla.org/integration/gaia-central/rev/86678f98c2b6 Author: mai Desc: Bug 1083122 - [Contacts] Check visual consistency of bulk contacts delete screen --- 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 ccb1e4f8df4..79b266bc142 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "cf4bacdaa17516155ab63698dedd98178a077b3f", + "revision": "99ecc3f35fb60519781f7dc8b24881a133862923", "repo_path": "/integration/gaia-central" } From 2495bdf02ebbc33eaba8d2ef29401fd5ccd13cba Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 08:22:20 -0700 Subject: [PATCH 34/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8f3c05d2e86..979f6531e87 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a3a0e08d44b..4dc8228b511 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 afc1477fcbd..0f9cf81fecb 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 f2c4aabed98..17a176977fb 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 a3a0e08d44b..4dc8228b511 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 212d04f82bd..116ee866edf 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 1ab37a6a8ed..6077d50f368 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c6cad275f94..40f153e182b 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 8a71ff640aa..f54afcecbb8 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 0aa3f5a6f7c..9b22e4b905d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 3019972d2b9..5140706c719 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 3e1f3ae48359bf6d24a100fa6d6c5c54e799a996 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 08:30:47 -0700 Subject: [PATCH 35/46] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c3cd85cee739 Author: Florin Strugariu Desc: Merge pull request #25026 from chirarobert/call_log Bug 1075547 - Update test_call_log_all_calls to verify missed calls menu ======== https://hg.mozilla.org/integration/gaia-central/rev/3cb38fb1d1be Author: Robert Chira Desc: Bug 1075547 - Update test_call_log_all_calls to verify missed calls menu --- 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 79b266bc142..1106a978acd 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "99ecc3f35fb60519781f7dc8b24881a133862923", + "revision": "c3cd85cee739d53e8f3b9cff576b1efff2002237", "repo_path": "/integration/gaia-central" } From 3b85d1d12991c27a81da91dde83a2ba0c832322a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 08:37:16 -0700 Subject: [PATCH 36/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 979f6531e87..74b32224e68 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4dc8228b511..5076349485b 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 0f9cf81fecb..6e870e71b02 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 17a176977fb..0cfc2300969 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 4dc8228b511..5076349485b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 116ee866edf..3438ba5de96 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 6077d50f368..c9c11b884f0 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 40f153e182b..a1e0a4a7127 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 f54afcecbb8..3349c7273ed 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 9b22e4b905d..4f5cbbe1602 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 5140706c719..c5cf60323e2 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 103b18caf044b6856a4654155ec085e6c6d77ec7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 09:30:48 -0700 Subject: [PATCH 37/46] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/1b18dd8bfce2 Author: Michael Henretty Desc: Merge pull request #25153 from mikehenrty/bug-1082885-ime-menu-shb Bug 1082885 - Make IME Menu SHB aware ======== https://hg.mozilla.org/integration/gaia-central/rev/5520397220d9 Author: Michael Henretty Desc: Bug 1082885 - Make IME Menu SHB aware ======== https://hg.mozilla.org/integration/gaia-central/rev/4070a23a762d Author: Florin Strugariu Desc: Merge pull request #25321 from zacc/bug_1085294 Bug 1085294 - Update expected audio channel in test_dialer.py ======== https://hg.mozilla.org/integration/gaia-central/rev/689c00e476ab Author: Zac Desc: Bug 1085294 - Update expected audio channel in test_dialer.py --- 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 1106a978acd..9444c015dec 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c3cd85cee739d53e8f3b9cff576b1efff2002237", + "revision": "1b18dd8bfce2f16748cdff27910cc66b356ef9bf", "repo_path": "/integration/gaia-central" } From d9bdb544f7182c29dd210990bff8a0d14ec0bf9b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 09:37:20 -0700 Subject: [PATCH 38/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 74b32224e68..2d351f7831b 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 5076349485b..96832482336 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 6e870e71b02..05769dbd48a 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 0cfc2300969..49453893f0f 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 5076349485b..96832482336 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 3438ba5de96..9f8e32fb08f 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index c9c11b884f0..5e1f84a2949 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a1e0a4a7127..175033f330f 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 3349c7273ed..c95b7b5f0b2 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 4f5cbbe1602..f1a0cb8d94a 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index c5cf60323e2..d1c76ef4b76 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 3bc4371324a47e527c7160d113f0ebd56f6c8247 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 09:45:55 -0700 Subject: [PATCH 39/46] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/4d313feb1594 Author: chirarobert Desc: Merge pull request #25328 from viorelaioia/bug_1079254 Bug 1079254 - [v2.2] Investigate test_number_keyboard intermittent failu... ======== https://hg.mozilla.org/integration/gaia-central/rev/a1e981c05270 Author: Viorela Ioia Desc: Bug 1079254 - [v2.2] Investigate test_number_keyboard intermittent failure ======== https://hg.mozilla.org/integration/gaia-central/rev/e356a0458a6a Author: Kevin Grandon Desc: Merge pull request #25298 from KevinGrandon/bug_1065179_app_auth_dialog_test_case Bug 1065179 - [System] Add integration test for app authentication ======== https://hg.mozilla.org/integration/gaia-central/rev/4c99b4888e86 Author: Kevin Grandon Desc: Bug 1065179 - [System] Add integration test for app authentication r=albertopq --- 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 9444c015dec..243ab8adb51 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "1b18dd8bfce2f16748cdff27910cc66b356ef9bf", + "revision": "4d313feb1594fe8627aaf3e8d23788b9b48cddc4", "repo_path": "/integration/gaia-central" } From 1725c51bc4555f6f0316fac955c8fc91ae7e06bb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 09:52:05 -0700 Subject: [PATCH 40/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 2d351f7831b..423225f3984 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 96832482336..8bf031e8ae8 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 05769dbd48a..f1a53bc3e76 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 49453893f0f..fa209bf555f 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 96832482336..8bf031e8ae8 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 9f8e32fb08f..2f4a58042be 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5e1f84a2949..cea48a2fc32 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 175033f330f..a6c5f03945e 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 c95b7b5f0b2..7848125d620 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index f1a0cb8d94a..e85b8e74b3e 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index d1c76ef4b76..4239cc0af41 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From c8c06f7ba58e5359823d48510a7776a848264752 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 10:45:54 -0700 Subject: [PATCH 41/46] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0168c620b526 Author: Justin D'Arcangelo Desc: Merge pull request #25234 from justindarc/bug1079543 Bug 1079543 - Preview is getting freeze after opening & closing Camera a... ======== https://hg.mozilla.org/integration/gaia-central/rev/a29ff7766603 Author: Justin D'Arcangelo Desc: Bug 1079543 - Preview is getting freeze after opening & closing Camera app during WEBRTC video call ======== https://hg.mozilla.org/integration/gaia-central/rev/c39f765bb8d0 Author: Kevin Grandon Desc: Merge pull request #25341 from KevinGrandon/bug_1085460_tc_gaia_integration_manifest Bug 1085460 - taskcluster: Run tests with correct TBPL manifest ======== https://hg.mozilla.org/integration/gaia-central/rev/14af59f56c57 Author: Kevin Grandon Desc: Bug 1085460 - taskcluster: Run tests with correct TBPL manifest r=kgrandon a=testonly --- 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 243ab8adb51..09852f2e5fc 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "4d313feb1594fe8627aaf3e8d23788b9b48cddc4", + "revision": "0168c620b52650a6ae1fc07b761e1120d0942402", "repo_path": "/integration/gaia-central" } From 90790b9e011363cb844891ac547e30473892251e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 10:52:04 -0700 Subject: [PATCH 42/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 423225f3984..8e2c9288cd3 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8bf031e8ae8..113944b5bce 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 f1a53bc3e76..e25948e862f 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 fa209bf555f..bb38b5c58b0 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 8bf031e8ae8..113944b5bce 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 2f4a58042be..18a156f5293 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index cea48a2fc32..e4e43275c83 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a6c5f03945e..d8cb2ffae9b 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 7848125d620..f00be299502 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index e85b8e74b3e..e6d1a13cda7 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 4239cc0af41..871d0abe085 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 545041e98b602a803dfce8f29e9cc1dda139f59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez?= Date: Mon, 20 Oct 2014 20:05:54 +0200 Subject: [PATCH 43/46] Bug 1081873 - [Loop][Contacts API] mozContacts API should trigger DOMRequest.onerror if no permissions are granted to the consumer. r=anygregor --- dom/contacts/ContactManager.js | 96 ++++++++++---- dom/contacts/tests/mochitest.ini | 2 +- .../tests/test_permission_denied.html | 120 ++++++++++++++++++ 3 files changed, 190 insertions(+), 28 deletions(-) create mode 100644 dom/contacts/tests/test_permission_denied.html diff --git a/dom/contacts/ContactManager.js b/dom/contacts/ContactManager.js index 22d17277600..3ef3a96e9ae 100644 --- a/dom/contacts/ContactManager.js +++ b/dom/contacts/ContactManager.js @@ -248,6 +248,7 @@ ContactManager.prototype = { let type = "contacts-" + access; let permValue = Services.perms.testExactPermissionFromPrincipal(principal, type); + DEBUG && debug("Existing permission " + permValue); if (permValue == Ci.nsIPermissionManager.ALLOW_ACTION) { if (aAllowCallback) { aAllowCallback(); @@ -256,7 +257,7 @@ ContactManager.prototype = { } else if (permValue == Ci.nsIPermissionManager.DENY_ACTION || permValue == Ci.nsIPermissionManager.UNKNOWN_ACTION) { if (aCancelCallback) { - aCancelCallback(); + aCancelCallback("PERMISSION_DENIED"); } return; } @@ -276,16 +277,14 @@ ContactManager.prototype = { types: typeArray, principal: principal, QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]), - allow: aAllowCallback || - function() { - if (DEBUG) - debug("Default allow contacts callback. " + access +"\n"); - }, - cancel: aCancelCallback || - function() { - if (DEBUG) - debug("Default cancel contacts callback. " + access +"\n"); - }, + allow: function() { + aAllowCallback && aAllowCallback(); + DEBUG && debug("Permission granted. Access " + access +"\n"); + }, + cancel: function() { + aCancelCallback && aCancelCallback("PERMISSION_DENIED"); + DEBUG && debug("Permission denied. Access " + access +"\n"); + }, window: this._window }; @@ -336,9 +335,17 @@ ContactManager.prototype = { let options = { contact: newContact, reason: reason }; let allowCallback = function() { - cpmm.sendAsyncMessage("Contact:Save", {requestID: requestID, options: options}); - }.bind(this) - this.askPermission(reason, request, allowCallback); + cpmm.sendAsyncMessage("Contact:Save", { + requestID: requestID, + options: options + }); + }.bind(this); + + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); + }; + + this.askPermission(reason, request, allowCallback, cancelCallback); return request; }, @@ -346,10 +353,19 @@ ContactManager.prototype = { if (DEBUG) debug("find! " + JSON.stringify(aOptions)); let request = this.createRequest(); let options = { findOptions: aOptions }; + let allowCallback = function() { - cpmm.sendAsyncMessage("Contacts:Find", {requestID: this.getRequestId({request: request, reason: "find"}), options: options}); - }.bind(this) - this.askPermission("find", request, allowCallback); + cpmm.sendAsyncMessage("Contacts:Find", { + requestID: this.getRequestId({request: request, reason: "find"}), + options: options + }); + }.bind(this); + + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); + }; + + this.askPermission("find", request, allowCallback, cancelCallback); return request; }, @@ -369,11 +385,19 @@ ContactManager.prototype = { getAll: function CM_getAll(aOptions) { if (DEBUG) debug("getAll: " + JSON.stringify(aOptions)); let [cursorId, cursor] = this.createCursor(); + let allowCallback = function() { cpmm.sendAsyncMessage("Contacts:GetAll", { - cursorId: cursorId, findOptions: aOptions}); + cursorId: cursorId, + findOptions: aOptions + }); }.bind(this); - this.askPermission("find", cursor, allowCallback); + + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(cursor, reason); + }; + + this.askPermission("find", cursor, allowCallback, cancelCallback); return cursor; }, @@ -412,10 +436,19 @@ ContactManager.prototype = { } let options = { id: id }; + let allowCallback = function() { - cpmm.sendAsyncMessage("Contact:Remove", {requestID: this.getRequestId({request: request, reason: "remove"}), options: options}); + cpmm.sendAsyncMessage("Contact:Remove", { + requestID: this.getRequestId({request: request, reason: "remove"}), + options: options + }); }.bind(this); - this.askPermission("remove", request, allowCallback); + + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); + }; + + this.askPermission("remove", request, allowCallback, cancelCallback); return request; }, @@ -423,10 +456,19 @@ ContactManager.prototype = { if (DEBUG) debug("clear"); let request = this.createRequest(); let options = {}; + let allowCallback = function() { - cpmm.sendAsyncMessage("Contacts:Clear", {requestID: this.getRequestId({request: request, reason: "remove"}), options: options}); + cpmm.sendAsyncMessage("Contacts:Clear", { + requestID: this.getRequestId({request: request, reason: "remove"}), + options: options + }); }.bind(this); - this.askPermission("remove", request, allowCallback); + + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); + }; + + this.askPermission("remove", request, allowCallback, cancelCallback); return request; }, @@ -439,8 +481,8 @@ ContactManager.prototype = { }); }.bind(this); - let cancelCallback = function() { - Services.DOMRequest.fireError(request, ""); + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); }; this.askPermission("revision", request, allowCallback, cancelCallback); @@ -456,8 +498,8 @@ ContactManager.prototype = { }); }.bind(this); - let cancelCallback = function() { - Services.DOMRequest.fireError(request, ""); + let cancelCallback = function(reason) { + Services.DOMRequest.fireErrorAsync(request, reason); }; this.askPermission("count", request, allowCallback, cancelCallback); diff --git a/dom/contacts/tests/mochitest.ini b/dom/contacts/tests/mochitest.ini index 1dcffd9ca41..49bb1600ea5 100644 --- a/dom/contacts/tests/mochitest.ini +++ b/dom/contacts/tests/mochitest.ini @@ -21,4 +21,4 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only failure support-files = test_migration_chrome.js skip-if = os == "android" - +[test_permission_denied.html] diff --git a/dom/contacts/tests/test_permission_denied.html b/dom/contacts/tests/test_permission_denied.html new file mode 100644 index 00000000000..4c1e8feffa9 --- /dev/null +++ b/dom/contacts/tests/test_permission_denied.html @@ -0,0 +1,120 @@ + + + + + Test for Bug 1081873 + + + + + + +Mozilla Bug 1081873 +

+ +
+
+
+ + From 34c7984879a383b89e6ec7d7f6d67062787659ac Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Mon, 20 Oct 2014 12:29:25 -0700 Subject: [PATCH 44/46] Bug 1078838 - Restrict clone(2) flags for sandboxed content processes. r=kang --HG-- extra : amend_source : f80a3a672f5496f76d8649f0c8ab905044ea81ac --- security/sandbox/linux/SandboxFilter.cpp | 41 +++++++++++++----------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp index f3f55828863..ac3768e95b9 100644 --- a/security/sandbox/linux/SandboxFilter.cpp +++ b/security/sandbox/linux/SandboxFilter.cpp @@ -29,6 +29,7 @@ class SandboxFilterImpl : public SandboxAssembler public: virtual void Build() = 0; virtual ~SandboxFilterImpl() { } + void AllowThreadClone(); }; // Some helper macros to make the code that builds the filter more @@ -72,6 +73,26 @@ public: #define SYSVIPCCALL(name, NAME) SYSCALL(name) #endif +void SandboxFilterImpl::AllowThreadClone() { + // WARNING: s390 and cris pass the flags in a different arg -- see + // CLONE_BACKWARDS2 in arch/Kconfig in the kernel source -- but we + // don't support seccomp-bpf on those archs yet. + // + // The glibc source hasn't changed the thread creation clone flags + // since 2004, so this *should* be safe to hard-code. Bionic's + // value has changed a few times, and has converged on the same one + // as glibc; allow any of them. + static const int flags_common = CLONE_VM | CLONE_FS | CLONE_FILES | + CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM; + Allow(SYSCALL_WITH_ARG(clone, 0, +#ifdef ANDROID + flags_common | CLONE_DETACHED, // <= JB 4.2 + flags_common, // JB 4.3 or KK 4.4 +#endif + flags_common | CLONE_SETTLS // Android L or glibc + | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID)); +} + #ifdef MOZ_CONTENT_SANDBOX class SandboxFilterImplContent : public SandboxFilterImpl { protected: @@ -134,7 +155,7 @@ SandboxFilterImplContent::Build() { Allow(SYSCALL(munmap)); Allow(SYSCALL(mprotect)); Allow(SYSCALL(writev)); - Allow(SYSCALL(clone)); + AllowThreadClone(); Allow(SYSCALL(brk)); #if SYSCALL_EXISTS(set_thread_area) Allow(SYSCALL(set_thread_area)); @@ -354,23 +375,7 @@ void SandboxFilterImplGMP::Build() { Allow(SYSCALL(getpid)); Allow(SYSCALL(gettid)); - // The glibc source hasn't changed the thread creation clone flags - // since 2004, so this *should* be safe to hard-code. Bionic is - // different, but MOZ_GMP_SANDBOX isn't supported there yet. - // - // At minimum we should require CLONE_THREAD, so that a single - // SIGKILL from the parent will destroy all descendant tasks. In - // general, pinning down as much of the flags word as possible is a - // good idea, because it exposes a lot of subtle (and probably not - // well tested in all cases) kernel functionality. - // - // WARNING: s390 and cris pass the flags in a different arg -- see - // CLONE_BACKWARDS2 in arch/Kconfig in the kernel source -- but we - // don't support seccomp-bpf on those archs yet. - static const int new_thread_flags = CLONE_VM | CLONE_FS | CLONE_FILES | - CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM | CLONE_SETTLS | - CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; - Allow(SYSCALL_WITH_ARG(clone, 0, new_thread_flags)); + AllowThreadClone(); Allow(SYSCALL_WITH_ARG(prctl, 0, PR_GET_SECCOMP, PR_SET_NAME)); From 6948ea41918bbc03885c704c56a5a4a6e726c4b3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 12:30:52 -0700 Subject: [PATCH 45/46] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/162be54d45ec Author: Kevin Grandon Desc: Bug 1085550 - Disable intermittent failing test, Vertical - Group collapse the first group r=kgrandon ======== https://hg.mozilla.org/integration/gaia-central/rev/fff194dc2dc3 Author: Miller Medeiros Desc: Merge pull request #24759 from millermedeiros/1052960-day-view-multi-day Bug 1052960 - [Calendar] Day View: update it to use same logic as the 5-day week view r=gaye ======== https://hg.mozilla.org/integration/gaia-central/rev/00eaa0446a90 Author: Miller Medeiros Desc: Bug 1052960 - [Calendar] Day View: update it to use same logic as the 5-day week view --- 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 09852f2e5fc..751b5cd4dbc 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "0168c620b52650a6ae1fc07b761e1120d0942402", + "revision": "162be54d45ece9196921eb2b342490ec2ab9e1a6", "repo_path": "/integration/gaia-central" } From 188193f6a1d9725c562de990b0d56ae481626843 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 20 Oct 2014 12:36:59 -0700 Subject: [PATCH 46/46] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 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-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8e2c9288cd3..942043ca0b7 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 113944b5bce..a536b57e9bf 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 e25948e862f..d8dde7e95d8 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 bb38b5c58b0..c7c89b3ce2b 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 113944b5bce..a536b57e9bf 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 18a156f5293..1810a23ecfa 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index e4e43275c83..f3b5b07ec59 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index d8cb2ffae9b..d039f913a06 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 f00be299502..93acd6529bb 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index e6d1a13cda7..008e5713640 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 871d0abe085..d4920e8c28b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - +