Bug 1495184 - Follow-up: Make gData's onSecurityChange() backward compatible. r=MakeMyDay DONTBUILD
authorJorg K <jorgk@jorgk.com>
Mon, 01 Oct 2018 12:32:02 +0200
changeset 33278 93d3584af75b199939a7e19ef2c6d87d44d494fa
parent 33277 cb236791087d7f8a495acceb6b330f184e144070
child 33279 630fc01f8e33b9dc4fe8831c8038e534ade67314
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersMakeMyDay
bugs1495184
Bug 1495184 - Follow-up: Make gData's onSecurityChange() backward compatible. r=MakeMyDay DONTBUILD
calendar/providers/gdata/content/browserRequest.js
--- a/calendar/providers/gdata/content/browserRequest.js
+++ b/calendar/providers/gdata/content/browserRequest.js
@@ -30,26 +30,30 @@ var reporterListener = {
     onLocationChange: function(aWebProgress, aRequest, aLocation) {
         document.getElementById("headerMessage").textContent = aLocation.spec;
     },
 
     onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
     },
 
     onSecurityChange: function(aWebProgress, aRequest, aOldState, aState, aContentBlockingLogJSON) {
+        // Before mozilla64 this function had three parameters, aState being the third one.
+        // From mozilla64 the function has five parameters.
+        // Once support for versions below 64 is dropped, this workaround can be removed.
+        let state = typeof aState === "undefined" ? aOldState : aState;
         const wpl_security_bits = wpl.STATE_IS_SECURE |
                                     wpl.STATE_IS_BROKEN |
                                     wpl.STATE_IS_INSECURE |
                                     wpl.STATE_SECURE_HIGH |
                                     wpl.STATE_SECURE_MED |
                                     wpl.STATE_SECURE_LOW;
         let browser = document.getElementById("requestFrame");
         let level;
 
-        switch (aState & wpl_security_bits) {
+        switch (state & wpl_security_bits) {
             case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_HIGH:
                 level = "high";
                 break;
             case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_MED:
             case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_LOW:
                 level = "low";
                 break;
             case wpl.STATE_IS_BROKEN: