Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7490 from dscravag/nightly2
Browse files Browse the repository at this point in the history
Nightly 2012-11-10
  • Loading branch information
dscravag committed Jan 10, 2013
2 parents f8e15c1 + 726a738 commit 9d4983b
Show file tree
Hide file tree
Showing 173 changed files with 3,285 additions and 1,380 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -14,6 +14,7 @@ manifest.appcache
/apps/sms/js/blacklist.json
/test_apps/test-agent/test/config.json
/apps/dialer/contacts
/apps/browser/js/init.json

/apps/*/test/unit/_sandbox.html
/apps/*/test/unit/_proxy.html
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -633,7 +633,7 @@ SETTINGS_ARG=--noftu
endif

profile/settings.json: build/settings.py build/wallpaper.jpg
python build/settings.py $(SETTINGS_ARG) --console --homescreen $(SCHEME)homescreen.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --ftu $(SCHEME)communications.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --wallpaper build/wallpaper.jpg --override build/custom-settings.json --output $@
python build/settings.py $(SETTINGS_ARG) --console --locale $(GAIA_DEFAULT_LOCALE) --homescreen $(SCHEME)homescreen.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --ftu $(SCHEME)communications.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --wallpaper build/wallpaper.jpg --override build/custom-settings.json --output $@

# push profile/settings.json to the phone
install-settings-defaults: profile/settings.json
Expand Down
5 changes: 5 additions & 0 deletions apps/browser/js/authentication_dialog.js
Expand Up @@ -126,5 +126,10 @@ var AuthenticationDialog = {

originHasEvent: function(origin) {
return origin in this.currentEvents;
},

clear: function ad_clear(origin) {
if (this.currentEvents[origin])
delete this.currentEvents[origin];
}
};
92 changes: 45 additions & 47 deletions apps/browser/js/browser.js
Expand Up @@ -212,7 +212,7 @@ var Browser = {
},

handleTryReloading: function browser_handleTryReloading() {
this.navigate(this.currentTab.url);
this.reviveCrashedTab(this.currentTab);
},

