diff --git a/CLOBBER b/CLOBBER index 42e5a0800d7..1a23e9a0205 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1016529 - Updating Android SDK to include Google Play Services +Multiple bugs that happened to trigger bug 1042115. diff --git a/Makefile.in b/Makefile.in index 19429320a5b..a2c5d141b1e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -200,6 +200,7 @@ MAKE_SYM_STORE_ARGS := -c --vcs-info DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms MAKE_SYM_STORE_PATH := $(DIST)/bin endif +MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist_include,$(DIST)/include SYM_STORE_SOURCE_DIRS := $(topsrcdir) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 445e6e882a2..3f0637e03d0 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 3faa434827e..d9405d1c8f8 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 b8d2cda6cb1..6c6a2d018e6 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 445e6e882a2..3f0637e03d0 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5cd2c79f105..9382e2adf06 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 8cb2bacce60..740dc62489d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "3762f6bf4b014e34e62162e84c6acf7deebbbcfa", + "revision": "97a95feb1d1505c9d179266fee891e600ad8760b", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 65924565f08..077ed79a015 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 476fd421519..626c507870e 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 b6f994e0859..5b77eacd749 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 e53732d5466..10d3d5c2b3b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml index ea097e3aa1b..5308769bde6 100644 --- a/browser/app/blocklist.xml +++ b/browser/app/blocklist.xml @@ -1,5 +1,5 @@ - + @@ -38,6 +38,12 @@ + + + + + + @@ -123,8 +129,8 @@ - - + + @@ -457,6 +463,12 @@ + + + + + + @@ -739,8 +751,8 @@ - - + + @@ -757,8 +769,8 @@ - - + + @@ -1245,8 +1257,8 @@ - - + + @@ -1426,6 +1438,12 @@ + + + + + + @@ -1844,6 +1862,12 @@ + + + + + + diff --git a/browser/base/content/aboutneterror/info.svg b/browser/base/content/aboutneterror/info.svg index 2d3e564b8ec..5b586334345 100644 --- a/browser/base/content/aboutneterror/info.svg +++ b/browser/base/content/aboutneterror/info.svg @@ -1,6 +1,6 @@ - - + + diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 74e0fbd4253..f90ed9b0956 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5604,7 +5604,7 @@ var OfflineApps = { // OfflineApps Implementation Methods // XXX: _getBrowserWindowForContentWindow and _getBrowserForContentWindow - // were taken from browser/components/feeds/src/WebContentConverter. + // were taken from browser/components/feeds/WebContentConverter. _getBrowserWindowForContentWindow: function(aContentWindow) { return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build index 3c6f304fcde..629e539b8f2 100644 --- a/browser/components/build/moz.build +++ b/browser/components/build/moz.build @@ -19,9 +19,9 @@ IS_COMPONENT = True LOCAL_INCLUDES += [ '../about', '../dirprovider', - '../feeds/src', - '../migration/src', - '../shell/src', + '../feeds', + '../migration', + '../shell', ] USE_LIBS += [ diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm similarity index 100% rename from browser/components/customizableui/src/CustomizableUI.jsm rename to browser/components/customizableui/CustomizableUI.jsm diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm similarity index 100% rename from browser/components/customizableui/src/CustomizableWidgets.jsm rename to browser/components/customizableui/CustomizableWidgets.jsm diff --git a/browser/components/customizableui/src/CustomizeMode.jsm b/browser/components/customizableui/CustomizeMode.jsm similarity index 100% rename from browser/components/customizableui/src/CustomizeMode.jsm rename to browser/components/customizableui/CustomizeMode.jsm diff --git a/browser/components/customizableui/src/DragPositionManager.jsm b/browser/components/customizableui/DragPositionManager.jsm similarity index 100% rename from browser/components/customizableui/src/DragPositionManager.jsm rename to browser/components/customizableui/DragPositionManager.jsm diff --git a/browser/components/customizableui/src/PanelWideWidgetTracker.jsm b/browser/components/customizableui/PanelWideWidgetTracker.jsm similarity index 100% rename from browser/components/customizableui/src/PanelWideWidgetTracker.jsm rename to browser/components/customizableui/PanelWideWidgetTracker.jsm diff --git a/browser/components/customizableui/src/ScrollbarSampler.jsm b/browser/components/customizableui/ScrollbarSampler.jsm similarity index 100% rename from browser/components/customizableui/src/ScrollbarSampler.jsm rename to browser/components/customizableui/ScrollbarSampler.jsm diff --git a/browser/components/customizableui/src/logging.js b/browser/components/customizableui/logging.js similarity index 100% rename from browser/components/customizableui/src/logging.js rename to browser/components/customizableui/logging.js diff --git a/browser/components/customizableui/moz.build b/browser/components/customizableui/moz.build index 0f9ebfb4c11..4c20c05f55f 100644 --- a/browser/components/customizableui/moz.build +++ b/browser/components/customizableui/moz.build @@ -6,7 +6,26 @@ PARALLEL_DIRS += [ 'content', - 'src', ] BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +EXTRA_JS_MODULES += [ + 'DragPositionManager.jsm', + 'ScrollbarSampler.jsm', +] + +DEFINES['E10S_TESTING_ONLY'] = CONFIG['E10S_TESTING_ONLY'] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): + DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1 + +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'): + DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1 + +EXTRA_PP_JS_MODULES += [ + 'CustomizableUI.jsm', + 'CustomizableWidgets.jsm', + 'CustomizeMode.jsm', + 'PanelWideWidgetTracker.jsm', +] diff --git a/browser/components/customizableui/src/moz.build b/browser/components/customizableui/src/moz.build deleted file mode 100644 index f5e98c08c5d..00000000000 --- a/browser/components/customizableui/src/moz.build +++ /dev/null @@ -1,25 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXTRA_JS_MODULES += [ - 'DragPositionManager.jsm', - 'ScrollbarSampler.jsm', -] - -DEFINES['E10S_TESTING_ONLY'] = CONFIG['E10S_TESTING_ONLY'] - -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): - DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1 - -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'): - DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1 - -EXTRA_PP_JS_MODULES += [ - 'CustomizableUI.jsm', - 'CustomizableWidgets.jsm', - 'CustomizeMode.jsm', - 'PanelWideWidgetTracker.jsm', -] diff --git a/browser/components/downloads/src/BrowserDownloads.manifest b/browser/components/downloads/BrowserDownloads.manifest similarity index 100% rename from browser/components/downloads/src/BrowserDownloads.manifest rename to browser/components/downloads/BrowserDownloads.manifest diff --git a/browser/components/downloads/src/DownloadsCommon.jsm b/browser/components/downloads/DownloadsCommon.jsm similarity index 100% rename from browser/components/downloads/src/DownloadsCommon.jsm rename to browser/components/downloads/DownloadsCommon.jsm diff --git a/browser/components/downloads/src/DownloadsLogger.jsm b/browser/components/downloads/DownloadsLogger.jsm similarity index 100% rename from browser/components/downloads/src/DownloadsLogger.jsm rename to browser/components/downloads/DownloadsLogger.jsm diff --git a/browser/components/downloads/src/DownloadsStartup.js b/browser/components/downloads/DownloadsStartup.js similarity index 100% rename from browser/components/downloads/src/DownloadsStartup.js rename to browser/components/downloads/DownloadsStartup.js diff --git a/browser/components/downloads/src/DownloadsTaskbar.jsm b/browser/components/downloads/DownloadsTaskbar.jsm similarity index 100% rename from browser/components/downloads/src/DownloadsTaskbar.jsm rename to browser/components/downloads/DownloadsTaskbar.jsm diff --git a/browser/components/downloads/src/DownloadsUI.js b/browser/components/downloads/DownloadsUI.js similarity index 100% rename from browser/components/downloads/src/DownloadsUI.js rename to browser/components/downloads/DownloadsUI.js diff --git a/browser/components/downloads/moz.build b/browser/components/downloads/moz.build index e43c5774c55..d93cfa1853c 100644 --- a/browser/components/downloads/moz.build +++ b/browser/components/downloads/moz.build @@ -4,14 +4,19 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['src'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -XPCSHELL_TESTS_MANIFESTS += [ - 'test/unit/xpcshell.ini', +JAR_MANIFESTS += ['jar.mn'] + +EXTRA_COMPONENTS += [ + 'BrowserDownloads.manifest', + 'DownloadsStartup.js', + 'DownloadsUI.js', ] -BROWSER_CHROME_MANIFESTS += [ - 'test/browser/browser.ini', +EXTRA_JS_MODULES += [ + 'DownloadsCommon.jsm', + 'DownloadsLogger.jsm', + 'DownloadsTaskbar.jsm', ] - -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/components/downloads/src/moz.build b/browser/components/downloads/src/moz.build deleted file mode 100644 index f7b6c7e686c..00000000000 --- a/browser/components/downloads/src/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXTRA_COMPONENTS += [ - 'BrowserDownloads.manifest', - 'DownloadsStartup.js', - 'DownloadsUI.js', -] - -EXTRA_JS_MODULES += [ - 'DownloadsCommon.jsm', - 'DownloadsLogger.jsm', - 'DownloadsTaskbar.jsm', -] - diff --git a/browser/components/feeds/src/BrowserFeeds.manifest b/browser/components/feeds/BrowserFeeds.manifest similarity index 100% rename from browser/components/feeds/src/BrowserFeeds.manifest rename to browser/components/feeds/BrowserFeeds.manifest diff --git a/browser/components/feeds/src/FeedConverter.js b/browser/components/feeds/FeedConverter.js similarity index 100% rename from browser/components/feeds/src/FeedConverter.js rename to browser/components/feeds/FeedConverter.js diff --git a/browser/components/feeds/src/FeedWriter.js b/browser/components/feeds/FeedWriter.js similarity index 100% rename from browser/components/feeds/src/FeedWriter.js rename to browser/components/feeds/FeedWriter.js diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/WebContentConverter.js similarity index 100% rename from browser/components/feeds/src/WebContentConverter.js rename to browser/components/feeds/WebContentConverter.js diff --git a/browser/components/feeds/moz.build b/browser/components/feeds/moz.build index 97ead0f9873..429339039a9 100644 --- a/browser/components/feeds/moz.build +++ b/browser/components/feeds/moz.build @@ -4,18 +4,38 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +MOCHITEST_CHROME_MANIFESTS += ['test/chrome/chrome.ini'] +MOCHITEST_MANIFESTS += ['test/mochitest.ini'] -XPCSHELL_TESTS_MANIFESTS += [ - 'test/unit/xpcshell.ini', +JAR_MANIFESTS += ['jar.mn'] + +XPIDL_SOURCES += [ + 'nsIFeedResultService.idl', + 'nsIWebContentConverterRegistrar.idl', ] -MOCHITEST_CHROME_MANIFESTS += [ - 'test/chrome/chrome.ini', +XPIDL_MODULE = 'browser-feeds' + +SOURCES += [ + 'nsFeedSniffer.cpp', ] -MOCHITEST_MANIFESTS += [ - 'test/mochitest.ini' +EXTRA_COMPONENTS += [ + 'BrowserFeeds.manifest', + 'FeedConverter.js', + 'WebContentConverter.js', ] -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file +EXTRA_PP_COMPONENTS += [ + 'FeedWriter.js', +] + +FINAL_LIBRARY = 'browsercomps' + +for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): + DEFINES[var] = CONFIG[var] + +LOCAL_INCLUDES += [ + '../build', +] diff --git a/browser/components/feeds/src/nsFeedSniffer.cpp b/browser/components/feeds/nsFeedSniffer.cpp similarity index 100% rename from browser/components/feeds/src/nsFeedSniffer.cpp rename to browser/components/feeds/nsFeedSniffer.cpp diff --git a/browser/components/feeds/src/nsFeedSniffer.h b/browser/components/feeds/nsFeedSniffer.h similarity index 100% rename from browser/components/feeds/src/nsFeedSniffer.h rename to browser/components/feeds/nsFeedSniffer.h diff --git a/browser/components/feeds/public/nsIFeedResultService.idl b/browser/components/feeds/nsIFeedResultService.idl similarity index 100% rename from browser/components/feeds/public/nsIFeedResultService.idl rename to browser/components/feeds/nsIFeedResultService.idl diff --git a/browser/components/feeds/public/nsIWebContentConverterRegistrar.idl b/browser/components/feeds/nsIWebContentConverterRegistrar.idl similarity index 100% rename from browser/components/feeds/public/nsIWebContentConverterRegistrar.idl rename to browser/components/feeds/nsIWebContentConverterRegistrar.idl diff --git a/browser/components/feeds/public/moz.build b/browser/components/feeds/public/moz.build deleted file mode 100644 index 664ff93bd40..00000000000 --- a/browser/components/feeds/public/moz.build +++ /dev/null @@ -1,13 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIFeedResultService.idl', - 'nsIWebContentConverterRegistrar.idl', -] - -XPIDL_MODULE = 'browser-feeds' - diff --git a/browser/components/feeds/src/moz.build b/browser/components/feeds/src/moz.build deleted file mode 100644 index 31639f79396..00000000000 --- a/browser/components/feeds/src/moz.build +++ /dev/null @@ -1,29 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -SOURCES += [ - 'nsFeedSniffer.cpp', -] - -EXTRA_COMPONENTS += [ - 'BrowserFeeds.manifest', - 'FeedConverter.js', - 'WebContentConverter.js', -] - -EXTRA_PP_COMPONENTS += [ - 'FeedWriter.js', -] - -FINAL_LIBRARY = 'browsercomps' - -for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): - DEFINES[var] = CONFIG[var] - -LOCAL_INCLUDES += [ - '../../build', -] - diff --git a/browser/components/loop/content/js/client.js b/browser/components/loop/content/js/client.js index cac153651d9..bd4aff58789 100644 --- a/browser/components/loop/content/js/client.js +++ b/browser/components/loop/content/js/client.js @@ -82,7 +82,15 @@ loop.Client = (function($) { * @param {Function} cb Callback(err) */ _ensureRegistered: function(cb) { - this.mozLoop.ensureRegistered(cb); + this.mozLoop.ensureRegistered(function(error) { + if (error) { + console.log("Error registering with Loop server, code: " + error); + cb(error); + return; + } else { + cb(null); + } + }); }, /** @@ -125,6 +133,45 @@ loop.Client = (function($) { }); }, + /** + * Block call URL based on the token identifier + * + * @param {string} token Conversation identifier used to block the URL + * @param {function} cb Callback function used for handling an error + * response. XXX The incoming call panel does not + * exist after the block button is clicked therefore + * it does not make sense to display an error. + **/ + deleteCallUrl: function(token, cb) { + this._ensureRegistered(function(err) { + if (err) { + cb(err); + return; + } + + this._deleteCallUrlInternal(token, cb); + }.bind(this)); + }, + + _deleteCallUrlInternal: function(token, cb) { + this.mozLoop.hawkRequest("/call-url/" + token, "DELETE", null, + (error, responseText) => { + if (error) { + this._failureHandler(cb, error); + return; + } + + try { + cb(null); + + this.mozLoop.noteCallUrlExpiry((new Date()).getTime() / 1000); + } catch (err) { + console.log("Error deleting call info", err); + cb(err); + } + }); + }, + /** * Requests a call URL from the Loop server. It will note the * expiry time for the url with the mozLoop api. @@ -142,7 +189,6 @@ loop.Client = (function($) { requestCallUrl: function(nickname, cb) { this._ensureRegistered(function(err) { if (err) { - console.log("Error registering with Loop server, code: " + err); cb(err); return; } diff --git a/browser/components/loop/content/js/conversation.js b/browser/components/loop/content/js/conversation.js index 0ab97096f15..56bc64c5cc8 100644 --- a/browser/components/loop/content/js/conversation.js +++ b/browser/components/loop/content/js/conversation.js @@ -27,6 +27,27 @@ loop.conversation = (function(OT, mozL10n) { model: React.PropTypes.func.isRequired }, + getInitialState: function() { + return {showDeclineMenu: false}; + }, + + componentDidMount: function() { + window.addEventListener('click', this.clickHandler); + window.addEventListener('blur', this._hideDeclineMenu); + }, + + componentWillUnmount: function() { + window.removeEventListener('click', this.clickHandler); + window.removeEventListener('blur', this._hideDeclineMenu); + }, + + clickHandler: function(e) { + var target = e.target; + if (!target.classList.contains('btn-chevron')) { + this._hideDeclineMenu(); + } + }, + /** * Used for adding different styles to the panel * @returns {String} Corresponds to the client platform @@ -55,19 +76,56 @@ loop.conversation = (function(OT, mozL10n) { this.props.model.trigger("decline"); }, + _handleDeclineBlock: function(e) { + this.props.model.trigger("declineAndBlock"); + /* Prevent event propagation + * stop the click from reaching parent element */ + return false; + }, + + _toggleDeclineMenu: function() { + var currentState = this.state.showDeclineMenu; + this.setState({showDeclineMenu: !currentState}); + }, + + _hideDeclineMenu: function() { + this.setState({showDeclineMenu: false}); + }, + render: function() { /* jshint ignore:start */ - var btnClassAccept = "btn btn-error btn-decline"; - var btnClassDecline = "btn btn-success btn-accept"; + var btnClassAccept = "btn btn-success btn-accept"; + var btnClassBlock = "btn btn-error btn-block"; + var btnClassDecline = "btn btn-error btn-decline"; var conversationPanelClass = "incoming-call " + this._getTargetPlatform(); + var cx = React.addons.classSet; + var declineDropdownMenuClasses = cx({ + "native-dropdown-menu": true, + "decline-block-menu": true, + "visually-hidden": !this.state.showDeclineMenu + }); return ( - React.DOM.div( {className:conversationPanelClass}, - React.DOM.h2(null, __("incoming_call")), - React.DOM.div( {className:"button-group"}, - React.DOM.button( {className:btnClassAccept, onClick:this._handleDecline}, - __("incoming_call_decline_button") - ), - React.DOM.button( {className:btnClassDecline, onClick:this._handleAccept}, + React.DOM.div({className: conversationPanelClass}, + React.DOM.h2(null, __("incoming_call")), + React.DOM.div({className: "button-group incoming-call-action-group"}, + React.DOM.div({className: "button-chevron-menu-group"}, + React.DOM.div({className: "button-group-chevron"}, + React.DOM.div({className: "button-group"}, + React.DOM.button({className: btnClassDecline, onClick: this._handleDecline}, + __("incoming_call_decline_button") + ), + React.DOM.div({className: "btn-chevron", + onClick: this._toggleDeclineMenu} + ) + ), + React.DOM.ul({className: declineDropdownMenuClasses}, + React.DOM.li({className: "btn-block", onClick: this._handleDeclineBlock}, + __("incoming_call_decline_and_block_button") + ) + ) + ) + ), + React.DOM.button({className: btnClassAccept, onClick: this._handleAccept}, __("incoming_call_answer_button") ) ) @@ -116,7 +174,8 @@ loop.conversation = (function(OT, mozL10n) { "call/accept": "accept", "call/decline": "decline", "call/ongoing": "conversation", - "call/ended": "ended" + "call/ended": "ended", + "call/declineAndBlock": "declineAndBlock" }, /** @@ -148,6 +207,9 @@ loop.conversation = (function(OT, mozL10n) { this._conversation.once("decline", function() { this.navigate("call/decline", {trigger: true}); }.bind(this)); + this._conversation.once("declineAndBlock", function() { + this.navigate("call/declineAndBlock", {trigger: true}); + }.bind(this)); this.loadReactComponent(loop.conversation.IncomingCallView({ model: this._conversation })); @@ -173,6 +235,24 @@ loop.conversation = (function(OT, mozL10n) { window.close(); }, + /** + * Decline and block an incoming call + * @note: + * - loopToken is the callUrl identifier. It gets set in the panel + * after a callUrl is received + */ + declineAndBlock: function() { + window.navigator.mozLoop.stopAlerting(); + var token = navigator.mozLoop.getLoopCharPref('loopToken'); + var client = new loop.Client(); + client.deleteCallUrl(token, function(error) { + // XXX The conversation window will be closed when this cb is triggered + // figure out if there is a better way to report the error to the user + console.log(error); + }); + window.close(); + }, + /** * conversation is the route when the conversation is active. The start * route should be navigated to first. diff --git a/browser/components/loop/content/js/conversation.jsx b/browser/components/loop/content/js/conversation.jsx index 33d61883b39..821c23f34c0 100644 --- a/browser/components/loop/content/js/conversation.jsx +++ b/browser/components/loop/content/js/conversation.jsx @@ -27,6 +27,27 @@ loop.conversation = (function(OT, mozL10n) { model: React.PropTypes.func.isRequired }, + getInitialState: function() { + return {showDeclineMenu: false}; + }, + + componentDidMount: function() { + window.addEventListener('click', this.clickHandler); + window.addEventListener('blur', this._hideDeclineMenu); + }, + + componentWillUnmount: function() { + window.removeEventListener('click', this.clickHandler); + window.removeEventListener('blur', this._hideDeclineMenu); + }, + + clickHandler: function(e) { + var target = e.target; + if (!target.classList.contains('btn-chevron')) { + this._hideDeclineMenu(); + } + }, + /** * Used for adding different styles to the panel * @returns {String} Corresponds to the client platform @@ -55,19 +76,56 @@ loop.conversation = (function(OT, mozL10n) { this.props.model.trigger("decline"); }, + _handleDeclineBlock: function(e) { + this.props.model.trigger("declineAndBlock"); + /* Prevent event propagation + * stop the click from reaching parent element */ + return false; + }, + + _toggleDeclineMenu: function() { + var currentState = this.state.showDeclineMenu; + this.setState({showDeclineMenu: !currentState}); + }, + + _hideDeclineMenu: function() { + this.setState({showDeclineMenu: false}); + }, + render: function() { /* jshint ignore:start */ - var btnClassAccept = "btn btn-error btn-decline"; - var btnClassDecline = "btn btn-success btn-accept"; + var btnClassAccept = "btn btn-success btn-accept"; + var btnClassBlock = "btn btn-error btn-block"; + var btnClassDecline = "btn btn-error btn-decline"; var conversationPanelClass = "incoming-call " + this._getTargetPlatform(); + var cx = React.addons.classSet; + var declineDropdownMenuClasses = cx({ + "native-dropdown-menu": true, + "decline-block-menu": true, + "visually-hidden": !this.state.showDeclineMenu + }); return (

{__("incoming_call")}

-
- - +
+
+
+
    +
  • + {__("incoming_call_decline_and_block_button")} +
  • +
+
+ + @@ -116,7 +174,8 @@ loop.conversation = (function(OT, mozL10n) { "call/accept": "accept", "call/decline": "decline", "call/ongoing": "conversation", - "call/ended": "ended" + "call/ended": "ended", + "call/declineAndBlock": "declineAndBlock" }, /** @@ -148,6 +207,9 @@ loop.conversation = (function(OT, mozL10n) { this._conversation.once("decline", function() { this.navigate("call/decline", {trigger: true}); }.bind(this)); + this._conversation.once("declineAndBlock", function() { + this.navigate("call/declineAndBlock", {trigger: true}); + }.bind(this)); this.loadReactComponent(loop.conversation.IncomingCallView({ model: this._conversation })); @@ -173,6 +235,24 @@ loop.conversation = (function(OT, mozL10n) { window.close(); }, + /** + * Decline and block an incoming call + * @note: + * - loopToken is the callUrl identifier. It gets set in the panel + * after a callUrl is received + */ + declineAndBlock: function() { + window.navigator.mozLoop.stopAlerting(); + var token = navigator.mozLoop.getLoopCharPref('loopToken'); + var client = new loop.Client(); + client.deleteCallUrl(token, function(error) { + // XXX The conversation window will be closed when this cb is triggered + // figure out if there is a better way to report the error to the user + console.log(error); + }); + window.close(); + }, + /** * conversation is the route when the conversation is active. The start * route should be navigated to first. diff --git a/browser/components/loop/content/js/panel.js b/browser/components/loop/content/js/panel.js index 4b42b9c428e..03b938cb9f1 100644 --- a/browser/components/loop/content/js/panel.js +++ b/browser/components/loop/content/js/panel.js @@ -77,22 +77,22 @@ loop.panel = (function(_, mozL10n) { __("display_name_available_status"); return ( - React.DOM.div( {className:"footer component-spacer"}, - React.DOM.div( {className:"do-not-disturb"}, - React.DOM.p( {className:"dnd-status", onClick:this.showDropdownMenu}, - React.DOM.span(null, availabilityText), - React.DOM.i( {className:availabilityStatus}) - ), - React.DOM.ul( {className:availabilityDropdown, - onMouseLeave:this.hideDropdownMenu}, - React.DOM.li( {onClick:this.changeAvailability("available"), - className:"dnd-menu-item dnd-make-available"}, - React.DOM.i( {className:"status status-available"}), + React.DOM.div({className: "footer component-spacer"}, + React.DOM.div({className: "do-not-disturb"}, + React.DOM.p({className: "dnd-status", onClick: this.showDropdownMenu}, + React.DOM.span(null, availabilityText), + React.DOM.i({className: availabilityStatus}) + ), + React.DOM.ul({className: availabilityDropdown, + onMouseLeave: this.hideDropdownMenu}, + React.DOM.li({onClick: this.changeAvailability("available"), + className: "dnd-menu-item dnd-make-available"}, + React.DOM.i({className: "status status-available"}), React.DOM.span(null, __("display_name_available_status")) - ), - React.DOM.li( {onClick:this.changeAvailability("do-not-disturb"), - className:"dnd-menu-item dnd-make-unavailable"}, - React.DOM.i( {className:"status status-dnd"}), + ), + React.DOM.li({onClick: this.changeAvailability("do-not-disturb"), + className: "dnd-menu-item dnd-make-unavailable"}, + React.DOM.i({className: "status status-dnd"}), React.DOM.span(null, __("display_name_dnd_status")) ) ) @@ -115,10 +115,10 @@ loop.panel = (function(_, mozL10n) { if (this.state.seenToS == "unseen") { navigator.mozLoop.setLoopCharPref('seenToS', 'seen'); - return React.DOM.p( {className:"terms-service", - dangerouslySetInnerHTML:{__html: tosHTML}}); + return React.DOM.p({className: "terms-service", + dangerouslySetInnerHTML: {__html: tosHTML}}); } else { - return React.DOM.div(null ); + return React.DOM.div(null); } } }); @@ -130,11 +130,11 @@ loop.panel = (function(_, mozL10n) { render: function() { return ( - React.DOM.div( {className:"component-spacer share generate-url"}, - React.DOM.div( {className:"description"}, - React.DOM.p( {className:"description-content"}, this.props.summary) - ), - React.DOM.div( {className:"action"}, + React.DOM.div({className: "component-spacer share generate-url"}, + React.DOM.div({className: "description"}, + React.DOM.p({className: "description-content"}, this.props.summary) + ), + React.DOM.div({className: "action"}, this.props.children ) ) @@ -155,6 +155,10 @@ loop.panel = (function(_, mozL10n) { * Returns a random 5 character string used to identify * the conversation. * XXX this will go away once the backend changes + * @note: + * - When we get back a callUrl we use setLoopCharPref to store the token + * (the last fragment of the URL) so that it can be used to ignore&block + * the call. The preference is used by the conversation router. */ conversationIdentifier: function() { return Math.random().toString(36).substring(5); @@ -167,22 +171,28 @@ loop.panel = (function(_, mozL10n) { }, _onCallUrlReceived: function(err, callUrlData) { - // XXX this initializer is a bug, as it will cause - // setState to set the callUrl to false if one is not returned. - // Should decide on an implement correct behavior and state - // (eg set widget as disabled, state.callUrl == '') - // - var callUrl = false; - this.props.notifier.clear(); if (err) { this.props.notifier.errorL10n("unable_retrieve_url"); + this.setState({pending: false}); } else { - callUrl = callUrlData.callUrl || callUrlData.call_url; - } + try { + var callUrl = new window.URL(callUrlData.callUrl || + callUrlData.call_url); + // XXX the current server vers does not implement the callToken field + // but it exists in the API. This workaround should be removed in the future + var token = callUrlData.callToken || + callUrl.pathname.split('/').pop(); - this.setState({pending: false, callUrl: callUrl}); + navigator.mozLoop.setLoopCharPref('loopToken', token); + this.setState({pending: false, callUrl: callUrl.href}); + } catch(e) { + console.log(e); + this.props.notifier.errorL10n("unable_retrieve_url"); + this.setState({pending: false}); + } + } }, render: function() { @@ -192,10 +202,10 @@ loop.panel = (function(_, mozL10n) { // from the react lib. var cx = React.addons.classSet; return ( - PanelLayout( {summary:__("share_link_header_text")}, - React.DOM.div( {className:"invite"}, - React.DOM.input( {type:"url", value:this.state.callUrl, readOnly:"true", - className:cx({'pending': this.state.pending})} ) + PanelLayout({summary: __("share_link_header_text")}, + React.DOM.div({className: "invite"}, + React.DOM.input({type: "url", value: this.state.callUrl, readOnly: "true", + className: cx({'pending': this.state.pending})}) ) ) ); @@ -214,10 +224,10 @@ loop.panel = (function(_, mozL10n) { render: function() { return ( React.DOM.div(null, - CallUrlResult( {client:this.props.client, - notifier:this.props.notifier} ), - ToSView(null ), - AvailabilityDropdown(null ) + CallUrlResult({client: this.props.client, + notifier: this.props.notifier}), + ToSView(null), + AvailabilityDropdown(null) ) ); } @@ -284,8 +294,8 @@ loop.panel = (function(_, mozL10n) { var client = new loop.Client({ baseServerUrl: navigator.mozLoop.serverUrl }); - this.loadReactComponent(PanelView( {client:client, - notifier:this._notifier} )); + this.loadReactComponent(PanelView({client: client, + notifier: this._notifier})); } }); diff --git a/browser/components/loop/content/js/panel.jsx b/browser/components/loop/content/js/panel.jsx index fef6afcd801..77fbb536f32 100644 --- a/browser/components/loop/content/js/panel.jsx +++ b/browser/components/loop/content/js/panel.jsx @@ -155,6 +155,10 @@ loop.panel = (function(_, mozL10n) { * Returns a random 5 character string used to identify * the conversation. * XXX this will go away once the backend changes + * @note: + * - When we get back a callUrl we use setLoopCharPref to store the token + * (the last fragment of the URL) so that it can be used to ignore&block + * the call. The preference is used by the conversation router. */ conversationIdentifier: function() { return Math.random().toString(36).substring(5); @@ -167,22 +171,28 @@ loop.panel = (function(_, mozL10n) { }, _onCallUrlReceived: function(err, callUrlData) { - // XXX this initializer is a bug, as it will cause - // setState to set the callUrl to false if one is not returned. - // Should decide on an implement correct behavior and state - // (eg set widget as disabled, state.callUrl == '') - // - var callUrl = false; - this.props.notifier.clear(); if (err) { this.props.notifier.errorL10n("unable_retrieve_url"); + this.setState({pending: false}); } else { - callUrl = callUrlData.callUrl || callUrlData.call_url; - } + try { + var callUrl = new window.URL(callUrlData.callUrl || + callUrlData.call_url); + // XXX the current server vers does not implement the callToken field + // but it exists in the API. This workaround should be removed in the future + var token = callUrlData.callToken || + callUrl.pathname.split('/').pop(); - this.setState({pending: false, callUrl: callUrl}); + navigator.mozLoop.setLoopCharPref('loopToken', token); + this.setState({pending: false, callUrl: callUrl.href}); + } catch(e) { + console.log(e); + this.props.notifier.errorL10n("unable_retrieve_url"); + this.setState({pending: false}); + } + } }, render: function() { diff --git a/browser/components/loop/content/shared/css/common.css b/browser/components/loop/content/shared/css/common.css index 197dc761e38..207268b5d71 100644 --- a/browser/components/loop/content/shared/css/common.css +++ b/browser/components/loop/content/shared/css/common.css @@ -53,6 +53,10 @@ img { display: none; } +.visually-hidden { + visibility: hidden; +} + .tc { text-align: center; } @@ -73,57 +77,111 @@ img { padding: 0 0.5em; border-radius: 2px; cursor: pointer; + font-size: .9em; + text-align: center; } .btn-info { - background: #0096dd; + background-color: #0096dd; border: 1px solid #0095dd; } .btn-info:hover { - background: #008acb; + background-color: #008acb; border: 1px solid #008acb; } .btn-info:active { - background: #006b9d; + background-color: #006b9d; border: 1px solid #006b9d; } .btn-success { - background: #74bf43; + background-color: #74bf43; border: 1px solid #74bf43; } .btn-success:hover { - background: #6cb23e; + background-color: #6cb23e; border: 1px solid #6cb23e; } .btn-success:active { - background: #64a43a; + background-color: #64a43a; border: 1px solid #64a43a; } .btn-warning { - background: #f0ad4e; + background-color: #f0ad4e; } -.btn-error { - background: #d74345; +.btn-error, +.btn-error + .btn-chevron { + background-color: #d74345; border: 1px solid #d74345; } - .btn-error:hover { - background: #c53436; + .btn-error:hover, + .btn-error + .btn-chevron:hover { + background-color: #c53436; border: 1px solid #c53436; } - .btn-error:active { - background: #ae2325; + .btn-error:active, + .btn-error + .btn-chevron:active { + background-color: #ae2325; border: 1px solid #ae2325; } +.btn-chevron { + width: 26px; + height: 26px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; +} + +/* Groups together a button and a chevron */ +.button-group-chevron { + display: flex; + flex-direction: column; + flex: 1; +} + +/* Groups together a button-group-chevron + * and the dropdown menu */ +.button-chevron-menu-group { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + flex: 1; +} + +.button-group-chevron .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + flex: 2; +} + + .btn + .btn-chevron, + .btn + .btn-chevron:hover, + .btn + .btn-chevron:active { + border-left: 1px solid rgba(255,255,255,.4); + background-image: url("../img/dropdown-inverse.png"); + background-repeat: no-repeat; + background-position: center; + background-size: 10px; + } + +@media (min-resolution: 2dppx) { + .btn-chevron { + background-image: url(../img/dropdown-inverse@2x.png); + background-position: center; + background-size: 10px; + background-repeat: no-repeat; + } +} + .disabled, button[disabled] { cursor: not-allowed; pointer-events: none; @@ -133,12 +191,10 @@ img { .button-group { display: flex; width: 100%; - padding: 1em; } .button-group .btn { flex: 1; - margin: 0 .3em; } /* Alerts */ diff --git a/browser/components/loop/content/shared/css/conversation.css b/browser/components/loop/content/shared/css/conversation.css index 4e0b0c61fc0..e3f36763fa6 100644 --- a/browser/components/loop/content/shared/css/conversation.css +++ b/browser/components/loop/content/shared/css/conversation.css @@ -177,8 +177,46 @@ min-height: 264px; } +.incoming-call-action-group { + padding: 2.5em 1em; +} + +.incoming-call-action-group .button-chevron-menu-group { + margin-right: .5em; +} + +.incoming-call-action-group > .btn { + margin-left: .5em; +} + .incoming-call h2 { font-size: 1.5em; font-weight: normal; } +/* Block incoming call */ + +.native-dropdown-menu { + /* Should match a native select menu */ + padding: 0; + position: absolute; /* element can be wider than the parent */ + background: #fff; + margin: 0; + box-shadow: 0 4px 5px rgba(30, 30, 30, .3); + border-style: solid; + border-width: 1px 1px 1px 2px; + border-color: #aaa #111 #111 #aaa; +} + +.decline-block-menu li { + padding: 0 10px 0 5px; + list-style: none; + font-size: .9em; + color: #000; + cursor: pointer; +} + + .decline-block-menu li:hover { + color: #FFF; + background: #111; + } diff --git a/browser/components/loop/content/shared/img/dropdown-inverse.png b/browser/components/loop/content/shared/img/dropdown-inverse.png new file mode 100644 index 00000000000..b30364466d9 Binary files /dev/null and b/browser/components/loop/content/shared/img/dropdown-inverse.png differ diff --git a/browser/components/loop/content/shared/img/dropdown-inverse@2x.png b/browser/components/loop/content/shared/img/dropdown-inverse@2x.png new file mode 100644 index 00000000000..63126f18cca Binary files /dev/null and b/browser/components/loop/content/shared/img/dropdown-inverse@2x.png differ diff --git a/browser/components/loop/content/shared/js/views.js b/browser/components/loop/content/shared/js/views.js index 281e6c1926d..29d515f9fcb 100644 --- a/browser/components/loop/content/shared/js/views.js +++ b/browser/components/loop/content/shared/js/views.js @@ -138,9 +138,11 @@ loop.shared.views = (function(_, OT, l10n) { render: function() { return ( - React.DOM.button( {className:this._getClasses(), - title:this._getTitle(), - onClick:this.handleClick}) + /* jshint ignore:start */ + React.DOM.button({className: this._getClasses(), + title: this._getTitle(), + onClick: this.handleClick}) + /* jshint ignore:end */ ); } }); @@ -176,19 +178,21 @@ loop.shared.views = (function(_, OT, l10n) { }, render: function() { + /* jshint ignore:start */ return ( - React.DOM.ul( {className:"controls"}, - React.DOM.li(null, React.DOM.button( {className:"btn btn-hangup", - onClick:this.handleClickHangup, - title:__("hangup_button_title")})), - React.DOM.li(null, MediaControlButton( {action:this.handleToggleVideo, - enabled:this.props.video.enabled, - scope:"local", type:"video"} )), - React.DOM.li(null, MediaControlButton( {action:this.handleToggleAudio, - enabled:this.props.audio.enabled, - scope:"local", type:"audio"} )) + React.DOM.ul({className: "controls"}, + React.DOM.li(null, React.DOM.button({className: "btn btn-hangup", + onClick: this.handleClickHangup, + title: __("hangup_button_title")})), + React.DOM.li(null, MediaControlButton({action: this.handleToggleVideo, + enabled: this.props.video.enabled, + scope: "local", type: "video"})), + React.DOM.li(null, MediaControlButton({action: this.handleToggleAudio, + enabled: this.props.audio.enabled, + scope: "local", type: "audio"})) ) ); + /* jshint ignore:end */ } }); @@ -200,8 +204,8 @@ loop.shared.views = (function(_, OT, l10n) { model: React.PropTypes.object.isRequired }, - // height set to "auto" to fix video layout on Google Chrome - // @see https://bugzilla.mozilla.org/show_bug.cgi?id=991122 + // height set to 100%" to fix video layout on Google Chrome + // @see https://bugzilla.mozilla.org/show_bug.cgi?id=1020445 publisherConfig: { insertMode: "append", width: "100%", @@ -329,20 +333,22 @@ loop.shared.views = (function(_, OT, l10n) { }, render: function() { + /* jshint ignore:start */ return ( - React.DOM.div( {className:"conversation"}, - ConversationToolbar( {video:this.state.video, - audio:this.state.audio, - publishStream:this.publishStream, - hangup:this.hangup} ), - React.DOM.div( {className:"media nested"}, - React.DOM.div( {className:"video_wrapper remote_wrapper"}, - React.DOM.div( {className:"video_inner remote"}) - ), - React.DOM.div( {className:"local"}) + React.DOM.div({className: "conversation"}, + ConversationToolbar({video: this.state.video, + audio: this.state.audio, + publishStream: this.publishStream, + hangup: this.hangup}), + React.DOM.div({className: "media nested"}, + React.DOM.div({className: "video_wrapper remote_wrapper"}, + React.DOM.div({className: "video_inner remote"}) + ), + React.DOM.div({className: "local"}) ) ) ); + /* jshint ignore:end */ } }); diff --git a/browser/components/loop/jar.mn b/browser/components/loop/jar.mn index 33c3015545d..ef362755ea3 100644 --- a/browser/components/loop/jar.mn +++ b/browser/components/loop/jar.mn @@ -35,6 +35,8 @@ browser.jar: content/browser/loop/shared/img/mute-inverse-14x14@2x.png (content/shared/img/mute-inverse-14x14@2x.png) content/browser/loop/shared/img/video-inverse-14x14.png (content/shared/img/video-inverse-14x14.png) content/browser/loop/shared/img/video-inverse-14x14@2x.png (content/shared/img/video-inverse-14x14@2x.png) + content/browser/loop/shared/img/dropdown-inverse.png (content/shared/img/dropdown-inverse.png) + content/browser/loop/shared/img/dropdown-inverse@2x.png (content/shared/img/dropdown-inverse@2x.png) # Shared scripts content/browser/loop/shared/js/models.js (content/shared/js/models.js) diff --git a/browser/components/loop/standalone/content/l10n/data.ini b/browser/components/loop/standalone/content/l10n/data.ini index a6d57cb337c..f6887e33217 100644 --- a/browser/components/loop/standalone/content/l10n/data.ini +++ b/browser/components/loop/standalone/content/l10n/data.ini @@ -14,7 +14,7 @@ start_call=Start the call welcome=Welcome to the Loop web client. incompatible_browser=Incompatible Browser powered_by_webrtc=The audio and video components of Loop are powered by WebRTC. -use_latest_firefox.innerHTML=To use Loop, please use the latest version of Firefox. +use_latest_firefox.innerHTML=Please try this link in a WebRTC-enabled browser, such as Firefox. incompatible_device=Incompatible device sorry_device_unsupported=Sorry, Loop does not currently support your device. use_firefox_windows_mac_linux=Please open this page using the latest Firefox on Windows, Android, Mac or Linux. @@ -37,7 +37,7 @@ start_call=Démarrer l'appel welcome=Bienvenue sur Loop. incompatible_browser=Navigateur non supporté powered_by_webrtc=Les fonctionnalités audio et vidéo de Loop utilisent WebRTC. -use_latest_firefox.innerHTML=Pour utiliser Loop, merci d'utiliser la dernière version de Firefox. +use_latest_firefox.innerHTML=Veuillez essayer ce lien dans un navigateur acceptant WebRTC, par exemple Firefox. incompatible_device=Plateforme non supportée sorry_device_unsupported=Désolé, Loop ne fonctionne actuellement pas sur votre appareil. use_firefox_windows_mac_linux=Merci d'ouvrir cette page avec une version récente de Firefox pour Windows, Android, Mac ou Linux. diff --git a/browser/components/loop/test/desktop-local/client_test.js b/browser/components/loop/test/desktop-local/client_test.js index 4c29645f6dd..bc63b8971a4 100644 --- a/browser/components/loop/test/desktop-local/client_test.js +++ b/browser/components/loop/test/desktop-local/client_test.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*global loop, sinon, it, beforeEach, afterEach, describe, hawk */ +/*global loop, sinon, it, beforeEach, afterEach, describe */ var expect = chai.expect; @@ -48,6 +48,70 @@ describe("loop.Client", function() { }); describe("loop.Client", function() { + describe("#deleteCallUrl", function() { + it("should ensure loop is registered", function() { + client.deleteCallUrl("fakeToken", callback); + + sinon.assert.calledOnce(mozLoop.ensureRegistered); + }); + + it("should send an error when registration fails", function() { + mozLoop.ensureRegistered.callsArgWith(0, "offline"); + + client.deleteCallUrl("fakeToken", callback); + + sinon.assert.calledOnce(callback); + sinon.assert.calledWithExactly(callback, "offline"); + }); + + it("should make a delete call to /call-url/{fakeToken}", function() { + client.deleteCallUrl(fakeToken, callback); + + sinon.assert.calledOnce(hawkRequestStub); + sinon.assert.calledWith(hawkRequestStub, + "/call-url/" + fakeToken, "DELETE"); + }); + + it("should call the callback with null when the request succeeds", + function() { + + // Sets up the hawkRequest stub to trigger the callback with no error + // and the url. + hawkRequestStub.callsArgWith(3, null); + + client.deleteCallUrl(fakeToken, callback); + + sinon.assert.calledWithExactly(callback, null); + }); + + it("should reset all url expiry when the request succeeds", function() { + // Sets up the hawkRequest stub to trigger the callback with no error + // and the url. + var dateInMilliseconds = new Date(2014,7,20).getTime(); + hawkRequestStub.callsArgWith(3, null); + sandbox.useFakeTimers(dateInMilliseconds); + + client.deleteCallUrl(fakeToken, callback); + + sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry); + sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry, + dateInMilliseconds / 1000); + }); + + it("should send an error when the request fails", function() { + // Sets up the hawkRequest stub to trigger the callback with + // an error + hawkRequestStub.callsArgWith(3, fakeErrorRes); + + client.deleteCallUrl(fakeToken, callback); + + sinon.assert.calledOnce(callback); + sinon.assert.calledWithMatch(callback, sinon.match(function(err) { + return /400.*invalid token/.test(err.message); + })); + }); + }); + describe("#requestCallUrl", function() { it("should ensure loop is registered", function() { client.requestCallUrl("foo", callback); @@ -72,39 +136,41 @@ describe("loop.Client", function() { "/call-url/", "POST", {callerId: "foo"}); }); - it("should call the callback with the url when the request succeeds", function() { - var callUrlData = { - "callUrl": "fakeCallUrl", - "expiresAt": 60 - }; + it("should call the callback with the url when the request succeeds", + function() { + var callUrlData = { + "callUrl": "fakeCallUrl", + "expiresAt": 60 + }; - // Sets up the hawkRequest stub to trigger the callback with no error - // and the url. - hawkRequestStub.callsArgWith(3, null, - JSON.stringify(callUrlData)); + // Sets up the hawkRequest stub to trigger the callback with no error + // and the url. + hawkRequestStub.callsArgWith(3, null, + JSON.stringify(callUrlData)); - client.requestCallUrl("foo", callback); + client.requestCallUrl("foo", callback); - sinon.assert.calledWithExactly(callback, null, callUrlData); - }); + sinon.assert.calledWithExactly(callback, null, callUrlData); + }); - it("should note the call url expiry when the request succeeds", function() { - var callUrlData = { - "callUrl": "fakeCallUrl", - "expiresAt": 6000 - }; + it("should note the call url expiry when the request succeeds", + function() { + var callUrlData = { + "callUrl": "fakeCallUrl", + "expiresAt": 6000 + }; - // Sets up the hawkRequest stub to trigger the callback with no error - // and the url. - hawkRequestStub.callsArgWith(3, null, - JSON.stringify(callUrlData)); + // Sets up the hawkRequest stub to trigger the callback with no error + // and the url. + hawkRequestStub.callsArgWith(3, null, + JSON.stringify(callUrlData)); - client.requestCallUrl("foo", callback); + client.requestCallUrl("foo", callback); - sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry); - sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry, - 6000); - }); + sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry); + sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry, + 6000); + }); it("should send an error when the request fails", function() { // Sets up the hawkRequest stub to trigger the callback with diff --git a/browser/components/loop/test/desktop-local/conversation_test.js b/browser/components/loop/test/desktop-local/conversation_test.js index 1e0acbe6a4f..623ff18b16c 100644 --- a/browser/components/loop/test/desktop-local/conversation_test.js +++ b/browser/components/loop/test/desktop-local/conversation_test.js @@ -37,7 +37,8 @@ describe("loop.conversation", function() { setLoopCharPref: sandbox.stub(), getLoopCharPref: sandbox.stub(), startAlerting: function() {}, - stopAlerting: function() {} + stopAlerting: function() {}, + ensureRegistered: function() {} }; // XXX These stubs should be hoisted in a common file @@ -252,6 +253,44 @@ describe("loop.conversation", function() { // close connections nicely it("should close the window"); }); + + describe("#blocked", function() { + it("should call mozLoop.stopAlerting", function() { + sandbox.stub(window.navigator.mozLoop, "stopAlerting"); + router.declineAndBlock(); + + sinon.assert.calledOnce(window.navigator.mozLoop.stopAlerting); + }); + + it("should call delete call", function() { + var deleteCallUrl = sandbox.stub(loop.Client.prototype, "deleteCallUrl"); + router.declineAndBlock(); + + sinon.assert.calledOnce(deleteCallUrl); + }); + + it("should trigger error handling in case of error", function() { + // XXX just logging to console for now + var log = sandbox.stub(console, "log"); + var fakeError = { + error: true + }; + sandbox.stub(loop.Client.prototype, "deleteCallUrl", function(_, cb) { + cb(fakeError); + }); + router.declineAndBlock(); + + sinon.assert.calledOnce(log); + sinon.assert.calledWithExactly(log, fakeError); + }); + + it("should close the window", function() { + sandbox.stub(window, "close"); + router.declineAndBlock(); + + sinon.assert.calledOnce(window.close); + }); + }); }); describe("Events", function() { @@ -351,5 +390,16 @@ describe("loop.conversation", function() { sinon.assert.calledWith(model.trigger, "decline"); }); }); + + describe("click event on .btn-block", function() { + it("should trigger a 'block' conversation model event", function() { + var buttonBlock = view.getDOMNode().querySelector(".btn-block"); + + TestUtils.Simulate.click(buttonBlock); + + sinon.assert.calledOnce(model.trigger); + sinon.assert.calledWith(model.trigger, "declineAndBlock"); + }); + }); }); }); diff --git a/browser/components/loop/test/desktop-local/panel_test.js b/browser/components/loop/test/desktop-local/panel_test.js index 969a243b2c9..8b23b154265 100644 --- a/browser/components/loop/test/desktop-local/panel_test.js +++ b/browser/components/loop/test/desktop-local/panel_test.js @@ -229,7 +229,7 @@ describe("loop.panel", function() { beforeEach(function() { callUrlData = { - call_url: "http://call.invalid/", + call_url: "http://call.invalid/fakeToken", expiresAt: 1000 }; @@ -303,6 +303,12 @@ describe("loop.panel", function() { sinon.assert.calledWithExactly(notifier.errorL10n, "unable_retrieve_url"); }); + + it("should set 'loopToken' with the callUrl token", function() { + sinon.assert.calledOnce(navigator.mozLoop.setLoopCharPref); + sinon.assert.calledWithExactly(navigator.mozLoop.setLoopCharPref, + "loopToken", "fakeToken"); + }); }); }); diff --git a/browser/components/migration/src/BrowserProfileMigrators.manifest b/browser/components/migration/BrowserProfileMigrators.manifest similarity index 100% rename from browser/components/migration/src/BrowserProfileMigrators.manifest rename to browser/components/migration/BrowserProfileMigrators.manifest diff --git a/browser/components/migration/src/ChromeProfileMigrator.js b/browser/components/migration/ChromeProfileMigrator.js similarity index 100% rename from browser/components/migration/src/ChromeProfileMigrator.js rename to browser/components/migration/ChromeProfileMigrator.js diff --git a/browser/components/migration/src/FirefoxProfileMigrator.js b/browser/components/migration/FirefoxProfileMigrator.js similarity index 100% rename from browser/components/migration/src/FirefoxProfileMigrator.js rename to browser/components/migration/FirefoxProfileMigrator.js diff --git a/browser/components/migration/src/IEProfileMigrator.js b/browser/components/migration/IEProfileMigrator.js similarity index 100% rename from browser/components/migration/src/IEProfileMigrator.js rename to browser/components/migration/IEProfileMigrator.js diff --git a/browser/components/migration/src/MigrationUtils.jsm b/browser/components/migration/MigrationUtils.jsm similarity index 100% rename from browser/components/migration/src/MigrationUtils.jsm rename to browser/components/migration/MigrationUtils.jsm diff --git a/browser/components/migration/src/ProfileMigrator.js b/browser/components/migration/ProfileMigrator.js similarity index 100% rename from browser/components/migration/src/ProfileMigrator.js rename to browser/components/migration/ProfileMigrator.js diff --git a/browser/components/migration/src/SafariProfileMigrator.js b/browser/components/migration/SafariProfileMigrator.js similarity index 100% rename from browser/components/migration/src/SafariProfileMigrator.js rename to browser/components/migration/SafariProfileMigrator.js diff --git a/browser/components/migration/moz.build b/browser/components/migration/moz.build index 857759511de..ca9aea4c28e 100644 --- a/browser/components/migration/moz.build +++ b/browser/components/migration/moz.build @@ -4,10 +4,51 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] -XPCSHELL_TESTS_MANIFESTS += [ - 'tests/unit/xpcshell.ini', +JAR_MANIFESTS += ['jar.mn'] + +XPIDL_SOURCES += [ + 'nsIBrowserProfileMigrator.idl', ] -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file +XPIDL_MODULE = 'migration' + +if CONFIG['OS_ARCH'] == 'WINNT': + SOURCES += [ + 'nsIEHistoryEnumerator.cpp', + ] + +EXTRA_COMPONENTS += [ + 'FirefoxProfileMigrator.js', + 'ProfileMigrator.js', +] + +if CONFIG['OS_ARCH'] == 'WINNT': + EXTRA_COMPONENTS += [ + 'IEProfileMigrator.js', + ] + DEFINES['HAS_IE_MIGRATOR'] = True + +EXTRA_PP_COMPONENTS += [ + 'BrowserProfileMigrators.manifest', + 'ChromeProfileMigrator.js', +] + +if CONFIG['OS_ARCH'] == 'WINNT': + EXTRA_PP_COMPONENTS += [ + 'SafariProfileMigrator.js', + ] + DEFINES['HAS_SAFARI_MIGRATOR'] = True + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + EXTRA_PP_COMPONENTS += [ + 'SafariProfileMigrator.js', + ] + DEFINES['HAS_SAFARI_MIGRATOR'] = True + +EXTRA_PP_JS_MODULES += [ + 'MigrationUtils.jsm', +] + +FINAL_LIBRARY = 'browsercomps' diff --git a/browser/components/migration/public/nsIBrowserProfileMigrator.idl b/browser/components/migration/nsIBrowserProfileMigrator.idl similarity index 100% rename from browser/components/migration/public/nsIBrowserProfileMigrator.idl rename to browser/components/migration/nsIBrowserProfileMigrator.idl diff --git a/browser/components/migration/src/nsIEHistoryEnumerator.cpp b/browser/components/migration/nsIEHistoryEnumerator.cpp similarity index 100% rename from browser/components/migration/src/nsIEHistoryEnumerator.cpp rename to browser/components/migration/nsIEHistoryEnumerator.cpp diff --git a/browser/components/migration/src/nsIEHistoryEnumerator.h b/browser/components/migration/nsIEHistoryEnumerator.h similarity index 100% rename from browser/components/migration/src/nsIEHistoryEnumerator.h rename to browser/components/migration/nsIEHistoryEnumerator.h diff --git a/browser/components/migration/public/moz.build b/browser/components/migration/public/moz.build deleted file mode 100644 index b496622bc3c..00000000000 --- a/browser/components/migration/public/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIBrowserProfileMigrator.idl', -] - -XPIDL_MODULE = 'migration' - diff --git a/browser/components/migration/src/moz.build b/browser/components/migration/src/moz.build deleted file mode 100644 index 43d08fe9e25..00000000000 --- a/browser/components/migration/src/moz.build +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['OS_ARCH'] == 'WINNT': - SOURCES += [ - 'nsIEHistoryEnumerator.cpp', - ] - -EXTRA_COMPONENTS += [ - 'FirefoxProfileMigrator.js', - 'ProfileMigrator.js', -] - -if CONFIG['OS_ARCH'] == 'WINNT': - EXTRA_COMPONENTS += [ - 'IEProfileMigrator.js', - ] - DEFINES['HAS_IE_MIGRATOR'] = True - -EXTRA_PP_COMPONENTS += [ - 'BrowserProfileMigrators.manifest', - 'ChromeProfileMigrator.js', -] - -if CONFIG['OS_ARCH'] == 'WINNT': - EXTRA_PP_COMPONENTS += [ - 'SafariProfileMigrator.js', - ] - DEFINES['HAS_SAFARI_MIGRATOR'] = True - -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXTRA_PP_COMPONENTS += [ - 'SafariProfileMigrator.js', - ] - DEFINES['HAS_SAFARI_MIGRATOR'] = True - -EXTRA_PP_JS_MODULES += [ - 'MigrationUtils.jsm', -] - -FINAL_LIBRARY = 'browsercomps' diff --git a/browser/components/places/src/BrowserPlaces.manifest b/browser/components/places/BrowserPlaces.manifest similarity index 100% rename from browser/components/places/src/BrowserPlaces.manifest rename to browser/components/places/BrowserPlaces.manifest diff --git a/browser/components/places/src/PlacesProtocolHandler.js b/browser/components/places/PlacesProtocolHandler.js similarity index 100% rename from browser/components/places/src/PlacesProtocolHandler.js rename to browser/components/places/PlacesProtocolHandler.js diff --git a/browser/components/places/src/PlacesUIUtils.jsm b/browser/components/places/PlacesUIUtils.jsm similarity index 100% rename from browser/components/places/src/PlacesUIUtils.jsm rename to browser/components/places/PlacesUIUtils.jsm diff --git a/browser/components/places/moz.build b/browser/components/places/moz.build index 68f83cd7e66..549531fd079 100644 --- a/browser/components/places/moz.build +++ b/browser/components/places/moz.build @@ -4,18 +4,17 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['src'] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] +MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] -XPCSHELL_TESTS_MANIFESTS += [ - 'tests/unit/xpcshell.ini', +JAR_MANIFESTS += ['jar.mn'] + +EXTRA_COMPONENTS += [ + 'BrowserPlaces.manifest', + 'PlacesProtocolHandler.js', ] -MOCHITEST_CHROME_MANIFESTS += [ - 'tests/chrome/chrome.ini' +EXTRA_PP_JS_MODULES += [ + 'PlacesUIUtils.jsm', ] - -BROWSER_CHROME_MANIFESTS += [ - 'tests/browser/browser.ini', -] - -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/components/places/src/moz.build b/browser/components/places/src/moz.build deleted file mode 100644 index cbeaf1cc811..00000000000 --- a/browser/components/places/src/moz.build +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXTRA_COMPONENTS += [ - 'BrowserPlaces.manifest', - 'PlacesProtocolHandler.js', -] - -EXTRA_PP_JS_MODULES += [ - 'PlacesUIUtils.jsm', -] - diff --git a/browser/components/sessionstore/src/ContentRestore.jsm b/browser/components/sessionstore/ContentRestore.jsm similarity index 100% rename from browser/components/sessionstore/src/ContentRestore.jsm rename to browser/components/sessionstore/ContentRestore.jsm diff --git a/browser/components/sessionstore/src/DocShellCapabilities.jsm b/browser/components/sessionstore/DocShellCapabilities.jsm similarity index 100% rename from browser/components/sessionstore/src/DocShellCapabilities.jsm rename to browser/components/sessionstore/DocShellCapabilities.jsm diff --git a/browser/components/sessionstore/src/FrameTree.jsm b/browser/components/sessionstore/FrameTree.jsm similarity index 100% rename from browser/components/sessionstore/src/FrameTree.jsm rename to browser/components/sessionstore/FrameTree.jsm diff --git a/browser/components/sessionstore/src/GlobalState.jsm b/browser/components/sessionstore/GlobalState.jsm similarity index 100% rename from browser/components/sessionstore/src/GlobalState.jsm rename to browser/components/sessionstore/GlobalState.jsm diff --git a/browser/components/sessionstore/src/PageStyle.jsm b/browser/components/sessionstore/PageStyle.jsm similarity index 100% rename from browser/components/sessionstore/src/PageStyle.jsm rename to browser/components/sessionstore/PageStyle.jsm diff --git a/browser/components/sessionstore/src/PrivacyFilter.jsm b/browser/components/sessionstore/PrivacyFilter.jsm similarity index 100% rename from browser/components/sessionstore/src/PrivacyFilter.jsm rename to browser/components/sessionstore/PrivacyFilter.jsm diff --git a/browser/components/sessionstore/src/PrivacyLevel.jsm b/browser/components/sessionstore/PrivacyLevel.jsm similarity index 100% rename from browser/components/sessionstore/src/PrivacyLevel.jsm rename to browser/components/sessionstore/PrivacyLevel.jsm diff --git a/browser/components/sessionstore/src/RecentlyClosedTabsAndWindowsMenuUtils.jsm b/browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm similarity index 100% rename from browser/components/sessionstore/src/RecentlyClosedTabsAndWindowsMenuUtils.jsm rename to browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm diff --git a/browser/components/sessionstore/src/SessionCookies.jsm b/browser/components/sessionstore/SessionCookies.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionCookies.jsm rename to browser/components/sessionstore/SessionCookies.jsm diff --git a/browser/components/sessionstore/src/SessionFile.jsm b/browser/components/sessionstore/SessionFile.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionFile.jsm rename to browser/components/sessionstore/SessionFile.jsm diff --git a/browser/components/sessionstore/src/SessionHistory.jsm b/browser/components/sessionstore/SessionHistory.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionHistory.jsm rename to browser/components/sessionstore/SessionHistory.jsm diff --git a/browser/components/sessionstore/src/SessionMigration.jsm b/browser/components/sessionstore/SessionMigration.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionMigration.jsm rename to browser/components/sessionstore/SessionMigration.jsm diff --git a/browser/components/sessionstore/src/SessionSaver.jsm b/browser/components/sessionstore/SessionSaver.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionSaver.jsm rename to browser/components/sessionstore/SessionSaver.jsm diff --git a/browser/components/sessionstore/src/SessionStorage.jsm b/browser/components/sessionstore/SessionStorage.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionStorage.jsm rename to browser/components/sessionstore/SessionStorage.jsm diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionStore.jsm rename to browser/components/sessionstore/SessionStore.jsm diff --git a/browser/components/sessionstore/src/SessionWorker.js b/browser/components/sessionstore/SessionWorker.js similarity index 100% rename from browser/components/sessionstore/src/SessionWorker.js rename to browser/components/sessionstore/SessionWorker.js diff --git a/browser/components/sessionstore/src/SessionWorker.jsm b/browser/components/sessionstore/SessionWorker.jsm similarity index 100% rename from browser/components/sessionstore/src/SessionWorker.jsm rename to browser/components/sessionstore/SessionWorker.jsm diff --git a/browser/components/sessionstore/src/TabAttributes.jsm b/browser/components/sessionstore/TabAttributes.jsm similarity index 100% rename from browser/components/sessionstore/src/TabAttributes.jsm rename to browser/components/sessionstore/TabAttributes.jsm diff --git a/browser/components/sessionstore/src/TabState.jsm b/browser/components/sessionstore/TabState.jsm similarity index 100% rename from browser/components/sessionstore/src/TabState.jsm rename to browser/components/sessionstore/TabState.jsm diff --git a/browser/components/sessionstore/src/TabStateCache.jsm b/browser/components/sessionstore/TabStateCache.jsm similarity index 100% rename from browser/components/sessionstore/src/TabStateCache.jsm rename to browser/components/sessionstore/TabStateCache.jsm diff --git a/browser/components/sessionstore/src/Utils.jsm b/browser/components/sessionstore/Utils.jsm similarity index 100% rename from browser/components/sessionstore/src/Utils.jsm rename to browser/components/sessionstore/Utils.jsm diff --git a/browser/components/sessionstore/moz.build b/browser/components/sessionstore/moz.build index 4a5e274ba01..9f6d8091d1c 100644 --- a/browser/components/sessionstore/moz.build +++ b/browser/components/sessionstore/moz.build @@ -4,7 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['src'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +JAR_MANIFESTS += ['jar.mn'] XPIDL_SOURCES += [ 'nsISessionStartup.idl', @@ -13,12 +16,38 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'sessionstore' -XPCSHELL_TESTS_MANIFESTS += [ - 'test/unit/xpcshell.ini', +EXTRA_COMPONENTS += [ + 'nsSessionStartup.js', + 'nsSessionStore.js', + 'nsSessionStore.manifest', ] -BROWSER_CHROME_MANIFESTS += [ - 'test/browser.ini', +JS_MODULES_PATH = 'modules/sessionstore' + +EXTRA_JS_MODULES = [ + 'ContentRestore.jsm', + 'DocShellCapabilities.jsm', + 'FrameTree.jsm', + 'GlobalState.jsm', + 'PageStyle.jsm', + 'PrivacyFilter.jsm', + 'PrivacyLevel.jsm', + 'RecentlyClosedTabsAndWindowsMenuUtils.jsm', + 'SessionCookies.jsm', + 'SessionFile.jsm', + 'SessionHistory.jsm', + 'SessionMigration.jsm', + 'SessionStorage.jsm', + 'SessionWorker.js', + 'SessionWorker.jsm', + 'TabAttributes.jsm', + 'TabState.jsm', + 'TabStateCache.jsm', + 'Utils.jsm', +] + +EXTRA_PP_JS_MODULES += [ + 'SessionSaver.jsm', + 'SessionStore.jsm', ] -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/components/sessionstore/src/nsSessionStartup.js b/browser/components/sessionstore/nsSessionStartup.js similarity index 100% rename from browser/components/sessionstore/src/nsSessionStartup.js rename to browser/components/sessionstore/nsSessionStartup.js diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/nsSessionStore.js similarity index 100% rename from browser/components/sessionstore/src/nsSessionStore.js rename to browser/components/sessionstore/nsSessionStore.js diff --git a/browser/components/sessionstore/src/nsSessionStore.manifest b/browser/components/sessionstore/nsSessionStore.manifest similarity index 100% rename from browser/components/sessionstore/src/nsSessionStore.manifest rename to browser/components/sessionstore/nsSessionStore.manifest diff --git a/browser/components/sessionstore/src/moz.build b/browser/components/sessionstore/src/moz.build deleted file mode 100644 index 77634f59a18..00000000000 --- a/browser/components/sessionstore/src/moz.build +++ /dev/null @@ -1,41 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXTRA_COMPONENTS += [ - 'nsSessionStartup.js', - 'nsSessionStore.js', - 'nsSessionStore.manifest', -] - -JS_MODULES_PATH = 'modules/sessionstore' - -EXTRA_JS_MODULES = [ - 'ContentRestore.jsm', - 'DocShellCapabilities.jsm', - 'FrameTree.jsm', - 'GlobalState.jsm', - 'PageStyle.jsm', - 'PrivacyFilter.jsm', - 'PrivacyLevel.jsm', - 'RecentlyClosedTabsAndWindowsMenuUtils.jsm', - 'SessionCookies.jsm', - 'SessionFile.jsm', - 'SessionHistory.jsm', - 'SessionMigration.jsm', - 'SessionStorage.jsm', - 'SessionWorker.js', - 'SessionWorker.jsm', - 'TabAttributes.jsm', - 'TabState.jsm', - 'TabStateCache.jsm', - 'Utils.jsm', -] - -EXTRA_PP_JS_MODULES += [ - 'SessionSaver.jsm', - 'SessionStore.jsm', -] - diff --git a/browser/components/shell/src/Makefile.in b/browser/components/shell/Makefile.in similarity index 100% rename from browser/components/shell/src/Makefile.in rename to browser/components/shell/Makefile.in diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build index 3b401f4ec08..89025787c89 100644 --- a/browser/components/shell/moz.build +++ b/browser/components/shell/moz.build @@ -4,14 +4,46 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] -XPCSHELL_TESTS_MANIFESTS += [ - 'test/unit/xpcshell.ini' +JAR_MANIFESTS += ['jar.mn'] + +XPIDL_SOURCES += [ + 'nsIShellService.idl', ] -BROWSER_CHROME_MANIFESTS += [ - 'test/browser.ini', +if CONFIG['OS_ARCH'] == 'WINNT': + XPIDL_SOURCES += [ + 'nsIWindowsShellService.idl', + ] +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + XPIDL_SOURCES += [ + 'nsIMacShellService.idl', + ] + +XPIDL_MODULE = 'shellservice' + +if CONFIG['OS_ARCH'] == 'WINNT': + SOURCES += [ + 'nsWindowsShellService.cpp', + ] +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + SOURCES += [ + 'nsMacShellService.cpp', + ] +elif CONFIG['MOZ_WIDGET_GTK']: + SOURCES += [ + 'nsGNOMEShellService.cpp', + ] + +if SOURCES: + FINAL_LIBRARY = 'browsercomps' + +EXTRA_COMPONENTS += [ + 'nsSetDefaultBrowser.js', + 'nsSetDefaultBrowser.manifest', ] -JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file +for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'): + DEFINES[var] = '"%s"' % CONFIG[var] diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp similarity index 100% rename from browser/components/shell/src/nsGNOMEShellService.cpp rename to browser/components/shell/nsGNOMEShellService.cpp diff --git a/browser/components/shell/src/nsGNOMEShellService.h b/browser/components/shell/nsGNOMEShellService.h similarity index 100% rename from browser/components/shell/src/nsGNOMEShellService.h rename to browser/components/shell/nsGNOMEShellService.h diff --git a/browser/components/shell/public/nsIMacShellService.idl b/browser/components/shell/nsIMacShellService.idl similarity index 100% rename from browser/components/shell/public/nsIMacShellService.idl rename to browser/components/shell/nsIMacShellService.idl diff --git a/browser/components/shell/public/nsIShellService.idl b/browser/components/shell/nsIShellService.idl similarity index 100% rename from browser/components/shell/public/nsIShellService.idl rename to browser/components/shell/nsIShellService.idl diff --git a/browser/components/shell/public/nsIWindowsShellService.idl b/browser/components/shell/nsIWindowsShellService.idl similarity index 100% rename from browser/components/shell/public/nsIWindowsShellService.idl rename to browser/components/shell/nsIWindowsShellService.idl diff --git a/browser/components/shell/src/nsMacShellService.cpp b/browser/components/shell/nsMacShellService.cpp similarity index 100% rename from browser/components/shell/src/nsMacShellService.cpp rename to browser/components/shell/nsMacShellService.cpp diff --git a/browser/components/shell/src/nsMacShellService.h b/browser/components/shell/nsMacShellService.h similarity index 100% rename from browser/components/shell/src/nsMacShellService.h rename to browser/components/shell/nsMacShellService.h diff --git a/browser/components/shell/src/nsSetDefaultBrowser.js b/browser/components/shell/nsSetDefaultBrowser.js similarity index 100% rename from browser/components/shell/src/nsSetDefaultBrowser.js rename to browser/components/shell/nsSetDefaultBrowser.js diff --git a/browser/components/shell/src/nsSetDefaultBrowser.manifest b/browser/components/shell/nsSetDefaultBrowser.manifest similarity index 100% rename from browser/components/shell/src/nsSetDefaultBrowser.manifest rename to browser/components/shell/nsSetDefaultBrowser.manifest diff --git a/browser/components/shell/src/nsShellService.h b/browser/components/shell/nsShellService.h similarity index 100% rename from browser/components/shell/src/nsShellService.h rename to browser/components/shell/nsShellService.h diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp similarity index 100% rename from browser/components/shell/src/nsWindowsShellService.cpp rename to browser/components/shell/nsWindowsShellService.cpp diff --git a/browser/components/shell/src/nsWindowsShellService.h b/browser/components/shell/nsWindowsShellService.h similarity index 100% rename from browser/components/shell/src/nsWindowsShellService.h rename to browser/components/shell/nsWindowsShellService.h diff --git a/browser/components/shell/public/moz.build b/browser/components/shell/public/moz.build deleted file mode 100644 index 53f78cb6d1e..00000000000 --- a/browser/components/shell/public/moz.build +++ /dev/null @@ -1,21 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIShellService.idl', -] - -if CONFIG['OS_ARCH'] == 'WINNT': - XPIDL_SOURCES += [ - 'nsIWindowsShellService.idl', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - XPIDL_SOURCES += [ - 'nsIMacShellService.idl', - ] - -XPIDL_MODULE = 'shellservice' - diff --git a/browser/components/shell/src/moz.build b/browser/components/shell/src/moz.build deleted file mode 100644 index 61ed38f5e44..00000000000 --- a/browser/components/shell/src/moz.build +++ /dev/null @@ -1,29 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['OS_ARCH'] == 'WINNT': - SOURCES += [ - 'nsWindowsShellService.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'nsMacShellService.cpp', - ] -elif CONFIG['MOZ_WIDGET_GTK']: - SOURCES += [ - 'nsGNOMEShellService.cpp', - ] - -if SOURCES: - FINAL_LIBRARY = 'browsercomps' - -EXTRA_COMPONENTS += [ - 'nsSetDefaultBrowser.js', - 'nsSetDefaultBrowser.manifest', -] - -for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'): - DEFINES[var] = '"%s"' % CONFIG[var] diff --git a/browser/devtools/Makefile.in b/browser/devtools/Makefile.in deleted file mode 100644 index 2364f7a8733..00000000000 --- a/browser/devtools/Makefile.in +++ /dev/null @@ -1,8 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/main.js $(FINAL_TARGET)/modules/devtools diff --git a/browser/devtools/app-manager/Makefile.in b/browser/devtools/app-manager/Makefile.in deleted file mode 100644 index ba273b843c6..00000000000 --- a/browser/devtools/app-manager/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/app-manager diff --git a/browser/devtools/app-manager/moz.build b/browser/devtools/app-manager/moz.build index c65e2eeca48..4dee9226e7b 100644 --- a/browser/devtools/app-manager/moz.build +++ b/browser/devtools/app-manager/moz.build @@ -6,3 +6,15 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] + +JS_MODULES_PATH = 'modules/devtools/app-manager' + +EXTRA_JS_MODULES += [ + 'app-projects.js', + 'app-validator.js', + 'builtin-adb-store.js', + 'connection-store.js', + 'device-store.js', + 'simulators-store.js', + 'webapps-store.js', +] diff --git a/browser/devtools/markupview/Makefile.in b/browser/devtools/markupview/Makefile.in deleted file mode 100644 index 09327f5fb54..00000000000 --- a/browser/devtools/markupview/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -libs:: - $(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/markupview diff --git a/browser/devtools/markupview/moz.build b/browser/devtools/markupview/moz.build index 1f094a9573d..d9370477055 100644 --- a/browser/devtools/markupview/moz.build +++ b/browser/devtools/markupview/moz.build @@ -5,3 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +JS_MODULES_PATH = 'modules/devtools/markupview' + +EXTRA_JS_MODULES += [ + 'html-editor.js', + 'markup-view.js', +] diff --git a/browser/devtools/moz.build b/browser/devtools/moz.build index b07ea014a21..4fa5f2548f1 100644 --- a/browser/devtools/moz.build +++ b/browser/devtools/moz.build @@ -37,3 +37,9 @@ EXTRA_COMPONENTS += [ ] JAR_MANIFESTS += ['jar.mn'] + +JS_MODULES_PATH = 'modules/devtools' + +EXTRA_JS_MODULES += [ + 'main.js', +] diff --git a/browser/devtools/profiler/Makefile.in b/browser/devtools/profiler/Makefile.in deleted file mode 100644 index 50512908d28..00000000000 --- a/browser/devtools/profiler/Makefile.in +++ /dev/null @@ -1,8 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/profiler diff --git a/browser/devtools/profiler/moz.build b/browser/devtools/profiler/moz.build index 1f094a9573d..057cc9692b0 100644 --- a/browser/devtools/profiler/moz.build +++ b/browser/devtools/profiler/moz.build @@ -5,3 +5,14 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +JS_MODULES_PATH = 'modules/devtools/profiler' + +EXTRA_JS_MODULES += [ + 'cleopatra.js', + 'commands.js', + 'consts.js', + 'controller.js', + 'panel.js', + 'sidebar.js', +] diff --git a/browser/devtools/styleinspector/Makefile.in b/browser/devtools/styleinspector/Makefile.in deleted file mode 100644 index 8a262855b73..00000000000 --- a/browser/devtools/styleinspector/Makefile.in +++ /dev/null @@ -1,9 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/styleinspector diff --git a/browser/devtools/styleinspector/moz.build b/browser/devtools/styleinspector/moz.build index a4d125b80f9..fb06feba37d 100644 --- a/browser/devtools/styleinspector/moz.build +++ b/browser/devtools/styleinspector/moz.build @@ -6,3 +6,13 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] + +JS_MODULES_PATH = 'modules/devtools/styleinspector' + +EXTRA_JS_MODULES += [ + 'computed-view.js', + 'css-parsing-utils.js', + 'rule-view.js', + 'style-inspector-overlays.js', + 'style-inspector.js', +] diff --git a/browser/devtools/webconsole/Makefile.in b/browser/devtools/webconsole/Makefile.in deleted file mode 100644 index 35db6f7792e..00000000000 --- a/browser/devtools/webconsole/Makefile.in +++ /dev/null @@ -1,8 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/webconsole diff --git a/browser/devtools/webconsole/moz.build b/browser/devtools/webconsole/moz.build index 1f094a9573d..802ff7e11b7 100644 --- a/browser/devtools/webconsole/moz.build +++ b/browser/devtools/webconsole/moz.build @@ -5,3 +5,14 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] + +JS_MODULES_PATH = 'modules/devtools/webconsole' + +EXTRA_JS_MODULES += [ + 'console-commands.js', + 'console-output.js', + 'hudservice.js', + 'network-panel.js', + 'panel.js', + 'webconsole.js', +] diff --git a/browser/devtools/webide/Makefile.in b/browser/devtools/webide/Makefile.in index fe2dd009627..099c204a932 100644 --- a/browser/devtools/webide/Makefile.in +++ b/browser/devtools/webide/Makefile.in @@ -3,8 +3,3 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. PREF_JS_EXPORTS = $(srcdir)/webide-prefs.js - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/modules/*.js $(FINAL_TARGET)/modules/devtools/webide diff --git a/browser/devtools/webide/moz.build b/browser/devtools/webide/moz.build index 1e987d17edd..5a089c0614e 100644 --- a/browser/devtools/webide/moz.build +++ b/browser/devtools/webide/moz.build @@ -11,3 +11,12 @@ PARALLEL_DIRS += [ ] MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] + +JS_MODULES_PATH = 'modules/devtools/webide' + +EXTRA_JS_MODULES += [ + 'modules/addons.js', + 'modules/app-manager.js', + 'modules/remote-resources.js', + 'modules/runtimes.js' +] diff --git a/browser/locales/en-US/chrome/browser/loop/loop.properties b/browser/locales/en-US/chrome/browser/loop/loop.properties index fbc69df8bb2..6ae185e588f 100644 --- a/browser/locales/en-US/chrome/browser/loop/loop.properties +++ b/browser/locales/en-US/chrome/browser/loop/loop.properties @@ -18,7 +18,7 @@ incoming_call_title=Incoming Call… incoming_call=Incoming call incoming_call_answer_button=Answer incoming_call_decline_button=Decline -incoming_call_ignore_button=Ignore +incoming_call_decline_and_block_button=Decline and Block incoming_call_block_button=Block hangup_button_title=Hangup mute_local_audio_button_title=Mute your audio diff --git a/browser/modules/test/unit/moz.build b/browser/modules/test/unit/moz.build index fb6e74855b3..c23ff1c5314 100644 --- a/browser/modules/test/unit/moz.build +++ b/browser/modules/test/unit/moz.build @@ -4,6 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['social'] - XPCSHELL_TESTS_MANIFESTS += ['social/xpcshell.ini'] diff --git a/browser/modules/test/unit/social/Makefile.in b/browser/modules/test/unit/social/Makefile.in deleted file mode 100644 index a060fd25e47..00000000000 --- a/browser/modules/test/unit/social/Makefile.in +++ /dev/null @@ -1,11 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPCSHELL_RESOURCES = \ - xpcshell.ini \ - head.js \ - blocklist.xml \ - test_social.js \ - test_socialDisabledStartup.js \ - $(NULL) diff --git a/browser/modules/test/unit/social/moz.build b/browser/modules/test/unit/social/moz.build deleted file mode 100644 index 895d11993cf..00000000000 --- a/browser/modules/test/unit/social/moz.build +++ /dev/null @@ -1,6 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - diff --git a/browser/themes/shared/in-content/common.css b/browser/themes/shared/in-content/common.css index c48744e9986..732286350c6 100644 --- a/browser/themes/shared/in-content/common.css +++ b/browser/themes/shared/in-content/common.css @@ -7,8 +7,8 @@ body { font-size: 15px; font-weight: normal; margin: 0; - color: #737980; - background-image: linear-gradient(#fff, #ededed 100px); + color: #424e5a; + background-color: #f1f1f1; } h1 { @@ -24,7 +24,7 @@ button { height: 30px; max-height: 30px; padding: 3px; - color: #737980; + color: #333333; border: 1px solid rgba(23,50,77,.4); border-radius: 5px; background-color: #f1f1f1; diff --git a/chrome/RegistryMessageUtils.h b/chrome/RegistryMessageUtils.h index 3a4a4672ec4..31b015c526b 100644 --- a/chrome/RegistryMessageUtils.h +++ b/chrome/RegistryMessageUtils.h @@ -13,6 +13,12 @@ struct SerializedURI { nsCString spec; nsCString charset; + + bool operator ==(const SerializedURI& rhs) const + { + return spec.Equals(rhs.spec) && + charset.Equals(rhs.charset); + } }; struct ChromePackage @@ -22,6 +28,15 @@ struct ChromePackage SerializedURI localeBaseURI; SerializedURI skinBaseURI; uint32_t flags; + + bool operator ==(const ChromePackage& rhs) const + { + return package.Equals(rhs.package) && + contentBaseURI == rhs.contentBaseURI && + localeBaseURI == rhs.localeBaseURI && + skinBaseURI == rhs.skinBaseURI && + flags == rhs.flags; + } }; struct ResourceMapping @@ -34,6 +49,12 @@ struct OverrideMapping { SerializedURI originalURI; SerializedURI overrideURI; + + bool operator==(const OverrideMapping& rhs) const + { + return originalURI == rhs.originalURI && + overrideURI == rhs.overrideURI; + } }; namespace IPC { diff --git a/chrome/nsChromeRegistryChrome.cpp b/chrome/nsChromeRegistryChrome.cpp index 3f089ae09ca..bd508d21e07 100644 --- a/chrome/nsChromeRegistryChrome.cpp +++ b/chrome/nsChromeRegistryChrome.cpp @@ -1,9 +1,10 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sts=2 sw=2 et tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "mozilla/dom/PContentParent.h" +#include "mozilla/dom/ContentParent.h" #include "RegistryMessageUtils.h" #include "nsResProtocolHandler.h" @@ -24,6 +25,7 @@ #include "nsXPCOMCIDInternal.h" #include "mozilla/LookAndFeel.h" +#include "mozilla/unused.h" #include "nsICommandLine.h" #include "nsILocaleService.h" @@ -44,6 +46,8 @@ #define PACKAGE_OVERRIDE_BRANCH "chrome.override_package." using namespace mozilla; +using mozilla::dom::ContentParent; +using mozilla::dom::PContentParent; static PLDHashOperator RemoveAll(PLDHashTable *table, PLDHashEntryHdr *entry, uint32_t number, void *arg) @@ -99,6 +103,7 @@ LanguagesMatch(const nsACString& a, const nsACString& b) nsChromeRegistryChrome::nsChromeRegistryChrome() : mProfileLoaded(false) + , mDynamicRegistration(true) { mPackagesHash.ops = nullptr; } @@ -389,7 +394,13 @@ nsChromeRegistryChrome::CheckForNewChrome() mStyleHash.Clear(); mOverrideTable.Clear(); + mDynamicRegistration = false; + nsComponentManagerImpl::gComponentManager->RereadChromeManifests(); + + mDynamicRegistration = true; + + SendRegisteredChrome(nullptr); return NS_OK; } @@ -476,9 +487,39 @@ nsChromeRegistryChrome::SendRegisteredChrome( mOverrideTable.EnumerateRead(&EnumerateOverride, &overrides); - bool success = aParent->SendRegisterChrome(packages, resources, overrides, - mSelectedLocale); - NS_ENSURE_TRUE_VOID(success); + if (aParent) { + bool success = aParent->SendRegisterChrome(packages, resources, overrides, + mSelectedLocale, false); + NS_ENSURE_TRUE_VOID(success); + } else { + nsTArray parents; + ContentParent::GetAll(parents); + if (!parents.Length()) + return; + + for (PRUint32 i = 0; i < parents.Length(); i++) { + DebugOnly success = + parents[i]->SendRegisterChrome(packages, resources, overrides, + mSelectedLocale, true); + NS_WARN_IF_FALSE(success, "couldn't reset a child's registered chrome"); + } + } +} + +/* static */ void +nsChromeRegistryChrome::ChromePackageFromPackageEntry(PackageEntry* aPackage, + ChromePackage* aChromePackage, + const nsCString& aSelectedLocale, + const nsCString& aSelectedSkin) +{ + SerializeURI(aPackage->baseURI, aChromePackage->contentBaseURI); + SerializeURI(aPackage->locales.GetBase(aSelectedLocale, + nsProviderArray::LOCALE), + aChromePackage->localeBaseURI); + SerializeURI(aPackage->skins.GetBase(aSelectedSkin, nsProviderArray::ANY), + aChromePackage->skinBaseURI); + aChromePackage->package = aPackage->package; + aChromePackage->flags = aPackage->flags; } PLDHashOperator @@ -490,21 +531,9 @@ nsChromeRegistryChrome::CollectPackages(PLDHashTable *table, EnumerationArgs* args = static_cast(arg); PackageEntry* package = static_cast(entry); - SerializedURI contentURI, localeURI, skinURI; - - SerializeURI(package->baseURI, contentURI); - SerializeURI(package->locales.GetBase(args->selectedLocale, - nsProviderArray::LOCALE), localeURI); - SerializeURI(package->skins.GetBase(args->selectedSkin, nsProviderArray::ANY), - skinURI); - - ChromePackage chromePackage = { - package->package, - contentURI, - localeURI, - skinURI, - package->flags - }; + ChromePackage chromePackage; + ChromePackageFromPackageEntry(package, &chromePackage, + args->selectedLocale, args->selectedSkin); args->packages.AppendElement(chromePackage); return (PLDHashOperator)PL_DHASH_NEXT; } @@ -789,6 +818,19 @@ EnsureLowerCase(char *aBuf) } } +static void +SendManifestEntry(const ChromeRegistryItem &aItem) +{ + nsTArray parents; + ContentParent::GetAll(parents); + if (!parents.Length()) + return; + + for (uint32_t i = 0; i < parents.Length(); i++) { + unused << parents[i]->SendRegisterChromeItem(aItem); + } +} + void nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int lineno, char *const * argv, bool platform, @@ -826,6 +868,12 @@ nsChromeRegistryChrome::ManifestContent(ManifestProcessingContext& cx, int linen entry->flags |= PLATFORM_PACKAGE; if (contentaccessible) entry->flags |= CONTENT_ACCESSIBLE; + + if (mDynamicRegistration) { + ChromePackage chromePackage; + ChromePackageFromPackageEntry(entry, &chromePackage, mSelectedLocale, mSelectedSkin); + SendManifestEntry(chromePackage); + } } void @@ -861,6 +909,12 @@ nsChromeRegistryChrome::ManifestLocale(ManifestProcessingContext& cx, int lineno return; entry->locales.SetBase(nsDependentCString(provider), resolved); + + if (mDynamicRegistration) { + ChromePackage chromePackage; + ChromePackageFromPackageEntry(entry, &chromePackage, mSelectedLocale, mSelectedSkin); + SendManifestEntry(chromePackage); + } } void @@ -896,6 +950,12 @@ nsChromeRegistryChrome::ManifestSkin(ManifestProcessingContext& cx, int lineno, return; entry->skins.SetBase(nsDependentCString(provider), resolved); + + if (mDynamicRegistration) { + ChromePackage chromePackage; + ChromePackageFromPackageEntry(entry, &chromePackage, mSelectedLocale, mSelectedSkin); + SendManifestEntry(chromePackage); + } } void @@ -970,6 +1030,17 @@ nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int line return; } mOverrideTable.Put(chromeuri, resolveduri); + + if (mDynamicRegistration) { + SerializedURI serializedChrome; + SerializedURI serializedOverride; + + SerializeURI(chromeuri, serializedChrome); + SerializeURI(resolveduri, serializedOverride); + + OverrideMapping override = { serializedChrome, serializedOverride }; + SendManifestEntry(override); + } } void diff --git a/chrome/nsChromeRegistryChrome.h b/chrome/nsChromeRegistryChrome.h index f9340d32fc8..2c581ab4055 100644 --- a/chrome/nsChromeRegistryChrome.h +++ b/chrome/nsChromeRegistryChrome.h @@ -18,6 +18,7 @@ class PContentParent; } class nsIPrefBranch; +struct ChromePackage; class nsChromeRegistryChrome : public nsChromeRegistry { @@ -44,10 +45,18 @@ class nsChromeRegistryChrome : public nsChromeRegistry NS_IMETHOD GetStyleOverlays(nsIURI *aURI, nsISimpleEnumerator **_retval) MOZ_OVERRIDE; #endif - + + // If aChild is non-null then it is a new child to notify. If aChild is + // null, then we have installed new chrome and we are resetting all of our + // children's registered chrome. void SendRegisteredChrome(mozilla::dom::PContentParent* aChild); private: + struct PackageEntry; + static void ChromePackageFromPackageEntry(PackageEntry* aPackage, + ChromePackage* aChromePackage, + const nsCString& aSelectedLocale, + const nsCString& aSelectedSkin); static PLDHashOperator CollectPackages(PLDHashTable *table, PLDHashEntryHdr *entry, uint32_t number, void *arg); @@ -155,7 +164,8 @@ class nsChromeRegistryChrome : public nsChromeRegistry OverlayListHash mStyleHash; bool mProfileLoaded; - + bool mDynamicRegistration; + nsCString mSelectedLocale; nsCString mSelectedSkin; diff --git a/chrome/nsChromeRegistryContent.cpp b/chrome/nsChromeRegistryContent.cpp index 7452b45da3b..3ea6f42ffcb 100644 --- a/chrome/nsChromeRegistryContent.cpp +++ b/chrome/nsChromeRegistryContent.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sts=2 sw=2 et tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -18,11 +19,18 @@ nsChromeRegistryContent::RegisterRemoteChrome( const InfallibleTArray& aPackages, const InfallibleTArray& aResources, const InfallibleTArray& aOverrides, - const nsACString& aLocale) + const nsACString& aLocale, + bool aReset) { - NS_ABORT_IF_FALSE(mLocale == nsDependentCString(""), + NS_ABORT_IF_FALSE(aReset || mLocale.IsEmpty(), "RegisterChrome twice?"); + if (aReset) { + mPackagesHash.Clear(); + mOverrideTable.Clear(); + // XXX Can't clear resources. + } + for (uint32_t i = aPackages.Length(); i > 0; ) { --i; RegisterPackage(aPackages[i]); @@ -106,7 +114,7 @@ nsChromeRegistryContent::RegisterResource(const ResourceMapping& aResource) nsresult rv = NS_NewURI(getter_AddRefs(resolvedURI), aResource.resolvedURI.spec, aResource.resolvedURI.charset.get(), - nullptr, io); + nullptr, io); if (NS_FAILED(rv)) return; } diff --git a/chrome/nsChromeRegistryContent.h b/chrome/nsChromeRegistryContent.h index c2d3ae788d3..9320806d7b1 100644 --- a/chrome/nsChromeRegistryContent.h +++ b/chrome/nsChromeRegistryContent.h @@ -17,11 +17,12 @@ class nsChromeRegistryContent : public nsChromeRegistry { public: nsChromeRegistryContent(); - + void RegisterRemoteChrome(const InfallibleTArray& aPackages, const InfallibleTArray& aResources, const InfallibleTArray& aOverrides, - const nsACString& aLocale); + const nsACString& aLocale, + bool aReset); NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage, nsIUTF8StringEnumerator* *aResult) MOZ_OVERRIDE; @@ -38,6 +39,10 @@ class nsChromeRegistryContent : public nsChromeRegistry NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL, nsISimpleEnumerator **aResult) MOZ_OVERRIDE; + void RegisterPackage(const ChromePackage& aPackage); + void RegisterOverride(const OverrideMapping& aOverride); + void RegisterResource(const ResourceMapping& aResource); + private: struct PackageEntry { @@ -49,10 +54,6 @@ class nsChromeRegistryContent : public nsChromeRegistry nsCOMPtr skinBaseURI; uint32_t flags; }; - - void RegisterPackage(const ChromePackage& aPackage); - void RegisterResource(const ResourceMapping& aResource); - void RegisterOverride(const OverrideMapping& aOverride); nsresult UpdateSelectedLocale() MOZ_OVERRIDE; nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, diff --git a/config/config.mk b/config/config.mk index 2b3f0128b61..3e8edf43ba6 100644 --- a/config/config.mk +++ b/config/config.mk @@ -41,6 +41,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \ CPP_UNIT_TESTS \ DIRS \ EXTRA_DSO_LDOPTS \ + EXTRA_JS_MODULES \ EXTRA_PP_COMPONENTS \ EXTRA_PP_JS_MODULES \ FORCE_SHARED_LIB \ diff --git a/content/base/crashtests/crashtests.list b/content/base/crashtests/crashtests.list index b801d6ee1e9..88ffdabbed2 100644 --- a/content/base/crashtests/crashtests.list +++ b/content/base/crashtests/crashtests.list @@ -133,8 +133,8 @@ load 830098.html load 831287.html load 832644.html load 836890.html -load 838489-1.html -load 838489-2.html +skip-if(browserIsRemote) load 838489-1.html # broken in e10s (bug 582297) +skip-if(browserIsRemote) load 838489-2.html # broken in e10s (bug 582297) load 841205.html load 844404.html load 847127.html diff --git a/content/base/src/moz.build b/content/base/src/moz.build index f8ddded31ee..e92bd4844cb 100644 --- a/content/base/src/moz.build +++ b/content/base/src/moz.build @@ -223,8 +223,6 @@ LOCAL_INCLUDES += [ '/content/html/content/src', '/content/html/document/src', '/content/svg/content/src', - '/content/xml/content/src', - '/content/xml/document/src', '/content/xul/content/src', '/content/xul/document/src', '/docshell/base', @@ -232,6 +230,7 @@ LOCAL_INCLUDES += [ '/dom/ipc', '/dom/workers', '/dom/xbl', + '/dom/xml', '/dom/xslt/xpath', '/image/src', '/js/ipc', diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index b4ca2e7e75f..cd2baae7e22 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -6498,10 +6498,20 @@ nsContentUtils::SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal, bool aIsSandboxed, bool aForceInherit) { - if (!aLoadingPrincipal) { - // Nothing to do here - MOZ_ASSERT(!aIsSandboxed); - return false; + nsCOMPtr loadingPrincipal = aLoadingPrincipal; + if (!loadingPrincipal) { + if (!aIsSandboxed) { + // Nothing to do here + return false; + } + + // Go ahead and create a nullprincipal to use as our loading principal, + // since we need to make sure to sandbox the load but we have no clue who's + // loading us. + loadingPrincipal = do_CreateInstance(NS_NULLPRINCIPAL_CONTRACTID); + if (!loadingPrincipal) { + NS_RUNTIMEABORT("Failed to create a principal?"); + } } // If we're sandboxed, make sure to clear any owner the channel @@ -6541,14 +6551,14 @@ nsContentUtils::SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal, // based on its own codebase later. // (URIIsLocalFile(aURI) && - NS_SUCCEEDED(aLoadingPrincipal->CheckMayLoad(aURI, false, false)) && + NS_SUCCEEDED(loadingPrincipal->CheckMayLoad(aURI, false, false)) && // One more check here. CheckMayLoad will always return true for the // system principal, but we do NOT want to inherit in that case. - !IsSystemPrincipal(aLoadingPrincipal)); + !IsSystemPrincipal(loadingPrincipal)); } nsCOMPtr loadInfo = - new LoadInfo(aLoadingPrincipal, + new LoadInfo(loadingPrincipal, inherit ? LoadInfo::eInheritPrincipal : LoadInfo::eDontInheritPrincipal, aIsSandboxed ? LoadInfo::eSandboxed : LoadInfo::eNotSandboxed); diff --git a/content/canvas/moz.build b/content/canvas/moz.build deleted file mode 100644 index b666b2e804a..00000000000 --- a/content/canvas/moz.build +++ /dev/null @@ -1,10 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -PARALLEL_DIRS += ['public', 'src'] -TEST_DIRS += ['test'] - -TEST_TOOL_DIRS += ['compiledtest'] diff --git a/content/canvas/public/moz.build b/content/canvas/public/moz.build deleted file mode 100644 index 774482005eb..00000000000 --- a/content/canvas/public/moz.build +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -EXPORTS += [ - 'nsICanvasRenderingContextInternal.h', -] - -EXPORTS.mozilla.ipc += [ - 'DocumentRendererChild.h', - 'DocumentRendererParent.h', -] - diff --git a/content/canvas/test/android.json b/content/canvas/test/android.json deleted file mode 100644 index f6697b7a149..00000000000 --- a/content/canvas/test/android.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "runtests": {}, - "excludetests": { - "content/canvas/test/webgl/test_webgl_conformance_test_suite.html": "" - } -} diff --git a/content/canvas/test/image_green-redirect^headers^ b/content/canvas/test/image_green-redirect^headers^ deleted file mode 100644 index e54e486c1a5..00000000000 --- a/content/canvas/test/image_green-redirect^headers^ +++ /dev/null @@ -1,2 +0,0 @@ -HTTP 302 Moved -Location: http://example.com/tests/content/canvas/test/image_green-1x1.png diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp index 1836bbebcaf..012238a7a70 100644 --- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -37,7 +37,7 @@ #include "ActiveLayerTracker.h" #ifdef MOZ_WEBGL -#include "../canvas/src/WebGL2Context.h" +#include "WebGL2Context.h" #endif using namespace mozilla::layers; diff --git a/content/html/content/src/HTMLFormElement.cpp b/content/html/content/src/HTMLFormElement.cpp index 603cdcaa999..a689a4323a4 100644 --- a/content/html/content/src/HTMLFormElement.cpp +++ b/content/html/content/src/HTMLFormElement.cpp @@ -1709,7 +1709,7 @@ HTMLFormElement::ImplicitSubmissionIsDisabled() const numDisablingControlsFound++; } } - return numDisablingControlsFound > 1; + return numDisablingControlsFound != 1; } NS_IMETHODIMP diff --git a/content/html/content/src/HTMLSelectElement.cpp b/content/html/content/src/HTMLSelectElement.cpp index a10b9bd5ef1..83527a5496f 100644 --- a/content/html/content/src/HTMLSelectElement.cpp +++ b/content/html/content/src/HTMLSelectElement.cpp @@ -104,6 +104,7 @@ HTMLSelectElement::HTMLSelectElement(already_AddRefed& a FromParser aFromParser) : nsGenericHTMLFormElementWithState(aNodeInfo), mOptions(new HTMLOptionsCollection(MOZ_THIS_IN_INITIALIZER_LIST())), + mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown), mIsDoneAddingChildren(!aFromParser), mDisabledChanged(false), mMutating(false), @@ -177,6 +178,16 @@ HTMLSelectElement::SetCustomValidity(const nsAString& aError) return NS_OK; } +void +HTMLSelectElement::GetAutocomplete(DOMString& aValue) +{ + const nsAttrValue* attributeVal = GetParsedAttr(nsGkAtoms::autocomplete); + + mAutocompleteAttrState = + nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue, + mAutocompleteAttrState); +} + NS_IMETHODIMP HTMLSelectElement::GetForm(nsIDOMHTMLFormElement** aForm) { @@ -1333,6 +1344,9 @@ HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, UpdateBarredFromConstraintValidation(); } else if (aName == nsGkAtoms::required) { UpdateValueMissingValidityState(); + } else if (aName == nsGkAtoms::autocomplete) { + // Clear the cached @autocomplete attribute state + mAutocompleteAttrState = nsContentUtils::eAutocompleteAttrState_Unknown; } UpdateState(aNotify); @@ -1420,8 +1434,13 @@ HTMLSelectElement::ParseAttribute(int32_t aNamespaceID, const nsAString& aValue, nsAttrValue& aResult) { - if (aAttribute == nsGkAtoms::size && kNameSpaceID_None == aNamespaceID) { - return aResult.ParsePositiveIntValue(aValue); + if (kNameSpaceID_None == aNamespaceID) { + if (aAttribute == nsGkAtoms::size) { + return aResult.ParsePositiveIntValue(aValue); + } else if (aAttribute == nsGkAtoms::autocomplete) { + aResult.ParseAtomArray(aValue); + return true; + } } return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, aResult); diff --git a/content/html/content/src/HTMLSelectElement.h b/content/html/content/src/HTMLSelectElement.h index 4c8488a77f5..c13dda5b5b9 100644 --- a/content/html/content/src/HTMLSelectElement.h +++ b/content/html/content/src/HTMLSelectElement.h @@ -17,6 +17,7 @@ #include "nsCOMPtr.h" #include "nsError.h" #include "mozilla/dom/HTMLFormElement.h" +#include "nsContentUtils.h" class nsContentList; class nsIDOMHTMLOptionElement; @@ -158,6 +159,11 @@ public: { SetHTMLBoolAttr(nsGkAtoms::autofocus, aVal, aRv); } + void GetAutocomplete(DOMString& aValue); + void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv) + { + SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv); + } bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); @@ -606,6 +612,7 @@ protected: /** The options[] array */ nsRefPtr mOptions; + nsContentUtils::AutocompleteAttrState mAutocompleteAttrState; /** false if the parser is in the middle of adding children. */ bool mIsDoneAddingChildren; /** true if our disabled state has changed from the default **/ diff --git a/content/html/content/src/moz.build b/content/html/content/src/moz.build index 88948c87527..a793993d989 100644 --- a/content/html/content/src/moz.build +++ b/content/html/content/src/moz.build @@ -171,11 +171,11 @@ include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/content/base/src', - '/content/canvas/src', '/content/html/document/src', '/content/media/', '/content/xul/content/src', '/dom/base', + '/dom/canvas', '/dom/xbl', '/editor/libeditor/base', '/editor/libeditor/text', diff --git a/content/html/content/test/forms/mochitest.ini b/content/html/content/test/forms/mochitest.ini index 37bcd0dd511..f542918e148 100644 --- a/content/html/content/test/forms/mochitest.ini +++ b/content/html/content/test/forms/mochitest.ini @@ -4,6 +4,7 @@ support-files = submit_invalid_file.sjs test_input_number_data.js +[test_bug1039548.html] [test_button_attributes_reflection.html] [test_input_radio_radiogroup.html] [test_change_event.html] diff --git a/content/html/content/test/forms/test_bug1039548.html b/content/html/content/test/forms/test_bug1039548.html new file mode 100644 index 00000000000..0405d54829a --- /dev/null +++ b/content/html/content/test/forms/test_bug1039548.html @@ -0,0 +1,55 @@ + + + + + + Test for Bug 1039548 + + + + + + +Mozilla Bug 1039548 +

+
+ +
+ +
+ +
+ +
+ +
+
+
+ + diff --git a/content/html/content/test/forms/test_input_autocomplete.html b/content/html/content/test/forms/test_input_autocomplete.html index 63a2811cfc1..72cf21a2305 100644 --- a/content/html/content/test/forms/test_input_autocomplete.html +++ b/content/html/content/test/forms/test_input_autocomplete.html @@ -7,16 +7,6 @@ Test @autocomplete on Test for <input autocomplete='…'> - - - -

- -
 
+
+
+
+

+