Refactor utils functions into {Common,Crypto}Utils

RESOLVED FIXED in mozilla15

Status

()

defect
RESOLVED FIXED
8 years ago
11 months ago

People

(Reporter: gps, Assigned: gps)

Tracking

unspecified
mozilla15
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [qa-])

Attachments

(1 attachment)

Moved a lot of code out of Util and into CommonUtils and a newly-created CryptoUtils. Installed proxies in the old Util so existing code doesn't need to be updated (that would make an obvious follow-up bug).

I made some minor style changes along the way. Some functions could still use a lot of love though (again, a good follow-up bug).

This isn't strictly required for AITC. But, there was a resource://services-sync/util.js reference for HTTP MAC that I didn't want to see. That required moving all the HMAC functions over. At that point, I went all in and moved all the crypto functions. I stopped short of getting rid of Svc.Crypto b/c I didn't want to touch record.js (or anything outside of the /utils?\.js/ files.

The tests: they all pass!
Attachment #614983 - Flags: review?(rnewman)
Blocks: 745424
Hmm, perhaps it would be easier to roll in encodeBase64url from Utils to CommonUtils in this bug? Then we wouldn't need bug 745425 anymore.
Comment on attachment 614983 [details] [diff] [review]
Refactor utility functions, v1

Review of attachment 614983 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good to me, albeit with a cursory review only.

::: services/common/utils.js
@@ +141,5 @@
>      }
>    },
>  
> +  byteArrayToString: function byteArrayToString(bytes) {
> +    return [String.fromCharCode(byte) for each (byte in bytes)].join("");

Ugh.
Attachment #614983 - Flags: review?(rnewman) → review+
https://hg.mozilla.org/services/services-central/rev/a791bf9ecb45
Assignee: nobody → gps
Whiteboard: [fixed in services]
[qa-] but I'll smoketest Sync to be certain nothing is broken.
Whiteboard: [fixed in services] → [fixed in services][qa-]
https://hg.mozilla.org/mozilla-central/rev/a791bf9ecb45
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [fixed in services][qa-] → [qa-]
Target Milestone: --- → mozilla15
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.