Closed Bug 23400 Opened 25 years ago Closed 25 years ago

[BETA] Need to expose api GetDocumentCharacterSet() to JS

Categories

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

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: tao, Assigned: tao)

References

()

Details

(Whiteboard: patch available for checkin)

Here is a copy of the article pointed by the URL field above.

"These |GetDocumentCharacterSet()| method is exposed
on nsIDocument only. IMO, we should probably add this to either
NSDocument
(http://lxr.mozilla.org/mozilla/source/dom/public/idl/coreDom/Document.idl)
or NSHTMLDocument
(http://lxr.mozilla.org/mozilla/source/dom/public/idl/html/HTMLDocument.idl)."

The "View| charset > " menu feature needs to know the charset of the current
loaded document in the frame from JS.
Assignee: vidur → tao
Sorry guys, if this an RFE, you're going to have to implement yourself. I'll be
happy to point you in the right direction and review when you're done, but I
don't have the bandwidth to deal with new functionality.
Hi, Vidur:

Would you please feed us information about how to do it in the right way?


Thanks.
Blocks: 20761
Summary: Need to expose api GetDocumentCharacterSet() to JS → [BETA] Need to expose api GetDocumentCharacterSet() to JS
Vidur, Can you point us at similar code that uses the pre-non-IDL mechanism
to expose APIs to JS?  This functionality is needed to enable the new charset
encoding menu for Beta1.
Status: NEW → ASSIGNED
Whiteboard: patch available for checkin
Hi, Bob:

Vidur worked with me yesterday afteroon to come up the patch. Mostly Vidur's
work; the only thing I did is to test it on NT and Linux.

I'll check in the code as soon as tree open.


Thanks
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
To verify it:

Please copy the lines inbetween "+++" marks to the bottom of

      chrome/global/content/default/charsetOverlay.js

and rerun Mozilla. You can click on Sidebar panel, the location bar, or the
browser page to move focus. You shall see the current charset of the loaded
page dump to the console.

Feel free to let me know if you have any problem verifying it.

+++++ BEGIN ++++++++
function charsetFocusListener(event)
{

    dump("\n++ JS charsetFocusListener, event=" + event + "++\n");
    var charsetMenu = document.getElementById( "charsetMenu" );
    if (charsetMenu) {
      dump("\n** charsetMenu=" + charsetMenu + "--\n");
    }

    dump("\n++++ JS charsetFocusListener: the current focused object is: " +
         document.commandDispatcher.focusedWindow + "--\n");
    dump("\n>>>> JS charsetFocusListener: content object charset is: " +
         document.commandDispatcher.focusedWindow.content.document.characterSet
+ "--\n");

}

  window.addEventListener("focus",
             charsetFocusListener,
             false /* true = capture, false = bubble */);


+++++ END ++++++++++
Teruko, this is a code change for i18n. Please set the appropriate QA contact. 
Thanks.
QA Contact: gerardok → teruko
Verified.
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.