OS:Centos 6.4 Firefox version: firefox-23.0.source
I downloaded the source code and built it and it worked well.After I modified the file js/src/jsstr.cpp,when I rum command:./firfox -new-tab url,firefox starts a new window with one blank page tab.Normally,it should open one new tab with the url.I just modified one function: template <AllowGC allowGC>JSStableString *js_NewString(JSContext *cx, jschar *chars, size_t length);I just want to get the string produced by spidermonkey ,the page url and then write to a file. ---------------------------------------------------------------------------- ---------------------------------------------------- The original code: template <AllowGC allowGC> JSStableString * js_NewString(JSContext *cx, jschar *chars, size_t length) { return JSStableString::new_<allowGC>(cx, chars, length); } ---------------------------------------------------------------------------- ---------------------------------------------------- My modified code: template <AllowGC allowGC> JSStableString * js_NewString(JSContext *cx, jschar *chars, size_t length) { JSScript * script; bool token=JS_DescribeScriptedCaller(cx,&script,NULL); if(token&&length>SHELLCODE_LENGTH) { JSObject *hypo_object=JS_GetGlobalForScopeChain(cx); //get global object whose property location.href contains webpage url if(hypo_object!=NULL) { JS::Value vp; if(JS_GetProperty(cx,hypo_object,"location",&vp)) //get location property { if(vp!=JSVAL_VOID) { if(vp.isObject()) { if(JS_GetProperty(cx,&(vp.toObject()),"href",&vp)) //get href property { if(vp!=JSVAL_VOID) { if(vp.isString()) { JSString* urlString=vp.toString(); const jschar *urlChars=urlString->getCharsZ(cx); //get string produced by spidermonkey size_t urlLength=urlString->length(); if(urlChars[urlLength-1]!=47) return; //write webpage url and string to a file ofstream out; out.open(FIFO_SERVER,ios::app|ios::binary); out.write((const char*)(&urlLength),sizeof(urlLength)); out.write((const char*)urlChars,urlLength*2); out.write((const char*)(&length),sizeof(length)); out.write((const char*)chars,length*2); out.close(); } } } } } } } } return JSStableString::new_<allowGC>(cx, chars, length); } I want to use command ./firefox -new-tab url.Unfortunately,modifying jsstr.cpp made it invalid.Could someone help me? Help!Thanks! _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals