summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-03 18:26:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-07 10:54:12 +0100
commit602d1efed4671fd2289be1fbe4a2811a5fff6143 (patch)
tree2239bd809a68432ed7da346ebaf94d9aed4fdbd9 /examples
parent813320a2d5304923613796bf795f43f258a84a13 (diff)
downloadqtwebkit-examples-602d1efed4671fd2289be1fbe4a2811a5fff6143.tar.gz
Simplify regexp usage
JS has built-in support for regular expressions, so we don't need to allocate a new RegExp object for each resource request. Change-Id: I7d669252ab60264dc6c7c45de3b7f5c9f74c9158 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/flickrview/flickrview.qml3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/qml/flickrview/flickrview.qml b/examples/qml/flickrview/flickrview.qml
index a188a85..6592864 100644
--- a/examples/qml/flickrview/flickrview.qml
+++ b/examples/qml/flickrview/flickrview.qml
@@ -229,7 +229,6 @@ Rectangle {
}
onNavigationRequested: {
- var pattern = new RegExp('^(https|http)://www.flickr.com|^(https|http)://login.yahoo.com');
switch (request.navigationType)
{
case WebView.LinkClickedNavigation:
@@ -238,7 +237,7 @@ Rectangle {
case WebView.ReloadNavigation:
case WebView.FormResubmittedNavigation:
case WebView.OtherNavigation:
- if (pattern.test(request.url)) {
+ if (/^(https|http):\/\/(www\.flickr\.com|login\.yahoo\.com)/.test(request.url)) {
request.action = WebView.AcceptRequest
return
}