From a08fdb20f5ffdd5729cbeb3034ada5accbd2dc39 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 10 Jan 2014 12:57:20 -0800 Subject: [PATCH 01/13] Bug 958189 - Rename ListManager to PanelManager. r=liuche --HG-- rename : mobile/android/base/home/ListManager.java => mobile/android/base/home/PanelManager.java --- .../base/home/HomeConfigPrefsBackend.java | 1 - .../{ListManager.java => PanelManager.java} | 24 +++++++++---------- mobile/android/base/moz.build | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) rename mobile/android/base/home/{ListManager.java => PanelManager.java} (75%) diff --git a/mobile/android/base/home/HomeConfigPrefsBackend.java b/mobile/android/base/home/HomeConfigPrefsBackend.java index d62b67c0e6f..2f3862fa841 100644 --- a/mobile/android/base/home/HomeConfigPrefsBackend.java +++ b/mobile/android/base/home/HomeConfigPrefsBackend.java @@ -10,7 +10,6 @@ import org.mozilla.gecko.home.HomeConfig.HomeConfigBackend; import org.mozilla.gecko.home.HomeConfig.OnChangeListener; import org.mozilla.gecko.home.HomeConfig.PageEntry; import org.mozilla.gecko.home.HomeConfig.PageType; -import org.mozilla.gecko.home.ListManager.ListInfo; import org.mozilla.gecko.util.HardwareUtils; import org.mozilla.gecko.util.ThreadUtils; diff --git a/mobile/android/base/home/ListManager.java b/mobile/android/base/home/PanelManager.java similarity index 75% rename from mobile/android/base/home/ListManager.java rename to mobile/android/base/home/PanelManager.java index bb1af8b5f8b..e4e61adc60a 100644 --- a/mobile/android/base/home/ListManager.java +++ b/mobile/android/base/home/PanelManager.java @@ -21,14 +21,14 @@ import android.util.Log; import java.util.ArrayList; import java.util.List; -public class ListManager implements GeckoEventListener { - private static final String LOGTAG = "GeckoListManager"; +public class PanelManager implements GeckoEventListener { + private static final String LOGTAG = "GeckoPanelManager"; - public class ListInfo { + public class PanelInfo { public final String id; public final String title; - public ListInfo(String id, String title) { + public PanelInfo(String id, String title) { this.id = id; this.title = title; } @@ -36,7 +36,7 @@ public class ListManager implements GeckoEventListener { private final Context mContext; - public ListManager(Context context) { + public PanelManager(Context context) { mContext = context; // Add a listener to handle any new lists that are added after the lists have been loaded. @@ -46,10 +46,10 @@ public class ListManager implements GeckoEventListener { /** * Reads list info from SharedPreferences. Don't call this on the main thread! * - * @return List A list of ListInfos for each registered list. + * @return List A list of PanelInfos for each registered list. */ - public List getListInfos() { - final ArrayList listInfos = new ArrayList(); + public List getPanelInfos() { + final ArrayList panelInfos = new ArrayList(); // XXX: We need to use PreferenceManager right now because that's what SharedPreferences.jsm uses (see bug 940575) final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); @@ -60,14 +60,14 @@ public class ListManager implements GeckoEventListener { final JSONArray lists = new JSONArray(prefValue); for (int i = 0; i < lists.length(); i++) { final JSONObject list = lists.getJSONObject(i); - final ListInfo info = new ListInfo(list.getString("id"), list.getString("title")); - listInfos.add(info); + final PanelInfo info = new PanelInfo(list.getString("id"), list.getString("title")); + panelInfos.add(info); } } catch (JSONException e) { Log.e(LOGTAG, "Exception getting list info", e); } } - return listInfos; + return panelInfos; } /** @@ -76,7 +76,7 @@ public class ListManager implements GeckoEventListener { @Override public void handleMessage(String event, JSONObject message) { try { - final ListInfo info = new ListInfo(message.getString("id"), message.getString("title")); + final PanelInfo info = new PanelInfo(message.getString("id"), message.getString("title")); // Do something to update the set of list pages. diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 0cc5d1e4846..abb90d13191 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -222,10 +222,10 @@ gbjar.sources += [ 'home/HomePager.java', 'home/HomePagerTabStrip.java', 'home/LastTabsPage.java', - 'home/ListManager.java', 'home/ListPage.java', 'home/MostRecentPage.java', 'home/MultiTypeCursorAdapter.java', + 'home/PanelManager.java', 'home/PinSiteDialog.java', 'home/ReadingListPage.java', 'home/SearchEngine.java', From bc06e9130b56728bcf220b62c36e36279f744030 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 10 Jan 2014 12:57:23 -0800 Subject: [PATCH 02/13] Bug 958179 - Rename Home.lists API to Home.panels. r=liuche --- mobile/android/base/home/PanelManager.java | 6 +-- mobile/android/modules/Home.jsm | 49 +++++++++++----------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/mobile/android/base/home/PanelManager.java b/mobile/android/base/home/PanelManager.java index e4e61adc60a..944e94c308d 100644 --- a/mobile/android/base/home/PanelManager.java +++ b/mobile/android/base/home/PanelManager.java @@ -39,8 +39,8 @@ public class PanelManager implements GeckoEventListener { public PanelManager(Context context) { mContext = context; - // Add a listener to handle any new lists that are added after the lists have been loaded. - GeckoAppShell.getEventDispatcher().registerEventListener("HomeLists:Added", this); + // Add a listener to handle any new panels that are added after the panels have been loaded. + GeckoAppShell.getEventDispatcher().registerEventListener("HomePanels:Added", this); } /** @@ -71,7 +71,7 @@ public class PanelManager implements GeckoEventListener { } /** - * Listens for "HomeLists:Added" + * Listens for "HomePanels:Added" */ @Override public void handleMessage(String event, JSONObject message) { diff --git a/mobile/android/modules/Home.jsm b/mobile/android/modules/Home.jsm index a93532314c0..9ac99f4e676 100644 --- a/mobile/android/modules/Home.jsm +++ b/mobile/android/modules/Home.jsm @@ -137,7 +137,7 @@ let HomeBanner = { } }; -function List(options) { +function Panel(options) { if ("id" in options) this.id = options.id; @@ -145,11 +145,12 @@ function List(options) { this.title = options.title; } -function HomeLists() { +function HomePanels() { + // XXX: Not renaming this because it is going away in bug 958192 this.PREF_KEY = "home_lists"; this._sharedPrefs = new SharedPreferences(); - this._lists = {}; + this._panels = {}; let prefValue = this._sharedPrefs.getCharPref(this.PREF_KEY); if (!prefValue) { @@ -157,47 +158,47 @@ function HomeLists() { } JSON.parse(prefValue).forEach(data => { - let list = new List(data); - this._lists[list.id] = list; + let panel = new Panel(data); + this._panels[panel.id] = panel; }); } -HomeLists.prototype = { +HomePanels.prototype = { add: function(options) { - let list = new List(options); - if (!list.id || !list.title) { - throw "Can't create a home list without an id and title!"; + let panel = new Panel(options); + if (!panel.id || !panel.title) { + throw "Can't create a home panel without an id and title!"; } - // Bail if the list already exists - if (list.id in this._lists) { - throw "List already exists: " + list.id; + // Bail if the panel already exists + if (panel.id in this._panels) { + throw "Panel already exists: " + panel.id; } - this._lists[list.id] = list; + this._panels[panel.id] = panel; this._updateSharedPref(); // Send a message to Java to update the home pager if it's currently showing sendMessageToJava({ - type: "HomeLists:Added", - id: list.id, - title: list.title + type: "HomePanels:Added", + id: panel.id, + title: panel.title }); }, remove: function(id) { - delete this._lists[id]; + delete this._panels[id]; this._updateSharedPref(); }, - // Set a shared pref so that Java can know about this list before Gecko is running + // Set a shared pref so that Java can know about this panel before Gecko is running _updateSharedPref: function() { - let lists = []; - for (let id in this._lists) { - let list = this._lists[id]; - lists.push({ id: list.id, title: list.title}); + let panels = []; + for (let id in this._panels) { + let panel = this._panels[id]; + panels.push({ id: panel.id, title: panel.title}); } - this._sharedPrefs.setCharPref(this.PREF_KEY, JSON.stringify(lists)); + this._sharedPrefs.setCharPref(this.PREF_KEY, JSON.stringify(panels)); } }; @@ -205,5 +206,5 @@ HomeLists.prototype = { // Public API this.Home = { banner: HomeBanner, - lists: new HomeLists() + panels: new HomePanels() } From 77e2bac13a1d7ccfd4e9cba648e539822894d949 Mon Sep 17 00:00:00 2001 From: Garrett Robinson Date: Wed, 11 Dec 2013 16:57:19 -0800 Subject: [PATCH 03/13] Bug 945268 - Modify CSP tests to work on multiprocess (e10s/B2G). r=sstamm, r=rcampbell --- content/base/test/csp/test_CSP.html | 46 +++++++++---------- content/base/test/csp/test_CSP_bug909029.html | 18 +++----- content/base/test/csp/test_CSP_bug916446.html | 18 +++----- content/base/test/csp/test_CSP_bug941404.html | 18 +++----- .../base/test/csp/test_CSP_evalscript.html | 6 +-- .../test_CSP_evalscript_getCRMFRequest.html | 7 +-- .../test/csp/test_CSP_frameancestors.html | 13 ++---- .../base/test/csp/test_bothCSPheaders.html | 16 +++---- .../test/csp/test_bug836922_npolicies.html | 22 ++++----- content/base/test/csp/test_bug886164.html | 21 +++------ content/base/test/csp/test_csp_redirects.html | 29 ++++++------ content/base/test/csp/test_nonce_source.html | 17 +++---- testing/mochitest/b2g.json | 18 ++------ .../components/SpecialPowersObserver.js | 9 ++++ .../specialpowers/content/specialpowersAPI.js | 21 +++++++++ 15 files changed, 127 insertions(+), 152 deletions(-) diff --git a/content/base/test/csp/test_CSP.html b/content/base/test/csp/test_CSP.html index e333d7c45ed..24a1d711ba2 100644 --- a/content/base/test/csp/test_CSP.html +++ b/content/base/test/csp/test_CSP.html @@ -2,23 +2,20 @@ Test for Content Security Policy Connections - +

- +

- @@ -23,7 +20,6 @@ var evalScriptsThatRan = 0; var evalScriptsBlocked = 0; var evalScriptsTotal = 24; - // called by scripts that run var scriptRan = function(shouldrun, testname, data) { evalScriptsThatRan++; diff --git a/content/base/test/csp/test_CSP_evalscript_getCRMFRequest.html b/content/base/test/csp/test_CSP_evalscript_getCRMFRequest.html index e5e8703406f..c3eee193b17 100644 --- a/content/base/test/csp/test_CSP_evalscript_getCRMFRequest.html +++ b/content/base/test/csp/test_CSP_evalscript_getCRMFRequest.html @@ -2,16 +2,13 @@ Test for Content Security Policy "no eval" in crypto.getCRMFRequest() - +

- @@ -24,7 +21,6 @@ var evalScriptsThatRan = 0; var evalScriptsBlocked = 0; var evalScriptsTotal = 4; - // called by scripts that run var scriptRan = function(shouldrun, testname, data) { evalScriptsThatRan++; @@ -39,7 +35,6 @@ var scriptBlocked = function(shouldrun, testname, data) { checkTestResults(); } - // Check to see if all the tests have run var checkTestResults = function() { // if any test is incomplete, keep waiting diff --git a/content/base/test/csp/test_CSP_frameancestors.html b/content/base/test/csp/test_CSP_frameancestors.html index ed13db03092..991a394815c 100644 --- a/content/base/test/csp/test_CSP_frameancestors.html +++ b/content/base/test/csp/test_CSP_frameancestors.html @@ -2,23 +2,20 @@ Test for Content Security Policy Frame Ancestors directive - +

-