Exemple #1
0
EncodedJSValue JSC_HOST_CALL jsHTMLDocumentPrototypeFunctionWriteln(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSHTMLDocument::s_info))
        return throwVMTypeError(exec);
    JSHTMLDocument* castedThis = static_cast<JSHTMLDocument*>(asObject(thisValue));
    return JSValue::encode(castedThis->writeln(exec));
}
Exemple #2
0
EncodedJSValue JSC_HOST_CALL jsHTMLDocumentPrototypeFunctionWriteln(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSHTMLDocument::s_info))
        return throwVMTypeError(exec);
    JSHTMLDocument* castedThis = static_cast<JSHTMLDocument*>(asObject(thisValue));
#if defined(JSC_TAINTED)
    JSValue s = exec->argument(0);
    if (s.isString() && s.isTainted() > 0) {
        HTMLDocument* d1 = static_cast<HTMLDocument*>(castedThis->impl());
        d1->setTainted(s.isTainted());

	TaintedStructure trace_struct;
	trace_struct.taintedno = s.isTainted();
	trace_struct.internalfunc = "jsHTMLDocumentPrototypeFunctionWriteln";
	trace_struct.jsfunc = "document.writeln";
	trace_struct.action = "sink";
	trace_struct.value = TaintedUtils::UString2string(s.toString(exec));

	TaintedTrace* trace = TaintedTrace::getInstance();
	trace->addTaintedTrace(trace_struct);
    }
    if (s.inherits(&StringObject::s_info)) {
	unsigned int tainted = asStringObject(s)->isTainted();
        if (tainted) {
            HTMLDocument* d2 = static_cast<HTMLDocument*>(castedThis->impl());
            d2->setTainted(tainted);

	    TaintedStructure trace_struct;
	    trace_struct.taintedno = tainted;
	    trace_struct.internalfunc = "jsHTMLDocumentPrototypeFunctionWriteln";
	    trace_struct.jsfunc = "document.writeln";
	    trace_struct.action = "sink";
	    trace_struct.value = TaintedUtils::UString2string(s.toString(exec));

	    TaintedTrace* trace = TaintedTrace::getInstance();
	    trace->addTaintedTrace(trace_struct);
        }
    }
#endif
    return JSValue::encode(castedThis->writeln(exec));
}