Modified: trunk/Source/_javascript_Core/ChangeLog (175705 => 175706)
--- trunk/Source/_javascript_Core/ChangeLog 2014-11-06 19:38:51 UTC (rev 175705)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-11-06 19:47:17 UTC (rev 175706)
@@ -1,3 +1,18 @@
+2014-11-06 Michael Saboff <msab...@apple.com>
+
+ REGRESSION (r174985-174986): Site display disappears
+ https://bugs.webkit.org/show_bug.cgi?id=138082
+
+ Reviewed by Geoffrey Garen.
+
+ In support of the change in WebCore, this adds a new functor class to unwind to our
+ caller's frame possibly skipping of intermediate C++ frames.
+
+ * interpreter/StackVisitor.h:
+ (JSC::CallerFunctor::CallerFunctor):
+ (JSC::CallerFunctor::callerFrame):
+ (JSC::CallerFunctor::operator()):
+
2014-11-06 Gyuyoung Kim <gyuyoung....@samsung.com>
Use std::unique_ptr in CodeBlock class
Modified: trunk/Source/_javascript_Core/interpreter/StackVisitor.h (175705 => 175706)
--- trunk/Source/_javascript_Core/interpreter/StackVisitor.h 2014-11-06 19:38:51 UTC (rev 175705)
+++ trunk/Source/_javascript_Core/interpreter/StackVisitor.h 2014-11-06 19:47:17 UTC (rev 175706)
@@ -150,6 +150,32 @@
Frame m_frame;
};
+class CallerFunctor {
+public:
+ CallerFunctor()
+ : m_hasSkippedFirstFrame(false)
+ , m_callerFrame(0)
+ {
+ }
+
+ CallFrame* callerFrame() const { return m_callerFrame; }
+
+ StackVisitor::Status operator()(StackVisitor& visitor)
+ {
+ if (!m_hasSkippedFirstFrame) {
+ m_hasSkippedFirstFrame = true;
+ return StackVisitor::Continue;
+ }
+
+ m_callerFrame = visitor->callFrame();
+ return StackVisitor::Done;
+ }
+
+private:
+ bool m_hasSkippedFirstFrame;
+ CallFrame* m_callerFrame;
+};
+
} // namespace JSC
#endif // StackVisitor_h
Modified: trunk/Source/WebCore/ChangeLog (175705 => 175706)
--- trunk/Source/WebCore/ChangeLog 2014-11-06 19:38:51 UTC (rev 175705)
+++ trunk/Source/WebCore/ChangeLog 2014-11-06 19:47:17 UTC (rev 175706)
@@ -1,3 +1,23 @@
+2014-11-06 Michael Saboff <msab...@apple.com>
+
+ REGRESSION (r174985-174986): Site display disappears
+ https://bugs.webkit.org/show_bug.cgi?id=138082
+
+ Reviewed by Geoffrey Garen.
+
+ This effectively reverts to the behavior before r174985 by using the
+ lexical global object of the caller's frame to find the active document.
+ Before r174985, native functions are invoked with the ScopeShain of their
+ caller. The lexical global object is accessed from the ScopeChain.
+
+ * bindings/js/JSHTMLDocumentCustom.cpp:
+ (WebCore::JSHTMLDocument::getOwnPropertySlot):
+ (WebCore::findOwningDocument):
+ (WebCore::documentWrite):
+ (WebCore::JSHTMLDocument::write):
+ (WebCore::JSHTMLDocument::writeln):
+ * html/HTMLDocument.idl:
+
2014-11-05 Sam Weinig <s...@webkit.org>
Use std::unique_ptr for TileController
Modified: trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp (175705 => 175706)
--- trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp 2014-11-06 19:38:51 UTC (rev 175705)
+++ trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp 2014-11-06 19:47:17 UTC (rev 175706)
@@ -41,6 +41,7 @@
#include "JSMainThreadExecState.h"
#include "SegmentedString.h"
#include "DocumentParser.h"
+#include <interpreter/StackVisitor.h>
#include <runtime/Error.h>
#include <runtime/JSCell.h>
#include <wtf/unicode/CharacterNames.h>
@@ -66,14 +67,6 @@
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionOpen, 2>);
return true;
}
- if (propertyName == "write") {
- slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionWrite, 1>);
- return true;
- }
- if (propertyName == "writeln") {
- slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionWriteln, 1>);
- return true;
- }
if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
@@ -130,6 +123,17 @@
putDirect(exec->vm(), Identifier(exec, "all"), value);
}
+static Document* findCallingDocument(ExecState* exec)
+{
+ CallerFunctor functor;
+ exec->iterate(functor);
+ CallFrame* callerFrame = functor.callerFrame();
+ if (!callerFrame)
+ return nullptr;
+
+ return asJSDOMWindow(functor.callerFrame()->lexicalGlobalObject())->impl().document();
+}
+
// Custom functions
JSValue JSHTMLDocument::open(ExecState* exec)
@@ -161,8 +165,9 @@
enum NewlineRequirement { DoNotAddNewline, DoAddNewline };
-static inline void documentWrite(ExecState* exec, HTMLDocument* document, NewlineRequirement addNewline)
+static inline void documentWrite(ExecState* exec, JSHTMLDocument* thisDocument, NewlineRequirement addNewline)
{
+ HTMLDocument* document = &thisDocument->impl();
// DOM only specifies single string argument, but browsers allow multiple or no arguments.
size_t size = exec->argumentCount();
@@ -182,19 +187,19 @@
if (addNewline)
segmentedString.append(SegmentedString(String(&newlineCharacter, 1)));
- Document* activeDocument = asJSDOMWindow(exec->lexicalGlobalObject())->impl().document();
+ Document* activeDocument = findCallingDocument(exec);
document->write(segmentedString, activeDocument);
}
JSValue JSHTMLDocument::write(ExecState* exec)
{
- documentWrite(exec, &impl(), DoNotAddNewline);
+ documentWrite(exec, this, DoNotAddNewline);
return jsUndefined();
}
JSValue JSHTMLDocument::writeln(ExecState* exec)
{
- documentWrite(exec, &impl(), DoAddNewline);
+ documentWrite(exec, this, DoAddNewline);
return jsUndefined();
}
Modified: trunk/Source/WebCore/html/HTMLDocument.idl (175705 => 175706)
--- trunk/Source/WebCore/html/HTMLDocument.idl 2014-11-06 19:38:51 UTC (rev 175705)
+++ trunk/Source/WebCore/html/HTMLDocument.idl 2014-11-06 19:47:17 UTC (rev 175706)
@@ -25,8 +25,8 @@
] interface HTMLDocument : Document {
[Custom, ForwardDeclareInHeader] void open();
void close();
- [Custom, ForwardDeclareInHeader] void write([Default=Undefined] optional DOMString text);
- [Custom, ForwardDeclareInHeader] void writeln([Default=Undefined] optional DOMString text);
+ [Custom] void write([Default=Undefined] optional DOMString text);
+ [Custom] void writeln([Default=Undefined] optional DOMString text);
readonly attribute HTMLCollection embeds;
readonly attribute HTMLCollection plugins;