Permalink
Browse files

Merge pull request #7420 from dscravag/nightly2

Nightly 2013-01-09
  • Loading branch information...
2 parents 7c348f4 + a069d55 commit f8e15c1774ea03332d0fb688b706a6c3cbe1e186 @dscravag dscravag committed Jan 9, 2013
Showing with 4,670 additions and 1,711 deletions.
  1. +3 −0 Makefile
  2. +2 −1 apps/browser/js/browser.js
  3. +3 −1 apps/browser/manifest.webapp
  4. +2 −1 apps/calendar/caldav_worker.js
  5. +3 −1 apps/calendar/index.html
  6. +145 −3 apps/calendar/js/app.js
  7. +25 −1 apps/calendar/js/calendar.js
  8. +12 −6 apps/calendar/js/controllers/alarm.js
  9. +219 −0 apps/calendar/js/controllers/recurring_events.js
  10. +10 −1 apps/calendar/js/controllers/sync.js
  11. +19 −3 apps/calendar/js/db.js
  12. +159 −33 apps/calendar/js/ext/ical.js
  13. +4 −4 apps/calendar/js/mozalarm_shim.js
  14. +19 −0 apps/calendar/js/provider/abstract.js
  15. +171 −7 apps/calendar/js/provider/caldav.js
  16. +40 −22 apps/calendar/js/provider/caldav_pull_events.js
  17. +3 −1 apps/calendar/js/provider/local.js
  18. +4 −4 apps/calendar/js/router.js
  19. +121 −87 apps/calendar/js/service/caldav.js
  20. +97 −0 apps/calendar/js/service/ical_recur_expansion.js
  21. +6 −6 apps/calendar/js/store/abstract.js
  22. +12 −6 apps/calendar/js/store/alarm.js
  23. +1 −22 apps/calendar/js/store/busytime.js
  24. +30 −1 apps/calendar/js/store/ical_component.js
  25. +5 −2 apps/calendar/js/templates/account.js
  26. +2 −1 apps/calendar/js/templates/calendar.js
  27. +7 −3 apps/calendar/js/templates/day.js
  28. +5 −2 apps/calendar/js/templates/month.js
  29. +3 −1 apps/calendar/js/templates/week.js
  30. +1 −1 apps/calendar/js/time_observer.js
  31. +1 −1 apps/calendar/js/utils/input_parser.js
  32. +1 −1 apps/calendar/js/view.js
  33. +26 −0 apps/calendar/js/views/errors.js
  34. +5 −0 apps/calendar/js/views/modify_account.js
  35. +14 −3 apps/calendar/js/views/modify_event.js
  36. +22 −7 apps/calendar/js/views/month_child.js
  37. +0 −18 apps/calendar/js/views/settings.js
  38. +1 −1 apps/calendar/js/views/week_child.js
  39. +1 −1 apps/calendar/js/worker/manager.js
  40. +1 −0 apps/calendar/locales/calendar.en-US.properties
  41. +1 −1 apps/calendar/style/settings.css
  42. +1 −1 apps/calendar/style/ui.css
  43. +1 −1 apps/calendar/test/integration/navigation_test.js
  44. +133 −1 apps/calendar/test/unit/app_test.js
  45. +2 −2 apps/calendar/test/unit/batch_test.js
  46. +13 −0 apps/calendar/test/unit/calendar_test.js
  47. +10 −10 apps/calendar/test/unit/controllers/alarm_test.js
  48. +273 −0 apps/calendar/test/unit/controllers/recurring_events_test.js
  49. +2 −2 apps/calendar/test/unit/controllers/sync_test.js
  50. +6 −6 apps/calendar/test/unit/controllers/time_test.js
  51. +9 −9 apps/calendar/test/unit/db_test.js
  52. +9 −2 apps/calendar/test/unit/helper.js
  53. +3 −3 apps/calendar/test/unit/mozalarm_shim_test.js
  54. +71 −111 apps/calendar/test/unit/provider/caldav_pull_events_test.js
  55. +339 −48 apps/calendar/test/unit/provider/caldav_test.js
  56. +1 −1 apps/calendar/test/unit/provider/local_test.js
  57. +1 −1 apps/calendar/test/unit/router_test.js
  58. +283 −32 apps/calendar/test/unit/service/caldav_test.js
  59. +24 −5 apps/calendar/test/unit/service/helper.js
  60. +276 −0 apps/calendar/test/unit/service/ical_recur_expansion_test.js
  61. +5 −5 apps/calendar/test/unit/store/abstract_test.js
  62. +1 −1 apps/calendar/test/unit/store/alarm_test.js
  63. +1 −1 apps/calendar/test/unit/store/busytime_test.js
  64. +1 −1 apps/calendar/test/unit/store/event_test.js
  65. +55 −2 apps/calendar/test/unit/store/ical_component_test.js
  66. +1 −1 apps/calendar/test/unit/store/setting_test.js
  67. +7 −1 apps/calendar/test/unit/support/factories/all.js
  68. +1 −1 apps/calendar/test/unit/support/factory.js
  69. +3 −3 apps/calendar/test/unit/support/fake_page.js
  70. +2 −2 apps/calendar/test/unit/utils/account_creation_test.js
  71. +1 −1 apps/calendar/test/unit/view_test.js
  72. +1 −1 apps/calendar/test/unit/views/advanced_settings_test.js
  73. +3 −3 apps/calendar/test/unit/views/calendar_colors_test.js
  74. +2 −2 apps/calendar/test/unit/views/create_account_test.js
  75. +3 −3 apps/calendar/test/unit/views/day_test.js
  76. +23 −0 apps/calendar/test/unit/views/errors_test.js
  77. +8 −8 apps/calendar/test/unit/views/modify_account_test.js
  78. +4 −2 apps/calendar/test/unit/views/modify_event_test.js
  79. +40 −32 apps/calendar/test/unit/views/month_child_test.js
  80. +2 −2 apps/calendar/test/unit/views/month_test.js
  81. +1 −1 apps/calendar/test/unit/views/months_day_test.js
  82. +2 −29 apps/calendar/test/unit/views/settings_test.js
  83. +1 −1 apps/calendar/test/unit/views/time_header_test.js
  84. +1 −1 apps/calendar/test/unit/views/time_parent_test.js
  85. +2 −2 apps/calendar/test/unit/worker/manager_test.js
  86. +7 −1 apps/camera/js/camera.js
  87. +1 −0 apps/clock/index.html
  88. +160 −136 apps/clock/js/alarm.js
  89. +211 −0 apps/clock/js/alarmManager.js
  90. +21 −6 apps/clock/js/onring.js
  91. +2 −4 apps/communications/contacts/fb_import.html
  92. +27 −28 apps/communications/contacts/index.html
  93. +1 −7 apps/communications/contacts/js/contacts.js
  94. +10 −4 apps/communications/contacts/js/contacts_form.js
  95. +0 −87 apps/communications/contacts/js/input_cancel_button.js
  96. +13 −10 apps/communications/contacts/js/search.js
  97. +3 −0 apps/communications/contacts/locales/locales.ini
  98. +0 −7 apps/communications/contacts/style/contacts.css
  99. BIN apps/communications/contacts/style/images/edit-contact.png
  100. +0 −15 apps/communications/contacts/style/input_cancel_button.css
  101. +1 −1 apps/communications/contacts/style/search.css
  102. +1 −0 apps/communications/dialer/index.html
  103. +8 −96 apps/communications/dialer/js/dialer.js
  104. +2 −2 apps/communications/dialer/js/recents.js
  105. +105 −0 apps/communications/dialer/js/telephony_helper.js
  106. +0 −7 apps/communications/dialer/locales/dialer.en-US.properties
  107. +0 −7 apps/communications/dialer/locales/dialer.fr.properties
  108. +0 −7 apps/communications/dialer/locales/dialer.zh-TW.properties
  109. +3 −0 apps/communications/dialer/locales/locales.ini
  110. +7 −0 apps/communications/dialer/locales/shared.en-US.properties
  111. +7 −0 apps/communications/dialer/locales/shared.fr.properties
  112. +7 −0 apps/communications/dialer/locales/shared.zh-TW.properties
  113. BIN apps/communications/dialer/style/images/ActionIcon_40x40_recents.png
  114. BIN apps/communications/dialer/style/images/ComLog_200x200_clock.png
  115. BIN apps/communications/dialer/style/images/recents.png
  116. +1 −1 apps/communications/dialer/style/oncall.css
  117. +7 −1 apps/communications/ftu/css/style.css
  118. +39 −6 apps/communications/ftu/index.html
  119. +1 −0 apps/communications/ftu/js/app.js
  120. +43 −0 apps/communications/ftu/js/basket-client.js
  121. +3 −2 apps/communications/ftu/js/sim_manager.js
  122. +71 −9 apps/communications/ftu/js/ui.js
  123. +3 −4 apps/communications/ftu/js/wifi.js
  124. +12 −15 apps/communications/ftu/locales/ftu.en-US.properties
  125. +1 −2 apps/costcontrol/fte.html
  126. +1 −1 apps/costcontrol/index.html
  127. +6 −1 apps/costcontrol/js/fte.js
  128. +2 −1 apps/costcontrol/js/message_handler.js
  129. +7 −7 apps/email/js/ext/gaia-email-opt.js
  130. +4 −2 apps/homescreen/everything.me/js/etmmanager.js
  131. +7 −0 apps/homescreen/index.html
  132. +4 −1 apps/homescreen/js/bookmark.js
  133. +20 −5 apps/homescreen/js/dock.js
  134. +2 −1 apps/homescreen/js/grid.js
  135. +14 −4 apps/homescreen/js/homescreen.js
  136. +27 −1 apps/homescreen/js/page.js
  137. +2 −1 apps/homescreen/manifest.webapp
  138. BIN apps/homescreen/resources/images/delete.png
  139. +9 −0 apps/homescreen/style/app_name_mask.svg
  140. +8 −4 apps/homescreen/style/dock.css
  141. +22 −4 apps/homescreen/style/grid.css
  142. +10 −10 apps/settings/index.html
  143. +1 −3 apps/settings/js/apps.js
  144. +5 −1 apps/settings/js/bluetooth.js
  145. +2 −2 apps/settings/js/date_time.js
  146. +72 −2 apps/settings/js/icc.js
  147. +14 −1 apps/settings/js/settings.js
  148. +65 −0 apps/settings/js/support.js
  149. +6 −1 apps/settings/js/wifi.js
  150. +3 −14 apps/settings/locales/settings.en-US.properties
  151. +1 −13 apps/settings/locales/settings.fr.properties
  152. +1 −13 apps/settings/locales/settings.zh-TW.properties
  153. +3 −5 apps/settings/style/settings.css
  154. +2 −2 apps/system/js/activities.js
  155. +74 −19 apps/system/js/screen_manager.js
  156. +13 −5 apps/system/js/trusted_ui.js
  157. +38 −16 apps/system/js/window_manager.js
  158. +2 −1 apps/system/js/wrapper.js
  159. +12 −0 apps/system/locales/system.en-US.properties
  160. +13 −2 apps/system/style/value_selector/value_selector.css
  161. +34 −24 apps/video/js/view.js
  162. +177 −0 apps/video/js/youtube.js
  163. +3 −2 apps/video/manifest.webapp
  164. BIN apps/video/style/images/spinner.png
  165. +33 −0 apps/video/style/spinner.css
  166. +4 −0 apps/video/view.html
  167. +58 −22 build/applications-data.js
  168. +2 −2 build/settings.py
  169. +21 −17 build/utils.js
  170. +81 −16 build/webapp-l10n.js
  171. +10 −3 build/webapp-zip.js
  172. +3 −0 external-apps/maps/manifest.webapp
  173. +0 −8 external-apps/marketplace-dev/cache/login.persona.org/include.js
  174. +0 −15 external-apps/marketplace-dev/cache/manifest.appcache
  175. +0 −1 external-apps/marketplace-dev/cache/marketplace-dev-cdn.allizom.org/media/css/mkt/consumer-min.css
  176. +0 −18 external-apps/marketplace-dev/cache/marketplace-dev-cdn.allizom.org/media/js/mkt/consumer-min.js
  177. BIN external-apps/marketplace-dev/cache/marketplace-dev.allizom.org/telefonica/media/img/mkt/grain.png
  178. +0 −277 external-apps/marketplace-dev/cache/marketplace-dev.allizom.org/telefonica/offline/home
  179. +0 −15 external-apps/marketplace-dev/manifest.webapp
  180. +0 −3 external-apps/marketplace-dev/metadata.json
  181. +0 −13 external-apps/marketplace-staging/manifest.webapp
  182. +0 −3 external-apps/marketplace-staging/metadata.json
  183. +52 −4 shared/js/gesture_detector.js
  184. +31 −10 shared/js/l10n.js
  185. +45 −23 shared/js/tz_select.js
  186. +11 −11 shared/locales/tz/tz.en-US.properties
  187. +12 −11 shared/locales/tz/tz.fr.properties
  188. +3 −2 shared/resources/tz.json
  189. +4 −6 shared/style/input_areas.css
  190. +2 −2 tools/extensions/httpd/install.rdf
