Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | const {classes: Cc, interfaces: Ci, utils: Cu} = Components; |
michael@0 | 5 | |
michael@0 | 6 | Cu.import("resource://gre/modules/InterAppCommService.jsm"); |
michael@0 | 7 | |
michael@0 | 8 | let UUIDGenerator = Cc["@mozilla.org/uuid-generator;1"] |
michael@0 | 9 | .getService(Ci.nsIUUIDGenerator); |
michael@0 | 10 | |
michael@0 | 11 | const MESSAGE_PORT_ID = UUIDGenerator.generateUUID().toString(); |
michael@0 | 12 | const FAKE_MESSAGE_PORT_ID = UUIDGenerator.generateUUID().toString(); |
michael@0 | 13 | const OUTER_WINDOW_ID = UUIDGenerator.generateUUID().toString(); |
michael@0 | 14 | const REQUEST_ID = UUIDGenerator.generateUUID().toString(); |
michael@0 | 15 | |
michael@0 | 16 | const PUB_APP_MANIFEST_URL = "app://pubApp.gaiamobile.org/manifest.webapp"; |
michael@0 | 17 | const SUB_APP_MANIFEST_URL = "app://subApp.gaiamobile.org/manifest.webapp"; |
michael@0 | 18 | |
michael@0 | 19 | const PUB_APP_PAGE_URL = "app://pubApp.gaiamobile.org/handler.html"; |
michael@0 | 20 | const SUB_APP_PAGE_URL = "app://subApp.gaiamobile.org/handler.html"; |
michael@0 | 21 | |
michael@0 | 22 | const KEYWORD = "test"; |
michael@0 | 23 | |
michael@0 | 24 | function create_message_port_pair(aMessagePortId, |
michael@0 | 25 | aKeyword, |
michael@0 | 26 | aPubManifestURL, |
michael@0 | 27 | aSubManifestURL) { |
michael@0 | 28 | InterAppCommService._messagePortPairs[aMessagePortId] = { |
michael@0 | 29 | keyword: aKeyword, |
michael@0 | 30 | publisher: { |
michael@0 | 31 | manifestURL: aPubManifestURL |
michael@0 | 32 | }, |
michael@0 | 33 | subscriber: { |
michael@0 | 34 | manifestURL: aSubManifestURL |
michael@0 | 35 | } |
michael@0 | 36 | }; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function clear_message_port_pairs() { |
michael@0 | 40 | InterAppCommService._messagePortPairs = {}; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | function register_message_port(aMessagePortId, |
michael@0 | 44 | aManifestURL, |
michael@0 | 45 | aPageURL, |
michael@0 | 46 | aTargetSendAsyncMessage) { |
michael@0 | 47 | let message = { |
michael@0 | 48 | name: "InterAppMessagePort:Register", |
michael@0 | 49 | json: { |
michael@0 | 50 | messagePortID: aMessagePortId, |
michael@0 | 51 | manifestURL: aManifestURL, |
michael@0 | 52 | pageURL: aPageURL |
michael@0 | 53 | }, |
michael@0 | 54 | target: { |
michael@0 | 55 | sendAsyncMessage: function(aName, aData) { |
michael@0 | 56 | if (aTargetSendAsyncMessage) { |
michael@0 | 57 | aTargetSendAsyncMessage(aName, aData); |
michael@0 | 58 | } |
michael@0 | 59 | }, |
michael@0 | 60 | assertContainApp: function(_manifestURL) { |
michael@0 | 61 | return (aManifestURL == _manifestURL); |
michael@0 | 62 | } |
michael@0 | 63 | } |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | InterAppCommService.receiveMessage(message); |
michael@0 | 67 | |
michael@0 | 68 | return message.target; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | function register_message_ports(aMessagePortId, |
michael@0 | 72 | aPubTargetSendAsyncMessage, |
michael@0 | 73 | aSubTargetSendAsyncMessage) { |
michael@0 | 74 | let pubTarget = register_message_port(aMessagePortId, |
michael@0 | 75 | PUB_APP_MANIFEST_URL, |
michael@0 | 76 | PUB_APP_PAGE_URL, |
michael@0 | 77 | aPubTargetSendAsyncMessage); |
michael@0 | 78 | |
michael@0 | 79 | let subTarget = register_message_port(aMessagePortId, |
michael@0 | 80 | SUB_APP_MANIFEST_URL, |
michael@0 | 81 | SUB_APP_PAGE_URL, |
michael@0 | 82 | aSubTargetSendAsyncMessage); |
michael@0 | 83 | |
michael@0 | 84 | return { pubTarget: pubTarget, subTarget: subTarget }; |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | function unregister_message_port(aMessagePortId, |
michael@0 | 88 | aManifestURL) { |
michael@0 | 89 | let message = { |
michael@0 | 90 | name: "InterAppMessagePort:Unregister", |
michael@0 | 91 | json: { |
michael@0 | 92 | messagePortID: aMessagePortId, |
michael@0 | 93 | manifestURL: aManifestURL |
michael@0 | 94 | }, |
michael@0 | 95 | target: { |
michael@0 | 96 | assertContainApp: function(_manifestURL) { |
michael@0 | 97 | return (aManifestURL == _manifestURL); |
michael@0 | 98 | } |
michael@0 | 99 | } |
michael@0 | 100 | }; |
michael@0 | 101 | |
michael@0 | 102 | InterAppCommService.receiveMessage(message); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | function remove_target(aTarget) { |
michael@0 | 106 | let message = { |
michael@0 | 107 | name: "child-process-shutdown", |
michael@0 | 108 | target: aTarget |
michael@0 | 109 | }; |
michael@0 | 110 | |
michael@0 | 111 | InterAppCommService.receiveMessage(message); |
michael@0 | 112 | } |
michael@0 | 113 | |
michael@0 | 114 | function post_message(aMessagePortId, |
michael@0 | 115 | aManifestURL, |
michael@0 | 116 | aMessage) { |
michael@0 | 117 | let message = { |
michael@0 | 118 | name: "InterAppMessagePort:PostMessage", |
michael@0 | 119 | json: { |
michael@0 | 120 | messagePortID: aMessagePortId, |
michael@0 | 121 | manifestURL: aManifestURL, |
michael@0 | 122 | message: aMessage |
michael@0 | 123 | }, |
michael@0 | 124 | target: { |
michael@0 | 125 | assertContainApp: function(_manifestURL) { |
michael@0 | 126 | return (aManifestURL == _manifestURL); |
michael@0 | 127 | } |
michael@0 | 128 | } |
michael@0 | 129 | }; |
michael@0 | 130 | |
michael@0 | 131 | InterAppCommService.receiveMessage(message); |
michael@0 | 132 | } |
michael@0 | 133 | |
michael@0 | 134 | function create_allowed_connections(aKeyword, |
michael@0 | 135 | aPubManifestURL, |
michael@0 | 136 | aSubManifestURL) { |
michael@0 | 137 | let allowedPubAppManifestURLs = |
michael@0 | 138 | InterAppCommService._allowedConnections[aKeyword] = {}; |
michael@0 | 139 | |
michael@0 | 140 | allowedPubAppManifestURLs[aPubManifestURL] = [aSubManifestURL]; |
michael@0 | 141 | } |
michael@0 | 142 | |
michael@0 | 143 | function clear_allowed_connections() { |
michael@0 | 144 | InterAppCommService._allowedConnections = {}; |
michael@0 | 145 | } |
michael@0 | 146 | |
michael@0 | 147 | function get_connections(aManifestURL, |
michael@0 | 148 | aOuterWindowID, |
michael@0 | 149 | aRequestID, |
michael@0 | 150 | aTargetSendAsyncMessage) { |
michael@0 | 151 | let message = { |
michael@0 | 152 | name: "Webapps:GetConnections", |
michael@0 | 153 | json: { |
michael@0 | 154 | manifestURL: aManifestURL, |
michael@0 | 155 | outerWindowID: aOuterWindowID, |
michael@0 | 156 | requestID: aRequestID |
michael@0 | 157 | }, |
michael@0 | 158 | target: { |
michael@0 | 159 | sendAsyncMessage: function(aName, aData) { |
michael@0 | 160 | if (aTargetSendAsyncMessage) { |
michael@0 | 161 | aTargetSendAsyncMessage(aName, aData); |
michael@0 | 162 | } |
michael@0 | 163 | }, |
michael@0 | 164 | assertContainApp: function(_manifestURL) { |
michael@0 | 165 | return (aManifestURL == _manifestURL); |
michael@0 | 166 | } |
michael@0 | 167 | } |
michael@0 | 168 | }; |
michael@0 | 169 | |
michael@0 | 170 | InterAppCommService.receiveMessage(message); |
michael@0 | 171 | } |
michael@0 | 172 | |
michael@0 | 173 | function cancel_connections(aManifestURL, |
michael@0 | 174 | aKeyword, |
michael@0 | 175 | aPubManifestURL, |
michael@0 | 176 | aSubManifestURL) { |
michael@0 | 177 | let message = { |
michael@0 | 178 | name: "InterAppConnection:Cancel", |
michael@0 | 179 | json: { |
michael@0 | 180 | manifestURL: aManifestURL, |
michael@0 | 181 | keyword: aKeyword, |
michael@0 | 182 | pubAppManifestURL: aPubManifestURL, |
michael@0 | 183 | subAppManifestURL: aSubManifestURL |
michael@0 | 184 | }, |
michael@0 | 185 | target: { |
michael@0 | 186 | assertContainApp: function(_manifestURL) { |
michael@0 | 187 | return (aManifestURL == _manifestURL); |
michael@0 | 188 | } |
michael@0 | 189 | } |
michael@0 | 190 | }; |
michael@0 | 191 | |
michael@0 | 192 | InterAppCommService.receiveMessage(message); |
michael@0 | 193 | } |
michael@0 | 194 | |
michael@0 | 195 | add_test(function test_registerMessagePort() { |
michael@0 | 196 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 197 | KEYWORD, |
michael@0 | 198 | PUB_APP_MANIFEST_URL, |
michael@0 | 199 | SUB_APP_MANIFEST_URL); |
michael@0 | 200 | |
michael@0 | 201 | let targets = register_message_ports(MESSAGE_PORT_ID); |
michael@0 | 202 | |
michael@0 | 203 | let messagePortPair = InterAppCommService._messagePortPairs[MESSAGE_PORT_ID]; |
michael@0 | 204 | |
michael@0 | 205 | do_check_eq(PUB_APP_PAGE_URL, messagePortPair.publisher.pageURL); |
michael@0 | 206 | do_check_eq(SUB_APP_PAGE_URL, messagePortPair.subscriber.pageURL); |
michael@0 | 207 | |
michael@0 | 208 | do_check_true(targets.pubTarget === messagePortPair.publisher.target); |
michael@0 | 209 | do_check_true(targets.subTarget === messagePortPair.subscriber.target); |
michael@0 | 210 | |
michael@0 | 211 | clear_message_port_pairs(); |
michael@0 | 212 | run_next_test(); |
michael@0 | 213 | }); |
michael@0 | 214 | |
michael@0 | 215 | add_test(function test_failToRegisterMessagePort() { |
michael@0 | 216 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 217 | KEYWORD, |
michael@0 | 218 | PUB_APP_MANIFEST_URL, |
michael@0 | 219 | SUB_APP_MANIFEST_URL); |
michael@0 | 220 | |
michael@0 | 221 | let targets = register_message_ports(FAKE_MESSAGE_PORT_ID); |
michael@0 | 222 | |
michael@0 | 223 | let messagePortPair = InterAppCommService._messagePortPairs[MESSAGE_PORT_ID]; |
michael@0 | 224 | |
michael@0 | 225 | // Because it failed to register, the page URLs and targets don't exist. |
michael@0 | 226 | do_check_true(messagePortPair.publisher.pageURL === undefined); |
michael@0 | 227 | do_check_true(messagePortPair.subscriber.pageURL === undefined); |
michael@0 | 228 | |
michael@0 | 229 | do_check_true(messagePortPair.publisher.target === undefined); |
michael@0 | 230 | do_check_true(messagePortPair.subscriber.target === undefined); |
michael@0 | 231 | |
michael@0 | 232 | clear_message_port_pairs(); |
michael@0 | 233 | run_next_test(); |
michael@0 | 234 | }); |
michael@0 | 235 | |
michael@0 | 236 | add_test(function test_unregisterMessagePort() { |
michael@0 | 237 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 238 | KEYWORD, |
michael@0 | 239 | PUB_APP_MANIFEST_URL, |
michael@0 | 240 | SUB_APP_MANIFEST_URL); |
michael@0 | 241 | |
michael@0 | 242 | register_message_ports(MESSAGE_PORT_ID); |
michael@0 | 243 | |
michael@0 | 244 | unregister_message_port(MESSAGE_PORT_ID, PUB_APP_MANIFEST_URL); |
michael@0 | 245 | |
michael@0 | 246 | do_check_true(InterAppCommService._messagePortPairs[MESSAGE_PORT_ID] |
michael@0 | 247 | === undefined); |
michael@0 | 248 | |
michael@0 | 249 | clear_message_port_pairs(); |
michael@0 | 250 | run_next_test(); |
michael@0 | 251 | }); |
michael@0 | 252 | |
michael@0 | 253 | add_test(function test_failToUnregisterMessagePort() { |
michael@0 | 254 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 255 | KEYWORD, |
michael@0 | 256 | PUB_APP_MANIFEST_URL, |
michael@0 | 257 | SUB_APP_MANIFEST_URL); |
michael@0 | 258 | |
michael@0 | 259 | register_message_ports(MESSAGE_PORT_ID); |
michael@0 | 260 | |
michael@0 | 261 | unregister_message_port(FAKE_MESSAGE_PORT_ID, PUB_APP_MANIFEST_URL); |
michael@0 | 262 | |
michael@0 | 263 | // Because it failed to unregister, the entry still exists. |
michael@0 | 264 | do_check_true(InterAppCommService._messagePortPairs[MESSAGE_PORT_ID] |
michael@0 | 265 | !== undefined); |
michael@0 | 266 | |
michael@0 | 267 | clear_message_port_pairs(); |
michael@0 | 268 | run_next_test(); |
michael@0 | 269 | }); |
michael@0 | 270 | |
michael@0 | 271 | add_test(function test_removeTarget() { |
michael@0 | 272 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 273 | KEYWORD, |
michael@0 | 274 | PUB_APP_MANIFEST_URL, |
michael@0 | 275 | SUB_APP_MANIFEST_URL); |
michael@0 | 276 | |
michael@0 | 277 | let targets = register_message_ports(MESSAGE_PORT_ID); |
michael@0 | 278 | |
michael@0 | 279 | remove_target(targets.pubTarget); |
michael@0 | 280 | |
michael@0 | 281 | do_check_true(InterAppCommService._messagePortPairs[MESSAGE_PORT_ID] |
michael@0 | 282 | === undefined); |
michael@0 | 283 | |
michael@0 | 284 | clear_message_port_pairs(); |
michael@0 | 285 | run_next_test(); |
michael@0 | 286 | }); |
michael@0 | 287 | |
michael@0 | 288 | add_test(function test_postMessage() { |
michael@0 | 289 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 290 | KEYWORD, |
michael@0 | 291 | PUB_APP_MANIFEST_URL, |
michael@0 | 292 | SUB_APP_MANIFEST_URL); |
michael@0 | 293 | |
michael@0 | 294 | let countPubAppOnMessage = 0; |
michael@0 | 295 | function pubAppOnMessage(aName, aData) { |
michael@0 | 296 | countPubAppOnMessage++; |
michael@0 | 297 | |
michael@0 | 298 | do_check_eq(aName, "InterAppMessagePort:OnMessage"); |
michael@0 | 299 | do_check_eq(aData.manifestURL, PUB_APP_MANIFEST_URL); |
michael@0 | 300 | do_check_eq(aData.pageURL, PUB_APP_PAGE_URL); |
michael@0 | 301 | do_check_eq(aData.messagePortID, MESSAGE_PORT_ID); |
michael@0 | 302 | |
michael@0 | 303 | if (countPubAppOnMessage == 1) { |
michael@0 | 304 | do_check_eq(aData.message.text, "sub app says world"); |
michael@0 | 305 | |
michael@0 | 306 | post_message(MESSAGE_PORT_ID, |
michael@0 | 307 | PUB_APP_MANIFEST_URL, |
michael@0 | 308 | { text: "pub app says hello again" }); |
michael@0 | 309 | |
michael@0 | 310 | } else if (countPubAppOnMessage == 2) { |
michael@0 | 311 | do_check_eq(aData.message.text, "sub app says world again"); |
michael@0 | 312 | |
michael@0 | 313 | clear_message_port_pairs(); |
michael@0 | 314 | run_next_test(); |
michael@0 | 315 | } else { |
michael@0 | 316 | do_throw("pub app receives an unexpected message") |
michael@0 | 317 | } |
michael@0 | 318 | }; |
michael@0 | 319 | |
michael@0 | 320 | let countSubAppOnMessage = 0; |
michael@0 | 321 | function subAppOnMessage(aName, aData) { |
michael@0 | 322 | countSubAppOnMessage++; |
michael@0 | 323 | |
michael@0 | 324 | do_check_eq(aName, "InterAppMessagePort:OnMessage"); |
michael@0 | 325 | do_check_eq(aData.manifestURL, SUB_APP_MANIFEST_URL); |
michael@0 | 326 | do_check_eq(aData.pageURL, SUB_APP_PAGE_URL); |
michael@0 | 327 | do_check_eq(aData.messagePortID, MESSAGE_PORT_ID); |
michael@0 | 328 | |
michael@0 | 329 | if (countSubAppOnMessage == 1) { |
michael@0 | 330 | do_check_eq(aData.message.text, "pub app says hello"); |
michael@0 | 331 | |
michael@0 | 332 | post_message(MESSAGE_PORT_ID, |
michael@0 | 333 | SUB_APP_MANIFEST_URL, |
michael@0 | 334 | { text: "sub app says world" }); |
michael@0 | 335 | |
michael@0 | 336 | } else if (countSubAppOnMessage == 2) { |
michael@0 | 337 | do_check_eq(aData.message.text, "pub app says hello again"); |
michael@0 | 338 | |
michael@0 | 339 | post_message(MESSAGE_PORT_ID, |
michael@0 | 340 | SUB_APP_MANIFEST_URL, |
michael@0 | 341 | { text: "sub app says world again" }); |
michael@0 | 342 | } else { |
michael@0 | 343 | do_throw("sub app receives an unexpected message") |
michael@0 | 344 | } |
michael@0 | 345 | }; |
michael@0 | 346 | |
michael@0 | 347 | register_message_ports(MESSAGE_PORT_ID, pubAppOnMessage, subAppOnMessage); |
michael@0 | 348 | |
michael@0 | 349 | post_message(MESSAGE_PORT_ID, |
michael@0 | 350 | PUB_APP_MANIFEST_URL, |
michael@0 | 351 | { text: "pub app says hello" }); |
michael@0 | 352 | }); |
michael@0 | 353 | |
michael@0 | 354 | add_test(function test_registerMessagePort_with_queued_messages() { |
michael@0 | 355 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 356 | KEYWORD, |
michael@0 | 357 | PUB_APP_MANIFEST_URL, |
michael@0 | 358 | SUB_APP_MANIFEST_URL); |
michael@0 | 359 | |
michael@0 | 360 | register_message_port(MESSAGE_PORT_ID, |
michael@0 | 361 | PUB_APP_MANIFEST_URL, |
michael@0 | 362 | PUB_APP_PAGE_URL); |
michael@0 | 363 | |
michael@0 | 364 | post_message(MESSAGE_PORT_ID, |
michael@0 | 365 | PUB_APP_MANIFEST_URL, |
michael@0 | 366 | { text: "pub app says hello" }); |
michael@0 | 367 | |
michael@0 | 368 | post_message(MESSAGE_PORT_ID, |
michael@0 | 369 | PUB_APP_MANIFEST_URL, |
michael@0 | 370 | { text: "pub app says hello again" }); |
michael@0 | 371 | |
michael@0 | 372 | let countSubAppOnMessage = 0; |
michael@0 | 373 | function subAppOnMessage(aName, aData) { |
michael@0 | 374 | countSubAppOnMessage++; |
michael@0 | 375 | |
michael@0 | 376 | do_check_eq(aName, "InterAppMessagePort:OnMessage"); |
michael@0 | 377 | do_check_eq(aData.manifestURL, SUB_APP_MANIFEST_URL); |
michael@0 | 378 | do_check_eq(aData.pageURL, SUB_APP_PAGE_URL); |
michael@0 | 379 | do_check_eq(aData.messagePortID, MESSAGE_PORT_ID); |
michael@0 | 380 | |
michael@0 | 381 | if (countSubAppOnMessage == 1) { |
michael@0 | 382 | do_check_eq(aData.message.text, "pub app says hello"); |
michael@0 | 383 | } else if (countSubAppOnMessage == 2) { |
michael@0 | 384 | do_check_eq(aData.message.text, "pub app says hello again"); |
michael@0 | 385 | |
michael@0 | 386 | clear_message_port_pairs(); |
michael@0 | 387 | run_next_test(); |
michael@0 | 388 | } else { |
michael@0 | 389 | do_throw("sub app receives an unexpected message") |
michael@0 | 390 | } |
michael@0 | 391 | }; |
michael@0 | 392 | |
michael@0 | 393 | register_message_port(MESSAGE_PORT_ID, |
michael@0 | 394 | SUB_APP_MANIFEST_URL, |
michael@0 | 395 | SUB_APP_PAGE_URL, |
michael@0 | 396 | subAppOnMessage); |
michael@0 | 397 | }); |
michael@0 | 398 | |
michael@0 | 399 | add_test(function test_getConnections() { |
michael@0 | 400 | create_allowed_connections(KEYWORD, |
michael@0 | 401 | PUB_APP_MANIFEST_URL, |
michael@0 | 402 | SUB_APP_MANIFEST_URL); |
michael@0 | 403 | |
michael@0 | 404 | function onGetConnections(aName, aData) { |
michael@0 | 405 | do_check_eq(aName, "Webapps:GetConnections:Return:OK"); |
michael@0 | 406 | do_check_eq(aData.oid, OUTER_WINDOW_ID); |
michael@0 | 407 | do_check_eq(aData.requestID, REQUEST_ID); |
michael@0 | 408 | |
michael@0 | 409 | let connections = aData.connections; |
michael@0 | 410 | do_check_eq(connections.length, 1); |
michael@0 | 411 | do_check_eq(connections[0].keyword, KEYWORD); |
michael@0 | 412 | do_check_eq(connections[0].pubAppManifestURL, PUB_APP_MANIFEST_URL); |
michael@0 | 413 | do_check_eq(connections[0].subAppManifestURL, SUB_APP_MANIFEST_URL); |
michael@0 | 414 | |
michael@0 | 415 | clear_allowed_connections(); |
michael@0 | 416 | run_next_test(); |
michael@0 | 417 | }; |
michael@0 | 418 | |
michael@0 | 419 | get_connections(PUB_APP_MANIFEST_URL, |
michael@0 | 420 | OUTER_WINDOW_ID, |
michael@0 | 421 | REQUEST_ID, |
michael@0 | 422 | onGetConnections); |
michael@0 | 423 | }); |
michael@0 | 424 | |
michael@0 | 425 | add_test(function test_cancelConnection() { |
michael@0 | 426 | create_allowed_connections(KEYWORD, |
michael@0 | 427 | PUB_APP_MANIFEST_URL, |
michael@0 | 428 | SUB_APP_MANIFEST_URL); |
michael@0 | 429 | |
michael@0 | 430 | create_message_port_pair(MESSAGE_PORT_ID, |
michael@0 | 431 | KEYWORD, |
michael@0 | 432 | PUB_APP_MANIFEST_URL, |
michael@0 | 433 | SUB_APP_MANIFEST_URL); |
michael@0 | 434 | |
michael@0 | 435 | register_message_ports(MESSAGE_PORT_ID); |
michael@0 | 436 | |
michael@0 | 437 | cancel_connections(PUB_APP_MANIFEST_URL, |
michael@0 | 438 | KEYWORD, |
michael@0 | 439 | PUB_APP_MANIFEST_URL, |
michael@0 | 440 | SUB_APP_MANIFEST_URL); |
michael@0 | 441 | |
michael@0 | 442 | do_check_true(InterAppCommService._allowedConnections[KEYWORD] |
michael@0 | 443 | === undefined); |
michael@0 | 444 | |
michael@0 | 445 | do_check_true(InterAppCommService._messagePortPairs[MESSAGE_PORT_ID] |
michael@0 | 446 | === undefined); |
michael@0 | 447 | |
michael@0 | 448 | clear_allowed_connections(); |
michael@0 | 449 | clear_message_port_pairs(); |
michael@0 | 450 | run_next_test(); |
michael@0 | 451 | }); |
michael@0 | 452 | |
michael@0 | 453 | function run_test() { |
michael@0 | 454 | do_get_profile(); |
michael@0 | 455 | |
michael@0 | 456 | run_next_test(); |
michael@0 | 457 | } |