Skip to content
This repository
Browse code

reset history when resetting session

  • Loading branch information...
commit eaec9792b370ca0a133acdbb16ed7bb65dad7898 1 parent 5eacd08
Marc Schwieterman authored February 05, 2012 halogenandtoast committed February 17, 2012
5  spec/driver_spec.rb
@@ -211,6 +211,11 @@
211 211
       subject.find("//*[contains(., 'hello')]").should be_empty
212 212
     end
213 213
 
  214
+    it "has a location of 'about:blank' after reseting" do
  215
+      subject.reset!
  216
+      subject.current_url.should == "about:blank"
  217
+    end
  218
+
214 219
     it "raises an error for an invalid xpath query" do
215 220
       expect { subject.find("totally invalid salad") }.
216 221
         to raise_error(Capybara::Driver::Webkit::WebkitInvalidResponseError, /xpath/i)
7  src/Reset.cpp
@@ -16,6 +16,13 @@ void Reset::start(QStringList &arguments) {
16 16
   page()->setUserAgent(NULL);
17 17
   page()->resetResponseHeaders();
18 18
   page()->resetConsoleMessages();
  19
+  resetHistory();
19 20
   emit finished(new Response(true));
20 21
 }
21 22
 
  23
+void Reset::resetHistory() {
  24
+  // Clearing the history preserves the current history item, so set it to blank first.
  25
+  page()->currentFrame()->setUrl(QUrl("about:blank"));
  26
+  page()->history()->clear();
  27
+}
  28
+
3  src/Reset.h
@@ -8,5 +8,8 @@ class Reset : public Command {
8 8
   public:
9 9
     Reset(WebPage *page, QObject *parent = 0);
10 10
     virtual void start(QStringList &arguments);
  11
+
  12
+  private:
  13
+    void resetHistory();
11 14
 };
12 15
 

0 notes on commit eaec979

Please sign in to comment.
Something went wrong with that request. Please try again.