Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tommy Webb
Tor Browser
Commits
74ec746b
Commit
74ec746b
authored
11 years ago
by
Shane Caraveo
Browse files
Options
Downloads
Patches
Plain Diff
Bug 936712 - Open marks panel on first click if user not logged in. r=markh, a=bajaj
parent
ee1e09da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
browser/base/content/socialmarks.xml
+1
-3
1 addition, 3 deletions
browser/base/content/socialmarks.xml
browser/base/content/test/social/browser_social_marks.js
+64
-1
64 additions, 1 deletion
browser/base/content/test/social/browser_social_marks.js
with
65 additions
and
4 deletions
browser/base/content/socialmarks.xml
+
1
−
3
View file @
74ec746b
...
...
@@ -145,11 +145,10 @@
<body>
<![CDATA[
// we always set the src on click if it has not been set for this tab,
// but we only want to open the panel if it was previously annotated.
let openPanel = this.isMarked || aOpenPanel;
let openPanel = this.isMarked || aOpenPanel
|| !this.provider.haveLoggedInUser()
;
let src = this.getAttribute("src");
if (!src || src == "about:blank") {
this.loadPanel();
this.isMarked = true;
}
if (openPanel)
this.panel.openPopup(this, "bottomcenter topright", 0, 0, false, false);
...
...
@@ -170,7 +169,6 @@
// previous url when it is closed.
this.setAttribute("src", "about:blank");
this.loadPanel({ url: aUrl });
this.isMarked = true;
this.panel.openPopup(this, "bottomcenter topright", 0, 0, false, false);
this.panel.addEventListener("popuphidden", function _hidden() {
this.panel.removeEventListener("popuphidden", _hidden);
...
...
This diff is collapsed.
Click to expand it.
browser/base/content/test/social/browser_social_marks.js
+
64
−
1
View file @
74ec746b
...
...
@@ -199,6 +199,7 @@ var tests = {
EventUtils
.
synthesizeMouseAtCenter
(
btn
,
{});
// wait for the button to be marked, click to open panel
waitForCondition
(
function
()
btn
.
isMarked
,
function
()
{
is
(
btn
.
panel
.
state
,
"
closed
"
,
"
panel should not be visible yet
"
);
EventUtils
.
synthesizeMouseAtCenter
(
btn
,
{});
},
"
button is marked
"
);
break
;
...
...
@@ -214,7 +215,69 @@ var tests = {
// page should no longer be marked
port
.
close
();
waitForCondition
(
function
()
!
btn
.
isMarked
,
function
()
{
// after closing the addons tab, verify provider is still installed
// cleanup after the page has been unmarked
gBrowser
.
tabContainer
.
addEventListener
(
"
TabClose
"
,
function
onTabClose
()
{
gBrowser
.
tabContainer
.
removeEventListener
(
"
TabClose
"
,
onTabClose
);
executeSoon
(
function
()
{
ok
(
btn
.
disabled
,
"
button is disabled
"
);
next
();
});
});
gBrowser
.
removeTab
(
tab
);
},
"
button unmarked
"
);
}
break
;
}
};
port
.
postMessage
({
topic
:
"
test-init
"
});
});
},
testMarkPanelLoggedOut
:
function
(
next
)
{
// click on panel to open and wait for visibility
let
provider
=
Social
.
_getProviderFromOrigin
(
manifest2
.
origin
);
ok
(
provider
.
enabled
,
"
provider is enabled
"
);
let
id
=
"
social-mark-button-
"
+
provider
.
origin
;
let
btn
=
document
.
getElementById
(
id
)
ok
(
btn
,
"
got a mark button
"
);
let
port
=
provider
.
getWorkerPort
();
ok
(
port
,
"
got a port
"
);
// verify markbutton is disabled when there is no browser url
ok
(
btn
.
disabled
,
"
button is disabled
"
);
let
activationURL
=
manifest2
.
origin
+
"
/browser/browser/base/content/test/social/social_activate.html
"
addTab
(
activationURL
,
function
(
tab
)
{
ok
(
!
btn
.
disabled
,
"
button is enabled
"
);
port
.
onmessage
=
function
(
e
)
{
let
topic
=
e
.
data
.
topic
;
switch
(
topic
)
{
case
"
test-init-done
"
:
ok
(
true
,
"
test-init-done received
"
);
ok
(
provider
.
profile
.
userName
,
"
profile was set by test worker
"
);
port
.
postMessage
({
topic
:
"
test-logout
"
});
waitForCondition
(
function
()
!
provider
.
profile
.
userName
,
function
()
{
// when the provider has not indicated to us that a user is
// logged in, the first click opens the page.
EventUtils
.
synthesizeMouseAtCenter
(
btn
,
{});
},
"
profile was unset by test worker
"
);
break
;
case
"
got-social-panel-visibility
"
:
ok
(
true
,
"
got the panel message
"
+
e
.
data
.
result
);
if
(
e
.
data
.
result
==
"
shown
"
)
{
// our test marks the page during the load event (see
// social_mark.html) regardless of login state, unmark the page
// via the button in the page
let
doc
=
btn
.
contentDocument
;
let
unmarkBtn
=
doc
.
getElementById
(
"
unmark
"
);
ok
(
unmarkBtn
,
"
got the panel unmark button
"
);
EventUtils
.
sendMouseEvent
({
type
:
"
click
"
},
unmarkBtn
,
btn
.
contentWindow
);
}
else
{
// page should no longer be marked
port
.
close
();
waitForCondition
(
function
()
!
btn
.
isMarked
,
function
()
{
// cleanup after the page has been unmarked
gBrowser
.
tabContainer
.
addEventListener
(
"
TabClose
"
,
function
onTabClose
()
{
gBrowser
.
tabContainer
.
removeEventListener
(
"
TabClose
"
,
onTabClose
);
executeSoon
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment