So summarizing, I will describe here all the necessary changes to be done in 
order to get my solution working. The produced log is as that:

-------------------------------------------------------------------------------
Mon Jan 26 19:13:15 2015 | GETTER: [Style], FILE: 
[http://static.gazeta.pl/info/portal/3.2.3/portal.jsgz], PID: 
[http://pieniadze.gazeta.pl/pieniadz/1,136159,17311064,Do_frytek_z_McDonald_apos_s_w_USA_dodaja_14_substancji.html#Prze]
Mon Jan 26 19:13:23 2015 | SETTER: [SetPosition], FILE: 
[http://static.gazeta.pl/info/portal/3.2.3/portal.jsgz], PID: 
[http://pieniadze.gazeta.pl/pieniadz/1,136159,17311064,Do_frytek_z_McDonald_apos_s_w_USA_dodaja_14_substancji.html#Prze]
Mon Jan 26 19:13:18 2015 | METHOD: [NamedGetter], FILE: 
[http://static.gazeta.pl/info/portal/3.2.3/portal.jsgz], PID: 
[http://pieniadze.gazeta.pl/pieniadz/1,136159,17311064,Do_frytek_z_McDonald_apos_s_w_USA_dodaja_14_substancji.html#Prze]
-------------------------------------------------------------------------------

1. Edit "mozilla-central/dom/bindings/Codegen.py":

a) in "class CGBindingRoot(CGThing):", just after 
"bindingHeaders["xpcpublic.h"] = dictionaries", we should add:

-------------------------------------------------------------------------------
bindingHeaders["nsGlobalWindow.h"] = True
-------------------------------------------------------------------------------

b) in "def __init__", we should add the following content right before 
"self.cgRoot = CGList(cgThings)":

-------------------------------------------------------------------------------
        cgThings.append(CGGeneric('  std::string mess = __TIMESTAMP__;          
                               \n'))
        cgThings.append(CGGeneric('  mess += " | ";                             
                               \n'))

        if setter:
            cgThings.append(CGGeneric('  mess += "SETTER";                      
                               \n'))
        elif getter:
            cgThings.append(CGGeneric('  mess += "GETTER";                      
                               \n'))
        else:
            cgThings.append(CGGeneric('  mess += "METHOD";                      
                               \n'))

        cgThings.append(CGGeneric('  mess += ": [' + nativeMethodName + ']";    
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  int loopActive = 1;                        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  while (loopActive) {                       
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    JS::Rooted<JSObject*> stack(cx);         
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    if (!JS::CaptureCurrentStack(cx, &stack, 
1)) {                          \n'))
        cgThings.append(CGGeneric('      loopActive = 0;                        
                               \n'))
        cgThings.append(CGGeneric('      break;                                 
                               \n'))
        cgThings.append(CGGeneric('    }                                        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    if (!stack) {                            
                               \n'))
        cgThings.append(CGGeneric('      loopActive = 0;                        
                               \n'))
        cgThings.append(CGGeneric('      break;                                 
                               \n'))
        cgThings.append(CGGeneric('    }                                        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    JS::Rooted<JS::Value> source(cx);        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    if (!JS_GetProperty(cx, stack, "source", 
&source)) {                    \n'))
        cgThings.append(CGGeneric('      loopActive = 0;                        
                               \n'))
        cgThings.append(CGGeneric('      break;                                 
                               \n'))
        cgThings.append(CGGeneric('    }                                        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    if (source.isString()) {                 
                               \n'))
        cgThings.append(CGGeneric('      nsAutoJSString str;                    
                               \n'))
        cgThings.append(CGGeneric('      if (!str.init(cx, source.toString())) 
{                               \n'))
        cgThings.append(CGGeneric('        loopActive = 0;                      
                               \n'))
        cgThings.append(CGGeneric('        break;                               
                               \n'))
        cgThings.append(CGGeneric('      }                                      
                               \n'))
        cgThings.append(CGGeneric('      mess += ", FILE: [";                   
                               \n'))
        cgThings.append(CGGeneric('      mess += 
NS_ConvertUTF16toUTF8(str).get();                             \n'))
        cgThings.append(CGGeneric('      mess += "]";                           
                               \n'))
        cgThings.append(CGGeneric('    }                                        
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('    break;                                   
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  }                                          
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  nsPIDOMWindow* cwindow = 
xpc::WindowOrNull(JS::CurrentGlobalOrNull(cx));  \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  nsIURI* oURI = 0;                          
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  if (cwindow) {                             
                               \n'))
        cgThings.append(CGGeneric('    oURI = cwindow->GetDocumentURI();        
                               \n'))
        cgThings.append(CGGeneric('  }                                          
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  if (oURI) {                                
                               \n'))
        cgThings.append(CGGeneric('    nsCString spec;                          
                               \n'))
        cgThings.append(CGGeneric('    oURI->GetAsciiSpec(spec);                
                               \n'))
        cgThings.append(CGGeneric('    mess += ", PID: [";                      
                               \n'))
        cgThings.append(CGGeneric('    mess += spec.get();                      
                               \n'))
        cgThings.append(CGGeneric('    mess += "]";                             
                               \n'))
        cgThings.append(CGGeneric('  }                                          
                               \n'))
        cgThings.append(CGGeneric('                                             
                               \n'))
        cgThings.append(CGGeneric('  printf("%s\\n", mess.c_str());             
                               \n'))
-------------------------------------------------------------------------------

We can also use early returns instead of breaking the loop for all conditions 
except "if (!stack) { ".

2. Edit "mozilla-central/dom/base/moz.build" and add the following entry in the 
right alphabetical order to the "EXPORTS += [" list:

-------------------------------------------------------------------------------
    'nsGlobalWindow.h',
-------------------------------------------------------------------------------

3. In case of problems, remove the failing unit tests.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to