Closed Bug 1176442 Opened 5 years ago Closed 1 year ago

Convert Web Manifest to Web IDL dictionary

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED INVALID
Tracking Status
firefox41 --- affected

People

(Reporter: marcosc, Unassigned)

References

(Blocks 1 open bug)

Details

Elsewhere, Bobby said: "manifest looks like it would be well-served by a type-safe WebIDL dictionary - is there any reason you're not using webidl here?"
Main reason was that it's not exposed to web content. But I would be happy to convert it to WebIDL. Do you have any examples of people doing similar things?
Flags: needinfo?(bobbyholley)
(In reply to Marcos Caceres [:marcosc] from comment #1)
> Main reason was that it's not exposed to web content.

Given the Xray troubles you were having, it's presumably exposed to _some_ kind of untrusted content.

> But I would be happy
> to convert it to WebIDL. Do you have any examples of people doing similar
> things?

I'd start here? https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#Implementing_WebIDL_using_Javascript

The Dictionary is the easy part - the more involved part will be designing your API such that it is expressed in WebIDL, which lets you give the arguments strong types (i.e. your dictionary).
Flags: needinfo?(bobbyholley)
(In reply to Bobby Holley (:bholley) from comment #2)
> (In reply to Marcos Caceres [:marcosc] from comment #1)
> > Main reason was that it's not exposed to web content.
> 
> Given the Xray troubles you were having, it's presumably exposed to _some_
> kind of untrusted content.

No, I was having e10s grief with message passing (which for whatever reason cloneInto() fixed... but then it caused the other problems I was having). I fixed that now ^_^. 

> > But I would be happy
> > to convert it to WebIDL. Do you have any examples of people doing similar
> > things?
> 
> I'd start here?
> https://developer.mozilla.org/en-US/docs/Mozilla/
> WebIDL_bindings#Implementing_WebIDL_using_Javascript
> 
> The Dictionary is the easy part - the more involved part will be designing
> your API such that it is expressed in WebIDL, which lets you give the
> arguments strong types (i.e. your dictionary).

Ok, thanks for the pointer. I'll see about shifting over.
Putting this here for now... will add it to dom/webidl/ soon. 

```
dictionary WebManifest {
  DOMString description;
  TextDirection dir; 
  DisplayMode display;
  DOMString lang;
  DOMString name;
  OrientationLockType orientation;
  USVString scope;
  DOMString short_name;
  USVString start_url;
}

enum TextDirection {
  "rtl", 
  "ltr",
  "auto",
}

enum DisplayMode {
  "browser",
  "fullscreen",
  "minimal-ui",
  "standalone",
}

```
Assignee: nobody → mcaceres
Assignee: mcaceres → nobody
Component: DOM → DOM: Core & HTML

We tried this, but it doesn't work in practice... the manifest allows for string case variants that don't map well to enums, for example. Also, the manifest is really a data format, and WebIDL is an interface definition format.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.