Closed
Bug 778044
Opened 12 years ago
Closed 12 years ago
Add a way to pref off interface objects
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla18
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
10.98 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
We need this for things like WebSocket.
We have two options here. We can either make this call nsWebSocket::PrefEnabled(), and generally use that pattern, or put the actual pref in the IDL.
I'm leaning towards the former to not duplicate the pref name and whatnot.
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bzbarsky
Comment 1•12 years ago
|
||
Putting the actual pref in the IDL would make things more readable, IMO.
Assignee | ||
Comment 2•12 years ago
|
||
How so? The IDL would be quite readable with:
[PrefControlled]
interface Foo {
};
which would call FooNativeType::PrefEnabled() on the C++ side.
Comment 3•12 years ago
|
||
I was talking about the name of the pref... Of course I may not quite know what this bug was filed for... :-)
Assignee | ||
Comment 4•12 years ago
|
||
Well, the name of the pref in my proposed setup would be in just one place: the PrefEnabled() impl.
Note that we have such an impl already and would still have it, so putting the pref name in the IDL would mean having it in two places...
Comment 5•12 years ago
|
||
(In reply to comment #4)
> Well, the name of the pref in my proposed setup would be in just one place: the
> PrefEnabled() impl.
>
> Note that we have such an impl already and would still have it, so putting the
> pref name in the IDL would mean having it in two places...
OK, what you're saying sounds good to me!
Comment 6•12 years ago
|
||
Could we autogenerate the pref check and have pref mentioned only in the webidl?
Assignee | ||
Comment 7•12 years ago
|
||
At least in the websocket case the implementation methods actually check the pref in various places.
Assignee | ||
Comment 8•12 years ago
|
||
Peter, would it make any sense to just store a bool* in the namestruct and if non-null to read what it's pointing to? Then we could initially point it to some boolean that observes the pref (or null, if not preffed).
Updated•12 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #658331 -
Flags: review?(peterv)
Assignee | ||
Updated•12 years ago
|
Keywords: dev-doc-needed
Whiteboard: [need review]
Updated•12 years ago
|
Attachment #658331 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 10•12 years ago
|
||
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla18
Assignee | ||
Comment 11•12 years ago
|
||
Keywords: dev-doc-needed → dev-doc-complete
Comment 12•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 13•12 years ago
|
||
Is PrefEnabled called every time the value is looked up?
Assignee | ||
Comment 14•12 years ago
|
||
If it keeps returning false, then yes.
If it returns true for a given window, it will normally not get called after that for that window.
Comment 15•12 years ago
|
||
(In reply to comment #14)
> If it keeps returning false, then yes.
>
> If it returns true for a given window, it will normally not get called after
> that for that window.
That's not great, at least for the purpose of writing tests for a preffed-off feature. Can we fix that easily?
Assignee | ||
Comment 16•12 years ago
|
||
Not without completely rewriting how prototypes are looked up on windows, unfortunately.
That said, the only problem arises if you have a test that takes a preffed-off feature, flips the pref, tests the feature, flips the pref back, and then tries to test things that depend on the feature being preffed off, right?
Comment 17•12 years ago
|
||
(In reply to comment #16)
> That said, the only problem arises if you have a test that takes a preffed-off
> feature, flips the pref, tests the feature, flips the pref back, and then tries
> to test things that depend on the feature being preffed off, right?
Oh wait. Comment 14 was per window (as in, the global window object), right? In that case, please ignore what I said!
Assignee | ||
Comment 18•12 years ago
|
||
Yes, per inner window. So as soon as you work with a different window, or navigate to a different page, you will get the pref check again.
Comment 19•12 years ago
|
||
(In reply to comment #18)
> Yes, per inner window. So as soon as you work with a different window, or
> navigate to a different page, you will get the pref check again.
Perfect!
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•