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 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3064 BeforeUnloadEvent* beforeUnloadEvent = BeforeUnloadEvent::create(); | 3064 BeforeUnloadEvent* beforeUnloadEvent = BeforeUnloadEvent::create(); |
| 3065 beforeUnloadEvent->initEvent(EventTypeNames::beforeunload, false, true); | 3065 beforeUnloadEvent->initEvent(EventTypeNames::beforeunload, false, true); |
| 3066 m_loadEventProgress = BeforeUnloadEventInProgress; | 3066 m_loadEventProgress = BeforeUnloadEventInProgress; |
| 3067 m_domWindow->dispatchEvent(beforeUnloadEvent, this); | 3067 m_domWindow->dispatchEvent(beforeUnloadEvent, this); |
| 3068 m_loadEventProgress = BeforeUnloadEventCompleted; | 3068 m_loadEventProgress = BeforeUnloadEventCompleted; |
| 3069 if (!beforeUnloadEvent->defaultPrevented()) | 3069 if (!beforeUnloadEvent->defaultPrevented()) |
| 3070 defaultEventHandler(beforeUnloadEvent); | 3070 defaultEventHandler(beforeUnloadEvent); |
| 3071 if (!frame() || beforeUnloadEvent->returnValue().isNull()) | 3071 if (!frame() || beforeUnloadEvent->returnValue().isNull()) |
| 3072 return true; | 3072 return true; |
| 3073 | 3073 |
| 3074 if (!frame()->hasReceivedUserGesture()) { | |
|
Charlie Reis
2017/04/10 06:20:11
Sanity check: Does this mean the frame has receive
Avi (use Gerrit)
2017/05/05 15:30:04
This is actually about the document, not the frame
| |
| 3075 addConsoleMessage(ConsoleMessage::create( | |
| 3076 JSMessageSource, ErrorMessageLevel, | |
| 3077 "Blocked attempt to show a 'beforeunload' confirmation panel for a " | |
| 3078 "frame that never had a user gesture since its load. " | |
| 3079 "https://www.chromestatus.com/feature/5082396709879808")); | |
| 3080 return true; | |
| 3081 } | |
| 3082 | |
| 3074 if (didAllowNavigation) { | 3083 if (didAllowNavigation) { |
| 3075 addConsoleMessage(ConsoleMessage::create( | 3084 addConsoleMessage(ConsoleMessage::create( |
| 3076 JSMessageSource, ErrorMessageLevel, | 3085 JSMessageSource, ErrorMessageLevel, |
| 3077 "Blocked attempt to show multiple 'beforeunload' confirmation panels " | 3086 "Blocked attempt to show multiple 'beforeunload' confirmation panels " |
| 3078 "for a single navigation.")); | 3087 "for a single navigation.")); |
| 3079 return true; | 3088 return true; |
| 3080 } | 3089 } |
| 3081 | 3090 |
| 3082 String text = beforeUnloadEvent->returnValue(); | 3091 String text = beforeUnloadEvent->returnValue(); |
| 3083 if (chromeClient.openBeforeUnloadConfirmPanel(text, m_frame, isReload)) { | 3092 if (chromeClient.openBeforeUnloadConfirmPanel(text, m_frame, isReload)) { |
| (...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6651 } | 6660 } |
| 6652 | 6661 |
| 6653 void showLiveDocumentInstances() { | 6662 void showLiveDocumentInstances() { |
| 6654 WeakDocumentSet& set = liveDocumentSet(); | 6663 WeakDocumentSet& set = liveDocumentSet(); |
| 6655 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6656 for (blink::Document* document : set) | 6665 for (blink::Document* document : set) |
| 6657 fprintf(stderr, "- Document %p URL: %s\n", document, | 6666 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6658 document->url().getString().utf8().data()); | 6667 document->url().getString().utf8().data()); |
| 6659 } | 6668 } |
| 6660 #endif | 6669 #endif |
| OLD | NEW |