Firefox Sidebar and Document object of DOM

By : ardsrk
Source: Stackoverflow.com
Question!

There is a webpage loaded in the firefox sidebar and another webpage loaded in the main document. Now, how do I ask access the main document object through the Firefox sidebar? An example to do this through Javascript code in the firefox sidebar document to access the main document would be helpful.

Thanks for the answers. I have to refine my question however. The main window has some webpage loaded and the sidebar has a webpage. I want the sidebar window to know what text the user has selected on the main window when a link on the sidebar window is clicked. I know how to get the selected text from a window. Only that the sidebar element adds complexity to the problem that I am not able to surpass.

@PConory:

I like your answer, but when I try it there is an error: Error: Permission denied to create wrapper for object of class UnnamedClass.

Thanks.

By : ardsrk


Answers

Are you trying to write in-page javascript that will allow communication between the sidebar page and the tab page? There are restrictions on which pages can see each other and communicate:

  • If the pages are not on the same domain, they aren't allowed to talk (same-domain restriction).
  • If one page did not open the other, there is no way for either page to acquire a reference to the other.

I'm not sure how a page can request the opening of a page in the sidebar, or vice versa. But if you can manage that, use var child = window.open(...) to get a reference one direction and window.opener to get a reference the other direction.

By : phyzome


My "short" answer:


You may have noticed this already, but just in case:

First of all, even when you see that error, (assuming that you click past it and continue), then you should still be able to use 99% of the debugging features in Xcode. In other words, that error means that only a very small, specific portion of the debugger is "broken" for a given debugging session. It does not mean that debugging is completely down and/or impossible for the given program-execution.

Given the above fact, if you simply want to get rid of the error and do not care whether Custom Data Formatters are working or not, then REMOVE the check-mark next to the following menu item:

  • Run -> Variables View -> Enable Data Formatters

My "long" answer:


The developers in my office had been experiencing this very same Xcode error for quite a while until someone discovered that some third party libraries were the cause.

In our case, this error was happening only for projects using wxWidgets. I am not meaning to imply that usage of wxWidgets is the only possible cause. I am only trying to put forth more information that might lead to the right solution for your case.

Also of interest: we (in my office) were getting this error without any use or presence of any .gdbinit file whatsoever.

It turns out that the "property" of wxWidgets that made it trigger this error was related to a "custom/generic" implementation of "dlopen." Prior to Mac OS X 10.3, dlopen was not provided within the operating system, so apparently some libraries coded their own versions. When such libraries are being used, then apparently the dlopen call that tries to open PBGDBIntrospectionSupport.A.dylib can fail.

Read through the comments on this sourceforge patch submission to learn even further details about dlopen in 10.3 and beyond.

Also, here is another related link:

Message on the Xcode users mailing list about PBGDBIntrospectionSupport and Custom Data Formatters



This video can help you solving your question :)
By: admin