Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4372 const AtomicString& Document::referrer() const { | 4372 const AtomicString& Document::referrer() const { |
| 4373 if (loader()) | 4373 if (loader()) |
| 4374 return loader()->request().httpReferrer(); | 4374 return loader()->request().httpReferrer(); |
| 4375 return nullAtom; | 4375 return nullAtom; |
| 4376 } | 4376 } |
| 4377 | 4377 |
| 4378 String Document::domain() const { | 4378 String Document::domain() const { |
| 4379 return getSecurityOrigin()->domain(); | 4379 return getSecurityOrigin()->domain(); |
| 4380 } | 4380 } |
| 4381 | 4381 |
| 4382 void Document::setDomain(const String& newDomain, | 4382 void Document::setDomain(const String& rawDomain, |
| 4383 ExceptionState& exceptionState) { | 4383 ExceptionState& exceptionState) { |
| 4384 UseCounter::count(*this, UseCounter::DocumentSetDomain); | 4384 UseCounter::count(*this, UseCounter::DocumentSetDomain); |
| 4385 | 4385 |
| 4386 if (isSandboxed(SandboxDocumentDomain)) { | 4386 if (isSandboxed(SandboxDocumentDomain)) { |
| 4387 exceptionState.throwSecurityError( | 4387 exceptionState.throwSecurityError( |
| 4388 "Assignment is forbidden for sandboxed iframes."); | 4388 "Assignment is forbidden for sandboxed iframes."); |
| 4389 return; | 4389 return; |
| 4390 } | 4390 } |
| 4391 | 4391 |
| 4392 if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme( | 4392 if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme( |
| 4393 getSecurityOrigin()->protocol())) { | 4393 getSecurityOrigin()->protocol())) { |
| 4394 exceptionState.throwSecurityError("Assignment is forbidden for the '" + | 4394 exceptionState.throwSecurityError("Assignment is forbidden for the '" + |
| 4395 getSecurityOrigin()->protocol() + | 4395 getSecurityOrigin()->protocol() + |
| 4396 "' scheme."); | 4396 "' scheme."); |
| 4397 return; | 4397 return; |
| 4398 } | 4398 } |
| 4399 | 4399 |
| 4400 bool success = false; | |
| 4401 String newDomain = SecurityOrigin::canonicalizeHost(rawDomain, &success); | |
| 4402 if (!success) { | |
| 4403 exceptionState.throwSecurityError("'" + rawDomain + | |
| 4404 "' could not be parsed properly."); | |
|
Mike West
2016/10/27 07:30:35
Can you add a layout test that runs through `docum
| |
| 4405 return; | |
| 4406 } | |
| 4407 | |
| 4400 if (newDomain.isEmpty()) { | 4408 if (newDomain.isEmpty()) { |
| 4401 exceptionState.throwSecurityError("'" + newDomain + | 4409 exceptionState.throwSecurityError("'" + newDomain + |
| 4402 "' is an empty domain."); | 4410 "' is an empty domain."); |
| 4403 return; | 4411 return; |
| 4404 } | 4412 } |
| 4405 | 4413 |
| 4406 OriginAccessEntry accessEntry(getSecurityOrigin()->protocol(), newDomain, | 4414 OriginAccessEntry accessEntry(getSecurityOrigin()->protocol(), newDomain, |
| 4407 OriginAccessEntry::AllowSubdomains); | 4415 OriginAccessEntry::AllowSubdomains); |
| 4408 OriginAccessEntry::MatchResult result = | 4416 OriginAccessEntry::MatchResult result = |
| 4409 accessEntry.matchesOrigin(*getSecurityOrigin()); | 4417 accessEntry.matchesOrigin(*getSecurityOrigin()); |
| (...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6410 } | 6418 } |
| 6411 | 6419 |
| 6412 void showLiveDocumentInstances() { | 6420 void showLiveDocumentInstances() { |
| 6413 WeakDocumentSet& set = liveDocumentSet(); | 6421 WeakDocumentSet& set = liveDocumentSet(); |
| 6414 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6422 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6415 for (Document* document : set) | 6423 for (Document* document : set) |
| 6416 fprintf(stderr, "- Document %p URL: %s\n", document, | 6424 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6417 document->url().getString().utf8().data()); | 6425 document->url().getString().utf8().data()); |
| 6418 } | 6426 } |
| 6419 #endif | 6427 #endif |
| OLD | NEW |