View
@@ -81,6 +81,7 @@ GAIA_LOCALES_PATH?=locales
LOCALES_FILE?=shared/resources/languages.json
GAIA_LOCALE_SRCDIRS=shared $(GAIA_APP_SRCDIRS)
GAIA_DEFAULT_LOCALE?=en-US
+GAIA_INLINE_LOCALES?=1
###############################################################################
# The above rules generate the profile/ folder and all its content. #
@@ -316,10 +317,12 @@ define run-js-command
const HOMESCREEN = "$(HOMESCREEN)"; const GAIA_PORT = "$(GAIA_PORT)"; \
const GAIA_APP_SRCDIRS = "$(GAIA_APP_SRCDIRS)"; \
const GAIA_LOCALES_PATH = "$(GAIA_LOCALES_PATH)"; \
+ const LOCALES_FILE = "$(LOCALES_FILE)"; \
const BUILD_APP_NAME = "$(BUILD_APP_NAME)"; \
const PRODUCTION = "$(PRODUCTION)"; \
const OFFICIAL = "$(MOZILLA_OFFICIAL)"; \
const GAIA_DEFAULT_LOCALE = "$(GAIA_DEFAULT_LOCALE)"; \
+ const GAIA_INLINE_LOCALES = "$(GAIA_INLINE_LOCALES)"; \
const GAIA_ENGINE = "xpcshell"; \
'; \
$(XULRUNNERSDK) $(XPCSHELLSDK) -e "$$JS_CONSTS" -f build/utils.js "build/$(strip $1).js"
@@ -733,7 +733,8 @@ var Browser = {
type: 'url',
url: this.currentTab.url,
name: this.currentTab.title,
- icon: place.iconUri
+ icon: place.iconUri,
+ useAsyncPanZoom: true
}
});
}).bind(this));
@@ -10,7 +10,9 @@
"permissions": {
"browser":{},
"systemXHR":{},
- "settings":{ "access": "readonly" }
+ "settings":{ "access": "readonly" },
+ "geolocation" : {},
+ "desktop-notification" : {}
},
"locales": {
"ar": {
@@ -3,6 +3,7 @@
'ext/ical',
'ext/caldav',
'ext/uuid',
+ 'service/ical_recur_expansion',
'service/caldav'].forEach(function(script) {
// ?time= is for cache busting in development...
// there have been cases where nightly would not
@@ -11,7 +12,7 @@
});
var thread = new Calendar.Thread(this);
-this.console = new thread.console();
+this.console = new thread.console('caldav worker');
thread.addRole('caldav');
@@ -95,7 +95,9 @@
</head>
<body role="application" class="loading">
-
+<section id="errors" role="status">
+ <p class="errors"></p>
+</section>
<nav class="skin-organic" id="settings" role="region">
<header>
@@ -1,5 +1,82 @@
Calendar.App = (function(window) {
+ function PendingManager() {
+ this.objects = [];
+ this.pending = 0;
+
+ this.onstart = this.onstart.bind(this);
+ this.onend = this.onend.bind(this);
+ }
+
+ PendingManager.prototype = {
+
+ onpending: function() {},
+ oncomplete: function() {},
+
+ register: function(object) {
+ object.on(object.startEvent, this.onstart);
+ object.on(object.completeEvent, this.onend);
+
+ var wasPending = this.isPending();
+
+ this.objects.push(object);
+
+ if (object.pending) {
+ this.pending++;
+
+ if (!wasPending) {
+ this.onpending();
+ }
+ }
+ },
+
+ /**
+ * Unregister an object.
+ * Note it is intended that objects that
+ * are unregistered are never in a state
+ * where we are waiting for their pending
+ * status to complete. If an incomplete
+ * object is removed it will break .pending.
+ */
+ unregister: function(object) {
+ var idx = this.objects.indexOf(object);
+
+ if (idx !== -1) {
+ var object = this.objects[idx];
+ this.objects.splice(idx, 1);
+ return true;
+ }
+ return false;
+ },
+
+ isPending: function() {
+ var len = this.objects.length;
+ var i = 0;
+
+ for (; i < len; i++) {
+ if (this.objects[i].pending)
+ return true;
+ }
+
+ return false;
+ },
+
+ onstart: function() {
+ if (!this.pending) {
+ this.onpending();
+ }
+
+ this.pending++;
+ },
+
+ onend: function() {
+ this.pending--;
+ if (!this.pending) {
+ this.oncomplete();
+ }
+ }
+ };
+
/**
* Focal point for state management
* within calendar application.
@@ -8,13 +85,17 @@ Calendar.App = (function(window) {
* location to reference database.
*/
var App = {
+ PendingManager: PendingManager,
+
//XXX: always assumes that app is never lazy loaded
startingURL: window.location.href,
_location: window.location,
_mozTimeRefreshTimeout: 3000,
+ pendingClass: 'pending-operation',
+
// Dependency map for loading
cssBase: '/style/',
jsBase: '/js/',
@@ -23,6 +104,10 @@ Calendar.App = (function(window) {
Style: {},
Templates: {},
Utils: {},
+ Controllers: {
+ RecurringEvents: []
+ },
+
Views: {
AdvancedSettings: [
{type: 'Templates', name: 'Account'}
@@ -79,7 +164,8 @@ Calendar.App = (function(window) {
{type: 'Templates', name: 'Week'},
{type: 'Utils', name: 'OrderedMap'},
{type: 'Views', name: 'DayBased'}
- ]
+ ],
+ Errors: []
}
},
@@ -95,11 +181,44 @@ Calendar.App = (function(window) {
this._providers = Object.create(null);
this._views = Object.create(null);
this._routeViewFn = Object.create(null);
+ this._pendingManger = new PendingManager();
+
+ var self = this;
+ this._pendingManger.oncomplete = function onpending() {
+ document.body.classList.remove(self.pendingClass);
+ };
+
+ this._pendingManger.onpending = function oncomplete() {
+ document.body.classList.add(self.pendingClass);
+ };
this.timeController = new Calendar.Controllers.Time(this);
this.syncController = new Calendar.Controllers.Sync(this);
this.serviceController = new Calendar.Controllers.Service(this);
this.alarmController = new Calendar.Controllers.Alarm(this);
+
+ // observe sync events
+ this.observePendingObject(this.syncController);
+ },
+
+ /**
+ * Adds observers to objects capable of being pending.
+ *
+ * Object must emit some kind of start/complete events
+ * and have the following properties:
+ *
+ * - startEvent (used to register an observer)
+ * - endEvent ( ditto )
+ * - pending
+ *
+ * @param {Object} object to observe.
+ */
+ observePendingObject: function(object) {
+ this._pendingManger.register(object);
+ },
+
+ isPending: function() {
+ return this._pendingManger.isPending();
},
/**
@@ -195,6 +314,18 @@ Calendar.App = (function(window) {
this.timeController.move(new Date());
+ // lazy load recurring event expander so as not to impact initial load.
+ this.loadResource('Controllers', 'RecurringEvents', function() {
+ self.recurringEventsController =
+ new Calendar.Controllers.RecurringEvents(self);
+
+ self.observePendingObject(
+ self.recurringEventsController
+ );
+
+ self.recurringEventsController.observe();
+ });
+
this.view('TimeHeader', function(header) {
header.render();
});
@@ -203,6 +334,8 @@ Calendar.App = (function(window) {
colors.render();
});
+ this.view('Errors');
+
document.body.classList.remove('loading');
this._routes();
},
@@ -366,10 +499,12 @@ Calendar.App = (function(window) {
this._views[name] = new Calendar.Views[name]({
app: this
});
- cb.call(this, this._views[name]);
+ if (cb) {
+ cb.call(this, this._views[name]);
+ }
}.bind(this));
- } else {
+ } else if (cb) {
cb.call(this, this._views[name]);
}
},
@@ -384,6 +519,13 @@ Calendar.App = (function(window) {
*/
store: function(name) {
return this.db.getStore(name);
+ },
+
+ /**
+ * Returns the offline status.
+ */
+ offline: function() {
+ return (navigator && 'onLine' in navigator) ? !navigator.onLine : true;
}
};
@@ -1,10 +1,22 @@
(function(window) {
+ const NEXT_TICK = 'calendar-next-tick';
+ var nextTickStack = [];
+
window.Calendar = {
DEBUG: false,
/**
+ * Very similar to node's nextTick.
+ * Much faster then setTimeout.
+ */
+ nextTick: function(callback) {
+ nextTickStack.push(callback);
+ window.postMessage(NEXT_TICK, '*');
+ },
+
+ /**
* Creates a calendar namespace.
*
* // Export a view
@@ -115,8 +127,20 @@
return mid;
}
}
-
};
+ /**
+ * next tick inspired by http://dbaron.org/log/20100309-faster-timeouts.
+ */
+ window.addEventListener('message', function handleNextTick(event) {
+ if (event.source === window && event.data == NEXT_TICK) {
+ event.stopPropagation();
+ if (nextTickStack.length) {
+ (nextTickStack.shift())();
+ }
+ }
+ });
+
+
}(this));
@@ -17,12 +17,14 @@ Calendar.ns('Controllers').Alarm = (function() {
this._wifiLock = null;
this.app.syncController.on('syncComplete', function() {
- if (self._wifiLock !== null)
+ if (self._wifiLock !== null) {
self._wifiLock.unlock();
+ self._wifiLock = null;
+ }
});
this._nextPeriodicSync = this.settings.syncAlarm;
-
+
if (this._nextPeriodicSync.alarmId === null)
this._resetSyncAlarm(false);
@@ -172,21 +174,25 @@ Calendar.ns('Controllers').Alarm = (function() {
var start = new Date();
var end = new Date(start.getTime() + duration);
- // We're resetting the sync alarm after a settings change and times are still in range
+ // We're resetting the sync alarm after a settings
+ // change and times are still in range
if (!triggered &&
this._nextPeriodicSync.end > start &&
this._nextPeriodicSync.start.getTime() + duration > start) {
start = this._nextPeriodicSync.start;
end = new Date(start.getTime() + duration);
}
-
- var request = navigator.mozAlarms.add(end, 'ignoreTimezone', {type: 'sync'});
+
+ var request = navigator.mozAlarms.add(
+ end, 'ignoreTimezone', {type: 'sync'}
+ );
+
var self = this;
request.onsuccess = function(e) {
self._nextPeriodicSync.alarmId = e.target.result;
self._nextPeriodicSync.start = start;
self._nextPeriodicSync.end = end;
- self.settings.set('syncAlarm', self._nextPeriodicSync)
+ self.settings.set('syncAlarm', self._nextPeriodicSync);
};
request.onerror = function(e) {
debug('Error setting alarm:', e.target.error.name);
Oops, something went wrong.

0 comments on commit f8e15c1

Please sign in to comment.