webengine/osswebengine/WebCore/bindings/js/kjs_proxy.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
    52     // Check for <rdar://problem/4876466>. In theory, no JS should be executing
    52     // Check for <rdar://problem/4876466>. In theory, no JS should be executing
    53     // in our interpreter. 
    53     // in our interpreter. 
    54     ASSERT(!m_script || !m_script->context());
    54     ASSERT(!m_script || !m_script->context());
    55     
    55     
    56     if (m_script) {
    56     if (m_script) {
       
    57         ((JSDOMWindow*)m_globalObject)->clear();
    57         m_script = 0;
    58         m_script = 0;
    58     
    59     
    59         // It's likely that destroying the interpreter has created a lot of garbage.
    60         // It's likely that destroying the interpreter has created a lot of garbage.
    60         gcController().garbageCollectSoon();
    61         gcController().garbageCollectSoon();
    61     }
    62     }
   149   if (m_script)
   150   if (m_script)
   150     return;
   151     return;
   151 
   152 
   152   // Build the global object - which is a Window instance
   153   // Build the global object - which is a Window instance
   153   JSLock lock;
   154   JSLock lock;
   154   JSObject* globalObject = new JSDOMWindow(m_frame->domWindow());
   155   m_globalObject = new JSDOMWindow(m_frame->domWindow());
   155 
   156   
   156   // Create a KJS interpreter for this frame
   157   // Create a KJS interpreter for this frame
   157   m_script = new ScriptInterpreter(globalObject, m_frame);
   158   m_script = new ScriptInterpreter(m_globalObject, m_frame);
   158 
   159 
   159   String userAgent = m_frame->loader()->userAgent(m_frame->document() ? m_frame->document()->URL() : KURL());
   160   String userAgent = m_frame->loader()->userAgent(m_frame->document() ? m_frame->document()->URL() : KURL());
   160   if (userAgent.find("Microsoft") >= 0 || userAgent.find("MSIE") >= 0)
   161   if (userAgent.find("Microsoft") >= 0 || userAgent.find("MSIE") >= 0)
   161     m_script->setCompatMode(Interpreter::IECompat);
   162     m_script->setCompatMode(Interpreter::IECompat);
   162   else
   163   else