Backed out changesets 26b240144648 and a701b0b291a0 (bug 1047146) for linux debug mochitest-bc crashes.

This commit is contained in:
Ryan VanderMeulen 2014-09-11 18:08:56 -04:00
parent fb43104aaf
commit cbb0660107
10 changed files with 18 additions and 207 deletions

View File

@ -96,23 +96,6 @@ function injectLoopAPI(targetWindow) {
let contactsAPI;
let api = {
/**
* Gets an object with data that represents the currently
* authenticated user's identity.
*/
userProfile: {
enumerable: true,
get: function() {
if (!MozLoopService.userProfile)
return null;
let userProfile = Cu.cloneInto({
email: MozLoopService.userProfile.email,
uid: MozLoopService.userProfile.uid
}, targetWindow);
return userProfile;
}
},
/**
* Sets and gets the "do not disturb" mode activation flag.
*/
@ -436,24 +419,10 @@ function injectLoopAPI(targetWindow) {
},
};
function onStatusChanged(aSubject, aTopic, aData) {
let event = new targetWindow.CustomEvent("LoopStatusChanged");
targetWindow.dispatchEvent(event)
};
function onDOMWindowDestroyed(aSubject, aTopic, aData) {
if (aSubject != targetWindow)
return;
Services.obs.removeObserver(onDOMWindowDestroyed, "dom-window-destroyed");
Services.obs.removeObserver(onStatusChanged, "loop-status-changed");
};
let contentObj = Cu.createObjectIn(targetWindow);
Object.defineProperties(contentObj, api);
Object.seal(contentObj);
Cu.makeObjectPropsNormal(contentObj);
Services.obs.addObserver(onStatusChanged, "loop-status-changed", false);
Services.obs.addObserver(onDOMWindowDestroyed, "dom-window-destroyed", false);
targetWindow.navigator.wrappedJSObject.__defineGetter__("mozLoop", function() {
// We do this in a getter, so that we create these objects

View File

@ -46,9 +46,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
XPCOMUtils.defineLazyModuleGetter(this, "CryptoUtils",
"resource://services-crypto/utils.js");
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsProfileClient",
"resource://gre/modules/FxAccountsProfileClient.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "HawkClient",
"resource://services-common/hawkclient.js");
@ -79,7 +76,6 @@ let gInitializeTimer = null;
let gFxAOAuthClientPromise = null;
let gFxAOAuthClient = null;
let gFxAOAuthTokenData = null;
let gFxAOAuthProfile = null;
let gErrors = new Map();
/**
@ -879,10 +875,6 @@ this.MozLoopService = {
MozLoopServiceInternal.doNotDisturb = aFlag;
},
get userProfile() {
return gFxAOAuthProfile;
},
get errors() {
return MozLoopServiceInternal.errors;
},
@ -1003,23 +995,9 @@ this.MozLoopService = {
}
return gFxAOAuthTokenData;
}));
}).then(tokenData => {
let client = new FxAccountsProfileClient({
serverURL: gFxAOAuthClient.parameters.profile_uri,
token: tokenData.access_token
});
client.fetchProfile().then(result => {
gFxAOAuthProfile = result;
MozLoopServiceInternal.notifyStatusChanged();
}, error => {
console.error("Failed to retrieve profile", error);
gFxAOAuthProfile = null;
MozLoopServiceInternal.notifyStatusChanged();
});
return tokenData;
}).catch(error => {
},
error => {
gFxAOAuthTokenData = null;
gFxAOAuthProfile = null;
throw error;
});
},

View File

@ -229,7 +229,8 @@ loop.panel = (function(_, mozL10n) {
},
_isSignedIn: function() {
return !!navigator.mozLoop.userProfile;
// XXX to be implemented - bug 979845
return !!navigator.mozLoop.loggedInToFxA;
},
render: function() {
@ -447,19 +448,6 @@ loop.panel = (function(_, mozL10n) {
}
});
/**
* FxA user identity (guest/authenticated) component.
*/
var UserIdentity = React.createClass({displayName: 'UserIdentity',
render: function() {
return (
React.DOM.p({className: "user-identity"},
this.props.displayName
)
);
}
});
/**
* Panel view.
*/
@ -468,32 +456,12 @@ loop.panel = (function(_, mozL10n) {
notifications: React.PropTypes.object.isRequired,
client: React.PropTypes.object.isRequired,
// Mostly used for UI components showcase and unit tests
callUrl: React.PropTypes.string,
userProfile: React.PropTypes.object,
},
getInitialState: function() {
return {
userProfile: this.props.userProfile || navigator.mozLoop.userProfile,
};
},
_onAuthStatusChange: function() {
this.setState({userProfile: navigator.mozLoop.userProfile});
},
componentDidMount: function() {
window.addEventListener("LoopStatusChanged", this._onAuthStatusChange);
},
componentWillUnmount: function() {
window.removeEventListener("LoopStatusChanged", this._onAuthStatusChange);
callUrl: React.PropTypes.string
},
render: function() {
var NotificationListView = sharedViews.NotificationListView;
var displayName = this.state.userProfile && this.state.userProfile.email ||
__("display_name_guest");
return (
React.DOM.div(null,
NotificationListView({notifications: this.props.notifications,
@ -509,11 +477,8 @@ loop.panel = (function(_, mozL10n) {
React.DOM.span(null, "contacts")
)
),
React.DOM.div({className: "footer"},
React.DOM.div({className: "user-details"},
UserIdentity({displayName: displayName}),
AvailabilityDropdown(null)
),
React.DOM.div({className: "footer"},
AvailabilityDropdown(null),
AuthLink(null),
SettingsDropdown(null)
)
@ -578,7 +543,6 @@ loop.panel = (function(_, mozL10n) {
return {
init: init,
UserIdentity: UserIdentity,
AvailabilityDropdown: AvailabilityDropdown,
CallUrlResult: CallUrlResult,
PanelView: PanelView,

View File

@ -229,7 +229,8 @@ loop.panel = (function(_, mozL10n) {
},
_isSignedIn: function() {
return !!navigator.mozLoop.userProfile;
// XXX to be implemented - bug 979845
return !!navigator.mozLoop.loggedInToFxA;
},
render: function() {
@ -447,19 +448,6 @@ loop.panel = (function(_, mozL10n) {
}
});
/**
* FxA user identity (guest/authenticated) component.
*/
var UserIdentity = React.createClass({
render: function() {
return (
<p className="user-identity">
{this.props.displayName}
</p>
);
}
});
/**
* Panel view.
*/
@ -468,32 +456,12 @@ loop.panel = (function(_, mozL10n) {
notifications: React.PropTypes.object.isRequired,
client: React.PropTypes.object.isRequired,
// Mostly used for UI components showcase and unit tests
callUrl: React.PropTypes.string,
userProfile: React.PropTypes.object,
},
getInitialState: function() {
return {
userProfile: this.props.userProfile || navigator.mozLoop.userProfile,
};
},
_onAuthStatusChange: function() {
this.setState({userProfile: navigator.mozLoop.userProfile});
},
componentDidMount: function() {
window.addEventListener("LoopStatusChanged", this._onAuthStatusChange);
},
componentWillUnmount: function() {
window.removeEventListener("LoopStatusChanged", this._onAuthStatusChange);
callUrl: React.PropTypes.string
},
render: function() {
var NotificationListView = sharedViews.NotificationListView;
var displayName = this.state.userProfile && this.state.userProfile.email ||
__("display_name_guest");
return (
<div>
<NotificationListView notifications={this.props.notifications}
@ -510,10 +478,7 @@ loop.panel = (function(_, mozL10n) {
</Tab>
</TabView>
<div className="footer">
<div className="user-details">
<UserIdentity displayName={displayName} />
<AvailabilityDropdown />
</div>
<AvailabilityDropdown />
<AuthLink />
<SettingsDropdown />
</div>
@ -578,7 +543,6 @@ loop.panel = (function(_, mozL10n) {
return {
init: init,
UserIdentity: UserIdentity,
AvailabilityDropdown: AvailabilityDropdown,
CallUrlResult: CallUrlResult,
PanelView: PanelView,

View File

@ -194,7 +194,7 @@ describe("loop.panel", function() {
});
it("should show a signout entry when user is authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.loggedInToFxA = true;
var view = TestUtils.renderIntoDocument(loop.panel.SettingsDropdown());
@ -205,7 +205,7 @@ describe("loop.panel", function() {
});
it("should show an account entry when user is authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.loggedInToFxA = true;
var view = TestUtils.renderIntoDocument(loop.panel.SettingsDropdown());
@ -234,7 +234,7 @@ describe("loop.panel", function() {
});
it("should sign out the user on click when authenticated", function() {
navigator.mozLoop.userProfile = {email: "test@example.com"};
navigator.mozLoop.loggedInToFxA = true;
var view = TestUtils.renderIntoDocument(loop.panel.SettingsDropdown());
TestUtils.Simulate.click(

View File

@ -9,8 +9,7 @@
const {
LOOP_SESSION_TYPE,
gFxAOAuthTokenData,
gFxAOAuthProfile,
gFxAOAuthTokenData
} = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
const BASE_URL = "http://mochi.test:8888/browser/browser/components/loop/test/mochitest/loop_fxa.sjs?";
@ -180,14 +179,7 @@ add_task(function* basicAuthorizationAndRegistration() {
// to be able to check for success on the second registration.
mockPushHandler.pushUrl = "https://localhost/pushUrl/fxa";
yield loadLoopPanel();
let loopDoc = document.getElementById("loop").contentDocument;
let visibleEmail = loopDoc.getElementsByClassName("user-identity")[0];
is(visibleEmail.textContent, "Guest", "Guest should be displayed on the panel when not logged in");
is(MozLoopService.userProfile, null, "profile should be null before log-in");
let tokenData = yield MozLoopService.logInToFxA();
yield promiseObserverNotified("loop-status-changed");
ise(tokenData.access_token, "code1_access_token", "Check access_token");
ise(tokenData.scope, "profile", "Check scope");
ise(tokenData.token_type, "bearer", "Check token_type");
@ -197,10 +189,6 @@ add_task(function* basicAuthorizationAndRegistration() {
prefName = MozLoopServiceInternal.getSessionTokenPrefName(LOOP_SESSION_TYPE.FXA);
padding = new Array(HAWK_TOKEN_LENGTH - mockPushHandler.pushUrl.length).fill("X").join("");
ise(Services.prefs.getCharPref(prefName), mockPushHandler.pushUrl + padding, "Check FxA hawk token");
is(MozLoopService.userProfile.email, "test@example.com", "email should exist in the profile data");
is(MozLoopService.userProfile.uid, "1234abcd", "uid should exist in the profile data");
is(visibleEmail.textContent, "test@example.com", "the email should be correct on the panel");
});
add_task(function* loginWithParams401() {

View File

@ -99,7 +99,6 @@ function resetFxA() {
global.gFxAOAuthClientPromise = null;
global.gFxAOAuthClient = null;
global.gFxAOAuthTokenData = null;
global.gFxAOAuthProfile = null;
}
function promiseDeletedOAuthParams(baseURL) {
@ -114,15 +113,6 @@ function promiseDeletedOAuthParams(baseURL) {
return deferred.promise;
}
function promiseObserverNotified(aTopic) {
let deferred = Promise.defer();
Services.obs.addObserver(function onNotification(aSubject, aTopic, aData) {
Services.obs.removeObserver(onNotification, aTopic);
deferred.resolve({subject: aSubject, data: aData});
}, aTopic, false);
return deferred.promise;
}
/**
* Get the last registration on the test server.
*/

View File

@ -36,9 +36,6 @@ function handleRequest(request, response) {
case "/get_registration": // Test-only
get_registration(request, response);
return;
case "/profile/profile":
profile(request, response);
return;
}
response.setStatusLine(request.httpVersion, 404, "Not Found");
}
@ -51,7 +48,7 @@ function handleRequest(request, response) {
*
* For a POST the X-Params header should contain a JSON object with keys to set for /fxa-oauth/params.
* A DELETE request will delete the stored parameters and should be run in a cleanup function to
* avoid interfering with subsequent tests.
* avoid interfering with subsequen tests.
*/
function setup_params(request, response) {
response.setHeader("Content-Type", "text/plain", false);
@ -153,19 +150,6 @@ function token(request, response) {
response.write(JSON.stringify(tokenData, null, 2));
}
/**
* GET /profile
*
*/
function profile(request, response) {
response.setHeader("Content-Type", "application/json; charset=utf-8", false);
let profile = {
email: "test@example.com",
uid: "1234abcd",
};
response.write(JSON.stringify(profile, null, 2));
}
/**
* POST /registration
*

View File

@ -125,24 +125,11 @@
PanelView({client: mockClient, notifications: notifications,
callUrl: "http://invalid.example.url/"})
),
Example({summary: "Call URL retrieved - authenticated", dashed: "true", style: {width: "332px"}},
PanelView({client: mockClient, notifications: notifications,
callUrl: "http://invalid.example.url/",
userProfile: {email: "test@example.com"}})
),
Example({summary: "Pending call url retrieval", dashed: "true", style: {width: "332px"}},
PanelView({client: mockClient, notifications: notifications})
),
Example({summary: "Pending call url retrieval - authenticated", dashed: "true", style: {width: "332px"}},
PanelView({client: mockClient, notifications: notifications,
userProfile: {email: "test@example.com"}})
),
Example({summary: "Error Notification", dashed: "true", style: {width: "332px"}},
PanelView({client: mockClient, notifications: errNotifications})
),
Example({summary: "Error Notification - authenticated", dashed: "true", style: {width: "332px"}},
PanelView({client: mockClient, notifications: errNotifications,
userProfile: {email: "test@example.com"}})
)
),

View File

@ -125,25 +125,12 @@
<PanelView client={mockClient} notifications={notifications}
callUrl="http://invalid.example.url/" />
</Example>
<Example summary="Call URL retrieved - authenticated" dashed="true" style={{width: "332px"}}>
<PanelView client={mockClient} notifications={notifications}
callUrl="http://invalid.example.url/"
userProfile={{email: "test@example.com"}} />
</Example>
<Example summary="Pending call url retrieval" dashed="true" style={{width: "332px"}}>
<PanelView client={mockClient} notifications={notifications} />
</Example>
<Example summary="Pending call url retrieval - authenticated" dashed="true" style={{width: "332px"}}>
<PanelView client={mockClient} notifications={notifications}
userProfile={{email: "test@example.com"}} />
</Example>
<Example summary="Error Notification" dashed="true" style={{width: "332px"}}>
<PanelView client={mockClient} notifications={errNotifications}/>
</Example>
<Example summary="Error Notification - authenticated" dashed="true" style={{width: "332px"}}>
<PanelView client={mockClient} notifications={errNotifications}
userProfile={{email: "test@example.com"}} />
</Example>
</Section>
<Section name="IncomingCallView">