From b00a3cd4e4b279b075e7786d850f63dacdd9ee98 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Dec 2010 13:37:05 -0800 Subject: [PATCH 1/2] Make sure the UUIDs are unique too :) --- tests/UUIDTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/UUIDTest.php b/tests/UUIDTest.php index de256ffa1f..e78d5ce1bc 100644 --- a/tests/UUIDTest.php +++ b/tests/UUIDTest.php @@ -21,5 +21,17 @@ class UUIDTest extends PHPUnit_Framework_TestCase $this->assertEquals(0x4000, hexdec(substr($result, 14, 4)) & 0xF000); $this->assertEquals(0x8000, hexdec(substr($result, 19, 4)) & 0xC000); } + + public function testUnique() + { + $reps = 100; + $ids = array(); + + for ($i = 0; $i < $reps; $i++) { + $ids[] = UUID::gen(); + } + + $this->assertEquals(count($ids), count(array_unique($ids)), "UUIDs must be unique"); + } } From b71a09a1a9a8eedcd0e2214c5c998b0707a2ee70 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Dec 2010 16:14:41 -0800 Subject: [PATCH 2/2] Tweak the post-form return on bookmarklet if we're not in a popup that we can close --- plugins/Bookmark/bookmarkpopup.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/Bookmark/bookmarkpopup.js b/plugins/Bookmark/bookmarkpopup.js index 29f314ed06..4904b07e24 100644 --- a/plugins/Bookmark/bookmarkpopup.js +++ b/plugins/Bookmark/bookmarkpopup.js @@ -2,6 +2,13 @@ $(document).ready( function() { var form = $('#form_new_bookmark'); form.append(''); + function doClose() { + self.close(); + // If in popup blocker situation, we'll have to redirect back. + setTimeout(function() { + window.location = $('#url').val(); + }, 100); + } form.ajaxForm({dataType: 'xml', timeout: '60000', beforeSend: function(formData) { @@ -11,12 +18,12 @@ $(document).ready( error: function (xhr, textStatus, errorThrown) { form.removeClass('processing'); form.find('#submit').removeClass('disabled'); - self.close(); + doClose(); }, success: function(data, textStatus) { form.removeClass('processing'); form.find('#submit').removeClass('disabled'); - self.close(); + doClose(); }}); }