bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

OpenSearch component for Remora (validation and OS->Sherlock conversion)



addons.mozilla.org Graveyard
Search Plugins
12 years ago
2 years ago


(Reporter: Gavin, Assigned: Gavin)




(1 attachment, 1 obsolete attachment)

I've been working on a component for Remora that will parse OpenSearch files, validate them, and optionally convert them to Sherlock, if possible.
Created attachment 244811 [details] [diff] [review]
OpenSearch component, with tests

I'm very much not familiar with PHP, so please feel free to point out if I've done anything stupid, or if there are better ways to do things that I'm not aware of.
Assignee: nobody → gavin.sharp
Attachment #244811 - Flags: first-review?(sancus)
Created attachment 248588 [details] [diff] [review]
updated OpenSearch component, with tests

This includes a minor fix to make getImage work (and an added test for it), and fixes a few problems with the data: URIs in the tests.

One thing that I'm particularly unsure about is that trying to add arbitrarily named entries (e.g. $this->attrs['ShortName']) to arrays results in lots of "undefined index" warnings, so I resorted to initializing the arrays with the right key names and empty elements (see reset()). Should I be using some other type of object for a simple key->value hash?
Attachment #244811 - Attachment is obsolete: true
Attachment #244811 - Flags: first-review?(sancus)
Attachment #248588 - Flags: first-review?(sancus)
Whiteboard: [patch-r?]
Comment on attachment 248588 [details] [diff] [review]
updated OpenSearch component, with tests

Per the discussion in IRC, the code causes errors without array index initializations because there's a few places where operations are performed on array indexes that may not exist at that time, such as the increment at line 330. That said, the code works fine with the initializations and I don't think they're a problem, so I'm landing this as-is.
Attachment #248588 - Flags: first-review?(sancus) → first-review+
Whiteboard: [patch-r?]
I'm going to mark this FIXED, because the code's landed. Integration of the component into Remora will be dealt separately.
Last Resolved: 11 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.