From 1a785621d86b53f76b315e75312e1e0f4388c0df Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 6 Jun 2013 12:36:57 -0400 Subject: [PATCH 01/93] Bug 880202 - Revert bug 878765 because it introduces a buffer overflow --- content/media/AudioNodeEngine.cpp | 4 +-- content/media/test/crashtests/880202.html | 33 +++++++++++++++++++ content/media/test/crashtests/crashtests.list | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 content/media/test/crashtests/880202.html diff --git a/content/media/AudioNodeEngine.cpp b/content/media/AudioNodeEngine.cpp index 28af3739bf75..6d4f3f36e7b2 100644 --- a/content/media/AudioNodeEngine.cpp +++ b/content/media/AudioNodeEngine.cpp @@ -113,12 +113,12 @@ AudioBlockPanStereoToStereo(const float aInputL[WEBAUDIO_BLOCK_SIZE], if (aIsOnTheLeft) { for (i = 0; i < WEBAUDIO_BLOCK_SIZE; ++i) { - *aOutputL++ = *aInputL++ + *aInputR++ * aGainL; + *aOutputL++ = *aInputL++ + *aInputR * aGainL; *aOutputR++ = *aInputR++ * aGainR; } } else { for (i = 0; i < WEBAUDIO_BLOCK_SIZE; ++i) { - *aOutputL++ = *aInputL++ * aGainL; + *aOutputL++ = *aInputL * aGainL; *aOutputR++ = *aInputR++ + *aInputL++ * aGainR; } } diff --git a/content/media/test/crashtests/880202.html b/content/media/test/crashtests/880202.html new file mode 100644 index 000000000000..ca364045ba2d --- /dev/null +++ b/content/media/test/crashtests/880202.html @@ -0,0 +1,33 @@ + + + diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index a15a1063f397..c38d70d9589b 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -37,3 +37,4 @@ load 878328.html load 878407.html load 878478.html load 877527.html +load 880202.html From ba771ab370cefc68804e30aaaffc35464b18dbef Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Sun, 26 May 2013 20:32:28 -0400 Subject: [PATCH 02/93] Bug 831789 - Enhance existing peer connection mochitests to check for media flow. r=jesup --- dom/media/tests/mochitest/head.js | 15 ++ dom/media/tests/mochitest/pc.js | 181 +++++++++++++++++- ...rConnection_offerRequiresReceiveAudio.html | 13 ++ ...rConnection_offerRequiresReceiveVideo.html | 13 ++ ...ection_offerRequiresReceiveVideoAudio.html | 13 ++ 5 files changed, 225 insertions(+), 10 deletions(-) diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 0a9a5d307728..d4560977fac2 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -190,3 +190,18 @@ function unexpectedCallbackAndFinish(error) { SimpleTest.finish(); } } + +/** + * Generates a callback function fired only for unexpected events happening. + * + * @param {String} description a description of what the event fired on + * @param {String} eventName the name of the unexpected event + */ +function unexpectedEventAndFinish(description, eventName) { + return function () { + var e = new Error(); + ok(false, "Unexpected event '" + eventName + "' fired for " + description + + " " + e.stack.split("\n")[1]); + SimpleTest.finish(); + } +} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index dc6c747cf1ff..0053644da9e1 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -295,21 +295,119 @@ var commandsPeerConnection = [ } ], [ - 'PC_LOCAL_CHECK_MEDIA', + 'PC_LOCAL_CHECK_MEDIA_STREAMS', function (test) { - test.pcLocal.checkMedia(test.pcRemote.constraints); + test.pcLocal.checkMediaStreams(test.pcRemote.constraints); test.next(); } ], [ - 'PC_REMOTE_CHECK_MEDIA', + 'PC_REMOTE_CHECK_MEDIA_STREAMS', function (test) { - test.pcRemote.checkMedia(test.pcLocal.constraints); + test.pcRemote.checkMediaStreams(test.pcLocal.constraints); test.next(); } + ], + [ + 'PC_LOCAL_CHECK_MEDIA_FLOW_PRESENT', + function (test) { + test.pcLocal.checkMediaFlowPresent(function () { + test.next(); + }); + } + ], + [ + 'PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT', + function (test) { + test.pcRemote.checkMediaFlowPresent(function () { + test.next(); + }); + } ] ]; +/** + * This class provides a state checker for media elements which store + * a media stream to check for media attribute state and events fired. + * When constructed by a caller, an object instance is created with + * a media element, event state checkers for canplaythrough, timeupdate, and + * time changing on the media element and stream. + * + * @param {HTMLMediaElement} element the media element being analyzed + */ +function MediaElementChecker(element) { + this.element = element; + this.canPlayThroughFired = false; + this.timeUpdateFired = false; + this.timePassed = false; + + var self = this; + var elementId = self.element.getAttribute('id'); + + // When canplaythrough fires, we track that it's fired and remove the + // event listener. + var canPlayThroughCallback = function() { + info('canplaythrough fired for media element ' + elementId); + self.canPlayThroughFired = true; + self.element.removeEventListener('canplaythrough', canPlayThroughCallback, + false); + }; + + // When timeupdate fires, we track that it's fired and check if time + // has passed on the media stream and media element. + var timeUpdateCallback = function() { + self.timeUpdateFired = true; + info('timeupdate fired for media element ' + elementId); + + // If time has passed, then track that and remove the timeupdate event + // listener. + if(element.mozSrcObject && element.mozSrcObject.currentTime > 0 && + element.currentTime > 0) { + info('time passed for media element ' + elementId); + self.timePassed = true; + self.element.removeEventListener('timeupdate', timeUpdateCallback, + false); + } + }; + + element.addEventListener('canplaythrough', canPlayThroughCallback, false); + element.addEventListener('timeupdate', timeUpdateCallback, false); +} + +MediaElementChecker.prototype = { + + /** + * Waits until the canplaythrough & timeupdate events to fire along with + * ensuring time has passed on the stream and media element. + * + * @param {Function} onSuccess the success callback when media flow is + * established + */ + waitForMediaFlow : function MEC_WaitForMediaFlow(onSuccess) { + var self = this; + var elementId = self.element.getAttribute('id'); + info('Analyzing element: ' + elementId); + + if(self.canPlayThroughFired && self.timeUpdateFired && self.timePassed) { + ok(true, 'Media flowing for ' + elementId); + onSuccess(); + } else { + setTimeout(function() { + self.waitForMediaFlow(onSuccess); + }, 100); + } + }, + + /** + * Checks if there is no media flow present by checking that the ready + * state of the media element is HAVE_METADATA. + */ + checkForNoMediaFlow : function MEC_CheckForNoMediaFlow() { + ok(this.element.readyState === HTMLMediaElement.HAVE_METADATA, + 'Media element has a ready state of HAVE_METADATA'); + } +}; + /** * This class handles tests for peer connections. * @@ -411,14 +509,20 @@ function PeerConnectionWrapper(label, configuration) { this.constraints = [ ]; this.offerConstraints = {}; this.streams = [ ]; + this.mediaCheckers = [ ]; + + this.onaddstream = unexpectedEventAndFinish(this.label, 'onaddstream'); info("Creating new PeerConnectionWrapper: " + this.label); this._pc = new mozRTCPeerConnection(this.configuration); var self = this; this._pc.onaddstream = function (event) { - // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. - self.attachMedia(event.stream, 'video', 'remote'); + info(this.label + ': onaddstream event fired'); + + self.onaddstream(event.stream); + self.onaddstream = unexpectedEventAndFinish(this.label, + 'onaddstream'); }; } @@ -482,6 +586,7 @@ PeerConnectionWrapper.prototype = { } var element = createMediaElement(type, this._label + '_' + side); + this.mediaCheckers.push(new MediaElementChecker(element)); element.mozSrcObject = stream; element.play(); }, @@ -572,7 +677,8 @@ PeerConnectionWrapper.prototype = { }, /** - * Sets the remote description and automatically handles the failure case. + * Sets the remote description on the peer connection object & waits + * for a resulting onaddstream callback to fire. * * @param {object} desc * mozRTCSessionDescription for the remote description request @@ -581,19 +687,39 @@ PeerConnectionWrapper.prototype = { */ setRemoteDescription : function PCW_setRemoteDescription(desc, onSuccess) { var self = this; + var onAddStreamFired = false; + var setRemoteDescriptionFinished = false; + + // Fires onSuccess when both onaddstream and setRemoteDescription + // have finished. + function isFinished() { + if(onAddStreamFired && setRemoteDescriptionFinished) { + onSuccess(); + } + } + + // Sets up the provided stream in a media element when onaddstream fires. + this.onaddstream = function(stream) { + // bug 834835: Assume type is video until we get media tracks + self.attachMedia(stream, 'video', 'remote'); + onAddStreamFired = true; + isFinished(); + }; + this._pc.setRemoteDescription(desc, function () { info("Successfully set remote description for " + self.label); - onSuccess(); + setRemoteDescriptionFinished = true; + isFinished(); }, unexpectedCallbackAndFinish(new Error)); }, /** - * Checks that we are getting the media we expect. + * Checks that we are getting the media streams we expect. * * @param {object} constraintsRemote * The media constraints of the remote peer connection object */ - checkMedia : function PCW_checkMedia(constraintsRemote) { + checkMediaStreams : function PCW_checkMediaStreams(constraintsRemote) { is(this._pc.localStreams.length, this.constraints.length, this.label + ' has ' + this.constraints.length + ' local streams'); @@ -602,6 +728,41 @@ PeerConnectionWrapper.prototype = { this.label + ' has ' + 1 + ' remote streams'); }, + /** + * Check that media flow is present on all media elements involved in this + * test by waiting for confirmation that media flow is present. + * + * @param {Function} onSuccess the success callback when media flow + * is confirmed on all media elements + */ + checkMediaFlowPresent : function PCW_checkMediaFlowPresent(onSuccess) { + var self = this; + + function _checkMediaFlowPresent(index, onSuccess) { + if(index >= self.mediaCheckers.length) { + onSuccess(); + } else { + var mediaChecker = self.mediaCheckers[index]; + mediaChecker.waitForMediaFlow(function() { + _checkMediaFlowPresent(index + 1, onSuccess); + }); + } + } + + _checkMediaFlowPresent(0, onSuccess); + }, + + /** + * Checks that media flow is not present on all media elements involved in + * this test by ensuring that the ready state is either HAVE_NOTHING or + * HAVE_METADATA. + */ + checkMediaFlowNotPresent : function PCW_checkMediaFlowNotPresent() { + for(var mediaChecker of this.mediaCheckers) { + mediaChecker.checkForNoMediaFlow(); + } + }, + /** * Closes the connection */ diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html index 783a79a36157..812ff62eb415 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html @@ -14,9 +14,22 @@ title: "Simple offer media constraint test with audio" }); + var steps = [ + [ + "CHECK_MEDIA_FLOW_NOT_PRESENT", + function (test) { + test.pcLocal.checkMediaFlowNotPresent(); + test.pcRemote.checkMediaFlowNotPresent(); + test.next(); + } + ] + ]; + runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } }); + test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); + test.chain.append(steps); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html index 214e9ede0157..9a611070cb6b 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html @@ -14,9 +14,22 @@ title: "Simple offer media constraint test with video" }); + var steps = [ + [ + "CHECK_MEDIA_FLOW_NOT_PRESENT", + function (test) { + test.pcLocal.checkMediaFlowNotPresent(); + test.pcRemote.checkMediaFlowNotPresent(); + test.next(); + } + ] + ]; + runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } }); + test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); + test.chain.append(steps); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html index d251322f8585..92fa3a4592b4 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html @@ -14,12 +14,25 @@ title: "Simple offer media constraint test with video/audio" }); + var steps = [ + [ + "CHECK_MEDIA_FLOW_NOT_PRESENT", + function (test) { + test.pcLocal.checkMediaFlowNotPresent(); + test.pcRemote.checkMediaFlowNotPresent(); + test.next(); + } + ] + ]; + runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true, OfferToReceiveAudio: true }}); + test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); + test.chain.append(steps); test.run(); }); From 4fc5256dfd106df7d71dbcb36020ae31c2aaf901 Mon Sep 17 00:00:00 2001 From: Ekanan Ketunuti Date: Thu, 6 Jun 2013 17:22:35 +0700 Subject: [PATCH 03/93] Bug 878621 - Add "cul-de-sac" to spell-checker dictionary. r=ehsan --- .../dictionary-sources/upstream-hunspell.diff | 248 +++++++++--------- .../locales/en-US/hunspell/en-US.dic | 3 +- 2 files changed, 127 insertions(+), 124 deletions(-) diff --git a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff index e68ac5fe9b96..115c09dda57e 100644 --- a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff +++ b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff @@ -9197,387 +9197,389 @@ > cookie/SM 18467a24273 > could've -19246c25052 +19035a24842 +> cul-de-sac +19246c25053 < cysteine --- > cysteine/M -20196,20197c26002,26003 +20196,20197c26003,26004 < dialog/SM < dialogue/SM --- > dialog/SMGD > dialogue/SMRGD -20481a26288 +20481a26289 > disclose/DSG -20830c26637 +20830c26638 < dogie/M --- > dogie/SM -20895a26703 +20895a26704 > donator/MS -21820a27629 +21820a27630 > elicitor/MS -22071a27881 +22071a27882 > encyclopaedia -22556a28367 +22556a28368 > estoppel -22638c28449 +22638c28450 < euthanize --- > euthanize/DSG -22719a28531 +22719a28532 > exabyte/MS -22947a28760 +22947a28761 > experimentalism -23207,23208d29019 +23207,23208d29020 < faecal < faeces/M -23215c29026 +23215c29027 < faggoting's --- > faggot/SMG -23701a29513 +23701a29514 > filesystem/MS -24155c29967 +24155c29968 < fluidized --- > fluidize/DSG -24216a30029 +24216a30030 > foci -24736d30548 +24736d30549 < frier/M -24855,24856c30667,30668 +24855,24856c30668,30669 < fucker/M! < fuckhead/S! --- > fucker/SM! > fuckhead/SM! -24953d30764 +24953d30765 < furore/MS -25125c30936 +25125c30937 < gaolbird/S --- > gaolbirds -25180d30990 +25180d30991 < gasolene/M -25190a31001 +25190a31002 > gastroenterologist/M -25262c31073 +25262c31074 < geezer/M --- > geezer/MS -25327c31138 +25327c31139 < genomic --- > genomic/S -25462a31274 +25462a31275 > gigabit/MS -25464a31277,31279 +25464a31278,31280 > gigajoule/MS > gigapixel/MS > gigawatt/MS -25560d31374 +25560d31375 < glamourize/DSG -25674c31488 +25674c31489 < glycerine's --- > glycerine/M -25905c31719 +25905c31720 < gram/MS --- > gram/KMS -25909d31722 +25909d31723 < gramme/SM -26063c31876,31877 +26063c31877,31878 < greybeard --- > grey/MDRTGSP > greybeard/SM -26066c31880 +26066c31881 < greyness --- > greyness/M -26246,26247d32059 +26246,26247d32060 < guerilla's < guerillas -26432,26436d32243 +26432,26436d32244 < haemoglobin's < haemophilia/M < haemorrhage/DSMG < haemorrhoid/S < haemorrhoids/M -27167c32974 +27167c32975 < hexane --- > hexane/SM -27273a33081 +27273a33082 > hippopotami -27875d33682 +27875d33683 < hyaena/SM -28017c33824 +28017c33825 < iPod/M --- > iPod/MS -28105a33913 +28105a33914 > idolator/SM -28513c34321 +28513c34322 < inbound --- > inbound/s -28650a34459 +28650a34460 > indices -28812d34620 +28812d34621 < inflexion/SM -29216a35025 +29216a35026 > intern/GDL -29272a35082,35085 +29272a35083,35086 > intersex > intersexual/MS > intersexualism > intersexuality -29724c35537 +29724c35538 < jewellery's --- > jewellery/M -29870a35684 +29870a35685 > judgement/MS -30066c35880 +30066c35881 < kiddie/M --- > kiddie/SM -30262,30263c36076 +30262,30263c36077 < kraut's < kraut/S! --- > kraut/MS! -30665a36479 +30665a36480 > lector/MS -31031c36845 +31031c36846 < linguini's --- > linguini/M -31151,31152c36965 +31151,31152c36966 < liver's < liver/S --- > liver/MS -32230c38043 +32230c38044 < meanie/M --- > meanie/MS -32317,32318c38130 +32317,32318c38131 < megadeath/M < megadeaths --- > megadeath/SM -32320c38132 +32320c38133 < megajoules --- > megajoule/SM -32329c38141 +32329c38142 < megapixel/S --- > megapixel/MS -32708a38521 +32708a38522 > might've -32777d38589 +32777d38590 < millionnaire/M -32934a38747 +32934a38748 > miscommunication/S -32991a38805 +32991a38806 > misjudgement/MS -33784a39599 +33784a39600 > must've -33963c39778 +33963c39779 < native/MS --- > native/MSY -34169,34171c39984,39985 +34169,34171c39985,39986 < neurone/S < neurophysiology < neuroscience --- > neurophysiology/M > neuroscience/MS -34275c40089 +34275c40090 < nightie/M --- > nightie/SM -35104a40919 +35104a40920 > octopi -35219d41033 +35219d41034 < oleomargarin/M -35226a41041 +35226a41042 > oligo -35913c41728 +35913c41729 < oversize/D --- > oversize -36056,36059d41870 +36056,36059d41871 < paederast/S < paediatrician's < paediatricians < paediatrics/M -36291a42103 +36291a42104 > paralyses -36403d42214 +36403d42215 < parrakeet/MS -36449d42259 +36449d42260 < partizan/SM -37093a42904 +37093a42905 > petabyte/MS -37102c42913 +37102c42914 < petitioner/M --- > petitioner/MS -37264a43076 +37264a43077 > phosphorylate/DSGN -37316d43127 +37316d43128 < phrenetic -37796a43608 +37796a43609 > plugin/MS -37987c43799 +37987c43800 < polypeptide/S --- > polypeptide/MS -38291d44102 +38291d44103 < practise's -38451a44263 +38451a44264 > prejudgement/MS -38891a44704,44705 +38891a44705,44706 > pronate/DSGN > pronator/MS -38951c44765 +38951c44766 < proprietorship/M --- > proprietorship/MS -39039a44854 +39039a44855 > provender/M -39564a45380 +39564a45381 > quinoa -40036a45853 +40036a45854 > recency -40141a45959 +40141a45960 > recuse/DGS -40208a46027 +40208a46028 > refactor/SMDG -40244d46062 +40244d46063 < reflexion/SM -40829c46647 +40829c46648 < reverie/M --- > reverie/MS -41415a47234 +41415a47235 > sabre/MS -41914c47733 +41914c47734 < schnaps's --- > schnaps/M -41949c47768 +41949c47769 < schrod's --- > schrod/SM -41998a47818 +41998a47819 > scot-free -42883,42885c48703 +42883,42885c48704 < shit's < shit/S! < shite/S! --- > shit/MS! -42887,42888c48705,48706 +42887,42888c48706,48707 < shithead/S! < shitload/! --- > shithead/MS! > shitload/MS! -42891c48709 +42891c48710 < shitty/RT! --- > shitty/TR! -42976a48795 +42976a48796 > should've -43008c48827 +43008c48828 < showtime --- > showtime/MS -43724,43726c49543 +43724,43726c49544 < smoulder's < smouldered < smoulders --- > smoulder/GSMD -44062c49879 +44062c49880 < sonofabitch --- > sonofabitch/! -44346a50164 +44346a50165 > spelled -44348a50167 +44348a50168 > spelt -44371a50191 +44371a50192 > spick/S! -44383c50203 +44383c50204 < spik/S --- > spik/S! -46106a51927 +46106a51928 > syllabi -46160c51981 +46160c51982 < synch/GMD --- > synch/GMDS -46167d51987 +46167d51988 < synchs -46203,46204c52023,52024 +46203,46204c52024,52025 < sysadmin/S < sysop/S --- > sysadmin/MS > sysop/MS -46752a52573 +46752a52574 > terabit/MS -46753a52575,52576 +46753a52576,52577 > terahertz/M > terapixel/MS -46817a52641 +46817a52642 > testcase/MS -46831a52656 +46831a52657 > testsuite/MS -46925a52751 +46925a52752 > theremin/MS -47755a53582 +47755a53583 > transfect/DSMG -47774a53602,53603 +47774a53603,53604 > transgenderism > transgene/MS -47951c53780 +47951c53781 < triage/M --- > triage/MG -48869a54699 +48869a54700 > unlikeable -49211c55041 +49211c55042 < vagina/M --- > vagina/MS -49368,49369c55198 +49368,49369c55199 < velour's < velours's --- > velour/MS -49478a55308 +49478a55309 > vertices -50148a55979 +50148a55980 > weaponize/DSG -50260,50261d56090 +50260,50261d56091 < werwolf/M < werwolves -50728c56557 +50728c56558 < women --- > women/M -50794c56623 +50794c56624 < wop/S! --- > wop/MS! diff --git a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic index 3d1530f015de..ebe09d18f950 100644 --- a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic +++ b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic @@ -1,4 +1,4 @@ -57445 +57446 0/nm 0th/pt 1/n1 @@ -25106,6 +25106,7 @@ cue/DSMG cuff/MDGS cufflink/SM cuisine/SM +cul-de-sac culinary cull/MDGS cullender/MS From da672121e7f808a0e91deb45dd6433227e6d4baf Mon Sep 17 00:00:00 2001 From: Nicolas Carlo Date: Thu, 6 Jun 2013 12:37:21 -0400 Subject: [PATCH 04/93] Bug 879088 - Replace XPCOMUtils.defineLazyGetter with XPCOMUtils.defineLazyModuleGetter where modules are loaded in browser.js, AddonUpdateService.js, and SessionStore.js. r=margaret --- mobile/android/chrome/content/browser.js | 50 ++++++------------- .../android/components/AddonUpdateService.js | 19 +++---- mobile/android/components/SessionStore.js | 6 +-- 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 60c2c0afe5ec..a48bdde2e9cc 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -21,47 +21,31 @@ Cu.import('resource://gre/modules/Payment.jsm'); Cu.import("resource://gre/modules/accessibility/AccessFu.jsm"); #endif -XPCOMUtils.defineLazyGetter(this, "PluralForm", function() { - Cu.import("resource://gre/modules/PluralForm.jsm"); - return PluralForm; -}); +XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", + "resource://gre/modules/PluralForm.jsm"); -XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() { - Cu.import("resource://gre/modules/devtools/dbg-server.jsm"); - return DebuggerServer; -}); +XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer", + "resource://gre/modules/devtools/dbg-server.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides", "resource://gre/modules/UserAgentOverrides.jsm"); -XPCOMUtils.defineLazyGetter(this, "NetUtil", function() { - Cu.import("resource://gre/modules/NetUtil.jsm"); - return NetUtil; -}); +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); #ifdef MOZ_SAFE_BROWSING -XPCOMUtils.defineLazyGetter(this, "SafeBrowsing", function() { - let tmp = {}; - Cu.import("resource://gre/modules/SafeBrowsing.jsm", tmp); - return tmp.SafeBrowsing; -}); +XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing", + "resource://gre/modules/SafeBrowsing.jsm"); #endif -XPCOMUtils.defineLazyGetter(this, "PrivateBrowsingUtils", function() { - Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); - return PrivateBrowsingUtils; -}); +XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); -XPCOMUtils.defineLazyGetter(this, "Sanitizer", function() { - Cu.import("resource://gre/modules/Sanitizer.jsm"); - return Sanitizer; -}); +XPCOMUtils.defineLazyModuleGetter(this, "Sanitizer", + "resource://gre/modules/Sanitizer.jsm"); -XPCOMUtils.defineLazyGetter(this, "Prompt", function() { - let temp = {}; - Cu.import("resource://gre/modules/Prompt.jsm", temp); - return temp.Prompt; -}); +XPCOMUtils.defineLazyModuleGetter(this, "Prompt", + "resource://gre/modules/Prompt.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "FormHistory", "resource://gre/modules/FormHistory.jsm"); @@ -213,10 +197,8 @@ XPCOMUtils.defineLazyGetter(this, "ContentAreaUtils", function() { return ContentAreaUtils; }); -XPCOMUtils.defineLazyGetter(this, "Rect", function() { - Cu.import("resource://gre/modules/Geometry.jsm"); - return Rect; -}); +XPCOMUtils.defineLazyModuleGetter(this, "Rect", + "resource://gre/modules/Geometry.jsm"); function resolveGeckoURI(aURI) { if (aURI.startsWith("chrome://")) { diff --git a/mobile/android/components/AddonUpdateService.js b/mobile/android/components/AddonUpdateService.js index 138c156fc564..57ffc706a516 100644 --- a/mobile/android/components/AddonUpdateService.js +++ b/mobile/android/components/AddonUpdateService.js @@ -9,21 +9,14 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -XPCOMUtils.defineLazyGetter(this, "AddonManager", function() { - Components.utils.import("resource://gre/modules/AddonManager.jsm"); - return AddonManager; -}); +XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", + "resource://gre/modules/AddonManager.jsm"); -XPCOMUtils.defineLazyGetter(this, "AddonRepository", function() { - Components.utils.import("resource://gre/modules/AddonRepository.jsm"); - return AddonRepository; -}); - -XPCOMUtils.defineLazyGetter(this, "NetUtil", function() { - Components.utils.import("resource://gre/modules/NetUtil.jsm"); - return NetUtil; -}); +XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", + "resource://gre/modules/AddonRepository.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); function getPref(func, preference, defaultValue) { try { diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js index 3e3dda0323d0..bd10c49cbbac 100644 --- a/mobile/android/components/SessionStore.js +++ b/mobile/android/components/SessionStore.js @@ -15,10 +15,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter", "@mozilla.org/xre/app-info;1", "nsICrashReporter"); #endif -XPCOMUtils.defineLazyGetter(this, "NetUtil", function() { - Cu.import("resource://gre/modules/NetUtil.jsm"); - return NetUtil; -}); +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); function dump(a) { Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(a); From 6537905f6be32027ac8df098a71008cd11154ee7 Mon Sep 17 00:00:00 2001 From: Arnaud Sourioux Date: Thu, 6 Jun 2013 12:42:57 -0400 Subject: [PATCH 05/93] Bug 874736 - Annotate "using CompositableHost::EnsureTextureHost;" to fix warnings with -Woverloaded-virtual in gfx/layers/composite. r=nical --- gfx/layers/composite/ContentHost.h | 3 +++ gfx/layers/composite/ImageHost.h | 1 + gfx/layers/composite/TiledContentHost.h | 1 + 3 files changed, 5 insertions(+) diff --git a/gfx/layers/composite/ContentHost.h b/gfx/layers/composite/ContentHost.h index eb13ff966b57..cfa01e15b499 100644 --- a/gfx/layers/composite/ContentHost.h +++ b/gfx/layers/composite/ContentHost.h @@ -139,6 +139,7 @@ protected: class ContentHostDoubleBuffered : public ContentHostBase { public: + using CompositableHost::EnsureTextureHost; ContentHostDoubleBuffered(const TextureInfo& aTextureInfo) : ContentHostBase(aTextureInfo) {} @@ -181,6 +182,7 @@ protected: class ContentHostSingleBuffered : public ContentHostBase { public: + using CompositableHost::EnsureTextureHost; ContentHostSingleBuffered(const TextureInfo& aTextureInfo) : ContentHostBase(aTextureInfo) {} @@ -217,6 +219,7 @@ public: class ContentHostIncremental : public ContentHostBase { public: + using CompositableHost::EnsureTextureHost; ContentHostIncremental(const TextureInfo& aTextureInfo) : ContentHostBase(aTextureInfo) , mDeAllocator(nullptr) diff --git a/gfx/layers/composite/ImageHost.h b/gfx/layers/composite/ImageHost.h index 965e1e56c507..3cc63f3d13fc 100644 --- a/gfx/layers/composite/ImageHost.h +++ b/gfx/layers/composite/ImageHost.h @@ -40,6 +40,7 @@ protected: class ImageHostSingle : public ImageHost { public: + using CompositableHost::EnsureTextureHost; ImageHostSingle(const TextureInfo& aTextureInfo) : ImageHost(aTextureInfo) , mTextureHost(nullptr) diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index 221c868d93c8..9b4d912f2a05 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -132,6 +132,7 @@ class TiledContentHost : public ContentHost, public TiledLayerComposer { public: + using CompositableHost::EnsureTextureHost; TiledContentHost(const TextureInfo& aTextureInfo) : ContentHost(aTextureInfo) , mPendingUpload(false) From b3158e791662d55ef2aa8c6fada504ac88c9a6fa Mon Sep 17 00:00:00 2001 From: Malini Das Date: Thu, 6 Jun 2013 13:11:43 -0400 Subject: [PATCH 06/93] Bug 880280 - gestures should be part of the marionette-client, r=davehunt --- testing/marionette/client/marionette/__init__.py | 1 + testing/marionette/client/setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/testing/marionette/client/marionette/__init__.py b/testing/marionette/client/marionette/__init__.py index a88df54b075c..e78bd0c53801 100644 --- a/testing/marionette/client/marionette/__init__.py +++ b/testing/marionette/client/marionette/__init__.py @@ -2,6 +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/. +from gestures import * from marionette import Marionette, HTMLElement, Actions, MultiActions from marionette_test import MarionetteTestCase, CommonTestCase from emulator import Emulator diff --git a/testing/marionette/client/setup.py b/testing/marionette/client/setup.py index 0be9f27e369b..39b7a7bca053 100644 --- a/testing/marionette/client/setup.py +++ b/testing/marionette/client/setup.py @@ -1,7 +1,7 @@ import os from setuptools import setup, find_packages -version = '0.5.29' +version = '0.5.30' # get documentation from the README try: From a983f728aca9e61124cfec8af957d0a2038e4214 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Thu, 6 Jun 2013 10:23:45 -0700 Subject: [PATCH 07/93] Bug 877584: Route JS holding through the cycle collection runtime so it can do different things on different threads. r=mccr8 --- content/base/src/nsContentUtils.cpp | 14 ++---- js/xpconnect/idl/nsIXPConnect.idl | 23 +--------- js/xpconnect/src/nsXPConnect.cpp | 6 +-- js/xpconnect/src/xpcprivate.h | 6 ++- xpcom/base/nsCycleCollector.cpp | 61 +++++++++++++++++++++---- xpcom/base/nsCycleCollector.h | 13 ++++++ xpcom/glue/nsCycleCollectionJSRuntime.h | 6 +++ 7 files changed, 83 insertions(+), 46 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index a027efc0cd6c..8a2a5324dc33 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -54,6 +54,7 @@ #include "nsCPrefetchService.h" #include "nsCRT.h" #include "nsCycleCollectionParticipant.h" +#include "nsCycleCollector.h" #include "nsDataHashtable.h" #include "nsDocShellCID.h" #include "nsDOMCID.h" @@ -4325,27 +4326,22 @@ void nsContentUtils::HoldJSObjects(void* aScriptObjectHolder, nsScriptObjectTracer* aTracer) { - MOZ_ASSERT(sXPConnect, "Tried to HoldJSObjects when there was no XPConnect"); - if (sXPConnect) { - sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer); - } + cyclecollector::AddJSHolder(aScriptObjectHolder, aTracer); } /* static */ void nsContentUtils::DropJSObjects(void* aScriptObjectHolder) { - if (sXPConnect) { - sXPConnect->RemoveJSHolder(aScriptObjectHolder); - } + cyclecollector::RemoveJSHolder(aScriptObjectHolder); } #ifdef DEBUG /* static */ bool -nsContentUtils::AreJSObjectsHeld(void* aScriptHolder) +nsContentUtils::AreJSObjectsHeld(void* aScriptObjectHolder) { - return sXPConnect->TestJSHolder(aScriptHolder); + return cyclecollector::TestJSHolder(aScriptObjectHolder); } #endif diff --git a/js/xpconnect/idl/nsIXPConnect.idl b/js/xpconnect/idl/nsIXPConnect.idl index 25fe849cfa7b..e0c0b4663ff5 100644 --- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } %} -[uuid(8c85f21e-c28b-4a78-89cf-f5682d0c357a)] +[uuid(4498aa26-62df-4a4f-8a45-7ddfd7f84834)] interface nsIXPConnect : nsISupports { %{ C++ @@ -561,27 +561,6 @@ interface nsIXPConnect : nsISupports in JSObjectPtr sandbox, in boolean returnStringOnly); - /** - * Root JS objects held by aHolder. - * @param aHolder The object that hold the JS objects that should be rooted. - * @param aTrace The tracer for aHolder. - */ - [noscript,notxpcom] void addJSHolder(in voidPtr aHolder, - in nsScriptObjectTracerPtr aTracer); - - /** - * Stop rooting the JS objects held by aHolder. - * @param aHolder The object that hold the rooted JS objects. - */ - [noscript,notxpcom] void removeJSHolder(in voidPtr aHolder); - - /** - * Test to see if a JS holder is in our hashtable. - * Only available in debug builds. - * @param aHolder The object to test for. - */ - [noscript,notxpcom] bool testJSHolder(in voidPtr aHolder); - /** * Note aJSContext as a child to the cycle collector. * @param aJSContext The JSContext to note. diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index edf086afee51..09287d116570 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1792,15 +1792,13 @@ nsXPConnect::RemoveJSHolder(void* aHolder) mRuntime->RemoveJSHolder(aHolder); } +#ifdef DEBUG bool nsXPConnect::TestJSHolder(void* aHolder) { -#ifdef DEBUG return mRuntime->TestJSHolder(aHolder); -#else - return false; -#endif } +#endif NS_IMETHODIMP nsXPConnect::SetReportAllJSExceptions(bool newval) diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 983bb2d74eb8..e351b10a0a1e 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -491,7 +491,11 @@ public: static XPCJSRuntime* GetRuntimeInstance(); XPCJSRuntime* GetRuntime() {return mRuntime;} + void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) MOZ_OVERRIDE; + void RemoveJSHolder(void* aHolder) MOZ_OVERRIDE; + #ifdef DEBUG + bool TestJSHolder(void* aHolder) MOZ_OVERRIDE; void SetObjectToUnlink(void* aObject); void AssertNoObjectsToTrace(void* aPossibleJSHolder); #endif @@ -800,8 +804,8 @@ public: void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer); void RemoveJSHolder(void* aHolder); - bool TestJSHolder(void* aHolder); #ifdef DEBUG + bool TestJSHolder(void* aHolder); void SetObjectToUnlink(void* aObject) { mObjectToUnlink = aObject; } void AssertNoObjectsToTrace(void* aPossibleJSHolder); #endif diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 9e5383ad59a7..7ad3876f1e9f 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -2946,6 +2946,21 @@ nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, // - mParams: because it only contains scalars. } +// This is our special sentinel value that tells us that we've shut +// down this thread's CC. +static nsCycleCollector* const kSentinelCollector = (nsCycleCollector*)1; + +inline bool +CollectorIsShutDown(nsCycleCollector* aCollector) +{ + return aCollector == kSentinelCollector; +} + +inline bool +HaveCollector(nsCycleCollector* aCollector) +{ + return aCollector && !CollectorIsShutDown(aCollector); +} //////////////////////////////////////////////////////////////////////// // Module public API (exported in nsCycleCollector.h) @@ -2966,9 +2981,7 @@ nsCycleCollector_forgetJSRuntime() { nsCycleCollector *collector = sCollector.get(); - if (collector == (nsCycleCollector*)1) { - // This is our special sentinel value that tells us that we've shut - // down this thread's CC. + if (CollectorIsShutDown(collector)) { return; } @@ -2976,6 +2989,38 @@ nsCycleCollector_forgetJSRuntime() collector->ForgetJSRuntime(); } +void +cyclecollector::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) +{ + nsCycleCollector *collector = sCollector.get(); + + MOZ_ASSERT(HaveCollector(collector)); + + collector->JSRuntime()->AddJSHolder(aHolder, aTracer); +} + +void +cyclecollector::RemoveJSHolder(void* aHolder) +{ + nsCycleCollector *collector = sCollector.get(); + + MOZ_ASSERT(HaveCollector(collector)); + + collector->JSRuntime()->RemoveJSHolder(aHolder); +} + +#ifdef DEBUG +bool +cyclecollector::TestJSHolder(void* aHolder) +{ + nsCycleCollector *collector = sCollector.get(); + + MOZ_ASSERT(HaveCollector(collector)); + + return collector->JSRuntime()->TestJSHolder(aHolder); +} +#endif + nsPurpleBufferEntry* NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp) { @@ -2985,9 +3030,7 @@ NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp) MOZ_CRASH(); } - if (collector == (nsCycleCollector*)1) { - // This is our special sentinel value that tells us that we've shut - // down this thread's CC. + if (CollectorIsShutDown(collector)) { return nullptr; } @@ -2999,9 +3042,7 @@ nsCycleCollector_suspectedCount() { nsCycleCollector *collector = sCollector.get(); - if (collector == (nsCycleCollector*)1) { - // This is our special sentinel value that tells us that we've shut - // down this thread's CC. + if (CollectorIsShutDown(collector)) { return 0; } @@ -3117,6 +3158,6 @@ nsCycleCollector_shutdown() delete collector; // We want to be able to distinguish never having a collector from // having a shutdown collector. - sCollector.set(reinterpret_cast(1)); + sCollector.set(kSentinelCollector); } } diff --git a/xpcom/base/nsCycleCollector.h b/xpcom/base/nsCycleCollector.h index c9de7a99996c..3ed70ed3a375 100644 --- a/xpcom/base/nsCycleCollector.h +++ b/xpcom/base/nsCycleCollector.h @@ -9,6 +9,7 @@ class nsCycleCollectionJSRuntime; class nsICycleCollectorListener; class nsISupports; +class nsScriptObjectTracer; // Contains various stats about the cycle collection. class nsCycleCollectorResults @@ -63,4 +64,16 @@ nsCycleCollectorLoggerConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); +namespace mozilla { +namespace cyclecollector { + +void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer); +void RemoveJSHolder(void* aHolder); +#ifdef DEBUG +bool TestJSHolder(void* aHolder); +#endif + +} // namespace cyclecollector +} // namespace mozilla + #endif // nsCycleCollector_h__ diff --git a/xpcom/glue/nsCycleCollectionJSRuntime.h b/xpcom/glue/nsCycleCollectionJSRuntime.h index 66711523743c..deac8f8d6e32 100644 --- a/xpcom/glue/nsCycleCollectionJSRuntime.h +++ b/xpcom/glue/nsCycleCollectionJSRuntime.h @@ -9,6 +9,7 @@ class nsCycleCollectionParticipant; class nsCycleCollectionNoteRootCallback; +class nsScriptObjectTracer; // Various methods the cycle collector needs to deal with Javascript. struct nsCycleCollectionJSRuntime @@ -51,7 +52,12 @@ struct nsCycleCollectionJSRuntime */ virtual nsCycleCollectionParticipant *GetParticipant() = 0; + virtual void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) = 0; + virtual void RemoveJSHolder(void* aHolder) = 0; + #ifdef DEBUG + virtual bool TestJSHolder(void* aHolder) = 0; + virtual void SetObjectToUnlink(void* aObject) = 0; virtual void AssertNoObjectsToTrace(void* aPossibleJSHolder) = 0; #endif From 23e4c9cd143268a3da076325c4f88296527d0a61 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Thu, 6 Jun 2013 10:28:47 -0700 Subject: [PATCH 08/93] Bug 854739: Ensure that messages are delivered in order when suspending and resuming workers. r=bent+bholley --- dom/base/nsGlobalWindow.cpp | 20 +++++++----- dom/workers/RuntimeService.cpp | 6 ++-- dom/workers/RuntimeService.h | 2 +- dom/workers/WorkerPrivate.cpp | 60 ++++++++++++++++++++++++++++------ dom/workers/WorkerPrivate.h | 7 ++-- dom/workers/Workers.h | 3 +- 6 files changed, 73 insertions(+), 25 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index f1a435d01dda..b5d7104fc845 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1457,9 +1457,11 @@ nsGlobalWindow::FreeInnerObjects() // Kill all of the workers for this window. // We push a cx so that exceptions get reported in the right DOM Window. - nsIScriptContext *scx = GetContextInternal(); - AutoPushJSContext cx(scx ? scx->GetNativeContext() : nsContentUtils::GetSafeJSContext()); - mozilla::dom::workers::CancelWorkersForWindow(cx, this); + { + nsIScriptContext *scx = GetContextInternal(); + AutoPushJSContext cx(scx ? scx->GetNativeContext() : nsContentUtils::GetSafeJSContext()); + mozilla::dom::workers::CancelWorkersForWindow(cx, this); + } // Close all offline storages for this window. quota::QuotaManager* quotaManager = quota::QuotaManager::Get(); @@ -10939,10 +10941,12 @@ nsGlobalWindow::SuspendTimeouts(uint32_t aIncrease, DisableGamepadUpdates(); // Suspend all of the workers for this window. - // We push a cx so that exceptions get reported in the right DOM Window. - nsIScriptContext *scx = GetContextInternal(); - AutoPushJSContext cx(scx ? scx->GetNativeContext() : nsContentUtils::GetSafeJSContext()); - mozilla::dom::workers::SuspendWorkersForWindow(cx, this); + // We push a cx so that exceptions get reported in the right DOM Window. + { + nsIScriptContext *scx = GetContextInternal(); + AutoPushJSContext cx(scx ? scx->GetNativeContext() : nsContentUtils::GetSafeJSContext()); + mozilla::dom::workers::SuspendWorkersForWindow(cx, this); + } TimeStamp now = TimeStamp::Now(); for (nsTimeout *t = mTimeouts.getFirst(); t; t = t->getNext()) { @@ -11034,7 +11038,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren) // We push a cx so that exceptions get reported in the right DOM Window. nsIScriptContext *scx = GetContextInternal(); AutoPushJSContext cx(scx ? scx->GetNativeContext() : nsContentUtils::GetSafeJSContext()); - mozilla::dom::workers::ResumeWorkersForWindow(cx, this); + mozilla::dom::workers::ResumeWorkersForWindow(scx, this); // Restore all of the timeouts, using the stored time remaining // (stored in timeout->mTimeRemaining). diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index d9ffca31cf05..c3c6b3adfffc 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -650,7 +650,7 @@ SuspendWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow) } void -ResumeWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow) +ResumeWorkersForWindow(nsIScriptContext* aCx, nsPIDOMWindow* aWindow) { AssertIsOnMainThread(); RuntimeService* runtime = RuntimeService::GetService(); @@ -1321,7 +1321,7 @@ RuntimeService::SuspendWorkersForWindow(JSContext* aCx, } void -RuntimeService::ResumeWorkersForWindow(JSContext* aCx, +RuntimeService::ResumeWorkersForWindow(nsIScriptContext* aCx, nsPIDOMWindow* aWindow) { AssertIsOnMainThread(); @@ -1331,7 +1331,7 @@ RuntimeService::ResumeWorkersForWindow(JSContext* aCx, if (!workers.IsEmpty()) { for (uint32_t index = 0; index < workers.Length(); index++) { - if (!workers[index]->Resume(aCx)) { + if (!workers[index]->SynchronizeAndResume(aCx)) { NS_WARNING("Failed to cancel worker!"); } } diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index 8244d8889fe5..41229658bfb5 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -120,7 +120,7 @@ public: SuspendWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); void - ResumeWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); + ResumeWorkersForWindow(nsIScriptContext* aCx, nsPIDOMWindow* aWindow); const nsACString& GetDetectorName() const diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index fb887477be1d..c9e755e5d1ca 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -77,6 +77,7 @@ using mozilla::MutexAutoLock; using mozilla::TimeDuration; using mozilla::TimeStamp; using mozilla::dom::workers::exceptions::ThrowDOMExceptionForNSResult; +using mozilla::AutoPushJSContext; using mozilla::AutoSafeJSContext; USING_WORKERS_NAMESPACE @@ -1403,6 +1404,33 @@ public: } }; +class SynchronizeAndResumeRunnable : public nsRunnable +{ +protected: + WorkerPrivate* mWorkerPrivate; + nsCOMPtr mCx; + +public: + SynchronizeAndResumeRunnable(WorkerPrivate* aWorkerPrivate, + nsIScriptContext* aCx) + : mWorkerPrivate(aWorkerPrivate), mCx(aCx) + { + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); + } + + NS_IMETHOD Run() + { + NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); + + AutoPushJSContext cx(mCx ? mCx->GetNativeContext() : + nsContentUtils::GetSafeJSContext()); + JSAutoRequest ar(cx); + mWorkerPrivate->Resume(cx); + + return NS_OK; + } +}; + class WorkerJSRuntimeStats : public JS::RuntimeStats { const nsACString& mRtPath; @@ -1959,7 +1987,7 @@ WorkerPrivateParent::Suspend(JSContext* aCx) } template -bool +void WorkerPrivateParent::Resume(JSContext* aCx) { AssertIsOnParentThread(); @@ -1971,11 +1999,11 @@ WorkerPrivateParent::Resume(JSContext* aCx) MutexAutoLock lock(mMutex); if (mParentStatus >= Terminating) { - return true; + return; } } - // Dispatch queued runnables before waking up the worker, otherwise the worker + // Execute queued runnables before waking up the worker, otherwise the worker // could post new messages before we run those that have been queued. if (!mQueuedRunnables.IsEmpty()) { AssertIsOnMainThread(); @@ -1985,19 +2013,31 @@ WorkerPrivateParent::Resume(JSContext* aCx) for (uint32_t index = 0; index < runnables.Length(); index++) { nsRefPtr& runnable = runnables[index]; - if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { - NS_WARNING("Failed to dispatch queued runnable!"); - } + runnable->Run(); } } nsRefPtr runnable = new ResumeRunnable(ParentAsWorkerPrivate()); - if (!runnable->Dispatch(aCx)) { - return false; - } + runnable->Dispatch(aCx); +} - return true; +template +bool +WorkerPrivateParent::SynchronizeAndResume(nsIScriptContext* aCx) +{ + AssertIsOnParentThread(); + NS_ASSERTION(mParentSuspended, "Not yet suspended!"); + + // NB: There may be pending unqueued messages. If we resume here we will + // execute those messages out of order. Instead we post an event to the + // end of the event queue, allowing all of the outstanding messages to be + // queued up in order on the worker. Then and only then we execute all of + // the messages. + + nsRefPtr runnable = + new SynchronizeAndResumeRunnable(ParentAsWorkerPrivate(), aCx); + return NS_SUCCEEDED(NS_DispatchToCurrentThread(runnable)); } template diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index e94c9a46c7f8..b9fdf60ac848 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -109,7 +109,7 @@ protected: void NotifyScriptExecutedIfNeeded() const; -private: +public: NS_DECL_NSIRUNNABLE }; @@ -348,9 +348,12 @@ public: bool Suspend(JSContext* aCx); - bool + void Resume(JSContext* aCx); + bool + SynchronizeAndResume(nsIScriptContext* aCx); + virtual void _trace(JSTracer* aTrc) MOZ_OVERRIDE; diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index deca647fdd88..9da38428efd0 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -24,6 +24,7 @@ #define WORKERS_SHUTDOWN_TOPIC "web-workers-shutdown" +class nsIScriptContext; class nsPIDOMWindow; BEGIN_WORKERS_NAMESPACE @@ -54,7 +55,7 @@ void SuspendWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); void -ResumeWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); +ResumeWorkersForWindow(nsIScriptContext* aCx, nsPIDOMWindow* aWindow); class WorkerTask { public: From 10716bfeb49c782da522871d2b1d0c1e4ded6577 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Thu, 6 Jun 2013 10:35:27 -0700 Subject: [PATCH 09/93] Fix misleading comment from bug 803675, r=dolske --HG-- extra : rebase_source : 443649d79172ba5e1304116aae22c74b898827c1 --- browser/app/profile/firefox.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index fdd1996de253..c81e87ad3684 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -393,7 +393,11 @@ pref("browser.link.open_newwindow.override.external", -1); // 2: don't divert window.open with features pref("browser.link.open_newwindow.restriction", 2); -// Disable opening a new window via window.open if browser is in fullscreen mode +// If true, this pref causes windows opened by window.open to be forced into new +// tabs (rather than potentially opening separate windows, depending on +// window.open arguments) when the browser is in fullscreen mode. +// We set this differently on Mac because the fullscreen implementation there is +// different. #ifdef XP_MACOSX pref("browser.link.open_newwindow.disabled_in_fullscreen", true); #else From 0fff129d82ea7b8bb1ddb7e2b00eb4f42145e671 Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Thu, 6 Jun 2013 13:33:54 -0400 Subject: [PATCH 10/93] Bug 878037 - unit test to make sure we can clone a static imgIRequest. r=seth --HG-- extra : rebase_source : 0b6a360ab04719b648c2eaaf9310a1bbb81be881 --- image/test/mochitest/Makefile.in | 1 + image/test/mochitest/test_staticClone.html | 42 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 image/test/mochitest/test_staticClone.html diff --git a/image/test/mochitest/Makefile.in b/image/test/mochitest/Makefile.in index f16259878f4e..289cb22dec4e 100644 --- a/image/test/mochitest/Makefile.in +++ b/image/test/mochitest/Makefile.in @@ -111,6 +111,7 @@ MOCHITEST_CHROME_FILES = imgutils.js \ test_synchronized_animation.html \ animated1.gif \ animated2.gif \ + test_staticClone.html \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/image/test/mochitest/test_staticClone.html b/image/test/mochitest/test_staticClone.html new file mode 100644 index 000000000000..fde8dcab1368 --- /dev/null +++ b/image/test/mochitest/test_staticClone.html @@ -0,0 +1,42 @@ + + + + + Test for Bug 878037 + + + + +Mozilla Bug 878037 +

+
+ + +
+
+
+
+ + From 3d8e6e267cd1ca268ce6ae628393cb5d6950db3f Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Thu, 6 Jun 2013 13:35:41 -0400 Subject: [PATCH 11/93] Bug 878037 - print preview crash test for printing a bullet with an animated image. r=smaug --HG-- extra : rebase_source : 2bba8a640fd6c5099fbaa7ae28970f941d27efb3 --- layout/base/tests/chrome/Makefile.in | 1 + layout/base/tests/chrome/animated.gif | Bin 0 -> 527 bytes .../base/tests/chrome/printpreview_helper.xul | 17 +++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 layout/base/tests/chrome/animated.gif diff --git a/layout/base/tests/chrome/Makefile.in b/layout/base/tests/chrome/Makefile.in index b7f155c51d7c..e3954192f916 100644 --- a/layout/base/tests/chrome/Makefile.in +++ b/layout/base/tests/chrome/Makefile.in @@ -35,6 +35,7 @@ MOCHITEST_CHROME_FILES = \ test_prerendered_transforms.html \ test_printpreview.xul \ printpreview_helper.xul \ + animated.gif \ test_printpreview_bug396024.xul \ printpreview_bug396024_helper.xul \ test_printpreview_bug482976.xul \ diff --git a/layout/base/tests/chrome/animated.gif b/layout/base/tests/chrome/animated.gif new file mode 100644 index 0000000000000000000000000000000000000000..b2895487bd5df3407a207bd50acd668fff0fd032 GIT binary patch literal 527 zcmZ?wbhEHbOkqf2XkcXc&%p5i|9{1wES!uCj0`#qK;R9OVPM+R)4%fcTmHp!w%qF8 zd~eTh{6#+vUzQ9w@`iM79~|Gbxg{AMb<2-*H3PlduL~NNUyFw zzWUW}))=id$6MyC*>mR3n?F3Vy0*TtxwXA>bAuQdP&{M;_Rt0*J@lS|1MDFcr%7kj zieL74ExeR9DeJ73{H=EaueUZG4%V}@wllx{YV}Up)Wf}>ewt;(@Be(l>i&H840Q{4 zj`SOCE0$Fp^LQq~_EPnx>&n#5ZO7f0@2tH3;O2Ent_DprsjR4_QEl$OPJW0wBGvxN z^L5MW=UUNRU$|v-Y'; printpreview(); exitprintpreview(); + + setTimeout(runTest6, 0); +} + +// Crash test for bug 878037 +function runTest6() { + window.frames[0].document.body.innerHTML = + '' + + '
  • Firefox will crash if you try and print this page
  • '; + + setTimeout(runTest6end, 500); +} + +function runTest6end() { + printpreview(); + exitprintpreview(); + finish(); } From b687c1a0929741deb542faf6e43a648b2b90907e Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Thu, 6 Jun 2013 11:42:01 -0600 Subject: [PATCH 12/93] Bug 869030 - Enable robocop testSystemPages; r=jmaher --- mobile/android/base/tests/robocop.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/tests/robocop.ini b/mobile/android/base/tests/robocop.ini index 4ab681034da8..f49797bca676 100644 --- a/mobile/android/base/tests/robocop.ini +++ b/mobile/android/base/tests/robocop.ini @@ -32,7 +32,7 @@ [testShareLink] [testClearPrivateData] # [testSettingsMenuItems] # see bug 843947 -# [testSystemPages] # see bug 869030 +[testSystemPages] # [testPermissions] # see bug 757475 # [testJarReader] # see bug 738890 [testDistribution] From 3c18bb93bd176a8ff6b844ab439f0f6d8cc09cb9 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Thu, 6 Jun 2013 10:49:09 -0700 Subject: [PATCH 13/93] Back out bug 877584 on this CLOSED TREE. --- content/base/src/nsContentUtils.cpp | 14 ++++-- js/xpconnect/idl/nsIXPConnect.idl | 23 +++++++++- js/xpconnect/src/nsXPConnect.cpp | 6 ++- js/xpconnect/src/xpcprivate.h | 6 +-- xpcom/base/nsCycleCollector.cpp | 61 ++++--------------------- xpcom/base/nsCycleCollector.h | 13 ------ xpcom/glue/nsCycleCollectionJSRuntime.h | 6 --- 7 files changed, 46 insertions(+), 83 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 8a2a5324dc33..a027efc0cd6c 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -54,7 +54,6 @@ #include "nsCPrefetchService.h" #include "nsCRT.h" #include "nsCycleCollectionParticipant.h" -#include "nsCycleCollector.h" #include "nsDataHashtable.h" #include "nsDocShellCID.h" #include "nsDOMCID.h" @@ -4326,22 +4325,27 @@ void nsContentUtils::HoldJSObjects(void* aScriptObjectHolder, nsScriptObjectTracer* aTracer) { - cyclecollector::AddJSHolder(aScriptObjectHolder, aTracer); + MOZ_ASSERT(sXPConnect, "Tried to HoldJSObjects when there was no XPConnect"); + if (sXPConnect) { + sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer); + } } /* static */ void nsContentUtils::DropJSObjects(void* aScriptObjectHolder) { - cyclecollector::RemoveJSHolder(aScriptObjectHolder); + if (sXPConnect) { + sXPConnect->RemoveJSHolder(aScriptObjectHolder); + } } #ifdef DEBUG /* static */ bool -nsContentUtils::AreJSObjectsHeld(void* aScriptObjectHolder) +nsContentUtils::AreJSObjectsHeld(void* aScriptHolder) { - return cyclecollector::TestJSHolder(aScriptObjectHolder); + return sXPConnect->TestJSHolder(aScriptHolder); } #endif diff --git a/js/xpconnect/idl/nsIXPConnect.idl b/js/xpconnect/idl/nsIXPConnect.idl index e0c0b4663ff5..25fe849cfa7b 100644 --- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } %} -[uuid(4498aa26-62df-4a4f-8a45-7ddfd7f84834)] +[uuid(8c85f21e-c28b-4a78-89cf-f5682d0c357a)] interface nsIXPConnect : nsISupports { %{ C++ @@ -561,6 +561,27 @@ interface nsIXPConnect : nsISupports in JSObjectPtr sandbox, in boolean returnStringOnly); + /** + * Root JS objects held by aHolder. + * @param aHolder The object that hold the JS objects that should be rooted. + * @param aTrace The tracer for aHolder. + */ + [noscript,notxpcom] void addJSHolder(in voidPtr aHolder, + in nsScriptObjectTracerPtr aTracer); + + /** + * Stop rooting the JS objects held by aHolder. + * @param aHolder The object that hold the rooted JS objects. + */ + [noscript,notxpcom] void removeJSHolder(in voidPtr aHolder); + + /** + * Test to see if a JS holder is in our hashtable. + * Only available in debug builds. + * @param aHolder The object to test for. + */ + [noscript,notxpcom] bool testJSHolder(in voidPtr aHolder); + /** * Note aJSContext as a child to the cycle collector. * @param aJSContext The JSContext to note. diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 09287d116570..edf086afee51 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1792,13 +1792,15 @@ nsXPConnect::RemoveJSHolder(void* aHolder) mRuntime->RemoveJSHolder(aHolder); } -#ifdef DEBUG bool nsXPConnect::TestJSHolder(void* aHolder) { +#ifdef DEBUG return mRuntime->TestJSHolder(aHolder); -} +#else + return false; #endif +} NS_IMETHODIMP nsXPConnect::SetReportAllJSExceptions(bool newval) diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index e351b10a0a1e..983bb2d74eb8 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -491,11 +491,7 @@ public: static XPCJSRuntime* GetRuntimeInstance(); XPCJSRuntime* GetRuntime() {return mRuntime;} - void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) MOZ_OVERRIDE; - void RemoveJSHolder(void* aHolder) MOZ_OVERRIDE; - #ifdef DEBUG - bool TestJSHolder(void* aHolder) MOZ_OVERRIDE; void SetObjectToUnlink(void* aObject); void AssertNoObjectsToTrace(void* aPossibleJSHolder); #endif @@ -804,8 +800,8 @@ public: void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer); void RemoveJSHolder(void* aHolder); -#ifdef DEBUG bool TestJSHolder(void* aHolder); +#ifdef DEBUG void SetObjectToUnlink(void* aObject) { mObjectToUnlink = aObject; } void AssertNoObjectsToTrace(void* aPossibleJSHolder); #endif diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 7ad3876f1e9f..9e5383ad59a7 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -2946,21 +2946,6 @@ nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf, // - mParams: because it only contains scalars. } -// This is our special sentinel value that tells us that we've shut -// down this thread's CC. -static nsCycleCollector* const kSentinelCollector = (nsCycleCollector*)1; - -inline bool -CollectorIsShutDown(nsCycleCollector* aCollector) -{ - return aCollector == kSentinelCollector; -} - -inline bool -HaveCollector(nsCycleCollector* aCollector) -{ - return aCollector && !CollectorIsShutDown(aCollector); -} //////////////////////////////////////////////////////////////////////// // Module public API (exported in nsCycleCollector.h) @@ -2981,7 +2966,9 @@ nsCycleCollector_forgetJSRuntime() { nsCycleCollector *collector = sCollector.get(); - if (CollectorIsShutDown(collector)) { + if (collector == (nsCycleCollector*)1) { + // This is our special sentinel value that tells us that we've shut + // down this thread's CC. return; } @@ -2989,38 +2976,6 @@ nsCycleCollector_forgetJSRuntime() collector->ForgetJSRuntime(); } -void -cyclecollector::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) -{ - nsCycleCollector *collector = sCollector.get(); - - MOZ_ASSERT(HaveCollector(collector)); - - collector->JSRuntime()->AddJSHolder(aHolder, aTracer); -} - -void -cyclecollector::RemoveJSHolder(void* aHolder) -{ - nsCycleCollector *collector = sCollector.get(); - - MOZ_ASSERT(HaveCollector(collector)); - - collector->JSRuntime()->RemoveJSHolder(aHolder); -} - -#ifdef DEBUG -bool -cyclecollector::TestJSHolder(void* aHolder) -{ - nsCycleCollector *collector = sCollector.get(); - - MOZ_ASSERT(HaveCollector(collector)); - - return collector->JSRuntime()->TestJSHolder(aHolder); -} -#endif - nsPurpleBufferEntry* NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp) { @@ -3030,7 +2985,9 @@ NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp) MOZ_CRASH(); } - if (CollectorIsShutDown(collector)) { + if (collector == (nsCycleCollector*)1) { + // This is our special sentinel value that tells us that we've shut + // down this thread's CC. return nullptr; } @@ -3042,7 +2999,9 @@ nsCycleCollector_suspectedCount() { nsCycleCollector *collector = sCollector.get(); - if (CollectorIsShutDown(collector)) { + if (collector == (nsCycleCollector*)1) { + // This is our special sentinel value that tells us that we've shut + // down this thread's CC. return 0; } @@ -3158,6 +3117,6 @@ nsCycleCollector_shutdown() delete collector; // We want to be able to distinguish never having a collector from // having a shutdown collector. - sCollector.set(kSentinelCollector); + sCollector.set(reinterpret_cast(1)); } } diff --git a/xpcom/base/nsCycleCollector.h b/xpcom/base/nsCycleCollector.h index 3ed70ed3a375..c9de7a99996c 100644 --- a/xpcom/base/nsCycleCollector.h +++ b/xpcom/base/nsCycleCollector.h @@ -9,7 +9,6 @@ class nsCycleCollectionJSRuntime; class nsICycleCollectorListener; class nsISupports; -class nsScriptObjectTracer; // Contains various stats about the cycle collection. class nsCycleCollectorResults @@ -64,16 +63,4 @@ nsCycleCollectorLoggerConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); -namespace mozilla { -namespace cyclecollector { - -void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer); -void RemoveJSHolder(void* aHolder); -#ifdef DEBUG -bool TestJSHolder(void* aHolder); -#endif - -} // namespace cyclecollector -} // namespace mozilla - #endif // nsCycleCollector_h__ diff --git a/xpcom/glue/nsCycleCollectionJSRuntime.h b/xpcom/glue/nsCycleCollectionJSRuntime.h index deac8f8d6e32..66711523743c 100644 --- a/xpcom/glue/nsCycleCollectionJSRuntime.h +++ b/xpcom/glue/nsCycleCollectionJSRuntime.h @@ -9,7 +9,6 @@ class nsCycleCollectionParticipant; class nsCycleCollectionNoteRootCallback; -class nsScriptObjectTracer; // Various methods the cycle collector needs to deal with Javascript. struct nsCycleCollectionJSRuntime @@ -52,12 +51,7 @@ struct nsCycleCollectionJSRuntime */ virtual nsCycleCollectionParticipant *GetParticipant() = 0; - virtual void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) = 0; - virtual void RemoveJSHolder(void* aHolder) = 0; - #ifdef DEBUG - virtual bool TestJSHolder(void* aHolder) = 0; - virtual void SetObjectToUnlink(void* aObject) = 0; virtual void AssertNoObjectsToTrace(void* aPossibleJSHolder) = 0; #endif From 49eccfe312d121df05ae10b71aeb7090e564fb23 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 6 Jun 2013 13:51:37 -0400 Subject: [PATCH 14/93] Backed out changeset 84fb317ea1d2 (bug 831789) for mochitest-3 timeouts. CLOSED TREE --- dom/media/tests/mochitest/head.js | 15 -- dom/media/tests/mochitest/pc.js | 181 +----------------- ...rConnection_offerRequiresReceiveAudio.html | 13 -- ...rConnection_offerRequiresReceiveVideo.html | 13 -- ...ection_offerRequiresReceiveVideoAudio.html | 13 -- 5 files changed, 10 insertions(+), 225 deletions(-) diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index d4560977fac2..0a9a5d307728 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -190,18 +190,3 @@ function unexpectedCallbackAndFinish(error) { SimpleTest.finish(); } } - -/** - * Generates a callback function fired only for unexpected events happening. - * - * @param {String} description a description of what the event fired on - * @param {String} eventName the name of the unexpected event - */ -function unexpectedEventAndFinish(description, eventName) { - return function () { - var e = new Error(); - ok(false, "Unexpected event '" + eventName + "' fired for " + description + - " " + e.stack.split("\n")[1]); - SimpleTest.finish(); - } -} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 0053644da9e1..dc6c747cf1ff 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -295,119 +295,21 @@ var commandsPeerConnection = [ } ], [ - 'PC_LOCAL_CHECK_MEDIA_STREAMS', + 'PC_LOCAL_CHECK_MEDIA', function (test) { - test.pcLocal.checkMediaStreams(test.pcRemote.constraints); + test.pcLocal.checkMedia(test.pcRemote.constraints); test.next(); } ], [ - 'PC_REMOTE_CHECK_MEDIA_STREAMS', + 'PC_REMOTE_CHECK_MEDIA', function (test) { - test.pcRemote.checkMediaStreams(test.pcLocal.constraints); + test.pcRemote.checkMedia(test.pcLocal.constraints); test.next(); } - ], - [ - 'PC_LOCAL_CHECK_MEDIA_FLOW_PRESENT', - function (test) { - test.pcLocal.checkMediaFlowPresent(function () { - test.next(); - }); - } - ], - [ - 'PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT', - function (test) { - test.pcRemote.checkMediaFlowPresent(function () { - test.next(); - }); - } ] ]; -/** - * This class provides a state checker for media elements which store - * a media stream to check for media attribute state and events fired. - * When constructed by a caller, an object instance is created with - * a media element, event state checkers for canplaythrough, timeupdate, and - * time changing on the media element and stream. - * - * @param {HTMLMediaElement} element the media element being analyzed - */ -function MediaElementChecker(element) { - this.element = element; - this.canPlayThroughFired = false; - this.timeUpdateFired = false; - this.timePassed = false; - - var self = this; - var elementId = self.element.getAttribute('id'); - - // When canplaythrough fires, we track that it's fired and remove the - // event listener. - var canPlayThroughCallback = function() { - info('canplaythrough fired for media element ' + elementId); - self.canPlayThroughFired = true; - self.element.removeEventListener('canplaythrough', canPlayThroughCallback, - false); - }; - - // When timeupdate fires, we track that it's fired and check if time - // has passed on the media stream and media element. - var timeUpdateCallback = function() { - self.timeUpdateFired = true; - info('timeupdate fired for media element ' + elementId); - - // If time has passed, then track that and remove the timeupdate event - // listener. - if(element.mozSrcObject && element.mozSrcObject.currentTime > 0 && - element.currentTime > 0) { - info('time passed for media element ' + elementId); - self.timePassed = true; - self.element.removeEventListener('timeupdate', timeUpdateCallback, - false); - } - }; - - element.addEventListener('canplaythrough', canPlayThroughCallback, false); - element.addEventListener('timeupdate', timeUpdateCallback, false); -} - -MediaElementChecker.prototype = { - - /** - * Waits until the canplaythrough & timeupdate events to fire along with - * ensuring time has passed on the stream and media element. - * - * @param {Function} onSuccess the success callback when media flow is - * established - */ - waitForMediaFlow : function MEC_WaitForMediaFlow(onSuccess) { - var self = this; - var elementId = self.element.getAttribute('id'); - info('Analyzing element: ' + elementId); - - if(self.canPlayThroughFired && self.timeUpdateFired && self.timePassed) { - ok(true, 'Media flowing for ' + elementId); - onSuccess(); - } else { - setTimeout(function() { - self.waitForMediaFlow(onSuccess); - }, 100); - } - }, - - /** - * Checks if there is no media flow present by checking that the ready - * state of the media element is HAVE_METADATA. - */ - checkForNoMediaFlow : function MEC_CheckForNoMediaFlow() { - ok(this.element.readyState === HTMLMediaElement.HAVE_METADATA, - 'Media element has a ready state of HAVE_METADATA'); - } -}; - /** * This class handles tests for peer connections. * @@ -509,20 +411,14 @@ function PeerConnectionWrapper(label, configuration) { this.constraints = [ ]; this.offerConstraints = {}; this.streams = [ ]; - this.mediaCheckers = [ ]; - - this.onaddstream = unexpectedEventAndFinish(this.label, 'onaddstream'); info("Creating new PeerConnectionWrapper: " + this.label); this._pc = new mozRTCPeerConnection(this.configuration); var self = this; this._pc.onaddstream = function (event) { - info(this.label + ': onaddstream event fired'); - - self.onaddstream(event.stream); - self.onaddstream = unexpectedEventAndFinish(this.label, - 'onaddstream'); + // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. + self.attachMedia(event.stream, 'video', 'remote'); }; } @@ -586,7 +482,6 @@ PeerConnectionWrapper.prototype = { } var element = createMediaElement(type, this._label + '_' + side); - this.mediaCheckers.push(new MediaElementChecker(element)); element.mozSrcObject = stream; element.play(); }, @@ -677,8 +572,7 @@ PeerConnectionWrapper.prototype = { }, /** - * Sets the remote description on the peer connection object & waits - * for a resulting onaddstream callback to fire. + * Sets the remote description and automatically handles the failure case. * * @param {object} desc * mozRTCSessionDescription for the remote description request @@ -687,39 +581,19 @@ PeerConnectionWrapper.prototype = { */ setRemoteDescription : function PCW_setRemoteDescription(desc, onSuccess) { var self = this; - var onAddStreamFired = false; - var setRemoteDescriptionFinished = false; - - // Fires onSuccess when both onaddstream and setRemoteDescription - // have finished. - function isFinished() { - if(onAddStreamFired && setRemoteDescriptionFinished) { - onSuccess(); - } - } - - // Sets up the provided stream in a media element when onaddstream fires. - this.onaddstream = function(stream) { - // bug 834835: Assume type is video until we get media tracks - self.attachMedia(stream, 'video', 'remote'); - onAddStreamFired = true; - isFinished(); - }; - this._pc.setRemoteDescription(desc, function () { info("Successfully set remote description for " + self.label); - setRemoteDescriptionFinished = true; - isFinished(); + onSuccess(); }, unexpectedCallbackAndFinish(new Error)); }, /** - * Checks that we are getting the media streams we expect. + * Checks that we are getting the media we expect. * * @param {object} constraintsRemote * The media constraints of the remote peer connection object */ - checkMediaStreams : function PCW_checkMediaStreams(constraintsRemote) { + checkMedia : function PCW_checkMedia(constraintsRemote) { is(this._pc.localStreams.length, this.constraints.length, this.label + ' has ' + this.constraints.length + ' local streams'); @@ -728,41 +602,6 @@ PeerConnectionWrapper.prototype = { this.label + ' has ' + 1 + ' remote streams'); }, - /** - * Check that media flow is present on all media elements involved in this - * test by waiting for confirmation that media flow is present. - * - * @param {Function} onSuccess the success callback when media flow - * is confirmed on all media elements - */ - checkMediaFlowPresent : function PCW_checkMediaFlowPresent(onSuccess) { - var self = this; - - function _checkMediaFlowPresent(index, onSuccess) { - if(index >= self.mediaCheckers.length) { - onSuccess(); - } else { - var mediaChecker = self.mediaCheckers[index]; - mediaChecker.waitForMediaFlow(function() { - _checkMediaFlowPresent(index + 1, onSuccess); - }); - } - } - - _checkMediaFlowPresent(0, onSuccess); - }, - - /** - * Checks that media flow is not present on all media elements involved in - * this test by ensuring that the ready state is either HAVE_NOTHING or - * HAVE_METADATA. - */ - checkMediaFlowNotPresent : function PCW_checkMediaFlowNotPresent() { - for(var mediaChecker of this.mediaCheckers) { - mediaChecker.checkForNoMediaFlow(); - } - }, - /** * Closes the connection */ diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html index 812ff62eb415..783a79a36157 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html @@ -14,22 +14,9 @@ title: "Simple offer media constraint test with audio" }); - var steps = [ - [ - "CHECK_MEDIA_FLOW_NOT_PRESENT", - function (test) { - test.pcLocal.checkMediaFlowNotPresent(); - test.pcRemote.checkMediaFlowNotPresent(); - test.next(); - } - ] - ]; - runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } }); - test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); - test.chain.append(steps); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html index 9a611070cb6b..214e9ede0157 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html @@ -14,22 +14,9 @@ title: "Simple offer media constraint test with video" }); - var steps = [ - [ - "CHECK_MEDIA_FLOW_NOT_PRESENT", - function (test) { - test.pcLocal.checkMediaFlowNotPresent(); - test.pcRemote.checkMediaFlowNotPresent(); - test.next(); - } - ] - ]; - runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } }); - test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); - test.chain.append(steps); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html index 92fa3a4592b4..d251322f8585 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html @@ -14,25 +14,12 @@ title: "Simple offer media constraint test with video/audio" }); - var steps = [ - [ - "CHECK_MEDIA_FLOW_NOT_PRESENT", - function (test) { - test.pcLocal.checkMediaFlowNotPresent(); - test.pcRemote.checkMediaFlowNotPresent(); - test.next(); - } - ] - ]; - runTest(function() { var test = new PeerConnectionTest(); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true, OfferToReceiveAudio: true }}); - test.chain.removeAfter('PC_REMOTE_CHECK_MEDIA_STREAMS'); - test.chain.append(steps); test.run(); }); From 0614a12fea935be13fb5becfe6bb6cea82b0d922 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Thu, 6 Jun 2013 14:05:32 -0400 Subject: [PATCH 15/93] bug 876689 - Virtual keyboard does not invoke on text input field focus if 'Don't keep activities' is enabled r=jchen --- mobile/android/base/FormAssistPopup.java | 2 +- mobile/android/base/GeckoAccessibility.java | 2 +- mobile/android/base/GeckoApp.java | 1 + mobile/android/base/GeckoAppShell.java | 5 ----- mobile/android/base/GeckoEvent.java | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mobile/android/base/FormAssistPopup.java b/mobile/android/base/FormAssistPopup.java index 3c6718ff307a..4d683f5eb7fe 100644 --- a/mobile/android/base/FormAssistPopup.java +++ b/mobile/android/base/FormAssistPopup.java @@ -206,7 +206,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene sValidationMessageHeight = (int) (res.getDimension(R.dimen.validation_message_height)); } - ImmutableViewportMetrics viewportMetrics = GeckoAppShell.getGeckoInterface().getLayerView().getViewportMetrics(); + ImmutableViewportMetrics viewportMetrics = GeckoAppShell.getLayerView().getViewportMetrics(); float zoom = viewportMetrics.zoomFactor; // These values correspond to the input box for which we want to diff --git a/mobile/android/base/GeckoAccessibility.java b/mobile/android/base/GeckoAccessibility.java index 9370be5ba782..307be51a22a4 100644 --- a/mobile/android/base/GeckoAccessibility.java +++ b/mobile/android/base/GeckoAccessibility.java @@ -153,7 +153,7 @@ public class GeckoAccessibility { } else { // In Jelly Bean we populate an AccessibilityNodeInfo with the minimal amount of data to have // it work with TalkBack. - final LayerView view = GeckoAppShell.getGeckoInterface().getLayerView(); + final LayerView view = GeckoAppShell.getLayerView(); if (view == null) return; diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 5bdd58928c3f..904fb6677939 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1294,6 +1294,7 @@ abstract public class GeckoApp LayerView layerView = (LayerView) findViewById(R.id.layer_view); layerView.initializeView(GeckoAppShell.getEventDispatcher()); mLayerView = layerView; + GeckoAppShell.setLayerView(layerView); // bind the GeckoEditable instance to the new LayerView GeckoAppShell.notifyIMEContext(GeckoEditableListener.IME_STATE_DISABLED, "", "", ""); } diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index fff7874080e2..9b58794e1a1d 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -287,13 +287,9 @@ public class GeckoAppShell // run gecko -- it will spawn its own thread GeckoAppShell.nativeInit(); - // Tell Gecko where the target byte buffer is for rendering - if (getGeckoInterface() != null) - sLayerView = getGeckoInterface().getLayerView(); if (sLayerView != null) GeckoAppShell.setLayerClient(sLayerView.getLayerClient()); - // First argument is the .apk path String combinedArgs = apkPath + " -greomni " + apkPath; if (args != null) @@ -2048,7 +2044,6 @@ public class GeckoAppShell public interface GeckoInterface { public GeckoProfile getProfile(); - public LayerView getLayerView(); public PromptService getPromptService(); public Activity getActivity(); public String getDefaultUAString(); diff --git a/mobile/android/base/GeckoEvent.java b/mobile/android/base/GeckoEvent.java index 5cd72d74626a..eab01ce840ef 100644 --- a/mobile/android/base/GeckoEvent.java +++ b/mobile/android/base/GeckoEvent.java @@ -311,7 +311,7 @@ public class GeckoEvent { event.mPoints = new Point[1]; PointF geckoPoint = new PointF(pt.x, pt.y); - geckoPoint = GeckoAppShell.getGeckoInterface().getLayerView().convertViewPointToLayerPoint(geckoPoint); + geckoPoint = GeckoAppShell.getLayerView().convertViewPointToLayerPoint(geckoPoint); if (geckoPoint == null) { // This could happen if Gecko isn't ready yet. From a5ec74e1fbf0dd88a4d8ed7f139291b908ff55c7 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Thu, 6 Jun 2013 14:05:06 -0400 Subject: [PATCH 16/93] bug 876689 - Virtual keyboard does not invoke on text input field focus if 'Don't keep activities' is enabled r=jchen --- mobile/android/base/GeckoApp.java | 4 ---- mobile/android/base/Prompt.java | 5 +---- mobile/android/base/RobocopAPI.java | 2 +- mobile/android/base/TextSelection.java | 12 +++++------- mobile/android/base/TextSelectionHandle.java | 9 +++------ mobile/android/base/WebAppImpl.java | 2 +- 6 files changed, 11 insertions(+), 23 deletions(-) diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 904fb6677939..0a77621c173a 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -2243,10 +2243,6 @@ abstract public class GeckoApp } } - public LayerView getLayerView() { - return mLayerView; - } - public AbsoluteLayout getPluginContainer() { return mPluginContainer; } // Accelerometer. diff --git a/mobile/android/base/Prompt.java b/mobile/android/base/Prompt.java index a986b8d25162..791370263810 100644 --- a/mobile/android/base/Prompt.java +++ b/mobile/android/base/Prompt.java @@ -117,10 +117,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis public void show(String aTitle, String aText, PromptListItem[] aMenuList, boolean aMultipleSelection) { ThreadUtils.assertOnUiThread(); - // treat actions that show a dialog as if preventDefault by content to prevent panning - if (mContext instanceof GeckoApp) { - ((GeckoApp)mContext).getLayerView().abortPanning(); - } + GeckoAppShell.getLayerView().abortPanning(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); if (!TextUtils.isEmpty(aTitle)) { diff --git a/mobile/android/base/RobocopAPI.java b/mobile/android/base/RobocopAPI.java index a6a9f868af7d..89941d4289c6 100644 --- a/mobile/android/base/RobocopAPI.java +++ b/mobile/android/base/RobocopAPI.java @@ -36,7 +36,7 @@ public class RobocopAPI { } public void setDrawListener(GeckoLayerClient.DrawListener listener) { - mGeckoApp.getLayerView().getLayerClient().setDrawListener(listener); + GeckoAppShell.getLayerView().getLayerClient().setDrawListener(listener); } public Cursor querySql(String dbPath, String query) { diff --git a/mobile/android/base/TextSelection.java b/mobile/android/base/TextSelection.java index fc74b5c6798a..675905b7e5f4 100644 --- a/mobile/android/base/TextSelection.java +++ b/mobile/android/base/TextSelection.java @@ -9,6 +9,7 @@ import org.mozilla.gecko.gfx.LayerView; import org.mozilla.gecko.util.EventDispatcher; import org.mozilla.gecko.util.FloatUtils; import org.mozilla.gecko.util.GeckoEventListener; +import org.mozilla.gecko.util.ThreadUtils; import org.json.JSONArray; import org.json.JSONException; @@ -29,8 +30,6 @@ class TextSelection extends Layer implements GeckoEventListener { private float mViewTop; private float mViewZoom; - private GeckoApp mActivity; - TextSelection(TextSelectionHandle startHandle, TextSelectionHandle middleHandle, TextSelectionHandle endHandle, @@ -40,7 +39,6 @@ class TextSelection extends Layer implements GeckoEventListener { mMiddleHandle = middleHandle; mEndHandle = endHandle; mEventDispatcher = eventDispatcher; - mActivity = activity; // Only register listeners if we have valid start/middle/end handles if (mStartHandle == null || mMiddleHandle == null || mEndHandle == null) { @@ -70,7 +68,7 @@ class TextSelection extends Layer implements GeckoEventListener { @Override public void handleMessage(final String event, final JSONObject message) { - mActivity.runOnUiThread(new Runnable() { + ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { try { @@ -84,12 +82,12 @@ class TextSelection extends Layer implements GeckoEventListener { mViewLeft = 0.0f; mViewTop = 0.0f; mViewZoom = 0.0f; - LayerView layerView = mActivity.getLayerView(); + LayerView layerView = GeckoAppShell.getLayerView(); if (layerView != null) { layerView.addLayer(TextSelection.this); } } else if (event.equals("TextSelection:HideHandles")) { - LayerView layerView = mActivity.getLayerView(); + LayerView layerView = GeckoAppShell.getLayerView(); if (layerView != null) { layerView.removeLayer(TextSelection.this); } @@ -135,7 +133,7 @@ class TextSelection extends Layer implements GeckoEventListener { mViewTop = viewTop; mViewZoom = viewZoom; - mActivity.runOnUiThread(new Runnable() { + ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { mStartHandle.repositionWithViewport(viewLeft, viewTop, viewZoom); diff --git a/mobile/android/base/TextSelectionHandle.java b/mobile/android/base/TextSelectionHandle.java index f8f3696d385c..ceb837d91fce 100644 --- a/mobile/android/base/TextSelectionHandle.java +++ b/mobile/android/base/TextSelectionHandle.java @@ -43,12 +43,9 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener { private static final int IMAGE_LEVEL_LTR = 0; private static final int IMAGE_LEVEL_RTL = 1; - private GeckoApp mActivity; - public TextSelectionHandle(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); - mActivity = (GeckoApp) context; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextSelectionHandle); int handleType = a.getInt(R.styleable.TextSelectionHandle_handleType, 0x01); @@ -76,7 +73,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener { mTouchStartY = event.getY(); int[] rect = new int[2]; - mActivity.getLayerView().getLocationOnScreen(rect); + GeckoAppShell.getLayerView().getLocationOnScreen(rect); mLayerViewX = rect[0]; mLayerViewY = rect[1]; break; @@ -111,7 +108,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener { mLeft = newX - mLayerViewX - mTouchStartX; mTop = newY - mLayerViewY - mTouchStartY; - LayerView layerView = mActivity.getLayerView(); + LayerView layerView = GeckoAppShell.getLayerView(); if (layerView == null) { Log.e(LOGTAG, "Can't move selection because layerView is null"); return; @@ -142,7 +139,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener { } void positionFromGecko(int left, int top, boolean rtl) { - LayerView layerView = mActivity.getLayerView(); + LayerView layerView = GeckoAppShell.getLayerView(); if (layerView == null) { Log.e(LOGTAG, "Can't position handle because layerView is null"); return; diff --git a/mobile/android/base/WebAppImpl.java b/mobile/android/base/WebAppImpl.java index 25bcc348e299..045f8a044264 100644 --- a/mobile/android/base/WebAppImpl.java +++ b/mobile/android/base/WebAppImpl.java @@ -217,6 +217,6 @@ public class WebAppImpl extends GeckoApp { @Override protected void geckoConnected() { super.geckoConnected(); - getLayerView().setOverScrollMode(View.OVER_SCROLL_NEVER); + mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER); } }; From 64d39d24ca13d3a5afc5e95fe438bcb475eb9188 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 6 Jun 2013 14:29:52 -0400 Subject: [PATCH 17/93] Bug 880202 - Skip crashtest on B2G due to failures. --- content/media/test/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index c38d70d9589b..c693ad83c37a 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -37,4 +37,4 @@ load 878328.html load 878407.html load 878478.html load 877527.html -load 880202.html +skip-if(B2G) load 880202.html # load failed, bug 833371 for B2G From 3a15382a129a446e81a532df7f17a0851060a37e Mon Sep 17 00:00:00 2001 From: Kannan Vijayan Date: Thu, 6 Jun 2013 15:03:40 -0400 Subject: [PATCH 18/93] Bug 877287 - Fix regression introduced by revision 7df36088f645. r=bhackett --- js/src/ion/IonBuilder.cpp | 16 +++++++++------- js/src/jsobj.cpp | 9 +++++++++ js/src/jsobjinlines.h | 4 ++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/js/src/ion/IonBuilder.cpp b/js/src/ion/IonBuilder.cpp index a608493fd4a9..afabd7fc0f4e 100644 --- a/js/src/ion/IonBuilder.cpp +++ b/js/src/ion/IonBuilder.cpp @@ -5254,13 +5254,15 @@ IonBuilder::jsop_initelem_array() } static bool -CanEffectlesslyCallLookupGenericOnObject(JSObject *obj) +CanEffectlesslyCallLookupGenericOnObject(JSContext *cx, JSObject *obj, jsid id) { while (obj) { if (!obj->isNative()) return false; - if (obj->getClass()->ops.lookupProperty) + if (obj->getClass()->ops.lookupGeneric) return false; + if (obj->nativeLookup(cx, id)) + return true; if (obj->getClass()->resolve != JS_ResolveStub) return false; obj = obj->getProto(); @@ -5276,12 +5278,12 @@ IonBuilder::jsop_initprop(HandlePropertyName name) RootedObject templateObject(cx, obj->toNewObject()->templateObject()); - if (!CanEffectlesslyCallLookupGenericOnObject(templateObject)) - return abort("INITPROP template object is special"); - RootedObject holder(cx); RootedShape shape(cx); RootedId id(cx, NameToId(name)); + if (!CanEffectlesslyCallLookupGenericOnObject(cx, templateObject, id)) + return abort("INITPROP template object is special"); + bool res = LookupPropertyWithFlags(cx, templateObject, id, 0, &holder, &shape); if (!res) @@ -5667,7 +5669,7 @@ TestSingletonProperty(JSContext *cx, HandleObject obj, JSObject *singleton, if (id != types::IdToTypeId(id)) return true; - if (!CanEffectlesslyCallLookupGenericOnObject(obj)) + if (!CanEffectlesslyCallLookupGenericOnObject(cx, obj, id)) return true; RootedObject holder(cx); @@ -7145,7 +7147,7 @@ IonBuilder::TestCommonPropFunc(JSContext *cx, types::StackTypeSet *types, Handle // Turns out that we need to check for a property lookup op, else we // will end up calling it mid-compilation. - if (!CanEffectlesslyCallLookupGenericOnObject(curObj)) + if (!CanEffectlesslyCallLookupGenericOnObject(cx, curObj, id)) return true; RootedObject proto(cx); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 1adef5e8b546..292c1f6d8783 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -3580,6 +3580,11 @@ LookupPropertyWithFlagsInline(JSContext *cx, typename MaybeRooted::MutableHandleType objp, typename MaybeRooted::MutableHandleType propp) { + /* NB: The logic of this procedure is implicitly reflected in IonBuilder.cpp's + * |CanEffectlesslyCallLookupGenericOnObject| logic. + * If this changes, please remember to update the logic there as well. + */ + /* Search scopes starting with obj and following the prototype link. */ typename MaybeRooted::RootType current(cx, obj); @@ -3657,6 +3662,10 @@ baseops::LookupProperty(JSContext *cx, typename MaybeRooted::MutableHandleType objp, typename MaybeRooted::MutableHandleType propp) { + /* NB: The logic of this procedure is implicitly reflected in IonBuilder.cpp's + * |CanEffectlesslyCallLookupGenericOnObject| logic. + * If this changes, please remember to update the logic there as well. + */ return LookupPropertyWithFlagsInline(cx, obj, id, cx->resolveFlags, objp, propp); } diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 31955124c8d7..3d620da3df71 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -1096,6 +1096,10 @@ JSObject::hasShapeTable() const JSObject::lookupGeneric(JSContext *cx, js::HandleObject obj, js::HandleId id, js::MutableHandleObject objp, js::MutableHandleShape propp) { + /* NB: The logic of lookupGeneric is implicitly reflected in IonBuilder.cpp's + * |CanEffectlesslyCallLookupGenericOnObject| logic. + * If this changes, please remember to update the logic there as well. + */ js::LookupGenericOp op = obj->getOps()->lookupGeneric; if (op) return op(cx, obj, id, objp, propp); From 63095521a734652f0ab266d0b1a1ec61c184e8c0 Mon Sep 17 00:00:00 2001 From: Sean Stangl Date: Wed, 5 Jun 2013 17:05:28 -0700 Subject: [PATCH 19/93] Bug 858586 - Drop temporary MGetPropertyCache reference if native inlining fails. r=h4writer --- js/src/ion/IonBuilder.cpp | 2 +- js/src/jit-test/tests/ion/bug858586.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/ion/bug858586.js diff --git a/js/src/ion/IonBuilder.cpp b/js/src/ion/IonBuilder.cpp index afabd7fc0f4e..c119ca048916 100644 --- a/js/src/ion/IonBuilder.cpp +++ b/js/src/ion/IonBuilder.cpp @@ -4133,7 +4133,7 @@ IonBuilder::inlineCalls(CallInfo &callInfo, AutoObjectVector &targets, JS_ASSERT(current == inlineBlock); // Undo operations inlineInfo.unwrapArgs(); - inlineBlock->entryResumePoint()->replaceOperand(funIndex, callInfo.fun()); + inlineBlock->entryResumePoint()->discardOperand(funIndex); inlineBlock->rewriteSlot(funIndex, callInfo.fun()); inlineBlock->discard(funcDef); graph().removeBlock(inlineBlock); diff --git a/js/src/jit-test/tests/ion/bug858586.js b/js/src/jit-test/tests/ion/bug858586.js new file mode 100644 index 000000000000..5f8a46c0e4b3 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug858586.js @@ -0,0 +1,23 @@ +function A(a) { this.a = a; } +A.prototype.foo = function (x) {}; +function B(b) { this.b = b; } +B.prototype.foo = function (x) {}; +function C(c) {} +function makeArray(n) { + var classes = [A, B, C]; + var arr = []; + for (var i = 0; i < n; i++) { + arr.push(new classes[i % 3](i % 3)); + } + return arr; +} +function runner(arr, resultArray, len) { + for (var i = 0; i < len; i++) { + var obj = arr[i]; + resultArray[0] += obj.foo(i); + } +} +var resultArray = [0]; +var arr = makeArray(30000); +C.prototype.foo = Uint8ClampedArray; +runner(arr, resultArray, 30000); From 0892e623d95bd96d4004cc2dbea21fbc87cb8bec Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Thu, 6 Jun 2013 15:59:31 -0400 Subject: [PATCH 20/93] Bug 874196 - Add an API to get the specifics of a permission given a host/type: this will allow the plugin click-to-activate UI to manage permissions by the matching host and determine whether the current permission is per-session or persistent. r=jdm sr=mounir --- extensions/cookie/nsPermission.cpp | 4 +- extensions/cookie/nsPermissionManager.cpp | 57 +++++++++++ .../test_permmanager_getPermissionObject.js | 94 +++++++++++++++++++ extensions/cookie/test/unit/xpcshell.ini | 1 + netwerk/base/public/nsIPermissionManager.idl | 20 +++- 5 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 extensions/cookie/test/unit/test_permmanager_getPermissionObject.js diff --git a/extensions/cookie/nsPermission.cpp b/extensions/cookie/nsPermission.cpp index b1bd2775e8ac..06d22fea8736 100644 --- a/extensions/cookie/nsPermission.cpp +++ b/extensions/cookie/nsPermission.cpp @@ -4,10 +4,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsPermission.h" +#include "nsIClassInfoImpl.h" // nsPermission Implementation -NS_IMPL_ISUPPORTS1(nsPermission, nsIPermission) +NS_IMPL_CLASSINFO(nsPermission, nullptr, 0, {0}) +NS_IMPL_ISUPPORTS1_CI(nsPermission, nsIPermission) nsPermission::nsPermission(const nsACString &aHost, uint32_t aAppId, diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 20d6245e281c..ef8e6b576097 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -1018,6 +1018,63 @@ nsPermissionManager::TestPermissionFromPrincipal(nsIPrincipal* aPrincipal, return CommonTestPermission(aPrincipal, aType, aPermission, false, true); } +NS_IMETHODIMP +nsPermissionManager::GetPermissionObject(nsIPrincipal* aPrincipal, + const char* aType, + bool aExactHostMatch, + nsIPermission** aResult) +{ + NS_ENSURE_ARG_POINTER(aPrincipal); + NS_ENSURE_ARG_POINTER(aType); + + *aResult = nullptr; + + if (nsContentUtils::IsSystemPrincipal(aPrincipal)) { + return NS_OK; + } + + nsAutoCString host; + nsresult rv = GetHostForPrincipal(aPrincipal, host); + NS_ENSURE_SUCCESS(rv, rv); + + int32_t typeIndex = GetTypeIndex(aType, false); + // If type == -1, the type isn't known, + // so just return NS_OK + if (typeIndex == -1) return NS_OK; + + uint32_t appId; + rv = aPrincipal->GetAppId(&appId); + NS_ENSURE_SUCCESS(rv, rv); + + bool isInBrowserElement; + rv = aPrincipal->GetIsInBrowserElement(&isInBrowserElement); + NS_ENSURE_SUCCESS(rv, rv); + + PermissionHashKey* entry = GetPermissionHashKey(host, appId, isInBrowserElement, + typeIndex, aExactHostMatch); + if (!entry) { + return NS_OK; + } + + // We don't call GetPermission(typeIndex) because that returns a fake + // UNKNOWN_ACTION entry if there is no match. + int32_t idx = entry->GetPermissionIndex(typeIndex); + if (-1 == idx) { + return NS_OK; + } + + PermissionEntry& perm = entry->GetPermissions()[idx]; + nsCOMPtr r = new nsPermission(entry->GetKey()->mHost, + entry->GetKey()->mAppId, + entry->GetKey()->mIsInBrowserElement, + mTypeArray.ElementAt(perm.mType), + perm.mPermission, + perm.mExpireType, + perm.mExpireTime); + r.forget(aResult); + return NS_OK; +} + nsresult nsPermissionManager::CommonTestPermission(nsIPrincipal* aPrincipal, const char *aType, diff --git a/extensions/cookie/test/unit/test_permmanager_getPermissionObject.js b/extensions/cookie/test/unit/test_permmanager_getPermissionObject.js new file mode 100644 index 000000000000..9ab4ff21f0f2 --- /dev/null +++ b/extensions/cookie/test/unit/test_permmanager_getPermissionObject.js @@ -0,0 +1,94 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function getPrincipalFromURI(uri) { + return Cc["@mozilla.org/scriptsecuritymanager;1"] + .getService(Ci.nsIScriptSecurityManager) + .getNoAppCodebasePrincipal(NetUtil.newURI(uri)); +} + +function getSystemPrincipal() { + return Cc["@mozilla.org/scriptsecuritymanager;1"] + .getService(Ci.nsIScriptSecurityManager) + .getSystemPrincipal(); +} + +function run_test() { + var pm = Cc["@mozilla.org/permissionmanager;1"]. + getService(Ci.nsIPermissionManager); + + do_check_null(pm.getPermissionObject(getSystemPrincipal(), "test/pobject", false)); + + let principal = getPrincipalFromURI("http://example.com"); + let subPrincipal = getPrincipalFromURI("http://sub.example.com"); + let subSubPrincipal = getPrincipalFromURI("http://sub.sub.example.com"); + + do_check_null(pm.getPermissionObject(principal, "test/pobject", false)); + do_check_null(pm.getPermissionObject(principal, "test/pobject", true)); + + pm.addFromPrincipal(principal, "test/pobject", pm.ALLOW_ACTION); + var rootPerm = pm.getPermissionObject(principal, "test/pobject", false); + do_check_true(rootPerm != null); + do_check_eq(rootPerm.host, "example.com"); + do_check_eq(rootPerm.type, "test/pobject"); + do_check_eq(rootPerm.capability, pm.ALLOW_ACTION); + do_check_eq(rootPerm.expireType, pm.EXPIRE_NEVER); + + var rootPerm2 = pm.getPermissionObject(principal, "test/pobject", true); + do_check_true(rootPerm != null); + do_check_eq(rootPerm.host, "example.com"); + + var subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", true); + do_check_null(subPerm); + subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", false); + do_check_true(subPerm != null); + do_check_eq(subPerm.host, "example.com"); + do_check_eq(subPerm.type, "test/pobject"); + do_check_eq(subPerm.capability, pm.ALLOW_ACTION); + + subPerm = pm.getPermissionObject(subSubPrincipal, "test/pobject", true); + do_check_null(subPerm); + subPerm = pm.getPermissionObject(subSubPrincipal, "test/pobject", false); + do_check_true(subPerm != null); + do_check_eq(subPerm.host, "example.com"); + + pm.addFromPrincipal(principal, "test/pobject", pm.DENY_ACTION, pm.EXPIRE_SESSION); + + // make sure permission objects are not dynamic + do_check_eq(rootPerm.capability, pm.ALLOW_ACTION); + + // but do update on change + rootPerm = pm.getPermissionObject(principal, "test/pobject", true); + do_check_eq(rootPerm.capability, pm.DENY_ACTION); + do_check_eq(rootPerm.expireType, pm.EXPIRE_SESSION); + + subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", false); + do_check_eq(subPerm.host, "example.com"); + do_check_eq(subPerm.capability, pm.DENY_ACTION); + do_check_eq(subPerm.expireType, pm.EXPIRE_SESSION); + + pm.addFromPrincipal(subPrincipal, "test/pobject", pm.PROMPT_ACTION); + rootPerm = pm.getPermissionObject(principal, "test/pobject", true); + do_check_eq(rootPerm.host, "example.com"); + do_check_eq(rootPerm.capability, pm.DENY_ACTION); + + subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", true); + do_check_eq(subPerm.host, "sub.example.com"); + do_check_eq(subPerm.capability, pm.PROMPT_ACTION); + + subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", false); + do_check_eq(subPerm.host, "sub.example.com"); + do_check_eq(subPerm.capability, pm.PROMPT_ACTION); + + subPerm = pm.getPermissionObject(subSubPrincipal, "test/pobject", true); + do_check_null(subPerm); + + subPerm = pm.getPermissionObject(subSubPrincipal, "test/pobject", false); + do_check_eq(subPerm.host, "sub.example.com"); + do_check_eq(subPerm.capability, pm.PROMPT_ACTION); + + pm.removeFromPrincipal(principal, "test/pobject"); + + rootPerm = pm.getPermissionObject(principal, "test/pobject", true); + do_check_null(rootPerm); +} diff --git a/extensions/cookie/test/unit/xpcshell.ini b/extensions/cookie/test/unit/xpcshell.ini index 0751b8d054e8..a10ba87ff2a1 100644 --- a/extensions/cookie/test/unit/xpcshell.ini +++ b/extensions/cookie/test/unit/xpcshell.ini @@ -16,6 +16,7 @@ tail = [test_domain_eviction.js] [test_eviction.js] [test_permmanager_expiration.js] +[test_permmanager_getPermissionObject.js] [test_permmanager_notifications.js] [test_permmanager_removeall.js] [test_permmanager_load_invalid_entries.js] diff --git a/netwerk/base/public/nsIPermissionManager.idl b/netwerk/base/public/nsIPermissionManager.idl index e301fc4a205a..9769dd54774b 100644 --- a/netwerk/base/public/nsIPermissionManager.idl +++ b/netwerk/base/public/nsIPermissionManager.idl @@ -35,8 +35,9 @@ interface nsIURI; interface nsIObserver; interface nsIPrincipal; interface nsIDOMWindow; +interface nsIPermission; -[scriptable, uuid(b38c982d-30bc-463f-9afc-0ca339eac03c)] +[scriptable, uuid(f75e0a32-04cd-4ed4-ad2d-d08ca92bb98e)] interface nsIPermissionManager : nsISupports { /** @@ -186,6 +187,23 @@ interface nsIPermissionManager : nsISupports uint32_t testExactPermanentPermission(in nsIPrincipal principal, in string type); + /** + * Get the permission object associated with the given principal and action. + * @param principal The principal + * @param type A case-sensitive ASCII string identifying the consumer + * @param exactHost If true, only the specific host will be matched, + * @see testExactPermission. If false, subdomains will + * also be searched, @see testPermission. + * @returns The matching permission object, or null if no matching object + * was found. No matching object is equivalent to UNKNOWN_ACTION. + * @note Clients in general should prefer the test* methods unless they + * need to know the specific stored details. + * @note This method will always return null for the system principal. + */ + nsIPermission getPermissionObject(in nsIPrincipal principal, + in string type, + in boolean exactHost); + /** * Increment or decrement our "refcount" of an app id. * From fbcb1e719611013a7c7cd0bd3569f360c1109499 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Thu, 6 Jun 2013 15:59:32 -0400 Subject: [PATCH 21/93] Bug 874197 - Change nsIPermissionManager.TYPE_SESSION to also respect expiration times if they are specified. r=jdm sr=mounir --- extensions/cookie/nsPermissionManager.cpp | 18 +++++++++++++----- extensions/cookie/nsPermissionManager.h | 4 +++- .../test/unit/test_permmanager_expiration.js | 14 +++++++++++++- netwerk/base/public/nsIPermissionManager.idl | 3 ++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index ef8e6b576097..38e1b8e9e190 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -618,8 +618,10 @@ nsPermissionManager::AddFromPrincipal(nsIPrincipal* aPrincipal, aExpireType == nsIPermissionManager::EXPIRE_SESSION, NS_ERROR_INVALID_ARG); - // Skip addition if the permission is already expired. - if (aExpireType == nsIPermissionManager::EXPIRE_TIME && + // Skip addition if the permission is already expired. Note that EXPIRE_SESSION only + // honors expireTime if it is nonzero. + if ((aExpireType == nsIPermissionManager::EXPIRE_TIME || + (aExpireType == nsIPermissionManager::EXPIRE_SESSION && aExpireTime != 0)) && aExpireTime <= (PR_Now() / 1000)) { return NS_OK; } @@ -702,7 +704,7 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal, // only thing changed is the expire time. if (aPermission == oldPermissionEntry.mPermission && aExpireType == oldPermissionEntry.mExpireType && - (aExpireType != nsIPermissionManager::EXPIRE_TIME || + (aExpireType == nsIPermissionManager::EXPIRE_NEVER || aExpireTime == oldPermissionEntry.mExpireTime)) op = eOperationNone; else if (aPermission == nsIPermissionManager::UNKNOWN_ACTION) @@ -801,14 +803,16 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal, aExpireType == nsIPermissionManager::EXPIRE_SESSION) { entry->GetPermissions()[index].mNonSessionPermission = entry->GetPermissions()[index].mPermission; entry->GetPermissions()[index].mNonSessionExpireType = entry->GetPermissions()[index].mExpireType; + entry->GetPermissions()[index].mNonSessionExpireTime = entry->GetPermissions()[index].mExpireTime; } else if (aExpireType != nsIPermissionManager::EXPIRE_SESSION) { entry->GetPermissions()[index].mNonSessionPermission = aPermission; entry->GetPermissions()[index].mNonSessionExpireType = aExpireType; - entry->GetPermissions()[index].mExpireTime = aExpireTime; + entry->GetPermissions()[index].mNonSessionExpireTime = aExpireTime; } entry->GetPermissions()[index].mPermission = aPermission; entry->GetPermissions()[index].mExpireType = aExpireType; + entry->GetPermissions()[index].mExpireTime = aExpireTime; if (aDBOperation == eWriteToDB && aExpireType != nsIPermissionManager::EXPIRE_SESSION) // We care only about the id, the permission and expireType/expireTime here. @@ -1143,7 +1147,10 @@ nsPermissionManager::GetPermissionHashKey(const nsACString& aHost, PermissionEntry permEntry = entry->GetPermission(aType); // if the entry is expired, remove and keep looking for others. - if (permEntry.mExpireType == nsIPermissionManager::EXPIRE_TIME && + // Note that EXPIRE_SESSION only honors expireTime if it is nonzero. + if ((permEntry.mExpireType == nsIPermissionManager::EXPIRE_TIME || + (permEntry.mExpireType == nsIPermissionManager::EXPIRE_SESSION && + permEntry.mExpireTime != 0)) && permEntry.mExpireTime <= (PR_Now() / 1000)) { nsCOMPtr principal; if (NS_FAILED(GetPrincipal(aHost, aAppId, aIsInBrowserElement, getter_AddRefs(principal)))) { @@ -1375,6 +1382,7 @@ nsPermissionManager::RemoveExpiredPermissionsForAppEnumerator( permEntry.mPermission = permEntry.mNonSessionPermission; permEntry.mExpireType = permEntry.mNonSessionExpireType; + permEntry.mExpireTime = permEntry.mNonSessionExpireTime; gPermissionManager->NotifyObserversWithPermission(entry->GetKey()->mHost, entry->GetKey()->mAppId, diff --git a/extensions/cookie/nsPermissionManager.h b/extensions/cookie/nsPermissionManager.h index efb56e501eef..637da623c00a 100644 --- a/extensions/cookie/nsPermissionManager.h +++ b/extensions/cookie/nsPermissionManager.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ @@ -45,6 +45,7 @@ public: , mExpireTime(aExpireTime) , mNonSessionPermission(aPermission) , mNonSessionExpireType(aExpireType) + , mNonSessionExpireTime(aExpireTime) {} int64_t mID; @@ -54,6 +55,7 @@ public: int64_t mExpireTime; uint32_t mNonSessionPermission; uint32_t mNonSessionExpireType; + uint32_t mNonSessionExpireTime; }; /** diff --git a/extensions/cookie/test/unit/test_permmanager_expiration.js b/extensions/cookie/test/unit/test_permmanager_expiration.js index ac0750691cff..440f8a1dd3e0 100644 --- a/extensions/cookie/test/unit/test_permmanager_expiration.js +++ b/extensions/cookie/test/unit/test_permmanager_expiration.js @@ -27,29 +27,41 @@ function do_run_test() { // add a permission with *now* expiration pm.addFromPrincipal(principal, "test/expiration-perm-exp", 1, pm.EXPIRE_TIME, now); + pm.addFromPrincipal(principal, "test/expiration-session-exp", 1, pm.EXPIRE_SESSION, now); // add a permission with future expiration (100 milliseconds) pm.addFromPrincipal(principal, "test/expiration-perm-exp2", 1, pm.EXPIRE_TIME, now + 100); + pm.addFromPrincipal(principal, "test/expiration-session-exp2", 1, pm.EXPIRE_SESSION, now + 100); // add a permission with future expiration (1000 seconds) pm.addFromPrincipal(principal, "test/expiration-perm-exp3", 1, pm.EXPIRE_TIME, now + 1e6); + pm.addFromPrincipal(principal, "test/expiration-session-exp3", 1, pm.EXPIRE_SESSION, now + 1e6); // add a permission without expiration pm.addFromPrincipal(principal, "test/expiration-perm-nexp", 1, pm.EXPIRE_NEVER, 0); // check that the second two haven't expired yet do_check_eq(1, pm.testPermissionFromPrincipal(principal, "test/expiration-perm-exp3")); + do_check_eq(1, pm.testPermissionFromPrincipal(principal, "test/expiration-session-exp3")); do_check_eq(1, pm.testPermissionFromPrincipal(principal, "test/expiration-perm-nexp")); // ... and the first one has do_timeout(10, continue_test); yield; do_check_eq(0, pm.testPermissionFromPrincipal(principal, "test/expiration-perm-exp")); + do_check_eq(0, pm.testPermissionFromPrincipal(principal, "test/expiration-session-exp")); // ... and that the short-term one will do_timeout(200, continue_test); yield; - do_check_eq(0, pm.testPermissionFromPrincipal(principal, "test/expiration-perm-exp2")); + do_check_eq(0, pm.testPermissionFromPrincipal(principal, "test/expiration-perm-exp2")); + do_check_eq(0, pm.testPermissionFromPrincipal(principal, "test/expiration-session-exp2")); + + // Check that .getPermission returns a matching result + do_check_null(pm.getPermissionObject(principal, "test/expiration-perm-exp", false)); + do_check_null(pm.getPermissionObject(principal, "test/expiration-session-exp", false)); + do_check_null(pm.getPermissionObject(principal, "test/expiration-perm-exp2", false)); + do_check_null(pm.getPermissionObject(principal, "test/expiration-session-exp2", false)); do_finish_generator_test(test_generator); } diff --git a/netwerk/base/public/nsIPermissionManager.idl b/netwerk/base/public/nsIPermissionManager.idl index 9769dd54774b..31f621890293 100644 --- a/netwerk/base/public/nsIPermissionManager.idl +++ b/netwerk/base/public/nsIPermissionManager.idl @@ -55,7 +55,8 @@ interface nsIPermissionManager : nsISupports /** * Predefined expiration types for permissions. Permissions can be permanent * (never expire), expire at the end of the session, or expire at a specified - * time. + * time. Permissions that expire at the end of a session may also have a + * specified expiration time. */ const uint32_t EXPIRE_NEVER = 0; const uint32_t EXPIRE_SESSION = 1; From 05ffce93dbd14785416422ee3035cc856b5f8ba5 Mon Sep 17 00:00:00 2001 From: Joey Armstrong Date: Thu, 6 Jun 2013 16:29:57 -0400 Subject: [PATCH 22/93] bug 875549: move HOST_CSRCS to moz.build (logic) r=ted --- python/mozbuild/mozbuild/frontend/emitter.py | 1 + python/mozbuild/mozbuild/frontend/sandbox_symbols.py | 6 ++++++ .../mozbuild/test/backend/data/variable_passthru/moz.build | 2 ++ python/mozbuild/mozbuild/test/backend/test_recursivemake.py | 4 ++++ .../mozbuild/test/frontend/data/variable-passthru/moz.build | 2 ++ python/mozbuild/mozbuild/test/frontend/test_emitter.py | 1 + 6 files changed, 16 insertions(+) diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index f6327fede924..95bf40b064be 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -85,6 +85,7 @@ class TreeMetadataEmitter(object): CSRCS='CSRCS', DEFINES='DEFINES', EXTRA_COMPONENTS='EXTRA_COMPONENTS', + HOST_CSRCS='HOST_CSRCS', MODULE='MODULE', SIMPLE_PROGRAMS='SIMPLE_PROGRAMS', XPIDL_FLAGS='XPIDL_FLAGS', diff --git a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py index 83bd2b09ed72..68271da4178d 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py +++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py @@ -104,6 +104,12 @@ VARIABLES = { This variable contains a list of files to copy into $(FINAL_TARGET)/components/. """), + 'HOST_CSRCS': (StrictOrderingOnAppendList, list, [], + """C source files to compile with the host compiler. + + This variable contains a list of C source files to compile. + """), + 'PARALLEL_DIRS': (list, list, [], """A parallel version of DIRS. diff --git a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build index 073ff7868865..ac928e3c6aea 100644 --- a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build +++ b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build @@ -12,6 +12,8 @@ DEFINES = ['-Dbar', '-Dfoo'] EXTRA_COMPONENTS = ['bar.js', 'foo.js'] +HOST_CSRCS = ['bar.c', 'foo.c'] + SIMPLE_PROGRAMS = ['bar.x', 'foo.x'] CSRCS += ['bar.c', 'foo.c'] diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index 376e831e132a..01624d6fbffe 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -158,6 +158,10 @@ class TestRecursiveMakeBackend(BackendTester): 'EXTRA_COMPONENTS += bar.js', 'EXTRA_COMPONENTS += foo.js', ], + 'HOST_CSRCS': [ + 'HOST_CSRCS += bar.c', + 'HOST_CSRCS += foo.c', + ], 'SIMPLE_PROGRAMS': [ 'SIMPLE_PROGRAMS += bar.x', 'SIMPLE_PROGRAMS += foo.x', diff --git a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build index 59e0ceb3adc4..3e7576589070 100644 --- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build +++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build @@ -12,6 +12,8 @@ DEFINES=['-Dfans', '-Dtans'] EXTRA_COMPONENTS=['fans.js', 'tans.js'] +HOST_CSRCS += ['fans.c', 'tans.c'] + SIMPLE_PROGRAMS += ['fans.x', 'tans.x'] CSRCS += ['fans.c', 'tans.c'] diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 1b66c4555c48..b6ffe917cffa 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -130,6 +130,7 @@ class TestEmitterBasic(unittest.TestCase): CSRCS=['fans.c', 'tans.c'], DEFINES=['-Dfans', '-Dtans'], EXTRA_COMPONENTS=['fans.js', 'tans.js'], + HOST_CSRCS=['fans.c', 'tans.c'], SIMPLE_PROGRAMS=['fans.x', 'tans.x'], XPIDLSRCS=['bar.idl', 'biz.idl', 'foo.idl'], XPIDL_MODULE='module_name', From cb3aa2346e85542c358034c92dc88fb543f1a4e1 Mon Sep 17 00:00:00 2001 From: Sankha Narayan Guria Date: Wed, 5 Jun 2013 14:17:30 -0500 Subject: [PATCH 23/93] Bug 869996 - Implement Set.prototype.{keys, values, entries}. r=jorendorff. --HG-- extra : rebase_source : 6d978d49d2fb696162b1cef5b643a209a01a4711 --- js/src/builtin/MapObject.cpp | 99 ++++++++++++++++--- js/src/builtin/MapObject.h | 9 +- .../tests/collections/Map-surfaces-1.js | 6 ++ .../tests/collections/Map-surfaces-2.js | 3 + .../tests/collections/Set-surfaces-1.js | 6 ++ .../tests/collections/Set-surfaces-2.js | 3 + .../tests/collections/Set-values-1.js | 14 +++ .../tests/collections/Set-values-2.js | 18 ++++ 8 files changed, 143 insertions(+), 15 deletions(-) create mode 100644 js/src/jit-test/tests/collections/Set-values-1.js create mode 100644 js/src/jit-test/tests/collections/Set-values-2.js diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 081409cb06cc..53026da9b203 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -1041,8 +1041,6 @@ const JSFunctionSpec MapObject::methods[] = { JS_FN("delete", delete_, 1, 0), JS_FN("keys", keys, 0, 0), JS_FN("values", values, 0, 0), - JS_FN("entries", entries, 0, 0), - JS_FN("iterator", entries, 0, 0), JS_FN("clear", clear, 0, 0), JS_FS_END }; @@ -1071,7 +1069,20 @@ JSObject * MapObject::initClass(JSContext *cx, JSObject *obj) { Rooted global(cx, &obj->asGlobal()); - return InitClass(cx, global, &class_, JSProto_Map, construct, properties, methods); + RootedObject proto(cx, + InitClass(cx, global, &class_, JSProto_Map, construct, properties, methods)); + if (proto) { + // Define the "entries" method. + JSFunction *fun = JS_DefineFunction(cx, proto, "entries", entries, 0, 0); + if (!fun) + return NULL; + + // Define its alias. + RootedValue funval(cx, ObjectValue(*fun)); + if (!JS_DefineProperty(cx, proto, "iterator", funval, NULL, NULL, 0)) + return NULL; + } + return proto; } template @@ -1422,14 +1433,16 @@ js_InitMapClass(JSContext *cx, HandleObject obj) class js::SetIteratorObject : public JSObject { public: - enum { TargetSlot, RangeSlot, SlotCount }; + enum { TargetSlot, KindSlot, RangeSlot, SlotCount }; static const JSFunctionSpec methods[]; - static SetIteratorObject *create(JSContext *cx, HandleObject setobj, ValueSet *data); + static SetIteratorObject *create(JSContext *cx, HandleObject setobj, ValueSet *data, + SetObject::IteratorKind kind); static void finalize(FreeOp *fop, JSObject *obj); private: static inline bool is(const Value &v); inline ValueSet::Range *range(); + inline SetObject::IteratorKind kind() const; static bool next_impl(JSContext *cx, CallArgs args); static JSBool next(JSContext *cx, unsigned argc, Value *vp); }; @@ -1466,6 +1479,14 @@ SetIteratorObject::range() return static_cast(getSlot(RangeSlot).toPrivate()); } +inline SetObject::IteratorKind +SetIteratorObject::kind() const +{ + int32_t i = getSlot(KindSlot).toInt32(); + JS_ASSERT(i == SetObject::Values || i == SetObject::Entries); + return SetObject::IteratorKind(i); +} + bool GlobalObject::initSetIteratorProto(JSContext *cx, Handle global) { @@ -1483,7 +1504,8 @@ GlobalObject::initSetIteratorProto(JSContext *cx, Handle global) } SetIteratorObject * -SetIteratorObject::create(JSContext *cx, HandleObject setobj, ValueSet *data) +SetIteratorObject::create(JSContext *cx, HandleObject setobj, ValueSet *data, + SetObject::IteratorKind kind) { Rooted global(cx, &setobj->global()); Rooted proto(cx, global->getOrCreateSetIteratorPrototype(cx)); @@ -1500,6 +1522,7 @@ SetIteratorObject::create(JSContext *cx, HandleObject setobj, ValueSet *data) return NULL; } iterobj->setSlot(TargetSlot, ObjectValue(*setobj)); + iterobj->setSlot(KindSlot, Int32Value(int32_t(kind))); iterobj->setSlot(RangeSlot, PrivateValue(range)); return static_cast(iterobj); } @@ -1529,7 +1552,23 @@ SetIteratorObject::next_impl(JSContext *cx, CallArgs args) return js_ThrowStopIteration(cx); } - args.rval().set(range->front().get()); + switch (thisobj.kind()) { + case SetObject::Values: + args.rval().set(range->front().get()); + break; + + case SetObject::Entries: { + Value pair[2] = { range->front().get(), range->front().get() }; + AutoValueArray root(cx, pair, 2); + + JSObject *pairobj = NewDenseCopiedArray(cx, 2, pair); + if (!pairobj) + return false; + args.rval().setObject(*pairobj); + break; + } + } + range->popFront(); return true; } @@ -1579,7 +1618,7 @@ const JSFunctionSpec SetObject::methods[] = { JS_FN("has", has, 1, 0), JS_FN("add", add, 1, 0), JS_FN("delete", delete_, 1, 0), - JS_FN("iterator", iterator, 0, 0), + JS_FN("entries", entries, 0, 0), JS_FN("clear", clear, 0, 0), JS_FS_END }; @@ -1588,7 +1627,22 @@ JSObject * SetObject::initClass(JSContext *cx, JSObject *obj) { Rooted global(cx, &obj->asGlobal()); - return InitClass(cx, global, &class_, JSProto_Set, construct, properties, methods); + RootedObject proto(cx, + InitClass(cx, global, &class_, JSProto_Set, construct, properties, methods)); + if (proto) { + // Define the "values" method. + JSFunction *fun = JS_DefineFunction(cx, proto, "values", values, 0, 0); + if (!fun) + return NULL; + + // Define its aliases. + RootedValue funval(cx, ObjectValue(*fun)); + if (!JS_DefineProperty(cx, proto, "keys", funval, NULL, NULL, 0)) + return NULL; + if (!JS_DefineProperty(cx, proto, "iterator", funval, NULL, NULL, 0)) + return NULL; + } + return proto; } void @@ -1743,22 +1797,41 @@ SetObject::delete_(JSContext *cx, unsigned argc, Value *vp) } bool -SetObject::iterator_impl(JSContext *cx, CallArgs args) +SetObject::iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind) { Rooted setobj(cx, &args.thisv().toObject().asSet()); ValueSet &set = *setobj->getData(); - Rooted iterobj(cx, SetIteratorObject::create(cx, setobj, &set)); + Rooted iterobj(cx, SetIteratorObject::create(cx, setobj, &set, kind)); if (!iterobj) return false; args.rval().setObject(*iterobj); return true; } +bool +SetObject::values_impl(JSContext *cx, CallArgs args) +{ + return iterator_impl(cx, args, Values); +} + JSBool -SetObject::iterator(JSContext *cx, unsigned argc, Value *vp) +SetObject::values(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - return CallNonGenericMethod(cx, is, iterator_impl, args); + return CallNonGenericMethod(cx, is, values_impl, args); +} + +bool +SetObject::entries_impl(JSContext *cx, CallArgs args) +{ + return iterator_impl(cx, args, Entries); +} + +JSBool +SetObject::entries(JSContext *cx, unsigned argc, Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + return CallNonGenericMethod(cx, is, entries_impl, args); } bool diff --git a/js/src/builtin/MapObject.h b/js/src/builtin/MapObject.h index 07f19c66ca10..4e58975f61b5 100644 --- a/js/src/builtin/MapObject.h +++ b/js/src/builtin/MapObject.h @@ -127,6 +127,7 @@ class MapObject : public JSObject { class SetObject : public JSObject { public: + enum IteratorKind { Values, Entries }; static JSObject *initClass(JSContext *cx, JSObject *obj); static Class class_; private: @@ -140,6 +141,8 @@ class SetObject : public JSObject { static bool is(const Value &v); + static bool iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind); + static bool size_impl(JSContext *cx, CallArgs args); static JSBool size(JSContext *cx, unsigned argc, Value *vp); static bool has_impl(JSContext *cx, CallArgs args); @@ -148,8 +151,10 @@ class SetObject : public JSObject { static JSBool add(JSContext *cx, unsigned argc, Value *vp); static bool delete_impl(JSContext *cx, CallArgs args); static JSBool delete_(JSContext *cx, unsigned argc, Value *vp); - static bool iterator_impl(JSContext *cx, CallArgs args); - static JSBool iterator(JSContext *cx, unsigned argc, Value *vp); + static bool values_impl(JSContext *cx, CallArgs args); + static JSBool values(JSContext *cx, unsigned argc, Value *vp); + static bool entries_impl(JSContext *cx, CallArgs args); + static JSBool entries(JSContext *cx, unsigned argc, Value *vp); static bool clear_impl(JSContext *cx, CallArgs args); static JSBool clear(JSContext *cx, unsigned argc, Value *vp); }; diff --git a/js/src/jit-test/tests/collections/Map-surfaces-1.js b/js/src/jit-test/tests/collections/Map-surfaces-1.js index 2b620aeeb33c..fda71bccbbba 100644 --- a/js/src/jit-test/tests/collections/Map-surfaces-1.js +++ b/js/src/jit-test/tests/collections/Map-surfaces-1.js @@ -31,6 +31,9 @@ checkMethod("get", 1); checkMethod("has", 1); checkMethod("set", 2); checkMethod("delete", 1); +checkMethod("keys", 0); +checkMethod("values", 0); +checkMethod("entries", 0); var desc = Object.getOwnPropertyDescriptor(Map.prototype, "size"); assertEq(desc.enumerable, false); @@ -39,3 +42,6 @@ assertEq(typeof desc.get, 'function'); assertEq(desc.get.length, 0); assertEq(desc.set, undefined); checkMethod("clear", 0); + +// Map.prototype.iterator and .entries are the same function object. +assertEq(Map.prototype.iterator, Map.prototype.entries); diff --git a/js/src/jit-test/tests/collections/Map-surfaces-2.js b/js/src/jit-test/tests/collections/Map-surfaces-2.js index 78d27ac761df..5333f719de38 100644 --- a/js/src/jit-test/tests/collections/Map-surfaces-2.js +++ b/js/src/jit-test/tests/collections/Map-surfaces-2.js @@ -16,6 +16,9 @@ function test(obj) { testcase(obj, Map.prototype.set, "x", 1); testcase(obj, Map.prototype.delete, "x"); testcase(obj, Map.prototype.clear); + testcase(obj, Map.prototype.keys); + testcase(obj, Map.prototype.values); + testcase(obj, Map.prototype.entries); testcase(obj, Map_size_getter); } diff --git a/js/src/jit-test/tests/collections/Set-surfaces-1.js b/js/src/jit-test/tests/collections/Set-surfaces-1.js index fe44883d026b..094846eebfdc 100644 --- a/js/src/jit-test/tests/collections/Set-surfaces-1.js +++ b/js/src/jit-test/tests/collections/Set-surfaces-1.js @@ -30,6 +30,8 @@ function checkMethod(name, arity) { checkMethod("has", 1); checkMethod("add", 1); checkMethod("delete", 1); +checkMethod("values", 0); +checkMethod("entries", 0); var desc = Object.getOwnPropertyDescriptor(Set.prototype, "size"); assertEq(desc.enumerable, false); @@ -38,3 +40,7 @@ assertEq(typeof desc.get, 'function'); assertEq(desc.get.length, 0); assertEq(desc.set, undefined); checkMethod("clear", 0); + +// Set.prototype.keys, .values, and .iterator are the same function object +assertEq(Set.prototype.keys, Set.prototype.values); +assertEq(Set.prototype.iterator, Set.prototype.values); diff --git a/js/src/jit-test/tests/collections/Set-surfaces-2.js b/js/src/jit-test/tests/collections/Set-surfaces-2.js index 20ab6a32e6fa..3fc422c155cc 100644 --- a/js/src/jit-test/tests/collections/Set-surfaces-2.js +++ b/js/src/jit-test/tests/collections/Set-surfaces-2.js @@ -15,6 +15,9 @@ function test(obj) { testcase(obj, Set.prototype.add, 12); testcase(obj, Set.prototype.delete, 12); testcase(obj, Set.prototype.clear); + testcase(obj, Set.prototype.keys); + testcase(obj, Set.prototype.values); + testcase(obj, Set.prototype.entries); testcase(obj, Set_size_getter); } diff --git a/js/src/jit-test/tests/collections/Set-values-1.js b/js/src/jit-test/tests/collections/Set-values-1.js new file mode 100644 index 000000000000..bf437c6631d1 --- /dev/null +++ b/js/src/jit-test/tests/collections/Set-values-1.js @@ -0,0 +1,14 @@ +// set.keys(), .values(), and .entries() on an empty set produce empty iterators + +var s = Set(); +var ki = s.keys(), vi = s.values(), ei = s.entries(); +var p = Object.getPrototypeOf(ki); +assertEq(Object.getPrototypeOf(vi), p); +assertEq(Object.getPrototypeOf(ei), p); + +for (let k of ki) + throw "FAIL"; +for (let v of vi) + throw "FAIL"; +for (let [k, v] of ei) + throw "FAIL"; diff --git a/js/src/jit-test/tests/collections/Set-values-2.js b/js/src/jit-test/tests/collections/Set-values-2.js new file mode 100644 index 000000000000..c9304ff8f352 --- /dev/null +++ b/js/src/jit-test/tests/collections/Set-values-2.js @@ -0,0 +1,18 @@ +// set.keys() and set.values() return iterators over the elements +// and set.entries() returns an iterator that yields pairs [e, e]. + +load(libdir + "asserts.js"); + +var data = [1, 2, 3, 4]; +var s = Set(data); + +var ki = s.keys(); +assertEq(ki.next(), 1); +assertEq(ki.next(), 2); +assertEq(ki.next(), 3); +assertEq(ki.next(), 4); +assertThrowsValue(function () { ki.next(); }, StopIteration); + +assertEq([...s.keys()].toSource(), data.toSource()); +assertEq([...s.values()].toSource(), data.toSource()); +assertEq([...s.entries()].toSource(), [[1, 1], [2, 2], [3, 3], [4, 4]].toSource()); From 7b2aff4ced520665f41606220664a23ca179fd47 Mon Sep 17 00:00:00 2001 From: Sankha Narayan Guria Date: Wed, 5 Jun 2013 14:17:35 -0500 Subject: [PATCH 24/93] Bug 875433 - Array.prototype.iterator is the same function object as .values. r=jorendorff. --HG-- extra : rebase_source : 0b9b93bd796ba2c528b89c377b8aac922631ec98 --- .../tests/collections/Array-iterator-surfaces.js | 4 ++++ js/src/jsarray.cpp | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 js/src/jit-test/tests/collections/Array-iterator-surfaces.js diff --git a/js/src/jit-test/tests/collections/Array-iterator-surfaces.js b/js/src/jit-test/tests/collections/Array-iterator-surfaces.js new file mode 100644 index 000000000000..e4779ee581f7 --- /dev/null +++ b/js/src/jit-test/tests/collections/Array-iterator-surfaces.js @@ -0,0 +1,4 @@ +// Array.prototype.iterator is the same function object as .values. + +assertEq(Array.prototype.values, Array.prototype.iterator); +assertEq(Array.prototype.iterator.name, "values"); diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 34081ed7129d..cb0222d43840 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2671,7 +2671,7 @@ array_filter(JSContext *cx, unsigned argc, Value *vp) return false; if (ToBoolean(ag.rval())) { - if(!SetArrayElement(cx, arr, to, kValue)) + if (!SetArrayElement(cx, arr, to, kValue)) return false; to++; } @@ -2728,7 +2728,6 @@ static const JSFunctionSpec array_methods[] = { {"some", {NULL, NULL}, 1,0, "ArraySome"}, {"every", {NULL, NULL}, 1,0, "ArrayEvery"}, - JS_FN("iterator", JS_ArrayIterator, 0,0), JS_FS_END }; @@ -2847,6 +2846,14 @@ js_InitArrayClass(JSContext *cx, HandleObject obj) if (!DefineConstructorAndPrototype(cx, global, JSProto_Array, ctor, arrayProto)) return NULL; + JSFunction *fun = JS_DefineFunction(cx, arrayProto, "values", JS_ArrayIterator, 0, 0); + if (!fun) + return NULL; + + RootedValue funval(cx, ObjectValue(*fun)); + if (!JS_DefineProperty(cx, arrayProto, "iterator", funval, NULL, NULL, 0)) + return NULL; + return arrayProto; } From aafbec68cef574018e3b994bee59fcad669f0884 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Wed, 5 Jun 2013 14:17:43 -0500 Subject: [PATCH 25/93] Bug 877639 - Switch some code in frontend/FoldConstants.cpp from getOp() to getKind(). r=jwalden. --HG-- extra : rebase_source : 97c448dc52660fc0257d81730b1c07eb2b89df40 --- js/src/frontend/FoldConstants.cpp | 45 +++++++++---------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index a17f49cbc274..48b6f77d991f 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -203,39 +203,20 @@ enum Truthiness { Truthy, Falsy, Unknown }; static Truthiness Boolish(ParseNode *pn) { - switch (pn->getOp()) { - case JSOP_DOUBLE: + switch (pn->getKind()) { + case PNK_NUMBER: return (pn->pn_dval != 0 && !IsNaN(pn->pn_dval)) ? Truthy : Falsy; - case JSOP_STRING: + case PNK_STRING: return (pn->pn_atom->length() > 0) ? Truthy : Falsy; -#if JS_HAS_GENERATOR_EXPRS - case JSOP_CALL: - { - /* - * A generator expression as an if or loop condition has no effects, it - * simply results in a truthy object reference. This condition folding - * is needed for the decompiler. See bug 442342 and bug 443074. - */ - if (pn->pn_count != 1) - return Unknown; - ParseNode *pn2 = pn->pn_head; - if (!pn2->isKind(PNK_FUNCTION)) - return Unknown; - if (!(pn2->pn_funbox->inGenexpLambda)) - return Unknown; - return Truthy; - } -#endif - - case JSOP_DEFFUN: - case JSOP_LAMBDA: - case JSOP_TRUE: + case PNK_TRUE: + case PNK_FUNCTION: + case PNK_GENEXP: return Truthy; - case JSOP_NULL: - case JSOP_FALSE: + case PNK_FALSE: + case PNK_NULL: return Falsy; default: @@ -671,19 +652,19 @@ FoldConstants(JSContext *cx, ParseNode **pnp, /* Operate on one numeric constant. */ d = pn1->pn_dval; - switch (pn->getOp()) { - case JSOP_BITNOT: + switch (pn->getKind()) { + case PNK_BITNOT: d = ~ToInt32(d); break; - case JSOP_NEG: + case PNK_NEG: d = -d; break; - case JSOP_POS: + case PNK_POS: break; - case JSOP_NOT: + case PNK_NOT: if (d == 0 || IsNaN(d)) { pn->setKind(PNK_TRUE); pn->setOp(JSOP_TRUE); From 0bddaed1a5f44c70e6ab8f1258f39bd83dfe3872 Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Wed, 5 Jun 2013 14:17:43 -0500 Subject: [PATCH 26/93] Bug 858060 - Throw SyntaxError on module syntax. Fix bogus assertion. r=jorendorff. --HG-- extra : rebase_source : ea25ab9fa70ff070ab85a5d4187d9b7312817557 --- js/src/frontend/BytecodeEmitter.cpp | 5 +++++ js/src/frontend/FoldConstants.cpp | 5 ++++- js/src/frontend/NameFunctions.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 1c6730c80ad3..ee657dc30570 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -6027,6 +6027,11 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) JS_ASSERT(pn->getArity() == PN_NULLARY); break; + case PNK_MODULE: + // TODO: Add emitter support for modules + bce->reportError(NULL, JSMSG_SYNTAX_ERROR); + return false; + default: JS_ASSERT(0); } diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 48b6f77d991f..e873d30d5c1d 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -247,8 +247,11 @@ FoldConstants(JSContext *cx, ParseNode **pnp, switch (pn->getArity()) { case PN_CODE: - if (pn->pn_funbox->useAsmOrInsideUseAsm() && cx->hasOption(JSOPTION_ASMJS)) + if (pn->isKind(PNK_FUNCTION) && + pn->pn_funbox->useAsmOrInsideUseAsm() && cx->hasOption(JSOPTION_ASMJS)) + { return true; + } if (pn->getKind() == PNK_MODULE) { if (!FoldConstants(cx, &pn->pn_body, parser)) return false; diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index ca8534b6636b..b13a62ccfd24 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -316,7 +316,7 @@ class NameResolver resolve(cur->pn_kid3, prefix); break; case PN_CODE: - JS_ASSERT(cur->isKind(PNK_FUNCTION)); + JS_ASSERT(cur->isKind(PNK_MODULE) || cur->isKind(PNK_FUNCTION)); resolve(cur->pn_body, prefix); break; case PN_LIST: From e70bae405da674962e71505f3ca5c4146dd5d30b Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Thu, 16 May 2013 15:49:43 -0700 Subject: [PATCH 27/93] Bug 873356 - 'Should do shrinking GCs more often for workers'. r=khuey. --- b2g/app/b2g.js | 5 +- dom/workers/RuntimeService.cpp | 725 +++++++++++++++++++++++++------- dom/workers/RuntimeService.h | 83 ++-- dom/workers/WorkerPrivate.cpp | 242 ++++++----- dom/workers/WorkerPrivate.h | 58 ++- dom/workers/Workers.h | 124 +++++- modules/libpref/src/init/all.js | 3 - 7 files changed, 907 insertions(+), 333 deletions(-) diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 4aad384ed504..cffaf498fc10 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -552,10 +552,7 @@ pref("javascript.options.mem.gc_high_frequency_high_limit_mb", 40); pref("javascript.options.mem.gc_high_frequency_low_limit_mb", 10); pref("javascript.options.mem.gc_low_frequency_heap_growth", 120); pref("javascript.options.mem.high_water_mark", 6); -pref("javascript.options.mem.gc_allocation_threshold_mb", 3); - -// Allocation Threshold for workers -pref("dom.workers.mem.gc_allocation_threshold_mb", 3); +pref("javascript.options.mem.gc_allocation_threshold_mb", 1); // Show/Hide scrollbars when active/inactive pref("ui.showHideScrollbars", 1); diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index c3c6b3adfffc..14feb6632c75 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -4,8 +4,6 @@ * 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/Util.h" - #include "RuntimeService.h" #include "nsIContentSecurityPolicy.h" @@ -18,32 +16,32 @@ #include "nsISupportsPriority.h" #include "nsITimer.h" #include "nsPIDOMWindow.h" -#include "nsLayoutStatics.h" +#include +#include "GeckoProfiler.h" #include "jsdbgapi.h" #include "jsfriendapi.h" +#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/EventTargetBinding.h" +#include "mozilla/DebugOnly.h" #include "mozilla/Preferences.h" -#include "nsContentUtils.h" -#include "nsCxPusher.h" -#include "nsDOMJSUtils.h" +#include "mozilla/Util.h" #include +#include "nsContentUtils.h" +#include "nsDOMJSUtils.h" +#include "nsLayoutStatics.h" #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "nsXPCOM.h" #include "nsXPCOMPrivate.h" +#include "OSFileConstants.h" #include "xpcpublic.h" #include "Events.h" #include "Worker.h" #include "WorkerPrivate.h" -#include "OSFileConstants.h" -#include - -#include "GeckoProfiler.h" - using namespace mozilla; using namespace mozilla::dom; @@ -72,7 +70,8 @@ using mozilla::Preferences; MOZ_STATIC_ASSERT(MAX_WORKERS_PER_DOMAIN >= 1, "We should allow at least one worker per domain."); -// The default number of seconds that close handlers will be allowed to run. +// The default number of seconds that close handlers will be allowed to run for +// content workers. #define MAX_SCRIPT_RUN_TIME_SEC 10 // The number of seconds that idle threads can hang around before being killed. @@ -81,10 +80,12 @@ MOZ_STATIC_ASSERT(MAX_WORKERS_PER_DOMAIN >= 1, // The maximum number of threads that can be idle at one time. #define MAX_IDLE_THREADS 20 -#define PREF_WORKERS_ENABLED "dom.workers.enabled" -#define PREF_WORKERS_MAX_PER_DOMAIN "dom.workers.maxPerDomain" -#define PREF_WORKERS_GCZEAL "dom.workers.gczeal" -#define PREF_MAX_SCRIPT_RUN_TIME "dom.max_script_run_time" +#define PREF_WORKERS_PREFIX "dom.workers." +#define PREF_WORKERS_ENABLED PREF_WORKERS_PREFIX "enabled" +#define PREF_WORKERS_MAX_PER_DOMAIN PREF_WORKERS_PREFIX "maxPerDomain" + +#define PREF_MAX_SCRIPT_RUN_TIME_CONTENT "dom.max_script_run_time" +#define PREF_MAX_SCRIPT_RUN_TIME_CHROME "dom.max_chrome_script_run_time" #define GC_REQUEST_OBSERVER_TOPIC "child-gc-request" #define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure" @@ -109,6 +110,13 @@ MOZ_STATIC_ASSERT(MAX_WORKERS_PER_DOMAIN >= 1, } \ PR_END_MACRO +// Prefixes for observing preference changes. +#define PREF_JS_OPTIONS_PREFIX "javascript.options." +#define PREF_WORKERS_OPTIONS_PREFIX PREF_WORKERS_PREFIX "options." +#define PREF_MEM_OPTIONS_PREFIX "mem." +#define PREF_JIT_HARDENING "jit_hardening" +#define PREF_GCZEAL "gcZeal" + namespace { const uint32_t kNoIndex = uint32_t(-1); @@ -121,6 +129,9 @@ uint32_t gMaxWorkersPerDomain = MAX_WORKERS_PER_DOMAIN; // Does not hold an owning reference. RuntimeService* gRuntimeService = nullptr; +// Only non-null during the call to Init. +RuntimeService* gRuntimeServiceDuringInit = nullptr; + enum { ID_Worker = 0, ID_ChromeWorker, @@ -148,100 +159,428 @@ const char* gStringChars[] = { MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT, "gStringChars should have the right length."); -enum { - PREF_strict = 0, - PREF_werror, - PREF_typeinference, - PREF_jit_hardening, - PREF_mem_max, - PREF_baselinejit, - PREF_ion, - PREF_asmjs, - PREF_mem_gc_allocation_threshold_mb, - -#ifdef JS_GC_ZEAL - PREF_gczeal, -#endif - - PREF_COUNT +class LiteralRebindingCString : public nsDependentCString +{ +public: + template + void RebindLiteral(const char (&aStr)[N]) + { + Rebind(aStr, N-1); + } }; -#define JS_OPTIONS_DOT_STR "javascript.options." +template +struct PrefTraits; -const char* gPrefsToWatch[] = { - JS_OPTIONS_DOT_STR "strict", - JS_OPTIONS_DOT_STR "werror", - JS_OPTIONS_DOT_STR "typeinference", - JS_OPTIONS_DOT_STR "jit_hardening", - JS_OPTIONS_DOT_STR "mem.max", - JS_OPTIONS_DOT_STR "baselinejit.content", - JS_OPTIONS_DOT_STR "ion.content", - JS_OPTIONS_DOT_STR "asmjs", - "dom.workers.mem.gc_allocation_threshold_mb" +template <> +struct PrefTraits +{ + typedef bool PrefValueType; -#ifdef JS_GC_ZEAL - , PREF_WORKERS_GCZEAL -#endif + static const PrefValueType kDefaultValue = false; + + static inline PrefValueType + Get(const char* aPref) + { + AssertIsOnMainThread(); + return Preferences::GetBool(aPref); + } + + static inline bool + Exists(const char* aPref) + { + AssertIsOnMainThread(); + return Preferences::GetType(aPref) == nsIPrefBranch::PREF_BOOL; + } }; -MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gPrefsToWatch) == PREF_COUNT, - "gPrefsToWatch should have the right length."); +template <> +struct PrefTraits +{ + typedef int32_t PrefValueType; -int -PrefCallback(const char* aPrefName, void* aClosure) + static const PrefValueType kDefaultValue = 0; + + static inline PrefValueType + Get(const char* aPref) + { + AssertIsOnMainThread(); + return Preferences::GetInt(aPref); + } + + static inline bool + Exists(const char* aPref) + { + AssertIsOnMainThread(); + return Preferences::GetType(aPref) == nsIPrefBranch::PREF_INT; + } +}; + +template +T +GetWorkerPref(const nsACString& aPref, + const T aDefault = PrefTraits::kDefaultValue) { AssertIsOnMainThread(); - RuntimeService* rts = static_cast(aClosure); - NS_ASSERTION(rts, "This should never be null!"); + typedef PrefTraits PrefHelper; - NS_NAMED_LITERAL_CSTRING(jsOptionStr, JS_OPTIONS_DOT_STR); + T result; - if (!strcmp(aPrefName, gPrefsToWatch[PREF_mem_max])) { - int32_t pref = Preferences::GetInt(aPrefName, -1); - uint32_t maxBytes = (pref <= 0 || pref >= 0x1000) ? - uint32_t(-1) : - uint32_t(pref) * 1024 * 1024; - RuntimeService::SetDefaultJSWorkerMemoryParameter(JSGC_MAX_BYTES, maxBytes); - rts->UpdateAllWorkerMemoryParameter(JSGC_MAX_BYTES); - } else if (!strcmp(aPrefName, gPrefsToWatch[PREF_mem_gc_allocation_threshold_mb])) { - int32_t pref = Preferences::GetInt(aPrefName, 30); - uint32_t threshold = (pref <= 0 || pref >= 0x1000) ? - uint32_t(30) : - uint32_t(pref); - RuntimeService::SetDefaultJSWorkerMemoryParameter(JSGC_ALLOCATION_THRESHOLD, threshold); - rts->UpdateAllWorkerMemoryParameter(JSGC_ALLOCATION_THRESHOLD); - } else if (StringBeginsWith(nsDependentCString(aPrefName), jsOptionStr)) { - uint32_t newOptions = kRequiredJSContextOptions; - if (Preferences::GetBool(gPrefsToWatch[PREF_strict])) { - newOptions |= JSOPTION_STRICT; - } - if (Preferences::GetBool(gPrefsToWatch[PREF_werror])) { - newOptions |= JSOPTION_WERROR; - } - if (Preferences::GetBool(gPrefsToWatch[PREF_typeinference])) { - newOptions |= JSOPTION_TYPE_INFERENCE; - } - if (Preferences::GetBool(gPrefsToWatch[PREF_baselinejit])) { - newOptions |= JSOPTION_BASELINE; - } - if (Preferences::GetBool(gPrefsToWatch[PREF_ion])) { - newOptions |= JSOPTION_ION; - } - if (Preferences::GetBool(gPrefsToWatch[PREF_asmjs])) { - newOptions |= JSOPTION_ASMJS; - } + nsAutoCString prefName; + prefName.AssignLiteral(PREF_WORKERS_OPTIONS_PREFIX); + prefName.Append(aPref); - RuntimeService::SetDefaultJSContextOptions(newOptions); - rts->UpdateAllWorkerJSContextOptions(); + if (PrefHelper::Exists(prefName.get())) { + result = PrefHelper::Get(prefName.get()); } + else { + prefName.AssignLiteral(PREF_JS_OPTIONS_PREFIX); + prefName.Append(aPref); + + if (PrefHelper::Exists(prefName.get())) { + result = PrefHelper::Get(prefName.get()); + } + else { + result = aDefault; + } + } + + return result; +} + +int +LoadJSContextOptions(const char* aPrefName, void* /* aClosure */) +{ + AssertIsOnMainThread(); + + RuntimeService* rts = RuntimeService::GetService(); + if (!rts && !gRuntimeServiceDuringInit) { + // May be shutting down, just bail. + return 0; + } + + const nsDependentCString prefName(aPrefName); + + // Several other pref branches will get included here so bail out if there is + // another callback that will handle this change. + if (StringBeginsWith(prefName, + NS_LITERAL_CSTRING(PREF_JS_OPTIONS_PREFIX + PREF_MEM_OPTIONS_PREFIX)) || + StringBeginsWith(prefName, + NS_LITERAL_CSTRING(PREF_WORKERS_OPTIONS_PREFIX + PREF_MEM_OPTIONS_PREFIX)) || + prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_JIT_HARDENING) || + prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_JIT_HARDENING)) { + return 0; + } + #ifdef JS_GC_ZEAL - else if (!strcmp(aPrefName, gPrefsToWatch[PREF_gczeal])) { - int32_t gczeal = Preferences::GetInt(gPrefsToWatch[PREF_gczeal]); - RuntimeService::SetDefaultGCZeal(uint8_t(clamped(gczeal, 0, 3))); - rts->UpdateAllWorkerGCZeal(); + if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL) || + prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL)) { + return 0; } #endif + + // Common options. + uint32_t commonOptions = kRequiredJSContextOptions; + if (GetWorkerPref(NS_LITERAL_CSTRING("strict"))) { + commonOptions |= JSOPTION_STRICT; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("werror"))) { + commonOptions |= JSOPTION_WERROR; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("typeinference"))) { + commonOptions |= JSOPTION_TYPE_INFERENCE; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("asmjs"))) { + commonOptions |= JSOPTION_ASMJS; + } + + // Content options. + uint32_t contentOptions = commonOptions; + if (GetWorkerPref(NS_LITERAL_CSTRING("pccounts.content"))) { + contentOptions |= JSOPTION_PCCOUNT; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("baselinejit.content"))) { + contentOptions |= JSOPTION_BASELINE; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("ion.content"))) { + contentOptions |= JSOPTION_ION; + } + + // Chrome options. + uint32_t chromeOptions = commonOptions; + if (GetWorkerPref(NS_LITERAL_CSTRING("pccounts.chrome"))) { + chromeOptions |= JSOPTION_PCCOUNT; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("baselinejit.chrome"))) { + chromeOptions |= JSOPTION_BASELINE; + } + if (GetWorkerPref(NS_LITERAL_CSTRING("ion.chrome"))) { + chromeOptions |= JSOPTION_ION; + } +#ifdef DEBUG + if (GetWorkerPref(NS_LITERAL_CSTRING("strict.debug"))) { + chromeOptions |= JSOPTION_STRICT; + } +#endif + + RuntimeService::SetDefaultJSContextOptions(contentOptions, chromeOptions); + + if (rts) { + rts->UpdateAllWorkerJSContextOptions(); + } + + return 0; +} + +#ifdef JS_GC_ZEAL +int +LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */) +{ + AssertIsOnMainThread(); + + RuntimeService* rts = RuntimeService::GetService(); + if (!rts && !gRuntimeServiceDuringInit) { + // May be shutting down, just bail. + return 0; + } + + int32_t gczeal = GetWorkerPref(NS_LITERAL_CSTRING(PREF_GCZEAL), -1); + if (gczeal < 0) { + gczeal = 0; + } + + int32_t frequency = + GetWorkerPref(NS_LITERAL_CSTRING("gcZeal.frequency"), -1); + if (frequency < 0) { + frequency = JS_DEFAULT_ZEAL_FREQ; + } + + RuntimeService::SetDefaultGCZeal(uint8_t(gczeal), uint32_t(frequency)); + + if (rts) { + rts->UpdateAllWorkerGCZeal(); + } + + return 0; +} +#endif + +void +UpdateCommonJSGCMemoryOption(RuntimeService* aRuntimeService, + const nsACString& aPrefName, JSGCParamKey aKey) +{ + AssertIsOnMainThread(); + NS_ASSERTION(!aPrefName.IsEmpty(), "Empty pref name!"); + + int32_t prefValue = GetWorkerPref(aPrefName, -1); + uint32_t value = + (prefValue <= 0 || prefValue >= 10000) ? 0 : uint32_t(prefValue); + + RuntimeService::SetDefaultJSGCSettings(aKey, value); + + if (aRuntimeService) { + aRuntimeService->UpdateAllWorkerMemoryParameter(aKey, value); + } +} + +void +UpdatOtherJSGCMemoryOption(RuntimeService* aRuntimeService, + JSGCParamKey aKey, uint32_t aValue) +{ + AssertIsOnMainThread(); + + RuntimeService::SetDefaultJSGCSettings(aKey, aValue); + + if (aRuntimeService) { + aRuntimeService->UpdateAllWorkerMemoryParameter(aKey, aValue); + } +} + + +int +LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) +{ + AssertIsOnMainThread(); + + RuntimeService* rts = RuntimeService::GetService(); + + if (!rts && !gRuntimeServiceDuringInit) { + // May be shutting down, just bail. + return 0; + } + + NS_NAMED_LITERAL_CSTRING(jsPrefix, PREF_JS_OPTIONS_PREFIX); + NS_NAMED_LITERAL_CSTRING(workersPrefix, PREF_WORKERS_OPTIONS_PREFIX); + + const nsDependentCString fullPrefName(aPrefName); + + // Pull out the string that actually distinguishes the parameter we need to + // change. + nsDependentCSubstring memPrefName; + if (StringBeginsWith(fullPrefName, jsPrefix)) { + memPrefName.Rebind(fullPrefName, jsPrefix.Length()); + } + else if (StringBeginsWith(fullPrefName, workersPrefix)) { + memPrefName.Rebind(fullPrefName, workersPrefix.Length()); + } + else { + NS_ERROR("Unknown pref name!"); + return 0; + } + +#ifdef DEBUG + // During Init() we get called back with a branch string here, so there should + // be no just a "mem." pref here. + if (!rts) { + NS_ASSERTION(memPrefName.EqualsLiteral(PREF_MEM_OPTIONS_PREFIX), "Huh?!"); + } +#endif + + // If we're running in Init() then do this for every pref we care about. + // Otherwise we just want to update the parameter that changed. + for (uint32_t index = rts ? JSSettings::kGCSettingsArraySize - 1 : 0; + index < JSSettings::kGCSettingsArraySize; + index++) { + LiteralRebindingCString matchName; + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "max"); + if (memPrefName == matchName || (!rts && index == 0)) { + int32_t prefValue = GetWorkerPref(matchName, -1); + uint32_t value = (prefValue <= 0 || prefValue >= 0x1000) ? + uint32_t(-1) : + uint32_t(prefValue) * 1024 * 1024; + UpdatOtherJSGCMemoryOption(rts, JSGC_MAX_BYTES, value); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "high_water_mark"); + if (memPrefName == matchName || (!rts && index == 1)) { + int32_t prefValue = GetWorkerPref(matchName, 128); + UpdatOtherJSGCMemoryOption(rts, JSGC_MAX_MALLOC_BYTES, + uint32_t(prefValue) * 1024 * 1024); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_high_frequency_time_limit_ms"); + if (memPrefName == matchName || (!rts && index == 2)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_HIGH_FREQUENCY_TIME_LIMIT); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_low_frequency_heap_growth"); + if (memPrefName == matchName || (!rts && index == 3)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_LOW_FREQUENCY_HEAP_GROWTH); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_high_frequency_heap_growth_min"); + if (memPrefName == matchName || (!rts && index == 4)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_high_frequency_heap_growth_max"); + if (memPrefName == matchName || (!rts && index == 5)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_high_frequency_low_limit_mb"); + if (memPrefName == matchName || (!rts && index == 6)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_HIGH_FREQUENCY_LOW_LIMIT); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_high_frequency_high_limit_mb"); + if (memPrefName == matchName || (!rts && index == 7)) { + UpdateCommonJSGCMemoryOption(rts, matchName, + JSGC_HIGH_FREQUENCY_HIGH_LIMIT); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "analysis_purge_mb"); + if (memPrefName == matchName || (!rts && index == 8)) { + UpdateCommonJSGCMemoryOption(rts, matchName, JSGC_ANALYSIS_PURGE_TRIGGER); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX + "gc_allocation_threshold_mb"); + if (memPrefName == matchName || (!rts && index == 9)) { + UpdateCommonJSGCMemoryOption(rts, matchName, JSGC_ALLOCATION_THRESHOLD); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "gc_incremental_slice_ms"); + if (memPrefName == matchName || (!rts && index == 10)) { + int32_t prefValue = GetWorkerPref(matchName, -1); + uint32_t value = + (prefValue <= 0 || prefValue >= 100000) ? 0 : uint32_t(prefValue); + UpdatOtherJSGCMemoryOption(rts, JSGC_SLICE_TIME_BUDGET, value); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "gc_dynamic_heap_growth"); + if (memPrefName == matchName || (!rts && index == 11)) { + bool prefValue = GetWorkerPref(matchName, false); + UpdatOtherJSGCMemoryOption(rts, JSGC_DYNAMIC_HEAP_GROWTH, + prefValue ? 0 : 1); + continue; + } + + matchName.RebindLiteral(PREF_MEM_OPTIONS_PREFIX "gc_dynamic_mark_slice"); + if (memPrefName == matchName || (!rts && index == 12)) { + bool prefValue = GetWorkerPref(matchName, false); + UpdatOtherJSGCMemoryOption(rts, JSGC_DYNAMIC_MARK_SLICE, + prefValue ? 0 : 1); + continue; + } + +#ifdef DEBUG + nsAutoCString message("Workers don't support the 'mem."); + message.Append(memPrefName); + message.AppendLiteral("' preference!"); + NS_WARNING(message.get()); +#endif + } + + return 0; +} + +int +LoadJITHardeningOption(const char* /* aPrefName */, void* /* aClosure */) +{ + AssertIsOnMainThread(); + + RuntimeService* rts = RuntimeService::GetService(); + + if (!rts && !gRuntimeServiceDuringInit) { + // May be shutting down, just bail. + return 0; + } + + bool value = GetWorkerPref(NS_LITERAL_CSTRING(PREF_JIT_HARDENING), false); + + RuntimeService::SetDefaultJITHardening(value); + + if (rts) { + rts->UpdateAllWorkerJITHardening(value); + } + return 0; } @@ -422,17 +761,33 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate) // The number passed here doesn't matter, we're about to change it in the call // to JS_SetGCParameter. - JSRuntime* runtime = JS_NewRuntime(WORKER_DEFAULT_RUNTIME_HEAPSIZE, JS_NO_HELPER_THREADS); + JSRuntime* runtime = + JS_NewRuntime(WORKER_DEFAULT_RUNTIME_HEAPSIZE, JS_NO_HELPER_THREADS); if (!runtime) { NS_WARNING("Could not create new runtime!"); return nullptr; } + JSSettings settings; + aWorkerPrivate->CopyJSSettings(settings); + + NS_ASSERTION((settings.chrome.options & kRequiredJSContextOptions) == + kRequiredJSContextOptions, + "Somehow we lost our required chrome options!"); + NS_ASSERTION((settings.content.options & kRequiredJSContextOptions) == + kRequiredJSContextOptions, + "Somehow we lost our required content options!"); + + JSSettings::JSGCSettingsArray& gcSettings = settings.gcSettings; + // This is the real place where we set the max memory for the runtime. - JS_SetGCParameter(runtime, JSGC_MAX_BYTES, - aWorkerPrivate->GetJSRuntimeHeapSize()); - JS_SetGCParameter(runtime, JSGC_ALLOCATION_THRESHOLD, - aWorkerPrivate->GetJSWorkerAllocationThreshold()); + for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { + const JSSettings::JSGCSetting& setting = gcSettings[index]; + if (setting.IsSet()) { + NS_ASSERTION(setting.value, "Can't handle 0 values!"); + JS_SetGCParameter(runtime, setting.key, setting.value); + } + } JS_SetNativeStackQuota(runtime, WORKER_CONTEXT_NATIVE_STACK_LIMIT); @@ -464,19 +819,14 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate) js::SetCTypesActivityCallback(runtime, CTypesActivityCallback); - NS_ASSERTION((aWorkerPrivate->GetJSContextOptions() & - kRequiredJSContextOptions) == kRequiredJSContextOptions, - "Somehow we lost our required options!"); - JS_SetOptions(workerCx, aWorkerPrivate->GetJSContextOptions()); + JS_SetOptions(workerCx, + aWorkerPrivate->IsChromeWorker() ? settings.chrome.options : + settings.content.options); + + JS_SetJitHardening(runtime, settings.jitHardening); #ifdef JS_GC_ZEAL - { - uint8_t zeal = aWorkerPrivate->GetGCZeal(); - NS_ASSERTION(zeal <= 3, "Bad zeal value!"); - - uint32_t frequency = zeal <= 2 ? JS_DEFAULT_ZEAL_FREQ : 1; - JS_SetGCZeal(workerCx, zeal, frequency); - } + JS_SetGCZeal(workerCx, settings.gcZeal, settings.gcZealFrequency); #endif if (aWorkerPrivate->IsChromeWorker()) { @@ -707,19 +1057,8 @@ WorkerCrossThreadDispatcher::PostTask(WorkerTask* aTask) END_WORKERS_NAMESPACE -uint32_t RuntimeService::sDefaultJSContextOptions = kRequiredJSContextOptions; - -uint32_t RuntimeService::sDefaultJSRuntimeHeapSize = - WORKER_DEFAULT_RUNTIME_HEAPSIZE; - -uint32_t RuntimeService::sDefaultJSAllocationThreshold = - WORKER_DEFAULT_ALLOCATION_THRESHOLD; - -int32_t RuntimeService::sCloseHandlerTimeoutSeconds = MAX_SCRIPT_RUN_TIME_SEC; - -#ifdef JS_GC_ZEAL -uint8_t RuntimeService::sDefaultGCZeal = 0; -#endif +// This is only touched on the main thread. Initialized in Init() below. +JSSettings RuntimeService::sDefaultJSSettings; RuntimeService::RuntimeService() : mMutex("RuntimeService::mMutex"), mObserved(false), @@ -972,12 +1311,15 @@ RuntimeService::ScheduleWorker(JSContext* aCx, WorkerPrivate* aWorkerPrivate) JS_ReportError(aCx, "Could not create new thread!"); return false; } + } - nsCOMPtr priority = do_QueryInterface(thread); - if (!priority || - NS_FAILED(priority->SetPriority(nsISupportsPriority::PRIORITY_LOW))) { - NS_WARNING("Could not lower the new thread's priority!"); - } + int32_t priority = aWorkerPrivate->IsChromeWorker() ? + nsISupportsPriority::PRIORITY_NORMAL : + nsISupportsPriority::PRIORITY_LOW; + + nsCOMPtr threadPriority = do_QueryInterface(thread); + if (!threadPriority || NS_FAILED(threadPriority->SetPriority(priority))) { + NS_WARNING("Could not set the thread's priority!"); } #ifdef DEBUG @@ -1058,8 +1400,24 @@ nsresult RuntimeService::Init() { AssertIsOnMainThread(); + nsLayoutStatics::AddRef(); + // Initialize JSSettings. + if (!sDefaultJSSettings.gcSettings[0].IsSet()) { + sDefaultJSSettings.chrome.options = kRequiredJSContextOptions; + sDefaultJSSettings.chrome.maxScriptRuntime = -1; + sDefaultJSSettings.content.options = kRequiredJSContextOptions; + sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC; +#ifdef JS_GC_ZEAL + sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ; + sDefaultJSSettings.gcZeal = 0; +#endif + SetDefaultJSGCSettings(JSGC_MAX_BYTES, WORKER_DEFAULT_RUNTIME_HEAPSIZE); + SetDefaultJSGCSettings(JSGC_ALLOCATION_THRESHOLD, + WORKER_DEFAULT_ALLOCATION_THRESHOLD); + } + mIdleThreadTimer = do_CreateInstance(NS_TIMER_CONTRACTID); NS_ENSURE_STATE(mIdleThreadTimer); @@ -1084,21 +1442,59 @@ RuntimeService::Init() NS_WARNING("Failed to register for memory pressure notifications!"); } - for (uint32_t index = 0; index < ArrayLength(gPrefsToWatch); index++) { - if (NS_FAILED(Preferences::RegisterCallback(PrefCallback, - gPrefsToWatch[index], this))) { - NS_WARNING("Failed to register pref callback?!"); - } - PrefCallback(gPrefsToWatch[index], this); + NS_ASSERTION(!gRuntimeServiceDuringInit, "This should be null!"); + gRuntimeServiceDuringInit = this; + + if (NS_FAILED(Preferences::RegisterCallback( + LoadJSGCMemoryOptions, + PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::RegisterCallbackAndCall( + LoadJSGCMemoryOptions, + PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::RegisterCallback( + LoadJITHardeningOption, + PREF_JS_OPTIONS_PREFIX PREF_JIT_HARDENING, + nullptr)) || + NS_FAILED(Preferences::RegisterCallbackAndCall( + LoadJITHardeningOption, + PREF_WORKERS_OPTIONS_PREFIX PREF_JIT_HARDENING, + nullptr)) || +#ifdef JS_GC_ZEAL + NS_FAILED(Preferences::RegisterCallback( + LoadGCZealOptions, + PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, + nullptr)) || + NS_FAILED(Preferences::RegisterCallbackAndCall( + LoadGCZealOptions, + PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL, + nullptr)) || +#endif + NS_FAILED(Preferences::RegisterCallback(LoadJSContextOptions, + PREF_JS_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::RegisterCallbackAndCall( + LoadJSContextOptions, + PREF_WORKERS_OPTIONS_PREFIX, + nullptr))) { + NS_WARNING("Failed to register pref callbacks!"); } + NS_ASSERTION(gRuntimeServiceDuringInit == this, "Should be 'this'!"); + gRuntimeServiceDuringInit = nullptr; + // We assume atomic 32bit reads/writes. If this assumption doesn't hold on // some wacky platform then the worst that could happen is that the close // handler will run for a slightly different amount of time. - if (NS_FAILED(Preferences::AddIntVarCache(&sCloseHandlerTimeoutSeconds, - PREF_MAX_SCRIPT_RUN_TIME, - MAX_SCRIPT_RUN_TIME_SEC))) { - NS_WARNING("Failed to register timeout cache?!"); + if (NS_FAILED(Preferences::AddIntVarCache( + &sDefaultJSSettings.content.maxScriptRuntime, + PREF_MAX_SCRIPT_RUN_TIME_CONTENT, + MAX_SCRIPT_RUN_TIME_SEC)) || + NS_FAILED(Preferences::AddIntVarCache( + &sDefaultJSSettings.chrome.maxScriptRuntime, + PREF_MAX_SCRIPT_RUN_TIME_CHROME, -1))) { + NS_WARNING("Failed to register timeout cache!"); } int32_t maxPerDomain = Preferences::GetInt(PREF_WORKERS_MAX_PER_DOMAIN, @@ -1215,8 +1611,39 @@ RuntimeService::Cleanup() } if (mObserved) { - for (uint32_t index = 0; index < ArrayLength(gPrefsToWatch); index++) { - Preferences::UnregisterCallback(PrefCallback, gPrefsToWatch[index], this); + if (NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions, + PREF_JS_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::UnregisterCallback(LoadJSContextOptions, + PREF_WORKERS_OPTIONS_PREFIX, + nullptr)) || +#ifdef JS_GC_ZEAL + NS_FAILED(Preferences::UnregisterCallback( + LoadGCZealOptions, + PREF_JS_OPTIONS_PREFIX PREF_GCZEAL, + nullptr)) || + NS_FAILED(Preferences::UnregisterCallback( + LoadGCZealOptions, + PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL, + nullptr)) || +#endif + NS_FAILED(Preferences::UnregisterCallback( + LoadJSGCMemoryOptions, + PREF_JS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::UnregisterCallback( + LoadJSGCMemoryOptions, + PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX, + nullptr)) || + NS_FAILED(Preferences::UnregisterCallback( + LoadJITHardeningOption, + PREF_JS_OPTIONS_PREFIX PREF_JIT_HARDENING, + nullptr)) || + NS_FAILED(Preferences::UnregisterCallback( + LoadJITHardeningOption, + PREF_WORKERS_OPTIONS_PREFIX PREF_JIT_HARDENING, + nullptr))) { + NS_WARNING("Failed to unregister pref callbacks!"); } if (obs) { @@ -1387,25 +1814,33 @@ RuntimeService::NoteIdleThread(nsIThread* aThread) void RuntimeService::UpdateAllWorkerJSContextOptions() { - BROADCAST_ALL_WORKERS(UpdateJSContextOptions, GetDefaultJSContextOptions()); + BROADCAST_ALL_WORKERS(UpdateJSContextOptions, + sDefaultJSSettings.content.options, + sDefaultJSSettings.chrome.options); } void -RuntimeService::UpdateAllWorkerMemoryParameter(JSGCParamKey key) +RuntimeService::UpdateAllWorkerMemoryParameter(JSGCParamKey aKey, + uint32_t aValue) { - BROADCAST_ALL_WORKERS(UpdateJSWorkerMemoryParameter, - key, - GetDefaultJSWorkerMemoryParameter(key)); + BROADCAST_ALL_WORKERS(UpdateJSWorkerMemoryParameter, aKey, aValue); } #ifdef JS_GC_ZEAL void RuntimeService::UpdateAllWorkerGCZeal() { - BROADCAST_ALL_WORKERS(UpdateGCZeal, GetDefaultGCZeal()); + BROADCAST_ALL_WORKERS(UpdateGCZeal, sDefaultJSSettings.gcZeal, + sDefaultJSSettings.gcZealFrequency); } #endif +void +RuntimeService::UpdateAllWorkerJITHardening(bool aJITHardening) +{ + BROADCAST_ALL_WORKERS(UpdateJITHardening, aJITHardening); +} + void RuntimeService::GarbageCollectAllWorkers(bool aShrinking) { diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index 41229658bfb5..5bf62395d5af 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -12,6 +12,7 @@ #include "nsIObserver.h" #include "jsapi.h" +#include "mozilla/Attributes.h" #include "mozilla/Mutex.h" #include "mozilla/TimeStamp.h" #include "nsAutoPtr.h" @@ -20,7 +21,6 @@ #include "nsHashKeys.h" #include "nsStringGlue.h" #include "nsTArray.h" -#include "mozilla/Attributes.h" class nsIThread; class nsITimer; @@ -71,14 +71,7 @@ class RuntimeService MOZ_FINAL : public nsIObserver nsCString mDetectorName; nsCString mSystemCharset; - static uint32_t sDefaultJSContextOptions; - static uint32_t sDefaultJSRuntimeHeapSize; - static uint32_t sDefaultJSAllocationThreshold; - static int32_t sCloseHandlerTimeoutSeconds; - -#ifdef JS_GC_ZEAL - static uint8_t sDefaultGCZeal; -#endif + static JSSettings sDefaultJSSettings; public: struct NavigatorStrings @@ -143,81 +136,69 @@ public: void NoteIdleThread(nsIThread* aThread); - static uint32_t - GetDefaultJSContextOptions() + static void + GetDefaultJSSettings(JSSettings& aSettings) { AssertIsOnMainThread(); - return sDefaultJSContextOptions; + aSettings = sDefaultJSSettings; } static void - SetDefaultJSContextOptions(uint32_t aOptions) + SetDefaultJSContextOptions(uint32_t aContentOptions, uint32_t aChromeOptions) { AssertIsOnMainThread(); - sDefaultJSContextOptions = aOptions; + sDefaultJSSettings.content.options = aContentOptions; + sDefaultJSSettings.chrome.options = aChromeOptions; } void UpdateAllWorkerJSContextOptions(); - static uint32_t - GetDefaultJSWorkerMemoryParameter(JSGCParamKey aKey) - { - AssertIsOnMainThread(); - switch (aKey) { - case JSGC_ALLOCATION_THRESHOLD: - return sDefaultJSAllocationThreshold; - case JSGC_MAX_BYTES: - return sDefaultJSRuntimeHeapSize; - default: - MOZ_NOT_REACHED("Unknown Worker Memory Parameter."); - } - } - static void - SetDefaultJSWorkerMemoryParameter(JSGCParamKey aKey, uint32_t aValue) + SetDefaultJSGCSettings(JSGCParamKey aKey, uint32_t aValue) { AssertIsOnMainThread(); - switch(aKey) { - case JSGC_ALLOCATION_THRESHOLD: - sDefaultJSAllocationThreshold = aValue; - break; - case JSGC_MAX_BYTES: - sDefaultJSRuntimeHeapSize = aValue; - break; - default: - MOZ_NOT_REACHED("Unknown Worker Memory Parameter."); - } + sDefaultJSSettings.ApplyGCSetting(aKey, aValue); } void - UpdateAllWorkerMemoryParameter(JSGCParamKey aKey); + UpdateAllWorkerMemoryParameter(JSGCParamKey aKey, uint32_t aValue); static uint32_t - GetCloseHandlerTimeoutSeconds() + GetContentCloseHandlerTimeoutSeconds() { - return sCloseHandlerTimeoutSeconds > 0 ? sCloseHandlerTimeoutSeconds : 0; + return sDefaultJSSettings.content.maxScriptRuntime; + } + + static uint32_t + GetChromeCloseHandlerTimeoutSeconds() + { + return sDefaultJSSettings.chrome.maxScriptRuntime; } #ifdef JS_GC_ZEAL - static uint8_t - GetDefaultGCZeal() - { - AssertIsOnMainThread(); - return sDefaultGCZeal; - } - static void - SetDefaultGCZeal(uint8_t aGCZeal) + SetDefaultGCZeal(uint8_t aGCZeal, uint32_t aFrequency) { AssertIsOnMainThread(); - sDefaultGCZeal = aGCZeal; + sDefaultJSSettings.gcZeal = aGCZeal; + sDefaultJSSettings.gcZealFrequency = aFrequency; } void UpdateAllWorkerGCZeal(); #endif + static void + SetDefaultJITHardening(bool aJITHardening) + { + AssertIsOnMainThread(); + sDefaultJSSettings.jitHardening = aJITHardening; + } + + void + UpdateAllWorkerJITHardening(bool aJITHardening); + void GarbageCollectAllWorkers(bool aShrinking); diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index c9e755e5d1ca..2092a64928ad 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -26,11 +26,14 @@ #include "nsIXPCScriptNotify.h" #include "nsPrintfCString.h" +#include #include "jsfriendapi.h" #include "jsdbgapi.h" #include "jsfriendapi.h" #include "jsprf.h" #include "js/MemoryMetrics.h" +#include "mozilla/Attributes.h" +#include "mozilla/Likely.h" #include "nsAlgorithm.h" #include "nsContentUtils.h" #include "nsCxPusher.h" @@ -44,9 +47,6 @@ #include "nsSandboxFlags.h" #include "nsThreadUtils.h" #include "xpcpublic.h" -#include "mozilla/Attributes.h" -#include "mozilla/Likely.h" -#include #ifdef ANDROID #include @@ -63,10 +63,6 @@ #include "WorkerFeature.h" #include "WorkerScope.h" -#if 0 // Define to run GC more often. -#define EXTRA_GC -#endif - // GC will run once every thirty seconds during normal execution. #define NORMAL_GC_TIMER_DELAY_MS 30000 @@ -1308,19 +1304,22 @@ public: class UpdateJSContextOptionsRunnable : public WorkerControlRunnable { - uint32_t mOptions; + uint32_t mContentOptions; + uint32_t mChromeOptions; public: UpdateJSContextOptionsRunnable(WorkerPrivate* aWorkerPrivate, - uint32_t aOptions) + uint32_t aContentOptions, + uint32_t aChromeOptions) : WorkerControlRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount), - mOptions(aOptions) + mContentOptions(aContentOptions), mChromeOptions(aChromeOptions) { } bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) { - aWorkerPrivate->UpdateJSContextOptionsInternal(aCx, mOptions); + aWorkerPrivate->UpdateJSContextOptionsInternal(aCx, mContentOptions, + mChromeOptions); return true; } }; @@ -1350,23 +1349,43 @@ public: class UpdateGCZealRunnable : public WorkerControlRunnable { uint8_t mGCZeal; + uint32_t mFrequency; public: UpdateGCZealRunnable(WorkerPrivate* aWorkerPrivate, - uint8_t aGCZeal) + uint8_t aGCZeal, + uint32_t aFrequency) : WorkerControlRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount), - mGCZeal(aGCZeal) + mGCZeal(aGCZeal), mFrequency(aFrequency) { } bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) { - aWorkerPrivate->UpdateGCZealInternal(aCx, mGCZeal); + aWorkerPrivate->UpdateGCZealInternal(aCx, mGCZeal, mFrequency); return true; } }; #endif +class UpdateJITHardeningRunnable : public WorkerControlRunnable +{ + bool mJITHardening; + +public: + UpdateJITHardeningRunnable(WorkerPrivate* aWorkerPrivate, bool aJITHardening) + : WorkerControlRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount), + mJITHardening(aJITHardening) + { } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) + { + aWorkerPrivate->UpdateJITHardeningInternal(aCx, mJITHardening); + return true; + } +}; + class GarbageCollectRunnable : public WorkerControlRunnable { protected: @@ -1840,9 +1859,7 @@ WorkerPrivateParent::WorkerPrivateParent( mMemoryReportCondVar(mMutex, "WorkerPrivateParent Memory Report CondVar"), mJSObject(aObject), mParent(aParent), mParentJSContext(aParentJSContext), mScriptURL(aScriptURL), mDomain(aDomain), mBusyCount(0), - mParentStatus(Pending), mJSContextOptions(0), - mJSRuntimeHeapSize(0), mJSWorkerAllocationThreshold(3), - mGCZeal(0), mJSObjectRooted(false), mParentSuspended(false), + mParentStatus(Pending), mJSObjectRooted(false), mParentSuspended(false), mIsChromeWorker(aIsChromeWorker), mPrincipalIsSystem(false), mMainThreadObjectsForgotten(false), mEvalAllowed(aEvalAllowed), mReportCSPViolations(aReportCSPViolations) @@ -1864,32 +1881,17 @@ WorkerPrivateParent::WorkerPrivateParent( if (aParent) { aParent->AssertIsOnWorkerThread(); - NS_ASSERTION(JS_GetOptions(aCx) == aParent->GetJSContextOptions(), + aParent->CopyJSSettings(mJSSettings); + + NS_ASSERTION(JS_GetOptions(aCx) == (aParent->IsChromeWorker() ? + mJSSettings.chrome.options : + mJSSettings.content.options), "Options mismatch!"); - mJSContextOptions = aParent->GetJSContextOptions(); - - NS_ASSERTION(JS_GetGCParameter(JS_GetRuntime(aCx), JSGC_MAX_BYTES) == - aParent->GetJSRuntimeHeapSize(), - "Runtime heap size mismatch!"); - mJSRuntimeHeapSize = aParent->GetJSRuntimeHeapSize(); - - mJSWorkerAllocationThreshold = aParent->GetJSWorkerAllocationThreshold(); - -#ifdef JS_GC_ZEAL - mGCZeal = aParent->GetGCZeal(); -#endif } else { AssertIsOnMainThread(); - mJSContextOptions = RuntimeService::GetDefaultJSContextOptions(); - mJSRuntimeHeapSize = - RuntimeService::GetDefaultJSWorkerMemoryParameter(JSGC_MAX_BYTES); - mJSWorkerAllocationThreshold = - RuntimeService::GetDefaultJSWorkerMemoryParameter(JSGC_ALLOCATION_THRESHOLD); -#ifdef JS_GC_ZEAL - mGCZeal = RuntimeService::GetDefaultGCZeal(); -#endif + RuntimeService::GetDefaultJSSettings(mJSSettings); } } @@ -2250,14 +2252,20 @@ WorkerPrivateParent::GetInnerWindowId() template void WorkerPrivateParent::UpdateJSContextOptions(JSContext* aCx, - uint32_t aOptions) + uint32_t aContentOptions, + uint32_t aChromeOptions) { AssertIsOnParentThread(); - mJSContextOptions = aOptions; + { + MutexAutoLock lock(mMutex); + mJSSettings.content.options = aContentOptions; + mJSSettings.chrome.options = aChromeOptions; + } nsRefPtr runnable = - new UpdateJSContextOptionsRunnable(ParentAsWorkerPrivate(), aOptions); + new UpdateJSContextOptionsRunnable(ParentAsWorkerPrivate(), aContentOptions, + aChromeOptions); if (!runnable->Dispatch(aCx)) { NS_WARNING("Failed to update worker context options!"); JS_ClearPendingException(aCx); @@ -2271,38 +2279,41 @@ WorkerPrivateParent::UpdateJSWorkerMemoryParameter(JSContext* aCx, uint32_t aValue) { AssertIsOnParentThread(); - switch(aKey) { - case JSGC_ALLOCATION_THRESHOLD: - mJSWorkerAllocationThreshold = aValue; - break; - case JSGC_MAX_BYTES: - mJSRuntimeHeapSize = aValue; - break; - default: - break; + + bool found = false; + + { + MutexAutoLock lock(mMutex); + found = mJSSettings.ApplyGCSetting(aKey, aValue); } - nsRefPtr runnable = - new UpdateJSWorkerMemoryParameterRunnable(ParentAsWorkerPrivate(), - aKey, - aValue); - if (!runnable->Dispatch(aCx)) { - NS_WARNING("Failed to update memory parameter!"); - JS_ClearPendingException(aCx); + if (found) { + nsRefPtr runnable = + new UpdateJSWorkerMemoryParameterRunnable(ParentAsWorkerPrivate(), aKey, + aValue); + if (!runnable->Dispatch(aCx)) { + NS_WARNING("Failed to update memory parameter!"); + JS_ClearPendingException(aCx); + } } } #ifdef JS_GC_ZEAL template void -WorkerPrivateParent::UpdateGCZeal(JSContext* aCx, uint8_t aGCZeal) +WorkerPrivateParent::UpdateGCZeal(JSContext* aCx, uint8_t aGCZeal, + uint32_t aFrequency) { AssertIsOnParentThread(); - mGCZeal = aGCZeal; + { + MutexAutoLock lock(mMutex); + mJSSettings.gcZeal = aGCZeal; + mJSSettings.gcZealFrequency = aFrequency; + } nsRefPtr runnable = - new UpdateGCZealRunnable(ParentAsWorkerPrivate(), aGCZeal); + new UpdateGCZealRunnable(ParentAsWorkerPrivate(), aGCZeal, aFrequency); if (!runnable->Dispatch(aCx)) { NS_WARNING("Failed to update worker gczeal!"); JS_ClearPendingException(aCx); @@ -2310,6 +2321,26 @@ WorkerPrivateParent::UpdateGCZeal(JSContext* aCx, uint8_t aGCZeal) } #endif +template +void +WorkerPrivateParent::UpdateJITHardening(JSContext* aCx, + bool aJITHardening) +{ + AssertIsOnParentThread(); + + { + MutexAutoLock lock(mMutex); + mJSSettings.jitHardening = aJITHardening; + } + + nsRefPtr runnable = + new UpdateJITHardeningRunnable(ParentAsWorkerPrivate(), aJITHardening); + if (!runnable->Dispatch(aCx)) { + NS_WARNING("Failed to update worker jit hardening!"); + JS_ClearPendingException(aCx); + } +} + template void WorkerPrivateParent::GarbageCollect(JSContext* aCx, bool aShrinking) @@ -2792,11 +2823,6 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) } } -#ifdef EXTRA_GC - // Find GC bugs... - JS_GC(aCx); -#endif - // Keep track of whether or not this is the idle GC event. eventIsNotIdleGCEvent = event != idleGCEvent; @@ -2807,7 +2833,8 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) currentStatus = mStatus; scheduleIdleGC = mControlQueue.IsEmpty() && mQueue.IsEmpty() && - eventIsNotIdleGCEvent; + eventIsNotIdleGCEvent && + JS_GetGlobalForScopeChain(aCx); } // Take care of the GC timer. If we're starting the close sequence then we @@ -2823,6 +2850,12 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) } if (scheduleIdleGC) { + NS_ASSERTION(JS_GetGlobalForScopeChain(aCx), "Should have global here!"); + + // Now *might* be a good time to GC. Let the JS engine make the decision. + JSAutoCompartment ac(aCx, JS_GetGlobalForScopeChain(aCx)); + JS_MaybeGC(aCx); + if (NS_SUCCEEDED(gcTimer->SetTarget(idleGCEventTarget)) && NS_SUCCEEDED(gcTimer->InitWithFuncCallback( DummyCallback, nullptr, @@ -2834,11 +2867,6 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) } } -#ifdef EXTRA_GC - // Find GC bugs... - JS_GC(aCx); -#endif - if (currentStatus != Running && !HasActiveFeatures()) { // If the close handler has finished and all features are done then we can // kill this thread. @@ -3502,19 +3530,9 @@ WorkerPrivate::RunSyncLoop(JSContext* aCx, uint32_t aSyncLoopKey) } } -#ifdef EXTRA_GC - // Find GC bugs... - JS_GC(mJSContext); -#endif - static_cast(event)->Run(); NS_RELEASE(event); -#ifdef EXTRA_GC - // Find GC bugs... - JS_GC(mJSContext); -#endif - if (syncQueue->mComplete) { NS_ASSERTION(mSyncQueues.Length() - 1 == aSyncLoopKey, "Mismatched calls!"); @@ -3686,7 +3704,10 @@ WorkerPrivate::NotifyInternal(JSContext* aCx, Status aStatus) previousStatus == Terminating, "Bad previous status!"); - uint32_t killSeconds = RuntimeService::GetCloseHandlerTimeoutSeconds(); + uint32_t killSeconds = IsChromeWorker() ? + RuntimeService::GetChromeCloseHandlerTimeoutSeconds() : + RuntimeService::GetContentCloseHandlerTimeoutSeconds(); + if (killSeconds) { mKillTime = TimeStamp::Now() + TimeDuration::FromSeconds(killSeconds); @@ -4101,14 +4122,17 @@ WorkerPrivate::RescheduleTimeoutTimer(JSContext* aCx) } void -WorkerPrivate::UpdateJSContextOptionsInternal(JSContext* aCx, uint32_t aOptions) +WorkerPrivate::UpdateJSContextOptionsInternal(JSContext* aCx, + uint32_t aContentOptions, + uint32_t aChromeOptions) { AssertIsOnWorkerThread(); - JS_SetOptions(aCx, aOptions); + JS_SetOptions(aCx, IsChromeWorker() ? aChromeOptions : aContentOptions); for (uint32_t index = 0; index < mChildWorkers.Length(); index++) { - mChildWorkers[index]->UpdateJSContextOptions(aCx, aOptions); + mChildWorkers[index]->UpdateJSContextOptions(aCx, aContentOptions, + aChromeOptions); } } @@ -4118,7 +4142,14 @@ WorkerPrivate::UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, uint32_t aValue) { AssertIsOnWorkerThread(); - JS_SetGCParameter(JS_GetRuntime(aCx), aKey, aValue); + + // XXX aValue might be 0 here (telling us to unset a previous value for child + // workers). Calling JS_SetGCParameter with a value of 0 isn't actually + // supported though. We really need some way to revert to a default value + // here. + if (aValue) { + JS_SetGCParameter(JS_GetRuntime(aCx), aKey, aValue); + } for (uint32_t index = 0; index < mChildWorkers.Length(); index++) { mChildWorkers[index]->UpdateJSWorkerMemoryParameter(aCx, aKey, aValue); @@ -4127,32 +4158,53 @@ WorkerPrivate::UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, #ifdef JS_GC_ZEAL void -WorkerPrivate::UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal) +WorkerPrivate::UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal, + uint32_t aFrequency) { AssertIsOnWorkerThread(); - uint32_t frequency = aGCZeal <= 2 ? JS_DEFAULT_ZEAL_FREQ : 1; - JS_SetGCZeal(aCx, aGCZeal, frequency); + JS_SetGCZeal(aCx, aGCZeal, aFrequency); for (uint32_t index = 0; index < mChildWorkers.Length(); index++) { - mChildWorkers[index]->UpdateGCZeal(aCx, aGCZeal); + mChildWorkers[index]->UpdateGCZeal(aCx, aGCZeal, aFrequency); } } #endif +void +WorkerPrivate::UpdateJITHardeningInternal(JSContext* aCx, bool aJITHardening) +{ + AssertIsOnWorkerThread(); + + JS_SetJitHardening(JS_GetRuntime(aCx), aJITHardening); + + for (uint32_t index = 0; index < mChildWorkers.Length(); index++) { + mChildWorkers[index]->UpdateJITHardening(aCx, aJITHardening); + } +} + void WorkerPrivate::GarbageCollectInternal(JSContext* aCx, bool aShrinking, bool aCollectChildren) { AssertIsOnWorkerThread(); - JSRuntime *rt = JS_GetRuntime(aCx); - JS::PrepareForFullGC(rt); - if (aShrinking) { - JS::ShrinkingGC(rt, JS::gcreason::DOM_WORKER); + if (aCollectChildren) { + JSRuntime* rt = JS_GetRuntime(aCx); + JS::PrepareForFullGC(rt); + if (aShrinking) { + JS::ShrinkingGC(rt, JS::gcreason::DOM_WORKER); + } + else { + JS::GCForReason(rt, JS::gcreason::DOM_WORKER); + } } else { - JS::GCForReason(rt, JS::gcreason::DOM_WORKER); + // If aCollectChildren is false then it means this collection request was + // not generated by the main thread. At the moment only the periodic GC + // timer can end up here, so rather than force a collection let the JS + // engine decide if we need one. + JS_MaybeGC(aCx); } if (aCollectChildren) { diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index b9fdf60ac848..91bfe2cf30a0 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -42,7 +42,10 @@ class nsIURI; class nsPIDOMWindow; class nsITimer; class nsIXPCScriptNotify; -namespace JS { struct RuntimeStats; } + +namespace JS { +class RuntimeStats; +} BEGIN_WORKERS_NAMESPACE @@ -274,12 +277,11 @@ private: // Only used for top level workers. nsTArray > mQueuedRunnables; + // Protected by mMutex. + JSSettings mJSSettings; + uint64_t mBusyCount; Status mParentStatus; - uint32_t mJSContextOptions; - uint32_t mJSRuntimeHeapSize; - uint32_t mJSWorkerAllocationThreshold; - uint8_t mGCZeal; bool mJSObjectRooted; bool mParentSuspended; bool mIsChromeWorker; @@ -394,16 +396,21 @@ public: GetInnerWindowId(); void - UpdateJSContextOptions(JSContext* aCx, uint32_t aOptions); + UpdateJSContextOptions(JSContext* aCx, uint32_t aChromeOptions, + uint32_t aContentOptions); void - UpdateJSWorkerMemoryParameter(JSContext* aCx, JSGCParamKey key, uint32_t value); + UpdateJSWorkerMemoryParameter(JSContext* aCx, JSGCParamKey key, + uint32_t value); #ifdef JS_GC_ZEAL void - UpdateGCZeal(JSContext* aCx, uint8_t aGCZeal); + UpdateGCZeal(JSContext* aCx, uint8_t aGCZeal, uint32_t aFrequency); #endif + void + UpdateJITHardening(JSContext* aCx, bool aJITHardening); + void GarbageCollect(JSContext* aCx, bool aShrinking); @@ -580,32 +587,13 @@ public: return mLocationInfo; } - uint32_t - GetJSContextOptions() const + void + CopyJSSettings(JSSettings& aSettings) { - return mJSContextOptions; + mozilla::MutexAutoLock lock(mMutex); + aSettings = mJSSettings; } - uint32_t - GetJSRuntimeHeapSize() const - { - return mJSRuntimeHeapSize; - } - - uint32_t - GetJSWorkerAllocationThreshold() const - { - return mJSWorkerAllocationThreshold; - } - -#ifdef JS_GC_ZEAL - uint8_t - GetGCZeal() const - { - return mGCZeal; - } -#endif - bool IsChromeWorker() const { @@ -818,7 +806,8 @@ public: } void - UpdateJSContextOptionsInternal(JSContext* aCx, uint32_t aOptions); + UpdateJSContextOptionsInternal(JSContext* aCx, uint32_t aContentOptions, + uint32_t aChromeOptions); void UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, JSGCParamKey key, uint32_t aValue); @@ -843,9 +832,12 @@ public: #ifdef JS_GC_ZEAL void - UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal); + UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal, uint32_t aFrequency); #endif + void + UpdateJITHardeningInternal(JSContext* aCx, bool aJITHardening); + void GarbageCollectInternal(JSContext* aCx, bool aShrinking, bool aCollectChildren); diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index 9da38428efd0..1d1e5f46e4d8 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -43,10 +43,130 @@ AssertIsOnMainThread() { } #endif +struct JSSettings +{ + enum { + // All the GC parameters that we support. + JSSettings_JSGC_MAX_BYTES = 0, + JSSettings_JSGC_MAX_MALLOC_BYTES, + JSSettings_JSGC_HIGH_FREQUENCY_TIME_LIMIT, + JSSettings_JSGC_LOW_FREQUENCY_HEAP_GROWTH, + JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MIN, + JSSettings_JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX, + JSSettings_JSGC_HIGH_FREQUENCY_LOW_LIMIT, + JSSettings_JSGC_HIGH_FREQUENCY_HIGH_LIMIT, + JSSettings_JSGC_ANALYSIS_PURGE_TRIGGER, + JSSettings_JSGC_ALLOCATION_THRESHOLD, + JSSettings_JSGC_SLICE_TIME_BUDGET, + JSSettings_JSGC_DYNAMIC_HEAP_GROWTH, + JSSettings_JSGC_DYNAMIC_MARK_SLICE, + // JSGC_MODE not supported + + // This must be last so that we get an accurate count. + kGCSettingsArraySize + }; + + struct JSGCSetting + { + JSGCParamKey key; + uint32_t value; + + JSGCSetting() + : key(static_cast(-1)), value(0) + { } + + bool + IsSet() const + { + return key != static_cast(-1); + } + + void + Unset() + { + key = static_cast(-1); + value = 0; + } + }; + + // There are several settings that we know we need so it makes sense to + // preallocate here. + typedef JSGCSetting JSGCSettingsArray[kGCSettingsArraySize]; + + // Settings that change based on chrome/content context. + struct JSContentChromeSettings + { + uint32_t options; + int32_t maxScriptRuntime; + + JSContentChromeSettings() + : options(0), maxScriptRuntime(0) + { } + }; + + JSContentChromeSettings chrome; + JSContentChromeSettings content; + JSGCSettingsArray gcSettings; + bool jitHardening; +#ifdef JS_GC_ZEAL + uint8_t gcZeal; + uint32_t gcZealFrequency; +#endif + + JSSettings() + : jitHardening(false) +#ifdef JS_GC_ZEAL + , gcZeal(0), gcZealFrequency(0) +#endif + { + for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { + new (gcSettings + index) JSGCSetting(); + } + } + + bool + ApplyGCSetting(JSGCParamKey aKey, uint32_t aValue) + { + JSSettings::JSGCSetting* firstEmptySetting = nullptr; + JSSettings::JSGCSetting* foundSetting = nullptr; + + for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) { + JSSettings::JSGCSetting& setting = gcSettings[index]; + if (setting.key == aKey) { + foundSetting = &setting; + break; + } + if (!firstEmptySetting && !setting.IsSet()) { + firstEmptySetting = &setting; + } + } + + if (aValue) { + if (!foundSetting) { + foundSetting = firstEmptySetting; + if (!foundSetting) { + NS_ERROR("Not enough space for this value!"); + return false; + } + } + foundSetting->key = aKey; + foundSetting->value = aValue; + return true; + } + + if (foundSetting) { + foundSetting->Unset(); + return true; + } + + return false; + } +}; + // All of these are implemented in RuntimeService.cpp JSBool -ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, unsigned aFlags, - JS::MutableHandle aObjp); +ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, + unsigned aFlags, JS::MutableHandle aObjp); void CancelWorkersForWindow(JSContext* aCx, nsPIDOMWindow* aWindow); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index abfc9da4f9d2..98eb62f3cf3e 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -760,9 +760,6 @@ pref("dom.forms.color", false); // Enables system messages and activities pref("dom.sysmsg.enabled", false); -// Allocation Threshold for Workers -pref("dom.workers.mem.gc_allocation_threshold_mb", 30); - // Parsing perf prefs. For now just mimic what the old code did. #ifndef XP_WIN pref("content.sink.pending_event_mode", 0); From 836ca84173584da45fac34c8662a878cbb7b5c55 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 6 Jun 2013 13:54:04 -0700 Subject: [PATCH 28/93] Bug 880019 - MakeCurrent before readback in mozGetAsFile. - r=bjacob --- content/canvas/src/WebGLContext.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 4969083f5a70..7ab24c1dbf7e 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -621,6 +621,7 @@ WebGLContext::Render(gfxContext *ctx, gfxPattern::GraphicsFilter f, uint32_t aFl if (surf->CairoStatus() != 0) return NS_ERROR_FAILURE; + gl->MakeCurrent(); gl->ReadScreenIntoImageSurface(surf); bool srcPremultAlpha = mOptions.premultipliedAlpha; From 6228c4cf3f8e562544c720a14be13aaa4b1c436b Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 6 Jun 2013 13:56:12 -0700 Subject: [PATCH 29/93] Bug 878365 - Fallback to Basic ShSurf as needed, not permanently. - r=bjacob --- gfx/gl/GLScreenBuffer.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index a269309d19cd..584fc16b54d6 100644 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -385,18 +385,14 @@ GLScreenBuffer::Swap(const gfxIntSize& size) { SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size); if (!nextSurf) { - SurfaceFactory_GL* basicFactory = - new SurfaceFactory_Basic(mGL, mFactory->Caps()); - nextSurf = mStream->SwapProducer(basicFactory, size); - if (!nextSurf) { - delete basicFactory; - return false; - } + SurfaceFactory_Basic basicFactory(mGL, mFactory->Caps()); + nextSurf = mStream->SwapProducer(&basicFactory, size); + if (!nextSurf) + return false; - // Swap out the apparently defective old factory. - delete mFactory; - mFactory = basicFactory; + NS_WARNING("SwapProd failed for sophisticated Factory type, fell back to Basic."); } + MOZ_ASSERT(nextSurf); Attach(nextSurf, size); From 5f68b7e0b1551985ff489a1960df9371165fa9be Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Thu, 6 Jun 2013 13:56:15 -0700 Subject: [PATCH 30/93] Bug 876721 - Allow for failing during creation of ANGLE ShSurf. - r=bjbas --- gfx/gl/SharedSurfaceANGLE.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gfx/gl/SharedSurfaceANGLE.cpp b/gfx/gl/SharedSurfaceANGLE.cpp index eea5bce043e7..c3bfb739427b 100644 --- a/gfx/gl/SharedSurfaceANGLE.cpp +++ b/gfx/gl/SharedSurfaceANGLE.cpp @@ -232,14 +232,18 @@ SharedSurface_ANGLEShareHandle::Create(GLContext* gl, ID3D10Device1* d3d, // Ok, we have a valid PBuffer with ShareHandle. // Let's attach it to D3D. hr = d3d->OpenSharedResource(shareHandle, - __uuidof(ID3D10Texture2D), - getter_AddRefs(texture)); - if (FAILED(hr)) + __uuidof(ID3D10Texture2D), + getter_AddRefs(texture)); + if (FAILED(hr)) { + NS_ERROR("Failed to open shared resource!"); goto CleanUpIfFailed; + } hr = d3d->CreateShaderResourceView(texture, nullptr, getter_AddRefs(srv)); - if (FAILED(hr)) + if (FAILED(hr)) { + NS_ERROR("Failed to create SRV!"); goto CleanUpIfFailed; + } failed = false; @@ -247,7 +251,6 @@ CleanUpIfFailed: if (failed) { NS_WARNING("CleanUpIfFailed"); egl->fDestroySurface(egl->Display(), pbuffer); - MOZ_CRASH(); return nullptr; } From f26f472d40e8417d76fe502b811afb38403ee5d9 Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 16 May 2013 18:41:46 -0500 Subject: [PATCH 31/93] Bug 784519 - Part 3: Send Signaling State from SIPCC to PeerConnection r=ekr --- dom/media/PeerConnection.js | 59 +++- dom/media/bridge/IPeerConnection.idl | 11 + media/webrtc/signaling/include/CC_CallInfo.h | 16 ++ media/webrtc/signaling/signaling.gyp | 1 + .../src/peerconnection/PeerConnectionImpl.cpp | 53 +++- .../src/peerconnection/PeerConnectionImpl.h | 16 ++ .../peerconnection/PeerConnectionMedia.cpp | 3 +- .../src/sipcc/core/ccapp/CCProvider.h | 2 + .../src/sipcc/core/ccapp/ccapi_call_info.c | 19 ++ .../src/sipcc/core/ccapp/ccprovider.c | 23 +- .../signaling/src/sipcc/core/common/ui.c | 115 +++++--- .../signaling/src/sipcc/core/gsm/fsmdef.c | 269 +++++++++--------- .../signaling/src/sipcc/core/gsm/gsm_sdp.c | 2 +- .../signaling/src/sipcc/core/gsm/h/fsm.h | 34 +-- .../src/sipcc/core/includes/sessionTypes.h | 1 + .../signaling/src/sipcc/core/includes/uiapi.h | 8 + .../src/sipcc/include/ccapi_call_info.h | 8 + .../src/sipcc/include/fsmdef_states.h | 44 +++ .../src/softphonewrapper/CC_SIPCCCallInfo.cpp | 11 + .../src/softphonewrapper/CC_SIPCCCallInfo.h | 2 + 20 files changed, 471 insertions(+), 226 deletions(-) create mode 100644 media/webrtc/signaling/src/sipcc/include/fsmdef_states.h diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 6c2527bd4f21..d002e7eb1c38 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -765,10 +765,29 @@ RTCPeerConnection.prototype = { sdp: sdp }); }, - get signalingState() { return "stable"; }, // not yet implemented get iceGatheringState() { return this._iceGatheringState; }, get iceConnectionState() { return this._iceConnectionState; }, + // Corresponds to constants in IPeerConnection.idl + _signalingStateMap: [ + 'invalid', + 'stable', + 'have-local-offer', + 'have-remote-offer', + 'have-local-pranswer', + 'have-remote-pranswer', + 'closed' + ], + + get signalingState() { + // checking for our local pc closed indication + // before invoking the pc methods. + if(this._closed) { + return "closed"; + } + return this._signalingStateMap[this._getPC().signalingState]; + }, + changeIceGatheringState: function(state) { this._iceGatheringState = state; }, @@ -990,14 +1009,10 @@ PeerConnectionObserver.prototype = { this._dompc._executeNext(); }, - onStateChange: function(state) { - if (state != Ci.IPeerConnectionObserver.kIceState) { - return; - } - - switch (this._dompc._pc.iceState) { + handleIceStateChanges: function(iceState) { + switch (iceState) { case Ci.IPeerConnection.kIceWaiting: - this._dompc.changeIceConnectionState("completed"); + this._dompc.changeIceConnectionState("new"); this.callCB(this._dompc.ongatheringchange, "complete"); this.callCB(this._onicechange, "starting"); // Now that the PC is ready to go, execute any pending operations. @@ -1021,7 +1036,33 @@ PeerConnectionObserver.prototype = { this.callCB(this._onicechange, "failed"); break; default: - // Unknown state! + // Unknown ICE state! + this._dompc.reportWarning("Unhandled ice state: " + iceState, null, 0); + break; + } + }, + + onStateChange: function(state) { + switch (state) { + case Ci.IPeerConnectionObserver.kSignalingState: + this.callCB(this._dompc.onsignalingstatechange, + this._dompc.signalingState); + break; + + case Ci.IPeerConnectionObserver.kIceState: + this.handleIceStateChanges(this._dompc._pc.iceState); + break; + + case Ci.IPeerConnectionObserver.kSdpState: + // No-op + break; + + case Ci.IPeerConnectionObserver.kSipccState: + // No-op + break; + + default: + this._dompc.reportWarning("Unhandled state type: " + state, null, 0); break; } }, diff --git a/dom/media/bridge/IPeerConnection.idl b/dom/media/bridge/IPeerConnection.idl index b90bc2c42d21..b6c4e21ca5ee 100644 --- a/dom/media/bridge/IPeerConnection.idl +++ b/dom/media/bridge/IPeerConnection.idl @@ -32,6 +32,7 @@ interface IPeerConnectionObserver : nsISupports const long kIceState = 0x2; const long kSdpState = 0x3; const long kSipccState = 0x4; + const long kSignalingState = 0x5; /* JSEP callbacks */ void onCreateOfferSuccess(in string offer); @@ -91,6 +92,15 @@ interface IPeerConnection : nsISupports const long kClosing = 3; const long kClosed = 4; + /* RTCSignalingState from WebRTC spec */ + const long kSignalingInvalid = 0; + const long kSignalingStable = 1; + const long kSignalingHaveLocalOffer = 2; + const long kSignalingHaveRemoteOffer = 3; + const long kSignalingHaveLocalPranswer = 4; + const long kSignalingHaveRemotePranswer = 5; + const long kSignalingClosed = 6; + /* for 'type' in DataChannelInit dictionary */ const unsigned short kDataChannelReliable = 0; const unsigned short kDataChannelPartialReliableRexmit = 1; @@ -144,6 +154,7 @@ interface IPeerConnection : nsISupports readonly attribute unsigned long iceState; readonly attribute unsigned long readyState; + readonly attribute unsigned long signalingState; readonly attribute unsigned long sipccState; /* Data channels */ diff --git a/media/webrtc/signaling/include/CC_CallInfo.h b/media/webrtc/signaling/include/CC_CallInfo.h index f6b04fc1b37d..3a9137048538 100644 --- a/media/webrtc/signaling/include/CC_CallInfo.h +++ b/media/webrtc/signaling/include/CC_CallInfo.h @@ -9,12 +9,14 @@ extern "C" { #include "ccapi_types.h" +#include "fsmdef_states.h" } #include "CC_Common.h" #include "CC_CallTypes.h" #include "peer_connection_types.h" + namespace CSF { @@ -43,6 +45,13 @@ namespace CSF */ virtual cc_call_state_t getCallState () = 0; + /** + get FSM state + @param [in] handle - call info handle + @return FSM state + */ + virtual fsmdef_states_t getFsmState () const = 0; + /** print Call state @param [in] handle - call info handle @@ -50,6 +59,13 @@ namespace CSF */ virtual std::string callStateToString (cc_call_state_t state) = 0; + /** + print FSM state + @param [in] handle - call info handle + @return call state as string + */ + virtual std::string fsmStateToString (fsmdef_states_t state) const = 0; + /** print Call event @param [in] call event diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index 7ac4b485bd44..34dbc0f0ce7e 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -387,6 +387,7 @@ './src/sipcc/core/includes/dns_utils.h', './src/sipcc/core/includes/dtmf.h', './src/sipcc/core/includes/embedded.h', + './src/sipcc/core/includes/fsmdef_states.h', './src/sipcc/core/includes/intelpentiumtypes.h', './src/sipcc/core/includes/kpml_common_util.h', './src/sipcc/core/includes/kpmlmap.h', diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index b20034faffcd..0df10c668032 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -129,7 +129,9 @@ public: mReason(aInfo->getStatus()), mSdpStr(), mCallState(aInfo->getCallState()), - mStateStr(aInfo->callStateToString(mCallState)) { + mFsmState(aInfo->getFsmState()), + mStateStr(aInfo->callStateToString(mCallState)), + mFsmStateStr(aInfo->fsmStateToString(mFsmState)) { if (mCallState == REMOTESTREAMADD) { MediaStreamTable *streams = NULL; streams = aInfo->getMediaStreams(); @@ -173,7 +175,8 @@ public: NS_IMETHOD Run() { CSFLogInfo(logTag, "PeerConnectionObserverDispatch processing " - "mCallState = %d (%s)", mCallState, mStateStr.c_str()); + "mCallState = %d (%s), mFsmState = %d (%s)", + mCallState, mStateStr.c_str(), mFsmState, mFsmStateStr.c_str()); if (mCallState == SETLOCALDESCERROR || mCallState == SETREMOTEDESCERROR) { const std::vector &errors = mPC->GetSdpParseErrors(); @@ -192,6 +195,23 @@ public: mCode, mReason.c_str()); } + /* + * While the fsm_states_t (FSM_DEF_*) constants are a proper superset + * of SignalingState, and the order in which the SignalingState values + * appear matches the order they appear in fsm_states_t, their underlying + * numeric representation is different. Hence, we need to perform an + * offset calculation to map from one to the other. + */ + + if (mFsmState >= FSMDEF_S_STABLE && mFsmState <= FSMDEF_S_CLOSED) { + int offset = FSMDEF_S_STABLE - PeerConnectionImpl::kSignalingStable; + mPC->SetSignalingState_m( + static_cast(mFsmState - offset)); + } else { + CSFLogError(logTag, ": **** UNHANDLED SIGNALING STATE : %d (%s)", + mFsmState, mFsmStateStr.c_str()); + } + switch (mCallState) { case CREATEOFFERSUCCESS: mObserver->OnCreateOfferSuccess(mSdpStr.c_str()); @@ -290,7 +310,9 @@ private: std::string mReason; std::string mSdpStr; cc_call_state_t mCallState; + fsmdef_states_t mFsmState; std::string mStateStr; + std::string mFsmStateStr; nsRefPtr mRemoteStream; }; @@ -300,6 +322,7 @@ PeerConnectionImpl::PeerConnectionImpl() : mRole(kRoleUnknown) , mCall(NULL) , mReadyState(kNew) + , mSignalingState(kSignalingStable) , mIceState(kIceGathering) , mPCObserver(NULL) , mWindow(NULL) @@ -1209,6 +1232,16 @@ PeerConnectionImpl::GetReadyState(uint32_t* aState) return NS_OK; } +NS_IMETHODIMP +PeerConnectionImpl::GetSignalingState(uint32_t* aState) +{ + PC_AUTO_ENTER_API_CALL_NO_CHECK(); + MOZ_ASSERT(aState); + + *aState = mSignalingState; + return NS_OK; +} + NS_IMETHODIMP PeerConnectionImpl::GetSipccState(uint32_t* aState) { @@ -1375,6 +1408,22 @@ PeerConnectionImpl::ChangeReadyState(PeerConnectionImpl::ReadyState aReadyState) NS_DISPATCH_NORMAL); } +void +PeerConnectionImpl::SetSignalingState_m(SignalingState aSignalingState) +{ + PC_AUTO_ENTER_API_CALL_NO_CHECK(); + if (mSignalingState == aSignalingState) { + return; + } + + mSignalingState = aSignalingState; + nsCOMPtr pco = do_QueryReferent(mPCObserver); + if (!pco) { + return; + } + pco->OnStateChange(IPeerConnectionObserver::kSignalingState); +} + PeerConnectionWrapper::PeerConnectionWrapper(const std::string& handle) : impl_(nullptr) { if (PeerConnectionCtx::GetInstance()->mPeerConnections.find(handle) == diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 3d66a304e0e3..5c23a826a9fb 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -133,6 +133,18 @@ public: kClosed }; + /* Must match constants in IPeerConnection.idl */ + /* Must also be int the same order as in fsmdef_states.h */ + enum SignalingState { + kSignalingInvalid = 0, + kSignalingStable = 1, + kSignalingHaveLocalOffer = 2, + kSignalingHaveRemoteOffer = 3, + kSignalingHaveLocalPranswer = 4, + kSignalingHaveRemotePranswer = 5, + kSignalingClosed = 6 + }; + enum SipccState { kIdle, kStarting, @@ -268,6 +280,9 @@ public: // Called to retreive the list of parsing errors. const std::vector &GetSdpParseErrors(); + // Sets the RTC Signaling State + void SetSignalingState_m(SignalingState aSignalingState); + private: PeerConnectionImpl(const PeerConnectionImpl&rhs); PeerConnectionImpl& operator=(PeerConnectionImpl); @@ -315,6 +330,7 @@ private: // The call CSF::CC_CallPtr mCall; ReadyState mReadyState; + SignalingState mSignalingState; // ICE State IceState mIceState; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index 0016765fa1aa..cb63fd2bbf2d 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -396,7 +396,8 @@ PeerConnectionMedia::AddRemoteStream(nsRefPtr aInfo, nsresult PeerConnectionMedia::AddRemoteStreamHint(int aIndex, bool aIsVideo) { - if (aIndex >= mRemoteSourceStreams.Length()) { + if (aIndex < 0 || + static_cast(aIndex) >= mRemoteSourceStreams.Length()) { return NS_ERROR_ILLEGAL_VALUE; } diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h index e55247e8eea4..bd87aa77c97b 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h @@ -16,6 +16,7 @@ #include "cpr_threads.h" #include "phone_types.h" #include "session.h" +#include "fsmdef_states.h" #include "cc_constants.h" #include "ccapi_types.h" @@ -60,6 +61,7 @@ typedef struct cc_call_info_t_{ callid_t id; uint16_t inst; cc_call_state_t state; + fsmdef_states_t fsm_state; cc_call_attr_t attr; cc_call_type_t type; cc_call_security_t security; diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c index d9773ac802a6..11b63510bc3e 100644 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c @@ -47,6 +47,25 @@ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle){ return ONHOOK; } +/** + * get FSM state + * @param handle - call handle + * @return call state + */ +fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle){ + session_data_t *data = (session_data_t *)handle; + CCAPP_DEBUG(DEB_F_PREFIX"Entering", + DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__)); + + if ( data ){ + CCAPP_DEBUG(DEB_F_PREFIX"returned %02X", + DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), data->state); + return data->fsm_state; + } + + return FSMDEF_S_IDLE; +} + /** * get call attributes * @param handle - call handle diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c index 924a7f1cc1c5..78484ef34588 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c @@ -1416,7 +1416,9 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) //Populate the session hash data the first time. memset(data, 0, sizeof(session_data_t)); data->sess_id = sessUpd->sessionID; - data->state = call_state; + data->state = call_state; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; if (sessUpd->eventID == CALL_NEWCALL || sessUpd->eventID == CREATE_OFFER || @@ -1506,8 +1508,12 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) if (createdSessionData == FALSE) { return; } - data->state = sessUpd->update.ccSessionUpd.data.state_data.state; - data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->state = + sessUpd->update.ccSessionUpd.data.state_data.state; + data->line = + sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; break; default: break; @@ -1572,6 +1578,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) data->state = sessUpd->update.ccSessionUpd.data.state_data.state; } data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; sessUpd->update.ccSessionUpd.data.state_data.attr = data->attr; sessUpd->update.ccSessionUpd.data.state_data.inst = data->inst; @@ -1629,8 +1637,10 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) ccsnap_gen_callEvent(CCAPI_CALL_EV_GCID, CREATE_CALL_HANDLE_FROM_SESSION_ID(sessUpd->sessionID)); break; case CALL_NEWCALL: - data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->state = sessUpd->update.ccSessionUpd.data.state_data.state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->attr = sessUpd->update.ccSessionUpd.data.state_data.attr; data->inst = sessUpd->update.ccSessionUpd.data.state_data.inst; return; @@ -1802,6 +1812,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) case REMOTE_STREAM_ADD: data->cause = sessUpd->update.ccSessionUpd.data.state_data.cause; data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->media_stream_track_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_track_id; data->media_stream_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_id; strlib_free(data->status); @@ -2155,7 +2167,8 @@ void ccappFeatureUpdated (feature_update_t *featUpd) { break; case DEVICE_FEATURE_MWILAMP: - g_deviceInfo.mwi_lamp = featUpd->update.ccFeatUpd.data.state_data.state; + g_deviceInfo.mwi_lamp = + featUpd->update.ccFeatUpd.data.mwi_status.status; ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_MWI_LAMP, CC_DEVICE_ID); break; case DEVICE_FEATURE_BLF: diff --git a/media/webrtc/signaling/src/sipcc/core/common/ui.c b/media/webrtc/signaling/src/sipcc/core/common/ui.c index 5d6e34eb243c..6faa7ec7baab 100755 --- a/media/webrtc/signaling/src/sipcc/core/common/ui.c +++ b/media/webrtc/signaling/src/sipcc/core/common/ui.c @@ -737,7 +737,7 @@ ui_change_mwi_lamp (int status) msg.sessionType = SESSIONTYPE_CALLCONTROL; msg.featureID = DEVICE_FEATURE_MWILAMP; - msg.update.ccFeatUpd.data.state_data.state = status; + msg.update.ccFeatUpd.data.mwi_status.status = status; if ( ccappTaskPostMsg(CCAPP_FEATURE_UPDATE, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) { CCAPP_ERROR(CCAPP_F_PREFIX"failed to send DEVICE_FEATURE_MWILAMP(%d) msg", __FUNCTION__, status); @@ -1544,20 +1544,20 @@ ui_control_feature (line_t line_id, callid_t call_id, } /* - * Helper for the following four functions which all load up a + * Helper for the following several functions which all load up a * session_update message and post it. * */ -static void post_message_helper( - group_call_event_t eventId, - call_events event, - line_t nLine, - callid_t nCallId, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, - va_list args) +static void post_message_helper(group_call_event_t eventId, + call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallId, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, + va_list args) { flex_string fs; session_update_t msg; @@ -1572,6 +1572,7 @@ static void post_message_helper( msg.eventID = eventId; msg.update.ccSessionUpd.data.state_data.state = event; + msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.sdp = sdp; @@ -1602,9 +1603,14 @@ static void post_message_helper( * * @return none */ -void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_create_offer(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; @@ -1614,8 +1620,8 @@ void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, va_start(ap, format); - post_message_helper(CREATE_OFFER, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(CREATE_OFFER, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1627,17 +1633,22 @@ void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, * * @return none */ -void ui_create_answer(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_create_answer(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(CREATE_ANSWER, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(CREATE_ANSWER, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1649,17 +1660,22 @@ void ui_create_answer(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_set_local_description(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_set_local_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_LOCAL_DESC, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(SET_LOCAL_DESC, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1671,9 +1687,13 @@ void ui_set_local_description(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_set_remote_description(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, - string_t sdp, pc_error error, +void ui_set_remote_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, const char *format, ...) { va_list ap; @@ -1681,7 +1701,7 @@ void ui_set_remote_description(call_events event, line_t nLine, DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_REMOTE_DESC, event, nLine, nCallID, + post_message_helper(SET_REMOTE_DESC, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1694,9 +1714,13 @@ void ui_set_remote_description(call_events event, line_t nLine, * @return none */ -void ui_update_local_description(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, - string_t sdp, pc_error error, +void ui_update_local_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, const char *format, ...) { va_list ap; @@ -1705,7 +1729,7 @@ void ui_update_local_description(call_events event, line_t nLine, event, call_instance_id); va_start(ap, format); - post_message_helper(UPDATE_LOCAL_DESC, event, nLine, nCallID, + post_message_helper(UPDATE_LOCAL_DESC, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1718,16 +1742,21 @@ void ui_update_local_description(call_events event, line_t nLine, * @return none */ -void ui_ice_candidate_add(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_ice_candidate_add(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(ICE_CANDIDATE_ADD, event, nLine, nCallID, + post_message_helper(ICE_CANDIDATE_ADD, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); } @@ -1738,8 +1767,11 @@ void ui_ice_candidate_add(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_on_remote_stream_added(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, +void ui_on_remote_stream_added(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, cc_media_remote_track_table_t media_track) { session_update_t msg; @@ -1759,6 +1791,7 @@ void ui_on_remote_stream_added(call_events event, line_t nLine, msg.eventID = REMOTE_STREAM_ADD; msg.update.ccSessionUpd.data.state_data.state = event; + msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.media_stream_track_id = media_track.track[0].media_stream_track_id; diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c index 7e829e91ec46..fbdd9d5da105 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c @@ -747,36 +747,6 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, -/* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */ - { - /* CC_MSG_SETUP */ fsmdef_ev_default, - /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, - /* CC_MSG_PROCEEDING */ fsmdef_ev_default, - /* CC_MSG_ALERTING */ fsmdef_ev_default, - /* CC_MSG_CONNECTED */ fsmdef_ev_default, - /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, - /* CC_MSG_RELEASE */ fsmdef_ev_default, - /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, - /* CC_MSG_FEATURE */ fsmdef_ev_default, - /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, - /* CC_MSG_OFFHOOK */ fsmdef_ev_default, - /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, - /* CC_MSG_LINE */ fsmdef_ev_default, - /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, - /* CC_MSG_DIGIT_END */ fsmdef_ev_default, - /* CC_MSG_DIALSTRING */ fsmdef_ev_default, - /* CC_MSG_MWI */ fsmdef_ev_default, - /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, - /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, - /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, - /* CC_MSG_SETLOCALDESC */ fsmdef_ev_default, /* Should not happen */ - /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_setremotedesc, - /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, - /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, - /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, - /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate - }, - /* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -807,6 +777,36 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, +/* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */ + { + /* CC_MSG_SETUP */ fsmdef_ev_default, + /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, + /* CC_MSG_PROCEEDING */ fsmdef_ev_default, + /* CC_MSG_ALERTING */ fsmdef_ev_default, + /* CC_MSG_CONNECTED */ fsmdef_ev_default, + /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, + /* CC_MSG_RELEASE */ fsmdef_ev_default, + /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, + /* CC_MSG_FEATURE */ fsmdef_ev_default, + /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, + /* CC_MSG_OFFHOOK */ fsmdef_ev_default, + /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, + /* CC_MSG_LINE */ fsmdef_ev_default, + /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, + /* CC_MSG_DIGIT_END */ fsmdef_ev_default, + /* CC_MSG_DIALSTRING */ fsmdef_ev_default, + /* CC_MSG_MWI */ fsmdef_ev_default, + /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, + /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, + /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, + /* CC_MSG_SETLOCALDESC */ fsmdef_ev_default, /* Should not happen */ + /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_setremotedesc, + /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, + /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, + /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, + /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate + }, + /* FSMDEF_S_CLOSED --------------------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -2416,38 +2416,39 @@ fsmdef_ev_default (sm_event_t *event) */ switch (event->event) { case CC_MSG_CREATEOFFER: - ui_create_offer(evCreateOfferError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_offer(evCreateOfferError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_CREATEANSWER: - ui_create_answer(evCreateAnswerError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_answer(evCreateAnswerError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_SETLOCALDESC: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local description in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_SETREMOTEDESC: - ui_set_remote_description(evSetRemoteDescError, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), - PC_INVALID_STATE, "Cannot set remote description in state %s", - fsmdef_state_name(event->state)); + ui_set_remote_description(evSetRemoteDescError, fcb->state, + msg->line, msg->call_id, dcb->caller_id.call_instance_id, + strlib_empty(), PC_INVALID_STATE, + "Cannot set remote description in state %s", + fsmdef_state_name(fcb->state)); break; case CC_MSG_ADDCANDIDATE: - ui_ice_candidate_add(evAddIceCandidateError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add ICE candidate in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_ADDSTREAM: @@ -2458,7 +2459,7 @@ fsmdef_ev_default (sm_event_t *event) * getting through anyway. */ FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Cannot add or remove streams " "in state %s", DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, - msg->call_id, __FUNCTION__), fsmdef_state_name(event->state)); + msg->call_id, __FUNCTION__), fsmdef_state_name(fcb->state)); break; default: @@ -3150,14 +3151,14 @@ fsmdef_ev_createoffer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for offer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_offer(evCreateOfferSuccess, line, call_id, + ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3179,7 +3180,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { } if (!has_stream) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create SDP without any streams."); return SM_RC_END; @@ -3189,7 +3190,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Failed to get ICE parameters for local SDP"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3221,7 +3222,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, FALSE, TRUE, TRUE, TRUE, TRUE); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3231,7 +3232,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3242,7 +3243,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass offer SDP back to UI */ - ui_create_offer(evCreateOfferSuccess, line, call_id, + ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3305,14 +3306,14 @@ fsmdef_ev_createanswer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for answer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_answer(evCreateAnswerSuccess, line, call_id, + ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3331,7 +3332,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not get ICE parameters for answer"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3373,7 +3374,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { */ cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for answer;" " cause = %s", cc_cause_name(cause)); @@ -3392,7 +3393,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { /* create_answer */ TRUE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); @@ -3401,7 +3402,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode SDP for answer; cause = %s", cc_cause_name(cause)); @@ -3412,7 +3413,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass SDP back to UI */ - ui_create_answer(evCreateAnswerSuccess, line, call_id, + ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3448,25 +3449,25 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_local_description(evSetLocalDescError, line, call_id, + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - ui_set_local_description(evSetLocalDescError, line, call_id, + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } if (!dcb->sdp) { - ui_set_local_description(evSetLocalDescError, line, call_id, + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Setting of local SDP before calling " "createOffer or createAnswer is not currently supported."); @@ -3476,12 +3477,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (event->state != FSMDEF_S_STABLE && - event->state != FSMDEF_S_HAVE_LOCAL_OFFER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_STABLE && + fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3489,12 +3490,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && - event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && + fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3509,8 +3510,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3525,8 +3526,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb->dsp_out_of_resources == TRUE) { cc_call_state(fcb->dcb->call_id, fcb->dcb->line, CC_STATE_UNKNOWN, NULL); - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Cannot start media channels; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3539,21 +3540,21 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && - event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && + fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local pranswer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3562,16 +3563,16 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { /* Encode the current local SDP structure into a char buffer */ local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for local " "description"); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescSuccess, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), - PC_NO_ERROR, NULL); + ui_set_local_description(evSetLocalDescSuccess, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, + strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); return (SM_RC_END); @@ -3609,20 +3610,20 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_remote_description(evSetRemoteDescError, line, call_id, - 0, strlib_empty(), - PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, 0, strlib_empty(), + PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } @@ -3632,8 +3633,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb->sdp && dcb->sdp->dest_sdp) { FSM_DEBUG_SM(DEB_F_PREFIX"Renegotiation not currently supported.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Renegotiation of session description is not " "currently supported. See Bug 840728 for status."); return (SM_RC_END); @@ -3661,18 +3662,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (event->state != FSMDEF_S_STABLE && - event->state != FSMDEF_S_HAVE_REMOTE_OFFER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_STABLE && + fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } cause = gsmsdp_process_offer_sdp(fcb, &msg_body, TRUE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not process offer SDP; " "cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3692,8 +3693,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP; cause = %s", cc_cause_name(cause)); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); @@ -3704,8 +3705,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_negotiate_media_lines(fcb, dcb->sdp, TRUE, TRUE, TRUE, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); return (fsmdef_release(fcb, cause, FALSE)); @@ -3717,18 +3718,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && - event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && + fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } cause = gsmsdp_negotiate_answer_sdp(fcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate answer SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3740,8 +3741,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3759,21 +3760,21 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && - event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && + fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote pranswer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3788,14 +3789,14 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize remote description;" " cause = %s", cc_cause_name(cause)); return (SM_RC_END); } - ui_set_remote_description(evSetRemoteDescSuccess, line, call_id, + ui_set_remote_description(evSetRemoteDescSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); @@ -3979,14 +3980,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { if (!dcb) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "DCB has not been created."); return SM_RC_CLEANUP; } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (sdpmode == FALSE) { - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); @@ -3998,7 +3999,7 @@ fsmdef_ev_addcandidate(sm_event_t *event) { "remote description been set yet?\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add remote ICE candidates before " "setting remote SDP."); @@ -4045,14 +4046,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize new SDP after adding ICE " "candidate."); return (SM_RC_END); } - ui_ice_candidate_add(evAddIceCandidate, line, call_id, + ui_ice_candidate_add(evAddIceCandidate, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c index f133920f81c3..1efc95922428 100644 --- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c @@ -4749,7 +4749,7 @@ gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial TODO(adam@nostrum.com): Figure out how to notify when streams gain tracks */ ui_on_remote_stream_added(evOnRemoteStreamAdd, - dcb_p->line, dcb_p->call_id, + fcb_p->state, dcb_p->line, dcb_p->call_id, dcb_p->caller_id.call_instance_id, dcb_p->remote_media_stream_tbl->streams[j]); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h index 9752cc8f68d6..85a72abbedca 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h +++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h @@ -13,6 +13,7 @@ #include "sll_lite.h" #include "sessionConstants.h" #include "ccsdp.h" +#include "fsmdef_states.h" /* TODO: BLASBERG * fsm.h only needs the following from ccsip_core.h @@ -65,39 +66,6 @@ typedef enum { FSMDEF_CALL_TYPE_MAX } fsmdef_call_types_t; -typedef enum { - FSMDEF_S_MIN = -1, - - FSMDEF_S_IDLE, - - /* SIP States */ - FSMDEF_S_COLLECT_INFO, - FSMDEF_S_CALL_SENT, - FSMDEF_S_OUTGOING_PROCEEDING, - FSMDEF_S_KPML_COLLECT_INFO, - FSMDEF_S_OUTGOING_ALERTING, - FSMDEF_S_INCOMING_ALERTING, - FSMDEF_S_CONNECTING, - FSMDEF_S_JOINING, - FSMDEF_S_CONNECTED, - FSMDEF_S_CONNECTED_MEDIA_PEND, - FSMDEF_S_RELEASING, - FSMDEF_S_HOLD_PENDING, - FSMDEF_S_HOLDING, - FSMDEF_S_RESUME_PENDING, - FSMDEF_S_PRESERVED, - - /* WebRTC States */ - FSMDEF_S_STABLE, - FSMDEF_S_HAVE_LOCAL_OFFER, - FSMDEF_S_HAVE_REMOTE_OFFER, - FSMDEF_S_HAVE_REMOTE_PRANSWER, - FSMDEF_S_HAVE_LOCAL_PRANSWER, - FSMDEF_S_CLOSED, - - FSMDEF_S_MAX -} fsmdef_states_t; - typedef enum { FSMDEF_MRTONE_NO_ACTION = 0, FSMDEF_MRTONE_PLAYED_MONITOR_TONE, diff --git a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h index c907f059681e..2849826adc80 100755 --- a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h @@ -52,6 +52,7 @@ typedef struct { typedef struct { int state; + int fsm_state; int attr; int inst; line_t line_id; diff --git a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h index d60e00d15427..e0f86287bf89 100644 --- a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h @@ -9,6 +9,7 @@ #include "phone_types.h" #include "string_lib.h" #include "vcm.h" +#include "fsm.h" #include "ccapi.h" #include "sessionConstants.h" @@ -180,6 +181,7 @@ void ui_update_media_interface_change(line_t line, callid_t call_id, group_call_ /* WebRTC upcalls for PeerConnectionImpl */ void ui_create_offer(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -188,6 +190,7 @@ void ui_create_offer(call_events event, const char *format, ...); void ui_create_answer(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -196,6 +199,7 @@ void ui_create_answer(call_events event, const char *format, ...); void ui_set_local_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -204,6 +208,7 @@ void ui_set_local_description(call_events event, const char *format, ...); void ui_set_remote_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -212,6 +217,7 @@ void ui_set_remote_description(call_events event, const char *format, ...); void ui_update_local_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -220,6 +226,7 @@ void ui_update_local_description(call_events event, const char *format, ...); void ui_ice_candidate_add(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -228,6 +235,7 @@ void ui_ice_candidate_add(call_events event, const char *format, ...); void ui_on_remote_stream_added(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, diff --git a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h index f23bef17062d..71c4d6884860 100644 --- a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h +++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h @@ -7,6 +7,7 @@ #include "ccapi_types.h" #include "peer_connection_types.h" +#include "fsmdef_states.h" /** * get Line on which this call is @@ -22,6 +23,13 @@ cc_lineid_t CCAPI_CallInfo_getLine(cc_callinfo_ref_t handle); */ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle); +/** + * get FSM state + * @param [in] handle - call info handle + * @return fsm state + */ +fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle); + /** * get call attributes * @param [in] handle - call info handle diff --git a/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h b/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h new file mode 100644 index 000000000000..c6544dd503d9 --- /dev/null +++ b/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h @@ -0,0 +1,44 @@ +/* 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/. */ + +#ifndef _FSMDEF_STATES_H_ +#define _FSMDEF_STATES_H_ + +typedef enum { + FSMDEF_S_MIN = -1, + + FSMDEF_S_IDLE, + + /* SIP States */ + FSMDEF_S_COLLECT_INFO, + FSMDEF_S_CALL_SENT, + FSMDEF_S_OUTGOING_PROCEEDING, + FSMDEF_S_KPML_COLLECT_INFO, + FSMDEF_S_OUTGOING_ALERTING, + FSMDEF_S_INCOMING_ALERTING, + FSMDEF_S_CONNECTING, + FSMDEF_S_JOINING, + FSMDEF_S_CONNECTED, + FSMDEF_S_CONNECTED_MEDIA_PEND, + FSMDEF_S_RELEASING, + FSMDEF_S_HOLD_PENDING, + FSMDEF_S_HOLDING, + FSMDEF_S_RESUME_PENDING, + FSMDEF_S_PRESERVED, + + /* WebRTC States */ + /* MUST be in the same order as PeerConnectionImpl::SignalingState */ + FSMDEF_S_STABLE, + FSMDEF_S_HAVE_LOCAL_OFFER, + FSMDEF_S_HAVE_REMOTE_OFFER, + FSMDEF_S_HAVE_LOCAL_PRANSWER, + FSMDEF_S_HAVE_REMOTE_PRANSWER, + FSMDEF_S_CLOSED, + + FSMDEF_S_MAX +} fsmdef_states_t; + +const char * fsmdef_state_name (int state); + +#endif diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp index d4b9c07e0909..da3831eca534 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp @@ -13,6 +13,7 @@ extern "C" { #include "ccapi_call.h" #include "ccapi_call_info.h" +#include "fsmdef_states.h" } static const char* logTag = "CC_SIPCCCallInfo"; @@ -56,6 +57,16 @@ cc_call_state_t CC_SIPCCCallInfo::getCallState() return CCAPI_CallInfo_getCallState(callinfo_ref); } +fsmdef_states_t CC_SIPCCCallInfo::getFsmState() const +{ + return CCAPI_CallInfo_getFsmState(callinfo_ref); +} + +std::string CC_SIPCCCallInfo::fsmStateToString (fsmdef_states_t state) const +{ + return fsmdef_state_name(state); +} + std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state) { std::string statestr = ""; diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h index 32b1505a0c47..80269bc4522d 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h @@ -35,6 +35,7 @@ namespace CSF ~CC_SIPCCCallInfo (); cc_call_state_t getCallState (); + fsmdef_states_t getFsmState () const; bool getRingerState(); virtual cc_call_attr_t getCallAttr(); @@ -42,6 +43,7 @@ namespace CSF virtual CC_LinePtr getline (); virtual std::string callStateToString (cc_call_state_t state); + virtual std::string fsmStateToString (fsmdef_states_t state) const; virtual std::string callEventToString (ccapi_call_event_e callEvent); virtual cc_call_type_t getCallType(); virtual std::string getCalledPartyName(); From a50b274cb5294a24f31203df73812cd55fa1229b Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 16 May 2013 21:47:50 -0500 Subject: [PATCH 32/93] Bug 784519 - Part 4: signalingState mochi tests r=jsmith --- dom/media/tests/mochitest/Makefile.in | 7 + dom/media/tests/mochitest/head.js | 16 +- dom/media/tests/mochitest/pc.js | 179 ++++++++++++++++-- ...nnection_addCandidateInHaveLocalOffer.html | 43 +++++ ...ection_setLocalAnswerInHaveLocalOffer.html | 41 ++++ ...peerConnection_setLocalAnswerInStable.html | 41 ++++ ...ection_setLocalOfferInHaveRemoteOffer.html | 40 ++++ ...tion_setRemoteAnswerInHaveRemoteOffer.html | 41 ++++ ...eerConnection_setRemoteAnswerInStable.html | 41 ++++ ...ection_setRemoteOfferInHaveLocalOffer.html | 40 ++++ 10 files changed, 475 insertions(+), 14 deletions(-) create mode 100644 dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index 2720ee9ccf2c..9b9c102ca73f 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -35,6 +35,13 @@ MOCHITEST_FILES = \ test_peerConnection_offerRequiresReceiveVideo.html \ test_peerConnection_offerRequiresReceiveVideoAudio.html \ test_peerConnection_throwInCallbacks.html \ + test_peerConnection_setLocalAnswerInStable.html \ + test_peerConnection_setRemoteAnswerInStable.html \ + test_peerConnection_setLocalAnswerInHaveLocalOffer.html \ + test_peerConnection_setRemoteOfferInHaveLocalOffer.html \ + test_peerConnection_setLocalOfferInHaveRemoteOffer.html \ + test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html \ + test_peerConnection_addCandidateInHaveLocalOffer.html \ test_peerConnection_bug822674.html \ test_peerConnection_bug825703.html \ test_peerConnection_bug827843.html \ diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 0a9a5d307728..2099790644be 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -182,11 +182,23 @@ function unexpectedCallbackAndFinish(error) { return function(aObj) { var where = error.fileName + ":" + error.lineNumber; if (aObj && aObj.name && aObj.message) { - ok(false, "Unexpected error callback from " + where + " with name = '" + + ok(false, "Unexpected callback/event from " + where + " with name = '" + aObj.name + "', message = '" + aObj.message + "'"); } else { - ok(false, "Unexpected error callback from " + where + " with " + aObj); + ok(false, "Unexpected callback/event from " + where + " with " + aObj); } SimpleTest.finish(); } } + +/** + * Generates a callback function suitable for putting int a success + * callback in circumstances where success is unexpected. The callback, + * if activated, will kill off the test gracefully. + */ + +function unexpectedSuccessCallbackAndFinish(error, reason) { + return function() { + unexpectedCallbackAndFinish(error)(message); + } +} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index dc6c747cf1ff..78d17471812d 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -246,10 +246,19 @@ var commandsPeerConnection = [ }); } ], + [ + 'PC_CHECK_INITIAL_SIGNALINGSTATE', + function (test) { + is(test.pcLocal.signalingState,"stable", "Initial local signalingState is stable"); + is(test.pcRemote.signalingState,"stable", "Initial remote signalingState is stable"); + test.next(); + } + ], [ 'PC_LOCAL_CREATE_OFFER', function (test) { test.pcLocal.createOffer(function () { + is(test.pcLocal.signalingState, "stable", "Local create offer does not change signaling state"); test.next(); }); } @@ -257,23 +266,24 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_LOCAL_DESCRIPTION', function (test) { - test.pcLocal.setLocalDescription(test.pcLocal._last_offer, function () { - test.next(); - }); + test.expectStateChange(test.pcLocal, "have-local-offer", test); + test.pcLocal.setLocalDescription(test.pcLocal._last_offer, + test.checkStateInCallback(test.pcLocal, "have-local-offer", test)); } ], [ 'PC_REMOTE_SET_REMOTE_DESCRIPTION', function (test) { - test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, function () { - test.next(); - }); + test.expectStateChange(test.pcRemote, "have-remote-offer", test); + test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, + test.checkStateInCallback(test.pcRemote, "have-remote-offer", test)); } ], [ 'PC_REMOTE_CREATE_ANSWER', function (test) { test.pcRemote.createAnswer(function () { + is(test.pcRemote.signalingState, "have-remote-offer", "Remote create offer does not change signaling state"); test.next(); }); } @@ -281,17 +291,17 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_REMOTE_DESCRIPTION', function (test) { - test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, function () { - test.next(); - }); + test.expectStateChange(test.pcLocal, "stable", test); + test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, + test.checkStateInCallback(test.pcLocal, "stable", test)); } ], [ 'PC_REMOTE_SET_LOCAL_DESCRIPTION', function (test) { - test.pcRemote.setLocalDescription(test.pcRemote._last_answer, function () { - test.next(); - }); + test.expectStateChange(test.pcRemote, "stable", test); + test.pcRemote.setLocalDescription(test.pcRemote._last_answer, + test.checkStateInCallback(test.pcRemote, "stable", test)); } ], [ @@ -394,6 +404,64 @@ PeerConnectionTest.prototype.teardown = function PCT_teardown() { SimpleTest.finish(); }; +/** + * Sets up the "onsignalingstatechange" handler for the indicated peerconnection + * as a one-shot test. If the test.commandSuccess flag is set when the event + * happens, then the next test in the command chain is triggered. After + * running, this sets the event handler so that it will fail the test if + * it fires again before we expect it. This is intended to be used in + * conjunction with checkStateInCallback, below. + * + * @param {pcw} PeerConnectionWrapper + * The peer connection to expect a state change on + * @param {state} string + * The state that we expect to change to + * @param {test} PeerConnectionTest + * The test strucure currently in use. + */ +PeerConnectionTest.prototype.expectStateChange = +function PCT_expectStateChange(pcw, state, test) { + pcw.signalingChangeEvent = false; + pcw._pc.onsignalingstatechange = function() { + pcw._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); + is(pcw._pc.signalingState, state, pcw.label + ": State is " + state + " in onsignalingstatechange"); + pcw.signalingChangeEvent = true; + if (pcw.commandSuccess) { + test.next(); + } else { + info("Waiting for success callback..."); + } + }; +} + +/** + * Returns a function, suitable for use as a success callback, that + * checks the signaling state of the PC; and, if the signalingstatechange + * event has already fired, moves on to the next test case. This is + * intended to be used in conjunction with expectStateChange, above. + * + * @param {pcw} PeerConnectionWrapper + * The peer connection to expect a state change on + * @param {state} string + * The state that we expect to change to + * @param {test} PeerConnectionTest + * The test strucure currently in use. + */ + +PeerConnectionTest.prototype.checkStateInCallback = +function PCT_checkStateInCallback(pcw, state, test) { + pcw.commandSuccess = false; + return function() { + pcw.commandSuccess = true; + is(pcw.signalingState, state, pcw.label + ": State is " + state + " in success callback"); + if (pcw.signalingChangeEvent) { + test.next(); + } else { + info("Waiting for signalingstatechange event..."); + } + }; +} + /** * This class handles acts as a wrapper around a PeerConnection instance. @@ -420,6 +488,9 @@ function PeerConnectionWrapper(label, configuration) { // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. self.attachMedia(event.stream, 'video', 'remote'); }; + + // Make sure no signaling state changes are fired until we expect them to + this._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); } PeerConnectionWrapper.prototype = { @@ -462,6 +533,15 @@ PeerConnectionWrapper.prototype = { this._pc.remoteDescription = desc; }, + /** + * Returns the remote signaling state. + * + * @returns {object} The local description + */ + get signalingState() { + return this._pc.signalingState; + }, + /** * Callback when we get media from either side. Also an appropriate * HTML media element will be created. @@ -571,6 +651,25 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, + /** + * Tries to set the local description and expect failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} desc + * mozRTCSessionDescription for the local description request + * @param {function} onFailure + * Callback to execute if the call fails. + */ + setLocalDescriptionAndFail : function PCW_setLocalDescriptionAndFail(desc, onFailure) { + var self = this; + this._pc.setLocalDescription(desc, + unexpectedSuccessCallbackAndFinish(new Error, "setLocalDescription should have failed."), + function (err) { + info("As expected, failed to set the local description for " + self.label); + onFailure(err); + }); + }, + /** * Sets the remote description and automatically handles the failure case. * @@ -587,6 +686,62 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, + /** + * Tries to set the remote description and expect failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} desc + * mozRTCSessionDescription for the remote description request + * @param {function} onFailure + * Callback to execute if the call fails. + */ + setRemoteDescriptionAndFail : function PCW_setRemoteDescriptionAndFail(desc, onFailure) { + var self = this; + this._pc.setRemoteDescription(desc, + unexpectedSuccessCallbackAndFinish(new Error, "setRemoteDescription should have failed."), + function (err) { + info("As expected, failed to set the remote description for " + self.label); + onFailure(err); + }); + }, + + /** + * Adds an ICE candidate and automatically handles the failure case. + * + * @param {object} candidate + * SDP candidate + * @param {function} onSuccess + * Callback to execute if the local description was set successfully + */ + addIceCandidate : function PCW_addIceCandidate(candidate, onSuccess) { + var self = this; + + this._pc.addIceCandidate(candidate, function () { + info("Successfully added an ICE candidate to " + self.label); + onSuccess(); + }, unexpectedCallbackAndFinish(new Error)); + }, + + /** + * Tries to add an ICE candidate and expects failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} candidate + * SDP candidate + * @param {function} onFailure + * Callback to execute if the call fails. + */ + addIceCandidateAndFail : function PCW_addIceCandidateAndFail(candidate, onFailure) { + var self = this; + + this._pc.addIceCandidate(candidate, + unexpectedSuccessCallbackAndFinish(new Error, "addIceCandidate should have failed."), + function (err) { + info("As expected, failed to add an ICE candidate to " + self.label); + onFailure(err); + }) ; + }, + /** * Checks that we are getting the media we expect. * diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html new file mode 100644 index 000000000000..21a1fe65b1f8 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html @@ -0,0 +1,43 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html new file mode 100644 index 000000000000..1873d52eaf22 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html new file mode 100644 index 000000000000..c92b3b686a97 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html new file mode 100644 index 000000000000..41052d403708 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html @@ -0,0 +1,40 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html new file mode 100644 index 000000000000..6864c7695fe4 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html new file mode 100644 index 000000000000..33505a9d0a43 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html new file mode 100644 index 000000000000..fb1987e66746 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html @@ -0,0 +1,40 @@ + + + + + + + + + + +
    +
    +
    + + From 293dbdc6f6fc21cb334d0f25af3cb3d1074a11bf Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Thu, 6 Jun 2013 08:16:28 -0700 Subject: [PATCH 33/93] Bug 876322 - Remove b2g/config/panda-gaia-central/*, r=catlee --- b2g/config/panda-gaia-central/README | 1 - b2g/config/panda-gaia-central/config.json | 25 ------------------- .../panda-gaia-central/releng-pandaboard.tt | 1 - 3 files changed, 27 deletions(-) delete mode 120000 b2g/config/panda-gaia-central/README delete mode 100644 b2g/config/panda-gaia-central/config.json delete mode 120000 b2g/config/panda-gaia-central/releng-pandaboard.tt diff --git a/b2g/config/panda-gaia-central/README b/b2g/config/panda-gaia-central/README deleted file mode 120000 index ca663238783c..000000000000 --- a/b2g/config/panda-gaia-central/README +++ /dev/null @@ -1 +0,0 @@ -../panda/README \ No newline at end of file diff --git a/b2g/config/panda-gaia-central/config.json b/b2g/config/panda-gaia-central/config.json deleted file mode 100644 index bc7a98c01680..000000000000 --- a/b2g/config/panda-gaia-central/config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "config_version": 1, - "tooltool_manifest": "releng-pandaboard.tt", - "mock_target": "mozilla-centos6-i386", - "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], - "build_targets": ["boottarball", "systemtarball", "userdatatarball", "package-tests"], - "upload_files": [ - "{workdir}/out/target/product/panda/*.tar.bz2", - "{workdir}/out/target/product/panda/tests/*.zip", - "{objdir}/dist/b2g-*.crashreporter-symbols.zip", - "{srcdir}/b2g/config/panda/README", - "{workdir}/sources.xml" - ], - "gecko_l10n_root": "http://hg.mozilla.org/l10n-central", - "gaia": { - "vcs": "hgtool", - "repo": "http://hg.mozilla.org/integration/gaia-central", - "l10n": { - "vcs": "hgtool", - "root": "http://hg.mozilla.org/gaia-l10n" - } - }, - "upload_platform": "panda_gaia_central" -} diff --git a/b2g/config/panda-gaia-central/releng-pandaboard.tt b/b2g/config/panda-gaia-central/releng-pandaboard.tt deleted file mode 120000 index f270dafc6d70..000000000000 --- a/b2g/config/panda-gaia-central/releng-pandaboard.tt +++ /dev/null @@ -1 +0,0 @@ -../panda/releng-pandaboard.tt \ No newline at end of file From 446418bc45e50f43c25d7e80f5e8655a33b64bcf Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 6 Jun 2013 14:47:12 -0700 Subject: [PATCH 34/93] Bug 878486: Improve sweeping of breakpoints r=terrence --- js/src/gc/Zone.cpp | 35 +++++++++++++++++++++++++++++++++++ js/src/gc/Zone.h | 3 +++ js/src/jscompartment.cpp | 32 -------------------------------- js/src/vm/Debugger.cpp | 2 +- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index 696ad1126ffe..28fcb0602fc4 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -9,6 +9,7 @@ #include "jsgc.h" #include "jsprf.h" +#include "vm/Debugger.h" #include "js/HashTable.h" #include "gc/GCInternals.h" @@ -143,9 +144,43 @@ Zone::sweep(FreeOp *fop, bool releaseTypes) types.sweep(fop, releaseTypes); } + if (!rt->debuggerList.isEmpty()) + sweepBreakpoints(fop); + active = false; } +void +Zone::sweepBreakpoints(FreeOp *fop) +{ + /* + * Sweep all compartments in a zone at the same time, since there is no way + * to iterate over the scripts belonging to a single compartment in a zone. + */ + + gcstats::AutoPhase ap1(rt->gcStats, gcstats::PHASE_SWEEP_TABLES); + gcstats::AutoPhase ap2(rt->gcStats, gcstats::PHASE_SWEEP_TABLES_BREAKPOINT); + + for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { + JSScript *script = i.get(); + if (!script->hasAnyBreakpointsOrStepMode()) + continue; + bool scriptGone = IsScriptAboutToBeFinalized(&script); + JS_ASSERT(script == i.get()); + for (unsigned i = 0; i < script->length; i++) { + BreakpointSite *site = script->getBreakpointSite(script->code + i); + if (!site) + continue; + Breakpoint *nextbp; + for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = nextbp) { + nextbp = bp->nextInSite(); + if (scriptGone || IsObjectAboutToBeFinalized(&bp->debugger->toJSObjectRef())) + bp->destroy(fop); + } + } + } +} + void Zone::discardJitCode(FreeOp *fop, bool discardConstraints) { diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index a9c444b6a5ab..567361b82239 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -311,6 +311,9 @@ struct Zone : private JS::shadow::Zone, public js::gc::GraphNodeBase js::types::TypeZone types; void sweep(js::FreeOp *fop, bool releaseTypes); + + private: + void sweepBreakpoints(js::FreeOp *fop); }; } /* namespace JS */ diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index ef72b3b98d10..412dfc6fca89 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -21,7 +21,6 @@ #include "ion/IonCompartment.h" #endif #include "js/RootingAPI.h" -#include "vm/Debugger.h" #include "jsgcinlines.h" #include "jsobjinlines.h" @@ -517,7 +516,6 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes) sweepInitialShapeTable(); sweepNewTypeObjectTable(newTypeObjects); sweepNewTypeObjectTable(lazyTypeObjects); - sweepBreakpoints(fop); sweepCallsiteClones(); if (global_ && IsObjectAboutToBeFinalized(global_.unsafeGet())) @@ -756,36 +754,6 @@ JSCompartment::clearTraps(FreeOp *fop) } } -void -JSCompartment::sweepBreakpoints(FreeOp *fop) -{ - gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_TABLES_BREAKPOINT); - - if (rt->debuggerList.isEmpty()) - return; - - for (CellIterUnderGC i(zone(), FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); - if (script->compartment() != this || !script->hasAnyBreakpointsOrStepMode()) - continue; - bool scriptGone = IsScriptAboutToBeFinalized(&script); - JS_ASSERT(script == i.get()); - for (unsigned i = 0; i < script->length; i++) { - BreakpointSite *site = script->getBreakpointSite(script->code + i); - if (!site) - continue; - // nextbp is necessary here to avoid possibly reading *bp after - // destroying it. - Breakpoint *nextbp; - for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = nextbp) { - nextbp = bp->nextInSite(); - if (scriptGone || IsObjectAboutToBeFinalized(&bp->debugger->toJSObjectRef())) - bp->destroy(fop); - } - } - } -} - void JSCompartment::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *compartmentObject, JS::TypeInferenceSizes *tiSizes, size_t *shapesCompartmentTables, diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 104ee9f15439..01e0c6dac025 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1607,7 +1607,7 @@ Debugger::sweepAll(FreeOp *fop) } } - for (CompartmentsIter comp(rt); !comp.done(); comp.next()) { + for (gc::GCCompartmentsIter comp(rt); !comp.done(); comp.next()) { /* For each debuggee being GC'd, detach it from all its debuggers. */ GlobalObjectSet &debuggees = comp->getDebuggees(); for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) { From 8691f71850c28efa91d9d5fd6ae7b3986d81f16c Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 6 Jun 2013 14:47:12 -0700 Subject: [PATCH 35/93] Bug 877444: Remove new 'inline function used but not defined' warnings for ScriptSourceObject-related functions. r=terrence --- js/src/jsscript.h | 16 ++-------------- js/src/jsscriptinlines.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 80bad3273ea1..da54bf7ab32e 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -635,9 +635,7 @@ class JSScript : public js::gc::Cell js::ScriptSource *scriptSource() const; - js::ScriptSourceObject *sourceObject() const { - return &sourceObject_->asScriptSource();; - } + js::ScriptSourceObject *sourceObject() const; void setSourceObject(js::ScriptSourceObject *sourceObject); @@ -1098,10 +1096,7 @@ class ScriptSourceObject : public JSObject { static void finalize(FreeOp *fop, JSObject *obj); static ScriptSourceObject *create(JSContext *cx, ScriptSource *source); - ScriptSource *source() { - return static_cast(getReservedSlot(SOURCE_SLOT).toPrivate()); - } - + inline ScriptSource *source(); void setSource(ScriptSource *source); private: @@ -1434,13 +1429,6 @@ struct ScriptAndCounts } /* namespace js */ -inline js::ScriptSourceObject & -JSObject::asScriptSource() -{ - JS_ASSERT(isScriptSource()); - return *static_cast(this); -} - extern jssrcnote * js_GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc); diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 24b58c4fd3b9..7f0297e89d32 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -102,6 +102,11 @@ JSScript::scriptSource() const return sourceObject()->source(); } +inline js::ScriptSourceObject * +JSScript::sourceObject() const { + return &sourceObject_->asScriptSource(); +} + inline JSFunction * JSScript::getFunction(size_t index) { @@ -221,4 +226,16 @@ JSScript::setOriginalFunctionObject(JSObject *fun) { enclosingScopeOrOriginalFunction_ = fun; } +inline js::ScriptSource * +js::ScriptSourceObject::source() { + return static_cast(getReservedSlot(SOURCE_SLOT).toPrivate()); +} + +inline js::ScriptSourceObject & +JSObject::asScriptSource() +{ + JS_ASSERT(isScriptSource()); + return *static_cast(this); +} + #endif /* jsscriptinlines_h___ */ From d98480141d2f5e10a56baca33098930c2035bfbe Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 6 Jun 2013 14:48:40 -0700 Subject: [PATCH 36/93] Bug 878520: don't clone native asm.js functions; r=luke --- js/src/jit-test/tests/asm.js/testBug878520.js | 9 +++++++ js/src/jsscript.cpp | 27 +++++++++++-------- 2 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 js/src/jit-test/tests/asm.js/testBug878520.js diff --git a/js/src/jit-test/tests/asm.js/testBug878520.js b/js/src/jit-test/tests/asm.js/testBug878520.js new file mode 100644 index 000000000000..fbc3358720a1 --- /dev/null +++ b/js/src/jit-test/tests/asm.js/testBug878520.js @@ -0,0 +1,9 @@ +function surprise(depth) { + arguments.callee.caller(depth); +} + +(function(depth) { + function foo() { function asmModule() { 'use asm'; return {} } }; + if (depth) + surprise(depth - 1); +})(2); diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 472b93ddb8af..89e334e8bcb3 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -2311,18 +2311,23 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, clone = CloneStaticBlockObject(cx, enclosingScope, innerBlock); } else if (obj->isFunction()) { RootedFunction innerFun(cx, obj->toFunction()); - if (!innerFun->getOrCreateScript(cx)) - return NULL; - RootedObject staticScope(cx, innerFun->nonLazyScript()->enclosingStaticScope()); - StaticScopeIter ssi(cx, staticScope); - RootedObject enclosingScope(cx); - if (!ssi.done() && ssi.type() == StaticScopeIter::BLOCK) - enclosingScope = objects[FindBlockIndex(src, ssi.block())]; - else - enclosingScope = fun; + if (innerFun->isNative()) { + assertSameCompartment(cx, innerFun); + clone = innerFun; + } else { + if (!innerFun->getOrCreateScript(cx)) + return NULL; + RootedObject staticScope(cx, innerFun->nonLazyScript()->enclosingStaticScope()); + StaticScopeIter ssi(cx, staticScope); + RootedObject enclosingScope(cx); + if (!ssi.done() && ssi.type() == StaticScopeIter::BLOCK) + enclosingScope = objects[FindBlockIndex(src, ssi.block())]; + else + enclosingScope = fun; - clone = CloneInterpretedFunction(cx, enclosingScope, innerFun, - src->selfHosted ? TenuredObject : newKind); + clone = CloneInterpretedFunction(cx, enclosingScope, innerFun, + src->selfHosted ? TenuredObject : newKind); + } } else { /* * Clone object literals emitted for the JSOP_NEWOBJECT opcode. We only emit that From 6cffba65758dab0c10a80f7770d899d3c63375dd Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 6 Jun 2013 17:40:21 -0500 Subject: [PATCH 37/93] Backed out changeset 8ec73e6aa7d3 (bug 784519) on a CLOSED TREE --- dom/media/tests/mochitest/Makefile.in | 7 - dom/media/tests/mochitest/head.js | 16 +- dom/media/tests/mochitest/pc.js | 179 ++---------------- ...nnection_addCandidateInHaveLocalOffer.html | 43 ----- ...ection_setLocalAnswerInHaveLocalOffer.html | 41 ---- ...peerConnection_setLocalAnswerInStable.html | 41 ---- ...ection_setLocalOfferInHaveRemoteOffer.html | 40 ---- ...tion_setRemoteAnswerInHaveRemoteOffer.html | 41 ---- ...eerConnection_setRemoteAnswerInStable.html | 41 ---- ...ection_setRemoteOfferInHaveLocalOffer.html | 40 ---- 10 files changed, 14 insertions(+), 475 deletions(-) delete mode 100644 dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index 9b9c102ca73f..2720ee9ccf2c 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -35,13 +35,6 @@ MOCHITEST_FILES = \ test_peerConnection_offerRequiresReceiveVideo.html \ test_peerConnection_offerRequiresReceiveVideoAudio.html \ test_peerConnection_throwInCallbacks.html \ - test_peerConnection_setLocalAnswerInStable.html \ - test_peerConnection_setRemoteAnswerInStable.html \ - test_peerConnection_setLocalAnswerInHaveLocalOffer.html \ - test_peerConnection_setRemoteOfferInHaveLocalOffer.html \ - test_peerConnection_setLocalOfferInHaveRemoteOffer.html \ - test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html \ - test_peerConnection_addCandidateInHaveLocalOffer.html \ test_peerConnection_bug822674.html \ test_peerConnection_bug825703.html \ test_peerConnection_bug827843.html \ diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 2099790644be..0a9a5d307728 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -182,23 +182,11 @@ function unexpectedCallbackAndFinish(error) { return function(aObj) { var where = error.fileName + ":" + error.lineNumber; if (aObj && aObj.name && aObj.message) { - ok(false, "Unexpected callback/event from " + where + " with name = '" + + ok(false, "Unexpected error callback from " + where + " with name = '" + aObj.name + "', message = '" + aObj.message + "'"); } else { - ok(false, "Unexpected callback/event from " + where + " with " + aObj); + ok(false, "Unexpected error callback from " + where + " with " + aObj); } SimpleTest.finish(); } } - -/** - * Generates a callback function suitable for putting int a success - * callback in circumstances where success is unexpected. The callback, - * if activated, will kill off the test gracefully. - */ - -function unexpectedSuccessCallbackAndFinish(error, reason) { - return function() { - unexpectedCallbackAndFinish(error)(message); - } -} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 78d17471812d..dc6c747cf1ff 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -246,19 +246,10 @@ var commandsPeerConnection = [ }); } ], - [ - 'PC_CHECK_INITIAL_SIGNALINGSTATE', - function (test) { - is(test.pcLocal.signalingState,"stable", "Initial local signalingState is stable"); - is(test.pcRemote.signalingState,"stable", "Initial remote signalingState is stable"); - test.next(); - } - ], [ 'PC_LOCAL_CREATE_OFFER', function (test) { test.pcLocal.createOffer(function () { - is(test.pcLocal.signalingState, "stable", "Local create offer does not change signaling state"); test.next(); }); } @@ -266,24 +257,23 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_LOCAL_DESCRIPTION', function (test) { - test.expectStateChange(test.pcLocal, "have-local-offer", test); - test.pcLocal.setLocalDescription(test.pcLocal._last_offer, - test.checkStateInCallback(test.pcLocal, "have-local-offer", test)); + test.pcLocal.setLocalDescription(test.pcLocal._last_offer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_SET_REMOTE_DESCRIPTION', function (test) { - test.expectStateChange(test.pcRemote, "have-remote-offer", test); - test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, - test.checkStateInCallback(test.pcRemote, "have-remote-offer", test)); + test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_CREATE_ANSWER', function (test) { test.pcRemote.createAnswer(function () { - is(test.pcRemote.signalingState, "have-remote-offer", "Remote create offer does not change signaling state"); test.next(); }); } @@ -291,17 +281,17 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_REMOTE_DESCRIPTION', function (test) { - test.expectStateChange(test.pcLocal, "stable", test); - test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, - test.checkStateInCallback(test.pcLocal, "stable", test)); + test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_SET_LOCAL_DESCRIPTION', function (test) { - test.expectStateChange(test.pcRemote, "stable", test); - test.pcRemote.setLocalDescription(test.pcRemote._last_answer, - test.checkStateInCallback(test.pcRemote, "stable", test)); + test.pcRemote.setLocalDescription(test.pcRemote._last_answer, function () { + test.next(); + }); } ], [ @@ -404,64 +394,6 @@ PeerConnectionTest.prototype.teardown = function PCT_teardown() { SimpleTest.finish(); }; -/** - * Sets up the "onsignalingstatechange" handler for the indicated peerconnection - * as a one-shot test. If the test.commandSuccess flag is set when the event - * happens, then the next test in the command chain is triggered. After - * running, this sets the event handler so that it will fail the test if - * it fires again before we expect it. This is intended to be used in - * conjunction with checkStateInCallback, below. - * - * @param {pcw} PeerConnectionWrapper - * The peer connection to expect a state change on - * @param {state} string - * The state that we expect to change to - * @param {test} PeerConnectionTest - * The test strucure currently in use. - */ -PeerConnectionTest.prototype.expectStateChange = -function PCT_expectStateChange(pcw, state, test) { - pcw.signalingChangeEvent = false; - pcw._pc.onsignalingstatechange = function() { - pcw._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); - is(pcw._pc.signalingState, state, pcw.label + ": State is " + state + " in onsignalingstatechange"); - pcw.signalingChangeEvent = true; - if (pcw.commandSuccess) { - test.next(); - } else { - info("Waiting for success callback..."); - } - }; -} - -/** - * Returns a function, suitable for use as a success callback, that - * checks the signaling state of the PC; and, if the signalingstatechange - * event has already fired, moves on to the next test case. This is - * intended to be used in conjunction with expectStateChange, above. - * - * @param {pcw} PeerConnectionWrapper - * The peer connection to expect a state change on - * @param {state} string - * The state that we expect to change to - * @param {test} PeerConnectionTest - * The test strucure currently in use. - */ - -PeerConnectionTest.prototype.checkStateInCallback = -function PCT_checkStateInCallback(pcw, state, test) { - pcw.commandSuccess = false; - return function() { - pcw.commandSuccess = true; - is(pcw.signalingState, state, pcw.label + ": State is " + state + " in success callback"); - if (pcw.signalingChangeEvent) { - test.next(); - } else { - info("Waiting for signalingstatechange event..."); - } - }; -} - /** * This class handles acts as a wrapper around a PeerConnection instance. @@ -488,9 +420,6 @@ function PeerConnectionWrapper(label, configuration) { // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. self.attachMedia(event.stream, 'video', 'remote'); }; - - // Make sure no signaling state changes are fired until we expect them to - this._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); } PeerConnectionWrapper.prototype = { @@ -533,15 +462,6 @@ PeerConnectionWrapper.prototype = { this._pc.remoteDescription = desc; }, - /** - * Returns the remote signaling state. - * - * @returns {object} The local description - */ - get signalingState() { - return this._pc.signalingState; - }, - /** * Callback when we get media from either side. Also an appropriate * HTML media element will be created. @@ -651,25 +571,6 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, - /** - * Tries to set the local description and expect failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} desc - * mozRTCSessionDescription for the local description request - * @param {function} onFailure - * Callback to execute if the call fails. - */ - setLocalDescriptionAndFail : function PCW_setLocalDescriptionAndFail(desc, onFailure) { - var self = this; - this._pc.setLocalDescription(desc, - unexpectedSuccessCallbackAndFinish(new Error, "setLocalDescription should have failed."), - function (err) { - info("As expected, failed to set the local description for " + self.label); - onFailure(err); - }); - }, - /** * Sets the remote description and automatically handles the failure case. * @@ -686,62 +587,6 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, - /** - * Tries to set the remote description and expect failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} desc - * mozRTCSessionDescription for the remote description request - * @param {function} onFailure - * Callback to execute if the call fails. - */ - setRemoteDescriptionAndFail : function PCW_setRemoteDescriptionAndFail(desc, onFailure) { - var self = this; - this._pc.setRemoteDescription(desc, - unexpectedSuccessCallbackAndFinish(new Error, "setRemoteDescription should have failed."), - function (err) { - info("As expected, failed to set the remote description for " + self.label); - onFailure(err); - }); - }, - - /** - * Adds an ICE candidate and automatically handles the failure case. - * - * @param {object} candidate - * SDP candidate - * @param {function} onSuccess - * Callback to execute if the local description was set successfully - */ - addIceCandidate : function PCW_addIceCandidate(candidate, onSuccess) { - var self = this; - - this._pc.addIceCandidate(candidate, function () { - info("Successfully added an ICE candidate to " + self.label); - onSuccess(); - }, unexpectedCallbackAndFinish(new Error)); - }, - - /** - * Tries to add an ICE candidate and expects failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} candidate - * SDP candidate - * @param {function} onFailure - * Callback to execute if the call fails. - */ - addIceCandidateAndFail : function PCW_addIceCandidateAndFail(candidate, onFailure) { - var self = this; - - this._pc.addIceCandidate(candidate, - unexpectedSuccessCallbackAndFinish(new Error, "addIceCandidate should have failed."), - function (err) { - info("As expected, failed to add an ICE candidate to " + self.label); - onFailure(err); - }) ; - }, - /** * Checks that we are getting the media we expect. * diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html deleted file mode 100644 index 21a1fe65b1f8..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html deleted file mode 100644 index 1873d52eaf22..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html deleted file mode 100644 index c92b3b686a97..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html deleted file mode 100644 index 41052d403708..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html deleted file mode 100644 index 6864c7695fe4..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html deleted file mode 100644 index 33505a9d0a43..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html deleted file mode 100644 index fb1987e66746..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - -
    -
    -
    - - From ea26cdbf26b7d07edc81ef95a5b723b7449bf3f6 Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 6 Jun 2013 17:40:21 -0500 Subject: [PATCH 38/93] Backed out changeset 90968836cce3 (bug 784519) on a CLOSED TREE --- dom/media/PeerConnection.js | 59 +--- dom/media/bridge/IPeerConnection.idl | 11 - media/webrtc/signaling/include/CC_CallInfo.h | 16 -- media/webrtc/signaling/signaling.gyp | 1 - .../src/peerconnection/PeerConnectionImpl.cpp | 53 +--- .../src/peerconnection/PeerConnectionImpl.h | 16 -- .../peerconnection/PeerConnectionMedia.cpp | 3 +- .../src/sipcc/core/ccapp/CCProvider.h | 2 - .../src/sipcc/core/ccapp/ccapi_call_info.c | 19 -- .../src/sipcc/core/ccapp/ccprovider.c | 23 +- .../signaling/src/sipcc/core/common/ui.c | 115 +++----- .../signaling/src/sipcc/core/gsm/fsmdef.c | 269 +++++++++--------- .../signaling/src/sipcc/core/gsm/gsm_sdp.c | 2 +- .../signaling/src/sipcc/core/gsm/h/fsm.h | 34 ++- .../src/sipcc/core/includes/sessionTypes.h | 1 - .../signaling/src/sipcc/core/includes/uiapi.h | 8 - .../src/sipcc/include/ccapi_call_info.h | 8 - .../src/sipcc/include/fsmdef_states.h | 44 --- .../src/softphonewrapper/CC_SIPCCCallInfo.cpp | 11 - .../src/softphonewrapper/CC_SIPCCCallInfo.h | 2 - 20 files changed, 226 insertions(+), 471 deletions(-) delete mode 100644 media/webrtc/signaling/src/sipcc/include/fsmdef_states.h diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index d002e7eb1c38..6c2527bd4f21 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -765,29 +765,10 @@ RTCPeerConnection.prototype = { sdp: sdp }); }, + get signalingState() { return "stable"; }, // not yet implemented get iceGatheringState() { return this._iceGatheringState; }, get iceConnectionState() { return this._iceConnectionState; }, - // Corresponds to constants in IPeerConnection.idl - _signalingStateMap: [ - 'invalid', - 'stable', - 'have-local-offer', - 'have-remote-offer', - 'have-local-pranswer', - 'have-remote-pranswer', - 'closed' - ], - - get signalingState() { - // checking for our local pc closed indication - // before invoking the pc methods. - if(this._closed) { - return "closed"; - } - return this._signalingStateMap[this._getPC().signalingState]; - }, - changeIceGatheringState: function(state) { this._iceGatheringState = state; }, @@ -1009,10 +990,14 @@ PeerConnectionObserver.prototype = { this._dompc._executeNext(); }, - handleIceStateChanges: function(iceState) { - switch (iceState) { + onStateChange: function(state) { + if (state != Ci.IPeerConnectionObserver.kIceState) { + return; + } + + switch (this._dompc._pc.iceState) { case Ci.IPeerConnection.kIceWaiting: - this._dompc.changeIceConnectionState("new"); + this._dompc.changeIceConnectionState("completed"); this.callCB(this._dompc.ongatheringchange, "complete"); this.callCB(this._onicechange, "starting"); // Now that the PC is ready to go, execute any pending operations. @@ -1036,33 +1021,7 @@ PeerConnectionObserver.prototype = { this.callCB(this._onicechange, "failed"); break; default: - // Unknown ICE state! - this._dompc.reportWarning("Unhandled ice state: " + iceState, null, 0); - break; - } - }, - - onStateChange: function(state) { - switch (state) { - case Ci.IPeerConnectionObserver.kSignalingState: - this.callCB(this._dompc.onsignalingstatechange, - this._dompc.signalingState); - break; - - case Ci.IPeerConnectionObserver.kIceState: - this.handleIceStateChanges(this._dompc._pc.iceState); - break; - - case Ci.IPeerConnectionObserver.kSdpState: - // No-op - break; - - case Ci.IPeerConnectionObserver.kSipccState: - // No-op - break; - - default: - this._dompc.reportWarning("Unhandled state type: " + state, null, 0); + // Unknown state! break; } }, diff --git a/dom/media/bridge/IPeerConnection.idl b/dom/media/bridge/IPeerConnection.idl index b6c4e21ca5ee..b90bc2c42d21 100644 --- a/dom/media/bridge/IPeerConnection.idl +++ b/dom/media/bridge/IPeerConnection.idl @@ -32,7 +32,6 @@ interface IPeerConnectionObserver : nsISupports const long kIceState = 0x2; const long kSdpState = 0x3; const long kSipccState = 0x4; - const long kSignalingState = 0x5; /* JSEP callbacks */ void onCreateOfferSuccess(in string offer); @@ -92,15 +91,6 @@ interface IPeerConnection : nsISupports const long kClosing = 3; const long kClosed = 4; - /* RTCSignalingState from WebRTC spec */ - const long kSignalingInvalid = 0; - const long kSignalingStable = 1; - const long kSignalingHaveLocalOffer = 2; - const long kSignalingHaveRemoteOffer = 3; - const long kSignalingHaveLocalPranswer = 4; - const long kSignalingHaveRemotePranswer = 5; - const long kSignalingClosed = 6; - /* for 'type' in DataChannelInit dictionary */ const unsigned short kDataChannelReliable = 0; const unsigned short kDataChannelPartialReliableRexmit = 1; @@ -154,7 +144,6 @@ interface IPeerConnection : nsISupports readonly attribute unsigned long iceState; readonly attribute unsigned long readyState; - readonly attribute unsigned long signalingState; readonly attribute unsigned long sipccState; /* Data channels */ diff --git a/media/webrtc/signaling/include/CC_CallInfo.h b/media/webrtc/signaling/include/CC_CallInfo.h index 3a9137048538..f6b04fc1b37d 100644 --- a/media/webrtc/signaling/include/CC_CallInfo.h +++ b/media/webrtc/signaling/include/CC_CallInfo.h @@ -9,14 +9,12 @@ extern "C" { #include "ccapi_types.h" -#include "fsmdef_states.h" } #include "CC_Common.h" #include "CC_CallTypes.h" #include "peer_connection_types.h" - namespace CSF { @@ -45,13 +43,6 @@ namespace CSF */ virtual cc_call_state_t getCallState () = 0; - /** - get FSM state - @param [in] handle - call info handle - @return FSM state - */ - virtual fsmdef_states_t getFsmState () const = 0; - /** print Call state @param [in] handle - call info handle @@ -59,13 +50,6 @@ namespace CSF */ virtual std::string callStateToString (cc_call_state_t state) = 0; - /** - print FSM state - @param [in] handle - call info handle - @return call state as string - */ - virtual std::string fsmStateToString (fsmdef_states_t state) const = 0; - /** print Call event @param [in] call event diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index 34dbc0f0ce7e..7ac4b485bd44 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -387,7 +387,6 @@ './src/sipcc/core/includes/dns_utils.h', './src/sipcc/core/includes/dtmf.h', './src/sipcc/core/includes/embedded.h', - './src/sipcc/core/includes/fsmdef_states.h', './src/sipcc/core/includes/intelpentiumtypes.h', './src/sipcc/core/includes/kpml_common_util.h', './src/sipcc/core/includes/kpmlmap.h', diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 0df10c668032..b20034faffcd 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -129,9 +129,7 @@ public: mReason(aInfo->getStatus()), mSdpStr(), mCallState(aInfo->getCallState()), - mFsmState(aInfo->getFsmState()), - mStateStr(aInfo->callStateToString(mCallState)), - mFsmStateStr(aInfo->fsmStateToString(mFsmState)) { + mStateStr(aInfo->callStateToString(mCallState)) { if (mCallState == REMOTESTREAMADD) { MediaStreamTable *streams = NULL; streams = aInfo->getMediaStreams(); @@ -175,8 +173,7 @@ public: NS_IMETHOD Run() { CSFLogInfo(logTag, "PeerConnectionObserverDispatch processing " - "mCallState = %d (%s), mFsmState = %d (%s)", - mCallState, mStateStr.c_str(), mFsmState, mFsmStateStr.c_str()); + "mCallState = %d (%s)", mCallState, mStateStr.c_str()); if (mCallState == SETLOCALDESCERROR || mCallState == SETREMOTEDESCERROR) { const std::vector &errors = mPC->GetSdpParseErrors(); @@ -195,23 +192,6 @@ public: mCode, mReason.c_str()); } - /* - * While the fsm_states_t (FSM_DEF_*) constants are a proper superset - * of SignalingState, and the order in which the SignalingState values - * appear matches the order they appear in fsm_states_t, their underlying - * numeric representation is different. Hence, we need to perform an - * offset calculation to map from one to the other. - */ - - if (mFsmState >= FSMDEF_S_STABLE && mFsmState <= FSMDEF_S_CLOSED) { - int offset = FSMDEF_S_STABLE - PeerConnectionImpl::kSignalingStable; - mPC->SetSignalingState_m( - static_cast(mFsmState - offset)); - } else { - CSFLogError(logTag, ": **** UNHANDLED SIGNALING STATE : %d (%s)", - mFsmState, mFsmStateStr.c_str()); - } - switch (mCallState) { case CREATEOFFERSUCCESS: mObserver->OnCreateOfferSuccess(mSdpStr.c_str()); @@ -310,9 +290,7 @@ private: std::string mReason; std::string mSdpStr; cc_call_state_t mCallState; - fsmdef_states_t mFsmState; std::string mStateStr; - std::string mFsmStateStr; nsRefPtr mRemoteStream; }; @@ -322,7 +300,6 @@ PeerConnectionImpl::PeerConnectionImpl() : mRole(kRoleUnknown) , mCall(NULL) , mReadyState(kNew) - , mSignalingState(kSignalingStable) , mIceState(kIceGathering) , mPCObserver(NULL) , mWindow(NULL) @@ -1232,16 +1209,6 @@ PeerConnectionImpl::GetReadyState(uint32_t* aState) return NS_OK; } -NS_IMETHODIMP -PeerConnectionImpl::GetSignalingState(uint32_t* aState) -{ - PC_AUTO_ENTER_API_CALL_NO_CHECK(); - MOZ_ASSERT(aState); - - *aState = mSignalingState; - return NS_OK; -} - NS_IMETHODIMP PeerConnectionImpl::GetSipccState(uint32_t* aState) { @@ -1408,22 +1375,6 @@ PeerConnectionImpl::ChangeReadyState(PeerConnectionImpl::ReadyState aReadyState) NS_DISPATCH_NORMAL); } -void -PeerConnectionImpl::SetSignalingState_m(SignalingState aSignalingState) -{ - PC_AUTO_ENTER_API_CALL_NO_CHECK(); - if (mSignalingState == aSignalingState) { - return; - } - - mSignalingState = aSignalingState; - nsCOMPtr pco = do_QueryReferent(mPCObserver); - if (!pco) { - return; - } - pco->OnStateChange(IPeerConnectionObserver::kSignalingState); -} - PeerConnectionWrapper::PeerConnectionWrapper(const std::string& handle) : impl_(nullptr) { if (PeerConnectionCtx::GetInstance()->mPeerConnections.find(handle) == diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 5c23a826a9fb..3d66a304e0e3 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -133,18 +133,6 @@ public: kClosed }; - /* Must match constants in IPeerConnection.idl */ - /* Must also be int the same order as in fsmdef_states.h */ - enum SignalingState { - kSignalingInvalid = 0, - kSignalingStable = 1, - kSignalingHaveLocalOffer = 2, - kSignalingHaveRemoteOffer = 3, - kSignalingHaveLocalPranswer = 4, - kSignalingHaveRemotePranswer = 5, - kSignalingClosed = 6 - }; - enum SipccState { kIdle, kStarting, @@ -280,9 +268,6 @@ public: // Called to retreive the list of parsing errors. const std::vector &GetSdpParseErrors(); - // Sets the RTC Signaling State - void SetSignalingState_m(SignalingState aSignalingState); - private: PeerConnectionImpl(const PeerConnectionImpl&rhs); PeerConnectionImpl& operator=(PeerConnectionImpl); @@ -330,7 +315,6 @@ private: // The call CSF::CC_CallPtr mCall; ReadyState mReadyState; - SignalingState mSignalingState; // ICE State IceState mIceState; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index cb63fd2bbf2d..0016765fa1aa 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -396,8 +396,7 @@ PeerConnectionMedia::AddRemoteStream(nsRefPtr aInfo, nsresult PeerConnectionMedia::AddRemoteStreamHint(int aIndex, bool aIsVideo) { - if (aIndex < 0 || - static_cast(aIndex) >= mRemoteSourceStreams.Length()) { + if (aIndex >= mRemoteSourceStreams.Length()) { return NS_ERROR_ILLEGAL_VALUE; } diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h index bd87aa77c97b..e55247e8eea4 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h @@ -16,7 +16,6 @@ #include "cpr_threads.h" #include "phone_types.h" #include "session.h" -#include "fsmdef_states.h" #include "cc_constants.h" #include "ccapi_types.h" @@ -61,7 +60,6 @@ typedef struct cc_call_info_t_{ callid_t id; uint16_t inst; cc_call_state_t state; - fsmdef_states_t fsm_state; cc_call_attr_t attr; cc_call_type_t type; cc_call_security_t security; diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c index 11b63510bc3e..d9773ac802a6 100644 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c @@ -47,25 +47,6 @@ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle){ return ONHOOK; } -/** - * get FSM state - * @param handle - call handle - * @return call state - */ -fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle){ - session_data_t *data = (session_data_t *)handle; - CCAPP_DEBUG(DEB_F_PREFIX"Entering", - DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__)); - - if ( data ){ - CCAPP_DEBUG(DEB_F_PREFIX"returned %02X", - DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), data->state); - return data->fsm_state; - } - - return FSMDEF_S_IDLE; -} - /** * get call attributes * @param handle - call handle diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c index 78484ef34588..924a7f1cc1c5 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c @@ -1416,9 +1416,7 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) //Populate the session hash data the first time. memset(data, 0, sizeof(session_data_t)); data->sess_id = sessUpd->sessionID; - data->state = call_state; - data->fsm_state = - sessUpd->update.ccSessionUpd.data.state_data.fsm_state; + data->state = call_state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; if (sessUpd->eventID == CALL_NEWCALL || sessUpd->eventID == CREATE_OFFER || @@ -1508,12 +1506,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) if (createdSessionData == FALSE) { return; } - data->state = - sessUpd->update.ccSessionUpd.data.state_data.state; - data->line = - sessUpd->update.ccSessionUpd.data.state_data.line_id; - data->fsm_state = - sessUpd->update.ccSessionUpd.data.state_data.fsm_state; + data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; break; default: break; @@ -1578,8 +1572,6 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) data->state = sessUpd->update.ccSessionUpd.data.state_data.state; } data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; - data->fsm_state = - sessUpd->update.ccSessionUpd.data.state_data.fsm_state; sessUpd->update.ccSessionUpd.data.state_data.attr = data->attr; sessUpd->update.ccSessionUpd.data.state_data.inst = data->inst; @@ -1637,10 +1629,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) ccsnap_gen_callEvent(CCAPI_CALL_EV_GCID, CREATE_CALL_HANDLE_FROM_SESSION_ID(sessUpd->sessionID)); break; case CALL_NEWCALL: - data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->state = sessUpd->update.ccSessionUpd.data.state_data.state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; - data->fsm_state = - sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->attr = sessUpd->update.ccSessionUpd.data.state_data.attr; data->inst = sessUpd->update.ccSessionUpd.data.state_data.inst; return; @@ -1812,8 +1802,6 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) case REMOTE_STREAM_ADD: data->cause = sessUpd->update.ccSessionUpd.data.state_data.cause; data->state = sessUpd->update.ccSessionUpd.data.state_data.state; - data->fsm_state = - sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->media_stream_track_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_track_id; data->media_stream_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_id; strlib_free(data->status); @@ -2167,8 +2155,7 @@ void ccappFeatureUpdated (feature_update_t *featUpd) { break; case DEVICE_FEATURE_MWILAMP: - g_deviceInfo.mwi_lamp = - featUpd->update.ccFeatUpd.data.mwi_status.status; + g_deviceInfo.mwi_lamp = featUpd->update.ccFeatUpd.data.state_data.state; ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_MWI_LAMP, CC_DEVICE_ID); break; case DEVICE_FEATURE_BLF: diff --git a/media/webrtc/signaling/src/sipcc/core/common/ui.c b/media/webrtc/signaling/src/sipcc/core/common/ui.c index 6faa7ec7baab..5d6e34eb243c 100755 --- a/media/webrtc/signaling/src/sipcc/core/common/ui.c +++ b/media/webrtc/signaling/src/sipcc/core/common/ui.c @@ -737,7 +737,7 @@ ui_change_mwi_lamp (int status) msg.sessionType = SESSIONTYPE_CALLCONTROL; msg.featureID = DEVICE_FEATURE_MWILAMP; - msg.update.ccFeatUpd.data.mwi_status.status = status; + msg.update.ccFeatUpd.data.state_data.state = status; if ( ccappTaskPostMsg(CCAPP_FEATURE_UPDATE, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) { CCAPP_ERROR(CCAPP_F_PREFIX"failed to send DEVICE_FEATURE_MWILAMP(%d) msg", __FUNCTION__, status); @@ -1544,20 +1544,20 @@ ui_control_feature (line_t line_id, callid_t call_id, } /* - * Helper for the following several functions which all load up a + * Helper for the following four functions which all load up a * session_update message and post it. * */ -static void post_message_helper(group_call_event_t eventId, - call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallId, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, - va_list args) +static void post_message_helper( + group_call_event_t eventId, + call_events event, + line_t nLine, + callid_t nCallId, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, + va_list args) { flex_string fs; session_update_t msg; @@ -1572,7 +1572,6 @@ static void post_message_helper(group_call_event_t eventId, msg.eventID = eventId; msg.update.ccSessionUpd.data.state_data.state = event; - msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.sdp = sdp; @@ -1603,14 +1602,9 @@ static void post_message_helper(group_call_event_t eventId, * * @return none */ -void ui_create_offer(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, ...) +void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, + uint16_t call_instance_id, string_t sdp, + pc_error error, const char *format, ...) { va_list ap; @@ -1620,8 +1614,8 @@ void ui_create_offer(call_events event, va_start(ap, format); - post_message_helper(CREATE_OFFER, event, new_state, nLine, nCallID, - call_instance_id, sdp, error, format, ap); + post_message_helper(CREATE_OFFER, event, nLine, nCallID, call_instance_id, + sdp, error, format, ap); va_end(ap); return; @@ -1633,22 +1627,17 @@ void ui_create_offer(call_events event, * * @return none */ -void ui_create_answer(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, ...) +void ui_create_answer(call_events event, line_t nLine, callid_t nCallID, + uint16_t call_instance_id, string_t sdp, + pc_error error, const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(CREATE_ANSWER, event, new_state, nLine, nCallID, - call_instance_id, sdp, error, format, ap); + post_message_helper(CREATE_ANSWER, event, nLine, nCallID, call_instance_id, + sdp, error, format, ap); va_end(ap); return; @@ -1660,22 +1649,17 @@ void ui_create_answer(call_events event, * @return none */ -void ui_set_local_description(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, ...) +void ui_set_local_description(call_events event, line_t nLine, callid_t nCallID, + uint16_t call_instance_id, string_t sdp, + pc_error error, const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_LOCAL_DESC, event, new_state, nLine, nCallID, - call_instance_id, sdp, error, format, ap); + post_message_helper(SET_LOCAL_DESC, event, nLine, nCallID, call_instance_id, + sdp, error, format, ap); va_end(ap); return; @@ -1687,13 +1671,9 @@ void ui_set_local_description(call_events event, * @return none */ -void ui_set_remote_description(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, +void ui_set_remote_description(call_events event, line_t nLine, + callid_t nCallID, uint16_t call_instance_id, + string_t sdp, pc_error error, const char *format, ...) { va_list ap; @@ -1701,7 +1681,7 @@ void ui_set_remote_description(call_events event, DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_REMOTE_DESC, event, new_state, nLine, nCallID, + post_message_helper(SET_REMOTE_DESC, event, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1714,13 +1694,9 @@ void ui_set_remote_description(call_events event, * @return none */ -void ui_update_local_description(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, +void ui_update_local_description(call_events event, line_t nLine, + callid_t nCallID, uint16_t call_instance_id, + string_t sdp, pc_error error, const char *format, ...) { va_list ap; @@ -1729,7 +1705,7 @@ void ui_update_local_description(call_events event, event, call_instance_id); va_start(ap, format); - post_message_helper(UPDATE_LOCAL_DESC, event, new_state, nLine, nCallID, + post_message_helper(UPDATE_LOCAL_DESC, event, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1742,21 +1718,16 @@ void ui_update_local_description(call_events event, * @return none */ -void ui_ice_candidate_add(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, ...) +void ui_ice_candidate_add(call_events event, line_t nLine, callid_t nCallID, + uint16_t call_instance_id, string_t sdp, + pc_error error, const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(ICE_CANDIDATE_ADD, event, new_state, nLine, nCallID, + post_message_helper(ICE_CANDIDATE_ADD, event, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); } @@ -1767,11 +1738,8 @@ void ui_ice_candidate_add(call_events event, * @return none */ -void ui_on_remote_stream_added(call_events event, - fsmdef_states_t new_state, - line_t nLine, - callid_t nCallID, - uint16_t call_instance_id, +void ui_on_remote_stream_added(call_events event, line_t nLine, + callid_t nCallID, uint16_t call_instance_id, cc_media_remote_track_table_t media_track) { session_update_t msg; @@ -1791,7 +1759,6 @@ void ui_on_remote_stream_added(call_events event, msg.eventID = REMOTE_STREAM_ADD; msg.update.ccSessionUpd.data.state_data.state = event; - msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.media_stream_track_id = media_track.track[0].media_stream_track_id; diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c index fbdd9d5da105..7e829e91ec46 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c @@ -747,36 +747,6 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, -/* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */ - { - /* CC_MSG_SETUP */ fsmdef_ev_default, - /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, - /* CC_MSG_PROCEEDING */ fsmdef_ev_default, - /* CC_MSG_ALERTING */ fsmdef_ev_default, - /* CC_MSG_CONNECTED */ fsmdef_ev_default, - /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, - /* CC_MSG_RELEASE */ fsmdef_ev_default, - /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, - /* CC_MSG_FEATURE */ fsmdef_ev_default, - /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, - /* CC_MSG_OFFHOOK */ fsmdef_ev_default, - /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, - /* CC_MSG_LINE */ fsmdef_ev_default, - /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, - /* CC_MSG_DIGIT_END */ fsmdef_ev_default, - /* CC_MSG_DIALSTRING */ fsmdef_ev_default, - /* CC_MSG_MWI */ fsmdef_ev_default, - /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, - /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, - /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, - /* CC_MSG_SETLOCALDESC */ fsmdef_ev_setlocaldesc, - /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_default, /* Should not happen */ - /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, - /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, - /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, - /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate - }, - /* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -807,6 +777,36 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, +/* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */ + { + /* CC_MSG_SETUP */ fsmdef_ev_default, + /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, + /* CC_MSG_PROCEEDING */ fsmdef_ev_default, + /* CC_MSG_ALERTING */ fsmdef_ev_default, + /* CC_MSG_CONNECTED */ fsmdef_ev_default, + /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, + /* CC_MSG_RELEASE */ fsmdef_ev_default, + /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, + /* CC_MSG_FEATURE */ fsmdef_ev_default, + /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, + /* CC_MSG_OFFHOOK */ fsmdef_ev_default, + /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, + /* CC_MSG_LINE */ fsmdef_ev_default, + /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, + /* CC_MSG_DIGIT_END */ fsmdef_ev_default, + /* CC_MSG_DIALSTRING */ fsmdef_ev_default, + /* CC_MSG_MWI */ fsmdef_ev_default, + /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, + /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, + /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, + /* CC_MSG_SETLOCALDESC */ fsmdef_ev_setlocaldesc, + /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_default, /* Should not happen */ + /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, + /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, + /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, + /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate + }, + /* FSMDEF_S_CLOSED --------------------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -2416,39 +2416,38 @@ fsmdef_ev_default (sm_event_t *event) */ switch (event->event) { case CC_MSG_CREATEOFFER: - ui_create_offer(evCreateOfferError, fcb->state, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_offer(evCreateOfferError, msg->line, msg->call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create offer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); break; case CC_MSG_CREATEANSWER: - ui_create_answer(evCreateAnswerError, fcb->state, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_answer(evCreateAnswerError, msg->line, msg->call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create answer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); break; case CC_MSG_SETLOCALDESC: - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local description in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); break; case CC_MSG_SETREMOTEDESC: - ui_set_remote_description(evSetRemoteDescError, fcb->state, - msg->line, msg->call_id, dcb->caller_id.call_instance_id, - strlib_empty(), PC_INVALID_STATE, - "Cannot set remote description in state %s", - fsmdef_state_name(fcb->state)); + ui_set_remote_description(evSetRemoteDescError, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), + PC_INVALID_STATE, "Cannot set remote description in state %s", + fsmdef_state_name(event->state)); break; case CC_MSG_ADDCANDIDATE: - ui_ice_candidate_add(evAddIceCandidateError, fcb->state, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_ice_candidate_add(evAddIceCandidateError, msg->line, msg->call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add ICE candidate in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); break; case CC_MSG_ADDSTREAM: @@ -2459,7 +2458,7 @@ fsmdef_ev_default (sm_event_t *event) * getting through anyway. */ FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Cannot add or remove streams " "in state %s", DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, - msg->call_id, __FUNCTION__), fsmdef_state_name(fcb->state)); + msg->call_id, __FUNCTION__), fsmdef_state_name(event->state)); break; default: @@ -3151,14 +3150,14 @@ fsmdef_ev_createoffer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_offer(evCreateOfferError, fcb->state, line, call_id, + ui_create_offer(evCreateOfferError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for offer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, + ui_create_offer(evCreateOfferSuccess, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3180,7 +3179,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { } if (!has_stream) { - ui_create_offer(evCreateOfferError, fcb->state, line, call_id, + ui_create_offer(evCreateOfferError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create SDP without any streams."); return SM_RC_END; @@ -3190,7 +3189,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_offer(evCreateOfferError, fcb->state, line, call_id, + ui_create_offer(evCreateOfferError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Failed to get ICE parameters for local SDP"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3222,7 +3221,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, FALSE, TRUE, TRUE, TRUE, TRUE); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, fcb->state, line, call_id, + ui_create_offer(evCreateOfferError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3232,7 +3231,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, fcb->state, line, call_id, + ui_create_offer(evCreateOfferError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3243,7 +3242,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass offer SDP back to UI */ - ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, + ui_create_offer(evCreateOfferSuccess, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3306,14 +3305,14 @@ fsmdef_ev_createanswer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for answer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerSuccess, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3332,7 +3331,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not get ICE parameters for answer"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3374,7 +3373,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { */ cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for answer;" " cause = %s", cc_cause_name(cause)); @@ -3393,7 +3392,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { /* create_answer */ TRUE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); @@ -3402,7 +3401,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode SDP for answer; cause = %s", cc_cause_name(cause)); @@ -3413,7 +3412,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass SDP back to UI */ - ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, + ui_create_answer(evCreateAnswerSuccess, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3449,25 +3448,25 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); - ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, + ui_set_local_description(evSetLocalDescError, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); - ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, + ui_set_local_description(evSetLocalDescError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } if (!dcb->sdp) { - ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, + ui_set_local_description(evSetLocalDescError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Setting of local SDP before calling " "createOffer or createAnswer is not currently supported."); @@ -3477,12 +3476,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (fcb->state != FSMDEF_S_STABLE && - fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER) { - ui_set_local_description(evSetLocalDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_STABLE && + event->state != FSMDEF_S_HAVE_LOCAL_OFFER) { + ui_set_local_description(evSetLocalDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local offer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3490,12 +3489,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && - fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && + event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local answer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3510,8 +3509,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_local_description(evSetLocalDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3526,8 +3525,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb->dsp_out_of_resources == TRUE) { cc_call_state(fcb->dcb->call_id, fcb->dcb->line, CC_STATE_UNKNOWN, NULL); - ui_set_local_description(evSetLocalDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Cannot start media channels; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3540,21 +3539,21 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && - fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && + event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local pranswer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3563,16 +3562,16 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { /* Encode the current local SDP structure into a char buffer */ local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for local " "description"); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescSuccess, fcb->state, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, - strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); + ui_set_local_description(evSetLocalDescSuccess, msg->line, msg->call_id, + dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), + PC_NO_ERROR, NULL); free(local_sdp); return (SM_RC_END); @@ -3610,20 +3609,20 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, 0, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + 0, strlib_empty(), PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } @@ -3633,8 +3632,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb->sdp && dcb->sdp->dest_sdp) { FSM_DEBUG_SM(DEB_F_PREFIX"Renegotiation not currently supported.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Renegotiation of session description is not " "currently supported. See Bug 840728 for status."); return (SM_RC_END); @@ -3662,18 +3661,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (fcb->state != FSMDEF_S_STABLE && - fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_STABLE && + event->state != FSMDEF_S_HAVE_REMOTE_OFFER) { + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote offer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } cause = gsmsdp_process_offer_sdp(fcb, &msg_body, TRUE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not process offer SDP; " "cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3693,8 +3692,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP; cause = %s", cc_cause_name(cause)); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); @@ -3705,8 +3704,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_negotiate_media_lines(fcb, dcb->sdp, TRUE, TRUE, TRUE, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); return (fsmdef_release(fcb, cause, FALSE)); @@ -3718,18 +3717,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && - fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && + event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote answer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } cause = gsmsdp_negotiate_answer_sdp(fcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate answer SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3741,8 +3740,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3760,21 +3759,21 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && - fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && + event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote pranswer in state %s", - fsmdef_state_name(fcb->state)); + fsmdef_state_name(event->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3789,14 +3788,14 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_set_remote_description(evSetRemoteDescError, fcb->state, line, - call_id, dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, line, call_id, + dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize remote description;" " cause = %s", cc_cause_name(cause)); return (SM_RC_END); } - ui_set_remote_description(evSetRemoteDescSuccess, fcb->state, line, call_id, + ui_set_remote_description(evSetRemoteDescSuccess, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); @@ -3980,14 +3979,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { if (!dcb) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "DCB has not been created."); return SM_RC_CLEANUP; } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (sdpmode == FALSE) { - ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); @@ -3999,7 +3998,7 @@ fsmdef_ev_addcandidate(sm_event_t *event) { "remote description been set yet?\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add remote ICE candidates before " "setting remote SDP."); @@ -4046,14 +4045,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize new SDP after adding ICE " "candidate."); return (SM_RC_END); } - ui_ice_candidate_add(evAddIceCandidate, fcb->state, line, call_id, + ui_ice_candidate_add(evAddIceCandidate, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c index 1efc95922428..f133920f81c3 100644 --- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c @@ -4749,7 +4749,7 @@ gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial TODO(adam@nostrum.com): Figure out how to notify when streams gain tracks */ ui_on_remote_stream_added(evOnRemoteStreamAdd, - fcb_p->state, dcb_p->line, dcb_p->call_id, + dcb_p->line, dcb_p->call_id, dcb_p->caller_id.call_instance_id, dcb_p->remote_media_stream_tbl->streams[j]); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h index 85a72abbedca..9752cc8f68d6 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h +++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h @@ -13,7 +13,6 @@ #include "sll_lite.h" #include "sessionConstants.h" #include "ccsdp.h" -#include "fsmdef_states.h" /* TODO: BLASBERG * fsm.h only needs the following from ccsip_core.h @@ -66,6 +65,39 @@ typedef enum { FSMDEF_CALL_TYPE_MAX } fsmdef_call_types_t; +typedef enum { + FSMDEF_S_MIN = -1, + + FSMDEF_S_IDLE, + + /* SIP States */ + FSMDEF_S_COLLECT_INFO, + FSMDEF_S_CALL_SENT, + FSMDEF_S_OUTGOING_PROCEEDING, + FSMDEF_S_KPML_COLLECT_INFO, + FSMDEF_S_OUTGOING_ALERTING, + FSMDEF_S_INCOMING_ALERTING, + FSMDEF_S_CONNECTING, + FSMDEF_S_JOINING, + FSMDEF_S_CONNECTED, + FSMDEF_S_CONNECTED_MEDIA_PEND, + FSMDEF_S_RELEASING, + FSMDEF_S_HOLD_PENDING, + FSMDEF_S_HOLDING, + FSMDEF_S_RESUME_PENDING, + FSMDEF_S_PRESERVED, + + /* WebRTC States */ + FSMDEF_S_STABLE, + FSMDEF_S_HAVE_LOCAL_OFFER, + FSMDEF_S_HAVE_REMOTE_OFFER, + FSMDEF_S_HAVE_REMOTE_PRANSWER, + FSMDEF_S_HAVE_LOCAL_PRANSWER, + FSMDEF_S_CLOSED, + + FSMDEF_S_MAX +} fsmdef_states_t; + typedef enum { FSMDEF_MRTONE_NO_ACTION = 0, FSMDEF_MRTONE_PLAYED_MONITOR_TONE, diff --git a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h index 2849826adc80..c907f059681e 100755 --- a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h @@ -52,7 +52,6 @@ typedef struct { typedef struct { int state; - int fsm_state; int attr; int inst; line_t line_id; diff --git a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h index e0f86287bf89..d60e00d15427 100644 --- a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h @@ -9,7 +9,6 @@ #include "phone_types.h" #include "string_lib.h" #include "vcm.h" -#include "fsm.h" #include "ccapi.h" #include "sessionConstants.h" @@ -181,7 +180,6 @@ void ui_update_media_interface_change(line_t line, callid_t call_id, group_call_ /* WebRTC upcalls for PeerConnectionImpl */ void ui_create_offer(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -190,7 +188,6 @@ void ui_create_offer(call_events event, const char *format, ...); void ui_create_answer(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -199,7 +196,6 @@ void ui_create_answer(call_events event, const char *format, ...); void ui_set_local_description(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -208,7 +204,6 @@ void ui_set_local_description(call_events event, const char *format, ...); void ui_set_remote_description(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -217,7 +212,6 @@ void ui_set_remote_description(call_events event, const char *format, ...); void ui_update_local_description(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -226,7 +220,6 @@ void ui_update_local_description(call_events event, const char *format, ...); void ui_ice_candidate_add(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -235,7 +228,6 @@ void ui_ice_candidate_add(call_events event, const char *format, ...); void ui_on_remote_stream_added(call_events event, - fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, diff --git a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h index 71c4d6884860..f23bef17062d 100644 --- a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h +++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h @@ -7,7 +7,6 @@ #include "ccapi_types.h" #include "peer_connection_types.h" -#include "fsmdef_states.h" /** * get Line on which this call is @@ -23,13 +22,6 @@ cc_lineid_t CCAPI_CallInfo_getLine(cc_callinfo_ref_t handle); */ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle); -/** - * get FSM state - * @param [in] handle - call info handle - * @return fsm state - */ -fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle); - /** * get call attributes * @param [in] handle - call info handle diff --git a/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h b/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h deleted file mode 100644 index c6544dd503d9..000000000000 --- a/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h +++ /dev/null @@ -1,44 +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/. */ - -#ifndef _FSMDEF_STATES_H_ -#define _FSMDEF_STATES_H_ - -typedef enum { - FSMDEF_S_MIN = -1, - - FSMDEF_S_IDLE, - - /* SIP States */ - FSMDEF_S_COLLECT_INFO, - FSMDEF_S_CALL_SENT, - FSMDEF_S_OUTGOING_PROCEEDING, - FSMDEF_S_KPML_COLLECT_INFO, - FSMDEF_S_OUTGOING_ALERTING, - FSMDEF_S_INCOMING_ALERTING, - FSMDEF_S_CONNECTING, - FSMDEF_S_JOINING, - FSMDEF_S_CONNECTED, - FSMDEF_S_CONNECTED_MEDIA_PEND, - FSMDEF_S_RELEASING, - FSMDEF_S_HOLD_PENDING, - FSMDEF_S_HOLDING, - FSMDEF_S_RESUME_PENDING, - FSMDEF_S_PRESERVED, - - /* WebRTC States */ - /* MUST be in the same order as PeerConnectionImpl::SignalingState */ - FSMDEF_S_STABLE, - FSMDEF_S_HAVE_LOCAL_OFFER, - FSMDEF_S_HAVE_REMOTE_OFFER, - FSMDEF_S_HAVE_LOCAL_PRANSWER, - FSMDEF_S_HAVE_REMOTE_PRANSWER, - FSMDEF_S_CLOSED, - - FSMDEF_S_MAX -} fsmdef_states_t; - -const char * fsmdef_state_name (int state); - -#endif diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp index da3831eca534..d4b9c07e0909 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp @@ -13,7 +13,6 @@ extern "C" { #include "ccapi_call.h" #include "ccapi_call_info.h" -#include "fsmdef_states.h" } static const char* logTag = "CC_SIPCCCallInfo"; @@ -57,16 +56,6 @@ cc_call_state_t CC_SIPCCCallInfo::getCallState() return CCAPI_CallInfo_getCallState(callinfo_ref); } -fsmdef_states_t CC_SIPCCCallInfo::getFsmState() const -{ - return CCAPI_CallInfo_getFsmState(callinfo_ref); -} - -std::string CC_SIPCCCallInfo::fsmStateToString (fsmdef_states_t state) const -{ - return fsmdef_state_name(state); -} - std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state) { std::string statestr = ""; diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h index 80269bc4522d..32b1505a0c47 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h @@ -35,7 +35,6 @@ namespace CSF ~CC_SIPCCCallInfo (); cc_call_state_t getCallState (); - fsmdef_states_t getFsmState () const; bool getRingerState(); virtual cc_call_attr_t getCallAttr(); @@ -43,7 +42,6 @@ namespace CSF virtual CC_LinePtr getline (); virtual std::string callStateToString (cc_call_state_t state); - virtual std::string fsmStateToString (fsmdef_states_t state) const; virtual std::string callEventToString (ccapi_call_event_e callEvent); virtual cc_call_type_t getCallType(); virtual std::string getCalledPartyName(); From 26061c26cdd5537c4ad7bc629fe9dae1505b482c Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Thu, 6 Jun 2013 15:14:44 -0700 Subject: [PATCH 39/93] Bug 875610 - Find in page throws r=mbrubeck --HG-- extra : rebase_source : 84798bac6fb2a9c7ee03bd11e311bc7bbc66f2e9 --- browser/metro/base/content/contenthandlers/FindHandler.js | 3 +++ browser/metro/base/content/helperui/FindHelperUI.js | 8 ++++++-- browser/metro/base/content/helperui/FormHelperUI.js | 3 --- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/browser/metro/base/content/contenthandlers/FindHandler.js b/browser/metro/base/content/contenthandlers/FindHandler.js index a72b33b39ff3..3fa855582437 100644 --- a/browser/metro/base/content/contenthandlers/FindHandler.js +++ b/browser/metro/base/content/contenthandlers/FindHandler.js @@ -40,6 +40,9 @@ var FindHandler = { return; } + if (!this._fastFind.currentWindow) + return; + let selection = this._fastFind.currentWindow.getSelection(); if (!selection.rangeCount || selection.isCollapsed) { // The selection can be into an input or a textarea element diff --git a/browser/metro/base/content/helperui/FindHelperUI.js b/browser/metro/base/content/helperui/FindHelperUI.js index 69b04b4661d1..15aae5e59aa4 100644 --- a/browser/metro/base/content/helperui/FindHelperUI.js +++ b/browser/metro/base/content/helperui/FindHelperUI.js @@ -3,6 +3,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/. */ +/* We don't support zooming yet, disable Animated zoom by clamping it to the default zoom. */ +const kBrowserFindZoomLevelMin = 1; +const kBrowserFindZoomLevelMax = 1; + var FindHelperUI = { type: "find", commands: { @@ -175,8 +179,8 @@ var FindHelperUI = { // Clamp the zoom level relatively to the default zoom level of the page let defaultZoomLevel = Browser.selectedTab.getDefaultZoomLevel(); - zoomLevel = Util.clamp(zoomLevel, (defaultZoomLevel * kBrowserFormZoomLevelMin), - (defaultZoomLevel * kBrowserFormZoomLevelMax)); + zoomLevel = Util.clamp(zoomLevel, (defaultZoomLevel * kBrowserFindZoomLevelMin), + (defaultZoomLevel * kBrowserFindZoomLevelMax)); zoomLevel = Browser.selectedTab.clampZoomLevel(zoomLevel); let zoomRect = Browser._getZoomRectForPoint(aElementRect.center().x, aElementRect.y, zoomLevel); diff --git a/browser/metro/base/content/helperui/FormHelperUI.js b/browser/metro/base/content/helperui/FormHelperUI.js index a381375e8cb4..c0c745b1f6d2 100644 --- a/browser/metro/base/content/helperui/FormHelperUI.js +++ b/browser/metro/base/content/helperui/FormHelperUI.js @@ -8,9 +8,6 @@ * - Provides autocomplete box for input fields. */ -const kBrowserFormZoomLevelMin = 0.8; -const kBrowserFormZoomLevelMax = 2.0; - var FormHelperUI = { _debugEvents: false, _currentBrowser: null, From 9ee04e3dc610541128a911af5dbd196f86bfe8ce Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 6 Jun 2013 19:10:46 -0400 Subject: [PATCH 40/93] Bug 879941 - Fix typo in LightweightThemeManager.jsm. r=Unfocused --HG-- extra : rebase_source : b1c77d825c620887b7b9bcbdb3e32150dd99f200 --- toolkit/mozapps/extensions/LightweightThemeManager.jsm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index 8ea29e427040..926e29e7ca8c 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -67,7 +67,7 @@ this.__defineSetter__("_maxUsedThemes", function maxUsedThemesSetter(aVal) { // events so cached AddonWrapper instances can return correct values for // permissions and pendingOperations var _themeIDBeingEnabled = null; -var _themeIDBeingDisbled = null; +var _themeIDBeingDisabled = null; this.LightweightThemeManager = { get usedThemes () { @@ -315,7 +315,7 @@ this.LightweightThemeManager = { if (current) { if (current.id == id) return; - _themeIDBeingDisbled = current.id; + _themeIDBeingDisabled = current.id; let wrapper = new AddonWrapper(current); if (aPendingRestart) { Services.prefs.setCharPref(PREF_LWTHEME_TO_SELECT, ""); @@ -326,7 +326,7 @@ this.LightweightThemeManager = { this.themeChanged(null); AddonManagerPrivate.callAddonListeners("onDisabled", wrapper); } - _themeIDBeingDisbled = null; + _themeIDBeingDisabled = null; } if (id) { @@ -474,7 +474,7 @@ function AddonWrapper(aTheme) { this.__defineGetter__("userDisabled", function AddonWrapper_userDisabledGetter() { if (_themeIDBeingEnabled == aTheme.id) return false; - if (_themeIDBeingDisbled == aTheme.id) + if (_themeIDBeingDisabled == aTheme.id) return true; try { From 4571c70459ed4b0c9f26c0356e5559184bb05c90 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Thu, 6 Jun 2013 16:11:58 -0700 Subject: [PATCH 41/93] Bug 797529 - Make SpecialPowers compatible with B2G compartment sharing, r=khuey --- testing/specialpowers/components/SpecialPowersObserver.js | 3 +-- testing/specialpowers/content/SpecialPowersObserverAPI.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/testing/specialpowers/components/SpecialPowersObserver.js b/testing/specialpowers/components/SpecialPowersObserver.js index 934ed3cc9c13..219f74dbe16d 100644 --- a/testing/specialpowers/components/SpecialPowersObserver.js +++ b/testing/specialpowers/components/SpecialPowersObserver.js @@ -25,9 +25,8 @@ var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getService(Components.interfaces.mozIJSSubScriptLoader); loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js"); - /* XPCOM gunk */ -function SpecialPowersObserver() { +this.SpecialPowersObserver = function SpecialPowersObserver() { this._isFrameScriptLoaded = false; this._messageManager = Cc["@mozilla.org/globalmessagemanager;1"]. getService(Ci.nsIMessageBroadcaster); diff --git a/testing/specialpowers/content/SpecialPowersObserverAPI.js b/testing/specialpowers/content/SpecialPowersObserverAPI.js index 6b8d396dd7cc..a10c68bbf72f 100644 --- a/testing/specialpowers/content/SpecialPowersObserverAPI.js +++ b/testing/specialpowers/content/SpecialPowersObserverAPI.js @@ -16,7 +16,7 @@ SpecialPowersException.prototype.toString = function() { return this.name + ': "' + this.message + '"'; }; -function SpecialPowersObserverAPI() { +this.SpecialPowersObserverAPI = function SpecialPowersObserverAPI() { this._crashDumpDir = null; this._processCrashObserversRegistered = false; } From f7a33ed7756c1a60e3fabf495342cc8ad3f0e675 Mon Sep 17 00:00:00 2001 From: William Lachance Date: Tue, 14 May 2013 16:54:07 -0400 Subject: [PATCH 42/93] Bug 797529 - Remove dependence on debugger server, r=jgriffin --HG-- rename : testing/marionette/marionette-actors.js => testing/marionette/marionette-server.js --- .../components/marionettecomponent.js | 57 ++-- testing/marionette/jar.mn | 2 +- testing/marionette/marionette-listener.js | 5 + testing/marionette/marionette-log-obj.js | 2 +- ...ionette-actors.js => marionette-server.js} | 292 ++++++++++-------- testing/marionette/marionette-simpletest.js | 2 +- 6 files changed, 185 insertions(+), 175 deletions(-) rename testing/marionette/{marionette-actors.js => marionette-server.js} (91%) diff --git a/testing/marionette/components/marionettecomponent.js b/testing/marionette/components/marionettecomponent.js index 0206326c7f1a..36ec3fc9a852 100644 --- a/testing/marionette/components/marionettecomponent.js +++ b/testing/marionette/components/marionettecomponent.js @@ -2,31 +2,35 @@ * 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/. */ -const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu} = Components; +this.CC = Components.Constructor; +this.Cc = Components.classes; +this.Ci = Components.interfaces; +this.Cu = Components.utils; const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1"; const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}"); -const DEBUGGER_ENABLED_PREF = 'devtools.debugger.remote-enabled'; const MARIONETTE_ENABLED_PREF = 'marionette.defaultPrefs.enabled'; -const DEBUGGER_FORCELOCAL_PREF = 'devtools.debugger.force-local'; const MARIONETTE_FORCELOCAL_PREF = 'marionette.force-local'; -const ServerSocket = CC("@mozilla.org/network/server-socket;1", - "nsIServerSocket", - "initSpecialConnection"); +this.ServerSocket = CC("@mozilla.org/network/server-socket;1", + "nsIServerSocket", + "initSpecialConnection"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/services-common/log4moz.js"); +let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Ci.mozIJSSubScriptLoader); + function MarionetteComponent() { this._loaded = false; // set up the logger this.logger = Log4Moz.repository.getLogger("Marionette"); - this.logger.level = Log4Moz.Level["INFO"]; + this.logger.level = Log4Moz.Level["Info"]; let logf = FileUtils.getFile('ProfD', ['marionette.log']); - + let formatter = new Log4Moz.BasicFormatter(); this.logger.addAppender(new Log4Moz.RotatingFileAppender(logf, formatter)); this.logger.addAppender(new Log4Moz.DumpAppender(formatter)); @@ -74,22 +78,17 @@ MarionetteComponent.prototype = { this.logger.info("marionette initializing at " + aTopic); observerService.removeObserver(this, aTopic); - try { - this.original_forcelocal = Services.prefs.getBoolPref(DEBUGGER_FORCELOCAL_PREF); - } - catch(e) {} - let marionette_forcelocal = this.appName == 'B2G' ? false : true; try { marionette_forcelocal = Services.prefs.getBoolPref(MARIONETTE_FORCELOCAL_PREF); } catch(e) {} - Services.prefs.setBoolPref(DEBUGGER_FORCELOCAL_PREF, marionette_forcelocal); + Services.prefs.setBoolPref(MARIONETTE_FORCELOCAL_PREF, marionette_forcelocal); if (!marionette_forcelocal) { // See bug 800138. Because the first socket that opens with // force-local=false fails, we open a dummy socket that will fail. - // keepWhenOffline=true so that it still work when offline (local). + // keepWhenOffline=true so that it still work when offline (local). // This allows the following attempt by Marionette to open a socket // to succeed. let insaneSacrificialGoat = new ServerSocket(666, Ci.nsIServerSocket.KeepWhenOffline, 4); @@ -116,28 +115,10 @@ MarionetteComponent.prototype = { port = 2828; } try { - Cu.import('resource://gre/modules/devtools/dbg-server.jsm'); - DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js'); - // This pref is required for the remote debugger to open a socket, - // so force it to true. See bug 761252. - - let original = false; - try { - original = Services.prefs.getBoolPref(DEBUGGER_ENABLED_PREF); - } - catch(e) { } - Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, true); - - // Always allow remote connections. - DebuggerServer.initTransport(function () { return true; }); - DebuggerServer.openListener(port); - - Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, original); - if (this.original_forcelocal != null) { - Services.prefs.setBoolPref(DEBUGGER_FORCELOCAL_PREF, - this.original_forcelocal); - } - this.logger.info("marionette listener opened"); + loader.loadSubScript("chrome://marionette/content/marionette-server.js"); + let forceLocal = Services.prefs.getBoolPref(MARIONETTE_FORCELOCAL_PREF); + this._marionetteServer = new MarionetteServer(port, forceLocal); + this.logger.info("Marionette server ready"); } catch(e) { this.logger.error('exception: ' + e.name + ', ' + e.message); @@ -146,7 +127,7 @@ MarionetteComponent.prototype = { }, uninit: function mc_uninit() { - DebuggerServer.closeListener(); + this._marionetteServer.closeListener(); this._loaded = false; }, diff --git a/testing/marionette/jar.mn b/testing/marionette/jar.mn index c3e76a766b36..e364c31012db 100644 --- a/testing/marionette/jar.mn +++ b/testing/marionette/jar.mn @@ -4,7 +4,7 @@ marionette.jar: % content marionette %content/ - content/marionette-actors.js (marionette-actors.js) + content/marionette-server.js (marionette-server.js) content/marionette-listener.js (marionette-listener.js) content/marionette-elements.js (marionette-elements.js) content/marionette-sendkeys.js (marionette-sendkeys.js) diff --git a/testing/marionette/marionette-listener.js b/testing/marionette/marionette-listener.js index 57ab8b7bb2c4..8b30ef6799a3 100644 --- a/testing/marionette/marionette-listener.js +++ b/testing/marionette/marionette-listener.js @@ -67,6 +67,11 @@ let lastCoordinates = null; let isTap = false; // whether to send mouse event let mouseEventsOnly = false; + +Cu.import("resource://gre/modules/services-common/log4moz.js"); +let logger = Log4Moz.repository.getLogger("Marionette"); +logger.info("loaded marionette-listener.js"); + /** * Called when listener is first started up. * The listener sends its unique window ID and its current URI to the actor. diff --git a/testing/marionette/marionette-log-obj.js b/testing/marionette/marionette-log-obj.js index fdd40e9b7b19..442e4e081536 100644 --- a/testing/marionette/marionette-log-obj.js +++ b/testing/marionette/marionette-log-obj.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/. */ -function MarionetteLogObj() { +this.MarionetteLogObj = function MarionetteLogObj() { this.logs = []; } MarionetteLogObj.prototype = { diff --git a/testing/marionette/marionette-actors.js b/testing/marionette/marionette-server.js similarity index 91% rename from testing/marionette/marionette-actors.js rename to testing/marionette/marionette-server.js index f757ed0ad44c..9950d2b3119e 100644 --- a/testing/marionette/marionette-actors.js +++ b/testing/marionette/marionette-server.js @@ -4,13 +4,12 @@ "use strict"; -/** - * Gecko-specific actors. - */ - const FRAME_SCRIPT = "chrome://marionette/content/marionette-listener.js"; -let {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; +// import logger +Cu.import("resource://gre/modules/services-common/log4moz.js"); +let logger = Log4Moz.repository.getLogger("Marionette"); +logger.info('marionette-server.js loaded'); let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] .getService(Ci.mozIJSSubScriptLoader); @@ -35,10 +34,11 @@ Cu.import("resource://gre/modules/NetUtil.jsm"); Services.prefs.setBoolPref("marionette.contentListener", false); let appName = Services.appinfo.name; -// import logger -Cu.import("resource://gre/modules/services-common/log4moz.js"); -let logger = Log4Moz.repository.getLogger("Marionette"); -logger.info('marionette-actors.js loaded'); +// dumpn needed/used by dbg-transport.js +this.dumpn = function dumpn(str) { + logger.trace(str); +} +loader.loadSubScript("resource://gre/modules/devtools/server/transport.js"); let bypassOffline = false; @@ -65,7 +65,7 @@ if (bypassOffline) { } // This is used to prevent newSession from returning before the telephony -// API's are ready; see bug 792647. This assumes that marionette-actors.js +// API's are ready; see bug 792647. This assumes that marionette-server.js // will be loaded before the 'system-message-listener-ready' message // is fired. If this stops being true, this approach will have to change. let systemMessageListenerReady = false; @@ -73,70 +73,6 @@ Services.obs.addObserver(function() { systemMessageListenerReady = true; }, "system-message-listener-ready", false); -/** - * Creates the root actor once a connection is established - */ - -function createRootActor(aConnection) -{ - return new MarionetteRootActor(aConnection); -} - -/** - * Root actor for Marionette. Add any future actors to its actor pool. - * Implements methods needed by resource:///modules/devtools/dbg-server.jsm - */ - -function MarionetteRootActor(aConnection) -{ - this.conn = aConnection; - this._marionetteActor = new MarionetteDriverActor(this.conn); - this._marionetteActorPool = null; //hold future actors - - this._marionetteActorPool = new ActorPool(this.conn); - this._marionetteActorPool.addActor(this._marionetteActor); - this.conn.addActorPool(this._marionetteActorPool); -} - -MarionetteRootActor.prototype = { - /** - * Called when a client first makes a connection - * - * @return object - * returns the name of the actor, the application type, and any traits - */ - sayHello: function MRA_sayHello() { - return { from: "root", - applicationType: "gecko", - traits: [] }; - }, - - /** - * Called when client disconnects. Cleans up marionette driver actions. - */ - disconnect: function MRA_disconnect() { - this._marionetteActor.deleteSession(); - }, - - /** - * Used to get the running marionette actor, so we can issue commands - * - * @return object - * Returns the ID the client can use to communicate with the - * MarionetteDriverActor - */ - getMarionetteID: function MRA_getMarionette() { - return { "from": "root", - "id": this._marionetteActor.actorID } ; - } -}; - -// register the calls -MarionetteRootActor.prototype.requestTypes = { - "getMarionetteID": MarionetteRootActor.prototype.getMarionetteID, - "sayHello": MarionetteRootActor.prototype.sayHello -}; - /** * An object representing a frame that Marionette has loaded a * frame script in. @@ -173,16 +109,25 @@ function FrameSendFailureError(frame) { } /** - * This actor is responsible for all marionette API calls. It gets created + * The server connection is responsible for all marionette API calls. It gets created * for each connection and manages all chrome and browser based calls. It * mediates content calls by issuing appropriate messages to the content process. */ -function MarionetteDriverActor(aConnection) +function MarionetteServerConnection(aPrefix, aTransport, aServer) { this.uuidGen = Cc["@mozilla.org/uuid-generator;1"] .getService(Ci.nsIUUIDGenerator); - this.conn = aConnection; + this.prefix = aPrefix; + this.server = aServer; + this.conn = aTransport; + this.conn.hooks = this; + + // marionette uses a protocol based on the debugger server, which requires + // passing back "actor ids" with responses. unlike the debugger server, + // we don't have multiple actors, so just use a dummy value of "0" here + this.actorID = "0"; + this.globalMessageManager = Cc["@mozilla.org/globalmessagemanager;1"] .getService(Ci.nsIMessageBroadcaster); this.messageManager = this.globalMessageManager; @@ -206,10 +151,33 @@ function MarionetteDriverActor(aConnection) this.addMessageManagerListeners(this.messageManager); } -MarionetteDriverActor.prototype = { +MarionetteServerConnection.prototype = { - //name of the actor - actorPrefix: "marionette", + /** + * Debugger transport callbacks: + */ + onPacket: function MSC_onPacket(aPacket) { + // Dispatch the request + if (this.requestTypes && this.requestTypes[aPacket.type]) { + try { + this.requestTypes[aPacket.type].bind(this)(aPacket); + } catch(e) { + this.conn.send({ error: ("error occurred while processing '" + + aPacket.type), + message: e }); + } + } else { + this.conn.send({ error: "unrecognizedPacketType", + message: ('Marionette does not ' + + 'recognize the packet type "' + + aPacket.type + '"') }); + } + }, + + onClosed: function MSC_onClosed(aStatus) { + this.server._connectionClosed(this); + this.deleteSession(); + }, /** * Helper methods: @@ -370,6 +338,16 @@ MarionetteDriverActor.prototype = { this.sendToClient({from:this.actorID, value: value}, command_id); }, + sayHello: function MDA_sayHello() { + this.conn.send({ from: "root", + applicationType: "gecko", + traits: [] }); + }, + + getMarionetteID: function MDA_getMarionette() { + this.conn.send({ "from": "root", "id": this.actorID }); + }, + /** * Send ack to client * @@ -2187,60 +2165,62 @@ MarionetteDriverActor.prototype = { } }; -MarionetteDriverActor.prototype.requestTypes = { - "newSession": MarionetteDriverActor.prototype.newSession, - "getSessionCapabilities": MarionetteDriverActor.prototype.getSessionCapabilities, - "getStatus": MarionetteDriverActor.prototype.getStatus, - "log": MarionetteDriverActor.prototype.log, - "getLogs": MarionetteDriverActor.prototype.getLogs, - "setContext": MarionetteDriverActor.prototype.setContext, - "executeScript": MarionetteDriverActor.prototype.execute, - "setScriptTimeout": MarionetteDriverActor.prototype.setScriptTimeout, - "timeouts": MarionetteDriverActor.prototype.timeouts, - "singleTap": MarionetteDriverActor.prototype.singleTap, - "actionChain": MarionetteDriverActor.prototype.actionChain, - "multiAction": MarionetteDriverActor.prototype.multiAction, - "executeAsyncScript": MarionetteDriverActor.prototype.executeWithCallback, - "executeJSScript": MarionetteDriverActor.prototype.executeJSScript, - "setSearchTimeout": MarionetteDriverActor.prototype.setSearchTimeout, - "findElement": MarionetteDriverActor.prototype.findElement, - "findElements": MarionetteDriverActor.prototype.findElements, - "clickElement": MarionetteDriverActor.prototype.clickElement, - "getElementAttribute": MarionetteDriverActor.prototype.getElementAttribute, - "getElementText": MarionetteDriverActor.prototype.getElementText, - "getElementTagName": MarionetteDriverActor.prototype.getElementTagName, - "isElementDisplayed": MarionetteDriverActor.prototype.isElementDisplayed, - "getElementValueOfCssProperty": MarionetteDriverActor.prototype.getElementValueOfCssProperty, - "getElementSize": MarionetteDriverActor.prototype.getElementSize, - "isElementEnabled": MarionetteDriverActor.prototype.isElementEnabled, - "isElementSelected": MarionetteDriverActor.prototype.isElementSelected, - "sendKeysToElement": MarionetteDriverActor.prototype.sendKeysToElement, - "getElementPosition": MarionetteDriverActor.prototype.getElementPosition, - "clearElement": MarionetteDriverActor.prototype.clearElement, - "getTitle": MarionetteDriverActor.prototype.getTitle, - "getWindowType": MarionetteDriverActor.prototype.getWindowType, - "getPageSource": MarionetteDriverActor.prototype.getPageSource, - "goUrl": MarionetteDriverActor.prototype.goUrl, - "getUrl": MarionetteDriverActor.prototype.getUrl, - "goBack": MarionetteDriverActor.prototype.goBack, - "goForward": MarionetteDriverActor.prototype.goForward, - "refresh": MarionetteDriverActor.prototype.refresh, - "getWindow": MarionetteDriverActor.prototype.getWindow, - "getWindows": MarionetteDriverActor.prototype.getWindows, - "switchToFrame": MarionetteDriverActor.prototype.switchToFrame, - "switchToWindow": MarionetteDriverActor.prototype.switchToWindow, - "deleteSession": MarionetteDriverActor.prototype.deleteSession, - "emulatorCmdResult": MarionetteDriverActor.prototype.emulatorCmdResult, - "importScript": MarionetteDriverActor.prototype.importScript, - "getAppCacheStatus": MarionetteDriverActor.prototype.getAppCacheStatus, - "closeWindow": MarionetteDriverActor.prototype.closeWindow, - "setTestName": MarionetteDriverActor.prototype.setTestName, - "screenShot": MarionetteDriverActor.prototype.screenShot, - "addCookie": MarionetteDriverActor.prototype.addCookie, - "getAllCookies": MarionetteDriverActor.prototype.getAllCookies, - "deleteAllCookies": MarionetteDriverActor.prototype.deleteAllCookies, - "deleteCookie": MarionetteDriverActor.prototype.deleteCookie, - "getActiveElement": MarionetteDriverActor.prototype.getActiveElement +MarionetteServerConnection.prototype.requestTypes = { + "getMarionetteID": MarionetteServerConnection.prototype.getMarionetteID, + "sayHello": MarionetteServerConnection.prototype.sayHello, + "newSession": MarionetteServerConnection.prototype.newSession, + "getSessionCapabilities": MarionetteServerConnection.prototype.getSessionCapabilities, + "getStatus": MarionetteServerConnection.prototype.getStatus, + "log": MarionetteServerConnection.prototype.log, + "getLogs": MarionetteServerConnection.prototype.getLogs, + "setContext": MarionetteServerConnection.prototype.setContext, + "executeScript": MarionetteServerConnection.prototype.execute, + "setScriptTimeout": MarionetteServerConnection.prototype.setScriptTimeout, + "timeouts": MarionetteServerConnection.prototype.timeouts, + "singleTap": MarionetteServerConnection.prototype.singleTap, + "actionChain": MarionetteServerConnection.prototype.actionChain, + "multiAction": MarionetteServerConnection.prototype.multiAction, + "executeAsyncScript": MarionetteServerConnection.prototype.executeWithCallback, + "executeJSScript": MarionetteServerConnection.prototype.executeJSScript, + "setSearchTimeout": MarionetteServerConnection.prototype.setSearchTimeout, + "findElement": MarionetteServerConnection.prototype.findElement, + "findElements": MarionetteServerConnection.prototype.findElements, + "clickElement": MarionetteServerConnection.prototype.clickElement, + "getElementAttribute": MarionetteServerConnection.prototype.getElementAttribute, + "getElementText": MarionetteServerConnection.prototype.getElementText, + "getElementTagName": MarionetteServerConnection.prototype.getElementTagName, + "isElementDisplayed": MarionetteServerConnection.prototype.isElementDisplayed, + "getElementValueOfCssProperty": MarionetteServerConnection.prototype.getElementValueOfCssProperty, + "getElementSize": MarionetteServerConnection.prototype.getElementSize, + "isElementEnabled": MarionetteServerConnection.prototype.isElementEnabled, + "isElementSelected": MarionetteServerConnection.prototype.isElementSelected, + "sendKeysToElement": MarionetteServerConnection.prototype.sendKeysToElement, + "getElementPosition": MarionetteServerConnection.prototype.getElementPosition, + "clearElement": MarionetteServerConnection.prototype.clearElement, + "getTitle": MarionetteServerConnection.prototype.getTitle, + "getWindowType": MarionetteServerConnection.prototype.getWindowType, + "getPageSource": MarionetteServerConnection.prototype.getPageSource, + "goUrl": MarionetteServerConnection.prototype.goUrl, + "getUrl": MarionetteServerConnection.prototype.getUrl, + "goBack": MarionetteServerConnection.prototype.goBack, + "goForward": MarionetteServerConnection.prototype.goForward, + "refresh": MarionetteServerConnection.prototype.refresh, + "getWindow": MarionetteServerConnection.prototype.getWindow, + "getWindows": MarionetteServerConnection.prototype.getWindows, + "switchToFrame": MarionetteServerConnection.prototype.switchToFrame, + "switchToWindow": MarionetteServerConnection.prototype.switchToWindow, + "deleteSession": MarionetteServerConnection.prototype.deleteSession, + "emulatorCmdResult": MarionetteServerConnection.prototype.emulatorCmdResult, + "importScript": MarionetteServerConnection.prototype.importScript, + "getAppCacheStatus": MarionetteServerConnection.prototype.getAppCacheStatus, + "closeWindow": MarionetteServerConnection.prototype.closeWindow, + "setTestName": MarionetteServerConnection.prototype.setTestName, + "screenShot": MarionetteServerConnection.prototype.screenShot, + "addCookie": MarionetteServerConnection.prototype.addCookie, + "getAllCookies": MarionetteServerConnection.prototype.getAllCookies, + "deleteAllCookies": MarionetteServerConnection.prototype.deleteAllCookies, + "deleteCookie": MarionetteServerConnection.prototype.deleteCookie, + "getActiveElement": MarionetteServerConnection.prototype.getActiveElement }; /** @@ -2378,3 +2358,47 @@ BrowserObj.prototype = { return uid; }, } + +/** + * Marionette server -- this class holds a reference to a socket and creates + * MarionetteServerConnection objects as needed. + */ +this.MarionetteServer = function MarionetteServer(port, forceLocal) { + let flags = Ci.nsIServerSocket.KeepWhenOffline; + if (forceLocal) { + flags |= Ci.nsIServerSocket.LoopbackOnly; + } + let socket = new ServerSocket(port, flags, 4); + logger.info("Listening on port " + socket.port + "\n"); + socket.asyncListen(this); + this.listener = socket; + this.nextConnId = 0; + this.connections = {}; +}; + +MarionetteServer.prototype = { + onSocketAccepted: function(serverSocket, clientSocket) + { + logger.debug("accepted connection on " + clientSocket.host + ":" + clientSocket.port); + + let input = clientSocket.openInputStream(0, 0, 0); + let output = clientSocket.openOutputStream(0, 0, 0); + let aTransport = new DebuggerTransport(input, output); + let connID = "conn" + this.nextConnID++ + '.'; + let conn = new MarionetteServerConnection(connID, aTransport, this); + this.connections[connID] = conn; + + // Create a root actor for the connection and send the hello packet. + conn.sayHello(); + aTransport.ready(); + }, + + closeListener: function() { + this.listener.close(); + this.listener = null; + }, + + _connectionClosed: function DS_connectionClosed(aConnection) { + delete this.connections[aConnection.prefix]; + } +}; diff --git a/testing/marionette/marionette-simpletest.js b/testing/marionette/marionette-simpletest.js index 5e3039b00afd..063e99e1188c 100644 --- a/testing/marionette/marionette-simpletest.js +++ b/testing/marionette/marionette-simpletest.js @@ -5,7 +5,7 @@ * The Marionette object, passed to the script context. */ -function Marionette(scope, window, context, logObj, timeout, testName) { +this.Marionette = function Marionette(scope, window, context, logObj, timeout, testName) { this.scope = scope; this.window = window; this.tests = []; From 1d9dd70a76b5239d7a682ea9e0db823f5800883a Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Thu, 6 Jun 2013 16:29:50 -0700 Subject: [PATCH 43/93] Bug 880361 - Fix "browser is undefined" error in FullZoom when immediately closing a newly opened browser window. r=gavin --- browser/base/content/browser-fullZoom.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index c90e74bdff00..90e9e222200e 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -432,14 +432,22 @@ var FullZoom = { * currently selected browser is used. */ _getState: function FullZoom__getState(browser) { - let browser = browser || gBrowser.selectedBrowser; - return { uri: browser.currentURI, token: this._zoomChangeToken }; + browser = browser || gBrowser.selectedBrowser; + return { + // Due to async content pref service callbacks, this method can get called + // after the window has closed, so gBrowser.selectedBrowser may be null. + uri: browser ? browser.currentURI : null, + token: this._zoomChangeToken, + }; }, /** * Returns true if the given state is current. */ _isStateCurrent: function FullZoom__isStateCurrent(state) { + // If either state has no URI, then the given state can't be current. + // currState.uri will be null when this method is called after the window + // has closed, which can happen due to async content pref service callbacks. let currState = this._getState(); return currState.token === state.token && currState.uri && state.uri && From 9d31038cec1dd55826bb987ad892583d9bf44021 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Thu, 6 Jun 2013 17:26:39 -0700 Subject: [PATCH 44/93] Backout 36b68f9e4e04 for bustage (Bug 797529) --- .../components/marionettecomponent.js | 57 ++-- testing/marionette/jar.mn | 2 +- ...ionette-server.js => marionette-actors.js} | 292 ++++++++---------- testing/marionette/marionette-listener.js | 5 - testing/marionette/marionette-log-obj.js | 2 +- testing/marionette/marionette-simpletest.js | 2 +- 6 files changed, 175 insertions(+), 185 deletions(-) rename testing/marionette/{marionette-server.js => marionette-actors.js} (91%) diff --git a/testing/marionette/components/marionettecomponent.js b/testing/marionette/components/marionettecomponent.js index 36ec3fc9a852..0206326c7f1a 100644 --- a/testing/marionette/components/marionettecomponent.js +++ b/testing/marionette/components/marionettecomponent.js @@ -2,35 +2,31 @@ * 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/. */ -this.CC = Components.Constructor; -this.Cc = Components.classes; -this.Ci = Components.interfaces; -this.Cu = Components.utils; +const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu} = Components; const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1"; const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}"); +const DEBUGGER_ENABLED_PREF = 'devtools.debugger.remote-enabled'; const MARIONETTE_ENABLED_PREF = 'marionette.defaultPrefs.enabled'; +const DEBUGGER_FORCELOCAL_PREF = 'devtools.debugger.force-local'; const MARIONETTE_FORCELOCAL_PREF = 'marionette.force-local'; -this.ServerSocket = CC("@mozilla.org/network/server-socket;1", - "nsIServerSocket", - "initSpecialConnection"); +const ServerSocket = CC("@mozilla.org/network/server-socket;1", + "nsIServerSocket", + "initSpecialConnection"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/services-common/log4moz.js"); -let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Ci.mozIJSSubScriptLoader); - function MarionetteComponent() { this._loaded = false; // set up the logger this.logger = Log4Moz.repository.getLogger("Marionette"); - this.logger.level = Log4Moz.Level["Info"]; + this.logger.level = Log4Moz.Level["INFO"]; let logf = FileUtils.getFile('ProfD', ['marionette.log']); - + let formatter = new Log4Moz.BasicFormatter(); this.logger.addAppender(new Log4Moz.RotatingFileAppender(logf, formatter)); this.logger.addAppender(new Log4Moz.DumpAppender(formatter)); @@ -78,17 +74,22 @@ MarionetteComponent.prototype = { this.logger.info("marionette initializing at " + aTopic); observerService.removeObserver(this, aTopic); + try { + this.original_forcelocal = Services.prefs.getBoolPref(DEBUGGER_FORCELOCAL_PREF); + } + catch(e) {} + let marionette_forcelocal = this.appName == 'B2G' ? false : true; try { marionette_forcelocal = Services.prefs.getBoolPref(MARIONETTE_FORCELOCAL_PREF); } catch(e) {} - Services.prefs.setBoolPref(MARIONETTE_FORCELOCAL_PREF, marionette_forcelocal); + Services.prefs.setBoolPref(DEBUGGER_FORCELOCAL_PREF, marionette_forcelocal); if (!marionette_forcelocal) { // See bug 800138. Because the first socket that opens with // force-local=false fails, we open a dummy socket that will fail. - // keepWhenOffline=true so that it still work when offline (local). + // keepWhenOffline=true so that it still work when offline (local). // This allows the following attempt by Marionette to open a socket // to succeed. let insaneSacrificialGoat = new ServerSocket(666, Ci.nsIServerSocket.KeepWhenOffline, 4); @@ -115,10 +116,28 @@ MarionetteComponent.prototype = { port = 2828; } try { - loader.loadSubScript("chrome://marionette/content/marionette-server.js"); - let forceLocal = Services.prefs.getBoolPref(MARIONETTE_FORCELOCAL_PREF); - this._marionetteServer = new MarionetteServer(port, forceLocal); - this.logger.info("Marionette server ready"); + Cu.import('resource://gre/modules/devtools/dbg-server.jsm'); + DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js'); + // This pref is required for the remote debugger to open a socket, + // so force it to true. See bug 761252. + + let original = false; + try { + original = Services.prefs.getBoolPref(DEBUGGER_ENABLED_PREF); + } + catch(e) { } + Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, true); + + // Always allow remote connections. + DebuggerServer.initTransport(function () { return true; }); + DebuggerServer.openListener(port); + + Services.prefs.setBoolPref(DEBUGGER_ENABLED_PREF, original); + if (this.original_forcelocal != null) { + Services.prefs.setBoolPref(DEBUGGER_FORCELOCAL_PREF, + this.original_forcelocal); + } + this.logger.info("marionette listener opened"); } catch(e) { this.logger.error('exception: ' + e.name + ', ' + e.message); @@ -127,7 +146,7 @@ MarionetteComponent.prototype = { }, uninit: function mc_uninit() { - this._marionetteServer.closeListener(); + DebuggerServer.closeListener(); this._loaded = false; }, diff --git a/testing/marionette/jar.mn b/testing/marionette/jar.mn index e364c31012db..c3e76a766b36 100644 --- a/testing/marionette/jar.mn +++ b/testing/marionette/jar.mn @@ -4,7 +4,7 @@ marionette.jar: % content marionette %content/ - content/marionette-server.js (marionette-server.js) + content/marionette-actors.js (marionette-actors.js) content/marionette-listener.js (marionette-listener.js) content/marionette-elements.js (marionette-elements.js) content/marionette-sendkeys.js (marionette-sendkeys.js) diff --git a/testing/marionette/marionette-server.js b/testing/marionette/marionette-actors.js similarity index 91% rename from testing/marionette/marionette-server.js rename to testing/marionette/marionette-actors.js index 9950d2b3119e..f757ed0ad44c 100644 --- a/testing/marionette/marionette-server.js +++ b/testing/marionette/marionette-actors.js @@ -4,12 +4,13 @@ "use strict"; +/** + * Gecko-specific actors. + */ + const FRAME_SCRIPT = "chrome://marionette/content/marionette-listener.js"; -// import logger -Cu.import("resource://gre/modules/services-common/log4moz.js"); -let logger = Log4Moz.repository.getLogger("Marionette"); -logger.info('marionette-server.js loaded'); +let {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] .getService(Ci.mozIJSSubScriptLoader); @@ -34,11 +35,10 @@ Cu.import("resource://gre/modules/NetUtil.jsm"); Services.prefs.setBoolPref("marionette.contentListener", false); let appName = Services.appinfo.name; -// dumpn needed/used by dbg-transport.js -this.dumpn = function dumpn(str) { - logger.trace(str); -} -loader.loadSubScript("resource://gre/modules/devtools/server/transport.js"); +// import logger +Cu.import("resource://gre/modules/services-common/log4moz.js"); +let logger = Log4Moz.repository.getLogger("Marionette"); +logger.info('marionette-actors.js loaded'); let bypassOffline = false; @@ -65,7 +65,7 @@ if (bypassOffline) { } // This is used to prevent newSession from returning before the telephony -// API's are ready; see bug 792647. This assumes that marionette-server.js +// API's are ready; see bug 792647. This assumes that marionette-actors.js // will be loaded before the 'system-message-listener-ready' message // is fired. If this stops being true, this approach will have to change. let systemMessageListenerReady = false; @@ -73,6 +73,70 @@ Services.obs.addObserver(function() { systemMessageListenerReady = true; }, "system-message-listener-ready", false); +/** + * Creates the root actor once a connection is established + */ + +function createRootActor(aConnection) +{ + return new MarionetteRootActor(aConnection); +} + +/** + * Root actor for Marionette. Add any future actors to its actor pool. + * Implements methods needed by resource:///modules/devtools/dbg-server.jsm + */ + +function MarionetteRootActor(aConnection) +{ + this.conn = aConnection; + this._marionetteActor = new MarionetteDriverActor(this.conn); + this._marionetteActorPool = null; //hold future actors + + this._marionetteActorPool = new ActorPool(this.conn); + this._marionetteActorPool.addActor(this._marionetteActor); + this.conn.addActorPool(this._marionetteActorPool); +} + +MarionetteRootActor.prototype = { + /** + * Called when a client first makes a connection + * + * @return object + * returns the name of the actor, the application type, and any traits + */ + sayHello: function MRA_sayHello() { + return { from: "root", + applicationType: "gecko", + traits: [] }; + }, + + /** + * Called when client disconnects. Cleans up marionette driver actions. + */ + disconnect: function MRA_disconnect() { + this._marionetteActor.deleteSession(); + }, + + /** + * Used to get the running marionette actor, so we can issue commands + * + * @return object + * Returns the ID the client can use to communicate with the + * MarionetteDriverActor + */ + getMarionetteID: function MRA_getMarionette() { + return { "from": "root", + "id": this._marionetteActor.actorID } ; + } +}; + +// register the calls +MarionetteRootActor.prototype.requestTypes = { + "getMarionetteID": MarionetteRootActor.prototype.getMarionetteID, + "sayHello": MarionetteRootActor.prototype.sayHello +}; + /** * An object representing a frame that Marionette has loaded a * frame script in. @@ -109,25 +173,16 @@ function FrameSendFailureError(frame) { } /** - * The server connection is responsible for all marionette API calls. It gets created + * This actor is responsible for all marionette API calls. It gets created * for each connection and manages all chrome and browser based calls. It * mediates content calls by issuing appropriate messages to the content process. */ -function MarionetteServerConnection(aPrefix, aTransport, aServer) +function MarionetteDriverActor(aConnection) { this.uuidGen = Cc["@mozilla.org/uuid-generator;1"] .getService(Ci.nsIUUIDGenerator); - this.prefix = aPrefix; - this.server = aServer; - this.conn = aTransport; - this.conn.hooks = this; - - // marionette uses a protocol based on the debugger server, which requires - // passing back "actor ids" with responses. unlike the debugger server, - // we don't have multiple actors, so just use a dummy value of "0" here - this.actorID = "0"; - + this.conn = aConnection; this.globalMessageManager = Cc["@mozilla.org/globalmessagemanager;1"] .getService(Ci.nsIMessageBroadcaster); this.messageManager = this.globalMessageManager; @@ -151,33 +206,10 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer) this.addMessageManagerListeners(this.messageManager); } -MarionetteServerConnection.prototype = { +MarionetteDriverActor.prototype = { - /** - * Debugger transport callbacks: - */ - onPacket: function MSC_onPacket(aPacket) { - // Dispatch the request - if (this.requestTypes && this.requestTypes[aPacket.type]) { - try { - this.requestTypes[aPacket.type].bind(this)(aPacket); - } catch(e) { - this.conn.send({ error: ("error occurred while processing '" + - aPacket.type), - message: e }); - } - } else { - this.conn.send({ error: "unrecognizedPacketType", - message: ('Marionette does not ' + - 'recognize the packet type "' + - aPacket.type + '"') }); - } - }, - - onClosed: function MSC_onClosed(aStatus) { - this.server._connectionClosed(this); - this.deleteSession(); - }, + //name of the actor + actorPrefix: "marionette", /** * Helper methods: @@ -338,16 +370,6 @@ MarionetteServerConnection.prototype = { this.sendToClient({from:this.actorID, value: value}, command_id); }, - sayHello: function MDA_sayHello() { - this.conn.send({ from: "root", - applicationType: "gecko", - traits: [] }); - }, - - getMarionetteID: function MDA_getMarionette() { - this.conn.send({ "from": "root", "id": this.actorID }); - }, - /** * Send ack to client * @@ -2165,62 +2187,60 @@ MarionetteServerConnection.prototype = { } }; -MarionetteServerConnection.prototype.requestTypes = { - "getMarionetteID": MarionetteServerConnection.prototype.getMarionetteID, - "sayHello": MarionetteServerConnection.prototype.sayHello, - "newSession": MarionetteServerConnection.prototype.newSession, - "getSessionCapabilities": MarionetteServerConnection.prototype.getSessionCapabilities, - "getStatus": MarionetteServerConnection.prototype.getStatus, - "log": MarionetteServerConnection.prototype.log, - "getLogs": MarionetteServerConnection.prototype.getLogs, - "setContext": MarionetteServerConnection.prototype.setContext, - "executeScript": MarionetteServerConnection.prototype.execute, - "setScriptTimeout": MarionetteServerConnection.prototype.setScriptTimeout, - "timeouts": MarionetteServerConnection.prototype.timeouts, - "singleTap": MarionetteServerConnection.prototype.singleTap, - "actionChain": MarionetteServerConnection.prototype.actionChain, - "multiAction": MarionetteServerConnection.prototype.multiAction, - "executeAsyncScript": MarionetteServerConnection.prototype.executeWithCallback, - "executeJSScript": MarionetteServerConnection.prototype.executeJSScript, - "setSearchTimeout": MarionetteServerConnection.prototype.setSearchTimeout, - "findElement": MarionetteServerConnection.prototype.findElement, - "findElements": MarionetteServerConnection.prototype.findElements, - "clickElement": MarionetteServerConnection.prototype.clickElement, - "getElementAttribute": MarionetteServerConnection.prototype.getElementAttribute, - "getElementText": MarionetteServerConnection.prototype.getElementText, - "getElementTagName": MarionetteServerConnection.prototype.getElementTagName, - "isElementDisplayed": MarionetteServerConnection.prototype.isElementDisplayed, - "getElementValueOfCssProperty": MarionetteServerConnection.prototype.getElementValueOfCssProperty, - "getElementSize": MarionetteServerConnection.prototype.getElementSize, - "isElementEnabled": MarionetteServerConnection.prototype.isElementEnabled, - "isElementSelected": MarionetteServerConnection.prototype.isElementSelected, - "sendKeysToElement": MarionetteServerConnection.prototype.sendKeysToElement, - "getElementPosition": MarionetteServerConnection.prototype.getElementPosition, - "clearElement": MarionetteServerConnection.prototype.clearElement, - "getTitle": MarionetteServerConnection.prototype.getTitle, - "getWindowType": MarionetteServerConnection.prototype.getWindowType, - "getPageSource": MarionetteServerConnection.prototype.getPageSource, - "goUrl": MarionetteServerConnection.prototype.goUrl, - "getUrl": MarionetteServerConnection.prototype.getUrl, - "goBack": MarionetteServerConnection.prototype.goBack, - "goForward": MarionetteServerConnection.prototype.goForward, - "refresh": MarionetteServerConnection.prototype.refresh, - "getWindow": MarionetteServerConnection.prototype.getWindow, - "getWindows": MarionetteServerConnection.prototype.getWindows, - "switchToFrame": MarionetteServerConnection.prototype.switchToFrame, - "switchToWindow": MarionetteServerConnection.prototype.switchToWindow, - "deleteSession": MarionetteServerConnection.prototype.deleteSession, - "emulatorCmdResult": MarionetteServerConnection.prototype.emulatorCmdResult, - "importScript": MarionetteServerConnection.prototype.importScript, - "getAppCacheStatus": MarionetteServerConnection.prototype.getAppCacheStatus, - "closeWindow": MarionetteServerConnection.prototype.closeWindow, - "setTestName": MarionetteServerConnection.prototype.setTestName, - "screenShot": MarionetteServerConnection.prototype.screenShot, - "addCookie": MarionetteServerConnection.prototype.addCookie, - "getAllCookies": MarionetteServerConnection.prototype.getAllCookies, - "deleteAllCookies": MarionetteServerConnection.prototype.deleteAllCookies, - "deleteCookie": MarionetteServerConnection.prototype.deleteCookie, - "getActiveElement": MarionetteServerConnection.prototype.getActiveElement +MarionetteDriverActor.prototype.requestTypes = { + "newSession": MarionetteDriverActor.prototype.newSession, + "getSessionCapabilities": MarionetteDriverActor.prototype.getSessionCapabilities, + "getStatus": MarionetteDriverActor.prototype.getStatus, + "log": MarionetteDriverActor.prototype.log, + "getLogs": MarionetteDriverActor.prototype.getLogs, + "setContext": MarionetteDriverActor.prototype.setContext, + "executeScript": MarionetteDriverActor.prototype.execute, + "setScriptTimeout": MarionetteDriverActor.prototype.setScriptTimeout, + "timeouts": MarionetteDriverActor.prototype.timeouts, + "singleTap": MarionetteDriverActor.prototype.singleTap, + "actionChain": MarionetteDriverActor.prototype.actionChain, + "multiAction": MarionetteDriverActor.prototype.multiAction, + "executeAsyncScript": MarionetteDriverActor.prototype.executeWithCallback, + "executeJSScript": MarionetteDriverActor.prototype.executeJSScript, + "setSearchTimeout": MarionetteDriverActor.prototype.setSearchTimeout, + "findElement": MarionetteDriverActor.prototype.findElement, + "findElements": MarionetteDriverActor.prototype.findElements, + "clickElement": MarionetteDriverActor.prototype.clickElement, + "getElementAttribute": MarionetteDriverActor.prototype.getElementAttribute, + "getElementText": MarionetteDriverActor.prototype.getElementText, + "getElementTagName": MarionetteDriverActor.prototype.getElementTagName, + "isElementDisplayed": MarionetteDriverActor.prototype.isElementDisplayed, + "getElementValueOfCssProperty": MarionetteDriverActor.prototype.getElementValueOfCssProperty, + "getElementSize": MarionetteDriverActor.prototype.getElementSize, + "isElementEnabled": MarionetteDriverActor.prototype.isElementEnabled, + "isElementSelected": MarionetteDriverActor.prototype.isElementSelected, + "sendKeysToElement": MarionetteDriverActor.prototype.sendKeysToElement, + "getElementPosition": MarionetteDriverActor.prototype.getElementPosition, + "clearElement": MarionetteDriverActor.prototype.clearElement, + "getTitle": MarionetteDriverActor.prototype.getTitle, + "getWindowType": MarionetteDriverActor.prototype.getWindowType, + "getPageSource": MarionetteDriverActor.prototype.getPageSource, + "goUrl": MarionetteDriverActor.prototype.goUrl, + "getUrl": MarionetteDriverActor.prototype.getUrl, + "goBack": MarionetteDriverActor.prototype.goBack, + "goForward": MarionetteDriverActor.prototype.goForward, + "refresh": MarionetteDriverActor.prototype.refresh, + "getWindow": MarionetteDriverActor.prototype.getWindow, + "getWindows": MarionetteDriverActor.prototype.getWindows, + "switchToFrame": MarionetteDriverActor.prototype.switchToFrame, + "switchToWindow": MarionetteDriverActor.prototype.switchToWindow, + "deleteSession": MarionetteDriverActor.prototype.deleteSession, + "emulatorCmdResult": MarionetteDriverActor.prototype.emulatorCmdResult, + "importScript": MarionetteDriverActor.prototype.importScript, + "getAppCacheStatus": MarionetteDriverActor.prototype.getAppCacheStatus, + "closeWindow": MarionetteDriverActor.prototype.closeWindow, + "setTestName": MarionetteDriverActor.prototype.setTestName, + "screenShot": MarionetteDriverActor.prototype.screenShot, + "addCookie": MarionetteDriverActor.prototype.addCookie, + "getAllCookies": MarionetteDriverActor.prototype.getAllCookies, + "deleteAllCookies": MarionetteDriverActor.prototype.deleteAllCookies, + "deleteCookie": MarionetteDriverActor.prototype.deleteCookie, + "getActiveElement": MarionetteDriverActor.prototype.getActiveElement }; /** @@ -2358,47 +2378,3 @@ BrowserObj.prototype = { return uid; }, } - -/** - * Marionette server -- this class holds a reference to a socket and creates - * MarionetteServerConnection objects as needed. - */ -this.MarionetteServer = function MarionetteServer(port, forceLocal) { - let flags = Ci.nsIServerSocket.KeepWhenOffline; - if (forceLocal) { - flags |= Ci.nsIServerSocket.LoopbackOnly; - } - let socket = new ServerSocket(port, flags, 4); - logger.info("Listening on port " + socket.port + "\n"); - socket.asyncListen(this); - this.listener = socket; - this.nextConnId = 0; - this.connections = {}; -}; - -MarionetteServer.prototype = { - onSocketAccepted: function(serverSocket, clientSocket) - { - logger.debug("accepted connection on " + clientSocket.host + ":" + clientSocket.port); - - let input = clientSocket.openInputStream(0, 0, 0); - let output = clientSocket.openOutputStream(0, 0, 0); - let aTransport = new DebuggerTransport(input, output); - let connID = "conn" + this.nextConnID++ + '.'; - let conn = new MarionetteServerConnection(connID, aTransport, this); - this.connections[connID] = conn; - - // Create a root actor for the connection and send the hello packet. - conn.sayHello(); - aTransport.ready(); - }, - - closeListener: function() { - this.listener.close(); - this.listener = null; - }, - - _connectionClosed: function DS_connectionClosed(aConnection) { - delete this.connections[aConnection.prefix]; - } -}; diff --git a/testing/marionette/marionette-listener.js b/testing/marionette/marionette-listener.js index 8b30ef6799a3..57ab8b7bb2c4 100644 --- a/testing/marionette/marionette-listener.js +++ b/testing/marionette/marionette-listener.js @@ -67,11 +67,6 @@ let lastCoordinates = null; let isTap = false; // whether to send mouse event let mouseEventsOnly = false; - -Cu.import("resource://gre/modules/services-common/log4moz.js"); -let logger = Log4Moz.repository.getLogger("Marionette"); -logger.info("loaded marionette-listener.js"); - /** * Called when listener is first started up. * The listener sends its unique window ID and its current URI to the actor. diff --git a/testing/marionette/marionette-log-obj.js b/testing/marionette/marionette-log-obj.js index 442e4e081536..fdd40e9b7b19 100644 --- a/testing/marionette/marionette-log-obj.js +++ b/testing/marionette/marionette-log-obj.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/. */ -this.MarionetteLogObj = function MarionetteLogObj() { +function MarionetteLogObj() { this.logs = []; } MarionetteLogObj.prototype = { diff --git a/testing/marionette/marionette-simpletest.js b/testing/marionette/marionette-simpletest.js index 063e99e1188c..5e3039b00afd 100644 --- a/testing/marionette/marionette-simpletest.js +++ b/testing/marionette/marionette-simpletest.js @@ -5,7 +5,7 @@ * The Marionette object, passed to the script context. */ -this.Marionette = function Marionette(scope, window, context, logObj, timeout, testName) { +function Marionette(scope, window, context, logObj, timeout, testName) { this.scope = scope; this.window = window; this.tests = []; From 4aee8c45fd28e86655940878c1945c668feb8f2f Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Thu, 6 Jun 2013 17:27:45 -0700 Subject: [PATCH 45/93] Backout adc90bff145f for bustage (Bug 797529) --- testing/specialpowers/components/SpecialPowersObserver.js | 3 ++- testing/specialpowers/content/SpecialPowersObserverAPI.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/specialpowers/components/SpecialPowersObserver.js b/testing/specialpowers/components/SpecialPowersObserver.js index 219f74dbe16d..934ed3cc9c13 100644 --- a/testing/specialpowers/components/SpecialPowersObserver.js +++ b/testing/specialpowers/components/SpecialPowersObserver.js @@ -25,8 +25,9 @@ var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getService(Components.interfaces.mozIJSSubScriptLoader); loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js"); + /* XPCOM gunk */ -this.SpecialPowersObserver = function SpecialPowersObserver() { +function SpecialPowersObserver() { this._isFrameScriptLoaded = false; this._messageManager = Cc["@mozilla.org/globalmessagemanager;1"]. getService(Ci.nsIMessageBroadcaster); diff --git a/testing/specialpowers/content/SpecialPowersObserverAPI.js b/testing/specialpowers/content/SpecialPowersObserverAPI.js index a10c68bbf72f..6b8d396dd7cc 100644 --- a/testing/specialpowers/content/SpecialPowersObserverAPI.js +++ b/testing/specialpowers/content/SpecialPowersObserverAPI.js @@ -16,7 +16,7 @@ SpecialPowersException.prototype.toString = function() { return this.name + ': "' + this.message + '"'; }; -this.SpecialPowersObserverAPI = function SpecialPowersObserverAPI() { +function SpecialPowersObserverAPI() { this._crashDumpDir = null; this._processCrashObserversRegistered = false; } From 7ea082d4cc0b6adb29e8da2ed36f6c57ab728d0f Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Wed, 5 Jun 2013 15:44:48 -0400 Subject: [PATCH 46/93] Bug 879654: Tolerate '?transport=udp' by stripping it r=jesup --- .../tests/mochitest/test_peerConnection_bug825703.html | 2 +- .../src/peerconnection/PeerConnectionImpl.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dom/media/tests/mochitest/test_peerConnection_bug825703.html b/dom/media/tests/mochitest/test_peerConnection_bug825703.html index 7b0951823142..323a9173e99d 100644 --- a/dom/media/tests/mochitest/test_peerConnection_bug825703.html +++ b/dom/media/tests/mochitest/test_peerConnection_bug825703.html @@ -54,7 +54,7 @@ { url:"stun:0.0.0.0" }, { url:"stuns:x.net", foo:"" }, { url:"turn:[::192.9.5.5]:42", username:"p", credential:"p" }, - { url:"turns:x.org:42", username:"p", credential:"p" } + { url:"turns:x.org:42?transport=udp", username:"p", credential:"p" } ]}, true); pcs = null; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index b20034faffcd..57411df34b7f 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -399,7 +399,8 @@ PeerConnectionImpl::CreateRemoteSourceStreamInfo(nsRefPtrGetPath(path); NS_ENSURE_SUCCESS(rv, rv); + + // Tolerate '?transport=udp' by stripping it. + int32_t questionmark = path.FindChar('?'); + if (questionmark >= 0) { + path.SetLength(questionmark); + } + rv = net_GetAuthURLParser()->ParseAuthority(path.get(), path.Length(), nullptr, nullptr, nullptr, nullptr, From be1d4ceb3b23f312f1f943f224c39333de19ec9d Mon Sep 17 00:00:00 2001 From: Mook Date: Thu, 6 Jun 2013 19:46:06 -0700 Subject: [PATCH 47/93] Bug 877961 - PrivateBrowsingChannel: Allow SetPrivate on a channel with a load group but no load context; r=ehsan, r=jduell --- netwerk/base/src/PrivateBrowsingChannel.h | 13 +++++-------- netwerk/test/unit/test_private_necko_channel.js | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/netwerk/base/src/PrivateBrowsingChannel.h b/netwerk/base/src/PrivateBrowsingChannel.h index 526449a46262..102e5ccc7a3b 100644 --- a/netwerk/base/src/PrivateBrowsingChannel.h +++ b/netwerk/base/src/PrivateBrowsingChannel.h @@ -29,17 +29,14 @@ public: NS_IMETHOD SetPrivate(bool aPrivate) { - // Make sure that we don't have a load group or a load context + // Make sure that we don't have a load context // This is a fatal error in debug builds, and a runtime error in release // builds. - nsILoadGroup* loadGroup = static_cast(this)->mLoadGroup; nsCOMPtr loadContext; - if (!loadGroup) { - NS_QueryNotificationCallbacks(static_cast(this), loadContext); - } - MOZ_ASSERT(!loadGroup && !loadContext); - if (loadGroup || loadContext) { - return NS_ERROR_FAILURE; + NS_QueryNotificationCallbacks(static_cast(this), loadContext); + MOZ_ASSERT(!loadContext); + if (loadContext) { + return NS_ERROR_FAILURE; } mPrivateBrowsingOverriden = true; diff --git a/netwerk/test/unit/test_private_necko_channel.js b/netwerk/test/unit/test_private_necko_channel.js index a8933f58ba10..732b61051ae5 100644 --- a/netwerk/test/unit/test_private_necko_channel.js +++ b/netwerk/test/unit/test_private_necko_channel.js @@ -24,6 +24,7 @@ function run_test() { httpserver.start(4444); var channel = setupChannel(testpath); + channel.loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(); channel.QueryInterface(Ci.nsIPrivateBrowsingChannel); channel.setPrivate(true); From 733a8c352cbeb7ebeeff5920ae730299d97ee5b6 Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 16 May 2013 18:41:46 -0500 Subject: [PATCH 48/93] Bug 784519 - Part 3: Send Signaling State from SIPCC to PeerConnection r=ekr --- CLOBBER | 2 +- dom/media/PeerConnection.js | 59 +++- dom/media/bridge/IPeerConnection.idl | 11 + media/webrtc/signaling/include/CC_CallInfo.h | 16 ++ media/webrtc/signaling/signaling.gyp | 1 + .../src/peerconnection/PeerConnectionImpl.cpp | 53 +++- .../src/peerconnection/PeerConnectionImpl.h | 16 ++ .../peerconnection/PeerConnectionMedia.cpp | 3 +- .../src/sipcc/core/ccapp/CCProvider.h | 2 + .../src/sipcc/core/ccapp/ccapi_call_info.c | 19 ++ .../src/sipcc/core/ccapp/ccprovider.c | 23 +- .../signaling/src/sipcc/core/common/ui.c | 115 +++++--- .../signaling/src/sipcc/core/gsm/fsmdef.c | 269 +++++++++--------- .../signaling/src/sipcc/core/gsm/gsm_sdp.c | 2 +- .../signaling/src/sipcc/core/gsm/h/fsm.h | 34 +-- .../src/sipcc/core/includes/sessionTypes.h | 1 + .../signaling/src/sipcc/core/includes/uiapi.h | 8 + .../src/sipcc/include/ccapi_call_info.h | 8 + .../src/sipcc/include/fsmdef_states.h | 44 +++ .../src/softphonewrapper/CC_SIPCCCallInfo.cpp | 11 + .../src/softphonewrapper/CC_SIPCCCallInfo.h | 2 + 21 files changed, 472 insertions(+), 227 deletions(-) create mode 100644 media/webrtc/signaling/src/sipcc/include/fsmdef_states.h diff --git a/CLOBBER b/CLOBBER index 1644bd3b4bfa..ae43bc0d1e8e 100644 --- a/CLOBBER +++ b/CLOBBER @@ -17,4 +17,4 @@ # # Modifying this file will now automatically clobber the buildbot machines \o/ # -Bug 875929 removed a file from js/src/moz.build and apparently the build system didn't notice. +Bug 784519 causes mystery Android build failures and mochi/crashtest failures diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js index 6c2527bd4f21..d002e7eb1c38 100644 --- a/dom/media/PeerConnection.js +++ b/dom/media/PeerConnection.js @@ -765,10 +765,29 @@ RTCPeerConnection.prototype = { sdp: sdp }); }, - get signalingState() { return "stable"; }, // not yet implemented get iceGatheringState() { return this._iceGatheringState; }, get iceConnectionState() { return this._iceConnectionState; }, + // Corresponds to constants in IPeerConnection.idl + _signalingStateMap: [ + 'invalid', + 'stable', + 'have-local-offer', + 'have-remote-offer', + 'have-local-pranswer', + 'have-remote-pranswer', + 'closed' + ], + + get signalingState() { + // checking for our local pc closed indication + // before invoking the pc methods. + if(this._closed) { + return "closed"; + } + return this._signalingStateMap[this._getPC().signalingState]; + }, + changeIceGatheringState: function(state) { this._iceGatheringState = state; }, @@ -990,14 +1009,10 @@ PeerConnectionObserver.prototype = { this._dompc._executeNext(); }, - onStateChange: function(state) { - if (state != Ci.IPeerConnectionObserver.kIceState) { - return; - } - - switch (this._dompc._pc.iceState) { + handleIceStateChanges: function(iceState) { + switch (iceState) { case Ci.IPeerConnection.kIceWaiting: - this._dompc.changeIceConnectionState("completed"); + this._dompc.changeIceConnectionState("new"); this.callCB(this._dompc.ongatheringchange, "complete"); this.callCB(this._onicechange, "starting"); // Now that the PC is ready to go, execute any pending operations. @@ -1021,7 +1036,33 @@ PeerConnectionObserver.prototype = { this.callCB(this._onicechange, "failed"); break; default: - // Unknown state! + // Unknown ICE state! + this._dompc.reportWarning("Unhandled ice state: " + iceState, null, 0); + break; + } + }, + + onStateChange: function(state) { + switch (state) { + case Ci.IPeerConnectionObserver.kSignalingState: + this.callCB(this._dompc.onsignalingstatechange, + this._dompc.signalingState); + break; + + case Ci.IPeerConnectionObserver.kIceState: + this.handleIceStateChanges(this._dompc._pc.iceState); + break; + + case Ci.IPeerConnectionObserver.kSdpState: + // No-op + break; + + case Ci.IPeerConnectionObserver.kSipccState: + // No-op + break; + + default: + this._dompc.reportWarning("Unhandled state type: " + state, null, 0); break; } }, diff --git a/dom/media/bridge/IPeerConnection.idl b/dom/media/bridge/IPeerConnection.idl index b90bc2c42d21..b6c4e21ca5ee 100644 --- a/dom/media/bridge/IPeerConnection.idl +++ b/dom/media/bridge/IPeerConnection.idl @@ -32,6 +32,7 @@ interface IPeerConnectionObserver : nsISupports const long kIceState = 0x2; const long kSdpState = 0x3; const long kSipccState = 0x4; + const long kSignalingState = 0x5; /* JSEP callbacks */ void onCreateOfferSuccess(in string offer); @@ -91,6 +92,15 @@ interface IPeerConnection : nsISupports const long kClosing = 3; const long kClosed = 4; + /* RTCSignalingState from WebRTC spec */ + const long kSignalingInvalid = 0; + const long kSignalingStable = 1; + const long kSignalingHaveLocalOffer = 2; + const long kSignalingHaveRemoteOffer = 3; + const long kSignalingHaveLocalPranswer = 4; + const long kSignalingHaveRemotePranswer = 5; + const long kSignalingClosed = 6; + /* for 'type' in DataChannelInit dictionary */ const unsigned short kDataChannelReliable = 0; const unsigned short kDataChannelPartialReliableRexmit = 1; @@ -144,6 +154,7 @@ interface IPeerConnection : nsISupports readonly attribute unsigned long iceState; readonly attribute unsigned long readyState; + readonly attribute unsigned long signalingState; readonly attribute unsigned long sipccState; /* Data channels */ diff --git a/media/webrtc/signaling/include/CC_CallInfo.h b/media/webrtc/signaling/include/CC_CallInfo.h index f6b04fc1b37d..3a9137048538 100644 --- a/media/webrtc/signaling/include/CC_CallInfo.h +++ b/media/webrtc/signaling/include/CC_CallInfo.h @@ -9,12 +9,14 @@ extern "C" { #include "ccapi_types.h" +#include "fsmdef_states.h" } #include "CC_Common.h" #include "CC_CallTypes.h" #include "peer_connection_types.h" + namespace CSF { @@ -43,6 +45,13 @@ namespace CSF */ virtual cc_call_state_t getCallState () = 0; + /** + get FSM state + @param [in] handle - call info handle + @return FSM state + */ + virtual fsmdef_states_t getFsmState () const = 0; + /** print Call state @param [in] handle - call info handle @@ -50,6 +59,13 @@ namespace CSF */ virtual std::string callStateToString (cc_call_state_t state) = 0; + /** + print FSM state + @param [in] handle - call info handle + @return call state as string + */ + virtual std::string fsmStateToString (fsmdef_states_t state) const = 0; + /** print Call event @param [in] call event diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index 7ac4b485bd44..34dbc0f0ce7e 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -387,6 +387,7 @@ './src/sipcc/core/includes/dns_utils.h', './src/sipcc/core/includes/dtmf.h', './src/sipcc/core/includes/embedded.h', + './src/sipcc/core/includes/fsmdef_states.h', './src/sipcc/core/includes/intelpentiumtypes.h', './src/sipcc/core/includes/kpml_common_util.h', './src/sipcc/core/includes/kpmlmap.h', diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 57411df34b7f..5a79ffe3a76f 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -129,7 +129,9 @@ public: mReason(aInfo->getStatus()), mSdpStr(), mCallState(aInfo->getCallState()), - mStateStr(aInfo->callStateToString(mCallState)) { + mFsmState(aInfo->getFsmState()), + mStateStr(aInfo->callStateToString(mCallState)), + mFsmStateStr(aInfo->fsmStateToString(mFsmState)) { if (mCallState == REMOTESTREAMADD) { MediaStreamTable *streams = NULL; streams = aInfo->getMediaStreams(); @@ -173,7 +175,8 @@ public: NS_IMETHOD Run() { CSFLogInfo(logTag, "PeerConnectionObserverDispatch processing " - "mCallState = %d (%s)", mCallState, mStateStr.c_str()); + "mCallState = %d (%s), mFsmState = %d (%s)", + mCallState, mStateStr.c_str(), mFsmState, mFsmStateStr.c_str()); if (mCallState == SETLOCALDESCERROR || mCallState == SETREMOTEDESCERROR) { const std::vector &errors = mPC->GetSdpParseErrors(); @@ -192,6 +195,23 @@ public: mCode, mReason.c_str()); } + /* + * While the fsm_states_t (FSM_DEF_*) constants are a proper superset + * of SignalingState, and the order in which the SignalingState values + * appear matches the order they appear in fsm_states_t, their underlying + * numeric representation is different. Hence, we need to perform an + * offset calculation to map from one to the other. + */ + + if (mFsmState >= FSMDEF_S_STABLE && mFsmState <= FSMDEF_S_CLOSED) { + int offset = FSMDEF_S_STABLE - PeerConnectionImpl::kSignalingStable; + mPC->SetSignalingState_m( + static_cast(mFsmState - offset)); + } else { + CSFLogError(logTag, ": **** UNHANDLED SIGNALING STATE : %d (%s)", + mFsmState, mFsmStateStr.c_str()); + } + switch (mCallState) { case CREATEOFFERSUCCESS: mObserver->OnCreateOfferSuccess(mSdpStr.c_str()); @@ -290,7 +310,9 @@ private: std::string mReason; std::string mSdpStr; cc_call_state_t mCallState; + fsmdef_states_t mFsmState; std::string mStateStr; + std::string mFsmStateStr; nsRefPtr mRemoteStream; }; @@ -300,6 +322,7 @@ PeerConnectionImpl::PeerConnectionImpl() : mRole(kRoleUnknown) , mCall(NULL) , mReadyState(kNew) + , mSignalingState(kSignalingStable) , mIceState(kIceGathering) , mPCObserver(NULL) , mWindow(NULL) @@ -1217,6 +1240,16 @@ PeerConnectionImpl::GetReadyState(uint32_t* aState) return NS_OK; } +NS_IMETHODIMP +PeerConnectionImpl::GetSignalingState(uint32_t* aState) +{ + PC_AUTO_ENTER_API_CALL_NO_CHECK(); + MOZ_ASSERT(aState); + + *aState = mSignalingState; + return NS_OK; +} + NS_IMETHODIMP PeerConnectionImpl::GetSipccState(uint32_t* aState) { @@ -1383,6 +1416,22 @@ PeerConnectionImpl::ChangeReadyState(PeerConnectionImpl::ReadyState aReadyState) NS_DISPATCH_NORMAL); } +void +PeerConnectionImpl::SetSignalingState_m(SignalingState aSignalingState) +{ + PC_AUTO_ENTER_API_CALL_NO_CHECK(); + if (mSignalingState == aSignalingState) { + return; + } + + mSignalingState = aSignalingState; + nsCOMPtr pco = do_QueryReferent(mPCObserver); + if (!pco) { + return; + } + pco->OnStateChange(IPeerConnectionObserver::kSignalingState); +} + PeerConnectionWrapper::PeerConnectionWrapper(const std::string& handle) : impl_(nullptr) { if (PeerConnectionCtx::GetInstance()->mPeerConnections.find(handle) == diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 3d66a304e0e3..5c23a826a9fb 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -133,6 +133,18 @@ public: kClosed }; + /* Must match constants in IPeerConnection.idl */ + /* Must also be int the same order as in fsmdef_states.h */ + enum SignalingState { + kSignalingInvalid = 0, + kSignalingStable = 1, + kSignalingHaveLocalOffer = 2, + kSignalingHaveRemoteOffer = 3, + kSignalingHaveLocalPranswer = 4, + kSignalingHaveRemotePranswer = 5, + kSignalingClosed = 6 + }; + enum SipccState { kIdle, kStarting, @@ -268,6 +280,9 @@ public: // Called to retreive the list of parsing errors. const std::vector &GetSdpParseErrors(); + // Sets the RTC Signaling State + void SetSignalingState_m(SignalingState aSignalingState); + private: PeerConnectionImpl(const PeerConnectionImpl&rhs); PeerConnectionImpl& operator=(PeerConnectionImpl); @@ -315,6 +330,7 @@ private: // The call CSF::CC_CallPtr mCall; ReadyState mReadyState; + SignalingState mSignalingState; // ICE State IceState mIceState; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index 0016765fa1aa..cb63fd2bbf2d 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -396,7 +396,8 @@ PeerConnectionMedia::AddRemoteStream(nsRefPtr aInfo, nsresult PeerConnectionMedia::AddRemoteStreamHint(int aIndex, bool aIsVideo) { - if (aIndex >= mRemoteSourceStreams.Length()) { + if (aIndex < 0 || + static_cast(aIndex) >= mRemoteSourceStreams.Length()) { return NS_ERROR_ILLEGAL_VALUE; } diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h index e55247e8eea4..bd87aa77c97b 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h @@ -16,6 +16,7 @@ #include "cpr_threads.h" #include "phone_types.h" #include "session.h" +#include "fsmdef_states.h" #include "cc_constants.h" #include "ccapi_types.h" @@ -60,6 +61,7 @@ typedef struct cc_call_info_t_{ callid_t id; uint16_t inst; cc_call_state_t state; + fsmdef_states_t fsm_state; cc_call_attr_t attr; cc_call_type_t type; cc_call_security_t security; diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c index d9773ac802a6..11b63510bc3e 100644 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c @@ -47,6 +47,25 @@ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle){ return ONHOOK; } +/** + * get FSM state + * @param handle - call handle + * @return call state + */ +fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle){ + session_data_t *data = (session_data_t *)handle; + CCAPP_DEBUG(DEB_F_PREFIX"Entering", + DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__)); + + if ( data ){ + CCAPP_DEBUG(DEB_F_PREFIX"returned %02X", + DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), data->state); + return data->fsm_state; + } + + return FSMDEF_S_IDLE; +} + /** * get call attributes * @param handle - call handle diff --git a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c index 924a7f1cc1c5..78484ef34588 100755 --- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c +++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c @@ -1416,7 +1416,9 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) //Populate the session hash data the first time. memset(data, 0, sizeof(session_data_t)); data->sess_id = sessUpd->sessionID; - data->state = call_state; + data->state = call_state; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; if (sessUpd->eventID == CALL_NEWCALL || sessUpd->eventID == CREATE_OFFER || @@ -1506,8 +1508,12 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) if (createdSessionData == FALSE) { return; } - data->state = sessUpd->update.ccSessionUpd.data.state_data.state; - data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->state = + sessUpd->update.ccSessionUpd.data.state_data.state; + data->line = + sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; break; default: break; @@ -1572,6 +1578,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) data->state = sessUpd->update.ccSessionUpd.data.state_data.state; } data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; sessUpd->update.ccSessionUpd.data.state_data.attr = data->attr; sessUpd->update.ccSessionUpd.data.state_data.inst = data->inst; @@ -1629,8 +1637,10 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) ccsnap_gen_callEvent(CCAPI_CALL_EV_GCID, CREATE_CALL_HANDLE_FROM_SESSION_ID(sessUpd->sessionID)); break; case CALL_NEWCALL: - data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->state = sessUpd->update.ccSessionUpd.data.state_data.state; data->line = sessUpd->update.ccSessionUpd.data.state_data.line_id; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->attr = sessUpd->update.ccSessionUpd.data.state_data.attr; data->inst = sessUpd->update.ccSessionUpd.data.state_data.inst; return; @@ -1802,6 +1812,8 @@ static void ccappUpdateSessionData (session_update_t *sessUpd) case REMOTE_STREAM_ADD: data->cause = sessUpd->update.ccSessionUpd.data.state_data.cause; data->state = sessUpd->update.ccSessionUpd.data.state_data.state; + data->fsm_state = + sessUpd->update.ccSessionUpd.data.state_data.fsm_state; data->media_stream_track_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_track_id; data->media_stream_id = sessUpd->update.ccSessionUpd.data.state_data.media_stream_id; strlib_free(data->status); @@ -2155,7 +2167,8 @@ void ccappFeatureUpdated (feature_update_t *featUpd) { break; case DEVICE_FEATURE_MWILAMP: - g_deviceInfo.mwi_lamp = featUpd->update.ccFeatUpd.data.state_data.state; + g_deviceInfo.mwi_lamp = + featUpd->update.ccFeatUpd.data.mwi_status.status; ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_MWI_LAMP, CC_DEVICE_ID); break; case DEVICE_FEATURE_BLF: diff --git a/media/webrtc/signaling/src/sipcc/core/common/ui.c b/media/webrtc/signaling/src/sipcc/core/common/ui.c index 5d6e34eb243c..6faa7ec7baab 100755 --- a/media/webrtc/signaling/src/sipcc/core/common/ui.c +++ b/media/webrtc/signaling/src/sipcc/core/common/ui.c @@ -737,7 +737,7 @@ ui_change_mwi_lamp (int status) msg.sessionType = SESSIONTYPE_CALLCONTROL; msg.featureID = DEVICE_FEATURE_MWILAMP; - msg.update.ccFeatUpd.data.state_data.state = status; + msg.update.ccFeatUpd.data.mwi_status.status = status; if ( ccappTaskPostMsg(CCAPP_FEATURE_UPDATE, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) { CCAPP_ERROR(CCAPP_F_PREFIX"failed to send DEVICE_FEATURE_MWILAMP(%d) msg", __FUNCTION__, status); @@ -1544,20 +1544,20 @@ ui_control_feature (line_t line_id, callid_t call_id, } /* - * Helper for the following four functions which all load up a + * Helper for the following several functions which all load up a * session_update message and post it. * */ -static void post_message_helper( - group_call_event_t eventId, - call_events event, - line_t nLine, - callid_t nCallId, - uint16_t call_instance_id, - string_t sdp, - pc_error error, - const char *format, - va_list args) +static void post_message_helper(group_call_event_t eventId, + call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallId, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, + va_list args) { flex_string fs; session_update_t msg; @@ -1572,6 +1572,7 @@ static void post_message_helper( msg.eventID = eventId; msg.update.ccSessionUpd.data.state_data.state = event; + msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.sdp = sdp; @@ -1602,9 +1603,14 @@ static void post_message_helper( * * @return none */ -void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_create_offer(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; @@ -1614,8 +1620,8 @@ void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, va_start(ap, format); - post_message_helper(CREATE_OFFER, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(CREATE_OFFER, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1627,17 +1633,22 @@ void ui_create_offer(call_events event, line_t nLine, callid_t nCallID, * * @return none */ -void ui_create_answer(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_create_answer(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(CREATE_ANSWER, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(CREATE_ANSWER, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1649,17 +1660,22 @@ void ui_create_answer(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_set_local_description(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_set_local_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_LOCAL_DESC, event, nLine, nCallID, call_instance_id, - sdp, error, format, ap); + post_message_helper(SET_LOCAL_DESC, event, new_state, nLine, nCallID, + call_instance_id, sdp, error, format, ap); va_end(ap); return; @@ -1671,9 +1687,13 @@ void ui_set_local_description(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_set_remote_description(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, - string_t sdp, pc_error error, +void ui_set_remote_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, const char *format, ...) { va_list ap; @@ -1681,7 +1701,7 @@ void ui_set_remote_description(call_events event, line_t nLine, DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(SET_REMOTE_DESC, event, nLine, nCallID, + post_message_helper(SET_REMOTE_DESC, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1694,9 +1714,13 @@ void ui_set_remote_description(call_events event, line_t nLine, * @return none */ -void ui_update_local_description(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, - string_t sdp, pc_error error, +void ui_update_local_description(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, const char *format, ...) { va_list ap; @@ -1705,7 +1729,7 @@ void ui_update_local_description(call_events event, line_t nLine, event, call_instance_id); va_start(ap, format); - post_message_helper(UPDATE_LOCAL_DESC, event, nLine, nCallID, + post_message_helper(UPDATE_LOCAL_DESC, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); @@ -1718,16 +1742,21 @@ void ui_update_local_description(call_events event, line_t nLine, * @return none */ -void ui_ice_candidate_add(call_events event, line_t nLine, callid_t nCallID, - uint16_t call_instance_id, string_t sdp, - pc_error error, const char *format, ...) +void ui_ice_candidate_add(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, + string_t sdp, + pc_error error, + const char *format, ...) { va_list ap; TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d", DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id); va_start(ap, format); - post_message_helper(ICE_CANDIDATE_ADD, event, nLine, nCallID, + post_message_helper(ICE_CANDIDATE_ADD, event, new_state, nLine, nCallID, call_instance_id, sdp, error, format, ap); va_end(ap); } @@ -1738,8 +1767,11 @@ void ui_ice_candidate_add(call_events event, line_t nLine, callid_t nCallID, * @return none */ -void ui_on_remote_stream_added(call_events event, line_t nLine, - callid_t nCallID, uint16_t call_instance_id, +void ui_on_remote_stream_added(call_events event, + fsmdef_states_t new_state, + line_t nLine, + callid_t nCallID, + uint16_t call_instance_id, cc_media_remote_track_table_t media_track) { session_update_t msg; @@ -1759,6 +1791,7 @@ void ui_on_remote_stream_added(call_events event, line_t nLine, msg.eventID = REMOTE_STREAM_ADD; msg.update.ccSessionUpd.data.state_data.state = event; + msg.update.ccSessionUpd.data.state_data.fsm_state = new_state; msg.update.ccSessionUpd.data.state_data.inst = call_instance_id; msg.update.ccSessionUpd.data.state_data.line_id = nLine; msg.update.ccSessionUpd.data.state_data.media_stream_track_id = media_track.track[0].media_stream_track_id; diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c index 7e829e91ec46..fbdd9d5da105 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c @@ -747,36 +747,6 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, -/* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */ - { - /* CC_MSG_SETUP */ fsmdef_ev_default, - /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, - /* CC_MSG_PROCEEDING */ fsmdef_ev_default, - /* CC_MSG_ALERTING */ fsmdef_ev_default, - /* CC_MSG_CONNECTED */ fsmdef_ev_default, - /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, - /* CC_MSG_RELEASE */ fsmdef_ev_default, - /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, - /* CC_MSG_FEATURE */ fsmdef_ev_default, - /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, - /* CC_MSG_OFFHOOK */ fsmdef_ev_default, - /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, - /* CC_MSG_LINE */ fsmdef_ev_default, - /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, - /* CC_MSG_DIGIT_END */ fsmdef_ev_default, - /* CC_MSG_DIALSTRING */ fsmdef_ev_default, - /* CC_MSG_MWI */ fsmdef_ev_default, - /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, - /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, - /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, - /* CC_MSG_SETLOCALDESC */ fsmdef_ev_default, /* Should not happen */ - /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_setremotedesc, - /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, - /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, - /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, - /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate - }, - /* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -807,6 +777,36 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] = /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate }, +/* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */ + { + /* CC_MSG_SETUP */ fsmdef_ev_default, + /* CC_MSG_SETUP_ACK */ fsmdef_ev_default, + /* CC_MSG_PROCEEDING */ fsmdef_ev_default, + /* CC_MSG_ALERTING */ fsmdef_ev_default, + /* CC_MSG_CONNECTED */ fsmdef_ev_default, + /* CC_MSG_CONNECTED_ACK */ fsmdef_ev_default, + /* CC_MSG_RELEASE */ fsmdef_ev_default, + /* CC_MSG_RELEASE_COMPLETE */ fsmdef_ev_default, + /* CC_MSG_FEATURE */ fsmdef_ev_default, + /* CC_MSG_FEATURE_ACK */ fsmdef_ev_default, + /* CC_MSG_OFFHOOK */ fsmdef_ev_default, + /* CC_MSG_ONHOOK */ fsmdef_ev_onhook, + /* CC_MSG_LINE */ fsmdef_ev_default, + /* CC_MSG_DIGIT_BEGIN */ fsmdef_ev_default, + /* CC_MSG_DIGIT_END */ fsmdef_ev_default, + /* CC_MSG_DIALSTRING */ fsmdef_ev_default, + /* CC_MSG_MWI */ fsmdef_ev_default, + /* CC_MSG_SESSION_AUDIT */ fsmdef_ev_default, + /* CC_MSG_CREATEOFFER */ fsmdef_ev_createoffer, + /* CC_MSG_CREATEANSWER */ fsmdef_ev_createanswer, + /* CC_MSG_SETLOCALDESC */ fsmdef_ev_default, /* Should not happen */ + /* CC_MSG_SETREMOTEDESC */ fsmdef_ev_setremotedesc, + /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default, + /* CC_MSG_ADDSTREAM */ fsmdef_ev_default, + /* CC_MSG_REMOVESTREAM */ fsmdef_ev_default, + /* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate + }, + /* FSMDEF_S_CLOSED --------------------------------------------------------- */ { /* CC_MSG_SETUP */ fsmdef_ev_default, @@ -2416,38 +2416,39 @@ fsmdef_ev_default (sm_event_t *event) */ switch (event->event) { case CC_MSG_CREATEOFFER: - ui_create_offer(evCreateOfferError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_offer(evCreateOfferError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_CREATEANSWER: - ui_create_answer(evCreateAnswerError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_create_answer(evCreateAnswerError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_SETLOCALDESC: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local description in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_SETREMOTEDESC: - ui_set_remote_description(evSetRemoteDescError, msg->line, - msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), - PC_INVALID_STATE, "Cannot set remote description in state %s", - fsmdef_state_name(event->state)); + ui_set_remote_description(evSetRemoteDescError, fcb->state, + msg->line, msg->call_id, dcb->caller_id.call_instance_id, + strlib_empty(), PC_INVALID_STATE, + "Cannot set remote description in state %s", + fsmdef_state_name(fcb->state)); break; case CC_MSG_ADDCANDIDATE: - ui_ice_candidate_add(evAddIceCandidateError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add ICE candidate in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); break; case CC_MSG_ADDSTREAM: @@ -2458,7 +2459,7 @@ fsmdef_ev_default (sm_event_t *event) * getting through anyway. */ FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Cannot add or remove streams " "in state %s", DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, - msg->call_id, __FUNCTION__), fsmdef_state_name(event->state)); + msg->call_id, __FUNCTION__), fsmdef_state_name(fcb->state)); break; default: @@ -3150,14 +3151,14 @@ fsmdef_ev_createoffer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for offer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_offer(evCreateOfferSuccess, line, call_id, + ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3179,7 +3180,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { } if (!has_stream) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot create SDP without any streams."); return SM_RC_END; @@ -3189,7 +3190,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Failed to get ICE parameters for local SDP"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3221,7 +3222,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, FALSE, TRUE, TRUE, TRUE, TRUE); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3231,7 +3232,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_offer(evCreateOfferError, line, call_id, + ui_create_offer(evCreateOfferError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for offer;" " cause = %s", cc_cause_name(cause)); @@ -3242,7 +3243,7 @@ fsmdef_ev_createoffer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass offer SDP back to UI */ - ui_create_offer(evCreateOfferSuccess, line, call_id, + ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3305,14 +3306,14 @@ fsmdef_ev_createanswer (sm_event_t *event) { local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not re-create local SDP for answer"); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); return (fsmdef_release(fcb, cause, FALSE)); } - ui_create_answer(evCreateAnswerSuccess, line, call_id, + ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); @@ -3331,7 +3332,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { if (vcm_res) { FSM_DEBUG_SM(DEB_F_PREFIX"vcmGetIceParams returned an error", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not get ICE parameters for answer"); return (fsmdef_release(fcb, cause, FALSE)); @@ -3373,7 +3374,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { */ cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP for answer;" " cause = %s", cc_cause_name(cause)); @@ -3392,7 +3393,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { /* create_answer */ TRUE); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); @@ -3401,7 +3402,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { cause = gsmsdp_encode_sdp_and_update_version(dcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_create_answer(evCreateAnswerError, line, call_id, + ui_create_answer(evCreateAnswerError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode SDP for answer; cause = %s", cc_cause_name(cause)); @@ -3412,7 +3413,7 @@ fsmdef_ev_createanswer (sm_event_t *event) { dcb->local_sdp_complete = TRUE; /* Pass SDP back to UI */ - ui_create_answer(evCreateAnswerSuccess, line, call_id, + ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL); cc_free_msg_body_parts(&msg_body); @@ -3448,25 +3449,25 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_local_description(evSetLocalDescError, line, call_id, + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - ui_set_local_description(evSetLocalDescError, line, call_id, + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } if (!dcb->sdp) { - ui_set_local_description(evSetLocalDescError, line, call_id, + ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Setting of local SDP before calling " "createOffer or createAnswer is not currently supported."); @@ -3476,12 +3477,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (event->state != FSMDEF_S_STABLE && - event->state != FSMDEF_S_HAVE_LOCAL_OFFER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_STABLE && + fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3489,12 +3490,12 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && - event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && + fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } /* TODO: Parse incoming SDP and act on it. */ @@ -3509,8 +3510,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3525,8 +3526,8 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { if (dcb->dsp_out_of_resources == TRUE) { cc_call_state(fcb->dcb->call_id, fcb->dcb->line, CC_STATE_UNKNOWN, NULL); - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Cannot start media channels; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3539,21 +3540,21 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (event->state != FSMDEF_S_HAVE_REMOTE_OFFER && - event->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { - ui_set_local_description(evSetLocalDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER && + fcb->state != FSMDEF_S_HAVE_LOCAL_PRANSWER) { + ui_set_local_description(evSetLocalDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set local pranswer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3562,16 +3563,16 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) { /* Encode the current local SDP structure into a char buffer */ local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len); if (!local_sdp) { - ui_set_local_description(evSetLocalDescError, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not encode local SDP for local " "description"); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescSuccess, msg->line, msg->call_id, - dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1), - PC_NO_ERROR, NULL); + ui_set_local_description(evSetLocalDescSuccess, fcb->state, msg->line, + msg->call_id, dcb->caller_id.call_instance_id, + strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL); free(local_sdp); return (SM_RC_END); @@ -3609,20 +3610,20 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb == NULL) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_remote_description(evSetRemoteDescError, line, call_id, - 0, strlib_empty(), - PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, 0, strlib_empty(), + PC_INTERNAL_ERROR, "Unrecoverable error: dcb is NULL."); return (SM_RC_CLEANUP); } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (!sdpmode) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); - fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED); return (SM_RC_END); } @@ -3632,8 +3633,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { if (dcb->sdp && dcb->sdp->dest_sdp) { FSM_DEBUG_SM(DEB_F_PREFIX"Renegotiation not currently supported.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Renegotiation of session description is not " "currently supported. See Bug 840728 for status."); return (SM_RC_END); @@ -3661,18 +3662,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { switch (action) { case JSEP_OFFER: - if (event->state != FSMDEF_S_STABLE && - event->state != FSMDEF_S_HAVE_REMOTE_OFFER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_STABLE && + fcb->state != FSMDEF_S_HAVE_REMOTE_OFFER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote offer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } cause = gsmsdp_process_offer_sdp(fcb, &msg_body, TRUE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not process offer SDP; " "cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3692,8 +3693,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_create_local_sdp(dcb, TRUE, has_audio, has_video, has_data, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not create local SDP; cause = %s", cc_cause_name(cause)); FSM_DEBUG_SM("%s", get_debug_string(FSM_DBG_SDP_BUILD_ERR)); @@ -3704,8 +3705,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { cause = gsmsdp_negotiate_media_lines(fcb, dcb->sdp, TRUE, TRUE, TRUE, FALSE); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate media lines; cause = %s", cc_cause_name(cause)); return (fsmdef_release(fcb, cause, FALSE)); @@ -3717,18 +3718,18 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_ANSWER: - if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && - event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && + fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote answer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } cause = gsmsdp_negotiate_answer_sdp(fcb, &msg_body); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not negotiate answer SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3740,8 +3741,8 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { */ cause = gsmsdp_install_peer_ice_attributes(fcb); if (cause != CC_CAUSE_OK) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not configure local ICE state" " from SDP; cause = %s", cc_cause_name(cause)); return (SM_RC_END); @@ -3759,21 +3760,21 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { break; case JSEP_PRANSWER: - if (event->state != FSMDEF_S_HAVE_LOCAL_OFFER && - event->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + if (fcb->state != FSMDEF_S_HAVE_LOCAL_OFFER && + fcb->state != FSMDEF_S_HAVE_REMOTE_PRANSWER) { + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot set remote pranswer in state %s", - fsmdef_state_name(event->state)); + fsmdef_state_name(fcb->state)); return (SM_RC_END); } - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Provisional answers are not yet supported"); return (SM_RC_END); default: - ui_set_local_description(evSetLocalDescError, msg->line, + ui_set_local_description(evSetLocalDescError, fcb->state, msg->line, msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Unknown session description type: %d",action); return (SM_RC_END); @@ -3788,14 +3789,14 @@ fsmdef_ev_setremotedesc(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_set_remote_description(evSetRemoteDescError, line, call_id, - dcb->caller_id.call_instance_id, strlib_empty(), + ui_set_remote_description(evSetRemoteDescError, fcb->state, line, + call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize remote description;" " cause = %s", cc_cause_name(cause)); return (SM_RC_END); } - ui_set_remote_description(evSetRemoteDescSuccess, line, call_id, + ui_set_remote_description(evSetRemoteDescSuccess, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); @@ -3979,14 +3980,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { if (!dcb) { FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, 0, strlib_empty(), PC_INTERNAL_ERROR, "DCB has not been created."); return SM_RC_CLEANUP; } config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode)); if (sdpmode == FALSE) { - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "'sdpmode' configuration is false. This should " "never ever happen. Run for your lives!"); @@ -3998,7 +3999,7 @@ fsmdef_ev_addcandidate(sm_event_t *event) { "remote description been set yet?\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INVALID_STATE, "Cannot add remote ICE candidates before " "setting remote SDP."); @@ -4045,14 +4046,14 @@ fsmdef_ev_addcandidate(sm_event_t *event) { remote_sdp = sipsdp_write_to_buf(dcb->sdp->dest_sdp, &remote_sdp_len); if (!remote_sdp) { - ui_ice_candidate_add(evAddIceCandidateError, line, call_id, + ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_empty(), PC_INTERNAL_ERROR, "Could not serialize new SDP after adding ICE " "candidate."); return (SM_RC_END); } - ui_ice_candidate_add(evAddIceCandidate, line, call_id, + ui_ice_candidate_add(evAddIceCandidate, fcb->state, line, call_id, dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1), PC_NO_ERROR, NULL); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c index f133920f81c3..1efc95922428 100644 --- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c +++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c @@ -4749,7 +4749,7 @@ gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial TODO(adam@nostrum.com): Figure out how to notify when streams gain tracks */ ui_on_remote_stream_added(evOnRemoteStreamAdd, - dcb_p->line, dcb_p->call_id, + fcb_p->state, dcb_p->line, dcb_p->call_id, dcb_p->caller_id.call_instance_id, dcb_p->remote_media_stream_tbl->streams[j]); diff --git a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h index 9752cc8f68d6..85a72abbedca 100755 --- a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h +++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h @@ -13,6 +13,7 @@ #include "sll_lite.h" #include "sessionConstants.h" #include "ccsdp.h" +#include "fsmdef_states.h" /* TODO: BLASBERG * fsm.h only needs the following from ccsip_core.h @@ -65,39 +66,6 @@ typedef enum { FSMDEF_CALL_TYPE_MAX } fsmdef_call_types_t; -typedef enum { - FSMDEF_S_MIN = -1, - - FSMDEF_S_IDLE, - - /* SIP States */ - FSMDEF_S_COLLECT_INFO, - FSMDEF_S_CALL_SENT, - FSMDEF_S_OUTGOING_PROCEEDING, - FSMDEF_S_KPML_COLLECT_INFO, - FSMDEF_S_OUTGOING_ALERTING, - FSMDEF_S_INCOMING_ALERTING, - FSMDEF_S_CONNECTING, - FSMDEF_S_JOINING, - FSMDEF_S_CONNECTED, - FSMDEF_S_CONNECTED_MEDIA_PEND, - FSMDEF_S_RELEASING, - FSMDEF_S_HOLD_PENDING, - FSMDEF_S_HOLDING, - FSMDEF_S_RESUME_PENDING, - FSMDEF_S_PRESERVED, - - /* WebRTC States */ - FSMDEF_S_STABLE, - FSMDEF_S_HAVE_LOCAL_OFFER, - FSMDEF_S_HAVE_REMOTE_OFFER, - FSMDEF_S_HAVE_REMOTE_PRANSWER, - FSMDEF_S_HAVE_LOCAL_PRANSWER, - FSMDEF_S_CLOSED, - - FSMDEF_S_MAX -} fsmdef_states_t; - typedef enum { FSMDEF_MRTONE_NO_ACTION = 0, FSMDEF_MRTONE_PLAYED_MONITOR_TONE, diff --git a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h index c907f059681e..2849826adc80 100755 --- a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h @@ -52,6 +52,7 @@ typedef struct { typedef struct { int state; + int fsm_state; int attr; int inst; line_t line_id; diff --git a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h index d60e00d15427..e0f86287bf89 100644 --- a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h +++ b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h @@ -9,6 +9,7 @@ #include "phone_types.h" #include "string_lib.h" #include "vcm.h" +#include "fsm.h" #include "ccapi.h" #include "sessionConstants.h" @@ -180,6 +181,7 @@ void ui_update_media_interface_change(line_t line, callid_t call_id, group_call_ /* WebRTC upcalls for PeerConnectionImpl */ void ui_create_offer(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -188,6 +190,7 @@ void ui_create_offer(call_events event, const char *format, ...); void ui_create_answer(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -196,6 +199,7 @@ void ui_create_answer(call_events event, const char *format, ...); void ui_set_local_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -204,6 +208,7 @@ void ui_set_local_description(call_events event, const char *format, ...); void ui_set_remote_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -212,6 +217,7 @@ void ui_set_remote_description(call_events event, const char *format, ...); void ui_update_local_description(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -220,6 +226,7 @@ void ui_update_local_description(call_events event, const char *format, ...); void ui_ice_candidate_add(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, @@ -228,6 +235,7 @@ void ui_ice_candidate_add(call_events event, const char *format, ...); void ui_on_remote_stream_added(call_events event, + fsmdef_states_t new_state, line_t nLine, callid_t nCallID, uint16_t call_instance_id, diff --git a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h index f23bef17062d..71c4d6884860 100644 --- a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h +++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h @@ -7,6 +7,7 @@ #include "ccapi_types.h" #include "peer_connection_types.h" +#include "fsmdef_states.h" /** * get Line on which this call is @@ -22,6 +23,13 @@ cc_lineid_t CCAPI_CallInfo_getLine(cc_callinfo_ref_t handle); */ cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle); +/** + * get FSM state + * @param [in] handle - call info handle + * @return fsm state + */ +fsmdef_states_t CCAPI_CallInfo_getFsmState(cc_callinfo_ref_t handle); + /** * get call attributes * @param [in] handle - call info handle diff --git a/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h b/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h new file mode 100644 index 000000000000..c6544dd503d9 --- /dev/null +++ b/media/webrtc/signaling/src/sipcc/include/fsmdef_states.h @@ -0,0 +1,44 @@ +/* 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/. */ + +#ifndef _FSMDEF_STATES_H_ +#define _FSMDEF_STATES_H_ + +typedef enum { + FSMDEF_S_MIN = -1, + + FSMDEF_S_IDLE, + + /* SIP States */ + FSMDEF_S_COLLECT_INFO, + FSMDEF_S_CALL_SENT, + FSMDEF_S_OUTGOING_PROCEEDING, + FSMDEF_S_KPML_COLLECT_INFO, + FSMDEF_S_OUTGOING_ALERTING, + FSMDEF_S_INCOMING_ALERTING, + FSMDEF_S_CONNECTING, + FSMDEF_S_JOINING, + FSMDEF_S_CONNECTED, + FSMDEF_S_CONNECTED_MEDIA_PEND, + FSMDEF_S_RELEASING, + FSMDEF_S_HOLD_PENDING, + FSMDEF_S_HOLDING, + FSMDEF_S_RESUME_PENDING, + FSMDEF_S_PRESERVED, + + /* WebRTC States */ + /* MUST be in the same order as PeerConnectionImpl::SignalingState */ + FSMDEF_S_STABLE, + FSMDEF_S_HAVE_LOCAL_OFFER, + FSMDEF_S_HAVE_REMOTE_OFFER, + FSMDEF_S_HAVE_LOCAL_PRANSWER, + FSMDEF_S_HAVE_REMOTE_PRANSWER, + FSMDEF_S_CLOSED, + + FSMDEF_S_MAX +} fsmdef_states_t; + +const char * fsmdef_state_name (int state); + +#endif diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp index d4b9c07e0909..da3831eca534 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp @@ -13,6 +13,7 @@ extern "C" { #include "ccapi_call.h" #include "ccapi_call_info.h" +#include "fsmdef_states.h" } static const char* logTag = "CC_SIPCCCallInfo"; @@ -56,6 +57,16 @@ cc_call_state_t CC_SIPCCCallInfo::getCallState() return CCAPI_CallInfo_getCallState(callinfo_ref); } +fsmdef_states_t CC_SIPCCCallInfo::getFsmState() const +{ + return CCAPI_CallInfo_getFsmState(callinfo_ref); +} + +std::string CC_SIPCCCallInfo::fsmStateToString (fsmdef_states_t state) const +{ + return fsmdef_state_name(state); +} + std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state) { std::string statestr = ""; diff --git a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h index 32b1505a0c47..80269bc4522d 100644 --- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h @@ -35,6 +35,7 @@ namespace CSF ~CC_SIPCCCallInfo (); cc_call_state_t getCallState (); + fsmdef_states_t getFsmState () const; bool getRingerState(); virtual cc_call_attr_t getCallAttr(); @@ -42,6 +43,7 @@ namespace CSF virtual CC_LinePtr getline (); virtual std::string callStateToString (cc_call_state_t state); + virtual std::string fsmStateToString (fsmdef_states_t state) const; virtual std::string callEventToString (ccapi_call_event_e callEvent); virtual cc_call_type_t getCallType(); virtual std::string getCalledPartyName(); From 368b3b5237e8105bcc421d9932cf766d9bbd8210 Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Thu, 16 May 2013 21:47:50 -0500 Subject: [PATCH 49/93] Bug 784519 - Part 4: signalingState mochi tests r=jsmith --- dom/media/tests/mochitest/Makefile.in | 7 + dom/media/tests/mochitest/head.js | 16 +- dom/media/tests/mochitest/pc.js | 179 ++++++++++++++++-- ...nnection_addCandidateInHaveLocalOffer.html | 43 +++++ ...ection_setLocalAnswerInHaveLocalOffer.html | 41 ++++ ...peerConnection_setLocalAnswerInStable.html | 41 ++++ ...ection_setLocalOfferInHaveRemoteOffer.html | 40 ++++ ...tion_setRemoteAnswerInHaveRemoteOffer.html | 41 ++++ ...eerConnection_setRemoteAnswerInStable.html | 41 ++++ ...ection_setRemoteOfferInHaveLocalOffer.html | 40 ++++ 10 files changed, 475 insertions(+), 14 deletions(-) create mode 100644 dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index 2720ee9ccf2c..9b9c102ca73f 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -35,6 +35,13 @@ MOCHITEST_FILES = \ test_peerConnection_offerRequiresReceiveVideo.html \ test_peerConnection_offerRequiresReceiveVideoAudio.html \ test_peerConnection_throwInCallbacks.html \ + test_peerConnection_setLocalAnswerInStable.html \ + test_peerConnection_setRemoteAnswerInStable.html \ + test_peerConnection_setLocalAnswerInHaveLocalOffer.html \ + test_peerConnection_setRemoteOfferInHaveLocalOffer.html \ + test_peerConnection_setLocalOfferInHaveRemoteOffer.html \ + test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html \ + test_peerConnection_addCandidateInHaveLocalOffer.html \ test_peerConnection_bug822674.html \ test_peerConnection_bug825703.html \ test_peerConnection_bug827843.html \ diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 0a9a5d307728..2099790644be 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -182,11 +182,23 @@ function unexpectedCallbackAndFinish(error) { return function(aObj) { var where = error.fileName + ":" + error.lineNumber; if (aObj && aObj.name && aObj.message) { - ok(false, "Unexpected error callback from " + where + " with name = '" + + ok(false, "Unexpected callback/event from " + where + " with name = '" + aObj.name + "', message = '" + aObj.message + "'"); } else { - ok(false, "Unexpected error callback from " + where + " with " + aObj); + ok(false, "Unexpected callback/event from " + where + " with " + aObj); } SimpleTest.finish(); } } + +/** + * Generates a callback function suitable for putting int a success + * callback in circumstances where success is unexpected. The callback, + * if activated, will kill off the test gracefully. + */ + +function unexpectedSuccessCallbackAndFinish(error, reason) { + return function() { + unexpectedCallbackAndFinish(error)(message); + } +} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index dc6c747cf1ff..78d17471812d 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -246,10 +246,19 @@ var commandsPeerConnection = [ }); } ], + [ + 'PC_CHECK_INITIAL_SIGNALINGSTATE', + function (test) { + is(test.pcLocal.signalingState,"stable", "Initial local signalingState is stable"); + is(test.pcRemote.signalingState,"stable", "Initial remote signalingState is stable"); + test.next(); + } + ], [ 'PC_LOCAL_CREATE_OFFER', function (test) { test.pcLocal.createOffer(function () { + is(test.pcLocal.signalingState, "stable", "Local create offer does not change signaling state"); test.next(); }); } @@ -257,23 +266,24 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_LOCAL_DESCRIPTION', function (test) { - test.pcLocal.setLocalDescription(test.pcLocal._last_offer, function () { - test.next(); - }); + test.expectStateChange(test.pcLocal, "have-local-offer", test); + test.pcLocal.setLocalDescription(test.pcLocal._last_offer, + test.checkStateInCallback(test.pcLocal, "have-local-offer", test)); } ], [ 'PC_REMOTE_SET_REMOTE_DESCRIPTION', function (test) { - test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, function () { - test.next(); - }); + test.expectStateChange(test.pcRemote, "have-remote-offer", test); + test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, + test.checkStateInCallback(test.pcRemote, "have-remote-offer", test)); } ], [ 'PC_REMOTE_CREATE_ANSWER', function (test) { test.pcRemote.createAnswer(function () { + is(test.pcRemote.signalingState, "have-remote-offer", "Remote create offer does not change signaling state"); test.next(); }); } @@ -281,17 +291,17 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_REMOTE_DESCRIPTION', function (test) { - test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, function () { - test.next(); - }); + test.expectStateChange(test.pcLocal, "stable", test); + test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, + test.checkStateInCallback(test.pcLocal, "stable", test)); } ], [ 'PC_REMOTE_SET_LOCAL_DESCRIPTION', function (test) { - test.pcRemote.setLocalDescription(test.pcRemote._last_answer, function () { - test.next(); - }); + test.expectStateChange(test.pcRemote, "stable", test); + test.pcRemote.setLocalDescription(test.pcRemote._last_answer, + test.checkStateInCallback(test.pcRemote, "stable", test)); } ], [ @@ -394,6 +404,64 @@ PeerConnectionTest.prototype.teardown = function PCT_teardown() { SimpleTest.finish(); }; +/** + * Sets up the "onsignalingstatechange" handler for the indicated peerconnection + * as a one-shot test. If the test.commandSuccess flag is set when the event + * happens, then the next test in the command chain is triggered. After + * running, this sets the event handler so that it will fail the test if + * it fires again before we expect it. This is intended to be used in + * conjunction with checkStateInCallback, below. + * + * @param {pcw} PeerConnectionWrapper + * The peer connection to expect a state change on + * @param {state} string + * The state that we expect to change to + * @param {test} PeerConnectionTest + * The test strucure currently in use. + */ +PeerConnectionTest.prototype.expectStateChange = +function PCT_expectStateChange(pcw, state, test) { + pcw.signalingChangeEvent = false; + pcw._pc.onsignalingstatechange = function() { + pcw._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); + is(pcw._pc.signalingState, state, pcw.label + ": State is " + state + " in onsignalingstatechange"); + pcw.signalingChangeEvent = true; + if (pcw.commandSuccess) { + test.next(); + } else { + info("Waiting for success callback..."); + } + }; +} + +/** + * Returns a function, suitable for use as a success callback, that + * checks the signaling state of the PC; and, if the signalingstatechange + * event has already fired, moves on to the next test case. This is + * intended to be used in conjunction with expectStateChange, above. + * + * @param {pcw} PeerConnectionWrapper + * The peer connection to expect a state change on + * @param {state} string + * The state that we expect to change to + * @param {test} PeerConnectionTest + * The test strucure currently in use. + */ + +PeerConnectionTest.prototype.checkStateInCallback = +function PCT_checkStateInCallback(pcw, state, test) { + pcw.commandSuccess = false; + return function() { + pcw.commandSuccess = true; + is(pcw.signalingState, state, pcw.label + ": State is " + state + " in success callback"); + if (pcw.signalingChangeEvent) { + test.next(); + } else { + info("Waiting for signalingstatechange event..."); + } + }; +} + /** * This class handles acts as a wrapper around a PeerConnection instance. @@ -420,6 +488,9 @@ function PeerConnectionWrapper(label, configuration) { // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. self.attachMedia(event.stream, 'video', 'remote'); }; + + // Make sure no signaling state changes are fired until we expect them to + this._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); } PeerConnectionWrapper.prototype = { @@ -462,6 +533,15 @@ PeerConnectionWrapper.prototype = { this._pc.remoteDescription = desc; }, + /** + * Returns the remote signaling state. + * + * @returns {object} The local description + */ + get signalingState() { + return this._pc.signalingState; + }, + /** * Callback when we get media from either side. Also an appropriate * HTML media element will be created. @@ -571,6 +651,25 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, + /** + * Tries to set the local description and expect failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} desc + * mozRTCSessionDescription for the local description request + * @param {function} onFailure + * Callback to execute if the call fails. + */ + setLocalDescriptionAndFail : function PCW_setLocalDescriptionAndFail(desc, onFailure) { + var self = this; + this._pc.setLocalDescription(desc, + unexpectedSuccessCallbackAndFinish(new Error, "setLocalDescription should have failed."), + function (err) { + info("As expected, failed to set the local description for " + self.label); + onFailure(err); + }); + }, + /** * Sets the remote description and automatically handles the failure case. * @@ -587,6 +686,62 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, + /** + * Tries to set the remote description and expect failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} desc + * mozRTCSessionDescription for the remote description request + * @param {function} onFailure + * Callback to execute if the call fails. + */ + setRemoteDescriptionAndFail : function PCW_setRemoteDescriptionAndFail(desc, onFailure) { + var self = this; + this._pc.setRemoteDescription(desc, + unexpectedSuccessCallbackAndFinish(new Error, "setRemoteDescription should have failed."), + function (err) { + info("As expected, failed to set the remote description for " + self.label); + onFailure(err); + }); + }, + + /** + * Adds an ICE candidate and automatically handles the failure case. + * + * @param {object} candidate + * SDP candidate + * @param {function} onSuccess + * Callback to execute if the local description was set successfully + */ + addIceCandidate : function PCW_addIceCandidate(candidate, onSuccess) { + var self = this; + + this._pc.addIceCandidate(candidate, function () { + info("Successfully added an ICE candidate to " + self.label); + onSuccess(); + }, unexpectedCallbackAndFinish(new Error)); + }, + + /** + * Tries to add an ICE candidate and expects failure. Automatically + * causes the test case to fail if the call succeeds. + * + * @param {object} candidate + * SDP candidate + * @param {function} onFailure + * Callback to execute if the call fails. + */ + addIceCandidateAndFail : function PCW_addIceCandidateAndFail(candidate, onFailure) { + var self = this; + + this._pc.addIceCandidate(candidate, + unexpectedSuccessCallbackAndFinish(new Error, "addIceCandidate should have failed."), + function (err) { + info("As expected, failed to add an ICE candidate to " + self.label); + onFailure(err); + }) ; + }, + /** * Checks that we are getting the media we expect. * diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html new file mode 100644 index 000000000000..21a1fe65b1f8 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html @@ -0,0 +1,43 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html new file mode 100644 index 000000000000..1873d52eaf22 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html new file mode 100644 index 000000000000..c92b3b686a97 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html new file mode 100644 index 000000000000..41052d403708 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html @@ -0,0 +1,40 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html new file mode 100644 index 000000000000..6864c7695fe4 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html new file mode 100644 index 000000000000..33505a9d0a43 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html @@ -0,0 +1,41 @@ + + + + + + + + + + +
    +
    +
    + + diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html new file mode 100644 index 000000000000..fb1987e66746 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html @@ -0,0 +1,40 @@ + + + + + + + + + + +
    +
    +
    + + From cdf5176a88f96d7403d70ef04923fc6642be2ad2 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 6 Jun 2013 20:37:09 -0700 Subject: [PATCH 50/93] Bug 880137 part 1: Create reftest directory for flexbox in w3c-css folder. rs=dbaron --- layout/reftests/w3c-css/submitted/flexbox/reftest.list | 0 layout/reftests/w3c-css/submitted/reftest.list | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 layout/reftests/w3c-css/submitted/flexbox/reftest.list diff --git a/layout/reftests/w3c-css/submitted/flexbox/reftest.list b/layout/reftests/w3c-css/submitted/flexbox/reftest.list new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/layout/reftests/w3c-css/submitted/reftest.list b/layout/reftests/w3c-css/submitted/reftest.list index 046b93b6d2dd..b98328586211 100644 --- a/layout/reftests/w3c-css/submitted/reftest.list +++ b/layout/reftests/w3c-css/submitted/reftest.list @@ -19,6 +19,9 @@ include css21/reftest.list # Conditional Rules Level 3 include conditional3/reftest.list +# Flexible Box Layout Module +include flexbox/reftest.list + # Fonts Level 3 # include fonts3/reftest.list From b854f0df24f7c2275980fc102a1d4b5b12085d31 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 6 Jun 2013 20:37:11 -0700 Subject: [PATCH 51/93] Bug 880137 part 2: Migrate most flexbox reftests to the flexbox directory in w3c-css folder. rs=dbaron --HG-- rename : layout/reftests/flexbox/flexbox-align-self-baseline-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-baseline-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-baseline-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-baseline-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-1-block.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-1-block.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-1-table.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-1-table.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-2.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-3.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-4.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-5-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-5-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-horiz-5.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-horiz-5.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-2.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-3.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-4.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-1.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-2.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-3.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-align-self-vert-rtl-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-align-self-vert-rtl-4.xhtml rename : layout/reftests/flexbox/flexbox-baseline-align-self-baseline-horiz-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-align-self-baseline-horiz-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-align-self-baseline-horiz-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-align-self-baseline-horiz-1.html rename : layout/reftests/flexbox/flexbox-baseline-align-self-baseline-vert-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-align-self-baseline-vert-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-align-self-baseline-vert-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-align-self-baseline-vert-1.html rename : layout/reftests/flexbox/flexbox-baseline-empty-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-empty-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-empty-1a.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-empty-1a.html rename : layout/reftests/flexbox/flexbox-baseline-empty-1b.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-empty-1b.html rename : layout/reftests/flexbox/flexbox-baseline-multi-item-horiz-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-multi-item-horiz-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-multi-item-horiz-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-multi-item-horiz-1.html rename : layout/reftests/flexbox/flexbox-baseline-multi-item-vert-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-multi-item-vert-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-multi-item-vert-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-multi-item-vert-1.html rename : layout/reftests/flexbox/flexbox-baseline-single-item-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-single-item-1-ref.html rename : layout/reftests/flexbox/flexbox-baseline-single-item-1a.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-single-item-1a.html rename : layout/reftests/flexbox/flexbox-baseline-single-item-1b.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-baseline-single-item-1b.html rename : layout/reftests/flexbox/flexbox-basic-block-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-block-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-block-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-block-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-block-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-canvas-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-canvas-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-canvas-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-canvas-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-canvas-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-fieldset-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-fieldset-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-fieldset-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-fieldset-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-fieldset-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-iframe-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-iframe-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-iframe-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-iframe-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-iframe-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-img-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-img-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-img-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-img-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-img-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-textarea-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-textarea-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-textarea-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-textarea-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-textarea-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-video-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-video-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-basic-video-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-basic-video-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-basic-video-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-1.xhtml rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-2-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-2-ref.html rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-2.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-2.html rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-3-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-3-ref.html rename : layout/reftests/flexbox/flexbox-items-as-stacking-contexts-3.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-items-as-stacking-contexts-3.html rename : layout/reftests/flexbox/flexbox-justify-content-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-2.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-3.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-4.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-5-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-5-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-horiz-5.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-horiz-5.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-2.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-3.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-4.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-5-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-5-ref.xhtml rename : layout/reftests/flexbox/flexbox-justify-content-vert-5.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-justify-content-vert-5.xhtml rename : layout/reftests/flexbox/flexbox-margin-auto-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-margin-auto-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-margin-auto-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-margin-auto-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-margin-auto-horiz-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-margin-auto-horiz-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-margin-auto-horiz-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-margin-auto-horiz-2.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1-reverse-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1-reverse-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1-reverse.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1-reverse.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1-rtl-reverse.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1-rtl-reverse.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1-rtl.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1-rtl.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-2a.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-2a.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-2b.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-2b.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-3-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-3-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-3-reverse-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-3-reverse-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-3-reverse.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-3-reverse.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-3.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-3.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-4-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-4-ref.xhtml rename : layout/reftests/flexbox/flexbox-mbp-horiz-4.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-mbp-horiz-4.xhtml rename : layout/reftests/flexbox/flexbox-overflow-horiz-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-1-ref.html rename : layout/reftests/flexbox/flexbox-overflow-horiz-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-1.html rename : layout/reftests/flexbox/flexbox-overflow-horiz-2-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-2-ref.html rename : layout/reftests/flexbox/flexbox-overflow-horiz-2.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-2.html rename : layout/reftests/flexbox/flexbox-overflow-horiz-3-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-3-ref.html rename : layout/reftests/flexbox/flexbox-overflow-horiz-3.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-horiz-3.html rename : layout/reftests/flexbox/flexbox-overflow-vert-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-1-ref.html rename : layout/reftests/flexbox/flexbox-overflow-vert-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-1.html rename : layout/reftests/flexbox/flexbox-overflow-vert-2-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-2-ref.html rename : layout/reftests/flexbox/flexbox-overflow-vert-2.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-2.html rename : layout/reftests/flexbox/flexbox-overflow-vert-3-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-3-ref.html rename : layout/reftests/flexbox/flexbox-overflow-vert-3.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-overflow-vert-3.html rename : layout/reftests/flexbox/flexbox-paint-ordering-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-paint-ordering-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-paint-ordering-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-paint-ordering-1.xhtml rename : layout/reftests/flexbox/flexbox-paint-ordering-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-paint-ordering-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-paint-ordering-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-paint-ordering-2.xhtml rename : layout/reftests/flexbox/flexbox-sizing-horiz-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-sizing-horiz-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-1.xhtml rename : layout/reftests/flexbox/flexbox-sizing-horiz-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-sizing-horiz-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-horiz-2.xhtml rename : layout/reftests/flexbox/flexbox-sizing-vert-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-vert-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-sizing-vert-1.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-vert-1.xhtml rename : layout/reftests/flexbox/flexbox-sizing-vert-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-vert-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-sizing-vert-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-sizing-vert-2.xhtml rename : layout/reftests/flexbox/flexbox-table-fixup-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-table-fixup-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-table-fixup-1a.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-table-fixup-1a.xhtml rename : layout/reftests/flexbox/flexbox-table-fixup-1b.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-table-fixup-1b.xhtml rename : layout/reftests/flexbox/flexbox-whitespace-handling-1-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-whitespace-handling-1-ref.xhtml rename : layout/reftests/flexbox/flexbox-whitespace-handling-1a.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-whitespace-handling-1a.xhtml rename : layout/reftests/flexbox/flexbox-whitespace-handling-1b.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-whitespace-handling-1b.xhtml rename : layout/reftests/flexbox/flexbox-whitespace-handling-2-ref.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-whitespace-handling-2-ref.xhtml rename : layout/reftests/flexbox/flexbox-whitespace-handling-2.xhtml => layout/reftests/w3c-css/submitted/flexbox/flexbox-whitespace-handling-2.xhtml rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-1-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-1-ref.html rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-1.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-1.html rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-2-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-2-ref.html rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-2.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-2.html rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-3-ref.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-3-ref.html rename : layout/reftests/flexbox/flexbox-with-pseudo-elements-3.html => layout/reftests/w3c-css/submitted/flexbox/flexbox-with-pseudo-elements-3.html rename : layout/reftests/flexbox/ahem.css => layout/reftests/w3c-css/submitted/flexbox/support/ahem.css rename : layout/reftests/flexbox/solidblue.png => layout/reftests/w3c-css/submitted/flexbox/support/solidblue.png --- layout/reftests/flexbox/reftest.list | 117 +++--------------- ...xbox-align-self-baseline-horiz-1-ref.xhtml | 0 .../flexbox-align-self-baseline-horiz-1.xhtml | 0 .../flexbox-align-self-horiz-1-block.xhtml | 0 .../flexbox-align-self-horiz-1-ref.xhtml | 0 .../flexbox-align-self-horiz-1-table.xhtml | 0 .../flexbox-align-self-horiz-2-ref.xhtml | 0 .../flexbox/flexbox-align-self-horiz-2.xhtml | 0 .../flexbox-align-self-horiz-3-ref.xhtml | 0 .../flexbox/flexbox-align-self-horiz-3.xhtml | 0 .../flexbox-align-self-horiz-4-ref.xhtml | 0 .../flexbox/flexbox-align-self-horiz-4.xhtml | 0 .../flexbox-align-self-horiz-5-ref.xhtml | 0 .../flexbox/flexbox-align-self-horiz-5.xhtml | 0 .../flexbox-align-self-vert-1-ref.xhtml | 0 .../flexbox/flexbox-align-self-vert-1.xhtml | 0 .../flexbox-align-self-vert-2-ref.xhtml | 0 .../flexbox/flexbox-align-self-vert-2.xhtml | 0 .../flexbox-align-self-vert-3-ref.xhtml | 0 .../flexbox/flexbox-align-self-vert-3.xhtml | 0 .../flexbox-align-self-vert-4-ref.xhtml | 0 .../flexbox/flexbox-align-self-vert-4.xhtml | 0 .../flexbox-align-self-vert-rtl-1-ref.xhtml | 0 .../flexbox-align-self-vert-rtl-1.xhtml | 0 .../flexbox-align-self-vert-rtl-2-ref.xhtml | 0 .../flexbox-align-self-vert-rtl-2.xhtml | 0 .../flexbox-align-self-vert-rtl-3-ref.xhtml | 0 .../flexbox-align-self-vert-rtl-3.xhtml | 0 .../flexbox-align-self-vert-rtl-4-ref.xhtml | 0 .../flexbox-align-self-vert-rtl-4.xhtml | 0 ...eline-align-self-baseline-horiz-1-ref.html | 0 ...-baseline-align-self-baseline-horiz-1.html | 0 ...seline-align-self-baseline-vert-1-ref.html | 2 +- ...x-baseline-align-self-baseline-vert-1.html | 2 +- .../flexbox/flexbox-baseline-empty-1-ref.html | 2 +- .../flexbox/flexbox-baseline-empty-1a.html | 2 +- .../flexbox/flexbox-baseline-empty-1b.html | 2 +- ...exbox-baseline-multi-item-horiz-1-ref.html | 0 .../flexbox-baseline-multi-item-horiz-1.html | 0 ...lexbox-baseline-multi-item-vert-1-ref.html | 2 +- .../flexbox-baseline-multi-item-vert-1.html | 2 +- .../flexbox-baseline-single-item-1-ref.html | 0 .../flexbox-baseline-single-item-1a.html | 0 .../flexbox-baseline-single-item-1b.html | 0 .../flexbox-basic-block-horiz-1-ref.xhtml | 0 .../flexbox/flexbox-basic-block-horiz-1.xhtml | 0 .../flexbox-basic-block-vert-1-ref.xhtml | 0 .../flexbox/flexbox-basic-block-vert-1.xhtml | 0 .../flexbox-basic-canvas-horiz-1-ref.xhtml | 0 .../flexbox-basic-canvas-horiz-1.xhtml | 0 .../flexbox-basic-canvas-vert-1-ref.xhtml | 0 .../flexbox/flexbox-basic-canvas-vert-1.xhtml | 0 .../flexbox-basic-fieldset-horiz-1-ref.xhtml | 0 .../flexbox-basic-fieldset-horiz-1.xhtml | 0 .../flexbox-basic-fieldset-vert-1-ref.xhtml | 0 .../flexbox-basic-fieldset-vert-1.xhtml | 0 .../flexbox-basic-iframe-horiz-1-ref.xhtml | 0 .../flexbox-basic-iframe-horiz-1.xhtml | 0 .../flexbox-basic-iframe-vert-1-ref.xhtml | 0 .../flexbox/flexbox-basic-iframe-vert-1.xhtml | 0 .../flexbox-basic-img-horiz-1-ref.xhtml | 24 ++-- .../flexbox/flexbox-basic-img-horiz-1.xhtml | 24 ++-- .../flexbox-basic-img-vert-1-ref.xhtml | 24 ++-- .../flexbox/flexbox-basic-img-vert-1.xhtml | 24 ++-- .../flexbox-basic-textarea-horiz-1-ref.xhtml | 0 .../flexbox-basic-textarea-horiz-1.xhtml | 0 .../flexbox-basic-textarea-vert-1-ref.xhtml | 0 .../flexbox-basic-textarea-vert-1.xhtml | 0 .../flexbox-basic-video-horiz-1-ref.xhtml | 0 .../flexbox/flexbox-basic-video-horiz-1.xhtml | 0 .../flexbox-basic-video-vert-1-ref.xhtml | 0 .../flexbox/flexbox-basic-video-vert-1.xhtml | 0 ...box-items-as-stacking-contexts-1-ref.xhtml | 0 ...flexbox-items-as-stacking-contexts-1.xhtml | 0 ...xbox-items-as-stacking-contexts-2-ref.html | 0 .../flexbox-items-as-stacking-contexts-2.html | 0 ...xbox-items-as-stacking-contexts-3-ref.html | 0 .../flexbox-items-as-stacking-contexts-3.html | 0 .../flexbox-justify-content-horiz-1-ref.xhtml | 0 .../flexbox-justify-content-horiz-1.xhtml | 0 .../flexbox-justify-content-horiz-2-ref.xhtml | 0 .../flexbox-justify-content-horiz-2.xhtml | 0 .../flexbox-justify-content-horiz-3-ref.xhtml | 0 .../flexbox-justify-content-horiz-3.xhtml | 0 .../flexbox-justify-content-horiz-4-ref.xhtml | 0 .../flexbox-justify-content-horiz-4.xhtml | 0 .../flexbox-justify-content-horiz-5-ref.xhtml | 0 .../flexbox-justify-content-horiz-5.xhtml | 0 .../flexbox-justify-content-vert-1-ref.xhtml | 0 .../flexbox-justify-content-vert-1.xhtml | 0 .../flexbox-justify-content-vert-2-ref.xhtml | 0 .../flexbox-justify-content-vert-2.xhtml | 0 .../flexbox-justify-content-vert-3-ref.xhtml | 0 .../flexbox-justify-content-vert-3.xhtml | 0 .../flexbox-justify-content-vert-4-ref.xhtml | 0 .../flexbox-justify-content-vert-4.xhtml | 0 .../flexbox-justify-content-vert-5-ref.xhtml | 0 .../flexbox-justify-content-vert-5.xhtml | 0 .../flexbox-margin-auto-horiz-1-ref.xhtml | 0 .../flexbox/flexbox-margin-auto-horiz-1.xhtml | 0 .../flexbox-margin-auto-horiz-2-ref.xhtml | 0 .../flexbox/flexbox-margin-auto-horiz-2.xhtml | 0 .../flexbox/flexbox-mbp-horiz-1-ref.xhtml | 0 .../flexbox-mbp-horiz-1-reverse-ref.xhtml | 0 .../flexbox/flexbox-mbp-horiz-1-reverse.xhtml | 0 .../flexbox-mbp-horiz-1-rtl-reverse.xhtml | 0 .../flexbox/flexbox-mbp-horiz-1-rtl.xhtml | 0 .../flexbox/flexbox-mbp-horiz-1.xhtml | 0 .../flexbox/flexbox-mbp-horiz-2-ref.xhtml | 0 .../flexbox/flexbox-mbp-horiz-2a.xhtml | 0 .../flexbox/flexbox-mbp-horiz-2b.xhtml | 0 .../flexbox/flexbox-mbp-horiz-3-ref.xhtml | 0 .../flexbox-mbp-horiz-3-reverse-ref.xhtml | 0 .../flexbox/flexbox-mbp-horiz-3-reverse.xhtml | 0 .../flexbox/flexbox-mbp-horiz-3.xhtml | 0 .../flexbox/flexbox-mbp-horiz-4-ref.xhtml | 0 .../flexbox/flexbox-mbp-horiz-4.xhtml | 0 .../flexbox/flexbox-overflow-horiz-1-ref.html | 0 .../flexbox/flexbox-overflow-horiz-1.html | 0 .../flexbox/flexbox-overflow-horiz-2-ref.html | 0 .../flexbox/flexbox-overflow-horiz-2.html | 0 .../flexbox/flexbox-overflow-horiz-3-ref.html | 0 .../flexbox/flexbox-overflow-horiz-3.html | 0 .../flexbox/flexbox-overflow-vert-1-ref.html | 0 .../flexbox/flexbox-overflow-vert-1.html | 0 .../flexbox/flexbox-overflow-vert-2-ref.html | 0 .../flexbox/flexbox-overflow-vert-2.html | 0 .../flexbox/flexbox-overflow-vert-3-ref.html | 0 .../flexbox/flexbox-overflow-vert-3.html | 0 .../flexbox-paint-ordering-1-ref.xhtml | 0 .../flexbox/flexbox-paint-ordering-1.xhtml | 0 .../flexbox-paint-ordering-2-ref.xhtml | 0 .../flexbox/flexbox-paint-ordering-2.xhtml | 0 .../flexbox/flexbox-sizing-horiz-1-ref.xhtml | 0 .../flexbox/flexbox-sizing-horiz-1.xhtml | 0 .../flexbox/flexbox-sizing-horiz-2-ref.xhtml | 0 .../flexbox/flexbox-sizing-horiz-2.xhtml | 0 .../flexbox/flexbox-sizing-vert-1-ref.xhtml | 0 .../flexbox/flexbox-sizing-vert-1.xhtml | 0 .../flexbox/flexbox-sizing-vert-2-ref.xhtml | 0 .../flexbox/flexbox-sizing-vert-2.xhtml | 0 .../flexbox/flexbox-table-fixup-1-ref.xhtml | 0 .../flexbox/flexbox-table-fixup-1a.xhtml | 0 .../flexbox/flexbox-table-fixup-1b.xhtml | 0 .../flexbox-whitespace-handling-1-ref.xhtml | 0 .../flexbox-whitespace-handling-1a.xhtml | 0 .../flexbox-whitespace-handling-1b.xhtml | 0 .../flexbox-whitespace-handling-2-ref.xhtml | 2 +- .../flexbox-whitespace-handling-2.xhtml | 2 +- .../flexbox-with-pseudo-elements-1-ref.html | 0 .../flexbox-with-pseudo-elements-1.html | 0 .../flexbox-with-pseudo-elements-2-ref.html | 0 .../flexbox-with-pseudo-elements-2.html | 0 .../flexbox-with-pseudo-elements-3-ref.html | 0 .../flexbox-with-pseudo-elements-3.html | 0 .../w3c-css/submitted/flexbox/reftest.list | 107 ++++++++++++++++ .../submitted/flexbox/support/ahem.css | 4 + .../submitted/flexbox/support/solidblue.png | Bin 0 -> 135 bytes 158 files changed, 184 insertions(+), 158 deletions(-) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-baseline-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-baseline-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-1-block.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-1-table.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-5-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-horiz-5.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-align-self-vert-rtl-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-align-self-baseline-horiz-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-align-self-baseline-horiz-1.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-align-self-baseline-vert-1-ref.html (95%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-align-self-baseline-vert-1.html (96%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-empty-1-ref.html (96%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-empty-1a.html (94%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-empty-1b.html (94%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-multi-item-horiz-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-multi-item-horiz-1.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-multi-item-vert-1-ref.html (94%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-multi-item-vert-1.html (95%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-single-item-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-single-item-1a.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-baseline-single-item-1b.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-block-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-block-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-block-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-block-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-canvas-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-canvas-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-canvas-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-canvas-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-fieldset-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-fieldset-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-fieldset-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-fieldset-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-iframe-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-iframe-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-iframe-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-iframe-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-img-horiz-1-ref.xhtml (53%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-img-horiz-1.xhtml (77%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-img-vert-1-ref.xhtml (55%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-img-vert-1.xhtml (78%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-textarea-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-textarea-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-textarea-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-textarea-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-video-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-video-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-video-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-basic-video-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-2-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-2.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-3-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-items-as-stacking-contexts-3.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-5-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-horiz-5.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-5-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-justify-content-vert-5.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-margin-auto-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-margin-auto-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-margin-auto-horiz-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-margin-auto-horiz-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1-reverse-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1-reverse.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1-rtl-reverse.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1-rtl.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-2a.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-2b.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-3-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-3-reverse-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-3-reverse.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-3.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-4-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-mbp-horiz-4.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-1.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-2-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-2.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-3-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-horiz-3.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-1.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-2-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-2.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-3-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-overflow-vert-3.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-paint-ordering-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-paint-ordering-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-paint-ordering-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-paint-ordering-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-horiz-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-horiz-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-horiz-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-horiz-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-vert-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-vert-1.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-vert-2-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-sizing-vert-2.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-table-fixup-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-table-fixup-1a.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-table-fixup-1b.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-whitespace-handling-1-ref.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-whitespace-handling-1a.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-whitespace-handling-1b.xhtml (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-whitespace-handling-2-ref.xhtml (96%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-whitespace-handling-2.xhtml (95%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-1-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-1.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-2-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-2.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-3-ref.html (100%) rename layout/reftests/{ => w3c-css/submitted}/flexbox/flexbox-with-pseudo-elements-3.html (100%) create mode 100644 layout/reftests/w3c-css/submitted/flexbox/support/ahem.css create mode 100644 layout/reftests/w3c-css/submitted/flexbox/support/solidblue.png diff --git a/layout/reftests/flexbox/reftest.list b/layout/reftests/flexbox/reftest.list index c6424791d1f5..e8294df0ae2e 100644 --- a/layout/reftests/flexbox/reftest.list +++ b/layout/reftests/flexbox/reftest.list @@ -1,3 +1,14 @@ +# NOTE: Most of our flexbox tests have moved to the w3c-css reftest directory. +# The tests that remain in *this* directory are still here because either: +# a) They (or one of their closely-related tests) use some moz-prefixed +# feature, e.g. MozReftestInvalidate or -moz-max-content. +# ...or... +# b) They test a feature that has known bugs (e.g. bug 874713) +# +# Where possible & practical, we should try to address these so we can migrate +# tests over to the w3c-css directory, so that they can become part of the +# W3C's test suite. + # Tests for flexbox pref "layout.css.flexbox.enabled" # (Note that it defaults to being off in release builds - see bug 841876) # Check that manually setting the pref on/off w/ test-pref() works correctly: @@ -11,72 +22,35 @@ test-pref(layout.css.flexbox.enabled,true) == flexbox-pref-1.xhtml flexbox-pref- default-preferences pref(layout.css.flexbox.enabled,true) # Tests for cross-axis alignment (align-self / align-items properties) -== flexbox-align-self-baseline-horiz-1.xhtml flexbox-align-self-baseline-horiz-1-ref.xhtml fails == flexbox-align-self-baseline-horiz-2.xhtml flexbox-align-self-baseline-horiz-2-ref.xhtml # bug 793456, and possibly others # This one fails on windows R (but not Ru, strangely). On Windows R, the # single-line