Hi,
I have written a custom "memory" protocol handler that supposely
feeds an XUL page in memory to gecko.
However, It only works partially.
From debugger, I can see some of the XBL bindings failed.
And the resultant page does not show the menubar nor the iframe.
This is the page I am trying to load from memory:
//------------------------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://workspace/skin/" type="text/css"?>
<window id="workspace_window" width="640" height="450" screenX="200"
screenY="200"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox flex="1">
<toolbox>
<menubar id="menubar">
<menu label="File" accesskey="F">
<menupopup>
<menuitem label="New" accesskey="N"/>
<menuitem label="Open" accesskey="O"/>
<menuitem label="Close" accesskey="C"/>
<menuseparator/>
<menuitem label="Exit" accesskey="x" id="app_exit"/>
</menupopup>
</menu>
<menu label="Edit" accesskey="E">
<menupopup>
<menuitem label="Undo" accesskey="U" acceltext="Ctrl+Z"/>
<menuitem label="Redo" accesskey="R" acceltext="Ctrl+Y"/>
<menuseparator/>
<menuitem label="Cut" accesskey="t" acceltext="Ctrl+X"/>
<menuitem label="Copy" accesskey="C" acceltext="Ctrl+C"/>
<menuitem label="Paste" accesskey="P" acceltext="Ctrl+V"/>
<menuitem label="Delete" accesskey="D" acceltext="Del"/>
<menuseparator/>
<menuitem label="Select All" accesskey="A" acceltext="Ctrl+A"/>
</menupopup>
</menu>
</menubar>
</toolbox>
<spacer style="height: 5px"/>
<tabbox flex="1">
<tabs>
<tab label=" Work Space "/>
<tab label=" Source View "/>
</tabs>
<tabpanels orient="horizontal" flex="1">
<tabpanel id="workspace_tabpanel" flex="1">
<iframe id="factory_iframe" width="600" height="400" flex="1"/>
</tabpanel>
<tabpanel id="sourceview_tabpanel" flex="1" align="start">
<button label="Clear News Buffer"/>
</tabpanel>
</tabpanels>
</tabbox>
<statusbar id="status_bar" persist="collapsed">
<statusbarpanel class="status_icon" id="status-icon" collapsed="true"/>
<statusbarpanel id="status_text" flex="1" crop="end"/>
</statusbar>
</vbox>
</window>
//------------------------------------------------------------
I used the following code to load the page, which in turn
calls my memory protocol handler:
NS_NAMED_LITERAL_STRING(path, "memory://host/workspace.xul");
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(bw->mWebBrowser));
webNav->LoadURI(path.get(), nsIWebNavigation::LOAD_FLAGS_NONE, nsnull,
nsnull, nsnull);
//------------------------------------------------------------
The memory protocol handler uses the nsIInputStreamPump to feed the
gecko engine:
rv = gCallback.mCallback->GetData(mURI, NS_STATIC_CAST(nsIChannel
*,this), mContentType, &mData, &mContentLength);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIByteArrayInputStream> stream;
rv = NS_NewByteArrayInputStream(getter_AddRefs(stream), (char *)mData,
mContentLength);
if (NS_FAILED(rv)) return rv;
mContentStream = do_QueryInterface(stream);
mListenerContext = aContext;
mListener = aListener;
nsresult rv = NS_NewInputStreamPump(getter_AddRefs(mPump),
mContentStream, -1, mContentLength, 0, 0, PR_TRUE);
if (NS_FAILED(rv)) return rv;
if (mLoadGroup)
mLoadGroup->AddRequest(this, nsnull);
rv = mPump->AsyncRead(this, nsnull);
if (NS_FAILED(rv)) return rv;
//------------------------------------------------------------
This is the call stack when the assertion occured:
xpcom.dll!nsDebugImpl::Assertion(const char * aStr=0x01d8a4d0, const
char * aExpr=0x01d8a4c4, const char * aFile=0x01d8a490, int aLine=818)
Line 290 C++
xpcom.dll!nsDebug::Assertion(const char * aStr=0x01d8a4d0, const char *
aExpr=0x01d8a4c4, const char * aFile=0x01d8a490, int aLine=818) Line
109 C++
gklayout.dll!nsGenericElement::~nsGenericElement() Line 818 + 0x26 C++
gklayout.dll!nsXMLElement::~nsXMLElement() Line 92 + 0x8 C++
gklayout.dll!nsXMLElement::`scalar deleting destructor'(unsigned int
__flags=1) + 0xf C++
gklayout.dll!nsGenericElement::Release() Line 3110 + 0xda C++
gklayout.dll!nsXMLElement::Release() Line 131 + 0xc C++
gklayout.dll!nsCOMPtr<nsIContent>::~nsCOMPtr<nsIContent>() Line 510 C++
gklayout.dll!nsXBLBinding::GenerateAnonymousContent() Line 650 + 0x57
C++
gklayout.dll!nsXBLService::LoadBindings(nsIContent *
aContent=0x0213efb0, nsIURI * aURL=0x020abc00, int aAugmentFlag=0,
nsIXBLBinding * * aBinding=0x0012dad4, int * aResolveStyle=0x0012dac0)
Line 628 C++
gklayout.dll!nsCSSFrameConstructor::ConstructFrameInternal(nsIPresShell
* aPresShell=0x0211fd80, nsPresContext * aPresContext=0x0211df48,
nsFrameConstructorState & aState={...}, nsIContent *
aContent=0x0213efb0, nsIFrame * aParentFrame=0x021af23c, nsIAtom *
aTag=0x00ca44c0, int aNameSpaceID=9, nsStyleContext *
aStyleContext=0x021af36c, nsFrameItems & aFrameItems={...}, int
aXBLBaseTag=0) Line 7394 + 0x37 C++
gklayout.dll!nsCSSFrameConstructor::ConstructFrame(nsIPresShell *
aPresShell=0x0211fd80, nsPresContext * aPresContext=0x0211df48,
nsFrameConstructorState & aState={...}, nsIContent *
aContent=0x0213efb0, nsIFrame * aParentFrame=0x021af23c, nsFrameItems &
aFrameItems={...}) Line 7351 + 0x33 C++
gklayout.dll!nsCSSFrameConstructor::ProcessChildren(nsIPresShell *
aPresShell=0x0211fd80, nsPresContext * aPresContext=0x0211df48,
nsFrameConstructorState & aState={...}, nsIContent *
aContent=0x021c6b48, nsIFrame * aFrame=0x021af23c, int
aCanHaveGeneratedContent=0, nsFrameItems & aFrameItems={...}, int
aParentIsBlock=0, nsTableCreator * aTableCreator=0x00000000) Line 11721
+ 0x42 C++
gklayout.dll!nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell
* aPresShell=0x0211fd80, nsPresContext * aPresContext=0x0211df48,
nsFrameConstructorState & aState={...}, nsIContent *
aContent=0x021c6b48, nsIFrame * aParentFrame=0x021aeb74, nsIAtom *
aTag=0x00d98e48, int aNameSpaceID=9, nsStyleContext *
aStyleContext=0x021aed1c, nsFrameItems & aFrameItems={...}, int
aXBLBaseTag=0, int & aHaltProcessing=0) Line 5728 + 0x2f C++
//---------------------------------------------------------------------
It looks as if it failed to find an insertion point and it is
in the process of bailing out. And It encountered an exception when
the nsCOMPtr of a childnode is being released.
This could not be a security issues since it has successfully loaded
serveral XBL bindings before this one.
Any help on resolving this issue is very much appreciated !!
Steve
_______________________________________________
Mozilla-netlib mailing list
Mozilla-netlib@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-netlib