handleCloseTab: function browser_handleCloseTab() {
Expand Down Expand Up @@ -412,14 +412,8 @@ var Browser = {
break;

case 'mozbrowsererror':
if (evt.detail.type === 'fatal') {
// A background crash usually means killed to save memory
if (document.mozHidden) {
this.handleKilledTab(tab);
} else {
this.handleCrashedTab(tab);
}
}
if (evt.detail.type === 'fatal')
this.handleCrashedTab(tab);
break;

case 'mozbrowserscroll':
Expand Down Expand Up @@ -493,37 +487,33 @@ var Browser = {
},

handleCrashedTab: function browser_handleCrashedTab(tab) {
if (tab.id === this.currentTab.id) {
// No need to show the crash screen for background tabs,
// they will be revived when selected
if (tab.id === this.currentTab.id && !document.mozHidden) {
this.showCrashScreen();
}

tab.loading = false;
tab.crashed = true;
ModalDialog.clear(tab.id);
AuthenticationDialog.clear(tab.id);
this.frames.removeChild(tab.dom);
delete tab.dom;
delete tab.screenshot;
tab.loading = false;
this.createTab(null, null, tab);
this.refreshButtons();
},

handleKilledTab: function browser_handleKilledTab(tab) {
tab.killed = true;
this.frames.removeChild(tab.dom);
delete tab.dom;
tab.loading = false;
},

handleVisibilityChange: function browser_handleVisibilityChange() {
if (!document.mozHidden && this.currentTab.killed)
this.reviveKilledTab(this.currentTab);
if (!document.mozHidden && this.currentTab.crashed)
this.reviveCrashedTab(this.currentTab);
},

reviveKilledTab: function browser_reviveKilledTab(tab) {
reviveCrashedTab: function browser_reviveCrashedTab(tab) {
this.createTab(null, null, tab);
this.setTabVisibility(tab, true);
this.refreshButtons();
this.navigate(tab.url);
tab.killed = false;
tab.crashed = false;
this.hideCrashScreen();
},

handleWindowOpen: function browser_handleWindowOpen(evt) {
Expand Down Expand Up @@ -562,10 +552,6 @@ var Browser = {
},

navigate: function browser_navigate(url) {
if (this.currentTab.crashed) {
this.currentTab.crashed = false;
this.hideCrashScreen();
}
this.hideStartscreen();
this.showPageScreen();
this.currentTab.title = null;
Expand Down Expand Up @@ -601,30 +587,37 @@ var Browser = {
e.preventDefault();
}

if (this.currentTab.crashed && this.urlButtonMode == this.REFRESH) {
if (this.urlButtonMode == this.REFRESH && this.currentTab.crashed) {
this.setUrlBar(this.currentTab.url);
this.navigate(this.currentTab.url);
this.reviveCrashedTab(this.currentTab);
return;
}

if (this.urlButtonMode == this.REFRESH) {
if (this.urlButtonMode == this.REFRESH && !this.currentTab.crashed) {
this.currentTab.dom.reload(true);
return;
}

if (this.urlButtonMode == this.STOP) {
if (this.urlButtonMode == this.STOP && !this.currentTab.crashed) {
this.currentTab.dom.stop();
return;
}

var url = this.getUrlFromInput(this.urlInput.value);

if (url !== this.currentTab.url && !this.currentTab.crashed) {
if (url !== this.currentTab.url) {
this.setUrlBar(url);
this.currentTab.url = url;
}
this.navigate(url);

this.urlInput.blur();

if (this.currentTab.crashed) {
this.reviveCrashedTab(this.currentTab);
return;
}

this.navigate(url);
},

goBack: function browser_goBack() {
Expand Down Expand Up @@ -852,20 +845,20 @@ var Browser = {
}
},

showTopSitesTab: function browser_showTopSitesTab(filter) {
showTopSitesTab: function browser_showTopSitesTab() {
this.deselectAwesomescreenTabs();
this.topSitesTab.classList.add('selected');
this.topSites.classList.add('selected');
Places.getTopSites(20, filter, this.showTopSites.bind(this));
Places.getTopSites(20, null, this.showTopSites.bind(this));
},

showTopSites: function browser_showTopSites(topSites, filter) {
showTopSites: function browser_showTopSites(topSites) {
this.topSites.innerHTML = '';
var list = document.createElement('ul');
list.setAttribute('role', 'listbox');
this.topSites.appendChild(list);
topSites.forEach(function browser_processTopSite(data) {
this.drawAwesomescreenListItem(list, data, filter);
this.drawAwesomescreenListItem(list, data);
}, this);
},

Expand Down Expand Up @@ -1131,6 +1124,9 @@ var Browser = {
},

setTabVisibility: function(tab, visible) {
if (!tab.dom)
return;

if (ModalDialog.originHasEvent(tab.id)) {
if (visible) {
ModalDialog.show(tab.id);
Expand All @@ -1146,18 +1142,17 @@ var Browser = {
AuthenticationDialog.hide();
}
}

// We put loading tabs off screen as we want to screenshot
// them when loaded
if (tab.loading && !visible) {
tab.dom.style.top = '-999px';
return;
}
if (tab.dom.setVisible) {

if (tab.dom.setVisible)
tab.dom.setVisible(visible);
}
if (tab.crashed) {
this.showCrashScreen();
}

tab.dom.style.display = visible ? 'block' : 'none';
tab.dom.style.top = '0px';
},
Expand Down Expand Up @@ -1215,8 +1210,11 @@ var Browser = {

deleteTab: function browser_deleteTab(id) {
var tabIds = Object.keys(this.tabs);
this.tabs[id].dom.parentNode.removeChild(this.tabs[id].dom);
if (this.tabs[id].dom)
this.tabs[id].dom.parentNode.removeChild(this.tabs[id].dom);
delete this.tabs[id];
ModalDialog.clear(id);
AuthenticationDialog.clear(id);
if (this.currentTab && this.currentTab.id === id) {
// The tab to be selected when the current one is deleted
var newTab = tabIds.indexOf(id);
Expand Down Expand Up @@ -1256,9 +1254,9 @@ var Browser = {

selectTab: function browser_selectTab(id) {
this.currentTab = this.tabs[id];
// If the tab was killed, bring it back to life
if (this.currentTab.killed)
this.reviveKilledTab(this.currentTab);
// If the tab crashed, bring it back to life
if (this.currentTab.crashed)
this.reviveCrashedTab(this.currentTab);
// We may have picked a currently loading background tab
// that was positioned off screen
this.setUrlBar(this.currentTab.title);
Expand Down
7 changes: 6 additions & 1 deletion apps/browser/js/modal_dialog.js
Expand Up @@ -70,7 +70,7 @@ var ModalDialog = {
break;

case 'click':
if (evt.currentTarget.nodeName == "BUTTON" ||
if (evt.currentTarget.nodeName == 'BUTTON' ||
evt.currentTarget == elements.customPromptButtons) {
evt.preventDefault();
}
Expand Down Expand Up @@ -242,5 +242,10 @@ var ModalDialog = {

originHasEvent: function(origin) {
return origin in this.currentEvents;
},

clear: function ad_clear(origin) {
if (this.currentEvents[origin])
delete this.currentEvents[origin];
}
};
3 changes: 3 additions & 0 deletions apps/browser/style/browser.css
Expand Up @@ -878,6 +878,9 @@ li[role="listitem"] small {

#settings li button {
margin: 0;
height: auto;
line-height: 2rem;
padding: 1rem 1.5rem;
}


Expand Down
52 changes: 52 additions & 0 deletions apps/calendar/js/app.js
Expand Up @@ -201,6 +201,55 @@ Calendar.App = (function(window) {
this.observePendingObject(this.syncController);
},

/**
* Observes localized events and localizes elements
* with data-l10n-date-format should be registered
* after the first localized event.
*
*
* Example:
*
*
* <span
* data-date="Wed Jan 09 2013 19:25:38 GMT+0100 (CET)"
* data-l10n-date-format="%x">
*
* 2013/9/19
*
* </span>
*
*/
observeDateLocalization: function() {
function localize() {
var elements = document.querySelectorAll(
'[data-l10n-date-format]'
);

var len = elements.length;
var i = 0;

var date;
var format;
var el;

for (; i < len; i++) {
el = elements[i];

date = el.dataset.date;
format = el.dataset.l10nDateFormat;

if (date) {
el.textContent = Calendar.App.dateFormat.localeFormat(
new Date(date),
format
);
}
}
}

window.addEventListener('localized', localize);
},

/**
* Adds observers to objects capable of being pending.
*
Expand Down Expand Up @@ -304,6 +353,9 @@ Calendar.App = (function(window) {

this.dateFormat = navigator.mozL10n.DateTimeFormat();

// re-localize dates on screen
this.observeDateLocalization();

this.timeController.observe();
this.alarmController.observe();

Expand Down
1 change: 1 addition & 0 deletions apps/calendar/js/db.js
Expand Up @@ -379,6 +379,7 @@
account._id = uuid();

var calendar = {
_id: Calendar.Provider.Local.calendarId,
accountId: account._id,
remote: Calendar.Provider.Local.defaultCalendar()
};
Expand Down

0 comments on commit 9d4983b

Please sign in to comment.