Closed Bug 561480 Opened 14 years ago Closed 14 years ago

Errors when loading WeaveCrypto.js on older platforms

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Dolske, Assigned: Mardak)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch v.1 (obsolete) — Splinter Review
Until we transition over entirely to the js-ctypes flavor of WeaveCrypto, Weave will currently load both the binary and WeaveCrypto.js components, and pick between them at runtime.

This works fine, except that on pre-1.9.3 platforms this causes some harmless (?) error console noise, because WeaveCrypto.js can't import Services.jsm and jsctypes.jsm, which are new in 1.9.3.

This patch defers loading these modules until after a platform version check.
Attachment #441183 - Flags: review?(mconnor)
So this will leave a registered component that does nothing? Or it'll fail to do stuff when its interfaces are poked?
Hrm yeah,

Components.classes["@labs.mozilla.com/Weave/Crypto;2"].getService(Components.interfaces.IWeaveCrypto).generateRandomIV()

Error: uncaught exception: [Exception... "'[JavaScript Error: "Services is not defined" {file: "file:///Users/Ed/weave/dist/stage/components/WeaveCrypto.js" line: 109}]' when calling method: [IWeaveCrypto::generateRandomIV]"
Yeah, perhaps component = [WeaveCrypto] should just be [] if something fails.
It's a component that only works on 1.9.3, no one should be invoking it on 1.9.2. This is just an interm fix until Weave only supports 1.9.3+, at which point it can be reverted.
Bug 561005 was going to check for existence of ;2 and load ;1 instead of doing the appinfo lookup everywhere.

let components = [];
try {
  Cu.import(..)
  components.push(WeaveCrypto);
}
catch(ex) {} ?
Depends on: 561005
Summary: Defer loading jsctypes.jsm and Services.jsm to hush errors on older platforms → Errors when loading WeaveCrypto.js on older platforms
Attached patch v2Splinter Review
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #443227 - Flags: review?(mconnor)
Depends on: 513798
Attachment #441183 - Attachment is obsolete: true
Attachment #441183 - Flags: review?(mconnor)
Attachment #443227 - Flags: review?(mconnor) → review+
http://hg.mozilla.org/labs/weave/rev/9396b591a8db
Only register WeaveCrypto if it was able to import scripts.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.3b4
Component: Firefox Sync: Crypto → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: