亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kjs_proxy.cpp

?? It is WEB browser core module with source code. Very good!
?? CPP
字號:
// -*- c-basic-offset: 2 -*-
/*
 *  This file is part of the KDE libraries
 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "kjs_proxy.h"

#include "kjs_window.h"
#include "kjs_events.h"
#include <khtml_part.h>
#include <kprotocolmanager.h>
#include <kdebug.h>
#include <kjs/collector.h>

using namespace KJS;

extern "C" {
  KJSProxy *kjs_html_init(KHTMLPart *khtmlpart);
}

class KJSProxyImpl : public KJSProxy {
public:
  KJSProxyImpl(KHTMLPart *part);
  virtual ~KJSProxyImpl();
  virtual QVariant evaluate(QString filename, int baseLine, const QString&str, const DOM::Node &n);
  virtual void clear();
  virtual DOM::EventListener *createHTMLEventHandler(QString sourceUrl, QString code, DOM::NodeImpl *node);
  virtual void finishedWithEvent(const DOM::Event &event);
  virtual KJS::ScriptInterpreter *interpreter();

  virtual void setDebugEnabled(bool enabled);
  virtual bool paused() const;
  virtual void setSourceFile(QString url, QString code);
  virtual void appendSourceFile(QString url, QString code);

  void initScript();

private:
  KJS::ScriptInterpreter* m_script;
  bool m_debugEnabled;
#ifndef NDEBUG
  static int s_count;
#endif
};

#ifndef NDEBUG
int KJSProxyImpl::s_count = 0;
#endif

KJSProxyImpl::KJSProxyImpl(KHTMLPart *part)
{
  m_script = 0;
  m_part = part;
  m_debugEnabled = false;
#ifndef NDEBUG
  s_count++;
#endif
}

KJSProxyImpl::~KJSProxyImpl()
{
  //kdDebug() << "KJSProxyImpl::~KJSProxyImpl deleting interpreter " << m_script << endl;
  delete m_script;
#ifndef NDEBUG
  s_count--;
  // If it was the last interpreter, we should have nothing left
#ifdef KJS_DEBUG_MEM
  if ( s_count == 0 )
    Interpreter::finalCheck();
#endif
#endif
}

QVariant KJSProxyImpl::evaluate(QString filename, int baseLine,
                                const QString&str, const DOM::Node &n) {
  // evaluate code. Returns the JS return value or an invalid QVariant
  // if there was none, an error occured or the type couldn't be converted.

  initScript();
  // inlineCode is true for <a href="javascript:doSomething()">
  // and false for <script>doSomething()</script>. Check if it has the
  // expected value in all cases.
  // See smart window.open policy for where this is used.
  bool inlineCode = filename.isNull();
  //kdDebug(6070) << "KJSProxyImpl::evaluate inlineCode=" << inlineCode << endl;

#ifdef KJS_DEBUGGER
  // ###    KJSDebugWin::instance()->attach(m_script);
  if (inlineCode)
    filename = "(unknown file)";
  if (KJSDebugWin::instance())
    KJSDebugWin::instance()->setNextSourceInfo(filename,baseLine);
  //    KJSDebugWin::instance()->setMode(KJS::Debugger::Step);
#else
  Q_UNUSED(baseLine);
#endif

  m_script->setInlineCode(inlineCode);
  KJS::Value thisNode = n.isNull() ? Window::retrieve( m_part ) : getDOMNode(m_script->globalExec(),n);

  UString code( str );
  Completion comp = m_script->evaluate(filename, baseLine, code, thisNode);
  bool success = ( comp.complType() == Normal ) || ( comp.complType() == ReturnValue );  
#ifdef KJS_DEBUGGER
    //    KJSDebugWin::instance()->setCode(QString::null);
#endif

  // let's try to convert the return value
  if (success && !comp.value().isNull())
    return ValueToVariant( m_script->globalExec(), comp.value());
  else
  {
    if ( comp.complType() == Throw )
    {
        KJS::Interpreter::lock();
        UString errorMessage = comp.value().toString(m_script->globalExec());
        int lineNumber =  comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "line").toInt32(m_script->globalExec());
        UString sourceURL = comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "sourceURL").toString(m_script->globalExec());
        KJS::Interpreter::unlock();

#if APPLE_CHANGES
        KWQ(m_part)->addMessageToConsole(errorMessage.qstring(), lineNumber, sourceURL.qstring());
#else
        kdWarning(6070) << "Script threw exception: " << errorMessage.qstring() << endl;
#endif
    }
    return QVariant();
  }
}

void KJSProxyImpl::clear() {
  // clear resources allocated by the interpreter, and make it ready to be used by another page
  // We have to keep it, so that the Window object for the part remains the same.
  // (we used to delete and re-create it, previously)
  if (m_script) {
#ifdef KJS_DEBUGGER
    KJSDebugWin *debugWin = KJSDebugWin::instance();
    if (debugWin && debugWin->currentScript() == m_script) {
        debugWin->setMode(KJSDebugWin::Stop);
//        debugWin->leaveSession();
    }
#endif
    Window *win = Window::retrieveWindow(m_part);
    if (win)
        win->clear( m_script->globalExec() );
  }
}

DOM::EventListener *KJSProxyImpl::createHTMLEventHandler(QString sourceUrl, QString code, DOM::NodeImpl *node)
{
#ifdef KJS_DEBUGGER
  if (KJSDebugWin::instance())
    KJSDebugWin::instance()->setNextSourceInfo(sourceUrl,m_handlerLineno);
#else
  Q_UNUSED(sourceUrl);
#endif

  initScript();
  return KJS::Window::retrieveWindow(m_part)->getJSLazyEventListener(code,node,m_handlerLineno);
}

void KJSProxyImpl::finishedWithEvent(const DOM::Event &event)
{
  // This is called when the DOM implementation has finished with a particular event. This
  // is the case in sitations where an event has been created just for temporary usage,
  // e.g. an image load or mouse move. Once the event has been dispatched, it is forgotten
  // by the DOM implementation and so does not need to be cached still by the interpreter
  m_script->forgetDOMObject(event.handle());
}

KJS::ScriptInterpreter *KJSProxyImpl::interpreter()
{
  if (!m_script)
    initScript();
  m_part->keepAlive();
  return m_script;
}

void KJSProxyImpl::setDebugEnabled(bool enabled)
{
#ifdef KJS_DEBUGGER
  m_debugEnabled = enabled;
  if (m_script)
      m_script->setDebuggingEnabled(enabled);
  // NOTE: this is consistent across all KJSProxyImpl instances, as we only
  // ever have 1 debug window
  if (!enabled && KJSDebugWin::instance()) {
    KJSDebugWin::destroyInstance();
  }
  else if (enabled && !KJSDebugWin::instance()) {
    KJSDebugWin::createInstance();
    initScript();
    KJSDebugWin::instance()->attach(m_script);
  }
#else
  Q_UNUSED(enabled);
#endif
}

bool KJSProxyImpl::paused() const
{
#ifdef KJS_DEBUGGER
  if (KJSDebugWin::instance())
    return KJSDebugWin::instance()->inSession();
#endif
  return false;
}

void KJSProxyImpl::setSourceFile(QString url, QString code)
{
#ifdef KJS_DEBUGGER
  if (KJSDebugWin::instance())
    KJSDebugWin::instance()->setSourceFile(url,code);
#else
  Q_UNUSED(url);
  Q_UNUSED(code);
#endif

}

void KJSProxyImpl::appendSourceFile(QString url, QString code)
{
#ifdef KJS_DEBUGGER
  if (KJSDebugWin::instance())
    KJSDebugWin::instance()->appendSourceFile(url,code);
#else
  Q_UNUSED(url);
  Q_UNUSED(code);
#endif
}

// Implementation of the debug() function
class TestFunctionImp : public ObjectImp {
public:
  TestFunctionImp() : ObjectImp() {}
  virtual bool implementsCall() const { return true; }
  virtual Value call(ExecState *exec, Object &thisObj, const List &args);
};

Value TestFunctionImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
{
  fprintf(stderr,"--> %s\n",args[0].toString(exec).ascii());
  return Undefined();
}

void KJSProxyImpl::initScript()
{
  if (m_script)
    return;

  // Build the global object - which is a Window instance
  KJS::Interpreter::lock();
  Window* window = new Window(m_part); // RVCT fix
  Object globalObject( window );
  KJS::Interpreter::unlock();

  // Create a KJS interpreter for this part
  m_script = new KJS::ScriptInterpreter(globalObject, m_part);

#ifdef KJS_DEBUGGER
  m_script->setDebuggingEnabled(m_debugEnabled);
#endif
  //m_script->enableDebug();
  KJS::Interpreter::lock();
  TestFunctionImp* testFuncImpl = new TestFunctionImp();
  globalObject.put(m_script->globalExec(),
           "debug", Value(testFuncImpl), Internal);
  KJS::Interpreter::unlock();

#if APPLE_CHANGES
  QString userAgent = KWQ(m_part)->userAgent();
#else
  QString userAgent = KProtocolManager::userAgentForHost(m_part->url().host());
#endif
  if (userAgent.find(QString::fromLatin1("Microsoft")) >= 0 ||
      userAgent.find(QString::fromLatin1("MSIE")) >= 0)
    m_script->setCompatMode(Interpreter::IECompat);
  else
    // If we find "Mozilla" but not "(compatible, ...)" we are a real Netscape
    if (userAgent.find(QString::fromLatin1("Mozilla")) >= 0 &&
        userAgent.find(QString::fromLatin1("compatible")) == -1)
      m_script->setCompatMode(Interpreter::NetscapeCompat);
}

// Helper method, so that all classes which need jScript() don't need to be added
// as friend to KHTMLPart
KJSProxy * KJSProxy::proxy( KHTMLPart *part )
{
    return part->jScript();
}

// initialize HTML module
KJSProxy *kjs_html_init(KHTMLPart *khtmlpart)
{
  return new KJSProxyImpl(khtmlpart);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲激情男女视频| 99免费精品在线| 成人在线综合网| 正在播放亚洲一区| 亚洲国产精品av| 日韩综合小视频| 成人永久aaa| 欧美福利视频一区| 亚洲欧美国产高清| 国产一区二区三区精品视频| 欧美色综合网站| 国产精品女同互慰在线看| 日本vs亚洲vs韩国一区三区| 成人h动漫精品一区二| 日韩欧美精品在线视频| 亚洲高清免费在线| www.亚洲色图| 久久精品综合网| 美洲天堂一区二卡三卡四卡视频| 91视频91自| 国产女主播视频一区二区| 天天综合网 天天综合色| av一区二区三区四区| 久久久国产一区二区三区四区小说| 亚洲第一激情av| 在线观看区一区二| 亚洲乱码国产乱码精品精98午夜 | 欧美理论电影在线| 国产精品丝袜91| 国产一区二区在线电影| 欧美一级淫片007| 日韩精品亚洲一区二区三区免费| 色综合色综合色综合色综合色综合 | 欧美另类变人与禽xxxxx| 亚洲精品成人悠悠色影视| 国产精品白丝av| 337p日本欧洲亚洲大胆精品| 人禽交欧美网站| 在线电影欧美成精品| 日韩精品国产精品| 日韩女优视频免费观看| 久久99精品一区二区三区三区| 制服丝袜中文字幕一区| 日韩精品91亚洲二区在线观看| 欧美久久久久久久久久| 日韩精品1区2区3区| 欧美一区二区三级| 激情综合五月婷婷| 国产日产欧美一区二区三区| 国产精品一二三在| 国产精品色眯眯| 99re8在线精品视频免费播放| 亚洲精品国产品国语在线app| 欧美亚洲精品一区| 强制捆绑调教一区二区| 久久久久97国产精华液好用吗 | 午夜av电影一区| 欧美一级片在线看| 国产999精品久久| 亚洲美女精品一区| 欧美日韩dvd在线观看| 看电影不卡的网站| 中文字幕一区二区三区色视频| 91久久线看在观草草青青| 午夜精品久久一牛影视| 欧美一区二区三区公司| 国产福利精品一区二区| 一区二区三区精密机械公司| 欧美丰满美乳xxx高潮www| 激情五月激情综合网| 中文字幕国产一区| 欧美久久久久久久久| 国产乱码精品一区二区三区忘忧草 | 国产成人欧美日韩在线电影| 亚洲人成电影网站色mp4| 91精品国产欧美一区二区成人 | 日产欧产美韩系列久久99| 久久精品欧美一区二区三区不卡| 99久久婷婷国产精品综合| 亚洲福利一区二区三区| 欧美激情一区在线观看| 欧美精品日日鲁夜夜添| 成人免费电影视频| 亚洲大尺度视频在线观看| 久久精品免视看| 欧美猛男男办公室激情| 福利电影一区二区| 美国精品在线观看| 一区二区三区不卡在线观看| 久久影院午夜片一区| 欧美写真视频网站| 成人av在线一区二区三区| 日韩黄色一级片| 亚洲女与黑人做爰| 国产欧美一区二区精品秋霞影院| 欧美日韩一区不卡| 成人高清视频在线观看| 午夜欧美视频在线观看| 亚洲乱码日产精品bd| 日韩欧美美女一区二区三区| 欧美色网一区二区| 91猫先生在线| 99久久婷婷国产| 国产乱子伦一区二区三区国色天香| 亚洲男人电影天堂| 日本一二三四高清不卡| 久久久午夜电影| 欧美va亚洲va| 日韩一区二区三区在线观看| 欧美性色黄大片| 91美女在线视频| 91网址在线看| av动漫一区二区| 国产成人av电影在线| 国产伦精品一区二区三区免费 | 婷婷国产v国产偷v亚洲高清| 成人欧美一区二区三区1314| 国产精品欧美一区喷水| 中文字幕乱码一区二区免费| 国产区在线观看成人精品| 国产欧美日韩综合| 日本一区二区三区在线不卡 | 国产精品久久久久久久浪潮网站| 久久综合色婷婷| 国产午夜精品久久| 久久久久久久久久久99999| 久久久午夜精品| 国产精品你懂的| 樱花草国产18久久久久| 亚洲男人天堂一区| 午夜欧美视频在线观看| 日本成人超碰在线观看| 日本va欧美va精品发布| 麻豆传媒一区二区三区| 国产一区二区不卡在线| 成人免费av资源| 91影视在线播放| 91久久线看在观草草青青| 欧美日韩视频专区在线播放| 欧美一区二区三区视频| 久久影院午夜片一区| 中文字幕亚洲在| 亚洲国产视频a| 蜜臀av性久久久久蜜臀aⅴ流畅| 六月丁香综合在线视频| 国产成a人亚洲精品| 欧美婷婷六月丁香综合色| 这里是久久伊人| 久久久久9999亚洲精品| 亚洲私人黄色宅男| 亚洲成人在线观看视频| 国产在线日韩欧美| 91在线精品一区二区三区| 欧美日韩视频在线第一区 | 久久毛片高清国产| 中文字幕在线一区二区三区| 亚洲午夜久久久久| 国产精品伊人色| 欧美色涩在线第一页| 久久综合一区二区| 亚洲高清视频在线| 国产91富婆露脸刺激对白 | 色琪琪一区二区三区亚洲区| 欧美日韩黄色一区二区| 中文字幕+乱码+中文字幕一区| 亚洲自拍都市欧美小说| 精品亚洲国产成人av制服丝袜| 99精品黄色片免费大全| 精品乱码亚洲一区二区不卡| 综合激情成人伊人| 国产一区视频网站| 宅男在线国产精品| 亚洲视频1区2区| 国产剧情一区二区| 在线电影国产精品| 亚洲一区二区四区蜜桃| 国产宾馆实践打屁股91| 日韩视频免费直播| 亚洲精品日产精品乱码不卡| 国产精品一区二区无线| 欧美一区二区三区思思人| 亚洲欧美日本韩国| 大胆亚洲人体视频| 久久久久久电影| 麻豆一区二区在线| 欧美精品日韩一本| 亚洲一区二区三区三| 不卡视频免费播放| 国产亚洲欧美中文| 久久不见久久见免费视频7| 欧美天堂亚洲电影院在线播放| 国产精品久久久久久亚洲毛片| 精品一区二区在线免费观看| 欧美一区二区三区免费视频| 亚洲一区成人在线| 欧美色精品在线视频| 亚洲精品视频在线| 99在线视频精品| 国产精品白丝在线| 成人精品一区二区三区中文字幕|