mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 926358 - Fix the potential issue in MMI request handler. r=allstars.chh
This commit is contained in:
parent
7f00fc1939
commit
4612cefbae
@ -76,11 +76,30 @@ tasks.push(function testGettingIMEI() {
|
||||
tasks.next();
|
||||
}
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "request success");
|
||||
ok(false, "request should not error");
|
||||
tasks.abort();
|
||||
};
|
||||
});
|
||||
|
||||
tasks.push(function testInvalidMMICode(){
|
||||
log("Test invalid MMI code ...");
|
||||
|
||||
let request = mobileConnection.sendMMI("InvalidMMICode");
|
||||
ok(request instanceof DOMRequest,
|
||||
"request is instanceof " + request.constructor);
|
||||
|
||||
request.onsuccess = function onsuccess(event) {
|
||||
ok(false, "request should not success");
|
||||
tasks.abort();
|
||||
};
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(true, "request error");
|
||||
is(request.error.name, "emMmiError", "MMI error name");
|
||||
tasks.next();
|
||||
};
|
||||
});
|
||||
|
||||
// WARNING: All tasks should be pushed before this!!!
|
||||
tasks.push(function cleanUp() {
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
|
@ -852,10 +852,6 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
sendMMI: function sendMMI(window, mmi) {
|
||||
// We need to save the global window to get the proper MMIError
|
||||
// constructor once we get the reply from the parent process.
|
||||
this._window = window;
|
||||
|
||||
debug("Sending MMI " + mmi);
|
||||
if (!window) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
@ -863,6 +859,10 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
// We need to save the global window to get the proper MMIError
|
||||
// constructor once we get the reply from the parent process.
|
||||
this._windowsMap[requestId] = window;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SendMMI", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
@ -1834,6 +1834,8 @@ RILContentHelper.prototype = {
|
||||
handleSendCancelMMI: function handleSendCancelMMI(message) {
|
||||
debug("handleSendCancelMMI " + JSON.stringify(message));
|
||||
let request = this.takeRequest(message.requestId);
|
||||
let requestWindow = this._windowsMap[message.requestId];
|
||||
delete this._windowsMap[message.requestId];
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
@ -1868,10 +1870,10 @@ RILContentHelper.prototype = {
|
||||
let mmiResult = new DOMMMIResult(result);
|
||||
Services.DOMRequest.fireSuccess(request, mmiResult);
|
||||
} else {
|
||||
let mmiError = new this._window.DOMMMIError(result.serviceCode,
|
||||
message.errorMsg,
|
||||
null,
|
||||
result.additionalInformation);
|
||||
let mmiError = new requestWindow.DOMMMIError(result.serviceCode,
|
||||
message.errorMsg,
|
||||
null,
|
||||
result.additionalInformation);
|
||||
Services.DOMRequest.fireDetailedError(request, mmiError);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user