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 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 BeforeUnloadEvent* before_unload_event = BeforeUnloadEvent::Create(); | 3164 BeforeUnloadEvent* before_unload_event = BeforeUnloadEvent::Create(); |
3165 before_unload_event->initEvent(EventTypeNames::beforeunload, false, true); | 3165 before_unload_event->initEvent(EventTypeNames::beforeunload, false, true); |
3166 load_event_progress_ = kBeforeUnloadEventInProgress; | 3166 load_event_progress_ = kBeforeUnloadEventInProgress; |
3167 dom_window_->DispatchEvent(before_unload_event, this); | 3167 dom_window_->DispatchEvent(before_unload_event, this); |
3168 load_event_progress_ = kBeforeUnloadEventCompleted; | 3168 load_event_progress_ = kBeforeUnloadEventCompleted; |
3169 if (!before_unload_event->defaultPrevented()) | 3169 if (!before_unload_event->defaultPrevented()) |
3170 DefaultEventHandler(before_unload_event); | 3170 DefaultEventHandler(before_unload_event); |
3171 if (!GetFrame() || before_unload_event->returnValue().IsNull()) | 3171 if (!GetFrame() || before_unload_event->returnValue().IsNull()) |
3172 return true; | 3172 return true; |
3173 | 3173 |
| 3174 if (!GetFrame()->HasReceivedUserGesture()) { |
| 3175 AddConsoleMessage(ConsoleMessage::Create( |
| 3176 kJSMessageSource, kErrorMessageLevel, |
| 3177 "Blocked attempt to show a 'beforeunload' confirmation panel for a " |
| 3178 "frame that never had a user gesture since its load. " |
| 3179 "https://www.chromestatus.com/feature/5082396709879808")); |
| 3180 return true; |
| 3181 } |
| 3182 |
3174 if (did_allow_navigation) { | 3183 if (did_allow_navigation) { |
3175 AddConsoleMessage(ConsoleMessage::Create( | 3184 AddConsoleMessage(ConsoleMessage::Create( |
3176 kJSMessageSource, kErrorMessageLevel, | 3185 kJSMessageSource, kErrorMessageLevel, |
3177 "Blocked attempt to show multiple 'beforeunload' confirmation panels " | 3186 "Blocked attempt to show multiple 'beforeunload' confirmation panels " |
3178 "for a single navigation.")); | 3187 "for a single navigation.")); |
3179 return true; | 3188 return true; |
3180 } | 3189 } |
3181 | 3190 |
3182 String text = before_unload_event->returnValue(); | 3191 String text = before_unload_event->returnValue(); |
3183 if (chrome_client.OpenBeforeUnloadConfirmPanel(text, frame_, is_reload)) { | 3192 if (chrome_client.OpenBeforeUnloadConfirmPanel(text, frame_, is_reload)) { |
(...skipping 3597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6781 } | 6790 } |
6782 | 6791 |
6783 void showLiveDocumentInstances() { | 6792 void showLiveDocumentInstances() { |
6784 WeakDocumentSet& set = liveDocumentSet(); | 6793 WeakDocumentSet& set = liveDocumentSet(); |
6785 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6794 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6786 for (blink::Document* document : set) | 6795 for (blink::Document* document : set) |
6787 fprintf(stderr, "- Document %p URL: %s\n", document, | 6796 fprintf(stderr, "- Document %p URL: %s\n", document, |
6788 document->Url().GetString().Utf8().data()); | 6797 document->Url().GetString().Utf8().data()); |
6789 } | 6798 } |
6790 #endif | 6799 #endif |
OLD | NEW |