JSValue jsLocationOrigin(ExecState* exec, JSValue slotBase, const Identifier&) { JSLocation* castedThis = static_cast<JSLocation*>(asObject(slotBase)); UNUSED_PARAM(exec); Location* imp = static_cast<Location*>(castedThis->impl()); JSValue result = jsString(exec, imp->origin()); #ifdef JSC_TAINTED TaintedCounter* counter = TaintedCounter::getInstance(); unsigned int tainted = counter->getCount(); result.setTainted(tainted); TaintedStructure trace_struct; trace_struct.taintedno = tainted; trace_struct.internalfunc = "jsLocationOrigin"; trace_struct.jsfunc = "location.origin"; trace_struct.action = "source"; char msg[20]; stringstream msgss; snprintf(msg, 20, "%s", result.toString(exec).utf8(true).data()); msgss << msg; msgss >> trace_struct.value; TaintedTrace* trace = TaintedTrace::getInstance(); trace->addTaintedTrace(trace_struct); #endif return result; }
JSValue JSLocation::toStringFunction(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame || !allowsAccessFromFrame(exec, frame)) return jsUndefined(); #if defined(JSC_TAINTED) JSValue s = jsString(exec, impl()->toString()); TaintedCounter* counter = TaintedCounter::getInstance(); unsigned int tainted = counter->getCount(); s.setTainted(tainted); TaintedStructure trace_struct; trace_struct.taintedno = tainted; trace_struct.internalfunc = "JSLocation::toStringFunction"; trace_struct.jsfunc = ""; trace_struct.action = "source"; trace_struct.value = TaintedUtils::UString2string(s.toString(exec)); TaintedTrace* trace = TaintedTrace::getInstance(); trace->addTaintedTrace(trace_struct); return s; #else return jsString(exec, impl()->toString()); #endif }