On Thursday, September 19, 2013 10:06:30 AM UTC+5:30, vasuyad...@gmail.com wrote: > Hi > > > > We are facing problem with our Add-ons support for FireFox 24.Firefox is > crashing. In earlier approach we was using 'JS_GetGlobalObject' to get global > object from docShell. > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_GetGlobalObject?redirectlocale=en-US&redirectslug=SpiderMonkey%2FJSAPI_Reference%2FJS_GetGlobalObject > > > > > As per given above link- I should use use JS_GetGlobalForObject or > JS_GetGlobalForScopeChain instead of JS_GetGlobalObject. I tried both of them > and additionally I tried GetNativeGlobal(), GetGlobalJSObject() . but none of > them work out. Firefox is crashing in all the cases . > > > > Could anybody help me for this issue? what are required changes need to fix > this problem. I have paste code for yours reference. > > > > > > > > bool CFFGBrowser::GetJSGlobalContextAndWindow(nsIDocShell *docShell, > JSContext **jsContext, > > > > jsval &window) > > > > { > > > > bool isSuccess = false; > > > > nsresult rv; > > > > > > do > > > > { > > > > nsCOMPtr< nsIScriptGlobalObject > scriptObj = do_GetInterface( docShell, &rv > ); > > > > > > if( NS_FAILED( rv ) ) > > > > { > > > > break; > > > > } > > > > nsCOMPtr< nsIScriptContext > scriptContext = scriptObj->GetContext(); > > > > if ( !scriptContext ) > > > > { > > > > break; > > > > } > > > > *jsContext = static_cast<JSContext*>( scriptContext->GetNativeContext()); > > > > //JSObject *globalObj1 = scriptContext->GetNativeGlobal(); > > > > JSObject *globalObj = scriptObj->GetGlobalJSObject(); > > > > CLogFile::Info(111, "CFFGBrowser::GetJSGlobalContextAndObject -start...3.2."); > > > > //JSObject *globalObj = JS_GetArrayPrototype(*jsContext,globalObj1); > > > > //JS::Rooted<JSObject*> globalObj(*jsContext, > JS_GetGlobalForScopeChain(*jsContext)); > > > > //JS::RootedObject*globalObj =static_cast<JSObject*>( > scriptContext->GetNativeGlobal()); > > > > //JSObject *globalObj2 = JS_GetGlobalForScopeChain(*jsContext); > > > > > > > > //JSObject *globalObj3 = JS_GetGlobalForObject(*jsContext,globalObj2); > > > > //JSObject *globalObj = JS_GetGlobalForScopeChain(scriptContext); > > > > if ( !jsContext ) > > > > { > > > > break; > > > > } > > > > > > if (!globalObj ) > > > > { > > > > break; > > > > } > > > > JSBool isSucceeded = JS_GetProperty( *jsContext, globalObj, "window", &window > ); > > > > if ( ( isSucceeded != JS_TRUE ) || ( window == JSVAL_VOID ) ) > > > > { > > > > break; > > > > } > > > > jsval jsargs[1]; > > //jsval jscaptureSSLText = JSVAL_NULL, rval = JSVAL_NULL; > > jsval rval = JSVAL_NULL; > > jsargs[0] = INT_TO_JSVAL(0); > > //JS::HandleValue captureSSLVal = JS::RootedValue(jsContext, > jscaptureSSLText); > > JS::RootedValue captureSSLVal(*jsContext, jsargs[0]); > > JS::RootedValue windowVal(*jsContext, window); > > JS::RootedObject windowObj (*jsContext, JSVAL_TO_OBJECT(window)); > > //JS_CallFunctionName > > JSBool isSucceededd = JS_CallFunctionName(*jsContext, > > globalObj, > > "KeynoteCaptureSSLText", > > 1, > > jsargs, > > &rval); > > isSuccess = true; > > > > }while(false); > > > > return isSuccess; > > > > } > > > > > > > > Regards > > > > Vasu
Hi Based on my understanding, I need to create a JS XPCOM component apart from the existing C++ XPCOM component I already have. All the JavaScript function calls need to be made from JS XPCOM component. How will the C++ XPCOM and JS XPCOM communicate to each other? Can we instantiate JS XPCOM component from C++ XPCOM Component? I want to deliver only one .xpi to my customers. I hope it is possible to package both C++ XPCOM and JS XPCOM components in the same .xpi file. Please let me know if this is possible and whether you see any problems in this approach. Regards Vasu _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform