Closed Bug 713825 Opened 13 years ago Closed 12 years ago

Move nsIDocCharset and nsIDocumentCharsetInfo into docshell

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: smontagu, Assigned: smontagu)

References

Details

(Keywords: addon-compat, dev-doc-complete)

Attachments

(3 files)

      No description provided.
Attachment #584569 - Flags: review?(bzbarsky)
Attachment #584570 - Flags: review?(bzbarsky)
Since the forcedDetector thing has been "write me" since for ever, I should think it can just disappear.
Attachment #584597 - Flags: review?(bzbarsky)
Comment on attachment 584569 [details] [diff] [review]
Move nsIDocCharset

There are a bunch of addons that use nsIDocCharset.  So this needs to be dev-doc-needed and addon-compat, and we may want to leave an empty nsIDocSharset interface that docshell QIs to and window returns via getInterface for a release or two.....

r=me modulo that.
Attachment #584569 - Flags: review?(bzbarsky) → review+
Comment on attachment 584570 [details] [diff] [review]
Move nsIDocumentCharsetInfo

Can you document the new properties on nsIDocShell, please?

Are you sure the mobile browser.xml change won't screw things up?  Seems like people could be relying on that .docShell prop returning null.  Needs review from someone who knows that code.

r=me with that...
Attachment #584570 - Flags: review?(bzbarsky) → review+
Oh, that second part probably also needs documentation, but seems to not be used by addons much.
Comment on attachment 584597 [details] [diff] [review]
Remove forcedDetector

Seems like BrowserSetForcedDetector should be renamed and any calls with !doReload be eliminated.  Followup bug?  r=me
Attachment #584597 - Flags: review?(bzbarsky) → review+
Comment on attachment 584570 [details] [diff] [review]
Move nsIDocumentCharsetInfo

(In reply to Boris Zbarsky (:bz) from comment #5)
> Are you sure the mobile browser.xml change won't screw things up?  Seems
> like people could be relying on that .docShell prop returning null.  Needs
> review from someone who knows that code.

Matt, can you look at the changes to mobile/ ? Thanks.
Attachment #584570 - Flags: review?(mbrubeck)
Comment on attachment 584570 [details] [diff] [review]
Move nsIDocumentCharsetInfo

>+++ b/mobile/xul/chrome/content/bindings/browser.xml

>       <property name="docShell"
>                 onget="return null"
>-                readonly="true"/>
>+                readonly="true">
>+         <getter><![CDATA[
>+            return {
>+               forcedCharset : this._charset,
>+               forcedDetector : false,
>+               parentCharset : "",
>+               parentCharsetSource : 0
>+            }
>+         ]]></getter>
>+      </property>

Please also remove the onget="return null" line.

Aside from that, this looks good to me.  No mobile code accesses the browser.docShell property.
Attachment #584570 - Flags: review?(mbrubeck) → review+
(In reply to Boris Zbarsky (:bz) from comment #4)
> Comment on attachment 584569 [details] [diff] [review]
> Move nsIDocCharset
> 
> There are a bunch of addons that use nsIDocCharset.  So this needs to be
> dev-doc-needed and addon-compat, and we may want to leave an empty
> nsIDocSharset interface that docshell QIs to and window returns via
> getInterface for a release or two.....

I don't understand this, neither (a) technically nor (b) the principals behind it. For (a), it would probably help if you could point me to some other interface where we did something similar. For (b) I don't understand why an empty interface is better for compat than no interface -- I would have thought the reverse (if those are the only choices), since I would expect no interface to give an error but an empty interface to produce hard-to-debug bugs.
"an error" -- i.e. an error message that makes the needed fix clear to a web developer.
> For (a), it would probably help if you could point me to some other interface where we
> did something similar

I can't find it right now, sadly....  There was a case recently where we brought back an interface as empty precisely for extension compat.

> (b) I don't understand why an empty interface is better for compat than no interface

Because of XPConnect interface flattening.

Say you have code that does something like:

  var foo = getBar().QueryInterface(Ci.nsIBaz).something();

If |something| is moved from nsIBaz to nsIBar (which is the return value of getBar()) and nsIBaz is eliminated, this line of code will throw because the QI will fail.  But if the same move is done but nsIBaz is left empty, the code will work, because in JS the return value of the QI has all the nsIBar _and_ nsIBaz methods visible on it.

In this case, as long as the extension was getting nsIDocumentCharsetInfo by QIing an nsIDocShell object, the extension will keep working.
Blocks: 720310
Blocks: 720312
Flags: in-testsuite+
Depends on: 721533
Depends on: 721535
(In reply to Boris Zbarsky (:bz) from comment #12)
> > For (a), it would probably help if you could point me to some other interface where we
> > did something similar
> 
> I can't find it right now, sadly....  There was a case recently where we
> brought back an interface as empty precisely for extension compat.
> 
> > (b) I don't understand why an empty interface is better for compat than no interface
> 
> Because of XPConnect interface flattening.

We did this with nsIDOMWindowInternal in Firefox 8. See: https://developer.mozilla.org/en/Firefox/Updating_add-ons_for_Firefox_8#Interfaces_have_been_merged
(In reply to Eric Shepherd [:sheppy] from comment #16)
> We did this with nsIDOMWindowInternal in Firefox 8. See:
> https://developer.mozilla.org/en/Firefox/Updating_add-
> ons_for_Firefox_8#Interfaces_have_been_merged

Thanks, I managed to work this out and make the necessary changes before checkin :)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: