Simulate location.search because it is not available on about: URIs

This commit is contained in:
YUKI Hiroshi 2013-08-21 13:00:38 +09:00
parent 163b14646d
commit 1170b1075a

View File

@ -62,6 +62,10 @@ GroupTab.prototype = {
{ {
return this.window && this.window.location; return this.window && this.window.location;
}, },
get locationSearch()
{
return this.location.href.replace(/^[^\?]+/, '');
},
get label() get label()
{ {
@ -79,12 +83,13 @@ GroupTab.prototype = {
get title() get title()
{ {
if (this._title === null) { if (this._title === null) {
let title = this.location.search.match(/(?:^|[\?&;])title=([^&;]*)/i); let locationSearch = this.locationSearch;
let title = locationSearch.match(/(?:^|[\?&;])title=([^&;]*)/i);
if (title) if (title)
title = title[1]; title = title[1];
// for old style URIs // for old style URIs
if (!title && !/(?:^|[\?&;])temporary=/i.test(this.location.search)) if (!title && !/(?:^|[\?&;])temporary=/i.test(locationSearch))
title = this.location.search.replace(/^\?/, ''); title = locationSearch.replace(/^\?/, '');
this._title = (title) ? this._title = (title) ?
this.trim(decodeURIComponent(title)) : this.trim(decodeURIComponent(title)) :
'' ; '' ;
@ -99,7 +104,7 @@ GroupTab.prototype = {
_title : null, _title : null,
get temporary() { get temporary() {
return /(?:^|[\?&;])temporary=(?:1|yes|true)/i.test(this.location.search); return /(?:^|[\?&;])temporary=(?:1|yes|true)/i.test(this.locationSearch);
}, },
set temporary(aValue) { set temporary(aValue) {
this._updateURI({ temporary: !!aValue }); this._updateURI({ temporary: !!aValue });