[webkit-changes] cvs commit: WebCore/layout-tests/fast/js/resources
new-location.html
Adele
adele at opensource.apple.com
Fri Jul 15 23:17:32 PDT 2005
adele 05/07/15 23:17:32
Modified: . ChangeLog
khtml/ecma kjs_window.cpp kjs_window.h
Added: layout-tests/fast/js location-assign-expected.txt
location-assign.html
layout-tests/fast/js/resources new-location.html
Log:
Written by Anders Carlsson <andersca at mac.com>
Reviewed by Maciej.
- Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3808>
Test cases added:
* layout-tests/fast/js/location-assign.html: Added.
* layout-tests/fast/js/location-assign-expected.txt: Added.
* layout-tests/fast/js/resources/new-location.html: Added.
* khtml/ecma/kjs_window.cpp:
(KJS::Location::get):
(KJS::LocationFunc::tryCall):
* khtml/ecma/kjs_window.h: (KJS::Location::): Implement location.assign.
Revision Changes Path
1.4432 +17 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4431
retrieving revision 1.4432
diff -u -r1.4431 -r1.4432
--- ChangeLog 16 Jul 2005 05:39:21 -0000 1.4431
+++ ChangeLog 16 Jul 2005 06:17:25 -0000 1.4432
@@ -1,5 +1,22 @@
2005-07-15 Adele Peterson <adele at apple.com>
+ Written by Anders Carlsson <andersca at mac.com>
+ Reviewed by Maciej.
+
+ - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=3808>
+
+ Test cases added:
+ * layout-tests/fast/js/location-assign.html: Added.
+ * layout-tests/fast/js/location-assign-expected.txt: Added.
+ * layout-tests/fast/js/resources/new-location.html: Added.
+
+ * khtml/ecma/kjs_window.cpp:
+ (KJS::Location::get):
+ (KJS::LocationFunc::tryCall):
+ * khtml/ecma/kjs_window.h: (KJS::Location::): Implement location.assign.
+
+2005-07-15 Adele Peterson <adele at apple.com>
+
Updated layout tests for formatting changes from change for
http://bugzilla.opendarwin.org/show_bug.cgi?id=3601
1.164 +22 -1 WebCore/khtml/ecma/kjs_window.cpp
Index: kjs_window.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -r1.163 -r1.164
--- kjs_window.cpp 9 Jul 2005 20:19:05 -0000 1.163
+++ kjs_window.cpp 16 Jul 2005 06:17:31 -0000 1.164
@@ -2348,7 +2348,8 @@
const ClassInfo Location::info = { "Location", 0, 0, 0 };
/*
- at begin LocationTable 11
+ at begin LocationTable 12
+ assign Location::Assign DontDelete|Function 1
hash Location::Hash DontDelete
host Location::Host DontDelete
hostname Location::Hostname DontDelete
@@ -2432,6 +2433,8 @@
return lookupOrCreateFunction<LocationFunc>(exec,p,this,entry->value,entry->params,entry->attr);
case Reload:
return lookupOrCreateFunction<LocationFunc>(exec,p,this,entry->value,entry->params,entry->attr);
+ case Assign:
+ return lookupOrCreateFunction<LocationFunc>(exec,p,this,entry->value,entry->params,entry->attr);
}
return Undefined();
@@ -2554,6 +2557,24 @@
}
break;
}
+ case Location::Assign:
+ {
+ KHTMLPart *p = Window::retrieveActive(exec)->part();
+ if (p) {
+ const Window *window = Window::retrieveWindow(part);
+ QString dstUrl = p->xmlDocImpl()->completeURL(args[0].toString(exec).qstring());
+ if (!dstUrl.startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
+ bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
+#if APPLE_CHANGES
+ // We want a new history item if this JS was called via a user gesture
+ part->scheduleLocationChange(dstUrl, p->referrer(), !userGesture, userGesture);
+#else
+ part->scheduleLocationChange(dstUrl, p->referrer(), false /*don't lock history*/, userGesture);
+#endif
+ }
+ }
+ break;
+ }
case Location::ToString:
return String(location->toString(exec));
}
1.46 +1 -1 WebCore/khtml/ecma/kjs_window.h
Index: kjs_window.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- kjs_window.h 14 Jul 2005 04:48:44 -0000 1.45
+++ kjs_window.h 16 Jul 2005 06:17:31 -0000 1.46
@@ -226,7 +226,7 @@
virtual Value toPrimitive(ExecState *exec, Type preferred) const;
virtual UString toString(ExecState *exec) const;
enum { Hash, Href, Hostname, Host, Pathname, Port, Protocol, Search, EqualEqual,
- Replace, Reload, ToString };
+ Replace, Reload, ToString, Assign };
KHTMLPart *part() const { return m_part; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.1 WebCore/layout-tests/fast/js/location-assign-expected.txt
Index: location-assign-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderText {TEXT} at (0,0) size 608x18
text run at (0,0) width 608: "If this text is shown, that means that the document was successfully loaded using location.assign."
RenderText {TEXT} at (0,0) size 0x0
1.1 WebCore/layout-tests/fast/js/location-assign.html
Index: location-assign.html
===================================================================
<html>
<script>
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function runTests() {
window.location.assign('resources/new-location.html');
}
</script>
<body onload="runTests();">
</body>
</html>
1.1 WebCore/layout-tests/fast/js/resources/new-location.html
Index: new-location.html
===================================================================
<html>
<script>
if (window.layoutTestController)
layoutTestController.notifyDone();
</script>
<body>
If this text is shown, that means that the document was successfully loaded using location.assign.
</body>
</html>
More information about the webkit-changes
mailing list