summaryrefslogtreecommitdiffstats
path: root/url
diff options
context:
space:
mode:
Diffstat (limited to 'url')
-rw-r--r--url/gurl.cc3
-rw-r--r--url/gurl_unittest.cc7
2 files changed, 10 insertions, 0 deletions
diff --git a/url/gurl.cc b/url/gurl.cc
index 229df5d..7997d22 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -169,6 +169,9 @@ GURL::~GURL() {
}
GURL& GURL::operator=(const GURL& other) {
+ if (&other == this)
+ return *this;
+
spec_ = other.spec_;
is_valid_ = other.is_valid_;
parsed_ = other.parsed_;
diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc
index dbf2b96..ddb55d89 100644
--- a/url/gurl_unittest.cc
+++ b/url/gurl_unittest.cc
@@ -487,3 +487,10 @@ TEST(GURLTest, IsStandard) {
GURL c("foo://bar/baz");
EXPECT_FALSE(c.IsStandard());
}
+
+// This is a regression test for http://crbug.com/309975 .
+TEST(GURLTest, SelfAssignment) {
+ GURL a("filesystem:http://example.com/temporary/");
+ // This should not crash.
+ a = a;
+}